Skip to main content

memory-pr

Review agent memory as pull requests and require evidence before accepting changes. Try the live Flask model-trial evidence. Judge proof and limits.

One edge changes the result

Relate finds the same two postgres keyword matches in both copies of the sample vault. With the restore drill's DERIVED_FROM edge to the nightly backup, the drill also appears two hops away in connected recall, and review blocks retracting the backup. Remove just that edge: the drill drops out of connected recall, and the identical retraction passes the default review.

Run the one-edge check in your browser, or run this from the repo root after setup:

python demo/ab/relationship_control.py

Removing the edge is the control, not a repair. The same replay shows how to retire an obsolete drill with its backup without erasing their dependency.

Git calls the merge clean. The graph is not.

Watch the 1:57 demo

Inspect the blocked PR · Try the live playground · Judge guide

Git says clean; the graph loses the fact's links; the check blocks the PR

Teams that run several coding agents on one repository keep a shared memory of project facts: which database a service uses, who owns it, what was derived from what. Agents edit that memory in parallel. Git merges their edits as text, so a merge can be clean while a fact loses its links, contradicts the fact it was derived from or rests on a retracted source. memory-pr stores the memory as a Relate graph in git and reviews every change to it as a pull request, in Cypher, before it merges.

Use case

memory-pr is for teams running more than one coding agent on a shared repository. Agents that share a project keep one memory: Markdown notes that Relate opens as a graph. A text diff cannot see graph damage, so a pull request can look perfect and still drop a fact's links, leave a fact attached to nothing or contradict an earlier fact. The relationships that matter are ABOUT, ASSERTED_BY, SOURCE, SUPERSEDES and DERIVED_FROM; variable-length DERIVED_FROM paths up to 6 hops are the ones a diff cannot follow.

How it uses Relate

  • Mode: directory. Relate opens the memory/ folder as a Markdown vault (not in memory, not a single file).
  • Why this mode: the git-tracked Markdown notes are the database. Because the store is plain files in the repository, a change to the graph is a commit, and a pull request can review the graph before it merges. An in-memory graph has no history to review, and a single file would not give git one note per fact to diff and merge.
  • What the graph models: what a team of agents knows about a project. A Fact is ABOUT an Entity, ASSERTED_BY an Agent, backed by a SOURCE, and can SUPERSEDES or be DERIVED_FROM another fact. Those relationships are what the review checks. The full shape is in The graph.
flowchart LR
  Fact["Fact {predicate, value, status}"]
  Entity["Entity"]
  Agent["Agent"]
  Source["Source {uri}"]
  Predicate["Predicate {cardinality}, optional"]
  Fact -->|ABOUT| Entity
  Fact -->|ASSERTED_BY| Agent
  Fact -->|SOURCE| Source
  Fact -->|SUPERSEDES| Fact
  Fact -->|DERIVED_FROM| Fact
  • Persistent store judges can inspect: the memory/ folder in this repository, one Markdown note per node. Print rows from that store:
mempr query "MATCH (f:Fact)-[:ABOUT]->(e:Entity) RETURN e.name, f.predicate, f.value LIMIT 3"
Output shape
{"e.name": "checkout-web", "f.predicate": "runtime", "f.value": "node-22"}
{"e.name": "checkout-web", "f.predicate": "port", "f.value": "3000"}
{"e.name": "checkout-web", "f.predicate": "owner", "f.value": "team-storefront"}
Relate feature The user-visible thing it enables Implementation
Cypher over the Markdown vault mempr recall / mempr query / mempr check: every read and every review rule is a Cypher query on the git-tracked notes src/mempr/default_rules.yaml, src/mempr/check.py
Variable-length DERIVED_FROM paths a fact resting on a replaced fact, a contradiction 1 to 6 hops away and a retracted source reached through that chain. The comment prints the Cypher default_rules.yaml
Keyword match plus those paths mempr search postgres returns the database fact and the restore drill two hops away, which never says "postgres". No model, no key src/mempr/search.py, the search box on the page
WASM (@relate/relate-wasm) the same rules plus a writable Cypher console run in the browser page, nothing leaves the tab site/index.html, site/app.js
Embedded Python (relate-db) the CLI, the MCP server, the GitHub Action and the serverless backend all open the vault with the same engine src/mempr/vault.py, api/
MCP agents can recall, search, explain_fact, query, or review on the Relate-backed memory. propose_fact and retract_fact write to a branch for review, never to main src/mempr/mcp_server.py, docs/agents.md

