Documentation
¶
Overview ¶
Package memory loads project instruction files (AGENTS.md, CLAUDE.md, GEMINI.md, BLITZ.md), the files they import, and rule files, which are added to the agents' system prompt. Rules scoped to paths are handed out when the agent first touches a matching file (see Rules).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Imports ¶
Imports returns the @path imports in an instruction file, in order, ignoring fenced code blocks and inline code. A token counts as a path when it has a "/" or a file extension, so "@team" stays text.
func Render ¶
Render formats docs as a system-prompt section. scoped says whether path-scoped rules exist, so the agent knows to expect them.
func RenderRules ¶
RenderRules formats rules handed out with a tool result.
func TrackedByGit ¶
TrackedByGit reports whether git tracks path, for warning about personal files that were committed. Git runs with fsmonitor off: the repository's config may name commands.
Types ¶
type Doc ¶
type Doc struct {
Path string
Content string
Truncated bool
// ImportedFrom is the file whose @path import loaded this one ("" for
// files found by name).
ImportedFrom string
// Local marks a personal file (BLITZ.local.md) that shouldn't be
// committed.
Local bool
}
Doc is one loaded instructions file.
type Loaded ¶
type Loaded struct {
Docs []Doc // always in the prompt (unscoped rules included)
Rules []Rule // scoped rules, handed out by path
}
Loaded is everything Load found.
func LoadAll ¶
func LoadAll(workspace string, cfg config.MemoryConfig, opts ...Options) Loaded
LoadAll returns instruction files and rules: the global file and global rules first, then, for each directory from the repository root (the nearest ancestor containing .git, if any) down to the workspace, the files named in cfg.Files, then cfg.LocalFiles, then the rule files in cfg.RuleDirs, so more specific files come last. Files a loaded file imports (@path) follow it. The same file, or the same content under another name (CLAUDE.md copying AGENTS.md), loads once.
type Options ¶
type Options struct {
// Blocked reports paths that must never be read (the sandbox's
// blocked_paths): an import of one is skipped.
Blocked func(abs string) bool
}
Options refine loading.