skillhawk

Why does my agent forget rules after compaction?

When a long session is compacted (summarised to free context), details can be lost, and users have reported that instructions from CLAUDE.md stop being followed afterwards. Instruction files are advice the model reads, not rules that are enforced, so the reliable fixes are shorter instruction files, the critical rules stated early and plainly, and deterministic hooks for anything that must never be skipped.

What helps

A worked example

A way to find the rules that do not stick, using your own session history. review --chats reads your agent sessions locally and proposes changes; nothing changes without your approval. Output from the landing page:

$ skillhawk review --chats
[af240c47] no skill covers this  4 corrections (repeated)  pending

The Skillhawk command that helps

What Skillhawk can do about it today:

npx skillhawk review --chats        # repeated corrections in your own sessions -> proposed skill edits
npx skillhawk review <dir>          # bloat, contradictions and vague wording in instruction files
npx skillhawk tokens --days 7       # where the tokens go, per session

Skillhawk does not detect which rules a compaction dropped, and does not write re-injection hooks. A compaction survival check is an idea we have not built.

Questions

Does Claude Code forget CLAUDE.md after /compact?

Users have reported exactly that in a Claude Code issue. Treat it as a risk: keep the file short, restate critical rules, and enforce hard requirements with hooks or CI.

How do I make an agent follow a rule every time?

Do not rely on instructions alone. Put the check in a hook or CI so it runs regardless of what the model remembers.

Sources

Skillhawk is a tool in this space, so weigh our framing accordingly. Last updated 2026-11-17.

Related

Try skillhawk review