mcpserver

package
v0.0.0-...-80cee1a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver implements the MCP tool surface for reverie's memory system. It registers tools with the MCP SDK server and delegates to the memory store and embedding provider for recall, write, reinforce, forget, and list operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyJudgmentInput

type ApplyJudgmentInput struct {
	RecallID  string    `json:"recall_id" jsonschema:"the recall_id returned by memory_recall"`
	Verdicts  []Verdict `json:"verdicts" jsonschema:"per-candidate keep/drop verdicts from the memory-judge subagent"`
	SessionID string    `json:"session_id,omitempty" jsonschema:"attach this call to a session; buffer updates on recall/write/reinforce"`
}

ApplyJudgmentInput is the input schema for the memory_apply_judgment tool.

type ApplyJudgmentOutput

type ApplyJudgmentOutput struct {
	Memories     []MemoryRefResp `json:"memories"`
	AppliedLogic string          `json:"applied_logic"` // "OR" or "AND"
}

ApplyJudgmentOutput is the output schema for the memory_apply_judgment tool.

type ClusterMeta

type ClusterMeta struct {
	Summary   string `json:"summary,omitempty"`
	Domain    string `json:"domain,omitempty"`
	MetaInstr string `json:"meta_instr,omitempty"`
}

ClusterMeta carries optional L1 metadata to apply to each new cluster created by memory_split_cluster. All fields are optional.

type DecayTickInput

type DecayTickInput struct {
	Note string `json:"note,omitempty" jsonschema:"optional log annotation"`

	// Deprecated-rejected: these fields were removed in Phase 3C. Setting
	// either returns an error. Do not read these values elsewhere.
	TurnsElapsed int  `json:"turns_elapsed,omitempty" jsonschema:"removed in Phase 3C; setting returns an error"`
	SessionEnd   bool `json:"session_end,omitempty" jsonschema:"removed in Phase 3C; setting returns an error"`
}

DecayTickInput is the input schema for the memory_decay_tick tool.

Phase 3C: turns_elapsed and session_end were removed because they had no effect on behavior. They are retained here solely to detect callers that still send the old shape so we can return an explicit error naming the removed flags — the MCP SDK's JSON decoder silently drops unknown fields, so pure deletion would leave callers with a confusing no-op. The Note field is purely an optional audit annotation; it does not influence the tick.

type DecayTickOutput

type DecayTickOutput struct {
	Ticked bool `json:"ticked"`
}

DecayTickOutput is the output schema for the memory_decay_tick tool.

type EdgeAddInput

type EdgeAddInput struct {
	SrcID    string   `json:"src_id" jsonschema:"source memory ID (fact, episode, or entity)"`
	DstID    string   `json:"dst_id" jsonschema:"destination memory ID"`
	EdgeType string   `json:"edge_type" jsonschema:"free-form; canonical types in README"`
	Weight   *float64 `json:"weight,omitempty" jsonschema:"default 1.0"`
}

EdgeAddInput is the input schema for the memory_edge_add tool.

type EdgeAddOutput

type EdgeAddOutput struct {
	SrcID    string  `json:"src_id"`
	DstID    string  `json:"dst_id"`
	EdgeType string  `json:"edge_type"`
	Weight   float64 `json:"weight"`
	Created  bool    `json:"created"`
}

EdgeAddOutput is the output schema for the memory_edge_add tool.

type EdgeDetail

type EdgeDetail struct {
	OtherID        string  `json:"other_id"`
	OtherLayer     string  `json:"other_layer"`
	EdgeType       string  `json:"edge_type"`
	Weight         float64 `json:"weight"`
	Distance       int     `json:"distance"`
	ContentPreview string  `json:"content_preview"`
}

EdgeDetail describes a single edge from the perspective of the seed memory. OtherID is the endpoint that BFS reached at this depth — at hops=1 it is the non-seed endpoint of the single edge row; at hops>=2 the seed itself no longer participates directly, and OtherID is the newly-reached node (i.e., the endpoint that was not already in the visited set at the moment BFS emitted this row).

