HOOD HUNT

Keep your Claude sharp: take our setup

Claude doesn't act dumb because the model is weak. It has no rules, no memory and no checks: every time it starts from scratch and takes its own word for it. Below is my setup that fixes this. First you just read, and at the end you install all of it with one prompt.

$2 576

that's what one week of my work with agents would cost at API prices (11–17.11). I'm on a subscription: this is a measure of volume, not a bill.

7desk sessions: product, trading, content and more
317subagents in a week
15 023model requests in a week
40of my mistakes turned into rules and checks

If you haven't touched agents yet, start here. Three minutes: how an agent differs from a chat, what the setup adds and what it has already done for me.

Chat vs agent

A chat answers. An agent does. In a chat you ask, get text back, and the rest is manual: copy, run, find the error, bring it back. An agent opens the files itself, runs things itself, sees the error itself and keeps fixing until it works. You set the task and accept the result.

I work in Claude Code — that's Claude sitting right inside your project folder. Two words you'll see below: session — one conversation with the agent, context — everything it's holding in its head right now. The bigger the context, the more every answer costs.

Diagram: in a chat the human runs the “run, find the error, bring it back” loop; an agent has this loop inside Chat Youask a question Modelwrites a text answer Youcopy it, run it Youfind the error you carry the error back: every loop by hand Agent Youtask and criterion Agentreads files, rules Agentfixes, checks Youaccept the result fixes the error itself
Fig. 1. Chat vs agent. In a chat, you spin the “ran it — found the error — brought it back” loop. An agent has this loop inside: you show up at the start with a task and at the end for the result.

The downside of a bare agent: it does a lot and fast, including the wrong things, and forgets everything between sessions. The setup is what fixes both.

Without setup → with setup

Memory

without setup
Every time you re-explain what you decided yesterday.
with setup
The agent writes decisions into memory files itself and reads them at startup. I have 332 of them.
details
Memory

Rules

without setup
You asked it to fix a button — it rewrote half the project.
with setup
The agent reads the CLAUDE.md rules file first: what it may do, what to ask you, how to check “done”.
details
Desks

Checks

without setup
Says “done” without running anything.
with setup
A hook is a script that runs on its own and won't let the agent finish with an error in a file.
details
Hooks

Desks and subagents

without setup
One chat for everything: a mess within a couple of days, and every answer costs more.
with setup
A separate session for each area; small tasks go to subagents.
details
Subagents and money

Watchdogs

without setup
Something broke overnight — you find out in the morning, on your own.
with setup
Scheduled scripts and an on-call agent. Handling one event costs half a cent.
details
Server and on-call

Limits

without setup
The limit runs out by lunch, and you can't tell why.
with setup
A script tracks usage. The biggest eater is a long conversation: 84% of the money goes to the agent rereading it on every answer.
details
Context and /clear

What agents have already done for me

Six real tasks in a month. Before → what the agent did → result.

tradingweek

Copy trading with an agent

before
Who to copy and when to switch off — by eye.
agent
Finds wallets in Hood Hunt, checks them with a backtest, places orders in Blizz and watches them around the clock.
result
A green day of +6 SOL, and the backtest on the same trades gave +6.03: that day the model matched reality. There were red days too: the safety net paused everything on its own.
productHood Hunt

Parser vs blockchain

before
People copy wallets with their own money — the numbers have to be trustworthy.
agent
Checked the wallet cards in the product against the blockchain itself.
result
Last trade — 12 of 12, coins — 42 of 43, fabricated — 0.
producta day

An auditor found fake profit

before
One desk computes the numbers — nobody to check them.
agent
A separate auditor agent with no deploy rights checked 654 product numbers against the blockchain.
result
Found a bug: 51 wallets showed over 5 000 SOL of profit that didn't exist. The first botched fix was stopped by a pre-deploy check.
serverin a day

Moving to one server

before
The product, bots and terminal lived on different servers.
agent
Wrote the migration and rollback scripts in advance, moved 53 GB of data in the background.
result
Moved in a day, about an hour of downtime. A build takes 3–4 minutes instead of 45–60.
mistakelesson

False alarm

before
A watchdog kept posting “service down” every half hour.
agent
Dug in: the service was fine, the watchdog's own key had expired.
result
New rule: an alert names the cause and the owner. More in mistakes.
setupday

Spring cleaning

before
The folder had sprawled, rules lived as lines of text.
agent
In a day it set up hooks and checks, cleaned up memory, moved old stuff to the archive.
result
Folder 26 → 8.7 GB, 25 auto-checks, 40 mistakes recorded and checked.

What to honestly expect

  • The first week is tuning. The agent builds the setup in half an hour, then it grows on your mistakes.
  • The agent makes mistakes. My list has 40 mistakes, and they're all mine.
  • Limits are finite. A long conversation eats them fastest — what to do about it.

Start in 15 minutes

This is exactly how I started. Five steps, not a single terminal command.

Five steps to start: VS Code, the Claude Code extension, a project folder, private GitHub, prompts step 1step 2step 3step 4step 5 VS Codedownload, install ExtensionClaude Code + sign-in Foldersees the project GitHubprivate repository Promptstune it to you first after every task — a version in GitHub
Fig. 2. The whole start. The first three steps happen once. After that you live in the fifth, and GitHub keeps every version.
  1. Download VS CodeA free editor from code.visualstudio.com. Mac, Windows, Linux.
  2. Install the Claude Code extensionIn VS Code open “Extensions”, find Claude Code by Anthropic, click “Install”. Sign in with an account that has a Claude subscription — a browser opens, confirm there.
  3. Open your folder“File → Open Folder”. No folder yet — create one for all your projects. Now Claude sees which folder it's working in and reads the files itself.
  4. Set up a private GitHubThis is your time machine. What it is and why — right below.
  5. Start promptingFirst tune Claude to you — with one prompt in the last section. Then move on to your own tasks.

We work in VS Code

  • Claude sees the folder, the rules and the memory.
  • It runs and checks things itself.
  • Everything in this guide works only here.

The Claude app is not for work

  • The chat in the app can't see your folder: that's the very “dumb Claude”.
  • You only need it for the subscription and to apply a limit reset if you get one.
  • The limit is shared: questions in the app eat into your work budget.

Private GitHub: rollback and a copy of everything

GitHub is an online version store. A private repository is visible only to you. The agent saves a version there itself after every task.

RollbackThe agent broke something that worked — you're back on yesterday's version in a minute.
A copy off the laptopLaptop died or got stolen — everything is in GitHub, whole.

Put in

  • Code and scripts.
  • The agent's rules — CLAUDE.md.
  • Project state files.
  • The agent's memory.

Never put in

  • Keys and passwords.
  • .env files with secrets.
  • Wallets and seed phrases.

