Documentation
¶
Overview ¶
Package memoryflow provides a higher-level workflow facade on top of CortexDB's memory, knowledge, and KnowledgeMemory primitives.
The package is intended for applications that want "memory system" behavior rather than direct database primitives. It focuses on:
- transcript ingest as episodic memory exchanges
- deterministic taxonomy and project conventions
- layered wake-up context assembly
- session-close promotion into durable knowledge
- diary and reply-protocol helpers
LLM-dependent behavior is exposed through interfaces:
- QueryPlanner
- SessionExtractor
- PromotionPolicy
This keeps the package usable in fully deterministic mode while allowing applications to plug in planner and extraction logic when needed.
Index ¶
- Constants
- func DefaultConfigPath(projectRoot string) string
- func SaveConfig(path string, cfg ProjectConfig) error
- type CloseSessionRequest
- type CloseSessionResponse
- type ConventionRule
- type ConventionSet
- type DefaultPromotionPolicy
- type DiaryEntryRequest
- type DiaryEntryResponse
- type DiaryListRequest
- type DiaryListResponse
- type Episode
- type GetTranscriptRequest
- type GetTranscriptResponse
- type HeuristicExtractor
- type IngestTranscriptRequest
- type IngestTranscriptResponse
- type ListEpisodesRequest
- type ListEpisodesResponse
- type MCPServerOptions
- type MemoryEdit
- type MemoryEditGenerator
- type MemoryEditOptions
- type MemoryEditPlan
- type MemoryEditReport
- type Option
- func WithConventions(conventions ConventionSet) Option
- func WithExtractor(extractor SessionExtractor) Option
- func WithPlanner(planner QueryPlanner) Option
- func WithProjectConfig(cfg ProjectConfig) Option
- func WithPromotionPolicy(policy PromotionPolicy) Option
- func WithRecallStrategy(strategy RecallStrategy) Option
- type PassthroughRecallStrategy
- type ProjectConfig
- type PromotionCandidate
- type PromotionKind
- type PromotionPolicy
- type ProtocolStep
- type QueryPlanner
- type RecallFunc
- type RecallRequest
- type RecallResponse
- type RecallStrategy
- type ReplyProtocolRequest
- type ReplyProtocolResponse
- type Service
- func (s *Service) AppendDiaryEntry(ctx context.Context, req DiaryEntryRequest) (*DiaryEntryResponse, error)
- func (s *Service) CloseSession(ctx context.Context, req CloseSessionRequest) (*CloseSessionResponse, error)
- func (s *Service) GetTranscript(ctx context.Context, req GetTranscriptRequest) (*GetTranscriptResponse, error)
- func (s *Service) IngestTranscript(ctx context.Context, req IngestTranscriptRequest) (*IngestTranscriptResponse, error)
- func (s *Service) ListDiaryEntries(ctx context.Context, req DiaryListRequest) (*DiaryListResponse, error)
- func (s *Service) ListEpisodes(ctx context.Context, req ListEpisodesRequest) (*ListEpisodesResponse, error)
- func (s *Service) NewMCPServer(opts MCPServerOptions) (*mcp.Server, error)
- func (s *Service) PrepareReply(ctx context.Context, req ReplyProtocolRequest) (*ReplyProtocolResponse, error)
- func (s *Service) Recall(ctx context.Context, req RecallRequest) (*RecallResponse, error)
- func (s *Service) ResolveTaxonomy(base Taxonomy, hint SourceHint) Taxonomy
- func (s *Service) WakeUp(ctx context.Context, req WakeUpRequest) (*WakeUpResponse, error)
- func (s *Service) WakeUpLayers(ctx context.Context, req WakeUpLayersRequest) (*WakeUpLayersResponse, error)
- type SessionExtractor
- type SessionState
- type SourceHint
- type Taxonomy
- type Toolbox
- type Transcript
- type TranscriptTurn
- type WakeUpLayer
- type WakeUpLayersRequest
- type WakeUpLayersResponse
- type WakeUpLevel
- type WakeUpRequest
- type WakeUpResponse
Constants ¶
const ( MemoryEditOpAdd = "add" // MemoryEditOpUpdate rewrites a memory in place. Use it when the earlier // wording was wrong; use supersede when the earlier statement was true then // and is not true now, so the history is worth keeping. MemoryEditOpUpdate = "update" // MemoryEditOpSupersede retires a memory in favour of a new one. MemoryEditOpSupersede = "supersede" )
const DefaultConfigFilename = ".cortexdb-memoryflow.json"
DefaultConfigFilename is the default project-local memoryflow config file.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
DefaultConfigPath returns the default config path for a project root.
func SaveConfig ¶
func SaveConfig(path string, cfg ProjectConfig) error
SaveConfig writes a project config to disk.
Types ¶
type CloseSessionRequest ¶
type CloseSessionRequest struct {
Transcript Transcript `json:"transcript"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
State SessionState `json:"state,omitempty"`
Promote bool `json:"promote,omitempty"`
Collection string `json:"collection,omitempty"`
Author string `json:"author,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
CloseSessionRequest optionally promotes extracted knowledge at session end.
type CloseSessionResponse ¶
type CloseSessionResponse struct {
Promotions []cortexdb.KnowledgeRecord `json:"promotions,omitempty"`
Count int `json:"count"`
}
CloseSessionResponse reports promotions created at session close.
type ConventionRule ¶
type ConventionRule struct {
MatchSource string `json:"match_source,omitempty"`
PathContainsAny []string `json:"path_contains_any,omitempty"`
TitleContainsAny []string `json:"title_contains_any,omitempty"`
Wing string `json:"wing,omitempty"`
Room string `json:"room,omitempty"`
Kind string `json:"kind,omitempty"`
AddTags []string `json:"add_tags,omitempty"`
}
ConventionRule applies deterministic taxonomy defaults when its conditions match.
type ConventionSet ¶
type ConventionSet struct {
Project string `json:"project,omitempty"`
DefaultWing string `json:"default_wing,omitempty"`
DefaultRoom string `json:"default_room,omitempty"`
DefaultKind string `json:"default_kind,omitempty"`
Rules []ConventionRule `json:"rules,omitempty"`
}
ConventionSet is the project-level deterministic taxonomy policy.
func DefaultConventionSet ¶
func DefaultConventionSet(project string) ConventionSet
DefaultConventionSet returns pragmatic defaults for a project-scoped memory workflow.
type DefaultPromotionPolicy ¶
type DefaultPromotionPolicy struct{}
DefaultPromotionPolicy keeps high-signal categories and drops generic notes by default.
func (DefaultPromotionPolicy) Select ¶
func (DefaultPromotionPolicy) Select(_ context.Context, _ Transcript, _ SessionState, candidates []PromotionCandidate) ([]PromotionCandidate, error)
Select filters promotion candidates using a deterministic allowlist.
type DiaryEntryRequest ¶
type DiaryEntryRequest struct {
EntryID string `json:"entry_id,omitempty"`
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Taxonomy Taxonomy `json:"taxonomy,omitempty"`
PathHint string `json:"path_hint,omitempty"`
Content string `json:"content"`
Metadata map[string]any `json:"metadata,omitempty"`
Importance float64 `json:"importance,omitempty"`
}
DiaryEntryRequest appends one workflow diary entry.
type DiaryEntryResponse ¶
type DiaryEntryResponse struct {
Entry cortexdb.MemoryRecord `json:"entry"`
}
DiaryEntryResponse returns the stored diary memory record.
type DiaryListRequest ¶
type DiaryListRequest struct {
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Limit int `json:"limit,omitempty"`
}
DiaryListRequest lists diary entries for a resolved bucket.
type DiaryListResponse ¶
type DiaryListResponse struct {
Entries []cortexdb.MemoryRecord `json:"entries"`
}
DiaryListResponse returns chronological diary entries.
type Episode ¶
type Episode struct {
Memory cortexdb.MemoryRecord `json:"memory"`
ExchangeIndex int `json:"exchange_index,omitempty"`
Taxonomy Taxonomy `json:"taxonomy,omitempty"`
Turns []TranscriptTurn `json:"turns,omitempty"`
}
Episode is one stored exchange-shaped memory record plus reconstructed turns.
type GetTranscriptRequest ¶
type GetTranscriptRequest struct {
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Limit int `json:"limit,omitempty"`
}
GetTranscriptRequest reconstructs the original transcript for a resolved bucket.
type GetTranscriptResponse ¶
type GetTranscriptResponse struct {
Transcript Transcript `json:"transcript"`
Episodes []Episode `json:"episodes"`
}
GetTranscriptResponse returns the reconstructed transcript and its backing episodes.
type HeuristicExtractor ¶
type HeuristicExtractor struct{}
HeuristicExtractor extracts a small set of durable facts without an LLM.
func (HeuristicExtractor) Extract ¶
func (HeuristicExtractor) Extract(_ context.Context, transcript Transcript, state SessionState) ([]PromotionCandidate, error)
Extract scans transcript text for simple preference/decision/milestone/problem signals.
type IngestTranscriptRequest ¶
type IngestTranscriptRequest struct {
Transcript Transcript `json:"transcript"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Wing string `json:"wing,omitempty"`
Room string `json:"room,omitempty"`
Tags []string `json:"tags,omitempty"`
Taxonomy Taxonomy `json:"taxonomy,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
IngestTranscriptRequest stores a transcript as episodic memory exchanges.
func (IngestTranscriptRequest) State ¶
func (req IngestTranscriptRequest) State() SessionState
type IngestTranscriptResponse ¶
type IngestTranscriptResponse struct {
MemoryIDs []string `json:"memory_ids"`
Count int `json:"count"`
}
IngestTranscriptResponse summarizes the stored episodic memories.
type ListEpisodesRequest ¶
type ListEpisodesRequest struct {
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Limit int `json:"limit,omitempty"`
}
ListEpisodesRequest lists stored episodic memory exchanges for a resolved bucket.
type ListEpisodesResponse ¶
type ListEpisodesResponse struct {
Episodes []Episode `json:"episodes"`
}
ListEpisodesResponse returns stored episodic exchange records.
type MCPServerOptions ¶
type MCPServerOptions struct {
Implementation *mcp.Implementation
Instructions string
Logger *slog.Logger
}
MCPServerOptions configures the memoryflow MCP server wrapper.
type MemoryEdit ¶ added in v2.63.2
type MemoryEdit struct {
Op string `json:"op"` // add|update|supersede
// MemoryID is the target of update/supersede.
MemoryID string `json:"memory_id,omitempty"`
// Content is the new text for add/update, and the replacement written by
// supersede.
Content string `json:"content,omitempty"`
// Reason is the model's justification; surfaced in dry runs, and stored on
// the retired memory so a later reader can see why it was retired.
Reason string `json:"reason,omitempty"`
}
MemoryEdit is one proposed mutation.
type MemoryEditGenerator ¶ added in v2.63.2
type MemoryEditGenerator interface {
GenerateJSON(ctx context.Context, systemPrompt, userPrompt string) ([]byte, error)
}
MemoryEditGenerator returns JSON given a system and user prompt. Declared here rather than imported from graphflow so the two workflow layers stay independent — a caller wiring only memory maintenance should not have to pull in the graph pipeline.
type MemoryEditOptions ¶ added in v2.63.2
type MemoryEditOptions struct {
// AllowSupersede must be set for supersede edits to apply. Retiring a
// memory is opt-in for the same reason deleting a graph fact is.
AllowSupersede bool
// MaxSupersedes caps how many memories one pass may retire
// (0 = default 10), so a confused model cannot retire a whole brain.
MaxSupersedes int
// DryRun reports what would change without touching anything.
DryRun bool
// MaxCandidates bounds how many existing memories are shown to the model
// (0 = default 30). More context is not automatically better: a long list
// makes a wrong supersede more likely, not less.
MaxCandidates int
// Scope, UserID, Namespace place newly written memories. They default to
// the same global scope SaveMemory uses.
Scope string
UserID string
Namespace string
}
MemoryEditOptions configures how a plan is produced and applied.
type MemoryEditPlan ¶ added in v2.63.2
type MemoryEditPlan struct {
Edits []MemoryEdit `json:"edits"`
}
MemoryEditPlan is a set of mutations.
func ProposeMemoryEdits ¶ added in v2.63.2
func ProposeMemoryEdits(ctx context.Context, db *cortexdb.DB, text string, llm MemoryEditGenerator, opts MemoryEditOptions) (*MemoryEditPlan, error)
ProposeMemoryEdits asks the model which existing memories the new text changes, without applying anything.
Separate from ApplyMemoryEdits on purpose: the proposal is the part that can be wrong, so it must be inspectable — printed, reviewed, or fed to a dry run — before anything touches the brain.
type MemoryEditReport ¶ added in v2.63.2
type MemoryEditReport struct {
// Added counts standalone additions. A supersede also writes a replacement,
// but that write is counted by Superseded — not here — so the two numbers
// never describe the same row twice.
Added int `json:"added"`
Updated int `json:"updated"`
Superseded int `json:"superseded"`
Skipped []string `json:"skipped,omitempty"`
Applied []MemoryEdit `json:"applied,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
MemoryEditReport summarizes an applied (or simulated) plan.
func ApplyMemoryEdits ¶ added in v2.63.2
func ApplyMemoryEdits(ctx context.Context, db *cortexdb.DB, plan MemoryEditPlan, opts MemoryEditOptions) (*MemoryEditReport, error)
ApplyMemoryEdits applies a mutation plan deterministically. It is the single write path, and is useful on its own when the caller — or an agent that has already reasoned about it — has decided on the edits.
One bad edit never fails the plan: unknown ops, missing targets and edits over the cap are recorded in Skipped and the rest still apply. A half-applied plan is far better than a rejected one when the alternative is losing the good edits alongside the bad.
func UpdateMemoryFromText ¶ added in v2.63.2
func UpdateMemoryFromText(ctx context.Context, db *cortexdb.DB, text string, llm MemoryEditGenerator, opts MemoryEditOptions) (*MemoryEditReport, error)
UpdateMemoryFromText proposes and applies in one pass. Prefer a DryRun first on anything that matters.
type Option ¶
type Option func(*Service)
Option configures the workflow service.
func WithConventions ¶
func WithConventions(conventions ConventionSet) Option
WithConventions injects deterministic taxonomy conventions.
func WithExtractor ¶
func WithExtractor(extractor SessionExtractor) Option
WithExtractor injects a session extractor.
func WithPlanner ¶
func WithPlanner(planner QueryPlanner) Option
WithPlanner injects a query planner.
func WithProjectConfig ¶
func WithProjectConfig(cfg ProjectConfig) Option
WithProjectConfig applies a project config to the service.
func WithPromotionPolicy ¶
func WithPromotionPolicy(policy PromotionPolicy) Option
WithPromotionPolicy injects a promotion policy.
func WithRecallStrategy ¶ added in v2.18.0
func WithRecallStrategy(strategy RecallStrategy) Option
WithRecallStrategy injects a recall strategy wrapper. Use this for optional cognitive strategy plugins such as hindsight without replacing memoryflow.
type PassthroughRecallStrategy ¶ added in v2.18.0
type PassthroughRecallStrategy struct{}
PassthroughRecallStrategy is the default recall strategy. It delegates to the next recall function unchanged.
func (PassthroughRecallStrategy) Recall ¶ added in v2.18.0
func (PassthroughRecallStrategy) Recall(ctx context.Context, req RecallRequest, next RecallFunc) (*RecallResponse, error)
Recall delegates unchanged.
type ProjectConfig ¶
type ProjectConfig struct {
Version int `json:"version"`
Project string `json:"project,omitempty"`
Conventions ConventionSet `json:"conventions"`
}
ProjectConfig stores project-local workflow defaults.
func DefaultProjectConfig ¶
func DefaultProjectConfig(project string) ProjectConfig
DefaultProjectConfig returns a ready-to-save config for a project.
func LoadConfig ¶
func LoadConfig(path string) (*ProjectConfig, error)
LoadConfig loads a project config from disk.
type PromotionCandidate ¶
type PromotionCandidate struct {
KnowledgeID string `json:"knowledge_id,omitempty"`
Kind PromotionKind `json:"kind,omitempty"`
Title string `json:"title,omitempty"`
Content string `json:"content"`
SourceURL string `json:"source_url,omitempty"`
Author string `json:"author,omitempty"`
Collection string `json:"collection,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Entities []cortexdb.ToolEntityInput `json:"entities,omitempty"`
Relations []cortexdb.ToolRelationInput `json:"relations,omitempty"`
}
PromotionCandidate is one knowledge item proposed by the workflow extractor.
type PromotionKind ¶
type PromotionKind string
PromotionKind classifies durable knowledge candidates.
const ( PromotionKindDecision PromotionKind = "decision" PromotionKindPreference PromotionKind = "preference" PromotionKindMilestone PromotionKind = "milestone" PromotionKindProblem PromotionKind = "problem" PromotionKindNote PromotionKind = "note" )
type PromotionPolicy ¶
type PromotionPolicy interface {
Select(ctx context.Context, transcript Transcript, state SessionState, candidates []PromotionCandidate) ([]PromotionCandidate, error)
}
PromotionPolicy filters or reorders extracted promotion candidates.
type ProtocolStep ¶
type ProtocolStep struct {
Name string `json:"name"`
Action string `json:"action"`
Required bool `json:"required"`
Completed bool `json:"completed"`
Note string `json:"note,omitempty"`
}
ProtocolStep is one deterministic step in the reply workflow.
type QueryPlanner ¶
type QueryPlanner interface {
Plan(ctx context.Context, query string, state SessionState) (*cortexdb.RetrievalPlan, error)
}
QueryPlanner produces retrieval plans for lexical or hybrid recall.
type RecallFunc ¶ added in v2.18.0
type RecallFunc func(ctx context.Context, req RecallRequest) (*RecallResponse, error)
RecallFunc executes a recall request. Strategy implementations receive this callback so they can wrap or enrich recall without replacing memoryflow.
type RecallRequest ¶
type RecallRequest struct {
Query string `json:"query"`
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Scope string `json:"scope,omitempty"`
Namespace string `json:"namespace,omitempty"`
Collection string `json:"collection,omitempty"`
TopKMemories int `json:"top_k_memories,omitempty"`
TopKKnowledge int `json:"top_k_knowledge,omitempty"`
RetrievalMode string `json:"retrieval_mode,omitempty"`
DisableMemory bool `json:"disable_memory,omitempty"`
DisableKnowledge bool `json:"disable_knowledge,omitempty"`
DisableGraph bool `json:"disable_graph,omitempty"`
GraphLight bool `json:"graph_light,omitempty"`
MaxContextChars int `json:"max_context_chars,omitempty"`
MaxContextChunks int `json:"max_context_chunks,omitempty"`
Plan *cortexdb.RetrievalPlan `json:"plan,omitempty"`
State SessionState `json:"state,omitempty"`
}
RecallRequest resolves a plan and returns a fused memory/knowledge pack.
type RecallResponse ¶
type RecallResponse struct {
Plan cortexdb.RetrievalPlan `json:"plan"`
Decision cortexdb.RetrievalDecision `json:"decision"`
Response cortexdb.KnowledgeMemoryRecallResponse `json:"response"`
}
RecallResponse contains the fused recall pack plus the resolved plan.
type RecallStrategy ¶ added in v2.18.0
type RecallStrategy interface {
Recall(ctx context.Context, req RecallRequest, next RecallFunc) (*RecallResponse, error)
}
RecallStrategy optionally wraps memoryflow recall. Implementations can enrich plans, add entity signals, or rerank results while preserving memoryflow as the default workflow.
type ReplyProtocolRequest ¶
type ReplyProtocolRequest struct {
Identity string `json:"identity,omitempty"`
Recall RecallRequest `json:"recall"`
}
ReplyProtocolRequest prepares a grounded reply workflow.
type ReplyProtocolResponse ¶
type ReplyProtocolResponse struct {
WakeUp WakeUpLayersResponse `json:"wake_up"`
ShouldGround bool `json:"should_ground"`
RecommendedMode string `json:"recommended_mode"`
Steps []ProtocolStep `json:"steps,omitempty"`
Notes []string `json:"notes,omitempty"`
}
ReplyProtocolResponse returns wake-up layers plus a deterministic grounding recommendation.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the opinionated workflow layer on top of CortexDB memory and knowledge primitives.
func New ¶
func New(db *cortexdb.DB, planner QueryPlanner, extractor SessionExtractor, opts ...Option) (*Service, error)
New constructs a memory workflow facade.
func (*Service) AppendDiaryEntry ¶
func (s *Service) AppendDiaryEntry(ctx context.Context, req DiaryEntryRequest) (*DiaryEntryResponse, error)
AppendDiaryEntry stores one diary entry in a dedicated diary namespace.
func (*Service) CloseSession ¶
func (s *Service) CloseSession(ctx context.Context, req CloseSessionRequest) (*CloseSessionResponse, error)
CloseSession optionally promotes extracted durable knowledge at session end.
func (*Service) GetTranscript ¶
func (s *Service) GetTranscript(ctx context.Context, req GetTranscriptRequest) (*GetTranscriptResponse, error)
GetTranscript reconstructs the original transcript order from stored episodes.
func (*Service) IngestTranscript ¶
func (s *Service) IngestTranscript(ctx context.Context, req IngestTranscriptRequest) (*IngestTranscriptResponse, error)
IngestTranscript stores a transcript as exchange-shaped episodic memory chunks.
func (*Service) ListDiaryEntries ¶
func (s *Service) ListDiaryEntries(ctx context.Context, req DiaryListRequest) (*DiaryListResponse, error)
ListDiaryEntries returns chronological diary entries for a resolved bucket.
func (*Service) ListEpisodes ¶
func (s *Service) ListEpisodes(ctx context.Context, req ListEpisodesRequest) (*ListEpisodesResponse, error)
ListEpisodes lists stored exchange-shaped episodic memories for a resolved bucket.
func (*Service) NewMCPServer ¶
func (s *Service) NewMCPServer(opts MCPServerOptions) (*mcp.Server, error)
NewMCPServer returns an MCP server that exposes the memoryflow tool surface.
func (*Service) PrepareReply ¶
func (s *Service) PrepareReply(ctx context.Context, req ReplyProtocolRequest) (*ReplyProtocolResponse, error)
PrepareReply returns deterministic protocol guidance plus wake-up layers.
func (*Service) Recall ¶
func (s *Service) Recall(ctx context.Context, req RecallRequest) (*RecallResponse, error)
Recall resolves a retrieval plan and delegates to the CortexDB KnowledgeMemory facade.
func (*Service) ResolveTaxonomy ¶
func (s *Service) ResolveTaxonomy(base Taxonomy, hint SourceHint) Taxonomy
ResolveTaxonomy resolves workflow taxonomy for external callers using the service conventions.
func (*Service) WakeUp ¶
func (s *Service) WakeUp(ctx context.Context, req WakeUpRequest) (*WakeUpResponse, error)
WakeUp assembles a compact startup context by prepending identity to a recall pack.
func (*Service) WakeUpLayers ¶
func (s *Service) WakeUpLayers(ctx context.Context, req WakeUpLayersRequest) (*WakeUpLayersResponse, error)
WakeUpLayers returns explicit L0-L3 wake-up tiers.
type SessionExtractor ¶
type SessionExtractor interface {
Extract(ctx context.Context, transcript Transcript, state SessionState) ([]PromotionCandidate, error)
}
SessionExtractor proposes durable knowledge promotions from a transcript.
type SessionState ¶
type SessionState struct {
UserID string `json:"user_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Namespace string `json:"namespace,omitempty"`
Wing string `json:"wing,omitempty"`
Room string `json:"room,omitempty"`
Tags []string `json:"tags,omitempty"`
Taxonomy Taxonomy `json:"taxonomy,omitempty"`
Transcript *Transcript `json:"transcript,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
SessionState provides planner context for recall and wake-up flows.
type SourceHint ¶
type SourceHint struct {
Project string `json:"project,omitempty"`
Path string `json:"path,omitempty"`
Source string `json:"source,omitempty"`
Title string `json:"title,omitempty"`
Tags []string `json:"tags,omitempty"`
}
SourceHint is the non-LLM input used to resolve a taxonomy from deterministic conventions.
type Taxonomy ¶
type Taxonomy struct {
Kind string `json:"kind,omitempty"`
Wing string `json:"wing,omitempty"`
Room string `json:"room,omitempty"`
Source string `json:"source,omitempty"`
Tags []string `json:"tags,omitempty"`
Entities []string `json:"entities,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
Taxonomy describes the workflow-level memory placement and labeling metadata.
func ResolveTaxonomy ¶
func ResolveTaxonomy(base Taxonomy, hint SourceHint, conventions ConventionSet) Taxonomy
ResolveTaxonomy applies deterministic project conventions to a base taxonomy.
type Toolbox ¶
type Toolbox struct {
// contains filtered or unexported fields
}
Toolbox exposes memoryflow as a tool-call surface.
func NewToolbox ¶
NewToolbox constructs a tool facade for a workflow service.
func (*Toolbox) Definitions ¶
func (t *Toolbox) Definitions() []cortexdb.ToolDefinition
Definitions returns JSON-schema-like tool definitions.
type Transcript ¶
type Transcript struct {
SessionID string `json:"session_id,omitempty"`
UserID string `json:"user_id,omitempty"`
Source string `json:"source,omitempty"`
Title string `json:"title,omitempty"`
Turns []TranscriptTurn `json:"turns"`
}
Transcript is the normalized input to the memory workflow ingest path.
type TranscriptTurn ¶
type TranscriptTurn struct {
Role string `json:"role"`
Content string `json:"content"`
Timestamp time.Time `json:"timestamp,omitempty"`
SourceID string `json:"source_id,omitempty"`
}
TranscriptTurn is one normalized turn from a conversation transcript.
type WakeUpLayer ¶
type WakeUpLayer struct {
Level WakeUpLevel `json:"level"`
Title string `json:"title,omitempty"`
Text string `json:"text"`
}
WakeUpLayer is one wake-up context tier.
type WakeUpLayersRequest ¶
type WakeUpLayersRequest struct {
Identity string `json:"identity,omitempty"`
Recall RecallRequest `json:"recall"`
}
WakeUpLayersRequest requests all wake-up context tiers.
type WakeUpLayersResponse ¶
type WakeUpLayersResponse struct {
Layers []WakeUpLayer `json:"layers"`
Recall RecallResponse `json:"recall"`
}
WakeUpLayersResponse returns all wake-up context tiers plus the recall payload.
type WakeUpLevel ¶
type WakeUpLevel string
WakeUpLevel identifies one context density tier.
const ( WakeUpLevelL0 WakeUpLevel = "L0" WakeUpLevelL1 WakeUpLevel = "L1" WakeUpLevelL2 WakeUpLevel = "L2" WakeUpLevelL3 WakeUpLevel = "L3" )
type WakeUpRequest ¶
type WakeUpRequest struct {
Identity string `json:"identity,omitempty"`
Recall RecallRequest `json:"recall"`
}
WakeUpRequest assembles a compact startup context for an agent.
type WakeUpResponse ¶
type WakeUpResponse struct {
Text string `json:"text"`
Recall RecallResponse `json:"recall"`
}
WakeUpResponse contains the final startup text and the underlying recall response.