stage
Hermes write_file and patch land in a scratch copy. The original file stays as it is until you apply.
Install
From this directory:
mkdir -p ~/.hermes/plugins
ln -sfn "$PWD" ~/.hermes/plugins/stage
hermes plugins enable stage
Start a new Hermes session after enabling. The plugin uses the Python standard library only.
Example
In a Hermes session, with notes.txt and draft.txt in the workspace:
Rewrite notes.txt so the first line says the relay is on. Rewrite draft.txt the same way. Leave both staged.
Hermes writes scratch copies. Both files on disk still have the old lines. Then:
Show the diffs. Apply notes.txt. Discard draft.txt.
stage_diff prints the pending edits. stage_apply with paths: ["notes.txt"] copies that scratch onto notes.txt and returns a receipt with the SHA-256 before and after. stage_discard with paths: ["draft.txt"] throws that scratch away. draft.txt on disk is unchanged.
Demo beat (under 90 seconds)
- Ask Hermes to rewrite a file and leave it staged.
- Hermes reports the write.
catthe file: the old line is still there. stage_diffshows the new line in the scratch copy.stage_applyupdates the file. The receipt has two hashes.
Errors
- Path outside the workspace. A write to
/tmpor another directory is blocked. The destination file is not created. patchon a file that is not there. The call is blocked. Nothing is created and nothing else changes.stage_applywhen nothing is staged. The tool returns an emptyappliedlist. Files on disk stay as they are.stage_applyafter the original changed. The apply for that file is refused. The newer bytes stay, and the scratch copy stays pending. Callstage_difffor that path, thenstage_discardon that path. Staging the same path again does not refresh the protected hash.- Shell or
execute_codethat would change a workspace file. The plugin blocks common shell patterns (sed -i, redirects into the workspace,rm/mvtouching the workspace,cpwhose destination is in the workspace). Usewrite_fileorpatch, thenstage_apply.
Known limits
- MCP tools are not staged.
- File deletion is staged only for V4A
Delete Filehunks. Other delete tools still change disk. A mixed V4A patch (delete plus add/update) is committed only after the Hermes patch succeeds; if that patch fails, the delete is dropped and any earlier staged edit of those paths is restored. Uncommitted patch batches appear instage_statuswithcommitted: falseand are not applied. A parallel V4A patch on the same path is rejected until the previous batch is committed or discarded. read_filereads the original file, not the scratch copy.- A scratch journal written by 0.1.0 has no hash, so apply refuses it. Call
stage_discardbefore a demo. - Shell commands that hide a write (
python -c,dd) are not all caught.
What it touches
No network, no credentials, and no background process. Scratch copies, the journal, and apply receipts live under ~/.hermes/plugin-data/stage/. stage_apply copies those files onto the original paths inside the workspace, or deletes an original that was staged as a V4A delete. stage_discard deletes only the scratch copy.
Check
hermes plugins validate . --install-deps
README from the reviewed commit b298921; it updates when the author re-pins.

adindamochamad