cortex

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Snapshot       *memory.SnapshotManager     // System 4: Frozen snapshot memory
	Trigger        *trigger.MessageTrigger     // System 1 + 2: Nudge mechanism
	Review         *review.BackgroundReview    // System 3: Background review
	Perception     *perception.Parser          // Layer 1: Intent classification
	Cognition      *cognition.Planner          // Layer 2: Planning and decision making
	Execution      *execution.Manager          // Layer 3: Checkpoint + Resume
	FTSMemory      *memory.FTSStore            // System 5: FTS full-text search
	SkillCreator   *skills.EnhancedAutoCreator // System 6: Auto skill evolution
	LastPerception *perception.PerceptionResult
	LastDecision   *cognition.Decision   // Last cognition decision
	LastCheckpoint *execution.Checkpoint // Current execution checkpoint
	// contains filtered or unexported fields
}

Manager integrates all six Cortex Agent systems: 1. User Message Trigger 2. Periodic Nudge Mechanism 3. Background Review System 4. Dual File Storage (MEMORY.md + USER.md) 5. Holographic Memory (SQLite FTS5 - coming soon) 6. Memory Manager with Frozen Snapshot

func NewManager

func NewManager(baseDir string) *Manager

NewManager creates a new Cortex integration manager Initializes all 6 Cortex systems and 3-layer architecture

func (*Manager) AddMemoryInsight

func (m *Manager) AddMemoryInsight(insight string, importance int) error

AddMemoryInsight stores a learned insight in FTS memory

func (*Manager) AnalyzeToolSequence

func (m *Manager) AnalyzeToolSequence(task string, tools []string)

AnalyzeToolSequence analyzes a tool sequence for pattern recognition

func (*Manager) AppendMemory

func (m *Manager) AppendMemory(line string) error

AppendMemory adds a line to the memory file Writes to disk immediately but does NOT refresh frozen snapshot

func (*Manager) AppendUser

func (m *Manager) AppendUser(line string) error

AppendUser adds a line to the user profile Writes to disk immediately but does NOT refresh frozen snapshot

func (*Manager) CompleteExecution

func (m *Manager) CompleteExecution()

CompleteExecution marks execution as successfully completed

func (*Manager) FindResumableTask

func (m *Manager) FindResumableTask(description string) *execution.Checkpoint

FindResumableTask checks if there's a resumable checkpoint

func (*Manager) GetClarificationQuestion

func (m *Manager) GetClarificationQuestion() string

GetClarificationQuestion returns the question to ask user for clarification

func (*Manager) GetDetectedPatterns

func (m *Manager) GetDetectedPatterns() []skills.Pattern

GetDetectedPatterns returns all currently detected patterns

func (*Manager) GetExecutionPlan

func (m *Manager) GetExecutionPlan() *cognition.ExecutionPlan

GetExecutionPlan returns the current execution plan

func (*Manager) GetExecutionProgress

func (m *Manager) GetExecutionProgress() *execution.Progress

GetExecutionProgress returns the current execution progress

func (*Manager) GetGeneratedSkills

func (m *Manager) GetGeneratedSkills() []string

GetGeneratedSkills returns all auto-generated skills

func (*Manager) GetIntent

func (m *Manager) GetIntent() perception.IntentType

GetIntent returns the classified intent type

func (*Manager) GetLastDecision

func (m *Manager) GetLastDecision() *cognition.Decision

GetLastDecision returns the last cognition decision

func (*Manager) GetLastPerception

func (m *Manager) GetLastPerception() *perception.PerceptionResult

GetLastPerception returns the result from the perception layer This can be used by the decision layer to: - Adjust max turns based on task complexity - Change tool selection based on intent - Request clarification if noise is detected

func (*Manager) GetMemoryStats

func (m *Manager) GetMemoryStats() map[string]interface{}

GetMemoryStats returns statistics about the memory store

func (*Manager) GetMemoryVersion

func (m *Manager) GetMemoryVersion() int

GetMemoryVersion returns the current memory version

func (*Manager) GetPromptContext

func (m *Manager) GetPromptContext() string

GetPromptContext returns the memory context to include in system prompt Uses the frozen snapshot, not the latest version

func (*Manager) GetRecommendedMaxTurns

func (m *Manager) GetRecommendedMaxTurns() int

GetRecommendedMaxTurns returns the recommended max turns based on task complexity

func (*Manager) GetRetrievalHints

func (m *Manager) GetRetrievalHints() []cognition.RetrievalHint

GetRetrievalHints returns hints for memory retrieval

func (*Manager) GetSkillEvolutionStats

func (m *Manager) GetSkillEvolutionStats() map[string]interface{}

GetSkillEvolutionStats returns statistics about skill generation

func (*Manager) GetSystemStatus

func (m *Manager) GetSystemStatus() map[string]interface{}

GetSystemStatus returns status of all six Cortex systems

func (*Manager) GetTaskComplexity

func (m *Manager) GetTaskComplexity() perception.TaskComplexity

GetTaskComplexity returns the estimated task complexity

func (*Manager) GetTurnCount

func (m *Manager) GetTurnCount() int

GetTurnCount returns the current turn count

func (*Manager) GetUserContext

func (m *Manager) GetUserContext() string

GetUserContext returns the user profile for system prompt Uses the frozen snapshot

func (*Manager) HasNoise

func (m *Manager) HasNoise() bool

HasNoise returns true if noise was detected in input

func (*Manager) NeedsClarification

func (m *Manager) NeedsClarification() bool

NeedsClarification returns true if clarification should be requested

func (*Manager) OnSessionEnd

func (m *Manager) OnSessionEnd()

OnSessionEnd is called when a session completes Refreshes the memory snapshot with latest changes

func (*Manager) OnTurnEnd

func (m *Manager) OnTurnEnd()

OnTurnEnd is called at the end of each LLM turn

func (*Manager) OnTurnStart

func (m *Manager) OnTurnStart()

OnTurnStart is called at the beginning of each LLM turn Freezes the memory snapshot for prefix cache protection

func (*Manager) OnUserMessage

func (m *Manager) OnUserMessage(input string)

OnUserMessage handles a new user message, triggering: - Layer 1: Perception (intent classification, noise detection) - Layer 2: Cognition (task planning, memory retrieval hints) - Turn counter increment - Nudge if threshold reached (async) - Skill creation flow initialization

func (*Manager) Reset

func (m *Manager) Reset()

Reset resets the turn counter for a new session

func (*Manager) SearchMemory

func (m *Manager) SearchMemory(query string, limit int) []memory.SearchResult

SearchMemory performs full-text search across all conversation history

func (*Manager) ShouldUseSubAgents

func (m *Manager) ShouldUseSubAgents() bool

ShouldUseSubAgents returns true if sub-agents should be enabled

func (*Manager) Start

func (m *Manager) Start() error

Start initializes all six Cortex systems Systems started in order of dependency:

  1. Memory systems (Snapshot, FTS)
  2. Review system
  3. Skill evolution system
  4. Trigger system

func (*Manager) StartExecution

func (m *Manager) StartExecution(task string) *execution.Progress

StartExecution begins a new execution with checkpoint support

func (*Manager) SuggestRecoveryAction

func (m *Manager) SuggestRecoveryAction(err error) execution.RecoveryAction

SuggestRecoveryAction suggests what to do after failure

func (*Manager) UpdateExecutionStep

func (m *Manager) UpdateExecutionStep(stepID int, stepName string)

UpdateExecutionStep updates the current step

Jump to

Keyboard shortcuts

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