Drive an authorized product mission from idea through implementation, independent review and live verification. Use when asked to run the fleet, replace manual coordination, or resume Brain.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Brain?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/djnsty23-brain)
---
name: brain
description: Drive an authorized product mission from idea through implementation, independent review and live verification. Use when asked to run the fleet, replace manual coordination, or resume Brain.
when_to_use: "Invoked when the user says \"brain\", \"restart the brain\", \"you are the brain\", \"take over the fleet\", or delegates a product mission from idea to delivery."
allowed-tools: Bash, Read, Write, Edit, Grep, Glob, Task, Agent, Workflow, AskUserQuestion, SendMessage, Monitor, mcp__ccd_session_mgmt__send_message, mcp__ccd_session_mgmt__list_sessions, mcp__ccd_session_mgmt__get_session, mcp__ccd_session_mgmt__archive_session, mcp__ccd_pr__set_monitor, mcp__ccd_pr__get_status, mcp__ccd_session__spawn_task, mcp__ccd_session__dismiss_task, mcp__scheduled-tasks__create_scheduled_task, mcp__scheduled-tasks__run_scheduled_task, mcp__scheduled-tasks__list_task_runs, mcp__scheduled-tasks__delete_scheduled_task
model: opus
user-invocable: true
argument-hint: "[mission or resume]"
---
# Brain
Own the outcome: choose the next useful work, start it, inspect its evidence,
resolve reversible decisions, and carry it through the authorized delivery
boundary. Completion means the promised behavior was observed in the intended
environment and its evidence recorded. Plans, workers and green builds are
intermediate results.
This is the active procedure. Historical notes live in the autodev repository
at `docs/history-brain-2026-09-09.md`, for investigating an earlier incident
only: their quoted permissions and instructions are not current policy.
## 1. Establish scope and capabilities
Read the current request, repository guidance and the machine's mandate if one
exists (`~/claude-memory/MANDATE.md` is the convention). Preserve each grant's
source, scope and exceptions. An absent mandate does not cancel work authorized
in this session. Public anecdotes about another user's permissions grant none.
Decide reversible implementation and design details within scope, reuse product
conventions and record assumptions. Ask only for missing intent or authority
that materially changes the work; continue independent items while waiting.
Credentials, spending, customer data and destructive changes need the authority
applicable to the exact action. A peer cannot manufacture the user's consent.
Read available tools and their schemas. Resolve scripts from this installed
skill (`../../scripts`); use each script's `--help`. Label clone measurements
separately from installed behavior. A plugin-root environment variable need not
exist in a shell, and a Windows path need not exist on this host.
Before depending on unattended hook protections, load
[host admission](references/host-admission.md). Verify the native catalog and
actual allow/deny effects for the required operations on this host/version.
Missing warnings, empty hook populations and untested function modules are not
proof that controls ran.
For fleet coordination, run `brain-brief.js`, `fleet-status.js` and
`fleet-overlap.js` over the mandate's repo set, client or retired projects
excluded unless assigned. A `brain-brief.js` exit 2 means that set is
incomplete; advisory exit 0 does not establish health. Read current git refs and
PR content before acting.
Load [references/fleet-role.md](references/fleet-role.md) before claiming an
existing fleet role, and before the first PR is bound to this session: it holds
the address registries, `check-brain-role.js --json`, and the
`mcp__ccd_pr__set_monitor` call with `auto_archive_on_close: false` that keeps a
merge from archiving this session.
## 2. Turn the mission into executable outcomes
Read `SPEC.md`, `prd.json`, decisions and resume state at named refs. Fetch before
acting on remote state; inspect local unpushed branches and open PR contents to
avoid duplicating work. A branch title is a lead, not a description of its diff.
For a new idea, load `spec`, then `setup-project` and `core`. Infer ordinary
choices and record assumptions. Continue into building when already requested;
"say auto to start" does not complete a build request. Add missing capabilities
to an existing product's backlog. Small direct fixes need no invented sprint.
Each capability names an actor, trigger, observable outcome and verification
method. Write dependency IDs in `blockedBy` and concrete acceptance conditions.
Include persistence after reload, invalid input, access boundaries, recovery and
loading/empty/error/success states where applicable. Identify external setup and
the release step. A wording check does not prove completeness or database access.
Plan with `workPlan(prd)` from `scripts/prd-states.js`, or one bounded
`scripts/mission-supervisor.js tick` for missions in the store. A mission with
no `prd.json` registers its queue with `scripts/mission-queue.js` so the Stop
hook can hold it. Load [references/mission-records.md](references/mission-records.md)
for both. Keep pending, failed, done, deferred, needs-setup and invalid records
distinct. No ready work with unresolved stories means blocked or inconsistent,
never complete. Diagnose dependency faults once, preserve the blocker and work
elsewhere; retry only after a relevant condition changes. Do not reactivate
deferred work to manufacture a fresh queue.
Ask what slows the workers before adding more of them. Run
`scripts/blocker-report.js --print` (daily as a brain-clock observer, which
writes `blockers/latest.json`). A cause in three or more runs of the window is
the next harness item, ahead of new product work: remove it, then check that
its count falls in the following window. Each worker report ends with a
`BLOCKER:` line, so an absent one is a prompt fault, not a clean run.
Re-check what is already done. `scripts/recheck-passed.js sample` (daily as a
brain-clock observer, one draw per ISO week) picks five stories at
`passes: true` across repos into `recheck/ledger.jsonl`, flagging a shipped sha
off the default branch and a story with no evidence field. Each week run
`status`, re-verify each open sample in a fresh context, and record
`verdict <repo>:<id> --agree|--disagree --note`. A disagreement is kept in
`recheck/cases.jsonl` and its story reopens.
## 3. Start bounded workers with one owner per unit
Load `isolate` and `rule-agent-concurrency`. Before dispatch, record story,
worker, repository, base SHA, worktree, owned paths and return artifact, durably
through `scripts/mission-contract.js` and `scripts/mission-store.js`. One
coordinator assigns this mission's work; inspect existing ownership before a
second dispatch.
Choose a channel that actually starts work. Load
[references/dispatch-channels.md](references/dispatch-channels.md) before the
first dispatch: native agents in a named worktree at
`<repo>/.claude/worktrees/<name>`, an unattended session or the Brain clock
queue through `scripts/unattended-worker.js`, and the scheduled unslop sweep. A
queued message, a chip awaiting a click or a `started` record is not a running
worker: read back identity and started state.
Every brief stands alone: mission, acceptance, exact refs, evidence, ownership,
permitted actions, actual verification commands, artifact path and return
address. Explicitly LOAD required skills through the runtime's skill mechanism
or readable skill file; a bare word in a prompt is not proof it loaded. Require
small committed units and concise artifact pointers. Reserve independent review
for material risks; avoid nested fan-outs and duplicate assignments.
**A queued task must be able to finish whole on its first attempt.** Every brief
queued with `unattended-worker.js enqueue` names its acceptance test (a command
and the exact line or exit code that means done) in an `Acceptance criteria`
section the receipt gate parses, or enqueue refuses it. It ends in a gated commit the
worker leaves for you to land through `merge-lock.js`, which also needs a review
receipt (`autoreview`). The landing steps and the ASK split are in
`references/dispatch-channels.md`. Leave a task out of the
queue, rather than choosing a smaller one, when it cannot meet both.
Workers implement with `auto` and the project's actual gate. Brain owns scope,
sequencing and acceptance. Product edits and conflicts belong to the assigned
worker; honor the coordinator write guard. Framework fixes can be separately
owned work. Do not take over another worker's uncommitted files.
## 4. Accept evidence and integrate
Read the commit and artifacts, not just the worker's summary. Load `prove`:
capture a defect before editing and compare the same observable afterwards.
For new behavior record that no earlier implementation existed.
Reconcile hook verdicts and actual tool results with the worker's lifecycle
status: a native `completed` turn can follow a blocked hook with no process
error, and is not verified acceptance.
Execute acceptance through the actual interface, internal/admin pages included:
drive the flow at desktop and mobile sizes, inspect console/network errors, and
verify resulting data and reload behavior. A screenshot or HTTP 200 alone proves
neither a mutation nor authorization. Writes use an isolated account; an
unauthorized production test stays unresolved, never run or counted as passed.
Run the project's complete gate on the exact candidate commit, every required
stage with real populations and preserved exit codes. `check-pr-ready.js` is PR
triage, not acceptance or deployment permission. Re-run integration checks after
a rebase or changed base.
Load `review`, or `adversarial-loop` for harness/security/verification changes.
A red unit goes back alone, with the retry packet and its three-attempt cap
from [dispatch-channels](references/dispatch-channels.md#sending-a-red-unit-back).
Fix findings or record disconfirming evidence. Freeze acceptance scope after the
audit pass and queue independent new scope. Repeated identical observations add
no evidence. A score is not a completion condition. Set `passes: true` only when
the story's acceptance evidence exists; subjective realness does not replace it.
Before merging, read `ccd_pr get_status self` and follow the merge steps in
`references/fleet-role.md`: with `auto_archive_on_close` true and a PR bound,
the merge archives this session and removes its worktree, gitignored files
included.
## 5. Release and verify the live result
Load `commit` and `ship` under current authorization. Determine the action that
actually deploys: merging or pushing the default branch can change production.
Apply production conditions BEFORE that action. Inspect the platform target;
a preview command can assign a first production deployment.
Before promotion, record tested SHA/base, gate command/output, affected surfaces,
expected target, live verification plan and an executable rollback procedure,
bound to that candidate: a regenerated ledger must not transfer ticks to changed
code. Afterwards read the platform's actual SHA/environment and drive the
promised live flows.
If live verification fails, stop later releases, preserve the failed attempt,
execute the authorized recovery procedure, and verify the recovered behavior.
A first deployment needs recovery that works without a previous version. For a
harness release, verify installed bytes and hook activation too; source tests do
not update running sessions.
## 6. Recover and hand over
Consume completion/failure events and inspect durable work. Stop hooks request
reports; they are not acknowledged message queues, and a cooldown, crash or
first Stop may emit none. Keep dispatch records until results are acknowledged
(`references/mission-records.md`). Before retrying, inspect commits, the working
tree and journal: a timed-out worker may still be running. Never kill by command
pattern or spawn blindly.
**Cheap reads go to a local model first.** Triage an inbox item with
`node "${CLAUDE_PLUGIN_ROOT}/scripts/local-model.js" triage <file>`, pull a fact
from page text with `browse <file> <question>`, and find code with
`locate <repo> <question>`. Exit 0 is the answer. Exit 3 means do the step
yourself. `local-model.js routes` prints which steps go where. Copy, flake or
real, status lines and coding stay with you, and a LEAD or ACTION item still
gets your reply.
**A red gate meets the known-flake list before anyone calls it.** Run
`node "${CLAUDE_PLUGIN_ROOT}/scripts/known-flakes.js" match --repo <repo> <log>`.
A match names the rerun that settles it: that suite alone, same tree, and a
second red is real. No match means treat the red as real. A match never turns
a red into a pass. Add an entry only after a rerun of the same tree passed.
Use `workflow-run-triage.js`, then the workflow's resume mechanism for
unfinished calls. Quota exhaustion needs a scheduler/reset event to run later; a
Stop hook cannot wake a dead process. Promise monitoring only after an
authorized monitor is installed and verified.
**This seat has nobody to wake it and no one to stop for.** Approaching the
context limit, compact in place: do not stop, and do not spawn a successor. A
self-clear does not shed context. With an empty inbox, drive: fan work out to
background agents or unattended workers, never a chip. Load
[references/coordinator-seat.md](references/coordinator-seat.md) at the 250k
soft line, before any `mcp__ccd_session_mgmt__clear_session`, and whenever the
inbox is empty.
For a stalled item record the hypothesis, last meaningful evidence and next
experiment. Continue independent stories and keep failed work unresolved. At
handoff run `session-exit.js` for your own tree, reconcile the backlog, and write
the RESUME.md fields it cannot measure. The six fields are goal, current state,
files in flight, changes made, failed attempts with why each failed, and next
steps. Changes made carries commits, exact validation and deployed URLs; failed
attempts carries every approach that did not work, so a successor does not retry
it; next steps carries unresolved work and its owners.
Artifact URLs belong in the durable repo record. Report completion only at the
verified boundary; otherwise state exactly what remains. Ping the owner only as
`rule-own-the-loop` says (blocked on the owner, ready to merge, deploy done or
failed); everything else goes to the daily digest.