Before the first save the agent adds .env, keys and wallet files to .gitignore (the list of what GitHub doesn't take). If a secret has already landed in GitHub, deleting it isn't enough: rotate the key right away, it doesn't leave the history.

How I do it. On 03.09 I lost all my chats with agents. Only the memory survived, because it lived in files. Now copies go to a private GitHub repository every day, the archive is encrypted, and the decryption key is kept separately from it.

What to take

  • Work happens in VS Code with Claude Code; the app is only for the subscription and limit resets.
  • One folder for everything and a private GitHub from day one.
  • You don't need to set up the editor and Claude Code settings by hand — they're in the final prompt.

Desks: seven sessions instead of one chat

What it is. A session is a separate chat with Claude. I have seven, one per area, like departments in a company.

Why you need it. One chat “about everything” turns into a mess within a couple of days. The agent mixes up topics, and every answer gets pricier: at every step the model rereads the whole conversation.

How we do it

Diagram: me, seven desks, shared contract and HANDOFF buses, subagents and the server Me task · product and money calls · sign-off Productback endSTATE.md TradingdeskSTATE.md Updates& contentSTATE.md GrowthSTATE.md MarketingSTATE.md NumbersauditSTATE.md Processesrules, memory the “processes” contract: rules, memory, deadlines, usage — for all desks HANDOFF files and batched messages: desks coordinate without me subagents: each desk has its own, no more than 3 at once Executor · Opus Skeptic · Opus Mechanic · Haiku Search · Haiku the master deploys, subagents never touch prod Server: product, bots, schedules, watchdogs, on-call agent deploys by script only: backup → tests → outside check → one-command rollback
Fig. 3. How the work is organized. I give tasks to the desks. The desks coordinate among themselves — through a shared notes file and messages. The “processes” desk keeps the rules for everyone. Subagents work inside a desk and can't reach the server.

Each desk has four things:

  1. An entry phrase. “Trading desk, let's continue” — and a new session knows within a minute who it is and what to read.
  2. A state file (STATE). Three blocks: what's working, what's open, what's waiting on me. The desk remembers where it stopped.
  3. Boundaries. A desk stays out of others' business. Asked to fix something — it fixes it instead of rewriting everything.
  4. A check. One command that runs the tests. “Done” means checked, not written.

When the agent makes mistakes, the first urge is to switch to a smarter model. The right order is different: first a command that catches the error, then higher effort, and only then the model.

STATE is read in full on every entry, so it has to be short. By 16.11 five of these files had bloated to 741 KB: every session dragged two months of history in at startup. After cleanup — 93 KB, the back end went 325 → 38 KB. Nothing was deleted, the history moved to an archive next door.

Trading desk9 sessions · 83 agents
$763
Product back end8 sessions · 102 agents
$754
Marketing7 sessions · 52 agents
$357
Numbers audit3 sessions · 42 agents
$331
Updates and content3 sessions · 6 agents
$136
Growth2 sessions · 22 agents
$128
Processes1 session · 9 agents
$75
Fig. 4. What each desk cost over the week of 11–17.11, $ at API prices, scale from zero. The trading desk and the back end are 59% of the money. “Processes” costs 3%, and it's exactly what keeps the rest cheap.

How desks talk to each other

I'm not needed in this chain: I set the direction, the sessions coordinate on their own. Three channels, from cheap to expensive:

Over 18–21.10 the sessions sent each other 658 messages. After the rule “batch your messages, everything else goes into a file”, in the week of 22–29.10 there were 160.

Take it home

  • One area — one session: an entry phrase and a short STATE.
  • Every project has one check command. No command yet — build it first, then the feature.
  • More than three desks — set up “processes”: it doesn't build product, it watches the rules, memory and usage of the others.

To install this for yourself — see the last section, one prompt.

Memory: what the agent remembers between sessions

What it is. The agent remembers nothing between sessions. Everything it “knows” about me and the projects lives in plain text files.

Why you need it. On 03.09 I lost all my chats at once. Only the memory in files survived. Since then the rule is: decisions and pitfalls go into memory right away, not “we'll dig it out of the chat later”.

How we do it

Three layers of memory and a rule's path from chat to hook LAYERWHAT IT HOLDSWHEN IT LOADS RulesCLAUDE.md × 28.6 + 23.8 KB How to work: style, boundaries, models, deploy order, per-project checks. A global file and a workspace file “Ship first, report after” every turnin fullmost expensive to keep MemoryMEMORY.md + files332 files Decisions, pitfalls, agreements: one topic — one file. Index — one line per topic with a link, 14 sub-indexes “Never put a gif in a broadcast” index at startupfirst 25 KB / 200 linesfile — via link Progressdesk STATE.mdup to 60 KB What's live, what's open, what waits on me. Continuation prompt for a new session after /clear “Live since 14.11, three items open” on entering the deskin fullso it's short A rule climbs the layers until it becomes code: said in chat memory file line in CLAUDE.md hook or test
Fig. 5. Three layers of memory. The more often a layer is read, the shorter it must be. At the bottom — a rule's path: said in chat → memory file → line in the rules → code. The gif rule took 17 days to travel this path: recorded 30.10, banned in code 16.11.

One memory file — one topic. Inside: the rule in one sentence, the incident with a date, and how to check it. Without the incident, a month later the agent will decide the rule is outdated.

Memory is not a guarantee. The ban on gifs in broadcasts sat in memory and was still broken. The only thing that reliably holds it is code that refuses to send such a file.

The index and the invisible tail

The memory index is one line per topic with a link to the file. At startup a session loads only the first 25 KB or 200 lines. Whatever comes after, the agent doesn't see — and there's no error. My index grew to 28.5 KB: the rules in the tail were there, but for the agent they didn't exist.

before 16.11tail not loaded
28.5 KB
16.11after trimming
24.6 KB
17.11120 lines
21.9 KB
the part the agent didn't seedashed line — 25 KB load limit
Fig. 6. Memory index size, scale 0–30 KB, dashed line — the 25 KB load limit. I keep it under 23 KB for headroom. A section that grows too big moves to its own file, and one link stays in the index.

Only what can't be looked up again goes into memory. There isn't a single usage number in my memory — there's the command that calculates them. I got every number in this guide by running it in the morning. A copied number lies a week later; the command doesn't.

Once a week — memory cleanup. The first big one was on 16.11:

332files checked
15orphans — files with no line in the index, the agent won't find them
25outdated
7groups of duplicates
5contradictions with the rules

A contradiction is the most dangerous: the agent reads an old file and confidently does it the old way. I don't silently rewrite such files — I put a note at the top saying what changed.

Take it home

  • Told the agent “don't do that again” — have it write a file right away: the rule, the incident with a date, how to check.
  • Watch the index size. Over 23 KB — move a section to its own file and leave a link in the index.
  • A rule broken a second time — turn it into code or a hook.

To install this for yourself — see the last section, one prompt.

What it is. The desk session is the master: it breaks down the task, plans, deploys, writes memory. Big code is written by subagents — separate agents that start from a clean slate.

Why you need it. A subagent doesn't drag along the master's 400 thousand tokens of history (a token is a piece of a word; text volume is measured in them). Its request is many times cheaper, and fresh eyes review better than the author.

How we do it

  1. Master — Fable 5.2. Breakdown, plan, deploy, memory.
  2. Executor — Opus 5.5, up to 150 steps. Writes code strictly to the brief and hands in proof: test output, not a story.
  3. Skeptic — Opus 5.5, up to 80 steps. Only reads and looks for errors. It has no tools to edit, so it can't “tweak a bit and sweep it under the rug”.
  4. Mechanic and search — Haiku, up to 60 and 40 steps. Tests, file search, copies.

The step cap is there so the agent stops instead of burning the limit in a loop.

Flow of the executor and skeptic pair, branching by task type and score Desk masterbreakdown and planBRIEF.md + CONTRACT.md Executor · Opuscode strictly to briefreturns files, md5, output Money or numbersfor users?else no skeptic needed /code-reviewon the diffbuilt-in, cheap Skeptic · Opusbrief + diff + runscore 1–10, blockers Deploybackup, tests,outside, rollback Fixesby the same executorif idle under 1 h (cache) no yes 7+ ≤6 second round — only if the score is 6 or lower The skeptic isn't a gatereversible: show and ship at once,the verdict catches up Irreversible waitsmoney, wallets, data deletion —only after the verdict Prod — master onlyssh and restarts are bannedfor subagents in their header
Fig. 7. A task's path. The master hands over the assignment (brief) and the shared agreements (contract) as files. The skeptic only steps in for money and numbers shown to users; everything else is checked by the built-in /code-review on the changes. A score of 7 or higher — OK to deploy.

Five rules for subagents

  1. No more than three agents at once. On 13.09 I launched a workflow (a chain of agents) with 20 of them — the limits burned before my eyes, I had to stop it. More than three — only in sequence.
  2. The master writes small stuff up to ~150 lines itself. Measured on 30.10: the executor spent 35 minutes on six scripts; by hand it would have been about 10. The brief, the wait and the report cost more than a small fix.
  3. Skeptic — only where it pays off. It ate 29% of the agents' money, and in 56% of reviews it gave 8+ and found no blockers. Now it only checks money and numbers for users.
  4. Agents are short and disposable. New task — new agent. The median agent of the week — 22 requests and $1.54.
  5. Mechanical work goes to a cheap model. Tests and search don't need brains. Honestly: this week Haiku made 6 requests out of 15 thousand. The rule exists, the habit doesn't yet.

Where the money goes

My script prices every request at API rates. The subscription doesn't charge this money, but limits are spent in the same proportion. This is an honest map of where they burn. Week of 11–17.11: $2 576, 15 023 requests, 38 sessions, 317 agents.

11.1112.1113.1114.1115.1116.1117.11*
Fig. 8. Daily spend, $ at API prices, scale from zero. *17.11 — snapshot in the morning, the day isn't over. The 14–15.11 peak is the launch of wallet cards and the guide: 3 370 and 3 940 requests a day.
13–19.10week before the rules
62%
18–21.103.5 days
54%
19.10–17.1130 days
41%
11–17.11this week
30%
Fig. 9. What share of the money went to subagents, scale 0–100%. These are four measurements of different lengths, not a series. The number of agents is about the same: 330 in the week of 13–19.10 vs 317 now. They got shorter and run where they pay off.

Take it home

  • A subagent is a file that sets its model, permissions and step cap. The reviewer has no right to edit.
  • A brief for the agent — as a file, with two lines: what you're changing and what not to touch. Without them the agent “fixes” the neighboring stuff too.
  • No more than three agents at once, small stuff by hand, a skeptic only where a mistake costs money.

To install this for yourself — see the last section, one prompt.

What it is. Context is everything the model holds in its head in this session: the conversation, files it has read, images. At every step it rereads all of it.

Why you need it. You pay not for answers but for rereading. For me 84–86% of the money is context rereading; the model's answers are less than a sixth. So you save on context size, not on answer length.

How we do it

Money$2 576
Fable 5.2 · $1 779Opus 5.5 · $795
Requests15 023
Fable · 5 495Opus · 9 503
Fable 5.2 — desk mastersOpus 5.5 — subagentsSonnet and Haiku — under $4 combined
Fig. 10. Week of 11–17.11. The master makes a third of the requests and eats two thirds of the money: its request averages $0.32, a subagent's — $0.08. The reason is context size: the master's median is 408 thousand tokens, the subagent's 109 thousand.

Below is the key picture of the guide.

Curve: the median request price of Fable 5.2 and Opus 5.5 grows with context size $0$0.10$0.20$0.30$0.40 0200k400k600k800k request context size, tokens subagent, median 109k master, median 408k 650k $0.13 $0.37 Fable 5.2 Opus 5.5 $0.05
Fig. 11. Price of one request by context size, median over 15 thousand requests in the week of 11–17.11. A Fable request at 100–200 thousand costs $0.13, at 600–700 thousand — $0.37: 2.9 times more for the same question. Subagents on Opus never get past 600 thousand.

Switching the model mid-session wipes the cached context: each model has its own. The first request after a switch cost $5.70, the next one $0.31 — an 18x difference. In a week there were 59 such cold starts — $293, 11% of the week. That's why I don't switch models in the middle of a big session.

/clear instead of a bloated session

/clear wipes the session. So you don't lose work, before it the session writes STATE and a continuation prompt — the text a new session picks up from.

The model can't see how much context it has. So there's a hook — a small script Claude Code runs on its own at every step. At 650 thousand it asks to prepare a continuation prompt, at 700 thousand it suggests /clear. Auto-compaction of history is only a safety net at the one-million wall.

Context ruler from 0 to 1 million tokens with the hook thresholds 109ksubagent, median 408kmaster, median 650kprepares a continuation prompt 700ksuggests /clear ~970k auto-compact · 1M wall 0
Fig. 12. Context ruler from zero to a million tokens. Medians are over the requests of the week of 11–17.11. Between the advice to clear and the wall there are 270 thousand tokens of headroom: auto-compaction only kicks in if you ignore every warning.

I tried a hard limit: on 04.11 the thresholds changed four times in one day. The cutoff tore work apart mid-step. A “get ready” signal plus a ready prompt works better.

Images — in batches. Every image read stays in context until the session ends. Over 18–19.10 screenshots made up 183 MB of the 197 MB total the agents read. Rule: one frame per state, eyes on it once at the end.

Take it home

  • One task — one session. Done with a topic — STATE, a continuation prompt and /clear.
  • Don't switch models in the middle of a big session. Keep effort (how much the model thinks) on high: going higher is 2.5× the price for +1.4 points of quality.
  • Set up a usage counter. Without it all advice about limits is guesswork.

To install this for yourself — see the last section, one prompt.

Hooks: the agent won't say “done” without a check

A hook is a small script that Claude Code runs on its own at the right moment: at session start, on every message you send, before the word “done”. It can't be forgotten or skipped.

Why you need it. The agent has read the rule in the file, but in a long session it may not follow it. My rules are 32 KB, and a single line drowns in them. So everything “always” and “never” I enforce with hooks and bans.

I took the principle from Anthropic: a hard rule is a hook or a ban, not a line in the rules file.

Session start summary on the first screen: what's on the server which deadlines are hot how much was spent rules check 25/25 Every message measures context size: 650k — prep the prompt 700k — time to /clear silent below 650k Before “done” checks the code the agent edited during the turn error → turn not closed, the agent fixes it Always: the agent never reads keys · a frozen project — only with my “yes”
Fig. 13. The three moments when my hooks fire. The bans at the bottom apply to every command, with no event needed. About 650k and 700k — in the context section.

The first screen of every session

Before, every session started with questions like “what's on the server, what's on fire”, and I retold it all. Now the startup hook prints the summary itself. It changes nothing, only reads.

new session · startup hook
$ claude          # the hook runs on its own, ~2.5 s
== PRODUCT snapshot · 2026-11-17 06:49 UTC
server: snapshot 4 min ago · load normal · memory normal
running: nothing heavy
services: all active
memory: 22 archive candidates — confirm with one “yes”
-- limits, past day: $243-eq · 1024 requests · 8 sessions, 25 agents (22% of money)
-- deadlines:
  #2 (OVERDUE 1 d) [owner] renew the domain
  #30 (today) [back end] check the weekly report
-- harness: 25/25 checks
Fig. 14. Real output of the startup hook on 17.11, shortened and anonymized. The numbers are as the script printed them.
Startup summaryServer, deadlines, spend, state of the rules. Server didn't answer — one line, and the session starts as usual.
Context watchdogMeasures how full the session's context is. Cleans nothing itself: it writes “time to /clear”, and I decide.
Check before “done”Runs a quick code check on the files the agent edited. Found an error — the turn goes back to the agent.
Deadline registryAny future date (“renew the server”, “reconcile on 27.11”) goes into a file, not into text. The hook shows what's overdue and the next 3 days.
Rules checkA 25-point script: hooks connected, bans in place, memory not bloated. I run it after every rules edit.
25/25rules checks on 17.11; at launch on 16.11 it was 24
36deadlines logged by sessions since 16.11; before that, dates lived in text

What to take

  • Find the lines in your rules with the words “always” and “never”. Each one is a candidate for a hook or a ban.
  • Start with one hook: a code check before “done”. That one alone catches the most.
  • Lock down keys and other people's projects with a ban, not a request.

To install this for yourself — see the last section, one prompt.

Server and on-call: work goes on while the laptop is closed

A server is a computer in a data center that runs around the clock. A Mac goes to sleep, and everything running on it stops. So everything that has to work without me lives on the server: bots, watchdogs, schedules.

Why you need it. Launching a bot is half the job. What matters is that the server notices problems itself and reports them properly, instead of burying you in identical alerts.

On 13.11 Anthropic published a write-up, “Building always-on agents” — how an agent that runs all the time is built. On 16.11 I checked our server against it. This is the loop we ended up with.

1 · Event a watchdog spots a failure → log entry 2 · Launch on-call agent, read-only 3 · Triage what happened, marked “handled” 4 · Message one line to me, repeat at most daily 5 · Timer hourly; nothing new → no model call a new session at startup sees what's unhandled
Fig. 15. The always-on agent loop on our server. The model is called only at step 2 and only if there's something new. The rest is ordinary scheduled scripts.

One notification sender

The most useful fix of the week, and the most boring. 38 scripts were messaging me on their own, each with its own text. One failure turned into a repeat every 30 minutes, and it was unclear what had already been handled. Now all service messages go through a single sender: it keeps a log and doesn't repeat the same thing more than once a day.

Before, 16.11 38 files send to Telegram on their own Telegram no log, no pauses: one failure — a repeat every 30 min After one sender, a log, pauses watchdogs, scripts sender Telegram once log on-call hourly the same alert repeated during a pause isn't sent
Fig. 16. 38 squares — the 38 scripts that on 16.11 were messaging me in Telegram directly. On the right — how a service message travels now. Broadcasts to users aren't part of this.

And the second rule: an alert names the cause and the owner. “The watchdog's own key expired” and “the service is silent” are different texts, and different sessions fix them. A new watchdog starts quiet: people stop reading a noisy one within a week.

On-call agent: the model only when there's something to triage

Once an hour a script looks at the log. Nothing new — it exits without calling the model, zero spend. Something there — it launches Claude on the cheapest model with permission only to read logs. The on-call agent fixes nothing and restarts nothing; it writes me one line. A real one: “On-call: events 1, spend $0.005”. Half a cent — cheaper than me opening a session and asking.

1 hhow often it wakes up
$0if there's nothing new
$0.15cap per run
$1cap per day

One-command deploy

Finished and checked work goes straight to prod for me, no staging. This rests not on courage but on a script. The agent doesn't improvise a deploy each time — it calls one command, and every step of it can stop the process.

  1. Testsone command runs all of the project's checks
  2. Backupprod is copied into a separate folderincomplete copy → stop
  3. Upload alongsidethe new file under a temporary namecorrupted file → stop
  4. Swapall files at once, services restarted
  5. Quick checkthe service answered and isn't crashingno answer → rollback
  6. Outside checkthe page opens for a guest, without logindidn't open → alert to me
  7. Recordwhat, when, and where the backup is
rollbackFailure after the swap — every file is restored from the backup, services are restarted again. The outside check doesn't roll back, it wakes me up: the server can be alive while the page is blank for guests.
Fig. 17. The steps of the one deploy command. Orange labels mark where the script stops on its own. Highlighted are the steps where new stops appeared on 16.11 after our mistakes.

What still gets asked of me: only the irreversible. Money and wallets, broadcasts to users, data deletion.

What to take

  • Everything that has to work without you — on a server, not a laptop.
  • All notifications — through one sender with a log and a pause.
  • Before you let an agent onto a server, give it one deploy command: backup, check, rollback. An agent that deploys by hand will sooner or later put a file in the wrong place — that's exactly what happened to us.

To install this for yourself — see the last section, one prompt.

Mistakes → rules

Almost every rule I have was born from a specific mistake. The pattern is always the same: what happened → what rule appeared → what enforces it now.

Why you need it. The agent doesn't remember past sessions. The only way a mistake won't repeat is if the rule has become a test or a check, not a request like “don't do that again”.

Below are eight of our cases. The “code” tag means a script checks the rule; “reviewer” means for now it's checked by questions.

datacode

The cleaner wiped the backfill

what happened
I asked to keep data for 93 days instead of 30. The retention was changed in one place, but nobody opened the nightly cleaner with its own “older than 34 days — delete”. It wiped 21 backfilled days, about 24 hours of work.
rule
Retention changes only after checking every cleaner. Retention comes from a single source.
enforced by
A check that the cleaner takes the retention from the same place as the build.
userscode

The landing page was blank for an hour

what happened
The page was checked from the server itself, and there it opened. For people outside, fonts and parts of the page didn't load; it didn't open for about an hour until I spoke up.
rule
Check public pages from outside, as a guest: without login, every file of the page.
enforced by
An outside check after every deploy, plus a test.
userscode

Deploy “succeeded”, but missed

what happened
The wrong folder was specified. The script put the file in the wrong place, the bot kept running the old version, and the report looked successful.
rule
As many copies in the backup as there are prod files, otherwise stop.
enforced by
The deploy stops before upload if the backup is incomplete.
timereviewer

A watchdog blamed the service for its own key

what happened
A watchdog for one service posted “down” every 30 minutes. In fact the watchdog's own key had expired. Sessions were debugging a healthy service.
rule
An alert names the cause and the owner. Key expiry goes into the deadline registry.
enforced by
One sender with a one-day pause, and the deadline registry.
usersreviewer

Drafts went out as final

what happened
The agent sent every intermediate version of a banner to the team chat as if it were final: three posts in a row.
rule
Drafts — only to me in DMs. Outside — once, after my “ok”.
enforced by
Reviewer questions; the related “don't send gifs” rule is already in code.
userscode

Unchecked numbers

what happened
Outdated sample results and a SOL figure without the fee rate made it into a guide. A reader with a different rate would have got less than promised.
rule
Check every number shown to people against its source. Don't draw made-up results.
enforced by
A text-check script before publishing and a second reviewer agent.
moneycode

“10,5” became 105

what happened
A user on iPhone enters the amount “10,5” in the trading terminal. The field dropped the comma: an order 10 times bigger than intended.
rule
A comma is a decimal separator too.
enforced by
A test for “10,5” and “0,05” in the shared check.
usersreviewer

“Continue” isn't “yes” to everything

what happened
A session gave six recommendations, I replied “continue”. It switched on the whole list, including things users see.
rule
Do only what was explicitly approved. For the rest — one question as a list.
enforced by
Reviewer questions and the rule “plan first, result after a yes”.

Mistake catalog

I record every mistake as a card: how I set the task, what went wrong, what should have been done and how to check it. That's how I have 40 cards. On 16.11, 11 were checked by a command, the other 29 by reviewer questions. By 17.11 code covered 7 more, making 18.

checked by a script reviewer questions Cost of the mistake seen by people 16 · 8 + 8 money 10 · 4 + 6 time 8 · 2 + 6 data 6 · 4 + 2
Fig. 18. The catalog's 40 cards by cost of the mistake, file as of 17.11. One case — 30 px. “Time” is hours of work and my attention, “data” is loss or leak.

How it works in practice. The agent makes a mistake — I say “don't do that again”. In the same turn it writes a memory file with the reason, adds a card to the catalog and, if the rule can be caught by code, writes a test. A week later the mistake doesn't repeat — not because the agent “remembered”, but because the test fails.

What to take

  • Every mistake — a card in the catalog the same day: the situation, what went wrong, how to check.
  • A rule that can be caught by code — turn it into a test. Reviewer questions are temporary.
  • After a month the catalog shows whether the agent repeats your mistakes.

To install this for yourself — see the last section, one prompt.

Trading with an agent: the flow only

I have my own trading desk: the agent runs copy orders in Blizz on wallets that our Hood Hunt parser finds. A copy order is when your account repeats the trades of a chosen wallet.

Here's only how the process works. I don't show wallets, sizes or selection rules: revealing them kills the trading itself.

Why you need it. If an agent moves money, the main mistake is trusting the rules to its memory.

1 · Selection wallets from Hood Hunt by trade history 2 · Backtest a run on past trades before the order 3 · Order only through one module with checks 4 · Oversight hourly, by the playbook “before → after” report 5 · Quarantine wallet taken off the order but kept in view 6 · Review desk log and report mistake → rule → test new rule into code Control: I type a phrase in the desk chat, the bot places or edits the order within code-enforced limits.
Fig. 19. The trading desk flow. Step 3 is highlighted: an order is written only through one module, and that's where the checks that can't be skipped live. The dashed line — the review feeds back into selection as a rule in code, not as text.

What the agent does

  • Reviews candidates and runs backtests.
  • Places and edits orders from my phrase in the chat.
  • Checks the orders hourly and writes a “before → after” report.
  • Keeps a log: what was placed, why, how it ended.

What code enforces, not the agent's memory

  • Orders — only through one module; the agent has no other path.
  • No order without a wallet review: test.
  • The agent can't pause a wallet on its own: test.
  • Desk limits live in settings, not in the rules text.

Why so strict. The agent read the rule in memory, agreed, and a week later in a new session did it its own way. That's what happened with pausing: the agent stopped a wallet on its own after a losing streak, and 40 seconds later I had to switch it back on. For a wallet like that a losing streak is normal. After that the rule went into a test.

What to take

  • All orders — through one module. The agent must have no other path.
  • Trading limits — in settings, not in the rules text.
  • A rule you've already had to say once — straight into a test.

To install this for yourself — see the last section, one prompt.

Take it all home: the guide and one prompt

You didn't copy anything along the way. It's all collected here: one prompt installs the whole setup from the sections above. Your Claude will read the guide, ask about you and build the same thing for your tasks.

  1. Save the guideCmd+S on Mac, Ctrl+S on Windows. Put the file into your working folder and drag it into the Claude Code chat in VS Code.
  2. Paste the promptThe “Copy” button below, then paste into the same chat and send.
  3. Answer and say “yes”The agent asks nine questions, shows a plan and starts only after your “yes”.
Fig. 20. Three steps. The agent does everything else itself: looks over the folder, builds, checks itself and writes how to roll back.

It takes 30–40 minutes including your answers. It doesn't overwrite your files: first it shows what it will change and backs up your settings. This is the first version. The setup will adapt to you over the first week of work.

main prompt

Build the setup from the guide

paste into the Claude Code chat together with the guide file
Build me a working Claude Code setup from the attached guide “Keep your Claude sharp”, then fine-tune it together with me.
There are no ready-made files: you create everything yourself from this prompt; the guide is a model of how it's built. Product, desk and server names and the numbers in the guide are the author's: you carry over the structure, not them. Go step by step, don't skip ahead.

## Rules for the whole job
- Don't overwrite existing files: only a diff and my “yes”. New files are fine.
- Before editing any settings.json (VS Code, ~/.claude, the project) — a backup next to it: settings.json.bak-YYYYMMDD-HHMM, then a diff, then my “yes”.
- Don't read or print secrets (~/.ssh, .env, keys, tokens, wallets, seed phrases), don't put them into memory, chat or git. If you see such a file — name only its path.
- Deploy nothing to servers, no restarts, git push — only with my “yes”. Don't touch anything I call off-limits.
- Keep a list of every file you created or changed — it's needed for rollback.
- Run every hook with test input and show the output. Not checked — say so.
- Talk to me in plain words: I may not know the terminal or git. If I have to do something — one step per line and what it does.

## Step 1. Read and look around (change nothing)
1. Read the whole guide.
2. Project: CLAUDE.md or .claude/CLAUDE.md, .claude/agents/, .claude/settings*.json, STATE.md, test and build commands (package.json, Makefile, pyproject, etc.).
3. ~/.claude: CLAUDE.md, settings.json, agents/, this project's auto-memory folder (~/.claude/projects/‹project path, slashes replaced with hyphens›/memory/).
4. Tools: versions of python3, node, bash, git; is gh installed and logged in (gh auth status). Is the folder already a git repository? Is there a remote?
5. Files that look like secrets (.env*, *.key, *.pem, id_rsa*, id_ed25519*, *keypair*.json, wallet*, seed*): only a list of paths, don't open them.
6. Briefly show what already exists and what will conflict.

## Step 2. Questions (in one message, numbered)
1. What are you building and how do you make money; the main goal, ideally as one number.
2. Which areas do you run, by importance. They'll become desk sessions; where is each one's folder.
3. Stack: languages, frameworks, services. Is there a server where prod lives, and how do you deploy now.
4. What is irreversible and done only with your “yes” (money, wallets, broadcasts, data deletion, other people's services).
5. Subscription and models: which is the main session, which are subagents, which model is the cheapest; context window 200k or 1M.
6. Which language should I talk to you in, and text rules: tone, banned words and letters.
7. How to check each project: a test or build command; if there isn't one — what counts as “works”.
8. What must never be touched: folders, services, projects.
9. GitHub: do you have an account; what to name the private repository; push after every task on my own or only on your word.
Don't guess. No answer — leave a ‹answer› placeholder and carry it into the report.

## Step 3. Plan — wait for “yes”
Show a list grouped by the sections of step 4: files to create, edits to existing ones as a diff, settings blocks, context thresholds, models and agent caps, the first desk and its entry phrase, what goes into git and what into .gitignore. You don't go further without my “yes”.

## Step 4. Build — in the order of the guide's sections

### 4.1 Workplace
- We work only in VS Code with the Claude Code extension, in the open project folder. The Claude app is for the subscription, not for work.
- VS Code user settings.json: "claudeCode.preferredLocation": "panel", "claudeCode.hideOnboarding": true.
- ~/.claude/settings.json (keep my keys, extend arrays):
  "language": ‹from answer 6›, "effortLevel": "high", "cleanupPeriodDays": 3650,
  "autoContinueAtUsageLimit": true, "subagentPromptCacheTtl": "1h",
  "env": {"CLAUDE_CODE_SUBAGENT_MODEL": "‹subagent model from answer 5›", "CTX_GUARD_SOFT": "…", "CTX_GUARD_HARD": "…"}.
  1M window: thresholds 650000 and 700000 and "autoCompactWindow": 1000000 (auto-compaction is only a safety net at the wall).
  200k window: 140000 and 170000, don't set autoCompactWindow.
  A key that doesn't exist in my version of Claude Code — don't set it: say so and skip it.
- In the report, one line per key on why: effort high — one step higher is 2.5 times pricier with almost no quality gain; 3650 days — chat history won't disappear; subagent model — without it a subagent takes the master's expensive model.
- A desk = its own tab: the first phrase says which area it is, name the tab via /rename. Start with one or two desks, not all of them.
- Models: master (main session) — the top model, subagents — one step lower, mechanics and search — the cheapest.

### 4.2 Private GitHub — .gitignore before the first commit
1. Folder not in git — git init, branch main.
2. .gitignore first: .env, .env.*, *.key, *.pem, id_rsa*, id_ed25519*, *keypair*.json, wallet and seed phrase files, *.bak-*, node_modules/, .venv/, dist/, __pycache__/, large data and logs.
   Check: git check-ignore -v .env fires; git status shows not a single file from the secrets list of step 1.
3. Memory and rules live outside the folder — a copy of them goes into the repository. Script .claude/hooks/sync-copy.sh: auto-memory folder → .claude/memory-copy/, ~/.claude/CLAUDE.md and ~/.claude/agents/ → .claude/global-copy/. Copy ~/.claude/settings.json only if it has no tokens in it; otherwise a copy without the env block.
   No auto-memory — memory goes straight into the project's .claude/memory/ and a line @.claude/memory/MEMORY.md into CLAUDE.md.
4. First commit — after the self-check (step 5): sync-copy.sh, git add, then git diff --cached --name-only and compare against the secrets list. Found something — stop and tell me.
5. Private repository. gh installed and logged in: gh repo create ‹name› --private --source . --remote origin (without --push).
   No gh or git — explain to me step by step: install git (Mac: xcode-select --install, Windows: git-scm.com); on github.com New repository → Private → no README; send you the URL. You add the remote.
   The first git push -u origin main — only after my “yes”.
6. A “Versions and rollback” section in CLAUDE.md: after every finished task — sync-copy.sh and a one-line commit “what was done”; push — as in answer 9.
   Rollback: git log --oneline → git revert ‹commit› (safe, history stays) or a single file: git restore --source ‹commit› ‹file›.
   Explain it to me in words: “restored file X as it was in the commit from ‹date›”. git push --force and git reset --hard — only with my “yes”.

### 4.3 Project rules, desks and STATE
- The project's CLAUDE.md from the answers. Sections:
  who and what — the product in one line, the target number, the entry phrase;
  style — answer 6, direct and to the point, no pleasantries;
  boundaries — product development is my zone, the agent is executor, reviewer and debugger, don't invent a backlog unasked; plan first, then work, after “yes” — a finished result with no interim reports; “done” only after a check (if there's prod — on the live URL from outside, without cookies); the irreversible from answer 4 — only with “yes”; the off-limits from answer 8; don't swap my task for your own, related stuff — as a list at the end of the report; money and trading rules (limits, stops, pause) are enforced by code with a test, not by the agent's memory;
  check — a command for each project from answer 7, “done” only after it; no check — build it first, then the code;
  diagnostics — one hypothesis at a time, out loud; at most three checks, then a report on what you ruled out, and a question; don't deploy during diagnostics; fix what broke;
  always-on work — deadlines into the registry, not into text; memory holds only what can't be looked up again; STATE is short; a hard rule is a hook or a ban, not a line here;
  versions and rollback (4.2) · subagents (4.5) · context (4.6) · Compact instructions (4.6).
- A desk = a session for one area from answer 2. Build the first one now. Its STATE.md (target under 25 KB, limit 60 KB):
  # STATE ‹desk› — updated ‹YYYY-MM-DD HH:MM› UTC
  ## Live — what, when deployed, file and md5, where the backup is, how to roll back
  ## Open — the task, where we stopped, the next step as one action
  ## Waiting on me — as one list, with a recommendation; remove closed items so I'm not asked again
  ## Deadlines — not here, in the registry (4.8)
  History — in docs/history/STATE-‹year-month›.md: move it, don't delete.
- The desk's entry prompt for the phrase “‹desk›, let's continue”: what to read and in what order (CLAUDE.md, STATE, HANDOFF).
- HANDOFF.md in the root — a log between desks, line format “- ‹date UTC› ‹from› → ‹to›: ‹what›”. Messages between sessions in batches, one for several topics; whatever can wait goes into HANDOFF. A desk writes its report on what's done as a line in its own STATE, not as a message.

### 4.4 Memory and index
- In the memory folder MEMORY.md is the index: one line = one topic with a link to the file. Header:
  # Memory index. One line = one topic. Time in UTC.
  # Only the first ~25 KB / 200 lines load, the tail is invisible: keep under 23 KB and 180 lines.
  A section has grown — into a sub-index _index_‹topic›.md, one link stays in the index.
- Memory file:
  ---
  name: ‹type›_‹short›
  description: ‹one sentence on when this is needed: the agent sees only this in the index and decides from it whether to open the file›
  metadata:
    type: feedback | project | reference | user
  ---
  **Rule:** what to do, in one sentence.
  **Why:** the incident with a date. Without a reason, a month later the rule will be judged outdated.
  **How to apply:** a check that can be done by hand.
  (later) **‹date› — closed by code:** where it's enforced now and which test.
  Create one such file from my answers as an example.
- Into memory — only what can't be looked up again. Whatever lives in a database, a file or on a server — a pointer and a command, not a copy of the numbers.
- My “don't do that again” → a memory file and an index line right away. Broken a second time → a hook, test or ban.
- Weekly review: orphans (files with no link from the index), outdated stuff, duplicates, contradictions with CLAUDE.md. Don't silently rewrite a contradicting file: put a note at the top “> **Update ‹date›:** ‹what's wrong and what the fix is›”, the fix after my “yes”.

### 4.5 Subagents
- Agents in .claude/agents/. Model set explicitly in the header (without it an agent inherits the master's expensive model), turn cap maxTurns:
  executor — the subagent model; tools: Read, Grep, Glob, Bash, Edit, Write; maxTurns 150. Body:
    You are the executor. Your inputs are only the BRIEF.md file (and CONTRACT.md), path given in the task.
    1. Read the brief and the files it names; others only if you can't do without them, and say which.
    2. The minimal change that fully solves the task: what already exists in the project → standard library → new code. No abstractions “for the future”.
    3. Branching, money, parsers, security — at least one test or assert. Mark a deliberate simplification shortcut: ‹limitation›, ‹when to update›.
    4. Run the check from the brief. Answer in up to 15 lines: files and md5, the check command and its output, what's unchecked and the risk.
    Bans: ssh, scp, server restarts, edits outside the brief's paths, plus the bans from answers 6 and 8.
  skeptic — the subagent model; tools: Read, Grep, Glob, Bash, no Edit or Write (it can't “tweak a bit” and sweep a problem under the rug); maxTurns 80. Reads the brief and the diff, runs the check, gives a score 1–10, flags only blockers; “no blockers” is a normal answer; 7 or higher — OK to deploy.
  mechanic — the cheapest model; tests, md5, grep, copies; no decisions and no prod; maxTurns 60.
  explore — the cheapest model; tools: Read, Grep, Glob; file search; maxTurns 40.
- Templates in .claude/templates/:
  BRIEF.md: # ‹code› — ‹what to do in one line›; project root; contract — CONTRACT.md next to it; You edit ONLY: ‹files›; Don't touch: prod, server, Claude settings, secrets; Why (2–3 lines); What to read first (files and lines); What to do (numbered, every item checkable; tests for empty, zero, dependency failure; old tests green); Check: ‹command› → ‹what it prints›; Report up to 15 lines; don't deploy.
  CONTRACT.md: # ‹Feature› — contract between subtasks; source of the decision and a data check of the idea (a number or “never happened”); constants (one name everywhere); fields and schema (name, type, meaning, what if there's no data); calculation rules and edge cases; files and events (who writes, who reads); the master's post-review decisions with a date.
- Subagent rules in CLAUDE.md:
  the master (main session) does the breakdown, plan, report and deploy itself;
  no more than 3 agents at once, inside a workflow too — in chunks of 3:
    for (let i = 0; i < items.length; i += 3) out.push(...await parallel(items.slice(i, i + 3).map(x => () => agent(...))))
  don't message an agent inside a workflow; inputs go as a file before launch;
  small code up to ~150 lines the master writes itself, a subagent is for big code;
  skeptic — only for money and numbers for users, everything else — /code-review on the diff;
  the skeptic isn't a gate: show reversible things right away, irreversible ones wait for the verdict;
  one review round, a second only if the score is 6 or lower; review fixes — by the same executor if it waited less than an hour, otherwise a fresh one with the brief and the diff;
  search and mechanics — on the cheapest model; ssh and restarts are banned for subagents.

### 4.6 Context and /clear
- In CLAUDE.md:
  don't switch models mid-session — each model has its own cache, a switch = rereading the whole context at full price;
  limit ran out — wait for the reset, or /clear and a new session on a lower model;
  soft threshold — between steps prepare a continuation prompt in STATE; hard — finish the step and advise me to /clear; after /clear — the desk's entry phrase;
  read images in batches and once, large files and logs — in parts;
  quality isn't enough — first a check, then effort up one step, then a higher model.
- At the end of CLAUDE.md a “# Compact instructions” section: on compaction keep the changed files with md5, what's deployed and what isn't, open decisions, check commands; drop log output, intermediate hypotheses, contents of files read.
- The context counter itself is the context-guard hook in 4.7.

### 4.7 Hooks and harness check
Hooks in .claude/hooks/, you write them yourself, python3 and bash with no dependencies. Input for all of them is JSON on stdin: session_id, transcript_path, hook_event_name (Stop also has stop_hook_active). The hook's own error — exit 0, don't break the turn.
a) session-start.sh (SessionStart). Read-only. Prints up to 40 lines to stdout — this goes into the model's context:
   date in UTC; overdue items and the next 3 days from the deadline registry; the last 3 lines of HANDOFF.md; the “Waiting on me” block from STATE.md; how many files are uncommitted (git status --short | wc -l); one line of the harness check (“harness N of M” and the FAIL names); once a week — memory review candidates: files older than 21 days with no link from the index (week stamp — the file ~/.claude/.memory-review-stamp). Always exit 0.
b) context-guard.py (UserPromptSubmit and PostToolUse). Skips subagents: agent_id or agent_type is present, or the transcript name starts with agent-.
   Reads the tail of the transcript (~2 MB, JSONL), takes the last type=assistant line without isSidechain that has message.usage.
   Context = input_tokens + cache_read_input_tokens + cache_creation_input_tokens. Thresholds — env CTX_GUARD_SOFT and CTX_GUARD_HARD (4.1). Below soft — silent.
   Soft: to the model “context ~Nk, between steps prepare a continuation prompt in STATE, keep working”. Hard: “finish the step, the prompt must be ready, advise /clear”. It cleans nothing itself — I decide.
   Output — one JSON line: {"systemMessage": "‹line for me›", "hookSpecificOutput": {"hookEventName": "‹event›", "additionalContext": "‹text for the model›"}}.
   On PostToolUse — hard only, and no more often than once per 25000 tokens (CTX_GUARD_STEP; state — a temp file with session_id in its name). exit 0.
c) stop-verify.py (Stop). Skips subagents. If stop_hook_active — don't hold a second time, exit 0.
   Takes project files changed since the last stop (marker — a temp file with session_id; the first time — the last 15 minutes) and those mentioned in the tail of the transcript.
   Checks: .py — python3 -m py_compile; .js .mjs .cjs — node --check; .sh — bash -n; .json — parse. Skips node_modules, .venv, .git, dist, __pycache__. Timeout per file 20 s.
   Errors found — a list to stderr (file and the last line of the error, up to 8 of them) and exit 2: the turn won't close until it's fixed. Otherwise exit 0.
   Full project tests — not here, but before deploy, with the single command from the “check” section.
