The agent loop
Every coach, at the step where it acts
One turn of Claude Code, from session start to session end, with all 11 coaches, the engine's 12 hook bindings, 29 skills, 6 agents and 4 commands placed where they enter it. Drag to move, ctrl + wheel to zoom. Read it as text ↓
The same map, as text
The loop, step by step
- Session start. startup · resume · clear · compact Hook context reaches the model before the first prompt. Claude Code docs
session-start.js(ai-coach-core): injects the brief. brief ≤ 4,000 chars; settable 500–16,000; compact: 1,000 + snapshot; branch/seed/partner nudges. Writes: the session row. plugins/ai-coach-core/hooks/session-start.js:44
- Your prompt. UserPromptSubmit: hooks add context beside it. A /plugin:skill you type loads that skill. A systemMessage reaches only you. Claude Code docs
prompt.js(ai-coach-core): records · hints to you. skips < 25 chars, / and !; hints: systemMessage only; never shown to the model; plan mode: a Haiku review. Writes: first prompt (scrubbed), signal ids. plugins/ai-coach-core/hooks/prompt.js:34/ai-coach:start(ai-coach (bundle)): day one, --run chains. Asks: says what --run costs, once, and asks. plugins/ai-coach/commands/start.md:59/ai-coach:wrap(ai-coach (bundle)): one question, publish. Asks: one question for every identity gap. plugins/ai-coach/commands/wrap.md:16/ai-coach:sitrep(ai-coach (bundle)): read-only morning read. plugins/ai-coach/commands/sitrep.md:7/investigation-coach:investigate(investigation-coach): all three, in order. plugins/investigation-coach/commands/investigate.md:12/strategy-coach:feature(strategy-coach): spec, then plan. Asks: no plan.md until you answer. Writes: docs/features/<slug>/. plugins/strategy-coach/skills/feature/SKILL.md:53/analysis-coach:elicit(analysis-coach): requirements. Writes: docs/requirements/. plugins/analysis-coach/skills/elicit/SKILL.md:2/analysis-coach:insight(analysis-coach): analysis, critiqued. Writes: docs/analysis/. plugins/analysis-coach/skills/insight/SKILL.md:49/analysis-coach:story(analysis-coach): executive write-up. plugins/analysis-coach/skills/story/SKILL.md:2/atlas-coach:research(atlas-coach): verified web research. Writes: research/<slug>.md. plugins/atlas-coach/skills/research/SKILL.md:10/atlas-coach:market(atlas-coach): competitor analysis. Writes: docs/market/. plugins/atlas-coach/skills/market/SKILL.md:61/atlas-coach:ingest(atlas-coach): docs in · Haiku. Asks: stops on a spotlight warning. Writes: docs/<slug>.md. plugins/atlas-coach/skills/ingest/SKILL.md:34/atlas-coach:translate(atlas-coach): docs to code. plugins/atlas-coach/skills/translate/SKILL.md:28/security-coach:scan(security-coach): injection scan · Haiku. plugins/security-coach/skills/scan/SKILL.md:28/security-coach:audit(security-coach): OWASP audit · Haiku. Asks: --triage asks before recording. Writes: findings. plugins/security-coach/skills/audit/SKILL.md:67/security-coach:triage(security-coach): pentest report · Haiku. Writes: findings, .ai-coach/security/. plugins/security-coach/skills/triage/SKILL.md:41/prompt-coach:prompt(prompt-coach): a prompt that lands. plugins/prompt-coach/skills/prompt/SKILL.md:2/prompt-coach:scope(prompt-coach): shape a big ask. Asks: any FAIL stops the walk. plugins/prompt-coach/skills/scope/SKILL.md:66/prompt-coach:prompt-stats(prompt-coach): habits that cost you. plugins/prompt-coach/skills/prompt-stats/SKILL.md:2/harness-coach:context(harness-coach): what fills the session. plugins/harness-coach/skills/context/SKILL.md:66/harness-coach:partners(harness-coach): partner tools · Haiku. Asks: installs only what you pick. plugins/harness-coach/skills/partners/SKILL.md:12mentions-nudge.js(pair-coach): names open threads. your uncommitted lines; ≤ 5 locations. plugins/pair-coach/hooks/mentions-nudge.js:15/pair-coach:pair(pair-coach): 1–3 stubs for you. Writes: code, tests, stubs that throw. plugins/pair-coach/skills/pair/SKILL.md:23/ship-coach:commit(ship-coach): Haiku · low effort. Asks: one look at the whole plan. Writes: a commit, a branch, a PR. plugins/ship-coach/skills/commit/SKILL.md:43
- Model turn. Answers in text, or calls tools: Skill, Agent, Read, Edit, Bash, WebFetch, Artifact. 11 skill descriptions are always in context. Claude Code docs
/memory-coach:recall(memory-coach): searches memory. plugins/memory-coach/skills/recall/SKILL.md:61/memory-coach:debrief(memory-coach): publishes conclusions. Asks: shows the draft, then publishes. Writes: a debrief. plugins/memory-coach/skills/debrief/SKILL.md:35/memory-coach:handoff(memory-coach): exports the team seed. Asks: exports only on a yes. Writes: .ai-coach/team-seed.jsonl. plugins/memory-coach/skills/handoff/SKILL.md:59/memory-coach:roster(memory-coach): who is on the team. Asks: asks for your role. Writes: .ai-coach/team.md. plugins/memory-coach/skills/roster/SKILL.md:31/investigation-coach:onboard(investigation-coach): onboarding docs. Asks: states the cost before starting. Writes: docs/onboarding/. plugins/investigation-coach/skills/onboard/SKILL.md:46/investigation-coach:map(investigation-coach): maps → artifact-style. Writes: docs/onboarding/components/, an Artifact. plugins/investigation-coach/skills/map/SKILL.md:34/investigation-coach:study(investigation-coach): study material. Writes: docs/study/. plugins/investigation-coach/skills/study/SKILL.md:11/strategy-coach:blueprint(strategy-coach): the business vault. Asks: you correct the domain first. Writes: docs/business/, an Artifact. plugins/strategy-coach/skills/blueprint/SKILL.md:65/prompt-coach:dispatch(prompt-coach): brief a subagent. plugins/prompt-coach/skills/dispatch/SKILL.md:86/design-coach:artifact-style(design-coach): checkable pages. Writes: an Artifact page. plugins/design-coach/skills/artifact-style/SKILL.md:38/pair-coach:mentions(pair-coach): answers @claude inline. Asks: asks about lines someone else committed. Writes: replies and changes in the code. plugins/pair-coach/skills/mentions/SKILL.md:40
- Pre-tool. PreToolUse runs before every call, permission or not. deny > defer > ask > allow. Claude Code docs
guard.js(ai-coach-core): blocks or asks: secrets. off by default; blocks real credentials; asks: secret out, key read; only hook that can block. Asks: asks before a secret-looking payload leaves, or a credential file is read. plugins/ai-coach-core/hooks/guard.js:44artifact-lint.js(design-coach): asks on lint errors. Artifact .html publish; never denies. Asks: asks before a page that fails the lint is published. plugins/design-coach/hooks/artifact-lint.js:29
- Permission. Deny and ask rules still apply. A hook's ask shows here. Claude Code docs
- Tool runs. Skill: its body loads. Agent: a subagent runs its own loop in its own context and returns only its report. Its tool calls fire the same hooks. Claude Code docs
scout · sonnet(investigation-coach): read-only repo sweep. Read · Grep · Glob · Bash; ≤ 500 words, file:line. plugins/investigation-coach/agents/scout.md:4critic(analysis-coach): unanchored review. Read · Grep · Glob · Bash; never sees the reasoning. plugins/analysis-coach/agents/critic.md:2researcher · sonnet(atlas-coach): cited brief. WebFetch · WebSearch; ≤ 600 words, UNVERIFIED. plugins/atlas-coach/agents/researcher.md:4verifier(atlas-coach): tries to refute. WebFetch · WebSearch. plugins/atlas-coach/agents/verifier.md:2reader · haiku(atlas-coach): PDF, 20 pages a call. Read · Write · Bash. plugins/atlas-coach/agents/reader.md:4examiner(security-coach): quarantine reader. Read · Grep only; no shell, no network. plugins/security-coach/agents/examiner.md:2
- Post-tool. The result returns to the model. PostToolUse can add context; it can't undo the call. A failure fires PostToolUseFailure. Claude Code docs
observe.js(ai-coach-core): records the action. Edit · Write · Bash; <private> stripped first. Writes: one observation per action. plugins/ai-coach-core/hooks/observe.js:15spotlight.js(ai-coach-core): warns: injection. WebFetch, WebSearch, Read; Read outside the repo only; in full once per session; never blocks. plugins/ai-coach-core/hooks/spotlight.js:8observe.js · FAIL(ai-coach-core): records the failure. feeds the snapshot; and the distillation. Writes: a FAIL observation. plugins/ai-coach-core/hooks/observe.js:21artifact-nudge.js(design-coach): loads artifact-style. after native design skills. plugins/design-coach/hooks/artifact-nudge.js:9
- Turn ends · Notification. No tool call: the turn ends and waits for you. Notification: a permission prompt (~6 s) or idle (~60 s). Can't block. Claude Code docs
notice.js(ai-coach-core): records a correction. on error, failed, wrong…; prints nothing. Writes: a correction. plugins/ai-coach-core/hooks/notice.js:30
- Compaction. PreCompact, then the context is summarized. The session resumes as SessionStart:compact. Claude Code docs
precompact.js(ai-coach-core): saves where you were. branch, ≤ 8 files touched; last fail, ≤ 3 corrections; handed back once, deleted. Writes: a working-state snapshot. plugins/ai-coach-core/hooks/engine.js:1546
- Session end. SessionEnd: the last hook before the process exits. Claude Code docs
session-end.js(ai-coach-core): distils on Haiku. ≤ 3 learnings, 'distilled'; AICOACH_LEARN=off skips it; prunes at 30 and 90 days; never exports a seed. Writes: a summary and up to 3 learnings. plugins/ai-coach-core/hooks/session-end.js:37
- Across sessions. What this session leaves for the next one, and for teammates. README.md
~/.ai-coach(ai-coach-core): your memory database. next session's brief; survives uninstalling. README.mdteam-seed.jsonl(memory-coach): carried by git. teammates import it; nothing leaves on its own. plugins/memory-coach/skills/handoff/SKILL.md:59
Every coach, beside its skills
ai-coach-core
The engine. Hooks and memory; runs without being asked. a hook: it just runs, kept between sessions.
session-start.js(fires at session start): injects the brief. brief ≤ 4,000 chars; settable 500–16,000; compact: 1,000 + snapshot; branch/seed/partner nudges. Writes: the session row. plugins/ai-coach-core/hooks/session-start.js:44prompt.js(fires at your prompt): records · hints to you. skips < 25 chars, / and !; hints: systemMessage only; never shown to the model; plan mode: a Haiku review. Writes: first prompt (scrubbed), signal ids. plugins/ai-coach-core/hooks/prompt.js:34guard.js(fires at pre-tool): blocks or asks: secrets. off by default; blocks real credentials; asks: secret out, key read; only hook that can block. Asks: asks before a secret-looking payload leaves, or a credential file is read. plugins/ai-coach-core/hooks/guard.js:44observe.js(fires at post-tool): records the action. Edit · Write · Bash; <private> stripped first. Writes: one observation per action. plugins/ai-coach-core/hooks/observe.js:15spotlight.js(fires at post-tool): warns: injection. WebFetch, WebSearch, Read; Read outside the repo only; in full once per session; never blocks. plugins/ai-coach-core/hooks/spotlight.js:8observe.js · FAIL(fires at post-tool): records the failure. feeds the snapshot; and the distillation. Writes: a FAIL observation. plugins/ai-coach-core/hooks/observe.js:21notice.js(fires at turn ends · notification): records a correction. on error, failed, wrong…; prints nothing. Writes: a correction. plugins/ai-coach-core/hooks/notice.js:30precompact.js(fires at compaction): saves where you were. branch, ≤ 8 files touched; last fail, ≤ 3 corrections; handed back once, deleted. Writes: a working-state snapshot. plugins/ai-coach-core/hooks/engine.js:1546session-end.js(fires at session end): distils on Haiku. ≤ 3 learnings, 'distilled'; AICOACH_LEARN=off skips it; prunes at 30 and 90 days; never exports a seed. Writes: a summary and up to 3 learnings. plugins/ai-coach-core/hooks/session-end.js:37~/.ai-coach(kept between sessions): your memory database. next session's brief; survives uninstalling. README.md
ai-coach (bundle)
Three commands that tie the coaches together. a command you type.
/ai-coach:start(a command you type): day one, --run chains. Asks: says what --run costs, once, and asks. plugins/ai-coach/commands/start.md:59/ai-coach:wrap(a command you type): one question, publish. Asks: one question for every identity gap. plugins/ai-coach/commands/wrap.md:16/ai-coach:sitrep(a command you type): read-only morning read. plugins/ai-coach/commands/sitrep.md:7
memory-coach
Search memory, publish conclusions, hand them to a teammate. Claude calls it, kept between sessions.
/memory-coach:recall(Claude calls it): searches memory. plugins/memory-coach/skills/recall/SKILL.md:61/memory-coach:debrief(Claude calls it): publishes conclusions. Asks: shows the draft, then publishes. Writes: a debrief. plugins/memory-coach/skills/debrief/SKILL.md:35/memory-coach:handoff(Claude calls it): exports the team seed. Asks: exports only on a yes. Writes: .ai-coach/team-seed.jsonl. plugins/memory-coach/skills/handoff/SKILL.md:59/memory-coach:roster(Claude calls it): who is on the team. Asks: asks for your role. Writes: .ai-coach/team.md. plugins/memory-coach/skills/roster/SKILL.md:31team-seed.jsonl(kept between sessions): carried by git. teammates import it; nothing leaves on its own. plugins/memory-coach/skills/handoff/SKILL.md:59
investigation-coach
Onboarding docs, architecture maps, study material. a command you type, Claude calls it, a subagent.
/investigation-coach:investigate(a command you type): all three, in order. plugins/investigation-coach/commands/investigate.md:12/investigation-coach:onboard(Claude calls it): onboarding docs. Asks: states the cost before starting. Writes: docs/onboarding/. plugins/investigation-coach/skills/onboard/SKILL.md:46/investigation-coach:map(Claude calls it): maps → artifact-style. Writes: docs/onboarding/components/, an Artifact. plugins/investigation-coach/skills/map/SKILL.md:34/investigation-coach:study(Claude calls it): study material. Writes: docs/study/. plugins/investigation-coach/skills/study/SKILL.md:11scout · sonnet(a subagent): read-only repo sweep. Read · Grep · Glob · Bash; ≤ 500 words, file:line. plugins/investigation-coach/agents/scout.md:4
strategy-coach
The business as a vault, and feature specs. you type it, Claude calls it.
/strategy-coach:feature(you type it): spec, then plan. Asks: no plan.md until you answer. Writes: docs/features/<slug>/. plugins/strategy-coach/skills/feature/SKILL.md:53/strategy-coach:blueprint(Claude calls it): the business vault. Asks: you correct the domain first. Writes: docs/business/, an Artifact. plugins/strategy-coach/skills/blueprint/SKILL.md:65
analysis-coach
Requirements, critiqued analysis, executive write-ups. you type it, a subagent.
/analysis-coach:elicit(you type it): requirements. Writes: docs/requirements/. plugins/analysis-coach/skills/elicit/SKILL.md:2/analysis-coach:insight(you type it): analysis, critiqued. Writes: docs/analysis/. plugins/analysis-coach/skills/insight/SKILL.md:49/analysis-coach:story(you type it): executive write-up. plugins/analysis-coach/skills/story/SKILL.md:2critic(a subagent): unanchored review. Read · Grep · Glob · Bash; never sees the reasoning. plugins/analysis-coach/agents/critic.md:2
atlas-coach
Everything outside the repo: research, ingestion, markets. you type it, a subagent.
/atlas-coach:research(you type it): verified web research. Writes: research/<slug>.md. plugins/atlas-coach/skills/research/SKILL.md:10/atlas-coach:market(you type it): competitor analysis. Writes: docs/market/. plugins/atlas-coach/skills/market/SKILL.md:61/atlas-coach:ingest(you type it): docs in · Haiku. Asks: stops on a spotlight warning. Writes: docs/<slug>.md. plugins/atlas-coach/skills/ingest/SKILL.md:34/atlas-coach:translate(you type it): docs to code. plugins/atlas-coach/skills/translate/SKILL.md:28researcher · sonnet(a subagent): cited brief. WebFetch · WebSearch; ≤ 600 words, UNVERIFIED. plugins/atlas-coach/agents/researcher.md:4verifier(a subagent): tries to refute. WebFetch · WebSearch. plugins/atlas-coach/agents/verifier.md:2reader · haiku(a subagent): PDF, 20 pages a call. Read · Write · Bash. plugins/atlas-coach/agents/reader.md:4
security-coach
Injection scans, OWASP audits, pentest triage. you type it, a subagent.
/security-coach:scan(you type it): injection scan · Haiku. plugins/security-coach/skills/scan/SKILL.md:28/security-coach:audit(you type it): OWASP audit · Haiku. Asks: --triage asks before recording. Writes: findings. plugins/security-coach/skills/audit/SKILL.md:67/security-coach:triage(you type it): pentest report · Haiku. Writes: findings, .ai-coach/security/. plugins/security-coach/skills/triage/SKILL.md:41examiner(a subagent): quarantine reader. Read · Grep only; no shell, no network. plugins/security-coach/agents/examiner.md:2
prompt-coach
Prompts that land, and briefs for a subagent. you type it, Claude calls it.
/prompt-coach:prompt(you type it): a prompt that lands. plugins/prompt-coach/skills/prompt/SKILL.md:2/prompt-coach:scope(you type it): shape a big ask. Asks: any FAIL stops the walk. plugins/prompt-coach/skills/scope/SKILL.md:66/prompt-coach:prompt-stats(you type it): habits that cost you. plugins/prompt-coach/skills/prompt-stats/SKILL.md:2/prompt-coach:dispatch(Claude calls it): brief a subagent. plugins/prompt-coach/skills/dispatch/SKILL.md:86
harness-coach
What is installed, and what fills this session. you type it.
/harness-coach:context(you type it): what fills the session. plugins/harness-coach/skills/context/SKILL.md:66/harness-coach:partners(you type it): partner tools · Haiku. Asks: installs only what you pick. plugins/harness-coach/skills/partners/SKILL.md:12
design-coach
Published pages made checkable, linted before publish. Claude calls it, a hook: it just runs.
/design-coach:artifact-style(Claude calls it): checkable pages. Writes: an Artifact page. plugins/design-coach/skills/artifact-style/SKILL.md:38artifact-lint.js(fires at pre-tool): asks on lint errors. Artifact .html publish; never denies. Asks: asks before a page that fails the lint is published. plugins/design-coach/hooks/artifact-lint.js:29artifact-nudge.js(fires at post-tool): loads artifact-style. after native design skills. plugins/design-coach/hooks/artifact-nudge.js:9
pair-coach
Talk to Claude through @claude comments in the code. a hook: it just runs, you type it, Claude calls it.
mentions-nudge.js(fires at your prompt): names open threads. your uncommitted lines; ≤ 5 locations. plugins/pair-coach/hooks/mentions-nudge.js:15/pair-coach:pair(you type it): 1–3 stubs for you. Writes: code, tests, stubs that throw. plugins/pair-coach/skills/pair/SKILL.md:23/pair-coach:mentions(Claude calls it): answers @claude inline. Asks: asks about lines someone else committed. Writes: replies and changes in the code. plugins/pair-coach/skills/mentions/SKILL.md:40
ship-coach
Commit, branch and PR on Haiku, after one look. you type it.
/ship-coach:commit(you type it): Haiku · low effort. Asks: one look at the whole plan. Writes: a commit, a branch, a PR. plugins/ship-coach/skills/commit/SKILL.md:43
Special cases
- Every hook fails open: a crash is logged and the session goes on. Only guard.js can stop a call. plugins/ai-coach-core/hooks/guard.js:4
- The engine's own claude -p runs set AICOACH_INNER, so every hook skips them: no recursion. plugins/ai-coach-core/hooks/engine.js:448
- Hook context goes to the model. Prompt hints go only to you, as a systemMessage. plugins/ai-coach-core/hooks/prompt.js:10
- Inside a subagent, every tool call still passes guard, observe and spotlight; the parent gets only the report. Claude Code docs
- Anything between <private> tags is stripped before a single byte is written. plugins/ai-coach-core/hooks/observe.js:15
- What a model wrote is stamped distilled, and nothing ever promotes it to a person's word. plugins/ai-coach-core/hooks/session-end.js:43
- Nothing leaves your machine on its own: the seed is exported only when you say yes. plugins/ai-coach-core/hooks/session-end.js:58
- Small models where a summary is the job: distillation, plan review, commit, reader, and skills pinned to Haiku. plugins/ship-coach/skills/commit/SKILL.md:5
- AI Coach binds no Stop, SubagentStart or SubagentStop hook: a turn always ends when Claude is done. plugins/ai-coach-core/hooks/hooks.json:1