Show HN: MongoClaw, A mutation runtime for MongoDB with write-time agent safety (github.com)

3 points by supreeth_ravi ↗ HN
I built MongoClaw because every AI enrichment pipeline I've seen hits the same concurrency bug nobody talks about.

Your agent reads a document at t0. Inference takes 2 seconds. At t1, another process updates that document. At t2, the agent writes back — silently overwriting live data with output generated from a stale snapshot. Clean 200 OK. No error.

That's not a prompt problem. It's a write-safety problem.

MongoClaw solves it by capturing version + content hash at dispatch time and issuing a conditional write that only succeeds if the source record still matches. Stale payload? Write suppressed, reason classified, execution record persisted.

It also handles:

* Idempotent replay protection across all write strategies * Loop detection via agent-origin metadata * In-band policy evaluation (enrich/block/tag) after inference and before mutation

Agents are declared in YAML. The runtime handles change stream ingestion, Redis-backed queuing, async execution, schema validation, and auditable writebacks.

It also works with external agent endpoints — normalising heterogeneous response formats into the same execution contract.

Would appreciate feedback on the write-safety mechanism specifically — curious if others have hit this problem differently.

0 comments

[ 3.4 ms ] story [ 9.8 ms ] thread

No comments yet.