MCPcopy
hub / github.com/sipeed/picoclaw / ContextManager

Interface ContextManager

pkg/agent/context_manager.go:15–31  ·  view source on GitHub ↗

ContextManager manages conversation context via a pluggable strategy. Exactly ONE ContextManager is active per AgentLoop, selected by config. The default ("legacy") preserves current summarization behavior.

Source from the content-addressed store, hash-verified

13// Exactly ONE ContextManager is active per AgentLoop, selected by config.
14// The default ("legacy") preserves current summarization behavior.
15type ContextManager interface {
16 // Assemble builds budget-aware context from the ContextManager's own storage.
17 // Called before BuildMessages. Returns assembled messages ready for LLM.
18 Assemble(ctx context.Context, req *AssembleRequest) (*AssembleResponse, error)
19
20 // Compact compresses conversation history.
21 // Called after turn completes (may be async internally) and on context overflow (sync).
22 Compact(ctx context.Context, req *CompactRequest) error
23
24 // Ingest records a message into the ContextManager's own storage.
25 // Called after each message is persisted to session JSONL.
26 Ingest(ctx context.Context, req *IngestRequest) error
27
28 // Clear removes all stored context for a session (messages, summaries, etc.).
29 // Called when the user issues /clear or /reset.
30 Clear(ctx context.Context, sessionKey string) error
31}
32
33// AssembleRequest is the input to Assemble.
34type AssembleRequest struct {

Implementers 4

seahorseContextManagerpkg/agent/context_seahorse.go
legacyContextManagerpkg/agent/context_legacy.go
noopContextManagerpkg/agent/context_manager_test.go
trackingContextManagerpkg/agent/context_manager_test.go

Calls

no outgoing calls

Tested by

no test coverage detected