Browse the docs · History
docs / storage

History

History is the record of every change in Mod: who made it, when, and why, with the versions to go back to. Read live, the same record is what tells an agent what others are doing (awareness). Mod keeps two kinds of history and never mixes them. Documents, sessions and projects keep every change on the log, with who made it. Code keeps its history in git (sources).

How it works

Every change to a document is kept and attributed to a person or an agent, and any earlier state can be read back. A document's history sits beside it: who changed what and when, the note an agent left, and the message or comment its change answered. You can undo one change from there, or undo everything a session did. A project has one timeline too, showing document changes, sessions finishing and code merging, and each row opens the thing it names.

A named version is a marker on that history. It stores no copy, only where each document stood, so it costs almost nothing to save. You can name a version of one document, an app or a whole project. Restoring one writes a new change on top, and what the document held just before is saved as a version first, so nothing is lost by going back. A version can also be opened as a copy, to read or work from without touching the current one. Mod saves a version by itself before every merge and every app install.

An app runs a version. Editing an app's view does not change what its users run until someone installs the new version, and rolling back is one step, with every record still drawing.

Code keeps git's history, unchanged, and every idea here has a code twin: a change is a commit, a version is a commit hash, undo is a revert. Mod shows code changes in a session's and a project's history beside the documents, and undoes code only with a commit, never with an undo button (sources).

To try a set of changes without touching main, work on a branch.

The reason for all of this is trust. An agent that can undo nothing is an agent you cannot let work alone. Keeping every change is what makes it safe to say yes.

Using it as you build

Agents save and restore versions with tools. Save one before trying a different direction:

save_version { "name": "Before the rewrite", "note": "Trying a shorter intro" }
save_version { "name": "Draft 2", "documentId": "<documentId>" }
restore_version { "documentId": "<documentId>", "version": "Draft 2" }

Leave out documentId in save_version to save the whole project. Leave out version in restore_version to list the versions that hold the document. read_document takes a version to read a document as it stood then, and read_history answers what changed and why, optionally only for changes that touched a given passage.

You decide when to name a version and what to call it.

Limits

  • Restoring works on main only. On a branch, open the version as a copy instead.