Orientation

You are not learning a tool. You are standing up a company.

The people who get extraordinary results out of Claude Code are not writing better prompts. They built a system around it. This playbook is that system, in the order you should build it.

The one-sentence version: give the AI a memory it can read and write (a knowledgebase), a policy it always follows (instruction files), senses and hands into your real systems (MCP connectors), a staff of specialists (subagents), and a loop that turns a business problem into shipped software and then writes down what it learned.

Why most people plateau

A first session with Claude Code feels like magic. The third week feels like babysitting. The reason is almost always the same: everything the model learned about your business evaporated when the context window closed. You re-explain the schema. You re-explain the auth. You re-explain why you rejected the obvious approach in week one. You are paying a re-onboarding tax on every session.

Everything in this guide exists to kill that tax.

The five layers

📚1 · Memory

A knowledgebase that holds the charter, decisions, specs, and runbooks. Claude reads it at the start and writes to it at the end. Notion, Outline, Confluence, or plain markdown in git.

📜2 · Policy

CLAUDE.md, .claude/rules/, and hooks. Facts that are always true, rules scoped to certain files, and enforcement that does not depend on the model's judgment.

🔌3 · Connectors

MCP servers into the ERP, CRM, warehouse, ticketing, and devices. The difference between an assistant that guesses at your data and one that reads it.

🤖4 · Staff

Subagents with narrow jobs, restricted tools, and their own context: a spec writer, builders, an adversarial QA auditor, a security reviewer, a librarian who files the results.

🔄5 · The loop

Intake → spec → slice → parallel build → adversarial QA → integrate → write back to memory. That last step is the one everybody skips, and it is the one that compounds.

How the pieces talk, and why

The five layers above are a list. This is the same thing as a system — every arrow is information moving because something downstream needs it. Step through the eight flows and watch where the leverage actually comes from.

The loop, running

The process over time. Same system, but now in the order you actually work it — and notice that the last step feeds the first.

How to use this guide

Answer the seven profile questions

Two sections along, in Build your profile. They personalize the callouts throughout the guide and, at the end, generate a working starter kit with your actual systems in it.

If you are still deciding whether to be here

Chat, Cowork, or Code explains which product does what, and The case for Code is the argument to bring to whoever controls the seats.

Work the Foundation sections in order

Environment, knowledgebase, instructions, connectors. Roughly a half day. Everything after that assumes it exists.

Copy the snippets literally

Every code block has a copy button and is meant to be pasted, not adapted. Where a value is yours to fill in, it is written in ALL_CAPS.

Finish at "Your kit"

The last section assembles your answers into files you can paste straight into a new workspace.

Prerequisites. A terminal, Node 18+, git, and a Claude subscription or API key. Everything else in this guide is either free or something you already pay for. No prior Claude Code experience assumed; some software instinct assumed.
Orientation

Chat, Cowork, or Code — and which model

Three products, one model family. The difference between them is not how smart the AI is. It is what the agent is allowed to touch, and how long it is allowed to work without you.

The one-line version: Chat gives you an expert in a conversation. Cowork gives that expert your folders and lets it finish a task while you close the laptop. Claude Code gives it your repository, your shell, your test suite, and the ability to hire other agents. Same brain, escalating hands.

What each one can actually touch

Claude Chat Cowork Claude Code
Built for Thinking, drafting, answering Knowledge work — research, analysis, documents Building and operating software
Where it runs Web, desktop, mobile Desktop; web and mobile in beta Terminal, IDE, desktop app, web
Reaches your files No — you paste in, you copy out Folders you grant it Your repo and working tree
Runs commands A sandbox, not your machine Within its granted folders Your shell, your tests, your build
Version control None None Git-native — branches, diffs, worktrees
Persistent instructions Project instructions, in the web app Project instructions and skills CLAUDE.md, .claude/rules/, skills — committed to the repo
Enforcement Guidance only Guidance only Hooks — shell commands at fixed events
Delegation One conversation Concurrent subtasks Subagents with their own tools and context
Runs unattended No Keeps working after you close it Headless, cron, CI — claude -p
Connects to your systems Connectors in the web app Connectors and tools MCP, plus anything you can wrap yourself

Why the knowledgebase loop needs Code

This matters more than the feature list suggests, and it is the specific thing that makes Chat feel limiting once you try to build something real. The loop in this guide asks one agent to, in a single session: read a spec from Notion, read the repo, write code, run the tests, and then write what it learned back to Notion. Chat can do the first and the last. It cannot do the middle three, and there is no way to chain them without a human carrying output between steps by hand.

The copy-paste tax

In Chat, every file is something you paste in and paste out. You are the integration layer. That is fine for one function and unworkable for a change that touches eleven files.

No diff, no revert

Chat has no git. You cannot see what changed, review it as a diff, or undo it. An agent working without version control is an agent you have to supervise character by character.

Instructions that do not travel

Project instructions live in a web app. CLAUDE.md lives in the repo — versioned, reviewed in a PR, and identical for everyone who clones it. One is a preference; the other is infrastructure.

Nothing runs at 2am

The drift checks, the deploy verification, the nightly sweeps — none of it exists without headless mode. Chat is a thing you operate. Code is a thing that also runs when you are asleep.

Where Chat is still the right tool. Thinking out loud before you know what you want. Drafting and editing prose. Reading a long document and arguing with it. Anything where the output is an answer rather than an artifact. Most people should use both daily — Chat to decide what to build, Code to build it. Reaching for Code to rewrite an email is as wrong as reaching for Chat to refactor a service.
And where Cowork fits. The work that is real, multi-step, and file-shaped, but is not software — a competitive analysis across forty PDFs, a quarterly board pack, reconciling two spreadsheets into a memo. Cowork is the right answer for the finance and marketing people on your team who will never open a terminal, and it is in the same seat you are already paying for.

Which one for this task?

What are you about to do?

The models inside Claude

All three surfaces run the same family. Inside Claude Code you choose per session with /model, and per subagent with the model field in its definition. This is your main cost lever: put judgment on a strong model and mechanical work on a cheap one.

ModelAliasReach for it when
Fable 5fable
best
The task is bigger than one sitting, or the problem is ambiguous — root-cause investigations, an outage nobody understands, an architecture decision. It investigates before acting and verifies its own work, so you can skip the "remember to test it" reminders. Not the default; select it deliberately.
Opus 5opusComplex reasoning on a task you could scope yourself. The strong default for judgment work: reviewing, planning, adversarial QA, writing a spec.
Sonnet 5sonnetDaily coding. Precise edits, mechanical changes, work where the relevant code is already in context. Most of your hours land here.
Haiku 4.5haikuFast, cheap, simple. Ideal for high-volume subagents doing one narrow mechanical thing many times.
Useful combinations: opusplan plans with Opus then executes with Sonnet. opus[1m] and sonnet[1m] select a one-million-token context window for very long sessions.
# switch the session
/model fable

# or pin a subagent in its definition
---
name: qa-auditor
model: opus
effort: high
---

Effort is the other dial, and it is the one people miss

Effort is not "thinking time." It controls how many files Claude reads, how many tools it uses, and how many steps it takes before checking back with you. Turning it up can generate several times more tokens — because it is doing several times more work.

The diagnostic worth memorizing: if Claude gave a shallow answer to a hard problem, that is a model problem — move up. If Claude skipped files, did not run the tests, or stopped early, that is an effort problem — turn it up. Reaching for a bigger model to fix an effort problem is the most common way to spend money without improving anything.
Move up a model
When Claude had the full context, clearly tried, and still could not solve it. Not on the first failure — on the first failure with complete information.
Move down a model
During a stretch of routine work. A mechanical migration across forty files does not need your most expensive model.
Raise effort
Adversarial review, unfamiliar code, anything where missing a file means missing the bug.
Lower effort
Narrow mechanical sweeps where the work is obvious and you just want it done.
On other providers, aliases may lag. Through Bedrock, Microsoft Foundry, or Google Cloud, opus and sonnet can resolve to older versions than they do on the Anthropic API. If you are on a cloud provider and a model feels a generation behind, it probably is — pin the full model ID, for example claude-opus-5.

Which model for this task?

Describe the work.
Orientation

The case for giving your team Code

If you are the person who has to justify this to a CFO, or the person being told "we already have Claude, use the chat one" — this section is the argument.

Start here, because it reframes the whole conversation: on the Team and Enterprise plans, Claude Code and Cowork are already included in the seat you are paying for. Restricting your team to Chat usually saves nothing. It leaves capability you have already bought sitting unused.

That is worth checking before any ROI modelling, because it changes the question. For most companies this is not a budget decision. It is a permission decision — and permission decisions get made by default, quietly, by whoever set up the workspace.

Verify the current numbers yourself. The figures below were the published prices in July 2026: Pro at $17/month annual, Team seats at $20/month annual, Team Premium at $100/month annual, Enterprise negotiated per organization. Pricing moves. Check claude.com/pricing before you put a number in a deck.

