Imported from omardeangelis/mito-micro-services (
brain/AGENTS.md). Install upstream withnpx skills add omardeangelis/mito-micro-services --skill brain. Copyright stays with the author.
Brain Schema
This file defines how any agent operates within brain/. Read it before creating or modifying brain content.
AGENTS.mdandCLAUDE.mdin this folder are kept identical on purpose, so any agent (Claude Code, Codex, Cursor, …) discovers the same rules. Edit both when you change one.
Skill Routing
Primary skills here: create-spec, create-plan, implement-spec, adversarial-review, docs-maintenance, grill-me, swarm-plan, tdd, simplify.
- Use
create-specto author aSPEC.mdin the problem space (the what, not the how). - Use
create-planto turn an approved spec into an execution-readyPLAN.md. It wrapsgrill-me,swarm-plan, andtddas inner phases. - Use
implement-specto execute an approved spec folder. Choose the execution mode inside the skill:sequentialorparallel. - Use
docs-maintenanceto ingest a spec folder into the brain domain layer and create missing domain scaffolding when needed. docs-maintenanceowns the full ingest pipeline. It creates or updates the domain map/contract when needed, then writes flow pages first, then concept pages.- Do not hand-write
domains/<domain>/flows/ordomains/<domain>/concepts/pages when that ingest workflow applies. SPEC.mdandIMPLEMENTATION-NOTES.mdremain the source material, but the ingest orchestrator may update their frontmatter/link bookkeeping (ingested,last_ingested, backlinks) as part of the pipeline.- Use
adversarial-reviewas an independent, bias-free quality gate on a code change or spec implementation: it classifies the change (review-classifier) then fans out independentadversarial-verifierpasses and writes a SHIP / DO-NOT-SHIPREPORT.md. - Use
prototype— explicit invocation only, never auto-routed — to explore N genuinely different variants of one UI piece behind a visual picker. The winner is never integrated by hand: it becomes the input tocreate-spec, and the prototype surface is deleted onceimplement-speclands the real implementation.
Advisor subagents
Shipped advisor subagents live in .agents/agents/ (symlinked into each capable provider, e.g. .claude/agents/). The spec-driven skills spawn them so reasoning is verified without consuming the orchestrator's context:
ux-advisor— writes a spec'sFLOW.md(user-flow contract) and pressure-tests implementation order.adversarial-verifier— clean-context quality gate that builds the strongest case against an artifact (spec, plan, or diff) and returns SHIP / DO NOT SHIP.review-classifier— routes theadversarial-reviewpipeline (how many verifier passes, at what depth).design-engineer— motion / interaction-craft advisor: motion budget and exact values (easing, durations, springs, reduced motion) increate-plan, pre-task motion decisions inimplement-spec, the motion-craft bar for anadversarial-reviewverifier pass, and read-only motion audits written tochore/animation-plans/. Routes to the project'sdesign-engineeringskill when one exists, else its built-in baseline.
No subagent runtime? Most non-Claude tools cannot spawn subagents yet. When that is your case, do not skip the advisor steps — run the named advisor's charter (
.agents/agents/<name>.md) inline in your main context: you lose the clean-context isolation but keep the same rubric and the same checks. Skipping is only for when the advisor file is not installed at all.
Spec-Driven Rules
Non-negotiables every spec-driven skill respects:
- Specs live in the problem space — the what and why, never the how.
- One
SPEC.mdmaps to one capability/epic; when child stories exist, their requirements are unified beneath it. - No code is written during
create-specorcreate-plan. Implementation happens only inimplement-spec. - Tests describe behavior through public interfaces (see
tdd). No horizontal slicing (all-tests-then-all-code). - Persistent implementation drift is tracked in
tech-debt/<domain>/<spec>.md, not buried in spec folders. - Domain knowledge in
domains/is written bydocs-maintenance, not hand-authored.
Project-specific gates (build/test/lint commands, review gates, contract/codegen chains) live in the repo-root
AGENTS.md, not here — that is the file every AI tool reads.
Directory Conventions
raw/ — Immutable Sources
Human-authored source material. Agent reads but never edits.
meetings/— meeting notes, transcriptsexternal/— external docs, reference materialassets/— binary files, images, PDFs
specs/ — Feature Specifications
PM-authored specifications organized by domain. Agents should treat their product intent as source material and should not rewrite requirements casually, but the ingest orchestrator may update frontmatter/link bookkeeping when processing them into domain knowledge.
specs/<domain>/<domain>-specs.md— domain spec page map (entry point for discovery)specs/<domain>/<spec-name>/SPEC.md— individual spec filespecs/<domain>/<spec-name>/FLOW.md— optional user-flow contract (Goal · Personas · Entry points · Happy path · Error paths · Edge cases), written by theux-advisoragent duringcreate-spec; consumed bycreate-plan,implement-spec, anddocs-maintenancespecs/<domain>/<spec-name>/PLAN.md— optional implementation plan for that specspecs/<domain>/<spec-name>/IMPLEMENTATION-NOTES.md— run-local reviewer context for that spec implementation; carries its own frontmatter andingestedtrackingspecs/<domain>/<spec-name>/RUBRIC.md+REPORT.md— optionaladversarial-reviewartifacts (routing rubric + SHIP/DO-NOT-SHIP verdict) for that spec implementation
review/ — Standalone Review Artifacts
adversarial-review outputs for code not tied to a spec (case A). One folder per review; spec-implementation reviews live inside the spec folder instead.
review/<slug>/RUBRIC.md+REPORT.md— routing rubric + SHIP/DO-NOT-SHIP verdict for a standalone diff/branch/PR
chore/ — Informal Planning Material
Repo-level planning scratch. Allowed to be informal. Promote durable decisions into domains/<domain>/decisions/.
- e.g.
tech-stack.md, product description, user stories, implementation backlog animation-plans/— prioritized motion audit plans written by thedesign-engineeragent (read-only on source; promote large findings tocreate-spec)
domains/<name>/ — Synthesized Domain Knowledge
Agent-owned synthesis layer. This is where the LLM writes.
<domain>.md— domain page map. Updated on every ingest or page creation. The stable entry point skills read to discover what exists. Named after the domain so it is identifiable in graph view (e.g.patients.md,auth.md).<domain>-contract.md— domain boundaries, invariants, ownership, what it does NOT do. Three sections: Owns, Does Not Own, Invariants. Named with domain prefix for graph readability (e.g.patients-contract.md).concepts/— one page per core conceptflows/— step-by-step user or system flowsdecisions/— domain-level ADRs
Frontmatter Schema
Base (all brain pages)
---
domain: auth | user-management | documents
type: concept | flow | decision | contract | index | spec | implementation-notes
links: []
created: YYYY-MM-DD
updated: YYYY-MM-DD
---
Spec-only addition
status: draft | review | approved | implemented
status is required when type: spec, omitted for all others.
Domain pages (concepts, flows, decisions, contracts)
ingested: true | false
last_ingested: YYYY-MM-DD | null
Tracks whether the LLM has processed the page. Enables staleness queries.
Implementation notes (type: implementation-notes)
---
domain: <domain>
type: implementation-notes
spec: <spec-id> # e.g. CP-120
links:
- "[[specs/<domain>/<spec>/SPEC]]" # always: own spec
- "[[domains/<domain>/flows/<flow>]]" # added after each flow is written
- "[[domains/<domain>/concepts/<concept>]]" # added after each concept is written
ingested: true | false
last_ingested: YYYY-MM-DD | null
created: YYYY-MM-DD
updated: YYYY-MM-DD
---
ingested: true means the notes were processed by docs-maintenance and their deviations/surprises are reflected in the domain flow and concept pages. Set only by the ingest orchestrator — never by hand.
Raw files
ingested: true | false
last_ingested: YYYY-MM-DD | null
Ingest Workflow
When processing source material into domain knowledge:
- Read source fully
- Identify which domains it touches
- For each domain: update
<domain>.md, update or create flow pages first, then concept pages - Flag contradictions with
> [!warning] CONTRADICTS [[page]] - Append entry to
log.md(cap at 50 entries — drop oldest if over) - Update root
index.mdif new pages created - Set
ingested: trueandlast_ingestedon processed source and created/updated pages, includingIMPLEMENTATION-NOTES.mdwhen present
Cross-Domain Linking Rules
- Use
[[wikilinks]]freely between domains - A concept in one domain should link to related concepts in other domains
- Backlinks from domain pages to source specs:
[[specs/domain/spec-name]]
Lint Rules
- Orphan pages (no inbound links) = knowledge gaps
- Pages without frontmatter = malformed
- Stale pages (not updated in 30+ days after related ingest) = review needed
- Contradictions flagged but unresolved = action items
Relationship to tech-debt/
tech-debt/<domain>/<spec>.mdowns persistent implementation drift tied to one spec; keep temporary execution notes in the spec folder instead
