INSTAR
Agent skills that learn from their own failures — in a database where two agents cannot teach them opposite things.
1 · Recall
Ask the memory something. The SQL and the query plan are shown because the claim worth checking is the plan, not the answer.
2 · Why this needs CockroachDB
INSTAR’s invariant: for any topic, the active lessons must not contain both a “do” and a “don’t” without an open conflict record. That is a predicate over a set — no UNIQUE index, no CHECK, no exclusion constraint can express it, because none can range over other rows. Only transaction isolation protects it.
These four numbers are queried live from the cluster right now, not copied from a run log — the audit SQL is in src/memory/write.ts. Below: concurrent agents learn contradictory rules about the same 6 topics. Same cluster, same code, same workload. The only difference is one SET TRANSACTION ISOLATION LEVEL.
READ COMMITTED
PostgreSQL's default
- undetected contradictions
- …
- ledger drift
- …
- lessons stored
- …
- open conflicts
- …
auditing…
SERIALIZABLE
CockroachDB's default
- undetected contradictions
- …
- ledger drift
- …
- lessons stored
- …
- open conflicts
- …
auditing…
94 vs 12 lessons is the tell. Under READ COMMITTED every agent read an empty slot, saw no conflict, and inserted — leaving 94 fragmented beliefs, 92 with corrupted support counts, and five of six topics where the library simultaneously believes “do X” and “never do X” with no record they disagree. Under SERIALIZABLE each aborted transaction retried, saw the earlier write, and opened arbitration instead.
The cost is real and is not hidden: the SERIALIZABLE arm takes several times longer and absorbs hundreds of aborts — the storm script prints both, per run. Zero writes are dropped in either arm. The claim is not“CockroachDB has SERIALIZABLE” — PostgreSQL has it too. It is that correctness here depends entirely on isolation, CockroachDB makes the safe choice the default, and no constraint will ever warn you that you needed it. Reproduce with npx tsx src/demo/storm.ts --agents 16.