Where the return actually comes from

Four buckets, roughly in order of how much they are worth and inversely by how easy they are to measure.

🏗1 · Work that was never going to happen

Every company has a long list of internal tools nobody could justify three developer-weeks for. The quoting tool, the reconciliation script, the dashboard finance asks for every quarter. This is the biggest bucket and it never shows up in a time-savings model, because the baseline was zero.

📋2 · The copy-paste tax

Work already being done in Chat, where a person is manually carrying files in and results out. Real, measurable, and the easiest to put in a spreadsheet.

🔄3 · The re-onboarding tax

Re-explaining the schema, the auth, the decision you already made. Without a knowledgebase loop you pay it every session. This is the one that compounds — it gets worse as the project gets bigger, which is exactly backwards.

🌕4 · Unattended work

Drift checks, deploy verification, nightly sweeps. Not time saved — work that simply did not exist before, running at 2am for the price of tokens.

Run your own numbers

Change any figure. The break-even line at the bottom is the one to put in front of a finance person — it is the honest version of the argument, and it does not depend on believing anything optimistic.

ppl
$/hr
$/mo
$/mo
hrs
/yr
$

The break-even argument

Most ROI decks fail because they ask a skeptic to accept an optimistic productivity number. This argument does not need one. Work out how many minutes per week a person has to save for the seat to pay for itself, then ask whether that threshold is plausible. At typical loaded rates it lands in the single-digit minutes, and the conversation ends there.

Use the smallest claim that still wins. If break-even is four minutes a week, argue for four minutes a week. Do not argue for a 30% productivity gain you will be asked to prove in six months. The modest claim is both more defensible and more persuasive, and it survives contact with the person who has to sign.

What this costs you, stated plainly

An honest case includes the other column. None of these are reasons not to do it; all of them are reasons to do it deliberately.

Review burden goes up
More code gets written, so more code needs reviewing. If your review process is already the bottleneck, this makes it worse before it makes it better. Budget for the QA gate in this guide — it exists for exactly this reason.
Confidently wrong output
AI-written code fails differently: rarely sloppy, frequently plausible-and-wrong. Teams that skip the gates ship subtle business-logic bugs faster than they used to.
Usage above the seat
Heavy agent use, parallel subagents, and scheduled jobs consume beyond the included allowance. Model routing and effort control are how you manage it. Watch it for a month before you extrapolate.
A real ramp
Week one is slower, not faster. The setup in this guide is roughly half a day, and the loop takes a couple of weeks to become habit. Anyone promising instant returns is selling something.
New surface area to govern
Agents with credentials to your ERP and warehouse is a real security posture question. Read-only by default, hooks for anything irreversible, sandbox before production. All covered later — but it is work.

How to actually roll it out

Check what your seats already include

Before anything else. If you are on Team or Enterprise, the answer is usually "everything," and the whole procurement conversation disappears.

Pick one real problem, not a pilot

Pilots produce demos nobody uses. Pick something with a person waiting for the outcome. The worked example later in this guide is the shape to copy.

Give two or three people a month

Not the whole team. The people most likely to build the setup properly — knowledgebase, agents, guardrails — so the next ten inherit something that works instead of discovering it themselves.

Commit the configuration

CLAUDE.md, .claude/agents/, .claude/settings.json, .mcp.json. Now onboarding person eleven is git clone, not a training session.

Measure the tools that got built

Not lines of code, not "time saved" — the list of things that now exist and did not before. That list is the ROI case for year two, and it is the one executives find convincing.

For your profile · Solo

Skip the procurement argument entirely — Pro includes Claude Code and Cowork. Your version of this section is bucket one: the tools that were never worth three weeks of your own time. That is where a solo operator gets nearly all the value.

For your profile · 6+ people

At your size the committed configuration matters more than anything else on this page. One shared CLAUDE.md, one agent roster, one set of hooks in git means the tenth person gets the same guardrails as the first. Without that you get ten private setups and no compounding — which is the failure mode that makes teams conclude "it did not work for us."

Orientation

Seven questions

These shape the rest of the guide. Personalized guidance appears inline as you go, and the final section assembles your answers into real config files. Answers are stored in your browser only.

Nothing leaves this page. Answers live in localStorage under the key sqs-ai-workflow-profile. There is no server, no account, no analytics on your inputs.
Foundation · Step 1

Set up the environment

One workspace, three CLIs, one place for secrets. Twenty minutes, and it is the last time you will think about any of it.

Install the CLIs

Claude Code is the primary builder. Codex and Gemini earn their keep as second opinions — a reviewer that did not write the code catches things the author cannot. Install at least Claude Code and one other.

# Claude Code — your primary build agent
npm install -g @anthropic-ai/claude-code

# OpenAI Codex — second opinion, strong adversarial reviewer
npm install -g @openai/codex

# Google Gemini — huge context, good for whole-repo and document sweeps
npm install -g @google/gemini-cli

Then authenticate each once. claude walks you through sign-in on first run; codex accepts a ChatGPT login or CODEX_API_KEY; gemini prompts for a Google account or GEMINI_API_KEY.

For your profile

You said Claude Code only — that is a completely valid setup and you can skip the Codex and Gemini installs. Come back to the Model routing section when you want a reviewer that is not the same model that wrote the code. It is the single cheapest quality upgrade available.

One workspace, not one repo per idea

The instinct is to make a repo per project. Resist it at first. A single workspace means one knowledgebase connection, one set of agents, one instruction file — and Claude can see across projects, which is where most of the interesting leverage is.

acme-workspace/
├── CLAUDE.md                 # facts that are always true (keep under ~200 lines)
├── .mcp.json                 # connectors, shared with the team via git
├── .env                      # secrets — gitignored, never committed
├── .gitignore
├── .claude/
│   ├── settings.json         # hooks, permissions — committed
│   ├── settings.local.json   # your machine only — gitignored
│   ├── agents/               # your specialist subagents
│   │   ├── spec-writer.md
│   │   ├── qa-auditor.md
│   │   └── docs-librarian.md
│   ├── skills/               # repeatable procedures, loaded on demand
│   │   └── wrap-session/SKILL.md
│   └── rules/                # instructions scoped to file paths
│       └── data-access.md
├── docs/                     # local mirror of key KB pages
└── projects/
    ├── quoting-app/
    └── shopfloor-tablet/
Why .mcp.json is committed but .env is not. The connector list is team knowledge worth sharing. The connector credentials are personal. MCP config supports ${VAR} expansion precisely so the two can live apart.

Secrets, once

# .gitignore — do this before your first commit, not after
.env
.env.*
.claude/settings.local.json
node_modules/
.DS_Store
# .env — referenced from .mcp.json as ${VAR}, never inlined
NOTION_TOKEN=secret_xxxxxxxxxxxx
CRM_API_KEY=xxxxxxxxxxxx
ERP_BASE=https://erp.internal.acme.com
ERP_TOKEN=xxxxxxxxxxxx
WAREHOUSE_DSN=postgres://readonly:pass@warehouse.acme.com:5432/analytics
The read-only credential rule. Give every connector the narrowest credential that still does the job, and start read-only. A warehouse connection should use a readonly role. A CRM token should be scoped to the objects you actually need. You will want write access eventually — add it deliberately, per system, after you have watched the agent work for a week.

Initialize

cd acme-workspace
git init
claude

Then, in the session, run /init. Claude reads the workspace and drafts a starting CLAUDE.md. It will be generic on an empty workspace — that is fine, you will replace it in two sections' time.

Setup checklist

Setup progress 0%
Foundation · Step 2

Build the knowledgebase

This is the highest-leverage hour in the whole guide. Not because a wiki is exciting, but because it is the only thing that makes session number forty as sharp as session number one.

The rule that makes everything else work: the knowledgebase is the source of truth for decisions; the repo is the source of truth for implementation. If a future session would need to know it and cannot read it off the code, it belongs in the KB.

Pick one — and it matters less than you think

PlatformBest whenClaude accessWatch out for
NotionThe default. Business users already live there, databases are strong, the MCP server is first-party.Official remote MCPDeep page trees get slow to query. Keep hierarchy shallow.
OutlineYou want self-hosted, markdown-native, fast. Engineering-leaning teams.MCP server availableWeaker structured databases — you will lean on documents plus tags.
ConfluenceIt is already the company standard and that fight is not worth having.Atlassian MCPPermissions sprawl. Give the agent one clearly-scoped space.
SharePoint / DriveEverything is already in documents and nobody will migrate.Connector or a thin custom MCPNo structure at all — you must impose the schema yourself.
Markdown in gitSolo or all-engineer team. Zero latency, versioned, diffable, free.Native — it is just filesNon-technical stakeholders will never read or update it.
If you are genuinely undecided, choose Notion — unless nobody outside engineering will ever touch it, in which case choose markdown in git. The worst outcome is spending a week deciding. The schema below works on any of them.
For your profile · Notion

