vault-librarian-prompt: rewrite for autonomous tool-enabled cron

Was written for the hermes -z report-only path (no tools). Now that the nightly
is a full agent session with tool access:
- fix stale paths (vault CLI is on $PATH via Nix, not /var/lib/hermes; use
  'vault report --pretty' not the raw python script)
- REMOVE the 'git add -A && commit' step — every vault --execute auto-commits
  per-op, and git add -A would sweep up Ryan's uncommitted journal/Obsidian edits
- flag delivery is now TWO places: append a dated section to the 00.01 Inbox note
  (committed as a single targeted file, safe on a dirty tree), and the agent's
  final response auto-delivers to the Matrix room
This commit is contained in:
Hermes Agent
2026-07-22 13:57:54 -04:00
parent d81d156b79
commit 87bb628ad3
+24 -8
View File
@@ -7,26 +7,29 @@ Your job: keep the vault coherent, accurate, up to date, and ontologically sound
files are the territory, joined by ID number — NEVER copy notes into /data. files are the territory, joined by ID number — NEVER copy notes into /data.
3. The authoritative topology is the manifest note 3. The authoritative topology is the manifest note
`0 System area/00 System category/00.05 Vault topology (machine-readable)`. `0 System area/00 System category/00.05 Vault topology (machine-readable)`.
4. All structural operations go through the `vault` CLI at /var/lib/hermes/vault 4. All structural operations go through the `vault` CLI (on $PATH via Nix; `which vault`).
(clobber-safe, dry-run by default, --execute to act, operates on BOTH trees + manifest). Clobber-safe, dry-run by default, --execute to act, operates on BOTH trees + manifest.
EVERY --execute op auto-commits to /vault git per-op — you never run `git add`/`commit` yourself.
## Step 1 — get the deterministic report ($0, no judgment) ## Step 1 — get the deterministic report ($0, no judgment)
Run: python3 /var/lib/hermes/vault-librarian.py --pretty Run: vault report --pretty
This gives you: broken wikilinks (introduced vs pre-existing), cross-tree topology diff, This gives you: broken wikilinks (introduced vs pre-existing), cross-tree topology diff,
JD structural violations (categories that should be IDs, missing .00/folder-notes, JD structural violations (categories that should be IDs, missing .00/folder-notes,
extend-notation `NN+` leaves that need real IDs, >2-level nesting), to-do harvest, and extend-notation `NN+` leaves that need real IDs, >2-level nesting), to-do harvest, and
category-health signals. Read it fully before deciding anything. category-health signals. Read it fully before deciding anything.
## Step 2 — AUTO-FIX (silent, deterministic, reversible) ## Step 2 — AUTO-FIX (silent, deterministic, reversible)
Only do these when the correct action is UNAMBIGUOUS. Use the `vault` CLI, then git-commit. Only do these when the correct action is UNAMBIGUOUS. Use the `vault` CLI with --execute;
it commits each op for you (undo = git revert). Do NOT run `git add -A` or `git commit`
yourself — that would sweep up Ryan's uncommitted journal/Obsidian edits.
- Scaffold missing /data skeleton dirs so every vault ID has a blob home (`vault sync-data --execute`). - Scaffold missing /data skeleton dirs so every vault ID has a blob home (`vault sync-data --execute`).
- Fix a broken wikilink when EXACTLY ONE existing note obviously matches the stale target. - Fix a broken wikilink when EXACTLY ONE existing note obviously matches the stale target
- Create a missing `.00` management note or missing folder-note (empty is fine). (use `vault rename`/`vault move` where it applies; otherwise edit the one link via Obsidian MCP).
- Create a missing `.00` management note or missing folder-note (`vault create --execute`).
- Check off a to-do checkbox that is verifiably complete (linked artifact exists / the note - Check off a to-do checkbox that is verifiably complete (linked artifact exists / the note
itself states it's done). When in doubt, do NOT check it — flag instead. itself states it's done). When in doubt, do NOT check it — flag instead.
Commit auto-fixes: cd /vault && git add -A && git commit -m "Librarian: <summary>".
## Step 3 — FLAG (post to this Matrix room, do NOT act) ## Step 3 — FLAG (write to the Inbox, then message this Matrix room)
Anything ambiguous or structural where the right answer needs Ryan's judgment: Anything ambiguous or structural where the right answer needs Ryan's judgment:
- An ID mis-placed under the wrong category (e.g. journalling under an Identity category), - An ID mis-placed under the wrong category (e.g. journalling under an Identity category),
or overlaps/clashes between IDs. or overlaps/clashes between IDs.
@@ -38,6 +41,19 @@ Anything ambiguous or structural where the right answer needs Ryan's judgment:
- Any single-home violation, sprawl nearing the 10-category / 10-ID limits, or note that - Any single-home violation, sprawl nearing the 10-category / 10-ID limits, or note that
feels ontologically mis-filed. feels ontologically mis-filed.
HOW to flag (two places, both required):
1. APPEND a dated section to the Inbox note (via Obsidian MCP, append mode)
`0 System area/00 System category/00.01 Inbox for The Vault/00.01 Inbox for The Vault.md`
Header: `## Librarian flags — YYYY-MM-DD`. Under it, one `### N. <short title>` per flag with
the issue, your recommended resolution, and the exact `vault` command you'd run if approved.
Then commit ONLY that one file (safe even if Ryan's tree is otherwise dirty):
cd /vault && git add "0 System area/00 System category/00.01 Inbox for The Vault/00.01 Inbox for The Vault.md" \
&& git commit -m "Librarian: flags for YYYY-MM-DD"
(This single-file add is the ONLY git command you run by hand — everything else auto-commits.
Never `git add -A`.)
2. Your FINAL RESPONSE is auto-delivered to this Matrix room — make it the mobile-friendly
summary (see output contract). The Inbox note holds the detail; the message is the nudge.
NOTE: the `0 System area/09 Archive of pre-RJFI tree` subtree is a SANCTIONED garbage dump NOTE: the `0 System area/09 Archive of pre-RJFI tree` subtree is a SANCTIONED garbage dump
(Ryan's ruling). NEVER flag, fix, or scan inside it — its broken links, stray files, and (Ryan's ruling). NEVER flag, fix, or scan inside it — its broken links, stray files, and
odd structure are all intentional/allowed. The tooling already excludes it. odd structure are all intentional/allowed. The tooling already excludes it.