My AI assistant kept forgetting why. So I wrote it a constitution.
An AI assistant with real access to a machine is astonishingly capable. It can read the code, run the tools, fix the thing, and write it up. Then the session ends, and the next one starts with no memory of any of it.
That gap costs more than it looks like it should. The assistant does not just forget what was done. It forgets why. So it re-derives things it already worked out. It re-opens decisions that were settled weeks ago. And worst of all, when it finds something odd, it invents a plausible reason for it, and the plausible reason is wrong, because the real one was decided for a better reason that nobody wrote down.
I ran into this over and over while building a lot of projects with an AI assistant as my working partner. KSS, the Knowledge Stewardship System, is what I built to stop it. It is now public: github.com/csonkarolliepollie/KSS.
What KSS is
KSS is a written system, not a service. It is a set of documents with fixed jobs, a few rules about who may write what, and a handful of small Python tools that fail loudly when the documents stop matching reality.
It splits knowledge into three layers:
| Layer | Answers | Who writes it |
|---|---|---|
| Doctrine | What a thing is, and the rules | The assistant proposes, the owner promotes |
| State | Where a project stands right now | The assistant may append directly |
| Handoff | Context passed between sessions | Never canon |
The one line that settles most arguments: state is substrate, doctrine is governance. A document that says what a component is should never grow a “Next steps” list. The moment it does, it has turned into state, and it will rot.
The parts that do the work
A primer that routes instead of summarizing. A fresh session reads
PRIMER.md first. It takes under a minute, and every line points at the file
that owns the answer instead of restating it. Copies drift from their source,
and nothing catches prose that disagrees with other prose. So the primer
refuses to copy.
Propose-only doctrine. The assistant can draft changes to the rules, but
they go into a proposals/ folder. Only the owner promotes them. This sounds
like friction. In practice it is the thing that keeps an assistant’s
confident guess from quietly becoming policy.
Negative knowledge gets its own file. CONSTRAINTS.md records what must
not be assumed: approaches that were rejected, limits on what a tool really
does. It is read for every project, whatever the project depends on, because
the classic failure is a limit discovered while building one thing and never
found while building the next. It has a line budget so it can afford to be
read every time.
A tried-and-rejected log, with receipts. Every tool that was actually tested and turned down gets an entry: what was tested, why it lost, and what would change the verdict. One entry records a code-indexing tool whose output contained an instruction addressed to the assistant itself, telling it to recite a “tokens saved” number to the user. That is marketing copy injected into tool output. The lesson went into the log so it would not have to be learned twice: whatever a tool returns lands in the assistant’s context, and some authors write to the assistant instead of to you.
Corrections the owner can edit. When I correct how the assistant works,
that correction goes into WORKING.md, a plain file I can read, argue with,
and delete. Mistakes that cost real time go into LESSONS.md. A correction
that lives only in a commit message or in one assistant’s private memory is
one the owner cannot see or change.
The tools: catching rot before it bites
Documents lie the moment the machine changes underneath them. KSS ships two checks that look from opposite directions:
check_drift.pyreads the claims doctrine makes (paths, ports, services, repositories, links) and verifies each one against the live machine. Exit code 1 means a claim has rotted.check_pulse.pycatches what nobody made a claim about: a service enabled but not running, a container stuck in a restart loop. It exists because of a container that crash-looped for two weeks without anyone noticing. Drift checking could not have caught that, because no document had said it should be running.
There is also session_orient.py, which gives a new session its briefing, and
new_project.py, which lays down the same six standard files for every new
project. Every file it writes says it is a stub, because a scaffold that
produces confident prose nobody wrote is worse than an empty file.
All of it is plain Python 3.11 with only the standard library.
How to use it
- Clone the repository.
- Fill in
kss.tomlwith your machine’s facts: where projects live, which git server holds them. Empty settings are fine; a tool with nothing configured says so and skips that step. - Add a row to
kss/REGISTRY.mdfor each project. - Point your assistant at
kss/PRIMER.mdat the start of every session. With Claude Code, that is one line in a project’sCLAUDE.md. - Run
tools/check_drift.pyafter any change to the docs or to what is deployed.
Then let it grow. Most of the files described in FILES.md do not ship; they
start the first time your setup needs them. What one machine learned means
nothing on another, so KSS ships the shape, not my history.
What I learned building it
- Write the reason next to the rule. A rule without its reason gets “improved” away by the first confident reader, human or not.
- Make the assistant propose, not decide. It is better at drafting than at knowing which draft should win.
- Check documents against the machine automatically. Nobody, human or AI, reliably notices that a sentence written in July stopped being true in October.
- Keep the record of what failed. Tried-and-rejected is the cheapest document in the system and saves the most time.
KSS was built with Claude as the assistant it was written for, and it is licensed CC BY 4.0: use it, adapt it, and tell me what breaks.
Chris Csonka, RolliePollie. KSS on GitHub.