Connect it first, before you create a single page — then let Claude build the structure for you. One command:

claude mcp add --transport http notion https://mcp.notion.com/mcp

Run /mcp inside a session to complete the OAuth handshake in your browser. When it shows connected, run the schema prompt below.

For your profile · Outline

Outline exposes an API token per user. Point an MCP server at your instance and pass the token from .env so it never lands in git:

claude mcp add --transport http outline https://YOUR-OUTLINE-HOST/api/mcp \
  --header "Authorization: Bearer ${OUTLINE_API_KEY}"

Because Outline is markdown-native, its collections map cleanly onto the schema below — one collection per top-level section.

For your profile · Confluence

Use the Atlassian MCP server and scope the agent to a single dedicated space (call it AI-BUILD). Do not point it at the whole instance — permission sprawl in Confluence is the fastest way to have an agent read something it should not.

For your profile · SharePoint / Drive

Document stores give you no structure, so impose it with folders and a strict naming convention, and keep a single INDEX.md at the root that lists every document with a one-line summary. That index is what Claude reads first — without it, the agent has to open everything to find anything.

For your profile · Markdown in git

The simplest and fastest option. Create docs/ in your workspace with the structure below, and skip MCP entirely — Claude reads and writes the files natively. Add this to CLAUDE.md: "The knowledgebase is docs/. Read docs/INDEX.md before starting any task. Record every architectural decision in docs/decisions/ as a numbered file."

Let Claude design the schema

Do not hand-build the structure. You will produce something shaped like a filing cabinet, and what you need is something shaped like an onboarding packet. Give Claude the job and the constraints, and it produces a better structure than most teams write by hand — because it knows exactly what a future session will need to look up.

Paste into Claude Code · knowledgebase build
You have write access to my knowledgebase. Build the structure that an AI agent needs to work on our software with no re-explanation between sessions. Business context: ACME_CO — DESCRIBE_WHAT_THE_COMPANY_DOES. We are going to build: DESCRIBE_THE_FIRST_PROJECT. Create this structure, and populate every page with a filled-in example row or paragraph so the format is obvious to the next human and the next agent: 1. Charter (single page) What the business does, who the users are, what we are building and why, what is explicitly out of scope, and the definition of done. 2. Decisions (database) Properties: Date, Decision, Alternatives considered, Rationale, Owner, Status (Active / Superseded), Supersedes. This is an append-only log. We never edit history, we supersede. 3. Specs (database) Properties: Name, System, Status (Draft / Approved / Built / Verified), Owner, Linked decisions, Acceptance criteria. 4. Systems and integrations (database) Properties: System, Type (ERP / CRM / DB / File / Device / SaaS), Auth method, Environment (prod / sandbox), Owner, MCP server name, Rate limits, Known quirks. The quirks field matters most — that is where the tribal knowledge goes. 5. Runbooks (database) Properties: Name, Trigger, Steps, Rollback, Last verified. 6. Agents (database) Properties: Name, Purpose, Model, Tools allowed, Definition file path. 7. Glossary (database) Properties: Term, Definition, Do not confuse with. Every internal acronym and every word that means something specific here. 8. Session log (database) Properties: Date, Session goal, What shipped, What we learned, Open questions, Follow-ups. Rules for how you build it: - Keep the hierarchy shallow. Nothing more than two levels deep. - Every database gets at least one real, filled-in example row — not placeholder text. - Write the Charter page from what I told you above, then ask me the five questions whose answers would most change what you wrote. When you are done, give me the URL of the Charter page and list what you still need from me.
The last instruction is the important one. "Ask me the five questions whose answers would most change what you wrote" turns a documentation exercise into an interview. Those five questions are almost always the exact things that would have caused a rebuild in week three.

The eight sections, and why each exists

Charter
The one page loaded into every session. If someone reads only this, they should be able to reject a bad idea correctly.
Decisions
Append-only. Prevents the agent re-proposing the approach you already rejected — and prevents you forgetting why you rejected it.
Specs
The contract for a slice of work. "Approved" means an agent may start building. Acceptance criteria are what the QA agent tests against.
Systems
Every connector, its auth, its rate limits, and its quirks. The quirks field is where "the ERP returns 200 with an error body" lives — the knowledge that costs a day to rediscover.
Runbooks
Deploy, rollback, rotate credentials, restore from backup. Written so an agent can execute them, which means every step is a literal command.
Agents
Your roster in a form a human can review. Keeps agent sprawl visible and gives new team members the map.
Glossary
Where a "job" is a work order and not a cron task. Stops an entire category of confidently-wrong output.
Session log
The compounding layer. Ten entries in, a new session can read what has already been tried and skip it.

What good looks like

claude — acme-workspace
Build the knowledgebase structure described above.
notion-search("ACME") — 0 results, workspace is empty
notion-create-pages — Charter
notion-create-database — Decisions (7 properties)
notion-create-database — Specs (6 properties)
notion-create-database — Systems and integrations (7 properties)
…4 more databases, each seeded with one example row
Knowledgebase created. Charter: notion.so/acme/Charter-2f91b
Five questions that would most change the Charter:
1. Quotes today are built in Excel by two estimators. Is the goal to
replace that spreadsheet, or to feed it faster?
2. Does a quote need to be approved before it reaches the customer,
and by whom?
3. Is the ERP the system of record for pricing, or is the spreadsheet?
4. What happens today when a quote is wrong — who absorbs it?
5. Who signs off that this project is done?
Question 3 is the kind that reorganizes a project. Better in hour one than week six.
Review what it wrote before you move on. Fifteen minutes reading the generated Charter and fixing what is wrong is the cheapest correction you will ever make. Every later session inherits this page.
Foundation · Step 3

Write the instruction layer

Four mechanisms, four jobs. Most frustration with AI coding tools comes from putting something in the wrong one.

MechanismHoldsLoadedUse when
CLAUDE.mdFacts always trueEvery session"We use pnpm." "API handlers live in src/api/."
.claude/rules/*.mdFacts true for some filesWhen matching files are touched"Every endpoint under src/api/ validates input."
SkillsProceduresOn demand, when invoked or relevant"How we cut a release." "How we onboard a new client."
HooksEnforcementAt fixed lifecycle events"Never touch prod." "Always run the formatter after an edit."
The distinction that saves you. CLAUDE.md is context — Claude reads it and tries to follow it. A hook is enforcement — it runs regardless of what Claude decides. If the consequence of skipping a rule is "the code is a bit inconsistent," that is CLAUDE.md. If the consequence is "we wrote to the production database," that is a hook.

CLAUDE.md — short, specific, verifiable

Target under 200 lines. Longer files consume context and, counterintuitively, get followed less reliably. Write instructions concrete enough to check: "use 2-space indentation," not "format code properly."

# ACME Workspace

## What this is
Software for ACME Manufacturing — a 180-person contract manufacturer.
Full context: read the Charter in the knowledgebase before any new task.

## Knowledgebase — read and write it
- Source of truth for decisions. The repo is the source of truth for code.
- **Before starting a task:** read the Charter and search Decisions for
  anything related. Do not re-propose a superseded approach.
- **After finishing a task:** append to the Session log. If you made an
  architectural choice, add a row to Decisions.
- Unfamiliar internal term? Check the Glossary before guessing.

## Stack
- TypeScript, Node 20, Postgres 16, Next.js App Router
- pnpm — never npm or yarn
- Tests: vitest. `pnpm test` must pass before anything is called done.

## Layout
- `projects/<name>/` — one app per folder, self-contained
- `src/api/` — route handlers.  `src/lib/` — shared logic.  `src/db/` — schema + migrations

## Hard rules
- Never write to the production ERP. Sandbox only, `ERP_BASE` points at sandbox.
- Never commit `.env` or anything matching `*_TOKEN`, `*_KEY`, `*_SECRET`.
- Database changes are migrations, never hand-edited schema.
- Money is integer cents. Never a float. Anywhere.

## Definition of done
Tests pass, types check, the acceptance criteria in the linked Spec are met,
and the Session log has an entry.
For your profile · Regulated

Add a compliance block to CLAUDE.md, and then back the non-negotiable parts with hooks — because CLAUDE.md is guidance, not enforcement, and in a regulated environment the difference is material:

## Compliance
- Regulated data. Never copy production records into test fixtures,
  logs, prompts, or the knowledgebase.
- Every data-touching change needs an entry in the Decisions log naming
  the reviewer.
- PII in code, comments, or commit messages is a defect. Flag and stop.
For your profile · Customer data

Add one line that prevents the most common leak — test fixtures built from real records:

## Data handling
- Never copy customer records into fixtures, logs, or the knowledgebase.
  Generate synthetic data with the same shape instead.

Path-scoped rules

When a rule only matters for part of the codebase, scope it. It loads when Claude touches a matching file and costs nothing the rest of the time.

---
paths:
  - "src/api/**/*.ts"
  - "src/db/**/*.ts"