d) health.py — the harness check, deterministic, no network. One line per item: OK or FAIL with a reason; at the end “N of M”; the --line flag — only the summary line; FAIL — exit 1. Items:
   CLAUDE.md exists; memory index under 23 KB and 180 lines; every index link points to a file; memory files without a link — as a list; settings.json is valid JSON; every hook from settings exists and passes a syntax check; context-guard and stop-verify are connected; every agent has model and maxTurns, skeptic has no Edit or Write; STATE.md under 60 KB; deny contains bans on secrets; .gitignore covers .env and keys, git ls-files has no files from the secrets list; the deterministic cases of the mistake catalog (4.9) pass.
   Run it after any edit to rules, memory, settings, hooks or agents.
e) Wiring in the project's .claude/settings.json (backup, diff, “yes”; keep my keys):
   "hooks": SessionStart → bash "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh";
   UserPromptSubmit and PostToolUse (matcher "*") → python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/context-guard.py";
   Stop → python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/stop-verify.py", timeout 60.
   "permissions.deny": Read(~/.ssh/**), Read(./.env), Read(./**/.env*), key and wallet files from step 1.
   "permissions.ask": rm -rf, git push --force, git reset --hard, deploy commands, everything irreversible from answer 4 and every off-limits path from answer 8 — in the rule syntax of my Claude Code version.
   This is exactly “a hard rule is a hook or a ban”: the agent can't do anything on the deny list, even if asked; an ask waits for my manual “yes” every time.