type EdgeListInput

type EdgeListInput struct {
	MemoryID string `json:"memory_id" jsonschema:"fact, episode, or entity ID"`
	Hops     int    `json:"hops,omitempty" jsonschema:"1..3, default 1"`
}

EdgeListInput is the input schema for the memory_edge_list tool.

type EdgeListOutput

type EdgeListOutput struct {
	MemoryID string       `json:"memory_id"`
	Layer    string       `json:"layer"`
	Edges    []EdgeDetail `json:"edges"`
}

EdgeListOutput is the output schema for the memory_edge_list tool.

type EdgeRemoveInput

type EdgeRemoveInput struct {
	SrcID    string `json:"src_id" jsonschema:"source memory ID"`
	DstID    string `json:"dst_id" jsonschema:"destination memory ID"`
	EdgeType string `json:"edge_type" jsonschema:"edge type label"`
}

EdgeRemoveInput is the input schema for the memory_edge_remove tool.

type EdgeRemoveOutput

type EdgeRemoveOutput struct {
	Deleted bool `json:"deleted"`
}

EdgeRemoveOutput is the output schema for the memory_edge_remove tool.

type EntityMentionInput

type EntityMentionInput struct {
	MemoryID  string   `json:"memory_id" jsonschema:"fact or episode ID"`
	EntityIDs []string `json:"entity_ids" jsonschema:"one or more entity IDs"`
	Role      string   `json:"role,omitempty" jsonschema:"advisory: subject/object/mention"`
}

EntityMentionInput is the input schema for the memory_entity_mention tool.

type EntityMentionOutput

type EntityMentionOutput struct {
	Inserted int `json:"inserted"`
}

EntityMentionOutput is the output schema for the memory_entity_mention tool.

type EntityNeighborsInput

type EntityNeighborsInput struct {
	EntityID string `json:"entity_id" jsonschema:"seed entity ID"`
	Hops     int    `json:"hops,omitempty" jsonschema:"1..3, default 1"`
}

EntityNeighborsInput is the input schema for the memory_entity_neighbors tool.

type EntityNeighborsOutput

type EntityNeighborsOutput struct {
	EntityID string              `json:"entity_id"`
	Memories []NeighborMemoryOut `json:"memories"`
	Entities []NeighborEntityOut `json:"entities"`
}

EntityNeighborsOutput is the output schema for the memory_entity_neighbors tool.

type EntityUpsertInput

type EntityUpsertInput struct {
	Name       string `json:"name" jsonschema:"entity name"`
	EntityType string `json:"entity_type" jsonschema:"file/repo/library/concept/person/command/..."`
}

EntityUpsertInput is the input schema for the memory_entity_upsert tool.

type EntityUpsertOutput

type EntityUpsertOutput struct {
	EntityID            string `json:"entity_id"`
	Created             bool   `json:"created"`
	MatchedBySimilarity bool   `json:"matched_by_similarity"`
}

EntityUpsertOutput is the output schema for the memory_entity_upsert tool.

type EpisodePayload

type EpisodePayload struct {
	Situation     string   `json:"situation" jsonschema:"what triggered this episode"`
	Action        string   `json:"action" jsonschema:"what was done"`
	Outcome       string   `json:"outcome" jsonschema:"what happened as a result"`
	Preemptive    string   `json:"preemptive" jsonschema:"actionable lesson: what to do next time"`
	LinkedFactIDs []string `json:"linked_fact_ids,omitempty" jsonschema:"fact IDs this episode cross-references"`
}

EpisodePayload is the structured input for writing an L3 episodic memory.

type ForgetCandidate

type ForgetCandidate struct {
	ID      string `json:"id"`
	Content string `json:"content"`
	Layer   string `json:"layer"`
}

ForgetCandidate is a candidate returned for confirmation when query is used.

type ForgetFailure

type ForgetFailure struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

ForgetFailure describes a per-ID failure during a batch forget.

