History you can trust: synced commits, restore and stable story IDs
A spec under version control is only useful if you can see which version you're on, go back when you need to, and trust that a story ID means the same thing tomorrow.
SpecGraph team
Putting a spec in a repository gives it a history. That doesn't automatically make the history useful. Three questions come up as soon as a team relies on it:
- Which commit does the spec in SpecGraph actually match right now?
- Can we see how it changed, and go back to an earlier version?
- When a story is called
2-3today, will it still be2-3next week?
The last one turned out to matter most.
The synced-commit indicator
When a project is linked to a repository, the top bar shows the branch and the commit the spec was last synced with, for example main @9639220a.
“Synced” has a precise meaning. It is the latest push, or the latest pull or restore that applied everypending change. A partial pull doesn't count. If you only took some of the edits, the spec doesn't match that commit, and the indicator shouldn't pretend it does.
That small rule is what makes the indicator worth looking at. When it says the spec matches a commit, it does. And when a reviewer asks which version of the spec a pull request was built against, the answer is a commit hash they can open, not someone's memory of roughly when the last export happened.
History and restore
Open the indicator and you get the spec and pack history: commits on the branch that changed spec.md or the BMAD pack, newest first, with the synced commit marked.
Restore on an older commit brings the spec in SpecGraph back to how spec.md looked at that point. It works like a pull. Every difference is listed as a separate change, you pick what to restore, and nothing else in the spec moves. Locked phases stay locked, and restored changes appear as uncommitted edits in each phase, so you can still discard them.
Restore never rewrites the repository's history. It changes the spec in SpecGraph. When you push afterwards, the restored spec becomes a new commit on top. Going back is itself a recorded step forward.
Viewers see the indicator and the synced commit. Editors also see the history and can restore.
A restore that rewrites history is an undo. A restore that adds a commit is an audit trail.
Stable story identity
This is the part that took the most work. Stories in the BMAD pack have keys, and those keys end up everywhere: commit messages, pull request titles, the agent's progress reports, review notes. If a key changes, every one of those references now points at the wrong story, or at nothing.
Keys used to follow position. Add a feature near the top and the stories below it could shift. Remove one and the numbering closed the gap. In a spec that changes from both the app and the repository, that isn't acceptable.
Now, once a pack is saved, each story's placement sticks to its feature. Its key, its epic and story number, its status, the agent's dev record and the review record all survive other features being added, removed, renamed or reordered. The spec file numbers features by their stable feature number too, so removing a feature deletes only its block instead of renumbering everything after it.
Pulls respect this. If an edit in the repository looks like one feature was removed and another added with the same number, SpecGraph treats it as a rename and updates the feature in place. It doesn't delete a story and create a new one under a different key.
What you can do this week
- Pick a story your team closed a month ago and search your repository for its ID. If the references don't all point at the same thing, your IDs aren't stable.
- Agree what “the current spec” means: a commit, a tag, a date. If people give different answers, fix that first.
- Make going back a forward operation. Whatever your tooling, a revert should leave a record, not erase one.
History is only useful if you can trust it. That takes honest sync markers, reversible changes, and names that don't move.
- version-history
- gitlab
- stories
- traceability