What's the most useful rule in your system prompt or AGENTS.md?
Paste the actual text of the rule and explain what it fixed!
One thoughtful comment unlocks the ability to create threads.
17 comments
I use the following along with a global bun config that will not install packages newer than 5 days old.
Instruction text:
Use Bun for everything. Never use npm, npx, yarn, pnpm, or
nodedirectly unless I explicitly tell you to in the current session. This applies to installing packages, running scripts, executing one-off tools, running files, testing, and bundling.| Instead of... | Use... | |----------------------|--------------------| |
npm install|bun install| |npm install <pkg>|bun add <pkg>| |npm run <script>|bun run <script>| |npx <tool>|bunx <tool>| |node <file>|bun <file>| |jest/vitest|bun test| |webpack/esbuild|bun build|Read
.envautomatically via Bun — do not adddotenv.Prefer Bun's built-ins over third-party packages where they exist:
Bun.serve()(not express),bun:sqlite(not better-sqlite3),Bun.$(not execa), built-inWebSocket(not ws),Bun.fileovernode:fsread/write helpers.If a task seems to require npm/node specifically, stop and ask rather than silently switching package managers.
Name the rung of evidence. Never round up.
You said so. (worthless)
You cited file:line.
You walked the failure path.
You ran real code that fails loudly if the claim is false. (first rung that counts as verified)
You reproduced it in the running system.
Below rung 4, say "unproven" out loud. A shape check (length, prefix, format) can only lower confidence. It can never declare something broken.
What it fixed .... agents kept saying "verified" and "it works" when they had only read the code. One session declared a working API key malformed because it was 53 characters and started with AQ. instead of the old 39-character AIza format. It wrote off the whole integration as down. Now every status claim carries its rung, and "are you sure?" mostly stopped being necessary.
super basic one but also the most used by my sessions on a daily basis is the 'capture learnings' rule I have in my global .md file. Executes on a project specific level after any correction it has to update a lessons.md with the pattern (create the file if it doesn't exist yet). Correspondingly at the start of any new session, it must review the lessons.md file if it exists. Saved having to repeat myself about some intentional design decisions that it often made incorrectly or that were not aligned with my design vision for the project
The most useful rule in mine:
“Removing private memory may make an executor slower. It must never make an executor wrong. If a decision cannot be made correctly without a memory entry, that entry carries operative knowledge and is in the wrong place.”
It fixed a subtle failure mode: an agent would learn something important, retain it privately, and appear smarter in the next session // while the rest of the system could not inspect, review or reproduce the basis for its decision.
Now anything required for correctness must have a visible owner: the repo, AGENTS.md, project documentation or an explicit state carrier. Private memory can preserve convenience, calibration and pointers that prevent re-solving the same problem // never hidden project truth.
Agent memory is the silent killer. The only thing worse than no context is context that is silently wrong.
For my serious stuff, this is what I use. I call it Gauntlet. Otherwise I prompt what I want, make it "remember".
Put a change through independent reviewers until it survives, all on one model. Other setups get independence from three different models. Here it comes from three rules, so keep all of them:
Fresh eyes. Each reviewer is a new subagent. It gets the user's request and the diff, never your reasoning or your summary of the change.
Different jobs. Four questions, split between the reviewers, so they do not all look at the change the same way.
Prove it. A finding counts only with a place, a failing case and evidence, and you act on it only after checking it yourself.
You are the author: you own the fixes and the scope. Reviews grow diffs. Keep this one the size the request needs.
When the user wants a review without fixes, or the change is someone else's and they did not ask you to fix it, follow "Review only" at the end.
## 1. Prepare
Working tree. Reviewers read the working tree, so the change must be checked out there. If it is not (someone else's PR, another branch) and your tree is clean, run
gh pr checkout <n>orgit switch <branch>, and switch back when you finish. If your tree is not clean, use a separate worktree (git worktree add), remove it when you finish, and say which checks could not run there.Scope. The whole branch or PR against its base. If the user asked to review only recent work, it starts at the point they name.
Base. Pin it once. PR:
git fetch origin,gh pr view <n> --json baseRefName, thengit merge-base HEAD origin/<baseRefName>. Another branch:git merge-base HEAD <default branch>, usingorigin/<default branch>after a fetch when there is a remote. On the default branch itself, or when only uncommitted work is under review:HEAD.Clean inputs. Fix what you already know is wrong and run the checks the repo's CI runs. Run
git status --short. Never stash, discard or pull in unrelated edits. If the change does not separate cleanly from them, stop and ask.Ask. The user's requests behind the whole change, in their words. For a PR, add its title, description and linked issue.
Out of scope. Only what the user ruled out, in their words. Otherwise write
none stated. Never use it to fence off code you are unsure about.Checks. The commands you ran and their results.
Ledger. A scratch file outside the repo, one row per finding:
id | round | severity | file:line | claim | outcome. Say its path in your next message so a resumed session can find it.
## 2. Seat the panel
The four questions never change. The size of the change decides how many reviewers share them.
| Question | Name | |---|---| | B: When does the changed code do the wrong thing? | Breaker | | A: How would someone hostile use this? | Attacker | | T: What else did this change break? | Tracer | | S: Is it proven, and is it only what was asked? | Skeptic |
| Size | When | Reviewers | |---|---|---| | Quick | the user says "quick", or about 50 changed lines or fewer in one area with no trust boundary | 1: B and T | | Standard | everything else | 2: one takes B, and A too if the change touches a trust boundary or dependencies; the other takes T and S | | Full | the user says "full", or about 400 changed lines or more | 4: one question each |
Trust boundary: input parsing, auth, sessions, permissions, secrets, crypto, file paths, shell or subprocess, network requests, queries, deserialization, IPC. Dependencies: manifests, lockfiles, CI, build scripts.
Each reviewer is a full agent run. Do not seat more than the size calls for.
Reviewers run on your own model. If the user's instructions name a model or effort for a reviewer, use it (in Aris Code or T3 Code, through
delegate_task). If it is unavailable, say so. Never substitute.
## 3. Round 1
Take a snapshot: inside the repo, run
bash scripts/snapshotfrom this skill's directory (use its absolute path). It prints a tree id for the working tree as it is now, untracked files included, and changes nothing. The change under review isgit diff <base> <snapshot>.Start every reviewer in one message and wait for all of them. Each is a new subagent on your harness's native subagent tool (
Agentin Claude Code and Aris Code,spawn_agentin Codex), never a fork of this conversation. Build each brief from BRIEFS.md, from the parts it lists for that role. Add nothing else.Do not edit the checkout while a reviewer or the Judge runs. A timeout, an error or an empty reply is not approval: start that reviewer again, once. If it fails twice, go on without it, and the run cannot pass.
When they have all replied, run the snapshot again. Its id must match this round's. If it does not,
git diff <snapshot> <new id>shows what a reviewer left behind: undo exactly that.## 4. Triage
Put every finding in the ledger before you change anything. The same defect from two reviewers is one row with both ids. An "Outside my questions" line is a lead: check it yourself, and if it holds, give it a row like any finding. Then give each row one outcome:
Unproven: a required part is missing: the place, the failing case or the evidence. It does not count. If all three are there and you think the evidence is wrong, that is a dispute.
Fix: you read the code, ran the failing case, and it is real. Make the smallest fix. Prefer deleting or narrowing over a new option, helper or guard. Add one focused test only if it fails without the fix.
Cut: the diff carries behavior the ask did not need. Remove it.
Decline: the reviewer called it a nit and you agree. One line why. List it as a follow-up.
Dispute: you think a blocker or should is wrong, you cannot reproduce it, or you would call it a nit. Write your evidence (file:line, command output). You may not drop or downgrade it yourself, and do not agree just to end the loop.
Run failing cases against local code and local fakes only, never a live service, a real database or a real account.
Severity, the same for you, the reviewers and the Judge:
blocker: what was asked for does not work, or the change opens a security hole or can lose data.
should: another real bug this change causes, in its own code or in code that depends on it, that users or callers will hit. Also asked-for behavior that no check would catch if it broke, and added behavior the ask did not need.
nit: everything else. Problems that were already there, cases that will not come up in practice, style, small costs.
Send all disputes of the round to one Judge, a new subagent with the Judge brief, before you fix anything. Its ruling is final for this run: STANDS, fix it; NIT, decline it; FALLS, drop it.
Then fix, run the checks again, and take a new snapshot. Compare
git diff --shortstat <base> <snapshot>with the round before. If review grew the diff past what the fixes need, cut first.## 5. Later rounds
A round is clean when no blocker or should from it survives triage. Run another round if the last one was not clean, or if you changed behavior after it. Comment, doc and format-only edits need no round.
Each reviewer with a finding you fixed or cut runs again, as a new subagent with the same questions and the re-check brief: the ledger rows for its questions, the declined list, and
git diff <previous snapshot> <new snapshot>.A reviewer with nothing to re-check runs again only if your fixes touched its questions.
Budget: 3 rounds. Up to 5 only while a blocker is still open, or when the user asks.
## 6. Stop
Passed: the latest round was clean, you have not changed behavior since, and no reviewer is missing. A spent budget is not a pass: show each open item with both sides in two or three lines, and leave the decision to the user.
Do not push during the loop. Afterward, push only if the user asked you to.
## 7. Record
Score each reviewer for each round from its findings that survived triage in that round. A finding two reviewers raised counts for both. Use the lowest row that applies, and nothing else: two or more blockers 2, one blocker 4, two or more shoulds 6, one should 7, nits only 9, nothing 10. Never invent or adjust a score.
Put this table in your final reply. If the user asked you to file or update a PR with this work, also put it in the PR description, above the closing attribution line. Edit the description. Never post it as a comment.
## Gauntlet review One model (<model>), standard, 2 rounds. | Reviewer | Round 1 | Round 2 | | --- | --- | --- | | Breaker + Attacker | 4/10 | 10/10 | | Tracer + Skeptic | 7/10 | not re-run |Report in plain words: what each real finding would have done to a user, what you changed, what you cut or declined and why, the Judge's rulings, anything still open, the diff size before and after, and how many reviewer and Judge runs it took.
## Review only
One round, no code changes, and no pass or fail.
Step 1: change nothing. For someone else's PR, the Ask is its title, description and linked issue, and the Checks are CI's results (
gh pr checks <n>) plus anything you ran.Step 4: a real finding's outcome is
confirmed. Disputes still go to the Judge, and STANDS means confirmed.Skip steps 5 and 6. Record as in step 7, with one round, and report each confirmed finding with its place, failing case and suggested fix.
Judge simplicity by the system left behind: how easy it is to understand, operate, and change. Lines of code and diff size are not the measure. Climb this ladder and stop at the first rung that fully meets the need:
Remove the need. For each skill, script, workflow, or document in scope, ask whether you would add it today for the current need. If not, retire the whole thing instead of trimming it. Keep a part that only it provides when a current consumer needs that part and no installed tool already covers the need. Unused text and machinery are not free: every reader and agent that loads them pays for them.
Use what already exists and works well: the codebase's established pattern, the standard library, the native platform, or an installed dependency. Don't extend a mechanism that carries tech debt. Agents copy what they find, so extending it spreads the debt.
Build the clearest design that fully meets the need, replacing the debt-carrying mechanism when that is the cause. More code is fine when it removes duplication, special cases, recurring manual work, or a pattern the next agent would copy. Size and effort only break ties between comparably good designs.
Fix the underlying cause within the agreed scope, including affected callers or dependents when necessary. Name the concrete benefit that justifies wider work and verify it. Keep the work bounded by the current goal and explicit constraints; speculative future needs do not justify extra machinery.
"Do not break encapsulation: this system needs to be maintainable and subsystems need to communicate with each other through well-defined interfaces without cheating."
The most serious leak I see in LLM code is a willingness to break encapsulation. As far as I can tell it's the single biggest barrier to building maintainable, scalable systems with AI. I remind them about this whenever I kick off a code review, and I also run checks aiming to discover failures of encapsulation and failures to respect abstraction barriers.
(By the way, humans are just as bad, and much harder to nudge toward correct behavior, in this respect.)
Did you promt fixed the problem?
I agree with the problem, but I had no luck with prompts personally.
The best option that somewhat works for me is hexagonal architecture on the codebase level. It hints agent to adapt the style and forces it to strucute the code into small packages with ports (interfaces) and adapters (implementations).
I also have agents.md with rules how to work, but I think the existing code structure helps the most by making it harder to improt stuff randomly (because it requires package registration, interface rewrite, possibly other adapters rewrites, etc).
Something along the lines of, "If I ask you to do something in a particular way, and you think there's a simpler/quicker/better/more efficient way to do it - tell me, rather than just doing it the way I asked. There may be a reason that I wanted it done in a specific way, but I may just not be aware of the other method. So give me your suggested method, along with reasoning for why you think it's better than my idea, and I'll decide which way to proceed.
I've worked a lot on improving the way Claude answer to me, using a/b tests and reading tests to measure the retention. After this I was still getting the brain fried and I noticed that by removing the reading bottleneck I started to hit a different one: a lot of more turns with decisions. Now I could read more and I had to decide faster. Then I measured what most of my turns were: answering follow up questions of Claude, but most of them were very simple: should I merge this? Should I commit the changes? Etc. Even with auto mode.
So i came with this system prompt:
This reduced the amount of turns with menial decisions and responses from 64% to 21%.
Who else is measuring how many decisions is your agent asking of you per day?