A Claude Code plugin. Before every git commit it archives completed
OpenSpec changes (all tasks - [x], none - [ ]) and stages the result so the
archive goes into the same commit. If openspec archive fails, the commit is
blocked and Claude is instructed to invoke opsx:archive and retry the
commit.
openspec-auto-archive/
├── .claude-plugin/
│ ├── plugin.json # manifest (this is the only file that lives here)
│ └── marketplace.json # the repo doubles as its own marketplace
├── hooks/
│ ├── hooks.json # PreToolUse(Bash) → openspec-archive.sh
│ └── scripts/
│ ├── openspec-archive.sh # the hook itself
│ └── archive-complete-changes.sh # core: archives + stages the archived paths
└── README.md
The hook is invoked via ${CLAUDE_PLUGIN_ROOT}, so it works from the plugin
cache on any machine — no absolute paths.
The repo is both a plugin and a marketplace:
/plugin marketplace add vyhuholl/openspec-auto-archive
/plugin install openspec-auto-archive@openspec-tools
Local check without publishing:
/plugin marketplace add ./openspec-auto-archive
/plugin install openspec-auto-archive@openspec-tools
# after edits:
/reload-plugins
bash, git, jq, openspec. If openspec is not found, the hook silently
skips the commit (does not block).
- pre-commit. The core script was also designed to work as a pre-commit
hook. The plugin only ships the Claude Code path — it cannot (and should not)
install a git hook into someone else's repo. For pre-commit, add a call to
archive-complete-changes.shin your repo separately.