Documentation
¶
Index ¶
Constants ¶
const ( CtxMarkerEnd = "<!-- ctx:end -->" CtxMarkerStart = "<!-- ctx:context -->" DirArchive = "archive" DirClaude = ".claude" DirClaudeHooks = ".claude/hooks" DirContext = ".context" DirSessions = "sessions" FileAutoSave = "auto-save-session.sh" FileBlockNonPathScript = "block-non-path-ctx.sh" FileClaudeMd = "CLAUDE.md" FileSettings = ".claude/settings.local.json" )
const ( FilenameConstitution = "CONSTITUTION.md" FilenameTask = "TASKS.md" FilenameConvention = "CONVENTIONS.md" FilenameArchitecture = "ARCHITECTURE.md" FilenameDecision = "DECISIONS.md" FilenameLearning = "LEARNINGS.md" FilenameGlossary = "GLOSSARY.md" FilenameDrift = "DRIFT.md" FilenameAgentPlaybook = "AGENT_PLAYBOOK.md" FilenameDependency = "DEPENDENCIES.md" )
Context file name constants.
const ( UpdateTypeTask = "task" UpdateTypeDecision = "decision" UpdateTypeLearning = "learning" UpdateTypeConvention = "convention" UpdateTypeComplete = "complete" )
Update type constants for context entries.
These are used in switch statements for routing add/update commands to the appropriate handler.
const ( UpdateTypeTasks = "tasks" UpdateTypeDecisions = "decisions" UpdateTypeLearnings = "learnings" UpdateTypeConventions = "conventions" )
Plural aliases for update types.
Accepted as synonyms for the singular forms.
const WatchAutoSaveInterval = 5
WatchAutoSaveInterval is the number of updates between auto-saves in watch mode.
Variables ¶
var FileReadOrder = []string{ FilenameConstitution, FilenameTask, FilenameConvention, FilenameArchitecture, FilenameDecision, FilenameLearning, FilenameGlossary, FilenameDrift, FilenameAgentPlaybook, }
FileReadOrder defines the priority order for reading context files.
The order follows a logical progression for AI agents:
CONSTITUTION — Inviolable rules. Must be loaded first so the agent knows what it cannot do before attempting anything.
TASKS — Current work items. What the agent should focus on.
CONVENTIONS — How to write code. Patterns and standards to follow.
ARCHITECTURE — System structure. Understanding of components and boundaries before making changes.
DECISIONS — Historical context. Why things are the way they are, to avoid re-debating settled decisions.
LEARNINGS — Gotchas and tips. Lessons from past work that inform current implementation.
GLOSSARY — Reference material. Domain terms and abbreviations for lookup as needed.
DRIFT — Staleness indicators. Lower priority since it's primarily for maintenance workflows.
AGENT_PLAYBOOK — Meta instructions. How to use this context system. Loaded last because it's about the system itself, not the work. The agent should understand the content before the operating manual.
var FileType = map[string]string{ UpdateTypeDecision: FilenameDecision, UpdateTypeDecisions: FilenameDecision, UpdateTypeTask: FilenameTask, UpdateTypeTasks: FilenameTask, UpdateTypeLearning: FilenameLearning, UpdateTypeLearnings: FilenameLearning, UpdateTypeConvention: FilenameConvention, UpdateTypeConventions: FilenameConvention, }
FileType maps short names to actual file names.
var Packages = map[string]string{
"package.json": "Node.js dependencies",
"go.mod": "Go module dependencies",
"Cargo.toml": "Rust dependencies",
"requirements.txt": "Python dependencies",
"Gemfile": "Ruby dependencies",
}
Packages maps dependency manifest files to their descriptions.
Used by sync to detect projects and suggest dependency documentation.
var Patterns = []Pattern{
{".eslintrc*", "linting conventions"},
{".prettierrc*", "formatting conventions"},
{"tsconfig.json", "TypeScript configuration"},
{".editorconfig", "editor configuration"},
{"Makefile", "build commands"},
{"Dockerfile", "containerization"},
}
Patterns lists config files that should be documented in CONVENTIONS.md.
Used by sync to suggest documenting project configuration.
var RequiredFiles = []string{ FilenameConstitution, FilenameTask, FilenameDecision, }
RequiredFiles lists the essential context files that must be present.
These are the files created with `ctx init --minimal` and checked by drift detection for missing files.
Functions ¶
func FilePriority ¶
FilePriority returns the priority of a context file.
Lower numbers indicate higher priority (1 = highest). Unknown files return 100.
Parameters:
- name: Filename to look up (e.g., "TASKS.md")
Returns:
- int: Priority value (1-9 for known files, 100 for unknown)