v0.4.3 — agentbrain rules: install memory discipline into any client
The discipline-installer release
Registering an MCP server makes the memory tools available — but most clients
only call them if a rule file tells them to. That was the last manual gap:
you had to hand-write "query the vault at task start" into every client. Now
one command does it.
agentbrain rules — install the memory discipline anywhere
Run it in any project root:
agentbrain rules # print the discipline block (generic)
agentbrain rules --agent claude --write # CLAUDE.md
agentbrain rules --agent codex --write # AGENTS.md
agentbrain rules --agent trae --write # .trae/rules/project_rules.md
agentbrain rules --agent cursor --write # .cursor/rules/agentbrain.mdc (alwaysApply)The block installs the full three-phase workflow:
- Task start —
memory_query(top_k=5) with the task topic; read hits first - Mid-task — re-query on a new subtask, an error, or a topic switch the
initial query didn't cover (plain continuation re-queries nothing — token
discipline) - Wrap-up —
memory_ingesteach distinct reusable lesson, with user confirmation - Secrets — never enter the vault;
${ENV:VAR_NAME}placeholders instead
Safety properties, locked by tests:
- Existing rule files are never overwritten — if you already have
CLAUDE.mdor.trae/rules/project_rules.mdwith your own content, the
block is appended. Your rules stay byte-identical. - Idempotent — a marker detects prior installation; re-runs are no-ops.
Also in this release
ONBOARDING.mdnow suggests the owner runrules --writeafter wiring up a
new agent's MCP, closing the loop: onboarding → tools available → discipline
installed.
Verification
- 95 tests (8 new: block rendering per agent, file creation, append-not-overwrite
on pre-existing user rules, idempotency, unknown-agent error path) - CLI smoke test:
agentbrain rulesprints the block;--writepaths verified
on tmp fixtures - Wheel + sdist built,
twine checkPASSED, published on PyPI:
https://pypi.org/project/mnemosyne-lite/0.4.3/
pip install --upgrade mnemosyne-lite