type ForgetInput

type ForgetInput struct {
	ID    string   `json:"id,omitempty" jsonschema:"ID of a specific memory to delete"`
	IDs   []string `json:"ids,omitempty" jsonschema:"Batch delete multiple memories by ID"`
	Query string   `json:"query,omitempty" jsonschema:"Query to find candidates for deletion (returns candidates without deleting)"`
}

ForgetInput is the input schema for the memory_forget tool.

type ForgetOutput

type ForgetOutput struct {
	Deleted    int               `json:"deleted"`
	Failed     []ForgetFailure   `json:"failed,omitempty"`
	Candidates []ForgetCandidate `json:"candidates,omitempty"`
}

ForgetOutput is the output schema for the memory_forget tool.

type GetInput

type GetInput struct {
	ID string `json:"id" jsonschema:"memory ID (fact or episode)"`
}

GetInput is the input schema for the memory_get tool.

type GetOutput

type GetOutput struct {
	ID             string   `json:"id"`
	Layer          string   `json:"layer"` // "l2_semantic" or "l3_episodic"
	Content        string   `json:"content"`
	Subtype        string   `json:"subtype,omitempty"`
	Source         string   `json:"source,omitempty"`
	Confidence     float64  `json:"confidence,omitempty"`
	Tags           []string `json:"tags"`
	ClusterID      string   `json:"cluster_id"`
	ClusterSummary string   `json:"cluster_summary,omitempty"`
	CreatedAt      string   `json:"created_at"`
	AccessedAt     string   `json:"accessed_at"`
	// Fact-only fields.
	ValidFrom    string   `json:"valid_from,omitempty"`
	SupersededBy *string  `json:"superseded_by,omitempty"`
	Supersedes   []string `json:"supersedes,omitempty"`
	// Cross-type links.
	Links []LinkRef `json:"links,omitempty"`
	// Episode-only fields.
	Situation  string `json:"situation,omitempty"`
	Action     string `json:"action,omitempty"`
	Outcome    string `json:"outcome,omitempty"`
	Preemptive string `json:"preemptive,omitempty"`
}

GetOutput is the output schema for the memory_get tool. It is the full single-record view: basic fields, fact-only supersede chain, episode-only structured fields, and cross-type links.

type LinkRef

type LinkRef struct {
	ID       string `json:"id"`
	Layer    string `json:"layer"`
	LinkType string `json:"link_type"`
}

LinkRef is a cross-type link reference returned by memory_get.

type ListInput

type ListInput struct {
	Layer   string   `json:"layer,omitempty" jsonschema:"l2 (default, facts) or l3 (episodes)"`
	Subtype string   `json:"subtype,omitempty" jsonschema:"Filter by subtype: user, feedback, project, reference"`
	Limit   int      `json:"limit,omitempty" jsonschema:"Maximum number of results (default 25)"`
	Offset  int      `json:"offset,omitempty" jsonschema:"Number of results to skip (for pagination)"`
	Sort    string   `json:"sort,omitempty" jsonschema:"Sort order: created (default) or accessed"`
	TagsAny []string `json:"tags_any,omitempty" jsonschema:"Filter to memories with at least one of these tags"`
}

ListInput is the input schema for the memory_list tool.

type ListMemory

type ListMemory struct {
	ID         string   `json:"id"`
	Content    string   `json:"content"`
	Layer      string   `json:"layer"`
	Subtype    string   `json:"subtype,omitempty"`
	Source     string   `json:"source,omitempty"`
	Confidence float64  `json:"confidence,omitempty"`
	CreatedAt  string   `json:"created_at"`
	AccessedAt string   `json:"accessed_at"`
	ClusterID  string   `json:"cluster_id"`
	Tags       []string `json:"tags,omitempty"`
}

ListMemory is a memory entry in the list result, without the embedding vector to avoid bloating the tool response.

type ListOutput

type ListOutput struct {
	Memories []ListMemory `json:"memories"`
}

ListOutput is the output schema for the memory_list tool.