### 4.8 Deadline registry
- .claude/hooks/followups.py, stdlib only, file .claude/followups.json:
  add YYYY-MM-DD "what" [--owner desk] [--ref file] → prints the id;
  due [--days 3] → overdue (“OVERDUE N d”), today and upcoming, with the owner in brackets;
  list → all open; done id → close with a date.
- A line in CLAUDE.md: “Deadlines go into the registry, not into text. Any future date (check, renew, key expires) — followups.py add; done — done ‹id›”.
- A line in session-start.sh: python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/followups.py" due --days 3 2>/dev/null || true

### 4.9 Mistake catalog
- .claude/evals/cases.json — an array of cases. One case:
  {"id": "‹desk›-‹what broke›", "department": "‹desk›", "source": "‹memory file with the rule›.md",
   "situation": "‹the task the way I phrase it›", "trap": "‹what went wrong, with the cost›",
   "expected": "‹what the agent should do instead›",
   "grader": {"type": "deterministic", "check": "‹a command that fails on a violation›"},
   "severity": "users | money | time | data"}
  If code can't catch it yet: "grader": {"type": "rubric", "check": ["‹question for the reviewer›?", "…"]}.
- Rule in CLAUDE.md: a new rule after a mistake = a new case right away, five lines of JSON. Over time turn question-based cases into commands.
- Now — one case from my answers (for example, about the irreversible from answer 4).

