AGENTS.ctx: Context System
Level 2 (Topic) — Context registry, load order, priorities, rules inheritance.
Concept
The context system is a layered governance model. Each context is a directory under AGENTS.ctx/ containing a CONTEXT.md that defines project-specific rules, structure, and assets. Contexts are loaded on demand or as composites.
Load Order
When a user says “work in context X,” the agent:
- Loads
AGENTS.ctx/CONTEXT.md(base system — golden rules) - Loads
AGENTS.ctx/memory/CONTEXT.md(mandatory alignment) - Reads root memory files (system-state, debts, past-summary, chronicle)
- Loads
AGENTS.ctx/X/CONTEXT.md(project-specific rules) - If X is composite (e.g.,
cluster→ loadsephemeral-castle+tazlab-k8s)
Priority Chain
Loaded CONTEXT.md(s) > base CONTEXT.md > dir-context GEMINI.md > global
Project-level rules always override base rules. Base rules override global GEMINI.md.
Mandatory Alignment
Whenever the base context is loaded, the agent must immediately read AGENTS.ctx/memory/CONTEXT.md and follow its boot sequence (reading chronicle, system-state) to synchronize with the current state.
Composite Contexts
Some contexts load multiple sub-contexts:
| Composite | Loads | Reason |
|---|---|---|
cluster | ephemeral-castle + tazlab-k8s | Full operational view |
Golden Rules (All Contexts)
All contexts inherit these non-negotiable rules:
- Never log or expose secrets in cleartext
- English everywhere (names, paths, docs)
- Relative paths only in AGENTS.ctx files
- Read before editing
- Minimum indispensable changes
- Teaching mindset for technical work
- No secrets in contexts
- Structured logs for long-running operations
See Also
- Hub: AGENTS.ctx
- Topic: Memory System
- Detail: Memory Files Detail