type MemoryRefResp

type MemoryRefResp struct {
	ID         string  `json:"id"`
	Content    string  `json:"content"`
	Layer      string  `json:"layer"`
	Subtype    string  `json:"subtype"`
	Similarity float32 `json:"similarity"`
	Retention  float64 `json:"retention"`
}

MemoryRefResp is a memory reference in the apply judgment output, without embeddings.

type MergeClustersInput

type MergeClustersInput struct {
	SourceClusterIDs []string `json:"source_cluster_ids" jsonschema:"clusters to merge and delete (must be non-empty)"`
	TargetClusterID  string   `json:"target_cluster_id" jsonschema:"destination cluster (must exist, cannot be in source list)"`
}

MergeClustersInput is the input schema for the memory_merge_clusters tool.

type MergeClustersOutput

type MergeClustersOutput struct {
	TargetClusterID string   `json:"target_cluster_id"`
	MergedCount     int      `json:"merged_count"`
	DeletedClusters []string `json:"deleted_clusters"`
	NewItemCount    int      `json:"new_item_count"`
}

MergeClustersOutput is the output schema for the memory_merge_clusters tool.

type NeighborEntityOut

type NeighborEntityOut struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	EntityType string `json:"entity_type"`
	Distance   int    `json:"distance"`
}

NeighborEntityOut is an entity neighbor returned by memory_entity_neighbors.

type NeighborMemoryOut

type NeighborMemoryOut struct {
	ID             string `json:"id"`
	Layer          string `json:"layer"`
	ContentPreview string `json:"content_preview"`
	Distance       int    `json:"distance"`
}

NeighborMemoryOut is a memory neighbor returned by memory_entity_neighbors.

type ReassignClusterInput

type ReassignClusterInput struct {
	MemoryID        string `json:"memory_id" jsonschema:"fact or episode ID"`
	TargetClusterID string `json:"target_cluster_id" jsonschema:"destination cluster ID (must exist)"`
}

ReassignClusterInput is the input schema for the memory_reassign_cluster tool.

type ReassignClusterOutput

type ReassignClusterOutput struct {
	MemoryID          string `json:"memory_id"`
	OldClusterID      string `json:"old_cluster_id"`
	NewClusterID      string `json:"new_cluster_id"`
	OldClusterDeleted bool   `json:"old_cluster_deleted"`
}

ReassignClusterOutput is the output schema for the memory_reassign_cluster tool.

type RecallCandidate

type RecallCandidate struct {
	ID         string   `json:"id"`
	Content    string   `json:"content"`
	Layer      string   `json:"layer"`
	Subtype    string   `json:"subtype,omitempty"`
	Similarity float32  `json:"similarity"`
	Retention  float64  `json:"retention"`
	GateBPass  bool     `json:"gate_b_pass"`
	GateCPass  bool     `json:"gate_c_pass"`
	LinkedIDs  []string `json:"linked_ids,omitempty"`
	ClusterID  string   `json:"cluster_id"`
	Tags       []string `json:"tags,omitempty"`

	// Distance: 0 for vector hits, >=1 for graph-expanded neighbors.
	Distance int `json:"distance"`

	// CompositeScore: the final ranking score. For vector hits this equals
	// Similarity. For graph hits it is seed_similarity * neighbor_retention
	// * (decay_per_hop ^ Distance), taking the MAX across seeds when the
	// neighbor is reachable from multiple seeds.
	CompositeScore float64 `json:"composite_score"`
}

RecallCandidate is a single candidate in the recall result.

type RecallInput