---

# Data access rules

- Every endpoint validates input with a zod schema before touching the DB.
- Queries go through `src/db/client.ts`. No raw connections in handlers.
- Every query touching `customers` or `quotes` filters by `tenant_id`.
  A query without a tenant filter is a security defect, not a style issue.
- Errors return the standard shape: `{ error: { code, message } }`.
  Never leak a database error string to the client.

Save as .claude/rules/data-access.md. Rules without a paths field load every session, same as CLAUDE.md.

Share the instructions with the knowledgebase

Your instruction files and your KB will drift. The fix is a scheduled reconciliation, not discipline.

Run weekly · reconcile instructions with the KB
Reconcile my instruction files against the knowledgebase. 1. Read CLAUDE.md and every file in .claude/rules/. 2. Read the Charter and the Decisions database. 3. Report, as a table: - Rules in CLAUDE.md that contradict an Active decision - Active decisions that should be in CLAUDE.md but are not - Rules in CLAUDE.md that are stale (the code no longer works that way — verify against the actual source before claiming this) - Anything in CLAUDE.md over 200 lines that should become a path-scoped rule or a skill instead Propose the edits. Do not apply them until I approve.
Do not let it apply automatically. The instruction layer is the one place where a confidently wrong edit propagates into every future session. Read the diff.
Foundation · Step 4

Connect your systems

MCP is how Claude reads your ERP, queries the warehouse, updates the CRM, and talks to devices. This is the step that separates a code assistant from something that can actually solve a business problem.

Add a connector

# Remote HTTP servers — most SaaS vendors ship one
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

# With a header, when the vendor uses a static token
claude mcp add --transport http erp https://erp.acme.com/mcp \
  --header "Authorization: Bearer ${ERP_TOKEN}"

# Local stdio servers — databases, filesystems, anything you wrap yourself
claude mcp add --transport stdio warehouse -- \
  npx -y @bytebase/dbhub --dsn "${WAREHOUSE_DSN}"

Then run /mcp in a session to check status and complete any OAuth flows. A server showing failed is almost always bad credentials.

Scope decides who gets it. --scope local (default) is you, this project. --scope project writes to .mcp.json and is shared with the team through git. --scope user follows you across every project. Team connectors go in project scope; your personal Gmail does not.

The shared .mcp.json

{
  "mcpServers": {
    "notion": {
      "type": "http",
      "url": "https://mcp.notion.com/mcp"
    },
    "erp": {
      "type": "http",
      "url": "${ERP_BASE}/mcp",
      "headers": {
        "Authorization": "Bearer ${ERP_TOKEN}"
      }
    },
    "warehouse": {
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub", "--dsn", "${WAREHOUSE_DSN}"]
    }
  }
}

Commit this file. ${VAR} expands from the environment, and ${VAR:-default} supplies a fallback. Teammates supply their own .env. An entry with a url and no type is a config error — Claude Code reads it as a stdio server and skips it.

System by system

CRM usually easy

HubSpot, Salesforce, Close, Attio and most others ship first-party MCP servers. Add, authenticate, done. Start with a read-only scope; the first time an agent writes to a live CRM you want it to be a deliberate decision.

For your profile · CRM

You flagged CRM as a system to connect. Add it early even if the first project barely touches it — CRM data is how the agent learns what your customers are actually called, which improves everything downstream. Then add one row to the Systems database recording which objects the token can reach.

Warehouse / SQL easy and high value

A read-only Postgres or Snowflake connection is the single highest-value connector for most companies. Claude can answer questions about the business directly, and — more usefully — check its own assumptions about the data before writing code against it.

claude mcp add --transport stdio warehouse -- \
  npx -y @bytebase/dbhub --dsn "postgres://readonly:PASS@host:5432/analytics"
Read-only means the role, not the intent. Create an actual readonly database role with SELECT only. Do not rely on instructions to keep an agent from writing. Instructions are guidance; grants are enforcement.

Excel and spreadsheets do not use MCP

The instinct is to find an Excel MCP server. Do not. Spreadsheets are files, and Claude is dramatically better at spreadsheets when it writes Python against them than when it pokes at them through a tool interface — because it can inspect, iterate, and verify.

# Put the file where Claude can reach it, then just ask.
# Claude writes and runs Python (openpyxl / pandas) against it.

"Read models/estimating-model.xlsx. Map every input cell, every formula,
and every output. Then write a Python module that reproduces the pricing
logic exactly, with a test that asserts it matches the workbook's outputs
for all 40 historical quotes in tests/fixtures/quotes.csv."
This is the pattern for legacy spreadsheet logic generally. Do not ask Claude to "understand the spreadsheet." Ask it to reproduce the spreadsheet in code and prove equivalence against historical rows. You get a tested module and a regression suite instead of a summary. It also surfaces the three cells where the workbook has been quietly wrong for two years.
For your profile · Excel

You flagged spreadsheets. The equivalence-test approach above is the one to use. Before you start, get the historical rows — a CSV of past inputs and their known-correct outputs. Without that, you have a rewrite; with it, you have a rewrite you can prove.

ERP usually needs a wrapper

NetSuite, SAP, Epicor, Dynamics, Infor: most have no official MCP server. They do have REST or SOAP APIs. So you write a thin MCP server that exposes the four or five operations you actually need — and no more. A narrow tool surface is a feature: it is how you guarantee an agent cannot post a journal entry.

// mcp-servers/erp/index.js
// npm i @modelcontextprotocol/sdk zod
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const BASE  = process.env.ERP_BASE;
const TOKEN = process.env.ERP_TOKEN;

async function erp(path) {
  const r = await fetch(`${BASE}${path}`, {
    headers: { Authorization: `Bearer ${TOKEN}`, Accept: "application/json" },
  });
  // This ERP returns 200 with an error body. Check both.
  const body = await r.json();
  if (!r.ok || body.error) throw new Error(`ERP ${r.status}: ${body.error ?? "unknown"}`);
  return body;
}

const server = new McpServer({ name: "acme-erp", version: "1.0.0" });

server.registerTool(
  "get_work_order",
  {
    title: "Get work order",
    description: "Fetch a single work order by number, including line items and routing.",
    inputSchema: { wo: z.string().describe("Work order number, e.g. WO-10422") },
  },
  async ({ wo }) => ({
    content: [{ type: "text", text: JSON.stringify(await erp(`/api/workorders/${wo}`), null, 2) }],
  })
);

server.registerTool(
  "find_part",
  {
    title: "Find part",
    description: "Search the item master by part number or description. Read-only.",
    inputSchema: { q: z.string(), limit: z.number().int().max(50).default(10) },
  },
  async ({ q, limit }) => ({
    content: [{ type: "text", text: JSON.stringify(
      await erp(`/api/items?search=${encodeURIComponent(q)}&limit=${limit}`), null, 2) }],
  })
);

// Note what is absent: no create, no update, no post. Add those the day
// you actually need them, one at a time, deliberately.

await server.connect(new StdioServerTransport());
claude mcp add --transport stdio erp -- node ./mcp-servers/erp/index.js
Have Claude write this for you — but hand it the docs. Point it at your ERP's API reference and say: "Write an MCP server exposing exactly these four read operations, using the SDK patterns in the official README. Handle the fact that this API returns 200 with an error body." Check the SDK's current README for the exact registerTool signature; the MCP SDK moves quickly and the shape above reflects the current major version.
For your profile · ERP

You flagged an ERP. Budget half a day for the wrapper and expect the API to be worse-documented than promised. Two things pay for themselves immediately: point it at the sandbox environment first, and fill in the "Known quirks" field in your Systems database as you discover each one. That field is the single most valuable thing in your knowledgebase after the Charter.

Connected devices bridge, do not connect directly

Do not give an agent a direct line to hardware. Put a broker in between — the agent talks to the bridge, the bridge talks to the fleet, and the bridge is where you enforce what is physically allowed.

# The bridge exposes read + safe-command tools only:
#   list_devices        — fleet inventory and last-seen
#   get_telemetry       — recent readings for one device
#   get_device_logs     — diagnostics
#   request_ota_check   — asks a device to check for firmware; does not push it
#
# What the bridge must never expose to an agent:
#   direct actuator control, firmware push, factory reset, credential rotation
#
# Those stay behind a human approval step. Always.
For your profile · Devices

You flagged connected devices. The rule above is not conservatism — it is the difference between a bad deploy costing you a rollback and costing you a truck roll to 40 sites. Let the agent read telemetry freely, write dashboards and alerting freely, and propose firmware changes freely. Keep the actual push behind a human.

