Repository navigation
feat(graph): a versioned, replayable entity graph with history, as-of, diffs, rollback and a History tab - #119
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
…ith as-of, diffs and named versions Every change to entities, their other names, links across namespaces and distinct pairs is one append-only graph_event with who, through what and why, and the rows before and after. The graph can be read as of any version, compared between versions, and an entity's history listed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
Every change since a version is undone newest first as one new event: merges with their mentions, graph changes marked undone, moved mentions back, then every record as it was. What analysis found stays. A rollback can itself be rolled back. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
The graph is kept whole with its first recorded change and every 1000 after; replaying from the newest checkpoint rebuilds it from history alone. Verify compares the replay with today's graph and can record any unrecorded writes as one graph.drift change. lens history verify, checkpoint and list. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
…t did, named versions and rollback Routines › History lists every version with who, through what and why; opening one shows what changed and lets editors name it or roll back to it after a preview. An entity's History button shows its own changes. Diffs name the entities other names point at. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
…Cypher as of a version Keeps both sides in entities.py (graph_history.change around delete, plus notebook.release), the entity drawer (Page and History buttons), mkdocs nav and DEVLOG. Adds as_of to graph_model.build (entities and links from graph_history.state_at), to /graph/schema, /graph/related, /graph/paths and Cypher /graph/query, and keys the graph cache on graph_history.head. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
…d topic entity hide/show Keeps both sides in CHANGELOG, DEVLOG and mkdocs nav. Turning an entity into a topic hides it, and deleting the topic shows it again; both now run inside graph_history.change so they are versions with why, not drift. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
…aude/graph-versioning-49x5up Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe
This was referenced Oct 4, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: renames, merges, links and other entity curation changed the graph in place. Only merges and graph changes could be undone, and there was no way to see what the graph looked like yesterday, who changed it, or to go back.
After: every change to the entity graph (entities, other names, cross-namespace links, "not the same" pairs) is an append-only, numbered version. Each version records who made it (a person,
routine:<id>, analysis or the assistant), how it was made (web, token, oauth, assistant, mcp, routine, workflow, analysis, cli) and why, plus every record before and after. One commit per part:GET /api/v1/graph/historylists versions; passentity=for one entity's history./graph/history/{version}shows a version in full,/graph/as-of/{version}shows the graph at that version,/graph/diff?from=&to=compares two versions, and/graph/tagsnames versions such as "before the cleanup".POST /graph/rollback {to, namespace, dry_run}shows a preview by default. Running it undoes every later change in the namespaces you can edit as one new version, so a rollback can be rolled back too. Merges come undone with their mentions, graph changes are marked undone and moved mentions go back. What analysis found since stays. It needs editor access to every namespace the changes touched.GET/POST /graph/verify(admins) andlens history verify [--fix]compare the replay with today's graph and can record any unrecorded write as onegraph.driftversion.lens history checkpoint|listis also added.See
docs/graph-history.md.Motivation and Context
Adeel asked for a "replayable and versioned graph". It builds on the existing graph changes (organize.py) and entity merges: their events point back at them. Two things are left for later:
The schema only gains four new tables in
store.SCHEMAand no data is rewritten. An archive that already has entities replays from a checkpoint taken at the first change. Mentions aren't versioned, since they come from transcripts.Screenshots (if appropriate):
Checked in the running app: the History tab shows versions with actor, via and why, an opened version shows its diff with Name and Roll back buttons, and the rollback preview lists what would change.
Types of changes
!in the title)Checklist:
pre-commit run --from-ref origin/mainpasses, including the OpenAPI and client regeneration.tests/domain/test_graph_history.py: every version replays to the exact earlier state; a rollback, and a rollback of the rollback, restore the exact state including mention counts; rights; checkpoints; drift.tests/api/test_graph_history.py, pluslens historyintest_cli.py.__tests__/graph-history.test.tsfor the frontend.docs/accordingly.## UnreleasedinCHANGELOG.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01DCB28xsaiCpiDKKk2JjRpe