Why Autonomous Coding Agents Need FalkorDB: The Case for Causal Invalidation
CAVDAX — Causal Action & Verified Decision Autonomous eXecution
WeMakeDevs × FalkorDB Graph Hacks 2026 — Track 01: Agents That Act on Connected Data
Authors: Geetika Chugh & Suneet Chugh
Try it: live demo · GitHub Repository ·npx -y @cavdax/mcp-server
The agent was right. The document was wrong.
Picture a senior engineer handing a task to an AI coding agent on a Friday afternoon: implement the checkout gateway migration.
The agent searches the docs folder, finds ADR-001.md, and reads its title: "\"Adopt TokenAuth v1 for Payment Gateway.\" The document is relevant. The retrieval is correct. The agent starts writing integration code."
What it doesn't know is that six weeks ago a security lead merged ADR-002.md. It supersedes ADR-001 and mandates OAuth2, because TokenAuth v1 has critical vulnerabilities.
The agent wasn't careless. It did exactly what we built agents to do. The failure is that finding context and verifying that context is still valid are two different problems, and most agent stacks only solve the first one.
We call this stale decision execution. It isn't a cache problem. It's a provenance problem: the agent's grounding exists, but nobody checked whether it still traces back to a current, authoritative source.
Relevance and freshness are different shapes
Vector search answers: "Which document is relevant to this task?"
It can't answer: "Has a later decision replaced this one?"
ADR-001 and ADR-002 are both about payments, auth and checkout. They share almost the same vocabulary, so similarity has no principled reason to prefer the newer one. And the old ADR can't simply be deleted, because that would erase history.
The same pattern shows up everywhere:
- A dependency jumps a major version, but decisions written against the old API remain.
-
CODEOWNERSchanges, but incident-routing decisions still name the old owner. - A security policy is revoked, but the conclusions drawn from it are still treated as true.
Freshness isn't a property of a document. It's a property of a chain: this action depends on that decision, which depends on that fact, which came from that source. If any link is broken, the action isn't safe, no matter how well the document ranks.
That's a graph problem.
Not a new idea
This has a long history. Truth Maintenance Systems (Doyle, 1979; de Kleer, 1986) formalized it: when a justification is retracted, every belief that depended on it must be withdrawn. Build systems like Bazel do the same for artifacts. Change a source file and everything downstream is invalidated.
CAVDAX applies that idea to engineering decisions and puts the check at the one place an agent can't skip: the moment it tries to write code.
The model: Source → Fact → Decision
CAVDAX stores engineering knowledge as a small dependency graph in FalkorDB:
(Decision) -[:DEPENDS_ON]-> (Fact)
(Fact) -[:EXTRACTED_FROM]-> (Source)
(Source) -[:SUPERSEDES]-> (Source)
-
Source: an authoritative artifact. ADRs are one type; commits,
package.jsonchanges,CODEOWNERSand closed GitHub issues use the same schema. - Fact: an atomic claim taken from a source, like "payment endpoints require TokenAuth v1."
- Decision: a choice an agent might act on, like "generate the checkout service with TokenAuth v1."
When ADR-002 declares supersedes: ADR-001, one Cypher statement does the rest:
MERGE (newSource)-[:SUPERSEDES]->(oldSource)
SET oldSource.status = 'SUPERSEDED'
WITH oldSource
MATCH (oldSource)<-[:EXTRACTED_FROM]-(staleFact:Fact)
SET staleFact.is_stale = true
WITH staleFact
MATCH (d:Decision)-[:DEPENDS_ON*1..4]->(staleFact)
SET d.status = 'INVALIDATED_NEEDS_REVALIDATION'
The old source is marked superseded. Every fact drawn from it goes stale. Every decision that reaches those facts, up to four hops away, is invalidated.
There's no LLM in this path. ADRs are parsed from YAML frontmatter, or, for plain Markdown without it, by regex heuristics that understand common Nygard/MADR layouts and tell "Supersedes: ADR-001" apart from "Superseded by ADR-002." Deterministic ingestion means a fact can't be hallucinated into the graph, and we weren't willing to let a probabilistic fact decide whether code gets written.
What the agent actually sees
Here is the moment that matters. The coding agent, still holding DEC-102, tries to write payment.js:
{
"isError": true,
"gate_verdict": "BLOCKED_DECISION_INVALIDATED",
"decision_id": "DEC-102",
"violation_paths": [["Decision:DEC-102", "Fact:F-Auth-v1", "Source:ADR-001"]],
"message": "⛔ CAVDAX GATE BLOCKED: Execution rejected. A supporting fact or source was superseded.",
"instructions_for_agent": "Inspect the superseding source, create an updated decision via 'revalidate_decision', and re-submit."
}
The file on disk is untouched. And the response doesn't just say no. It says why: violation_paths is the exact chain that broke, node by node, so the agent can reason about it.
The agent then calls revalidate_decision to create DEC-103, grounded in a new fact from ADR-002, and retries. This time the gate walks DEC-103 → F-OAuth2 → ADR-002 (ACTIVE), every link holds, and the file is written.
That's the full loop: detect, block, explain, recover, proceed. A system that only blocks would stall the agent forever. This one gives it the way out.
You can watch the whole sequence, with the graph turning red as ADR-001 is superseded, in the 4-act walkthrough on the live site.
The gate must enclose execution, not advise it
Many "agent safety" designs add a tool like check_action_safety() that the agent is supposed to call first. That's a suggestion, not a gate. An LLM can skip it, ignore the warning, or check one decision and act on another.
In CAVDAX, the write lives inside the tool. apply_code_change(decision_id, file_path, code_payload) runs the graph check first and only then touches the disk. There's no second path to the side-effect.
Around that core:
-
check_intent_clearanceruns the same check before the agent generates code, so it finds out a decision is stale without spending tokens first. - Decision locks stop two agents from editing the same decision branch at once.
- Path confinement refuses writes that resolve outside the repo root.
-
An audit trail: every attempt, approved or blocked, is recorded as an
AgentActionnode linked to the decision it cited.
The gate is deliberately strict. A decision with no facts, a fact with no source, a decision that depends on an invalid one, or a decision that doesn't exist all block. If the graph can't prove a chain is sound, the answer is no. For strict deployments, set CAVDAX_MODE=live so an unreachable database fails closed instead of falling back to the labelled demo simulation.
Beyond the agent
The gate protects an agent in flight, but engineering is asynchronous. ADR-002 might merge at 10:00 while a teammate's work on DEC-102 sits untouched until Monday.
So the same cascade runs on a GitHub push webhook. CAVDAX notifies, by email and browser push, the owners of exactly the decisions in the blast radius, not the whole team. npx cavdax check --staged and --pr <n> bring the same check into pre-commit hooks and CI.
Why FalkorDB
The honest objection: "You could do this in Postgres with a recursive CTE."
For a small graph, yes. But this is a graph problem in a way that matters for the product, not only for performance:
-
The relationships are the data.
SUPERSEDES,EXTRACTED_FROM,DEPENDS_ONandREPLACESare first-class, queryable edge types. Modeled relationally, each becomes a join table and each hop becomes a self-join. -
Variable-depth traversal is native.
[:DEPENDS_ON*1..4]is one pattern in Cypher. The invalidation cascade and the gate check are both short because the query language matches the question. -
Provenance paths come back for free. The
violation_pathsthe agent receives are just the paths the traversal already found. With recursive CTEs you'd build that bookkeeping yourself. -
It runs everywhere. A single
docker run falkordb/falkordbis all the published package needs, which matters for something that has to sit next to every developer's agent.
And the graph is explorable, not just queryable. Seeing a superseded ADR turn red and the invalidation ripple through facts and decisions makes the blast radius obvious in a way a list of rows never will.
What it doesn't do yet
The main limitation: the gate verifies that the declared decision has a sound provenance chain. It doesn't check that the code payload matches the decision's intent. An agent that cites DEC-103 (OAuth2) while submitting TokenAuth code would pass the graph check. Closing that gap needs semantic analysis of the payload, which is the next problem we want to take on.
Also, the graph only knows what's been ingested. A decision grounded in a source that was never parsed shows up as ungrounded and is blocked. That's the right failure mode, and the zero-config parser and a bootstrap flow that proposes a starter ADR as a pull request exist to ease onboarding.
Try it
You need Docker for FalkorDB and any MCP-capable agent (Claude Code, Cursor, Windsurf):
docker run -d -p 6379:6379 falkordb/falkordb:latest
npx -y @cavdax/mcp-server # start the MCP server
npx cavdax doctor # verify the FalkorDB connection
npx cavdax ingest --repo . # build the graph from your ADRs
Or skip the setup and click through the live demo. Client config snippets and the full tool list are in the README.
Closing: the problem worth solving
Agents are now capable enough that a stale action has real consequences. A payment service migrated to an authentication scheme that was already deprecated. A P0 incident routed to an engineer who left the team. Code generated against a library version that was patched for a CVE months ago. None of these are exotic edge cases. They're the predictable failure of a system that can retrieve context but can't tell whether that context is still true.
Better retrieval won't close that gap, because the gap isn't about finding the right document. It's about the chain behind it. Does this action still trace back, through a fact and a decision, to a source that is still in force? FalkorDB makes that chain a first-class, queryable structure, and CAVDAX enforces it at the one moment an agent can't talk its way around: the write.
If you're building or running coding agents, ask what happens when the decision they're acting on changes underneath them. If the honest answer is "nothing stops them," that's the problem we built this for. Try the demo, read the code, and tell us where it breaks. Issues and ideas are welcome on GitHub.
Finding the right document is a retrieval problem. Knowing whether you're still allowed to act on it is a graph problem.
Built by Suneet Chugh & Geetika Chugh for WeMakeDevs × FalkorDB Graph Hacks 2026.
Prior art citations: Doyle, J. (1979). A Truth Maintenance System. Artificial Intelligence, 12(3), 231–272. de Kleer, J. (1986). An Assumption-Based TMS. Artificial Intelligence, 28(2), 127–162.


Top comments (1)
Great post @geetika_chugh_246 , congratulations on your first post on Dev.To.
The Post In Itself is informational and quite interesting and covers really interesting topics around autonomous coding agents and why they need FalkorDB, how it can be used.
A great read Indeed, would love to see more posts from your side, keep it up. 🙌🏻