type RecallInput struct {
	Query     string   `json:"query" jsonschema:"Natural-language query to search memories"`
	Limit     int      `json:"limit,omitempty" jsonschema:"Maximum number of results (default 10)"`
	Hints     []string `json:"hints,omitempty" jsonschema:"Optional hint strings to augment the query"`
	Round     int      `json:"round,omitempty" jsonschema:"Recall round: 0 for OR-logic (default); 1+ for AND-logic refinement"`
	ClusterID string   `json:"cluster_id,omitempty" jsonschema:"restrict to members of this cluster"`
	Subtype   string   `json:"subtype,omitempty" jsonschema:"restrict to this fact subtype"`
	Layer     string   `json:"layer,omitempty" jsonschema:"l2, l3, or both (default)"`
	TagsAny   []string `json:"tags_any,omitempty" jsonschema:"restrict to memories with any of these tags"`
	SessionID string   `json:"session_id,omitempty" jsonschema:"attach this call to a session; buffer updates on recall/write/reinforce"`

	// ExpandViaGraph: when true and round==0, recall additionally walks
	// memory_edges and entity_mentions from the vector seeds to surface
	// graph neighbors. Default false. Ignored on round>=1.
	ExpandViaGraph bool `json:"expand_via_graph,omitempty" jsonschema:"opt-in graph expansion on top of vector recall"`

	// GraphHops: BFS depth budget for graph expansion. Clamped to [1,3].
	// Defaults to 2 when ExpandViaGraph is true. Memory->entity->memory
	// counts as 2 hops.
	GraphHops int `json:"graph_hops,omitempty" jsonschema:"BFS depth for graph expansion (1..3, default 2)"`
}

RecallInput is the input schema for the memory_recall tool.

type RecallOutput

type RecallOutput struct {
	RecallID   string            `json:"recall_id"`
	Round      int               `json:"round"`
	Candidates []RecallCandidate `json:"candidates"`
}

RecallOutput is the output schema for the memory_recall tool.

type ReinforceInput

type ReinforceInput struct {
	MemoryIDs []string `json:"memory_ids" jsonschema:"IDs of memories to reinforce"`
	SessionID string   `json:"session_id,omitempty" jsonschema:"attach this call to a session; buffer updates on recall/write/reinforce"`
}

ReinforceInput is the input schema for the memory_reinforce tool.

type ReinforceOutput

type ReinforceOutput struct {
	Reinforced int `json:"reinforced"`
}

ReinforceOutput is the output schema for the memory_reinforce tool.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps the MCP SDK server and wires tool handlers to the memory store, embedding provider, decayer, and memory manager. It is the main entry point for the reverie MCP surface.

func NewServer

func NewServer(store memory.Store, embedder embed.EmbeddingProvider, decayer decay.Decayer, mgr manager.MemoryManager, assigner cluster.Assigner, cfg *config.Config, logger *slog.Logger) *Server

NewServer creates a configured MCP server with all tools registered. If logger is nil, a discard logger is used.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run constructs the MCP SDK server, registers all Phase 1 tools, and runs over stdio. It blocks until the context is cancelled or the client disconnects.

type SessionEndInput

type SessionEndInput struct {
	SessionID string          `json:"session_id" jsonschema:"session to close"`
	Episode   *EpisodePayload `json:"episode,omitempty" jsonschema:"if set, write an L3 episode summarizing the session"`
	// EpisodeType lets the caller choose the subtype for the summary episode.
	// Defaults to "feedback" when unset — the best default for retrospective
	// "here's what we learned" tuples. Facts-only taxonomy values are rejected
	// downstream by writeEpisode's handleWrite wrapper.
	EpisodeType string   `json:"episode_type,omitempty" jsonschema:"subtype for the optional summary episode (default: feedback)"`
	EpisodeTags []string `json:"episode_tags,omitempty" jsonschema:"extra tags to apply to the summary episode; session:<id> is always added"`
}

SessionEndInput is the input schema for memory_session_end.

type SessionEndOutput

type SessionEndOutput struct {
	SessionID      string `json:"session_id"`
	EpisodeID      string `json:"episode_id,omitempty"`
	ClustersTicked int    `json:"clusters_ticked"`
}

SessionEndOutput is the output schema for memory_session_end.

type SessionInitInput

