Documentation
¶
Overview ¶
Package memory loads project + user "agent memory" files (typically AGENTS.md) into the system prompt.
Per REQUIREMENTS FR-9.1, the project root is searched in this order (first match wins): AGENTS.md → CLAUDE.md → GEMINI.md. The fallback chain lets Cogo be dropped into a repo that already has memory authored for Claude Code or a Gemini-native tool.
The user-global root (typically ~/.cogo/) reads only AGENTS.md; no fallback chain (FR-9.2). Both files are concatenated, user first, project second, so a per-repo memory file can layer on top of a user's personal preferences.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loaded ¶
Loaded is the result of a Load call. Instruction is the assembled text suitable for prepending to the agent's system prompt; Sources describes what got included so the user can inspect via /memory.
func Load ¶
Load resolves the project + user memory files and returns the concatenated instruction text. Missing files are not errors — memory is optional. Other I/O errors (permission denied, etc.) are returned so the caller can surface them.
projectRoot may be empty (e.g., no .agents/ found and we're not using cwd as a fallback); in that case only user memory is loaded. userRoot may be empty in tests.
type Source ¶
type Source struct {
Scope string // "user" | "project"
Path string // absolute path
Bytes int // bytes after truncation
Truncated bool // true if the on-disk file exceeded maxFileBytes
}
Source records where one piece of loaded memory came from. Used by the /memory slash command to show provenance.