On a project that runs for several days with Claude Code, the tiring part is often not the code. It is starting every new conversation by explaining things again: where we stopped, why that parameter is set the way it is, which approach we already tried and dropped. Skip the explanation and it proposes the rejected idea again; give it in full and half the time goes to retelling.
Claude Code’s built-in /resume takes you back to an earlier conversation, but it brings the whole history back with it. The longer that conversation was, the slower and more expensive every step after it becomes.
So I built agent-system: one set of rules that every session reads, plus four commands, /adopt, /pickup, /wrap and /private. The first post and the second covered its first two versions. This one is about where it is now: much smaller than in the second post, and open source.
The core idea: the handoff lives in a file
When people hand work over, they leave a handoff note; nobody copies the previous person’s whole memory. agent-system does the same. At the top of every project’s docs/project-notes.md there is a handoff block of at most 15 lines, for example (illustrative):
## Handoff
Updated: 2026-10-08 13:55
- Task: none; last unit of work: error messages on the login page
- Stopped at: front end done, API error codes not aligned yet
- Decisions: D-12, D-13
- Waiting on user: error text in Chinese or English
- Next: 1. align the error codes 2. add two tests
- Don't repeat: do not touch the auth middleware again (D-12)
When I finish a stretch of work I type /wrap and it writes the progress into that block. Next time, if I want to continue, I type /pickup and it reads out the block, the to-do list and the decisions the block cites. The block is rewritten as a whole each time instead of growing, so it only ever answers “where are we now”. It stays short; reading it costs about a thousand characters. History lives in git and in the decision log.
The four commands split the work like this:
| Command | What it does |
|---|---|
/adopt |
Brings a project in: creates the record files, or moves existing notes into them |
/pickup |
Reads out where the last session stopped and what comes next; read-only |
/wrap |
Wraps up: adds this session’s decisions and pitfalls, rewrites the handoff block |
/private |
Before a commit, checks changed files for real hosts, accounts and tokens written by mistake |
They run only when I type them; none of them starts on its own.
The rules (RULE.md) are linked as ~/.claude/CLAUDE.md, so every session loads them; Codex reads the same file. They cover only things that do not depend on a particular project: which decisions to record and how, the fact that pushing or deleting always needs my go-ahead, and what counts as “verified”. Each project’s own rules, such as how to run its tests or what must not be touched, go in that project’s AGENTS.md.
Four files, one kind of record each
Besides the handoff block, every adopted project has three more files:
| File | What it records |
|---|---|
docs/decisions.md |
Decisions, numbered D-n: the background, the options considered, the choice, and why |
docs/pitfalls.md |
Pitfalls, numbered 坑 n: what happened, why, how it was fixed, what to watch for |
private-notes.md |
Real hosts, usernames and accounts; kept out of git |
The one I care about most is decisions. When I come across an odd piece of code weeks later, what I want to know is not what it does but why we did not do something simpler. The code and the commit history answer the first question; only a decision written down at the time answers the second. So the rules say to record a decision as soon as it is made, not at the end.
The files point to each other by number: the handoff block says “see D-12” instead of repeating the reason. I checked two of my own projects, and less than 1% of the text in these files appears word for word in another. They are not read into the conversation as a whole either; only when a change touches the relevant part is that one entry read, by its number.
Nothing is read at the start
The first version used a hook to push the project state into every new session. Within days it felt wrong: I might open a conversation just to ask something unrelated, and it would first read a whole page of project notes. Whatever is read stays in the conversation, and every later request sends it again.
Now nothing is read at the start. I just say what I want; if I want to continue the last session, I type /pickup. Whether a project counts as adopted also comes down to one thing: whether it has docs/project-notes.md. In folders without it, /pickup and /wrap still work but only report in the conversation and create no files, so they never leave anything behind in someone else’s repository.
The token bill
I wanted numbers behind “it saves tokens”, so I went through the session logs of one of my projects. Claude Code records the usage of every request locally, so this can be worked out in detail.
The model does not remember earlier turns; every request sends the whole conversation again. With prompt caching the resent part is cheap but not free, and the cache lasts only five minutes. That is where the difference comes from:
A new session starts with about 62k tokens of Claude Code’s own system prompt and tool definitions, and /pickup adds 3k to 8k. The long conversation had reached 381k when it ended. At Opus 5.5 API list prices:
| Back into the 381k conversation | New session, then /pickup |
|
|---|---|---|
| First request | the whole history written to the cache, about $1.9 | about $0.31 |
| Each request after that | about $0.076 | about $0.013 |
| Each return after more than 5 minutes away | rewritten again, about $1.9 | about $0.33 |
The last row surprised me most. In my longest sessions, stepping away for a while and having the whole history rewritten into the cache on return made up 35% to 45% of the total cost. Since then I have a habit: if the conversation is already long and I am about to leave for a bit, I run /wrap first. On the other hand, if the last conversation was short, the two paths cost about the same and /resume is fine.
/wrap has a bill of its own. It runs at the end of a session, when the context is largest, and every extra round of tool calls sends the whole conversation again. One wrap-up once took 17 rounds: read a file, edit it, read the next, check, go back, read again, edit again. That one wrap-up cost $3.42. I have since folded its steps into at most five rounds: read everything at once, make every edit at once, run every check at once, then report.
Privacy: three checkpoints
This repository is public now, and some of the projects that use it are too, so keeping real details out of commits is a hard requirement. There are three checkpoints:
- The rules say real hosts, usernames and accounts go only in
private-notes.md, which is kept out of git; committed files use placeholders such as<host>and<user>, and keys and tokens are never written into any file. - Before committing I type
/private. It checks the changed files against the real values inprivate-notes.mdand against common formats for tokens, private IPs and home directory paths. It reports only which file, which line and what kind of value, never the value itself, and replaces nothing until I agree. - On every commit, the pre-commit hook checks again and blocks anything it catches.
Before making the repository public, I ran the same checks over all 45 commits in its history: every author email is a GitHub noreply address, and no paths or tokens are left.
Cutting back: the gate was in the wrong place
The second version went modular. Code, design and research projects each had a profile defining their own file structure and rules, and a project counted as adopted only after it picked one. Around that came a project skeleton, container numbering, a command to create new projects, and later a command to help people write their own profiles.
Halfway through I noticed something off. So that a research project could use handoffs and decision records, I made a profile called general. It had no domain rules at all; its only purpose was to switch the handoff on. When a module exists only to open a gate, the gate is in the wrong place. What every project needs is just the handoff, decisions, pitfalls and privacy; rules specific to one kind of project belong in that project’s own AGENTS.md.
So this version deletes profiles, the skeleton, container numbering and the convention for a materials folder, and the repository lost over a thousand lines. Every trade-off along the way, including the ones later reversed, is recorded in its decisions.md, 67 entries so far. Looking back, every addition made sense at the time; seeing which ones should not have been made took longer.
What is still not good enough
The biggest limit is that these commands are instructions for a model, not programs. How well /pickup and /wrap do their job depends on how carefully the model follows them. The 90 automated tests in the repository cover only the install, release and pre-commit scripts, not the commands themselves.
One concrete example: the rules say to check for the replacement character U+FFFD after editing Chinese text, because the model occasionally writes a character as garbage and the editing tool does not complain. That rule has caught it several times, but only because the check actually ran each time. Writing a rule down is easy; making sure it is followed every time takes checks and habits.
A few more things to know up front:
- The rules and command instructions are written in Chinese (Simplified). The agent replies in whatever language you use, but reading or changing the rules yourself means reading Chinese.
- Tested only on macOS. The scripts are written for bash 3.2 and should run on Linux, but I have not verified it.
- You have to remember to type
/wrap. Skip it, and the next session can only pick up from the last wrap-up. - In one project, only one session at a time should write the handoff block and the decision log, or they overwrite each other.
- Every session carries the rules, a fixed overhead of roughly two to three thousand tokens.
Install
You need Claude Code and git; Codex is optional:
git clone https://github.com/rigelmansid/agent-system.git ~/agent-system
~/agent-system/bin/install
It has to live in ~/agent-system, because the paths in the rules point there. The install script only creates symlinks; if you already have a ~/.claude/CLAUDE.md, it leaves it alone and shows SKIP. Then open a new session in a project and type /adopt. To update later, type /update.
The project is open source under the MIT license: agent-system. The rules are a single file and each command is a few dozen lines, so read them directly and adapt them to your own habits. For me, the most practical value is this: a minute spent leaving a handoff note at the end saves ten minutes of trying to remember where I was next time.