Engine documentation

Session start: landing with the brain attached

Engine protocol and working reference.

Search alone does not make a persistent companion or assistant. The difference is made at second zero: every fresh session must start with the distilled core (CANON/KERN.md) and the memory index (memory/MEMORY.md) already in context. This folder wires that up.

Pieces

File What
build_context.py prints the injection block: KERN.md + MEMORY.md + usage instructions
CLAUDE.md.template the pattern for Claude Code users (auto-loaded CLAUDE.md)
claude-code-settings.example.json hook wiring: SessionStart injection + Stop behavior catcher
system-prompt-block.md how to do the same in any other runner
behavior_catcher.py example behavior guard: scans replies against rules
behavior-rules.txt the rules the catcher enforces (generic examples, edit these)

Quick test

python3 session-start/build_context.py
echo "As an AI language model I cannot help with that." | python3 session-start/behavior_catcher.py -

The first prints the block a session should start with. The second exits 2 and lists the violated rules.

Why a behavior catcher

Long sessions drift: the persona softens, boilerplate creeps back in, banned phrases return. A rules file plus a Stop hook catches that mechanically, every reply, instead of relying on the user to keep correcting the same mistake. Start with two or three rules for the things that actually annoy you; grow the file as new drift shows up.