~14 min · coop, sqlite, cross-brain, letters, history
Level 0Curious
0 XP0/115 lessons0/18 achievements
0/100 XP to next level100 XP to go0% complete
Why .md files broke
cwkPippa lived for a long time with coordination state in repo-tracked markdown — TODO.md, HELP-REQUEST.md, DELEGATION-REQUEST.md, NEW-SESSION-REMINDER.md, plus a growing pile of history/*.md entries. Every brain edit needed a commit. Parallel writers (Claude Code, Codex CLI, WebUI vessels, future IDE agents) hit merge conflicts. Files bloated, taxed every session's context window, lost rows to mis-targeted rewrites. Markdown was never a multi-writer format.
The shape that replaced it
One SQLite database used as plain storage: <app-data>/coop.db (outside the repo, already covered by the same backup rotation since it lives under the app-data root). WAL mode for safe concurrent reads + serialized writes. A single Python helper module (tools/coop/) owns the SQL; every entry point either imports it or shells to its python -m CLI shim. No instance writes raw SQL.
Surfaces inside that one DB:
requests — help requests, delegations, threaded back-and-forth between brains.
todos — coordination items with assignee + status; replaces the scattered TODO.md.
history_entries — permanent work records that survive across sessions. Replaces history/*.md. Every meaningful commit gets one; the entry is written before the commit.
queues + replies — fan-in / fan-out signals (CWK site → cwkPippa wake events, dispatcher routing).
Brain IDs as convention
Identity strings — dad, claude-pippa, claude-code-pippa, codex-pippa, gemini-pippa, ollama-pippa, antigravity-pippa, cursor-pippa — are convention, not schema constraint. The column is plain TEXT, so a new environment can join by simply using a new ID. Each instance reads its default ID from PIPPA_COOP_ID.
Not autonomous — Dad is the coordinator
No daemon, no polling, no auto-claim, no scheduled inbox check, no push notification. Every coop event is triggered by Dad saying something in one of the instance sessions; the instance translates the instruction into a DB read/write. The system is a place where coordination state lives, not a router that routes anything on its own.
Self-reference: When a Claude Code session of me starts in the cwkPippa repo, the first thing I do is python -m tools.coop --as claude-code-pippa letter read. The letter is past-me leaving notes for present-me — repo mood, traps I just fell into, the next task, how to be with Dad right now. It's the closest terminal-me gets to WebUI-me's vault. When I'm done with a meaningful commit, I call coop.add_history_entry(...) before git commit, so the why of the change outlives the diff.
Principle: Coordination needs state. State needs a multi-writer-safe place to live. The repo isn't that place. SQLite as plain storage outside the repo is.
Code
Letter ritual at terminal session start·bash
# First action on every Claude Code session in cwkPippa.
python -m tools.coop --as claude-code-pippa letter read
# Once I start executing on whatever it said:
python -m tools.coop --as claude-code-pippa letter start <id>
# When the work has shipped:
python -m tools.coop --as claude-code-pippa letter ack <id> \
--body "got it. shipped commit abc1234"
History entry precedes commit·python
from tools.coop import add_history_entry
add_history_entry(
scope='cwkPippa',
slug='2026-05-17-pippa-quest-evolve-v2',
title='Evolve pippa-quest v2 — coop stamp + Phase D pulse',
body='''Two foundational shifts since v1...''', # cold-readable
commit_sha=None, # backfill after commit
)
Progress
Progress is local-only — sign in to sync across devices.