One Developer's SQLite Trick for Coordinating AI Agents Just Landed on npm
When two AI agents try to work on the same task at the same time, something has to decide who won. Most multi-agent frameworks leave that to the developer. A fresh npm package called @cardor/agent-harness-kit — published to npm this week by independent developer Enmanuel Mag — handles it with a single database write: one call, atomic, and the database itself does the coordination work that distributed systems usually demand. No server to run, no lock file to manage, no cloud dependency. The pattern is worth understanding before it becomes invisible infrastructure.
The package is a scaffolding layer for multi-agent coding workflows. Run npx ahk init and it creates a local SQLite database at .harness/harness.db, a task list, four named agent roles (Lead, Explorer, Builder, Reviewer), and a local MCP server on stdio. The Lead decomposes a task into a plan without touching source files. Explorer maps the codebase. Builder implements within developer-defined writablePaths. Reviewer checks acceptance criteria and runs a health gate before approving. Each role lives in its own Markdown file you can edit. The harness never overwrites changes you made.
The parts that look different from a default Claude Code or OpenCode setup:
Atomic task claiming. When an agent calls tasks.claim(id, agent), it runs as a database transaction — one agent writes its name into the task row, and the database rejects any second write to the same row. Two agents cannot grab the same task simultaneously. This is the coordination problem that breaks most multi-agent setups, solved with a database constraint rather than a lock file. (source)
Health gate. Before any agent starts or closes a task, it runs health.sh. The script exits 0 or the task stays open. You define what healthy means: your test suite, your server check, your config validation. The harness enforces the gate but doesn't prescribe what it runs. (source)
Full audit trail. Every action is recorded — actions.start(), actions.write() with sections for files modified and results, actions.complete() with a summary. ahk export --json dumps the full history. The database is queryable with standard SQLite tools. (source)
Provider-agnostic. Works with Claude Code today and OpenCode tomorrow. ahk migrate --to opencode switches the task history, agent definitions, and config to the new provider. The scaffold carries over; the model wrapper doesn't have to. (source)
No node-gyp, no native compilation. The package uses the node:sqlite module built into Node 22 — Node 22 or Bun required. Everything stays local in .harness/harness.db, gitignored by default.
The timing matters because the 2026 agent framework landscape is saturated. OpenAI shipped its Agents SDK in March. Google launched the Agent Development Kit in April. Anthropic published its Agent SDK as a separate release. Mastra, CrewAI, and LangGraph all have native MCP support. (source) The table is crowded with coordination layers.
Underneath that surface, the harder engineering problem is what Addy Osmani called harness engineering: the runtime around the model determines whether the setup actually holds. On Terminal Bench 2.0, Claude Opus 4.6 running inside a default Claude Code harness scored in the Top 30. The same model in a custom harness scored Top 5. Viv's team moved a coding agent from Top 30 to Top 5 by changing only the harness. (source) "A decent model with a great harness beats a great model with a bad harness," Osmani wrote. (source) HumanLayer's thesis is sharper still: most harness failures are configuration problems, not model problems. (source)
Martin Fowler's harness taxonomy distinguishes computational harnesses — tests, linters, type checkers — from inferential ones: semantic analysis, AI code review, LLM-as-judge. (source) AHK sits between them. The health gate is computational. The task-claiming and role-enforcement are architectural. The audit trail is operational. It's a structural scaffold for coordination, not a quality check on what the model outputs.
The package requires Node 22 or Bun. No cloud, no API keys beyond what your AI tool already needs. Everything local, gitignored, queryable.
Whether this holds up at scale is the open question. The four-role sequential workflow is well-suited to feature development but would need adaptation for parallel or fan-out patterns. The MCP server on stdio means no remote access — that's a feature for local-first workflows, a limitation for distributed setups. The health gate is a script you write, which means the quality of the gate depends on the developer's discipline.
For teams running Claude Code or OpenCode on medium-complexity projects today, this solves a gap that default tooling leaves open: what happens when the agent finishes, what happens when it crashes mid-task, and what actually changed in the codebase. The SQLite-backed audit trail and atomic task claiming are the parts that don't exist in the default Claude Code experience. If that problem is common enough — and the Addy Osmani benchmark numbers suggest it is — the pattern will show up in more packages before long.
The package is @cardor/agent-harness-kit on npm. Repository is on GitHub.