Search uses Cypher CONTAINS plus graph traversal, not a full-text index or vector search. MCP is our agent interface to Relate, not a separate database.

Setup and run

Prerequisites: Python 3.10+ and git. Node.js 22+ is needed only for the JavaScript tests.

  1. See it block a merge in the terminal (about a minute).

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -e .
    mempr demo
    

    The demo clones the repository into a temporary directory, makes one scripted memory edit there and leaves your working tree and branches untouched.

  2. Explore the graph in the browser.

    Commit explorer lets you step through eight Relate snapshots from the demo's Git history. Start with the CockroachDB proposal and compare the replacement fact's source with the stale derivations flagged by the proposed-merge review.

    ./quickstart.sh
    

    It serves the playground: write a memory, open a pull request, watch the review block it, then search postgres and see the facts derived from it. No Docker, no credentials, no env vars.

  3. Scan a real public repository.

    mempr scan GoogleCloudPlatform/microservices-demo --months 12
    

    The command compares the repository at two commits, prints which literal values moved, and shows the review before and after explicit supersession. Add --json for the complete graphs and source links.

  4. Run the tests.

    ./test.sh
    

    The script creates a Python virtualenv and runs the Python and JavaScript suites. The JavaScript suite can also run without npm dependencies:

    node --test tests/js/*.test.mjs
    

What to look at

Git reports no merge conflicts for demo PR #60. The memory-review check reports 3 lost links and 4 lost properties. On main, the required check fails on the contradiction in PR #15 and passes on PR #6. Inspect the check, then reproduce the review in the live playground without an account or API key.

Live page · Demo video · Devpost · Built by Himanshu Kumar for the Relate by Neo4j hackathon

Evidence

Generated-PR simulation Git alone Git + Memory PR
Wrong facts still active at the end, summed across five seeds 21 1

300 generated PR attempts per arm across five seeds, using actual local Git merges. These are final-state totals, not per-PR accuracy or independent agent runs. Raw comparison · Method and reproduction.

Limits: the original Devin A/B trial used one session for both arms; the 300-PR simulation uses generated proposals, not independent agent runs.

  • Hand off reviewed repository changes. In a four-session replication, each session answered all four directives correctly; reviewed-context sessions opened one primary manifest each. Details

  • Agent reads follow the reviewed branch. An end-to-end MCP test follows one session from a blocked contradiction through a corrected, merged fact. Details

  • Inspect what would be affected before changing a fact. Run python demo/explain_fact.py to see the bundled backup job's source, database dependency, and downstream restore drill. Judge walkthrough and real output. This reads the recorded links at a Git revision; it does not verify live source data.

  • Agent trials. The sequential Devin proposals differed. In the fresh A/B trial (#63), independent Codex sessions recalled different facts but both chose MongoDB after checking the code; both passed the service probe and graph review. No outcome advantage was observed in that trial. Transcripts and CI runs

  • Held-out release metadata. A preregistered deterministic consumer answered with exact values and URLs on 6 of 12 PyPI release pairs in each arm, with six direct source reads per arm. Recall returned source IDs rather than exact URLs, so the consumer could not cite recalled updates. Protocol, scores and raw pairs

  • Held-out follow-up after the citation fix. Recall now adds verbatim source_urls and retains sources as graph IDs. On a separate preregistered set of 12 release pairs, the same deterministic policy using that field gave 9 exact answers with 3 direct reads in the reviewed arm, versus 6 exact answers with 6 direct reads in the historical arm. Updates were seeded and source access was controlled; neither round measures independent agent behavior. Both rounds, raw outcomes and replay

  • Held-out repository history. On 12 locked Flask packaging questions, the same deterministic policy scored 6 → 9 exact commit citations with 6 → 3 direct reads. That includes an unchanged dependency value that still needs a citation to the target commit. Preregistration, limits, and raw outcomes

  • Real-source scan. Across 50 public repositories, 154 of the 328 facts had changed values; reconstructed memory produced 154 blocking findings and passed after supersession. Run one scan with mempr scan owner/repo --months 12. Replay

    Repositories read 50
    Wrong facts blocked, then 0 once superseded 154
  • Tests. Current and historical pytest and JavaScript test counts are in the evidence log.

Independent OpenAI model run (same vendor as the build tooling)

Run 1 gave GPT‑5.4 mini two locked repository handoffs: 1/2 exact with reviewed memory, 0/2 without memory. Three of four replies failed the required output format, so this run does not establish an accuracy difference. Run 1 receipt. Run 2 was preregistered after those failures. It used the same model and scorer, but enforced the JSON shape and used 12 different, previously locked Flask cases. All 24 replies met the schema. The historical arm scored 8/12 exact and the reviewed arm 10/12, with 6 archived source reads each. Two historical and one reviewed exact answers lacked supplied target evidence; counting only exact answers with that evidence gives 6/12 and 9/12, respectively. This is a seeded-update comparison, not independent update discovery or a measured reduction in reads. Run 2 protocol · Raw transcripts, usage, and scores.

The two OpenAI runs used 16,141 API-reported tokens combined (14,609 input and 1,532 output). At GPT‑5.4 mini's standard rates of $0.75 per million input tokens and $4.50 per million output tokens, that is about US$0.018 at uncached list prices. This is an estimate, not a billing receipt.

Docs

Disclosures

  • Built entirely during the contest (started Nov 20, 2026); no code reused from earlier projects.
  • Built with AI assistance (Devin and OpenAI Codex). Separate Devin build sessions contributed the MCP server and the browser graph view. The evidence includes recorded Devin and Codex agent runs. Third-party libraries and tools include Relate (relate-db, @relate/relate-wasm), PyYAML, the MCP Python SDK, Cytoscape.js, the Geist and Geist Mono fonts, pytest and ruff.
  • The sample project is fictional. The scripted demo agents run without a model. The real-repository scan reads public files on request and stores nothing. The backend sets no cookies, has no accounts and keeps no state between requests.
  • License: MIT.

Metadata

Release files for mempr 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mempr 0.1.0
File Size Uploaded Provenance Actions
mempr-0.1.0.tar.gz 106.1 kB Without provenance Details for mempr-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mempr 0.1.0
File Interpreter ABI Platform Actions
mempr-0.1.0-py3-none-any.whl Python 3 none any Details for mempr-0.1.0-py3-none-any.whl

Total release size: 174.7 kB

Release files / mempr-0.1.0.tar.gz

Download URL mempr-0.1.0.tar.gz
Size 106.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8c51cf382e43ef993906bd046b979c8d6fb94bd3d2c8bc01a3de432e15ec006a
BLAKE2b-256 checksum
How to use checksums
b25b308f35582652a1c2101816814fcd43b776c4e6331d894fdfc851d3a5b8ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / mempr-0.1.0-py3-none-any.whl

Download URL mempr-0.1.0-py3-none-any.whl
Size 68.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6d2d5c0123e4d7021303f123e6d1f9c64e8ef9bd05ab2498f657419b70e031
BLAKE2b-256 checksum
How to use checksums
94551742d86ad46fdae9a3df0bd4954d1444e623d29208e97afb4de2f4f7b164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for mempr 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page