Cover image generated with OpenAI gpt-image and carrying C2PA content credentials. Provenance in assets/PROVENANCE.md.
One command that gives an agent behaviour which survives the end of the chat,
and says plainly which parts of it are enforced and which are only loaded.
The idea
An agent is not short of memory. Claude Code persists instructions five ways:
CLAUDE.md at four scopes, .claude/rules/, skills, hooks, and auto memory the
agent writes for itself. What it is short of is enforcement.
Loading an instruction is deterministic. Following it is not. The documentation
is blunt about which is which: CLAUDE.md and rules are advisory, while hooks
"are deterministic and guarantee the action happens".
So a habit is two things, and most rule sets ship only the first.
Placement decides loading. A rule is in context when its trigger fires, or it may as well not exist, and the file it lives in is the only thing that decides. Tested, both directions.
Only a gate decides adherence. Everything short of a hook is a hint. This skill says that out loud rather than letting "durable rule" imply "reliable rule", and it escalates a habit that must not fail.
Budget over accumulation. The one adherence finding in the official docs is that bloated instruction files cause Claude to ignore your instructions. Twelve at system scope, ten per project, six per path file. At the cap, adding means retiring.
Three tiers
| Tier | Mechanism | Guarantee |
|---|
| Stated | a rules file that loads when the trigger fires | none, it is a hint |
| Gated | a hook that executes regardless of what the agent decides | deterministic |
| Judged | a read-only verifier scoring adherence from evidence | after the fact, and weaker than it sounds |
Most rule sets ship the first tier and imply the second. This one says which
tier a habit is in, in the card itself.
What the first tier actually buys. On Anthropic's Impossible Tasks
evaluation, an explicit forceful written instruction moved the failure rate from
55% to 35% for one model and 50% to 23% for the next. A written rule roughly
halves the failure and leaves a quarter to a third standing. That is the ceiling
this package works under, and it is why the other two tiers exist.
Quickstart
git clone https://github.com/AgriciDaniel/agentic-habits.git
cd agentic-habits
./install.sh # skill + judge agent
./install.sh --with-gate # also stage the Stop gate and print how to enable it
Then, in Claude Code:
/habits setup
Requirements: Claude Code (tested on 2.1.251), bash, and jq if you want
the gate. Linux and macOS; both are in CI. The installer never writes a habit
and never edits settings.json without --apply. ./uninstall.sh removes the
machinery and deliberately leaves your habits and cases alone.
It reads your existing CLAUDE.md files first and proposes only what is not
already covered, because a second copy of an existing rule is not free. It shows
you the exact file before writing anything.
What a habit looks like
Two lines in a file that loads every session.
### SYS-03 · Verify with the real thing
**When** I am about to say something works.
**Do** Run the closest real check and show its actual output.
<!-- habit: id=SYS-03 added=2026-08-29 source=starter/core status=active
check="the message claiming success contains real output from a real run" -->
Not "be rigorous". A moment, an action, and something you could check in the
transcript. The format is borrowed from implementation intentions, the finding
that "when X happens, I will do Y" gets acted on where a stated goal does not.
The bookkeeping rides in an HTML comment, which is stripped before the file
reaches the agent's context. Tested with a control on Claude Code 2.1.251, in
verification.md. Treat it as
version-specific: if bookkeeping ever starts showing up in the agent's
reasoning, that test is the one to rerun.
Where a habit goes