Comms and ticketing

Slack, Linear, Jira, Asana, Gmail, Calendar all have MCP servers. These are what let an agent close the loop — file the bug it found, post the deploy summary, read the ticket that started the work. Add them once the build loop is working; they are amplifiers, not foundations.

Register every connector in the knowledgebase

After adding connectors
Run /mcp and list every connected server. For each one, add a row to the Systems and integrations database in the knowledgebase with: system name, type, auth method, environment (prod or sandbox), the MCP server name as configured, and the specific tools it exposes. Leave "Known quirks" empty for now — we fill that in as we hit them. Then tell me which of these currently has write access to a production system, so I can confirm that is intentional.
Your agent team · Step 5

Build your agent team

A subagent is a specialist with its own context window, its own system prompt, and its own restricted tools. Used well, they are how you get parallelism and honest review. Used badly, they are a way to spend tokens on nothing.

When a subagent actually helps

✓ Context protection

A task that would flood your main session with search results, logs, or file dumps you will never reference again. The subagent absorbs the mess and returns the conclusion.

✓ Enforced constraints

A reviewer that cannot edit files, because you gave it read-only tools. Constraint by configuration beats constraint by instruction.

✓ Genuine parallelism

Four independent slices building at once in separate worktrees.

✗ Not for: sequential work

If step two needs step one's full context, a subagent just adds a lossy handoff. Do it inline.

Anatomy of an agent file

Drop these in .claude/agents/ (project) or ~/.claude/agents/ (all your projects). Claude Code picks up changes within seconds — no restart.

name required
Lowercase and hyphens. The handle you use to invoke it.
description required
The routing signal. This is what Claude reads to decide whether to delegate. Write it as when to use this, not what this is. Vague descriptions are the number one reason an agent never gets called.
tools
Allowlist. Omit to inherit everything. This is your real safety boundary — a reviewer with no Write tool cannot "helpfully" fix what it found.
disallowedTools
Denylist. Inherit everything except these. Easier when you want most tools minus one or two.
model
opus, sonnet, haiku, fable, a full model ID, or inherit (the default). Cost control: mechanical work on a cheap model, judgment on a strong one.
effort
low through max. Raise it for adversarial review, lower it for mechanical sweeps.
isolation
worktree gives the agent its own git worktree. Essential when several builders run at once and would otherwise collide.
memory
user, project, or local. Lets an agent accumulate its own learnings across sessions.

Pick your roster

Select the agents you want. The exact file for each is generated in Your kit at the end. Start with three or four — every agent is a thing you have to maintain.

Two that matter most

If you only build two agents, build these.

The adversarial QA auditor

The critical design choice: it has no write tools, and it is told to try to break the work rather than assess it. An agent asked to "review this code" grades it. An agent asked to "find the input that corrupts the data" hunts.

---
name: qa-auditor
description: Adversarially reviews completed work against its spec's acceptance criteria. Use after any slice is built and before it is merged. Hunts for the failing case rather than summarizing quality.
tools: Read, Grep, Glob, Bash
model: opus
effort: high
---

You try to break things. You are not a code reviewer and you do not
produce style feedback.

Method:
1. Read the linked Spec in the knowledgebase. The acceptance criteria are
   the contract — nothing else counts as done.
2. Read the implementation.
3. For each acceptance criterion, find the input or sequence that makes it
   fail. Actually run things. `Bash` is available — use it.
4. Check specifically for: unhandled empty and null cases, off-by-one at
   boundaries, floating-point money, missing tenant filters on queries,
   unvalidated input reaching the database, error paths that swallow the
   error, and time zone assumptions.

Report only defects you can demonstrate. For each one give:
  - the exact input or steps
  - what happened
  - what the spec says should have happened

If you cannot find a real defect, say so plainly. Do not pad the report
with suggestions. A clean pass is a useful result.

You have no ability to edit files. Do not propose patches — report the
defect and let the builder fix it.
Why read-only is load-bearing. An agent that can fix what it finds will fix small things and stop hunting. Taking away its hands keeps it hunting. This is the highest-value five minutes in the whole roster.

The librarian

This one closes the loop. Without it, everything learned in a session dies with the session — and you are back to paying the re-onboarding tax.

---
name: docs-librarian
description: Writes finished work back to the knowledgebase — session log, decisions, spec status, and system quirks. Use at the end of any working session or after a slice ships.
tools: Read, Grep, Glob, mcp__notion__notion-create-pages, mcp__notion__notion-update-page, mcp__notion__notion-search, mcp__notion__notion-query-data-sources
model: sonnet
---

You keep the knowledgebase true. You are the reason session forty is as
sharp as session one.

At the end of a session:

1. **Session log** — append one row: date, goal, what shipped, what we
   learned, open questions, follow-ups. Be specific. "Fixed the bug" is
   worthless; "the ERP returns 200 with an error body, so ok checks must
   inspect the payload" is the whole point.

2. **Decisions** — if an architectural choice was made, add a row:
   decision, alternatives considered, rationale, owner, status Active.
   If it supersedes an earlier decision, mark that one Superseded and
   link them. Never edit history.

3. **Specs** — move status forward: Draft, Approved, Built, Verified.

4. **Systems** — if we hit an API quirk, rate limit, or undocumented
   behaviour, add it to Known quirks on that system's row. This field
   saves more time than anything else in the knowledgebase.

5. **Glossary** — any internal term used this session that is not
   already there.

Rules: never invent an outcome. If you are unsure whether something
shipped, check the git log and the test results rather than assuming.
Write for a reader who was not here.
The tools line is worth copying carefully. MCP tools are named mcp__<server>__<tool>. Listing them explicitly means the librarian can write to Notion and nothing else — it cannot touch your code. Run /mcp to see the exact tool names your servers expose.

Invoke them

# Claude routes automatically based on the description field
"Have the QA auditor go through the quoting slice."

# Or name it explicitly
"Use the qa-auditor subagent on projects/quoting-app."

# Parallel builders, each isolated in its own worktree
"Build slices 2, 3 and 4 in parallel — one implementer subagent each,
 isolation worktree. Report back when all three pass their tests."
Your agent team · Step 6

Skills, commands & hooks

Agents are who does the work. Skills are how your team does a thing. Hooks are what happens no matter what anyone decides.

Skills — procedures that load on demand

A skill is a folder with a SKILL.md. It becomes a slash command, and Claude can also invoke it on its own when the description matches. The body loads only when used, so a long procedure costs nothing until you need it.

Write a skill the second time you paste the same instructions into chat.

.claude/skills/
├── wrap-session/SKILL.md      # /wrap-session
├── new-slice/SKILL.md         # /new-slice
└── ship/SKILL.md              # /ship

Here is the one to build first. It closes the knowledgebase loop, and running it becomes muscle memory.

---
description: Ends a working session cleanly — verifies what shipped, then writes it back to the knowledgebase. Use when the user says they are done, wrapping up, or stopping for the day.
argument-hint: [optional note about the session]
---

## What happened this session

!`git log --oneline -15`

!`git status --short`

## Instructions

Wrap up this session.

1. Verify before recording. Read the git log above and the test output.
   Do not record something as shipped that has no commit behind it.

2. Summarize for me in five bullets: what shipped, what did not, what we
   learned, what is now blocked, what is next.

3. Hand off to the docs-librarian subagent to write the knowledgebase
   entries — session log, any decisions, spec status changes, and any new
   system quirks we discovered.

4. If anything is left in a broken or half-finished state, say so loudly
   at the top of your summary. That is the single most important line
   for whoever picks this up next — including me on Monday.

Extra context from the user: $ARGUMENTS
The !`command` lines are dynamic context injection. Claude Code runs them and inlines the output before Claude reads the skill. So the session summary arrives with the actual git log already in it, rather than Claude having to go fetch it. Note the frontmatter has no name — the directory name becomes the command.

Hooks — enforcement that does not negotiate

Hooks run at fixed lifecycle events as real shell commands. They fire regardless of what the model decided. This is where the rules you cannot afford to have "mostly" followed belong.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "pnpm exec prettier --write \"$CLAUDE_FILE_PATHS\" 2>/dev/null || true",
            "statusMessage": "Formatting…"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/block-prod.sh"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/remind-kb.sh"
          }
        ]
      }
    ]
  }
}

Save as .claude/settings.json to share with the team, or .claude/settings.local.json for just your machine. Hooks merge across user, project, and local scopes rather than overriding each other.

#!/usr/bin/env bash
# .claude/hooks/block-prod.sh — chmod +x this file
# Exit code 2 blocks the tool call and returns stderr to Claude.
input=$(cat)

if echo "$input" | grep -qiE 'erp\.acme\.com|prod-db|DROP TABLE|TRUNCATE'; then
  echo "Blocked: command targets a production system. Use the sandbox." >&2
  exit 2