### 4.10 Server — plan only, install nothing
If answer 3 mentions a server — into the report and into the deadline registry for week 2–4:
- one deploy command: tests → lock “one deploy at a time” → a backup with as many copies as there are prod files, otherwise stop → upload under a temp name and syntax check → swap all files at once → restart → smoke test → outside check over https without cookies → a line in STATE (time, files, md5, backup path); failure after the swap — rollback from the backup with one command;
- one sender for service notifications: a log as JSON lines, a repeat pause per key of one day, a “handled” mark; the alert text names what broke, the cause and whose zone it is; new watchdogs start quiet;
- an on-call agent — only once there's an event log: an hourly timer; nothing new — no model call; something new — the cheapest model in single-command mode (claude -p) with a cap on turns and spend, read-only access to logs and statuses, permissions as separate --allowedTools arguments; it fixes nothing, writes the owner one line.

### 4.11 Deadlines
Every deadline I've mentioned — into the registry. Plus one in 7 days: “a week with the setup: review of rules and memory”.

## Step 5. Self-check (show me the output)
- Every hook with test input:
  echo '{"session_id":"t","transcript_path":"/none","hook_event_name":"Stop"}' | python3 .claude/hooks/stop-verify.py; echo $?
  stop-verify: a deliberately broken temp .py → exit 2, then delete it.
  context-guard: a temp transcript with usage above the hard threshold → JSON with both fields; below soft → silence.
  session-start: run → up to 40 lines, exit 0.
  followups: add, due, done on a test entry, then remove it.
