English · Polski
kaganiec

Your rules come back before the assistant forgets them.
("Kaganiec" is Polish for a muzzle - the thing that keeps a dog from biting, not from
running.)
What it is for
The longer you work with an AI assistant (Claude Code), the more it drifts from your
rules. Early in a conversation it remembers to answer briefly, not to make things up and
to ask before sending anything - after an hour it starts losing that. The longer the
conversation, the worse it gets.
kaganiec fixes it simply: it re-injects your rules as the context fills up, and it
does the same for the helpers the assistant spawns. The rules stay in front of the model,
so it keeps to them.
The name is deliberate. A muzzle is not a straitjacket - it does not limit what the
assistant can do. It only keeps it to the rules you set yourself.
What it does
- Repeats the rules in rhythm with the conversation. Always at the start, then more
and more often as the context fills up, because that is where instructions dissolve
fastest. A short conversation: a few reminders. A long one: a dozen or so.
- Takes care of the helpers. When the assistant spawns smaller agents for separate
tasks, they get your rules too (normally they would never see them).
- Does not let the list grow. If the rules file gets too long, the guard blocks the
write and suggests what to cut.
How it works - in plain words
kaganiec is a plugin for Claude Code. Once installed it attaches to three moments of
the assistant's work and does one simple thing each time. Nothing runs in the background,
nothing goes to the internet - it all happens on your machine, while the assistant is
working anyway.
1. Every time you write a message -> kaganiec asks the rhythm engine whether a
context-fill threshold was crossed. If it was, it appends rules.md to your prompt before
it reaches the model. You see nothing and do nothing - the assistant simply has your rules
in front of it. That is the heart of the plugin.
2. When the assistant spawns a helper (a smaller agent for a separate task - "search
these files") -> kaganiec prepends your rules to its prompt too. Without that the helper
would work blind to your rules. Exception: forks, which inherit the full context anyway,
are skipped so nothing is duplicated.
3. When somebody tries to save rules.md (you or the assistant) -> kaganiec checks the
length. If it grew too much (over ~1000 tokens) it blocks the write and shows the
standard for writing rules. Why guard the length? Because every reminder stays in the
context for good - the longer the file, the more it costs. Details: COST.md.
All three mechanisms are fail-open: if anything goes wrong, the plugin quietly steps
aside and never blocks your work.
Installation
You need Claude Code and Python (usually already there on Windows and macOS; check
with python3 --version).
Simplest - two commands in the terminal
claude plugin marketplace add studiogo/kaganiec
claude plugin install kaganiec@kaganiec
Then open Claude Code and run the wizard:
/setup-kaganiec
Or inside Claude Code (through the plugin menu)
/plugin marketplace add studiogo/kaganiec
/plugin install kaganiec@kaganiec
/setup-kaganiec
What exactly happens during installation
marketplace add studiogo/kaganiec - tells Claude Code where to get the plugin
(this repository). The command itself runs nothing - it only adds an address to the list
of sources.
plugin install kaganiec@kaganiec - downloads the plugin and enables it. From then
on the three hooks (see "How it works") are active. Installation does not touch your
settings.json - the hooks register through the plugin's own file
(hooks/hooks.json), so nothing in your configuration is overwritten.
/setup-kaganiec - the wizard that creates your rules file. It does not
overwrite an existing one. If there is none, it asks how you want to start and saves
rules.md in ~/.claude/kaganiec/.
What is not installed: no background services, no autostart, no network calls. Four
Python scripts and one file with your rules - that is it.