sessionmem

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
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

func Dir(projectDir, sessionID string) string

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

func EnsureFile(projectDir, sessionID string) (string, error)

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 Load

func Load(path string) (string, error)

Load reads the session summary file. Returns "" if the file doesn't exist.

func Path

func Path(projectDir, sessionID string) string

Path returns the path to the summary.md for a session.

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.

Jump to

Keyboard shortcuts

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