- python3 .claude/hooks/health.py — the full output. Goal — no FAIL; if one remains — what it is and how to close it.
- git: git check-ignore -v .env fires; git status is clean after the commit; git log -1 shows the first commit.
- Tell me to restart Claude Code so the hooks get picked up.

## Step 6. Commit and report
- First commit per 4.2. Push — only after my “yes”.
- What was created and what changed: the path and one line on what's inside. Where the settings backups are.
- Rollback: which files to delete, which settings.json backup to restore, which diffs to revert; the commit to go back to.
- The first desk's entry phrase and the ‹answer› placeholders that stayed empty.
- A 7-day tuning plan:
  day 1 — one check command per project in CLAUDE.md;
  days 2–3 — every “don't do that again” from me goes straight into a memory file, an index line and a catalog case;
  days 4–5 — a second desk with its own STATE and entry phrase; the first big task — to a subagent, brief as a file;
  day 7 — health.py, a review of memory and rules (orphans, outdated, duplicates, contradictions), a check that everything is committed and pushed.
  Every mistake becomes a rule, a repeated one — a hook, test or ban.

What gets installed

WorkplaceVS Code and Claude Code settings: language, subagent model, chat history kept for years. Backup before editing.start
Private GitHubEvery task is saved as a version. Something broke — rollback in a minute. Keys and wallets won't get into the repository.start
Rules and the first deskA rules file from your answers, the first desk's progress file and the phrase it resumes work from.desks
MemoryA memory index sized to the load limit and a first memory file as a template.memory
Four subagentsExecutor, skeptic, mechanic and search. Each has its own model and step cap.subagents
Context counterTells you itself when it's time to prepare a continuation prompt and do /clear.context
Hooks and checksA startup summary, a code check before “done”, a ban on reading keys, a check of the whole setup with one command.hooks
Deadlines and mistakesA deadline registry instead of dates in text, and a mistake catalog that every agent mistake goes into.mistakes

