- Which data lives in each repository
- When to branch and checkpoint work
- When you will promote to the main line of version history
Repositories
A repository is just a folder with independent version history and permissions. Generally, you documents should be grouped into the same repository if they need to evolve together and share the same owner. For example, all of the code for an application would typically live in a single repository. But apps belonging to different tenants should live in separate repositories. You can always add metadata to repositories to help you track which repositories belong to different teams or tenants. Here are recommendations for common cases:- Applications: One repo per application
- Knowledge bases: One repo per team or project
- n8n-style workflows: One repo per workflow
- Skills: One repo per skill. It is also feasible to create one skills repo per tenant, but repo-per-skill plus metadata tags typically provides the most flexibility.
Branching and checkpointing
Generally, you should treatmain bookmark as the canonical state that users or production systems trust.
Treat other bookmarks as markers of the tips of different “timelines” — work-in-progress modifications that are not yet ready to
be merged into the canonical state of the repository.
When an agent or human wants to draft some work, you typically create a new change forked off of the main bookmark, and optionally
create a new bookmark pointing at that change.
When you want to checkpoint your draft, you can chain a new change on top and advance the bookmark.
When you’re happy with that draft work, you can merge it into the canonical state with the mesa.merge method.
Below is guidance on using Mesa for agent sessions.
Timeline-per-session
Create one bookmark per user session/workflow run instead of mixing multiple sessions onmain. Each session can evolve independently, and you can merge or discard without affecting parallel work.
session/<session-id> or proposal/<feature-name>-<run-id>.
Checkpoint-per-prompt
Create a new change (and move the session bookmark to it) after each user prompt. This gives you a clean timeline of intent, makes undo/redo straightforward, and lets you restore the repository to a known good state if a later step goes wrong.- conversational coding agents,
- iterative content generation,
- any workflow where users expect “undo last prompt” behavior.
Short-lived bookmarks
Keep session/proposal bookmarks temporary. Merge approved work quickly and delete abandoned bookmarks. Short-lived bookmarks reduce drift frommain, lower conflict rates, and make reviews easier because diffs stay small.
main or delete it.
Approvals (proposal bookmark + diff)
Use a proposal bookmark for all non-trivial changes, then show users a diff before merge:- Agent writes changes on a proposal bookmark.
- Fetch the diff between
mainand the proposal bookmark. - Render the diff in your UI in a way that makes sense for your app.
- On user approval, merge the proposal into
main. - On reject, keep the bookmark for iteration or delete it.
General
- Treat
mainas canonical state, not a scratchpad. - Add metadata in commit messages so runs are traceable.
- Keep API/JWT scopes as tight as possible
- Track write, diff, and merge latency in your critical paths.
- Enforce repository naming conventions and lifecycle policies.
- Delete abandoned proposal bookmarks after a retention window.
- Keep human review workflows for high-impact changes.