fi
exit 0
Put the irreversible things here, not in CLAUDE.md. "Never touch production" in an instruction file is a strong suggestion. The same rule in a PreToolUse hook is a wall. Choose based on what happens when the rule is broken.
For your profile · Team

With more than one person building, commit .claude/settings.json, .claude/agents/, .claude/skills/ and .mcp.json to git. Everyone gets the same agents, the same guardrails, and the same connectors on clone. Keep personal preferences in .claude/settings.local.json and CLAUDE.local.md, both gitignored. This is also the moment to write down who is allowed to approve a Spec — ambiguity there is what turns parallel work into merge conflicts.

Your agent team · Step 7

Monitors & scheduled agents

Agents that run without you. This is where the system stops being a tool you operate and starts being infrastructure that watches your work.

Headless mode is the primitive

All three CLIs run non-interactively. That means any of them can be a cron job, a CI step, or a webhook handler.

# Claude Code
claude -p "Your prompt here" --output-format json

# Codex
codex exec "Your prompt here" --json

# Gemini
gemini -p "Your prompt here" --output-format json

Three monitors worth having

1 · Nightly drift check

Catches the class of problem nobody notices until a demo: the docs say one thing, the code does another.

#!/usr/bin/env bash
# scripts/nightly-drift.sh — cron: 0 2 * * *
cd /srv/acme-workspace || exit 1
git pull --quiet

claude -p "Compare the Specs marked Built or Verified in the knowledgebase
against what the code actually does today.

Report only real, verified divergences — read the source before claiming
one. For each: the spec's claim, the actual behaviour, and the file and
line. If everything matches, reply exactly: NO DRIFT.

Then, for anything you found, file one issue per divergence in Linear
with the label 'drift'." --output-format json > /var/log/acme/drift-$(date +%F).json

2 · Post-deploy verification

# .github/workflows/verify.yml (step)
- name: Agent verification sweep
  run: |
    claude -p "The deploy to staging just finished. Verify it:
      1. Hit each endpoint listed in docs/endpoints.md and confirm a 200
         with the documented response shape.
      2. Check Sentry for any new error signature in the last 10 minutes.
      3. Run the smoke suite: pnpm test:smoke

      Reply with PASS or FAIL and a one-line reason. If FAIL, post the
      detail to #eng-deploys." --output-format json
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

3 · Weekly knowledgebase hygiene

claude -p "Weekly knowledgebase audit.

1. Specs in Built status with no Verified date older than 14 days —
   list them, they are probably done and unrecorded.
2. Decisions marked Active that contradict a newer Active decision.
3. Systems rows with an empty Known quirks field that we have actually
   worked with this month — check the session log.
4. Glossary terms used in the session log but missing from the Glossary.

Post the summary to #ai-build. Fix nothing automatically."
Scheduled agents get read-only credentials and narrow tools. An interactive session has you watching it. A 2am cron job does not. Give unattended agents the ability to report and, at most, file a ticket — not to fix. The failure mode of an unattended agent making changes is discovering on Monday that it has been confidently wrong since Wednesday.
For your profile · Production

You are building for production, so add a fourth monitor: an incident first-responder. On a page, it pulls the last deploy diff, recent error signatures, and the relevant runbook, then posts a triage summary to the channel before a human is even at a keyboard. It must not act — its whole job is to make the first five minutes of the incident cheaper.

Building · Step 8

Route work across models

Claude Code is the builder. The value of Codex and Gemini is not that they are better — it is that they are different, and a reviewer who did not write the code catches what the author cannot see.

This section is about routing across vendors. For choosing within Claude — Fable, Opus, Sonnet, Haiku, and the effort dial that people routinely mistake for a model problem — see Chat, Cowork, or Code.

What each is actually for

Claude CodeCodexGemini CLI
Install@anthropic-ai/claude-code@openai/codex@google/gemini-cli
Instructions fileCLAUDE.mdAGENTS.mdGEMINI.md
Config.claude/settings.json~/.codex/config.toml~/.gemini/settings.json
Headlessclaude -pcodex execgemini -p
Strongest atMulti-step builds, agent orchestration, tool use, long refactorsTight algorithmic work, adversarial code reviewVery large context — whole-repo and long-document sweeps
Use it asThe builder and the orchestratorThe second opinionThe wide reader
If you already have AGENTS.md. Do not maintain two files. Put @AGENTS.md on the first line of CLAUDE.md and add anything Claude-specific below it. One source of truth, both tools read it.

Which model for this task?

What are you about to do?

The multi-model review pattern

Build with Claude Code. Then have two models that did not write it try to break it. Reconcile the findings yourself — do not let the author model grade its own homework.

#!/usr/bin/env bash
# scripts/cross-review.sh — run before opening a PR on anything that matters
set -euo pipefail

git diff main... > /tmp/change.diff

echo "── Codex ────────────────────────────────────────────"
codex exec "You are reviewing a change you did not write. Be adversarial.
Find correctness bugs, security holes, and unhandled edge cases. Ignore
style. For each finding give the specific input that triggers it. If you
find nothing real, say so — do not manufacture findings.

$(cat /tmp/change.diff)"

echo "── Gemini ───────────────────────────────────────────"
gemini -p "Review this diff in the context of the whole repository. Focus
on what a reviewer looking only at the diff would miss: callers that now
break, assumptions elsewhere that no longer hold, duplicated logic that
should have been reused.

$(cat /tmp/change.diff)"
Then bring the findings back to Claude Code to adjudicate — with the diff, not just the findings. Ask it to say for each one whether it is real, and to demonstrate why not when it disagrees. Cross-model review produces false positives; making the adjudicator show its work is what keeps you from chasing them.
For your profile · All three

You have all three installed. The routine that pays off: Claude Code builds, Codex reviews the diff, Gemini reads the whole repo for blast radius. Run cross-review.sh as a pre-PR gate on anything touching money, auth, or customer data. Skip it for a copy change.

For your profile · Claude + Codex

Drop the Gemini block from cross-review.sh and you have the pattern that matters most — an adversarial reviewer that did not write the code. That is where the majority of the benefit sits.

Building · Step 9

Turn a problem into a spec

The failure mode of AI-assisted building is not bad code. It is excellent code that solves a problem nobody had. The intake ritual is the cure and it costs twenty minutes.

Never start from a solution. "Build me a quoting app" produces a quoting app. "Quotes take nine days and we lose deals because of it" produces a conversation about which of those nine days are actually the problem — and sometimes the answer is a script, not an app.

The intake prompt

Start every project with this
I want to solve a business problem. Do not propose a solution yet. The problem: DESCRIBE THE SYMPTOM AND WHAT IT COSTS US Who feels it: WHICH ROLES, HOW MANY PEOPLE How it works today: THE CURRENT PROCESS, INCLUDING THE WORKAROUNDS What we have tried: WHAT FAILED AND WHY Your job right now, in this order: 1. Read the Charter and search Decisions in the knowledgebase for anything related. Tell me what you found. 2. Ask me the questions whose answers would most change the design. Maximum seven. Do not ask what you can look up yourself — query the warehouse, read the ERP, check the code first. 3. Only after I answer, propose three approaches: the smallest thing that could work, the thing you would build if we had a month, and the thing you would build if this had to serve the whole company for five years. Give each an honest cost and the specific reason you would not choose it. 4. Once I pick, write the Spec into the knowledgebase with acceptance criteria stated as testable assertions, and log the decision with the alternatives I rejected and why. Do not write any code this session.

Why each part is there

"Do not propose a solution yet"
Without it, you get an architecture in the first reply and spend the rest of the session negotiating with it.
"Read the Charter and Decisions first"
Grounds the whole conversation in what has already been decided. Prevents relitigating.
"Do not ask what you can look up"
The agent has your warehouse and your ERP. It should answer "how many quotes per month" itself, not ask you.
Three approaches with honest costs
Forces a real trade-off conversation. The "smallest thing" option wins more often than anyone expects.
"Testable assertions"
Acceptance criteria are the contract the QA auditor tests against. "Should be fast" cannot be tested. "p95 under 400ms with 500 concurrent quotes" can.
"Do not write any code"
Keeps the session honest. Code in the intake session becomes the design by default, whether or not it was the right one.

A spec worth building from

Spec: Quote assembly — core pricing
Status: Approved   Owner: DR   Linked decisions: D-014, D-017

Problem
  Estimators rebuild pricing by hand in Excel for every quote. Nine days
  median turnaround. We lose ~15% of RFQs to slower response.

In scope
  Pull part + routing data from the ERP, apply the pricing model, produce
  a quote document, write it back as a draft quote.

Out of scope
  Approval workflow (slice 4). Customer-facing portal (not this quarter).