type SessionInitInput struct {
	SessionID   string   `json:"session_id" jsonschema:"stable session identifier (client-generated)"`
	ProjectHint string   `json:"project_hint,omitempty" jsonschema:"freeform hint describing the project scope (replaces on resume if non-empty)"`
	Tags        []string `json:"tags,omitempty" jsonschema:"tags to associate with this session (merged with existing tags on resume)"`
}

SessionInitInput is the input schema for memory_session_init.

type SessionInitOutput

type SessionInitOutput struct {
	SessionID   string             `json:"session_id"`
	Created     bool               `json:"created"`
	Buffer      []memory.MemoryRef `json:"buffer"`
	ProjectHint string             `json:"project_hint"`
	Tags        []string           `json:"tags"`
	CreatedAt   string             `json:"created_at"`
	ClosedAt    *string            `json:"closed_at,omitempty"`
}

SessionInitOutput is the output schema for memory_session_init.

type SessionRestoreInput

type SessionRestoreInput struct {
	SessionID string `json:"session_id" jsonschema:"session to load"`
}

SessionRestoreInput is the input schema for memory_session_restore.

type SessionRestoreOutput

type SessionRestoreOutput struct {
	Buffer      []memory.MemoryRef `json:"buffer"`
	ProjectHint string             `json:"project_hint"`
	Tags        []string           `json:"tags"`
	UpdatedAt   string             `json:"updated_at"`
	ClosedAt    *string            `json:"closed_at,omitempty"`
}

SessionRestoreOutput is the output schema for memory_session_restore.

type SessionSnapshotInput

type SessionSnapshotInput struct {
	SessionID string `json:"session_id" jsonschema:"session to checkpoint"`
}

SessionSnapshotInput is the input schema for memory_session_snapshot.

type SessionSnapshotOutput

type SessionSnapshotOutput struct {
	Persisted bool   `json:"persisted"`
	UpdatedAt string `json:"updated_at"`
}

SessionSnapshotOutput is the output schema for memory_session_snapshot.

type SplitClusterInput

type SplitClusterInput struct {
	ClusterID string        `json:"cluster_id" jsonschema:"cluster to split (must exist)"`
	Groups    [][]string    `json:"groups" jsonschema:"non-overlapping partitions; each group becomes a new cluster"`
	Metas     []ClusterMeta `` /* 148-byte string literal not displayed */
}

SplitClusterInput is the input schema for the memory_split_cluster tool.

type SplitClusterOutput

type SplitClusterOutput struct {
	SourceClusterID   string   `json:"source_cluster_id"`
	NewClusterIDs     []string `json:"new_cluster_ids"`
	SourceDeleted     bool     `json:"source_deleted"`
	RemainingInSource int      `json:"remaining_in_source"`
}

SplitClusterOutput is the output schema for the memory_split_cluster tool.

type SupersedeCandidate

type SupersedeCandidate struct {
	ID         string  `json:"id"`
	Content    string  `json:"content"`
	Similarity float32 `json:"similarity"`
	Subtype    string  `json:"subtype"`
	CreatedAt  string  `json:"created_at"`
}

SupersedeCandidate describes the existing fact that a proposed write would supersede. Populated only for fact dry-runs when a near-duplicate exists above the configured conflict threshold.

type UnsupersedeInput

type UnsupersedeInput struct {
	FactID string `json:"fact_id" jsonschema:"ID of the superseded fact to revive"`
}

UnsupersedeInput is the input schema for the memory_unsupersede tool.

type UnsupersedeOutput

type UnsupersedeOutput struct {
	FactID                 string `json:"fact_id"`
	PreviouslySupersededBy string `json:"previously_superseded_by"`
	// Warning is populated when the formerly-superseding fact is still
	// active (its superseded_by is nil); the operator has two coexisting
	// facts and should decide how to reconcile them.
	Warning string `json:"warning,omitempty"`
}

UnsupersedeOutput is the output schema for the memory_unsupersede tool.

type UpdateClusterInput

