second-brain-template
AGENTS.md0 starsChanged 4 months agoMITView on GitHub
These rules govern the behavior of all AI agents (Claude Code, Cursor, or any other coding agent) working in a workspace linked to this vault. Everything below is a framework — the concrete paths, tech stack, and domain examples (Odoo shows up a lot) are illustrative. Swap them for your own stack; keep the shape of the rules. (This example is phrased for an Odoo module database — replace with whatever expensive-to-rebuild resource your stack has.) Any time the user…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- brain-syncSkill
- feature-guardianSkill
- feature-restorerSkill
- find-skillsSkill
- frontend-designSkill
- git-advancedSkill
- obsidian-vaultSkill
- safe-workflowSkill
- security-auditSkill
- session-wrapSkill
- spec-creationSkill
- systematic-debuggingSkill
- testing-patternsSkill
- vault-prunerSkill
- graphifySkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
25 rules. About 0 are common, 12 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 11
If your work touches a vendored/core dependency directory you must never modify directly (e.g.
- Very specific: line 30
Write to memory files (feedback_*.md, project_*.md, core.md) — these are loaded every session.
- Distinctive: line 31
If a file already covers the topic, UPDATE it.
- Distinctive: line 33
Keep entries rule-shaped: what to do / avoid / why.
- Distinctive: line 50
Execute a self-healing loop automatically: when running integration tests or a dev-server upgrade, do not halt on the first traceback or …
- Distinctive: line 57
Repeated error guard: if the same error type and line number appears 3 consecutive times, stop the loop immediately, report the blocker …
- Distinctive: line 64
Speed mode during execution: write direct code changes and command executions without chatty conversational intros or outros.
- Distinctive: line 66
Compact logs: when analyzing tracebacks or test errors, only extract and read the specific lines containing the filename, line number, and …
- Distinctive: line 72
Primary source of truth: prefer pre-downloaded local skills over relying on the model's own knowledge for framework-version-sensitive work:
- Distinctive: line 75
Version isolation (do not mix): always inspect the current project's manifest/config file first to identify the framework version.
- Very specific: line 76
If the project is on version 19 (or mid-migration), use only the odoo-19 skill.
- Very specific: line 77
If the project is on version 18, use only the odoo-18 skill.
- Distinctive: line 79
Web search fallback: always check the appropriate local version skill first.
- Very specific: line 90
Domain projects (e.g. Odoo): write tracebacks and framework fixes back to Development/<Domain>/<Domain>-Mistakes.md.
- Very specific: line 91
General code projects (Python, JS, etc.): write general bugs and coding solutions back to Development/General-Mistakes.md.
- Very specific: line 92
General tasks / conversations: if the user completes a focus session, brainstorms ideas, or plans tasks, write a bullet-point summary of …
- Distinctive: line 93
Never log learnings to temporary directories.
- Very specific: line 99
File length limit: if a domain mistakes file (e.g.
- Very specific: line 100
How: call the vault-pruner skill — it handles classification and archiving automatically.
- Very specific: line 102
Create or open archive files under Development/<Domain>/Mistakes/Archive_<Category>.md.
- Distinctive: line 104
Keep the most recent 20 rules in the main file to keep the context window small, fast, and token-efficient.
- Very specific: line 110
If a task could benefit from a community skill that doesn't exist in the vault yet, use the find-skills skill.
- Distinctive: line 112
When a new skill is installed, add it to the relevant alias/context so future sessions pick it up.
- Very specific: line 169
Keep it fresh: run graphify update . after code changes (AST-only, no LLM cost).
- Very specific: line 171
Backend: if you don't have an ANTHROPIC_API_KEY set, use --backend claude-cli for semantic extraction (docs/notes) — it shells out to the …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Custom Agent Rules & Behavioral Directives
These rules govern the behavior of all AI agents (Claude Code, Cursor, or any other coding agent) working in a workspace linked to this vault.
Everything below is a framework — the concrete paths, tech stack, and domain examples (Odoo shows up a lot) are illustrative. Swap them for your own stack; keep the shape of the rules.
1. 🚫 Read-Only Constraints
- If your work touches a vendored/core dependency directory you must never modify directly (e.g. a framework's core source tree, a generated
vendor/folder), name it explicitly here and mark it strictly read-only. - Example:
<CORE_FRAMEWORK_PATH>and all of its subfolders are read-only. You may read these files for context, but you must never create, edit, or delete any files inside that path.
2. 🛢️ Environment / Database Reuse Constraints
- Do not drop or recreate expensive local resources (databases, containers, build caches) unless truly necessary — recreating them costs time.
- Prefer incremental operations: upgrade/migrate in place rather than reinstalling from scratch. Only do a full reinstall/reset if the resource is corrupted beyond repair.
(This example is phrased for an Odoo module database — replace with whatever expensive-to-rebuild resource your stack has.)
📥 Universal Learn-and-Save Rule
Any time the user tells you something new — a preference, correction, decision, fix, workflow change, anything — save it to the vault immediately. No exceptions. No asking. Just write it.
Save in a way that's useful to future sessions — structured and actionable, not just logged.
- Write to memory files (
feedback_*.md,project_*.md,core.md) — these are loaded every session. - If a file already covers the topic, UPDATE it. Never duplicate.
- Daily logs (
Personal/Daily-Logs/YYYY-MM-DD.md) are for human review only — not agent context. - Keep entries rule-shaped: what to do / avoid / why.
Routing:
- Domain-specific fix (e.g. Odoo) →
brain-sync→ domain mistakes file + ledger - General code fix →
brain-sync→General-Mistakes.md - AI behavior / style →
claude-memory/feedback_*.md - Alias / tooling →
claude-memory/tooling.md - Personal preference →
claude-memory/core.md - New agent rule →
AGENTS.md - Session summary →
Personal/Daily-Logs/YYYY-MM-DD.md(human only)
Never say "I'll remember that." Write it.
3. 🔄 Automated Self-Healing & Logging Loop
- Execute a self-healing loop automatically: when running integration tests or a dev-server upgrade, do not halt on the first traceback or error.
- You are fully authorized to:
- Parse the error traceback from the console.
- Implement the fix in the code.
- Log the mistake and fix to your domain's mistakes file immediately using the
brain-syncskill. - Re-run the failing command.
- Repeat this loop up to 10 times automatically without user intervention until the command exits cleanly.
- Repeated error guard: if the same error type and line number appears 3 consecutive times, stop the loop immediately, report the blocker clearly, and ask for user input. Do not keep iterating on an unfixable error.
🪙 4. Token Preservation & Context Compaction
To avoid running out of tokens during big builds or migration loops:
- Speed mode during execution: write direct code changes and command executions without chatty conversational intros or outros.
- Subagent spawning: for multi-file changes, spawn a separate subagent for each file. This resets the chat history context and prevents token accumulation.
- Compact logs: when analyzing tracebacks or test errors, only extract and read the specific lines containing the filename, line number, and error type. Do not paste or ingest the entire console output.
📚 5. Local Skill References (Domain Example: Odoo)
- Primary source of truth: prefer pre-downloaded local skills over relying on the model's own knowledge for framework-version-sensitive work:
.agents/skills/examples/odoo/odoo-18/SKILL.md(andreferences/).agents/skills/examples/odoo/odoo-19/SKILL.md(andreferences/)
- Version isolation (do not mix): always inspect the current project's manifest/config file first to identify the framework version.
- If the project is on version 19 (or mid-migration), use only the
odoo-19skill. - If the project is on version 18, use only the
odoo-18skill. - You must never read, mix, or reference version-18 guidelines inside a version-19 workspace (or vice versa) if the versions have breaking changes between them.
- If the project is on version 19 (or mid-migration), use only the
- Web search fallback: always check the appropriate local version skill first. If the local references are insufficient to complete the task or resolve a complex traceback, you are permitted to use web search. Do not guess syntax.
This whole section is specific to the Odoo example pack — if you deleted .agents/skills/examples/odoo/, delete or replace this section with your own domain skill's version-isolation rules.
🏰 6. Session Memory Rule
- Initial context loading: upon starting a session, load and read
AGENTS.mdand your personal profile (Personal/Personal-AI-Profile.md, if you keep one) before writing any code or commands. - Cross-tool handoff: if a
HANDOFF.mdfile exists in the project root, read it before doing anything else — it's a short summary a previous session left for you, possibly written by a different agent tool than the one you are. This is what makes switching tools mid-project work: a tool that only auto-readsAGENTS.md(not a CLI flag) picks up the handoff automatically just by following this instruction, with no special wiring on its end. Seedocs/alias-modes.md's "Handoff between sessions" section for the full pattern and a worked example. - Routing memory by project type:
- Domain projects (e.g. Odoo): write tracebacks and framework fixes back to
Development/<Domain>/<Domain>-Mistakes.md. - General code projects (Python, JS, etc.): write general bugs and coding solutions back to
Development/General-Mistakes.md. - General tasks / conversations: if the user completes a focus session, brainstorms ideas, or plans tasks, write a bullet-point summary of the session directly to the bottom of the active daily note:
Personal/Daily-Logs/[YYYY-MM-DD].md.
- Domain projects (e.g. Odoo): write tracebacks and framework fixes back to
- Never log learnings to temporary directories. Keep all memory centralized inside the vault.
🦖 7. Mistakes-Log Pruning & Context Compaction
- File length limit: if a domain mistakes file (e.g.
Development/Odoo/Odoo-Mistakes.md) exceeds 30 entries, the agent must automatically archive older resolved entries. - How: call the
vault-prunerskill — it handles classification and archiving automatically. - Archive process:
- Create or open archive files under
Development/<Domain>/Mistakes/Archive_<Category>.md. - Move older entries from the main mistakes file into the respective archive file.
- Keep the most recent 20 rules in the main file to keep the context window small, fast, and token-efficient.
- Create or open archive files under
🔍 8. Finding New Skills
- If a task could benefit from a community skill that doesn't exist in the vault yet, use the
find-skillsskill. - It uses
npx skills find [query]to search the skills.sh ecosystem and can install skills withnpx skills add <package> -g -y. - When a new skill is installed, add it to the relevant alias/context so future sessions pick it up.
🐴 9. Ponytail — YAGNI Enforcement (General Code Only)
- Applies to: general Python, JavaScript, Bash, Shell scripts — not framework ORM boilerplate that requires its own conventions (e.g. Odoo models/views/security files).
- Rule: for any general utility, script, or non-boilerplate task, apply YAGNI principles:
- Question if the task needs to exist at all.
- Reach for stdlib/native tools before writing custom code.
- One line before fifty. No speculative abstractions.
- Invoke: the
ponytailskill/plugin (installed separately — not part of this vault's.agents/skills/) for any general code task, andponytail-reviewafter writing a general utility to catch over-engineering. - Never apply this to: ORM models, views, security files, or anything inside a framework module that requires its own boilerplate patterns.
⚙️ 10. SAFe Agentic Workflow (SAW) — Structured Multi-Agent Commands
Modeled on https://github.com/bybren-llc/safe-agentic-workflow. Available vault-wide via .claude/commands/ and .claude/agents/.
Claude Code Slash Commands
| Command | What It Does |
/start-work [description] | AC/DoD gate → vault task note → feature branch |
/end-work | Commit checklist + vault note update + handoff |
/pre-pr | Full validation (tests, rebase, AC/DoD) before PR creation |
/quick-fix [bug] | Fast-track workflow for small isolated fixes |
/retro | Retrospective — surfaces learnings for brain-sync |
/search-pattern <pattern> [ext] | Codebase pattern search |
Agent Profiles (.claude/agents/)
| Agent | Role |
be-developer | Implementation with AC/DoD gate and ponytail |
qas | Gate owner — independent AC/DoD verification |
rte | PR creation, CI monitoring, merge coordination |
system-architect | Design review, ponytail ladder, architecture |
AC/DoD Gate Rule (All Agents)
- Never implement without Acceptance Criteria / Definition of Done.
- Task note lives at
Personal/Tasks/YYYY-MM-DD-[slug].md. - You are NOT responsible for inventing AC/DoD — halt and ask the user.
Skills Supporting the Workflow (.agents/skills/)
safe-workflow— branch naming, commit format, PR workflowspec-creation— AC/DoD spec templatessecurity-audit— OWASP checklist, credential scanningtesting-patterns— test strategy patternsgit-advanced— advanced git operations
🕸️ 11. Graphify — Knowledge Graph Codebase Navigation
Graphify (installed separately — see repo README) is a CLI that builds graphify-out/graph.json, a queryable graph of files, functions, and cross-file relationships for a codebase (code + docs). It is distinct from the .agents/skills/ registry (skills.sh ecosystem, section 8); it's native to Claude Code and lives in .claude/skills/graphify/.
- Rule: for codebase questions, run
graphify query "<question>"before grepping whengraphify-out/graph.jsonexists; usegraphify path "A" "B"for relationships,graphify explain "X"for a concept,graphify affected "X"to find callers/impact. - Keep it fresh: run
graphify update .after code changes (AST-only, no LLM cost). - Per-project graphs: if you work across multiple codebases from one vault, consider storing each project's
graphify-out/outside that project's own git history (e.g. a visibleGraphify/projects/<name>/folder in the vault, symlinked into each project asgraphify-out) so multi-MB graph files don't bloat your project repos. When two projects are architecturally connected, build each separately, thengraphify merge-graphsthem into one combined graph, then re-cluster the merged graph as one unit (graphify cluster-only --backend claude-cli) before labeling — plainmerge-graphsonly unions two independently-clustered graphs, so community IDs collide across projects until re-clustered. - Backend: if you don't have an
ANTHROPIC_API_KEYset, use--backend claude-clifor semantic extraction (docs/notes) — it shells out to the localclaudeCLI instead of an API key. - Hooks: the installer can register
PreToolUsehooks onBash/Read/Globin.claude/settings.json(graphify hook-guard) — these are non-blocking nudges toward the graph, not enforcement. - MCP server:
graphify-mcpcan be registered project-wide in.mcp.json(query/explain/path/affected as native tool calls instead of Bash) — see.mcp.json.example. New MCP servers need a one-time approval prompt on session start.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

