A drop-in "Second Brain" convention for AI coding agents. One folder, one contract, and every agent that touches your project can recover the same stack, conventions, decisions, memory, and implementation history.
Current standard version: 0.3.0
AI coding tools often forget the same project context every session:
- Stack and conventions are rediscovered repeatedly.
- Tool-specific memory files do not share one format.
- Plans and decisions stay trapped in chat history.
- Old decisions are reversed because nobody can find why they were made.
Agent-SWI keeps that knowledge in plain Markdown inside the repo. It is not a library or runtime. It is a small, tool-agnostic documentation standard with no executable files.
| Capability | File |
|---|---|
| Agent entry point | BRAIN.md |
| Standard version | .agent/version.md |
| Stack snapshot | .agent/stack.md |
| Project-specific rules | .agent/conventions.md |
| Domain vocabulary | .agent/glossary.md |
| Daily memory log | .agent/memory/yyyy-mm-dd.md |
| Keyword-indexed memory | .agent/memory/index.md |
| Searchable cold archive | .agent/archive/index.md, .agent/archive/yyyy/qN.md |
| Reusable skill playbooks | .agent/skills/*.md |
| Skill discovery index | .agent/skills/index.md |
| Per-day implementation plans | .agent/implementation/implementation_plan_dd-mm-yyyy.md |
| Architecture Decision Records | .agent/decisions/NNNN-*.md |
| Work timeline | .agent/task.md |
| Starter templates | .agent/templates/*.md |
| Structure checklist | .agent/checklists/structure_checklist.md |
| Optional validators | .agent/tools/validate.sh, .agent/tools/validate.ps1 |
.
├── BRAIN.md
└── .agent/
├── version.md
├── task.md
├── stack.md
├── conventions.md
├── glossary.md
├── checklists/
│ └── structure_checklist.md
├── memory/
│ ├── index.md
│ └── yyyy-mm-dd.md
├── archive/
│ ├── index.md
│ └── yyyy/
│ └── qN.md
├── skills/
│ ├── index.md
│ └── *.md
├── implementation/ # optional — created on first implementation plan
├── decisions/ # your project's ADRs go here
├── templates/
└── tools/ # optional — opt-in validators (validate.sh / validate.ps1)
Optional directories.
implementation/andtools/are not required to exist.implementation/is created the first time you write an implementation plan;tools/holds the opt-in validators. The rest of the tree is the expected baseline.
git clone --depth=1 https://github.com/chatchai98/Agent-SWI tmp-swi
cp -r tmp-swi/BRAIN.md tmp-swi/.agent .
rm -rf tmp-swiThis repo ships as a clean skeleton: empty scaffolds for stack.md,
conventions.md, and glossary.md, an empty decisions/, and empty indexes.
You start fresh and fill them in.
On the first AI session in the target repo, say:
Read
BRAIN.mdand follow it.
BRAIN.md explains the required read order and the first-time setup flow.
Saying "read BRAIN.md" only affects the current session. To make every AI tool pick up the standard automatically in every new session — without you reminding it — set up pointer files once. These are the files each tool loads on its own at startup:
| AI Tool | File it auto-loads |
|---|---|
| Claude Code | CLAUDE.md |
| Codex CLI / OpenCode | AGENTS.md |
| Gemini CLI | GEMINI.md |
| Cursor | .cursor/rules/agent.mdc |
| GitHub Copilot | .github/copilot-instructions.md |
| Windsurf | .windsurfrules |
Each pointer just says "read BRAIN.md first." On the first session, your AI will offer to create them — say yes and pick the tools you use. The skill .agent/skills/bootstrap-cli-pointers.md does this safely (it injects into existing files without overwriting your content).
Without this step the standard still works, but you must say "read BRAIN.md" at the start of every session.
Before relying on the system, replace the placeholders in:
.agent/stack.md.agent/conventions.md.agent/glossary.md
Each scaffold contains inline placeholders describing what to fill in.
Use .agent/checklists/structure_checklist.md after copying or changing the standard. It checks frontmatter, naming conventions, index coverage, and template heading consistency.
- Read order:
BRAIN.md->.agent/task.md->.agent/stack.md->.agent/conventions.md->.agent/glossary.md->.agent/memory/index.md->.agent/archive/index.mdonly when older context is needed ->.agent/skills/index.md-> relevant implementation plans and ADRs. - Same-day artifacts append, never duplicate. Memory and implementation files use
## Section N - <topic> [HH:MM]. - Index all memory, archive entries, and skills. A section or skill that is not indexed is effectively invisible.
- Respect work mode. In read-only or review work, report missing indexes or stale docs instead of editing them.
- Every generated artifact has YAML frontmatter.
- Trust code over docs. If they disagree, trust the code and update the docs when writes are allowed.
- Use ADRs for architectural decisions. ADRs are required for persistence, auth, deployment, public API, data model, cross-module contracts, or tooling standards. Small local refactors and direct bug fixes usually do not need ADRs.
Agent-SWI is Markdown-only. Use .agent/checklists/structure_checklist.md for manual consistency checks.
The checklist covers:
.agent/version.mdexists and contains the standard semantic version.- Required
.agentfiles exist. .agent/skills/*.mdfiles are listed in.agent/skills/index.md.- Archive entries are listed in
.agent/archive/index.md. - Artifact files under memory, archive, implementation, skills, and decisions have YAML frontmatter.
- Implementation and ADR filenames match the standard patterns.
- Memory and implementation templates use the canonical section heading format.
The checklist is a guardrail, not a replacement for review. If the checklist and BRAIN.md disagree, update BRAIN.md first, then update the checklist.
Agent-SWI uses semantic versioning for the standard itself:
- Patch: typo fixes or clarifications that do not change workflow.
- Minor: new optional files, examples, checklists, or compatible workflow improvements.
- Major: breaking changes to file layout, required fields, or agent workflow.
.agent/version.md records which standard version a project is on. See the GitHub releases for changes between versions.
Do I need every file?
No. The minimum useful subset is BRAIN.md, .agent/task.md, .agent/memory/, .agent/memory/index.md, and .agent/archive/index.md. The full set is recommended for teams and multi-agent workflows.
Why Markdown instead of a database?
Markdown is portable, easy to diff, and already readable by AI agents and humans.
Can humans use this too?
Yes. task.md, ADRs, and memory logs are meant to be useful to humans first. AI agents maintain them because they are good at repetitive bookkeeping.
MIT. See LICENSE.
Copyright (c) 2026 Chatchai.J chatchai.j98@gmail.com
Start with BRAIN.md.