kanevry/session-orchestrator/vault-mirror
Claude Code and agent skill by kanevry/session-orchestrator
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when you need to populate the Meta-Vault with machine-generated notes derived from session-orchestrator JSONL records. Converts entries from `.orchestrator/metrics/sessions.jsonl` and `.orchestrator/metrics/learnings.jsonl` into vault-conformant Markdown under `50-sessions/` and `40-learnings/`. Called automatically at session-end Phase 3.7 and after evolve Phase 3.5 — only when `vault-integration.enabled=true` and `vault-integration.mode != "off"`. Idempotent: re-runs safely; skips hand-authored notes. Triggers: "mirror to vault", "sync session notes to vault", "write learning notes to vault", "vault-mirror failed at session close". <example>Context: session-end is finalizing, vault-integration.mode is "warn". user: "/close" assistant: "Running vault-mirror to write 50-sessions/session-2026-05-17.md from the closing session record — 1 created, 0 skipped."</example>
Install
npx vskill@latest install kanevry/session-orchestrator/vault-mirrorSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as kanevry/session-orchestrator/vault-mirror.
Vault Mirror Skill
Plugin root:${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Project-instruction file resolution:CLAUDE.mdandAGENTS.md(Codex CLI) are transparent aliases — see skills/_shared/instruction-file-resolution.md. When this skill mentions Session Config inCLAUDE.md, the alias rule applies.
Purpose
vault-mirror populates the Meta-Vault with machine-generated notes derived from structured JSONL records. It converts entries from .orchestrator/metrics/sessions.jsonl and .orchestrator/metrics/learnings.jsonl into vault-conformant Markdown files under numeric-prefix subdirectories. This is distinct from vault-sync, which validates the vault — vault-sync validates the vault; vault-mirror populates it. The two skills are complementary: vault-mirror writes notes, vault-sync checks that the vault as a whole remains conformant.
When Invoked
vault-mirror is called in two places:
- Phase 3.7 of session-end (
skills/session-end/session-metrics-write.md) — mirrors the sessions.jsonl entry for the closing session. - Phase 3.5 of evolve (
skills/evolve/SKILL.md) — mirrors all learnings.jsonl entries added during the evolve cycle.
Both call sites are conditional: vault-mirror runs only when vault-integration.enabled == true AND vault-integration.mode != "off" in the project's Session Config. When either condition is not met, the call site skips silently and vault-mirror is never invoked.
Inputs
scripts/vault-mirror.mjs is the implementation (call it by its plugin path, "${CLAUDE_PLUGIN_ROOT}/scripts/vault-mirror.mjs" — never cd into the plugin checkout to run it). --vault-dir, --source and --kind are required; node "${CLAUDE_PLUGIN_ROOT}/scripts/vault-mirror.mjs" --help lists every flag.
| Flag | Type | Required | Description | |
|---|---|---|---|---|
--vault-dir | path | yes | Absolute path to the Meta-Vault root directory. Must exist. | |
--source | path | yes | Path to the JSONL file to read (one JSON object per line). Must exist. Pass it absolute — a relative path resolves against the cwd. | |
--kind | session or learning | yes | Determines which generator and target path are used. | |
--repo-root | path | no | The repo whose ledger --source is (#1503). Its .vault.yaml slug / git remote decides the vault namespace. Default: the project holding --source (<root>/.orchestrator/metrics/<file> → <root>, so a monorepo package with its own .orchestrator/ keeps its own namespace), else the git repo containing it, else the cwd (only for a loose source outside any git repo, with a stderr WARN). Callers pass --repo-root "$PWD" from the repo root. | |
--dry-run | flag | no | Parse and resolve paths but do not write any files. Emits action lines as normal. |
Empty lines in the JSONL source are silently skipped.
Outputs
One JSON line is written to stdout for each non-empty JSONL entry processed. Exit code reflects the run outcome. Diagnostics (SKIP …, WARN …, refusals) go to stderr and are NOT JSON — a caller that captures 2>&1 must parse line by line (jq -R -r 'fromjson? | objects | …'), or one SKIP line ends the parse and drops every action after it.
Action values
action | Meaning | |
|---|---|---|
created | Entry did not exist in the vault; file created. | |
updated | Entry existed (generator marker present, same id) with an older updated date; file overwritten. | |
skipped-noop | Entry existed, same id, updated date not advanced; file unchanged. | |
skipped-handwritten | A file at the target path has no _generator marker (or an unknown generator); left untouched. | |
skipped-collision-resolved | A file at the target path has the generator marker but a different id; a disambiguated slug was used instead. | |
skipped-foreign-owner | A generator note at the target path was rendered from another record (#1503), and this write must not replace it. Sessions: its source-record differs from this write and occurs nowhere in this --source ledger (reason: "source-record mismatch"), or its id names a different session (reason: "id mismatch"). Learnings: only for the disambiguated <slug>-<uuid8>.md file — a mismatch on the main <slug>.md is routed to disambiguation instead (skipped-collision-resolved, see Idempotency rule 6). One SKIP foreign owner line goes to stderr; --force does not bypass it. A leak in the foreign note is masked in place — owner, content and source-record kept — and the line carries healed_leak: true. A note without source-record (written before #1503) stays writable. | |
skipped-invalid | Entry is missing one or more required fields; entry skipped, processing continues. | |
skipped-quality-low | Learning confidence below vault-mirror.quality.min-confidence (CLI: --quality-min-confidence, default 0.5), or a metrics-only session whose note ALREADY exists (left untouched; the pruner decides). Carries reason and path: null. Runs before --force; --force does not bypass it. | |
skipped-metrics-only | Session record below the narrative gate (#1513, see Retention): no note; one row was added to the month rollup 50-sessions/<repo>/_rollup-YYYY-MM.md (path). An unchanged rollup is skipped-noop. | |
skipped-expired | Learning past its expires_at with no note yet (#1513): nothing is created. | |
skipped-duplicate-insight | A mirror-owned, non-archived note in the same namespace (or the flat layout) already carries the same normalised insight (#1513); path names it. Only consulted where a NEW file would be created. |
Output line shape
path is relative to --vault-dir.
Exit codes
| Code | Meaning | |
|---|---|---|
0 | Success (including idempotent no-ops and per-entry skips). | |
1 | Malformed JSON on a JSONL line — fatal, processing stops. Also returned when required CLI args are missing. | |
2 | Filesystem error or pre-loop refusal: --vault-dir not found, vault not canonical, --source not found, --source in a different repo than --repo-root (source-repo-mismatch, #1503), or an unexpected write error. |
Target Paths
| Kind | Target | |
|---|---|---|
session | <vault-dir>/50-sessions/<repo>/<session-id>.md | |
learning | <vault-dir>/40-learnings/<repo>/<slug>.md |
Subdirectories are created automatically with mkdirSync({ recursive: true }) when writing (not in --dry-run mode).
The numeric prefix (50-sessions/, 40-learnings/) follows the vault folder ordering convention so that sessions and learnings appear in the correct position in the vault tree relative to other note types.
Per-project namespacing (#660). New writes are namespaced under a per-repo subdirectory <repo>/, so a single shared vault can hold notes from multiple projects without cross-repo slug/id collisions. <repo> is resolved by resolveRepoNamespace() (scripts/lib/vault-mirror/namespace.mjs): the optional vault-integration.vault-name Session Config key (CLI: --vault-name) when set, else the repo root's .vault.yaml slug, else its preferred git remote via deriveRepo(), sanitised to a single kebab segment. The repo root is --repo-root, else the project holding --source (<root>/.orchestrator/metrics/), else the git repo containing it, else the cwd — never the cwd when the source belongs to a project (#1503: running from another repo's checkout once wrote one project's ledger over another project's notes). Owner-privacy leaks (personal home path / private project slug / personal name) are redacted to redacted-repo before any write. The legacy flat layout (40-learnings/<slug>.md) is still read — the writer dual-probes the flat path so a pre-existing flat note is never duplicated; a one-time relocation of the historical flat corpus is tracked as a follow-up.
Path contract note: Issue #187 shipped the flat numeric-prefix layout (deferring the per-<repo> subfolder it sketched). Issue #660 adds that per-repo subfolder for write-isolation (above) while keeping the numeric-prefix ordering. If you need a different layout, file a new issue — do NOT silently change the script.
Learning-coverage self-healing after a store recovery (#740). vault-mirror always mirrors the CURRENT learnings.jsonl store contents at run time — if an earlier session's store was truncated or corrupted and later recovered (e.g. from a .bak), the resulting transient coverage gap in the vault is closed automatically by the next mirror run, with no manual backfill required. Note also that vault-mirror.quality.min-narrative-chars (see Retention below) gates sessions only — processLearning never applies a narrative-length filter, so a short learning insight is never skipped for length; only the confidence gate (vault-integration.quality.min-confidence) applies to learnings.
Host-local pseudonym mapping (Epic #725 D5). Without a map, EVERY owner-leaky repo namespace collapses to a single redacted-repo/ subdir — which breaks the #660 write-isolation (N private repos share one directory → id/slug collisions) and destroys cross-repo attribution. A host-local pseudonym map fixes this: each real repo slug is assigned a stable, non-leaky pseudonym, so the vault gets 40-learnings/<pseudonym>/ (and matching source-repo frontmatter, via W2's attribution threading) instead of everyone landing in redacted-repo/. The map is a JSON object { "real-slug": "pseudonym-slug", … } at a host-local path referenced by owner.yaml → paths.namespace-map-path (env SO_NAMESPACE_MAP overrides; precedence env > owner.yaml > unset). resolveRepoNamespace() consults the map ONLY at the redaction site (i.e. only when a repo would otherwise be redacted), looking up both the sanitised segment and the raw identifier; a hit returns the pseudonym and skips redaction, so clean/public repos never touch the map (or its lazy owner.yaml read). Privacy guarantee: the map file lives OUTSIDE every repo (alongside owner.yaml under ~/.config/session-orchestrator/) and is never committed — only the pseudonyms reach the vault, the real names stay host-local. Each pseudonym is validated (must be a kebab slug AND must not itself be owner-leaky); invalid or leaky pseudonyms are dropped with a WARN. Fallback: an absent, unreadable, or malformed map — and any UNMAPPED owner-leaky repo — still redacts to redacted-repo, identical to pre-#725 behaviour. Implementation: scripts/lib/vault-mirror/pseudonym-map.mjs (loadPseudonymMap) + namespace.mjs.
Retention (#1513)
The mirror used to write every record and never mark or remove anything; by 2026-10-03 the two zones were 78 % of the Meta-Vault, 91 % of the session notes carried nothing beyond git, and 2.826 expired learnings still read status: draft. The rules live in ONE module, scripts/lib/vault-mirror/retention.mjs, shared by the mirror and the pruner:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/vault-mirror/SKILL.md
Popularity
- Repository stars
- 52
- Repository forks
- 7
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kanevry/session-orchestrator/vault-mirror)