Documentation
¶
Overview ¶
Package sessionmem implements per-session memory: a markdown file at <projectDir>/<sessionID>/session-memory/summary.md that a sub-agent updates periodically with notes about the current conversation.
On --continue / /resume the file is loaded and appended to the loop's system blocks so the new turn picks up where the prior one left off.
Mirrors src/services/SessionMemory/sessionMemory.ts (GrowthBook-gated in CC; always on here, throttled to every UpdateEveryNTurns end_turns).
Index ¶
Constants ¶
const UpdateEveryNTurns = 3
UpdateEveryNTurns is the throttle for OnEndTurn updates. CC keys off token-window growth; we use a turn count for simplicity. 3 matches CC's DEFAULT_SESSION_MEMORY_CONFIG.toolCallsBetweenUpdates.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir returns the session-memory directory for a (cwd, sessionID) pair. Layout: <homeProjects>/<sanitized-cwd>/<sessionID>/session-memory/ where <homeProjects> matches session.ProjectDir's layout.
func EnsureFile ¶
EnsureFile creates the session-memory directory and seeds summary.md with the initial template if it doesn't exist yet. Returns the file path. Idempotent.
func RunUpdate ¶
func RunUpdate(ctx context.Context, summaryPath, recentTranscript string, runAgent func(context.Context, string) (string, error)) error
RunUpdate fires the session-memory sub-agent. The sub-agent receives the current summary plus a transcript of the recent conversation and is asked to produce an updated summary, which it writes back via FileWrite.
Mirrors src/services/SessionMemory/sessionMemory.ts updateSessionMemory().
Types ¶
This section is empty.