Acceptance criteria
  1. For all 40 historical quotes in tests/fixtures/quotes.csv, computed
     total is within $0.01 of the recorded actual.
  2. A part number absent from the ERP produces a named error, not a
     zero-priced line.
  3. Quantity breaks apply at 10/50/250 exactly as the workbook does,
     including the boundary values themselves.
  4. All money is integer cents end to end. A float anywhere fails review.
  5. p95 assembly under 400ms for a 25-line quote.
  6. Every ERP call is retried twice, then fails loudly. No silent zeroes.

Verification
  `pnpm test quoting` green, plus a qa-auditor pass with no demonstrated
  defects.
Criterion 1 is the pattern to steal. Forty historical quotes with known-correct answers turns "did we get the pricing right" from a judgment call into a test that runs in two seconds. Whenever you are replacing something that already works, harvest its history as your test suite before you write a line of code.
Building · Step 10

The four rungs

The same workspace, the same agents, the same knowledgebase. What changes as you climb is how much rigour you add — and the mistake almost everyone makes is starting two rungs too high.

Climb one rung at a time. The most common expensive mistake in AI-assisted building is starting at rung three. Because generating a production-shaped app is now easy, people generate one before they know whether anyone wants it — and then maintain it. Start at rung one. Get to rung two in a day. Only climb to three when someone is genuinely depending on it.
For your profile · Script

You are at rung one, which is the right place to start. One rule keeps rung-one work from becoming a liability: put it in the workspace and commit it, even if it is forty lines. Scripts that live in someone's downloads folder get rewritten from scratch four times.

For your profile · Prototype

You are at rung two. The thing that decides whether a prototype succeeds is not the build — it is whether real users touch it within a week. Set the deadline first and let it constrain scope. And write the throwaway date into the Spec, so that when it becomes permanent (it will) that is a decision someone made rather than a thing that happened.

For your profile · Production

You are at rung three. Three non-negotiables: tests before features (your acceptance criteria are already the test list), the QA auditor as a merge gate, and a rollback runbook written and rehearsed before first deploy. Have Claude write and then actually execute the rollback runbook against staging. An untested rollback is a story, not a plan.

For your profile · Fleet + firmware

You are at rung four, where the cost of a mistake stops being a rollback and starts being a truck roll. Two rules: staged rollout always — one device, then 5%, then the fleet, with automatic halt on error-rate rise — and the agent never pushes firmware. It can build, test, stage, and propose. A human presses the button.

Building · Step 11

Run a big project

Everything so far was setup. This is the part you repeat: how a twelve-week build actually gets managed without the whole thing drifting into mush.

Slice it so sessions can be independent

The unit of work is a slice: something one agent can build in one session, that has its own acceptance criteria, and that can be verified alone. Slices that need each other's context should be one slice.

After the spec is approved
Break the approved Spec into slices. Rules for a good slice: - One agent, one session, start to finish. - Its own testable acceptance criteria. - Verifiable on its own, without the other slices existing. - If two slices need each other's context to make sense, merge them. For each slice give me: name, what it delivers, acceptance criteria, which other slices it depends on, and which are safe to build in parallel. Then order them so the riskiest and least-understood work happens first. Do not sequence for a smooth demo — sequence to kill uncertainty early. Write the slice list into the knowledgebase as Specs in Draft status, linked to the parent Spec.
"Riskiest first" is the whole game. The natural instinct is to build the easy, satisfying parts first. That front-loads visible progress and back-loads the discovery that the ERP cannot do the thing the entire design assumed. Sequence to find that out in week one.

Run the slices

Parallel builds with worktrees

Independent slices can build simultaneously, each agent in its own git worktree so they cannot collide.

"Build slices 2, 3 and 4 in parallel. One implementer subagent each,
 isolation: worktree, so they don't collide.

 Each one must:
 - read its Spec from the knowledgebase before starting
 - write tests for its acceptance criteria first
 - not touch files outside its own slice — if it needs a shared change,
   stop and report instead of making it

 Report back with a summary per slice when all three are green."
"Stop and report instead of making it" is the load-bearing instruction. Parallel agents editing shared files is where parallelism turns into a merge nightmare. Shared changes get made once, by you, between rounds.

Context is the resource you are actually managing

One session per slice

Start fresh. The knowledgebase carries what matters across the boundary — that is what it is for.

Delegate the messy reads

Anything that produces output you will not reference again — log trawls, wide searches, dependency archaeology — goes to a subagent.

Plan mode for anything structural

Get the plan approved before a file changes. Far cheaper than reviewing a 900-line diff.

/compact at natural seams

End of a slice, not mid-debug. Compacting mid-problem loses exactly the detail you need.

A week in practice

the loop, compressed
/new-slice 3
notion-fetch — Spec: Quantity break pricing (Approved)
notion-query — Decisions D-014, D-017 (Active)
Read the spec. Writing tests for the 6 acceptance criteria first.
Write — src/pricing/breaks.test.ts
Bash — pnpm test pricing → 6 failing, as expected
Write — src/pricing/breaks.ts
Bash — pnpm test pricing → 6 passing
Have the QA auditor go at it.
qa-auditor (opus, read-only, effort high)
DEFECT: quantity exactly 250 takes the 50-249 tier.
Workbook uses >=, implementation uses >. Criterion 3 says
"including the boundary values themselves". Repro: qty=250
returns $4.10/unit, workbook returns $3.85.
Other 5 criteria: no defect found.
Fix it and add a boundary test at every break.
Edit — src/pricing/breaks.ts
Bash — pnpm test pricing → 9 passing
/wrap-session
docs-librarian (sonnet)
Session log appended · Spec 3 → Verified · quirk added to Systems:
"Workbook quantity breaks are inclusive of the boundary value"
The off-by-one at the tier boundary is exactly the defect a self-review misses and an adversarial read-only auditor finds. It is also now written down, so slice 7 will not repeat it.

The weekly rhythm

Monday
Read the session log for last week. Pick the slices. Confirm the riskiest is still first — new information may have changed which one that is.
Tuesday–Thursday
Build. One session per slice. QA gate on each before it merges. /wrap-session every time you stop.
Friday
Run the reconcile prompt. Cross-model review anything that touches money, auth, or customer data. Update the Charter if the shape of the project moved.
Building · Step 12

QA gates & shipping

AI-generated code fails differently from human code. It is rarely sloppy and frequently confident — which means the review has to hunt for the confidently wrong thing, not the obviously broken thing.

Where AI-written code actually breaks

FailureWhy it happensCatch it with
Plausible-but-wrong business logicThe model inferred a rule that sounds right and is not — a tier boundary, a rounding convention, a fiscal calendar.Acceptance criteria tested against historical records with known-correct answers.
Swallowed errorsDefensive try/catch that returns a default, turning a hard failure into a silent zero.Grep for empty catch blocks. Assert that failure paths actually raise.
Missing tenant or scope filtersThe query works perfectly in a single-tenant test fixture.A path-scoped rule plus a QA agent that checks every query touching a shared table.
Float moneyOverwhelmingly common in training data.A grep in CI. Non-negotiable rule in CLAUDE.md.
Time zone assumptionsServer local time treated as user local time.Explicit criteria with a non-UTC user in the test set.
Confident hallucinated APIsA method that should exist and does not, or existed in an older version.It fails at runtime — which is why "the tests pass" must mean tests that actually executed.

The gate

Nothing merges until all five clear. Make it mechanical so it does not depend on how tired you are.

Gate 0%
"The tests pass" is a claim, not evidence. Ask for the actual output. This one habit catches more than any other single practice — an agent that believes it ran the suite and an agent that ran the suite produce identical-sounding summaries.

Marketing and launch, while you are here

The same machinery that builds the thing can describe it, and it has an advantage no copywriter has: it read the spec and the diff.

---
name: marketing-writer
description: Writes launch and release material — release notes, internal announcements, landing copy, customer emails. Use when a slice ships or a release goes out.
tools: Read, Grep, Glob, Bash, mcp__notion__notion-fetch, mcp__notion__notion-search
model: opus
---

You write launch material for work that just shipped.

Ground everything in evidence. Read the Spec, the diff, and the session
log before writing a word. Every claim you make must trace to something
that actually shipped — if you cannot point at the commit, cut the line.

Voice: plain and concrete. Short sentences. No "excited to announce",
no "game-changing", no "seamless", no "revolutionize". Name the thing
that is now different and who it is different for.

Default deliverables unless told otherwise:
  1. Release notes — what changed, who is affected, anything they must do
  2. Internal announcement — 5 sentences, the "so what" in the first one
  3. Customer-facing summary — only if it changes their experience

If the change is invisible to users, say so and write only the internal
note. Not everything needs an announcement.
"If you cannot point at the commit, cut the line." This is what stops launch copy from describing the roadmap as if it shipped — the most common and most damaging failure in AI-written release material.
Operating · Step 13

Close the loop

Everything above is a normal good setup. This section is the one that makes month six different from month one — and it is the one nearly everyone skips.