type UpdateClusterInput struct {
	ClusterID string `json:"cluster_id" jsonschema:"the cluster ID to update"`
	Summary   string `json:"summary,omitempty" jsonschema:"new summary for the cluster"`
	Domain    string `json:"domain,omitempty" jsonschema:"domain label (e.g. go-patterns, user-prefs)"`
	MetaInstr string `json:"meta_instr,omitempty" jsonschema:"meta-instruction (e.g. when dealing with X, always do Y)"`
}

UpdateClusterInput is the input schema for the memory_update_cluster tool.

type UpdateClusterOutput

type UpdateClusterOutput struct {
	ID        string  `json:"id"`
	Summary   string  `json:"summary"`
	Domain    string  `json:"domain"`
	MetaInstr string  `json:"meta_instr"`
	ItemCount int     `json:"item_count"`
	Utility   float64 `json:"utility"`
	Frequency float64 `json:"frequency"`
}

UpdateClusterOutput is the output schema for the memory_update_cluster tool.

type UpdateContentInput

type UpdateContentInput struct {
	ID      string          `json:"id" jsonschema:"fact or episode ID"`
	Content string          `json:"content,omitempty" jsonschema:"new content (for facts)"`
	Episode *EpisodePayload `json:"episode,omitempty" jsonschema:"new episode fields (for episodes); omit linked_fact_ids to preserve existing"`
	Tags    *[]string       `json:"tags,omitempty" jsonschema:"replace tags; omit to preserve"`
}

UpdateContentInput is the input schema for the memory_update_content tool.

Tags is a tri-state pointer: nil preserves the current tag set; a non-nil pointer replaces it (an explicit empty slice clears tags). This mirrors the Phase 2D spec.

type UpdateContentOutput

type UpdateContentOutput struct {
	ID         string `json:"id"`
	Layer      string `json:"layer"`
	Reembedded bool   `json:"reembedded"`
}

UpdateContentOutput is the output schema for the memory_update_content tool.

type Verdict

type Verdict struct {
	MemoryID string `json:"memory_id"`
	Keep     bool   `json:"keep"`
	Reason   string `json:"reason,omitempty"`
}

Verdict is a single keep/drop verdict from the memory-judge subagent.

type WriteInput

type WriteInput struct {
	Content    string          `json:"content,omitempty" jsonschema:"The content of the memory (required for L2 facts)"`
	Type       string          `json:"type" jsonschema:"Memory subtype: user, feedback, project, or reference"`
	Tags       []string        `json:"tags,omitempty" jsonschema:"Optional tags for categorization"`
	Source     string          `json:"source,omitempty" jsonschema:"Source attribution (default: inferred)"`
	Confidence *float64        `json:"confidence,omitempty" jsonschema:"Confidence in [0,1]; defaults to 1.0. Facts only — rejected for episodes."`
	Episode    *EpisodePayload `json:"episode,omitempty" jsonschema:"if set, writes an L3 episode instead of an L2 fact"`
	DryRun     bool            `json:"dry_run,omitempty" jsonschema:"if true, preview cluster assignment and supersede candidate without writing"`
	SessionID  string          `json:"session_id,omitempty" jsonschema:"attach this call to a session; buffer updates on recall/write/reinforce"`
}

WriteInput is the input schema for the memory_write tool.

type WriteOutput

type WriteOutput struct {
	ID      string        `json:"id,omitempty"`
	Layer   string        `json:"layer"`
	DryRun  bool          `json:"dry_run"`
	Preview *WritePreview `json:"preview,omitempty"`
}

WriteOutput is the output schema for the memory_write tool.

type WritePreview

type WritePreview struct {
	ProposedClusterID    string              `json:"proposed_cluster_id"`
	ProposedClusterIsNew bool                `json:"proposed_cluster_is_new"`
	ProposedSupersedes   *SupersedeCandidate `json:"proposed_supersedes,omitempty"`
	ContentHash          string              `json:"content_hash"`
}

WritePreview describes what a memory_write would do when DryRun=true. It is populated only on dry-run responses; committed writes leave Preview nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL