Agentic memory for contract negotiation

Your last bad contract
should be your last.

You already know what a bad clause looks like. You just won't remember in June. Freelance Guardian reads every contract against your standing rules and every clause that has burned you — then marks it up and drafts the reply.

No API key neededFree tier throughoutMemory in CockroachDB
apex-dynamics-llc · independent contractor agreement
rules remembered
past risks recorded
contracts reviewed
clients tracked

Read live from CockroachDB when this page loaded.

01

Memory isn't one thing. This agent keeps three.

Read at different moments, written by different code. Collapsing them into one vector store is what makes agents feel amnesiac.

Semantic

What I believe

Your rules, and the clauses that burned you. Searched once per clause.

guardian_memory
Episodic

What happened here before

One durable thread per client, replayed on every review.

guardian_chat_history
Procedural

Where the work got to

State written after each node. Killed mid-run, it resumes.

checkpoints4 nodes
02

Four steps, and every one of them written down.

Each boundary is a checkpoint persisted to CockroachDB.

N1ingest_contract N2retrieve_memory N3analyze_contract N4save_state Counter-offerredlined · send-ready agent_audit_logappend-only · queryable checkpoint written after every node
Fig. 1 — each arrow is a checkpoint boundary.
03

The dangerous contract is the one that looks fine.

Pattern matching sees clauses that are present. It cannot see a protection nobody wrote. So the whole rule set is checked against the document.

Every standing rulenot just the recalled ones CHECKis it mentioned at all? Clause presentjudge it on its terms Nothing writtenraise a gap finding Counter-offerasks for what is missing yes silent
Fig. 2 — vector search returns rules resembling what the contract says, so a missing protection can never surface that way. A template still full of [7/15/30] blanks cannot be "accepted as written" either — it isn't written yet.
04

The second review starts where the first one ended.

Same contract, same client, twice. Every number below is asserted by the test suite — not described.

First review
Prior messages on file
0
Rows in the audit log
1
Messages on the client thread
2
Checkpoints for this thread
5
Second review, same client
Prior messages on file
2
Rows in the audit log
2
Messages on the client thread
4
Checkpoints for this thread
10

Don't take the page's word for it — run a review against the live agent now.

Press the button. The contract goes to AWS Lambda, memory is read from CockroachDB, and the verdict comes back here.
Nothing run yet.

Fig. 3 — output of scripts/test_graph.py run twice. The test fails if any of these stops growing.

The finding

One clause failing you across five clients isn't a client problem.

It's a missing term in your own contract. No single review can reach that conclusion — it exists only because every decision was written somewhere queryable.

SELECT f->>'clause'                AS clause,
       count(*)                    AS times_flagged,
       count(DISTINCT client_name) AS clients
FROM   agent_audit_log,
       jsonb_array_elements(decision->'findings') AS f
GROUP  BY 1
ORDER  BY times_flagged DESC;
clausesevflagged
Unlimited revisions5×20
Payment terms5×20
No deposit4×19
Uncapped liability4×18

Real output from the audit log. Run it yourself over the CockroachDB Cloud MCP Server — the audit-memory Agent Skill ships in the repo with every query pre-written.

05

Questions a reviewer should ask.

By default, no — and that is the point. The analyser is a deterministic clause engine, so the same contract always yields the same verdict and the demo needs no API key. Because it matches with re.search it knows the exact character offsets of every offending phrase, which is what makes the redline possible at all. Set MOCK_MODE=false and a real LLM runs through the same interface. The subject of this project is the memory, not the model.

RAG is the semantic layer alone. Here memory is split three ways, read at different moments and written by different code. The episodic thread is why the agent knows what it already conceded to a client; the procedural checkpoints are why it can be killed mid-review and resume.

Yes, and you should. Connect to the CockroachDB Cloud MCP Server and query agent_audit_log yourself. Every query in the shipped Agent Skill was run against a live cluster before it was written down.

No. A fair contract scores 0 / accept with zero findings. sample_data/clean_contract.md exists in the repo for exactly that reason — a reviewer that only ever rejects tells you nothing.

No. It flags commercial risk against rules you wrote, and drafts a counter-offer. It is not a lawyer, and the scoring weights are hand-tuned — marked as such in the source rather than dressed up as science.

Nothing. CockroachDB Basic, AWS Lambda, S3, API Gateway and CloudFront all sit inside their free tiers, and the default analyser makes no paid API calls.

Sign-off

Paste a contract. See what it remembers.

The sample has eleven traps planted in it. The clean one has none. Same agent, opposite verdicts, no key and no signup.

Freelance Guardian · CockroachDB × AWS Hackathon Every figure on this page is a real output.