The compounding asset is not your code. It is the accumulated record of what you tried, what broke, what you decided, and why. Code gets rewritten. That record is what makes the next rewrite take a week instead of a quarter.

Three things must be written down, every time

Decisions

Anything an agent might reasonably propose again. Without the rationale recorded, you will relitigate it — and possibly lose to your own earlier argument.

Quirks

"Returns 200 with an error body." "Rate limits at 40/min undocumented." "Quantity breaks are inclusive." Each one costs hours to rediscover.

Dead ends

What you tried that did not work. The single most under-recorded and most valuable category. It stops the next session repeating the experiment.

Make it automatic

Discipline fails. Wire it in three places so the loop closes whether or not anyone remembers.

The /wrap-session skill

The habit. Run it every time you stop working, even for a short session. It is the only step that reliably converts a session into durable knowledge.

A Stop hook that nags

Fires when the session ends. Prints a one-line reminder if the knowledgebase has not been touched. Costs nothing, catches the days you forget.

The weekly hygiene sweep

Scheduled. Catches the drift the first two missed and tells you which specs are quietly done-but-unrecorded.

#!/usr/bin/env bash
# .claude/hooks/remind-kb.sh — chmod +x
# Non-blocking. Prints a reminder when a session ends with commits
# but no knowledgebase write in the last hour.
if git -C "$CLAUDE_PROJECT_DIR" log --since="2 hours ago" --oneline 2>/dev/null | grep -q .; then
  if [ ! -f "$CLAUDE_PROJECT_DIR/.claude/.kb-touched" ] || \
     [ "$(find "$CLAUDE_PROJECT_DIR/.claude/.kb-touched" -mmin +60 2>/dev/null)" ]; then
    echo "Work happened but the knowledgebase looks untouched. Run /wrap-session."
  fi
fi
exit 0

Let Claude keep its own notes too

Alongside the shared knowledgebase, Claude Code maintains an automatic per-repository memory — build commands, debugging insights, preferences it picks up from your corrections. Run /memory to browse and edit it. It is plain markdown.

Two memories, two jobs. Auto memory is Claude's own notes about working in your repo, machine-local and private to you. The knowledgebase is the team's shared record — reviewed, durable, and readable by humans who do not use Claude Code. Do not collapse them into one.

The test

Once a month, start a fresh session and ask:

The cold-start test
You have never seen this project. Using only the knowledgebase, tell me: - What are we building and for whom? - What are the three most important decisions made so far, and why? - Which systems do we connect to, and what is broken or weird about each? - What shipped in the last month? - What would you need to ask a human before starting work tomorrow? Then tell me what you could not find that you should have been able to.

That last line is the whole exercise. The gaps it names are your homework, and the list gets shorter every month you keep the loop closed.

Operating

A worked example, end to end

Everything in this guide, applied to one real-shaped problem across six weeks. ERP, CRM, a legacy spreadsheet, a production web app, and shop-floor devices.

The company. Meridian Fabrication — 180 people, contract metal fabrication. Quotes take nine days. Two estimators build every quote by hand in a 40-tab Excel workbook that one of them wrote in 2016. They lose roughly 15% of RFQs to slower competitors. Nobody knows which of the nine days are the actual bottleneck.

Week 1 — Foundation and intake

Workspace + connectors

Half a day. Notion MCP, HubSpot MCP, read-only Postgres against the ERP's reporting replica. The ERP itself (Epicor) gets a four-tool wrapper: get_part, get_routing, get_work_center_rates, find_customer. Read-only, sandbox, no writes.

Claude builds the knowledgebase

The schema prompt from step 2. Its five questions surface the thing that reorganizes the project: "Is the ERP the system of record for pricing, or is the workbook?" Answer: the workbook. Nobody had said this out loud. It changes the entire design.

Intake, no code

The intake prompt. The agent queries the ERP replica itself and reports: median nine days, but seven of them are waiting for the estimator to start, not building the quote. The bottleneck is queue time, not compute time.

That finding is the whole project. The obvious build — "make quoting faster" — would have optimized the two days that were not the problem. The right build is: make a draft appear automatically the moment an RFQ lands, so the estimator reviews instead of starts. Twenty minutes of intake, and the scope changed completely.

Week 2 — The spreadsheet becomes code

The workbook is the system of record for pricing, so it is the first real slice. Not "understand it" — reproduce it and prove equivalence.

"Read models/estimating-2016.xlsx. Map every input, every formula, and
every output. Then write a TypeScript module reproducing the pricing
logic exactly.

Test it against tests/fixtures/quotes-2024.csv — 312 historical quotes
with their actual final prices. Every one must match within $0.01.

Where you cannot make one match, do not adjust the tolerance. Stop and
show me the quote, what the workbook produces, what your code produces,
and your best explanation of the difference."

309 of 312 matched. The other three did not, and the agent stopped rather than fudging the tolerance:

3 mismatches
Q-2024-0881, Q-2024-1042, Q-2024-1195 — all off by 4-6%.
All three use material grade 316L.
Tab 'MatlRates' row 47 references $C$46 for 316L. Row 46 is 304.
Every other grade references its own row. This looks like a
copy-paste error, not an intentional rule.
316L has been quoted at 304 pricing since at least Jan 2024.
Cannot tell from the data whether this was deliberate. Ask an estimator.
A two-year-old underquoting bug, found by an agent that was told to stop rather than accommodate a mismatch. It was not deliberate.
"Do not adjust the tolerance — stop and show me." Copy that phrasing. Without it, a model reconciling a rewrite against historical data will quietly widen the acceptance band until everything passes, and you will never see the three interesting rows.

Weeks 3–4 — Build in parallel

Six slices, sequenced riskiest-first, four of them parallel in worktrees.

SliceDeliversRisk
1 · Pricing coreThe workbook, in tested codeHighest — done week 2
2 · ERP ingestPart, routing, and work-center rate lookup with retriesHigh — undocumented rate limits
3 · RFQ watcherNew HubSpot deal at "RFQ received" triggers a draftMedium
4 · Draft assemblyQuote document generationLow
5 · Estimator review UINext.js app: review, adjust, approveMedium
6 · Write-backApproved quote becomes an ERP draft quoteHighest — first write path

Slice 2 hits the predictable wall: the ERP rate-limits at 40 requests/minute, undocumented. The agent finds it, implements backoff, and — the part that matters — the librarian writes it into the Systems row. Slice 6, three weeks later, reads that quirk before it starts.

Week 5 — Production hardening

Rung two to rung three. Auth via the existing SSO. Structured logging. Sentry. A rollback runbook, written by Claude and then actually executed against staging to prove it works. Cross-model review on slices 1 and 6 — the two that touch money.

Codex, reviewing slice 6, catches something the builder and the QA auditor both missed: the write-back is not idempotent. A retried request creates a duplicate draft quote in the ERP. The fix is an idempotency key, twenty minutes. Finding it in production would have been a very different week.

Week 6 — Devices

Scope creep, but the good kind: if the quote knows the routing, the shop floor should know when the job actually deviates from it. Eleven machines get a small collector reporting cycle times over MQTT.

The agent builds the bridge, the ingest, the dashboard, and the alerting. It reads telemetry freely. It never touches an actuator, and it does not push firmware — the collector update is staged to one machine, watched for a day, then rolled out by a human.

The boundary that made this safe. The agent had full read access to eleven machines and full authority to build software around them. It had zero authority to change what any machine did. That line is what let the project move quickly without anyone being nervous about it.

Where it landed

Quote turnaround9 days → 1.5 days median. The seven queue days are gone; a draft is waiting when the estimator opens it. Estimator time~4 hours per quote → ~35 minutes, spent reviewing rather than building. Found along the wayA two-year 316L underquoting bug, and a non-idempotent ERP write that would have duplicated quotes under retry. Knowledgebase31 decisions, 6 specs verified, 14 system quirks, 22 session log entries. What that record boughtSlice 6 read the rate-limit quirk from week 3 and handled it before writing a line. That is the compounding, made concrete.
Operating

Your generated kit

Assembled from your profile answers. Copy each into your workspace at the path shown. Placeholders in ALL_CAPS are yours to fill in.

Answer the seven questions on Build your profile and this section fills in with your systems, your agents, and your stack.

First-week checklist

Progress 0%
Where to start tomorrow. Do not build the whole system. Create the workspace, connect the knowledgebase, let Claude design the schema, and run one intake conversation on a real problem. That is a morning, and it is enough to tell you whether the rest is worth it.
Built by Side Quest Strategies. If you want help standing this up inside a company — the connectors, the agent roster, the operating rhythm — that is the work we do.
Building With AI — The Workflow Playbook · Side Quest Strategies · tools.sidequeststrategies.com
Verified against Claude Code documentation, July 2026. Product surfaces move — check the official docs when a snippet does not behave as written.