The recent trend of treating a git-backed LLM wiki as the obvious way to share a brain across bots has hit a practical wall. Developers realized that pointing multiple agents at a single Markdown repository creates more problems than it solves. The core issue isn't storage; it's contamination. When a new agent inherits a wiki written by a previous bot, it also inherits session-specific artifacts like connector URIs, conversation IDs, and first-person memory promises that are useless or dangerous for the new instance. In response, a developer released wiki_contract.py, a ~780-line, stdlib-only Python script designed to enforce strict layering in these shared knowledge bases.

Enforcing Layering With Regex and Frontmatter

wiki_contract.py operates on a simple premise: not all markdown pages are created equal. The script requires pages to declare a layer in their frontmatterβ€”shared, agent-local, or raw. Shared pages are the only ones eligible for inheritance by a new agent. The tool scans these shared pages for specific leakage patterns, such as muse:// connector URIs, phrases like "as I mentioned in our last Claude session," and paths pointing to agents//. If it finds these, it flags them as blocking errors. This prevents a new bot from trying to use a connector that doesn't exist in its environment or reading a scratch note meant only for the previous agent.

The Pack Command and Budgeted Context

Beyond checking for leaks, the script introduces a pack command that builds a CONTEXT.md file for a specific agent, respecting a character budget. For example, running pack --for research --budget 6000 compiles only the shared pages into a single file, while listing agent-local notes by title only. This ensures the new agent receives a clean, portable context without the noise of previous sessions. The tool explicitly refuses to rewrite wiki pages, acting instead as a compiler for shared context. It also maintains a .writes.json manifest to detect conflicts, exiting with an error if two different agents have unreviewed writes to the same shared page.

Why This Matters for Multi-Agent Workspaces

The release highlights a critical gap in current multi-agent architectures: portability is not automatic. Just because a wiki is in git doesn't mean it's portable across different LLMs or agent configurations. The script demonstrates that without explicit layering, a source of truth quickly becomes a contaminated archive of one bot's specific tooling and memory quirks. The author argues that this contract logic should eventually be native to knowledge base software, ensuring that shared operational pages remain distinct from agent-local scratch notes, regardless of whether the workspace is managed by a script or a dedicated platform.

Key Takeaways

  • wiki_contract.py uses regex to detect session-specific leakage (e.g., muse:// URIs, "last session" references) in shared wiki pages.
  • The tool enforces a three-layer model: shared (inheritable), agent-local (private), and raw (source citations).
  • A pack command generates budgeted context files for new agents, excluding local notes and preventing connector mismatches.
  • Write conflicts between agents are tracked via a .writes.json manifest, blocking unreviewed simultaneous edits to shared files.
  • The approach treats the wiki as a compiled artifact, not a mutable chat log, prioritizing clean inheritance over convenience.

The Bottom Line

If your agents share a brain, they need a contract, not just a repo. This script is a necessary hack until knowledge bases natively understand agent isolation.