The server and the on-call agent aren't installed right away: they depend on your infrastructure. If you have a server, the agent will write a plan for week 2–4. How it works for me — in the “Server” section.

What the agent will ask

It writes the rules for you from your answers. The more specific the answer, the less tuning later.

  1. What you're building and how you make moneyand the main goal, ideally as one number
  2. Which areasthey'll become the desks
  3. Stack and serveris there a server and how you deploy
  4. What's irreversiblemoney, wallets, broadcasts, data deletion: here the agent always asks
  5. Subscription and modelswhich is the main one, which are subagents, context window 200k or 1M
  6. Language and toneanswer style, banned words and letters
  7. How to check the projecta test command, or it has to be built first
  8. What's off-limitsfolders, services, other people's projects
  9. GitHubdo you have an account, what to name the repository, save on its own or on your word

The first week

The prompt gives you a skeleton. The setup becomes yours within a week: every agent mistake turns into a rule.

  1. Day 1. CheckOne command that checks the whole project. Without it “done” means nothing.
  2. Days 2–3. MemoryYou said “don't do that again” — the agent writes down the rule right away.
  3. Days 4–5. Second deskA second tab for another area. The first big task goes to a subagent.
  4. Day 7. ReviewPaste the short prompt below: the agent finds what's outdated and suggests what to make a hard rule.
prompt for day seven
A week with the setup has passed, let's fine-tune it.
1. Run the harness check (health.py) and show the red items.
2. Reread CLAUDE.md, the memory index and STATE: what's outdated, what's duplicated, what contradicts each other; memory files with no link from the index.
3. Find the lines in the rules with the words “always” and “never” and suggest which to turn into a hook or a ban.
4. Based on this week's mistakes, suggest cases for the mistake catalog.
5. Check git: is everything committed, is a copy of memory and rules in the repository, has a secret slipped in.
Show everything as a list with diffs and change nothing until my “yes”.

What to take. Answer the agent's questions in detail. After a week compare your CLAUDE.md with the first version: if it has barely changed, the agent is working by the guide's generic rules, not yours.