Documentation
¶
Overview ¶
Package claudemd loads CLAUDE.md instruction files from the project directory hierarchy and injects them into the agent system prompt.
Load order (mirrors utils/claudemd.ts):
- User global: ~/.claude/CLAUDE.md and ~/.claude/rules/*.md
- Project: CLAUDE.md, .claude/CLAUDE.md, .claude/rules/*.md discovered by walking from cwd up to filesystem root (closer to cwd = higher priority = loaded later)
- Local private: CLAUDE.local.md (gitignored, per-directory)
Within each directory, files closer to cwd override files from parents. @include directives are resolved recursively with circular-reference protection.
Index ¶
Constants ¶
const MaxCharCount = 40000
MaxCharCount is the recommended max character count for a single memory file. Files larger than this are truncated with a warning. Mirrors TS constant.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
BuildPrompt builds the system-prompt text block from loaded CLAUDE.md files. Returns empty string if no files were loaded.
Types ¶
type File ¶
type File struct {
Path string
Content string
Type MemoryType
}
File is one loaded CLAUDE.md file.
type MemoryType ¶
type MemoryType int
MemoryType identifies where a file came from.
const ( TypeUser MemoryType = iota // ~/.claude/CLAUDE.md TypeProject // CLAUDE.md or .claude/CLAUDE.md in project tree TypeLocal // CLAUDE.local.md (private, gitignored) )