No slash command · from session-orchestrator
Validates Markdown frontmatter against a Zod schema and checks wiki-link integrity in a Meta-Vault. Runs as a session-end gate that can block close on errors.
Ships in session-orchestrator. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Project-instruction file resolution:
CLAUDE.mdandAGENTS.md(Codex CLI) are transparent aliases — see skills/_shared/instruction-file-resolution.md. The vault-marker check below treats either file as a valid marker (when it carries## Session Config+vault-sync:); references toCLAUDE.mdresolve via the SSOT precedence rule.
STATUS: PHASE 1 IMPLEMENTED (2026-04-13). Session-End hard gate (section 3.1) operational. Phase 2 (wave-executor incremental, 3.2) and Phase 3 (evolve advisory, 3.3) not yet implemented.
Phase 1 ships a self-contained validator that reads every .md file under VAULT_DIR, parses YAML frontmatter, validates against the canonical vaultFrontmatterSchema, and flags dangling wiki-links as warnings.
validator.mjs — Node.js ESM validator. Uses zod + yaml npm packages. Reads VAULT_DIR (env or default cwd), walks the tree, skipping node_modules/, .git/, .obsidian/. 90-archive/ is walked but never checked (#833): archived notes stay in the link-target register — so an inbound [[wiki-link]] to an archived note resolves instead of dangling — while their frontmatter is skipped and counted in archived_skipped_count. For each .md: parses frontmatter, validates against the inline Zod schema, extracts [[wiki-links]], verifies each target resolves. Emits JSON report on stdout.validator.sh — Thin POSIX wrapper. Resolves VAULT_DIR from arg 1 or env, checks that zod and yaml resolve from the skill directory, execs the Node validator. It never installs anything: unresolvable deps exit 2 with "reason":"setup-required" and the one setup command, npm ci in the plugin root (#1070). Session-end and other callers use this entry point.package.json — Declares zod (^4.6.7, the projects-baseline major) and yaml (^2.5.0) as deps. No lockfile is committed (skills/vault-sync/package-lock.json is gitignored at the repo root); node_modules/ is gitignored.tests/fixtures/ — Seven fixture vaults matching each test scenario.The inline Zod schema is vendored from the canonical source at projects-baseline/packages/zod-schemas/src/vault-frontmatter.ts. The skill is intentionally self-contained (no monorepo workspace dependency), so the schema is duplicated with a header comment pointing at the SSOT. Drift is to be caught by a future smoke test that imports the canonical schema and diffs the shape — NOT YET IMPLEMENTED. Until that test exists, any change to the canonical schema must be mirrored here in the same commit.
skills/vault-sync/package.json pins yaml ^2.5.0 / zod ^4.6.7 — the yaml range intentionally NOT the root's yaml ^2.9.0. This is not drift to fix:
npm ci, and .husky/pre-push links only the root node_modules/ into its tracked-tree clone. The nested install was dropped on 2026-10-05: it pulled unlocked zod/yaml versions (this folder's lockfile is gitignored) that the root npm audit never saw, and the vault-sync test files ran 125 passed / 0 failed without it.package.json declares no workspaces, so npm ci at the root never touches this folder's deps. Node resolves zod/yaml from this folder via the root's own dependencies (yaml ^2.9.0, zod ^4.6.7) — measured 2026-10-05 via import.meta.resolve('zod') from this folder → <root>/node_modules/zod, re-measured 2026-10-23 after the zod 4.6.7 bump (#1782) with the same result. That is the runtime path in CI, in every worktree and for every end user, so the root dependencies must stay. A stale local skills/vault-sync/node_modules/ from an older manual install would still win resolution; delete it if versions disagree.zod pin tracks the projects-baseline major (zod ^4.0.0 in packages/zod-schemas), not this repo's own version (scripts/release.mjs, evaluateDriftSweep comment). Its floor is 4.6.7 because every 4.x below 4.6.6 carries GHSA-mrhx-c7xc-m3w5 (#1782); the same floor sits in the root package.json, so both ranges resolve to one installed copy.The root's dependency versions are NOT the SSOT for this folder — do not "fix" this pin to match the root.
VAULT_DIR=/path/to/vault bash ~/Projects/session-orchestrator/skills/vault-sync/validator.sh
0 — vault valid (or skipped because no vault exists / no .md files). Warnings may still be present in the JSON report.1 — one or more validation errors. Session-end surfaces them in the quality gate report and refuses to close.2 — invalid invocation or infrastructure error. Two cases: (a) VAULT_DIR is not set and cwd does not look like a Meta-Vault (no _meta/, no .obsidian/, no CLAUDE.md or AGENTS.md with ## Session Config + vault-sync: block) — actionable error printed to stderr; (b) infrastructure error (missing node, missing validator.mjs, cannot bootstrap deps). In both cases no JSON is emitted to stdout.JSON output shape (stdout):
{
"status": "ok|invalid|skipped",
"vault_dir": "...",
"files_checked": N,
"files_skipped_no_frontmatter": N,
"errors": [{"file": "...", "path": "frontmatter.id", "message": "..."}],
"warnings": [{"file": "...", "type": "dangling-wiki-link", "message": "..."}]
}
Opt-in --check-expires flag downgrades expired notes to warnings; default off (Phase 1 leaves freshness for the Phase 3 evolve advisory).
The validator (both validator.mjs and the validator.sh wrapper) accepts:
--mode <hard|warn|off> — gate severity. hard (default) exits 1 on any frontmatter/schema error. warn exits 0 but still populates the errors array in the JSON output so callers can surface them as warnings. off short-circuits to status: "skipped-mode-off" — useful during onboarding when the gate is enabled but the vault is not yet clean.--exclude <glob> — repeatable. Glob patterns (relative to VAULT_DIR, POSIX-style forward slashes) matching files to skip. Supports ** (any number of segments), * (any chars except /), and ? (single char except /). Excluded files are counted in excluded_count and contribute nothing to errors/warnings. Example: --exclude "**/_MOC.md" --exclude "**/README.md".On every invocation — including bare validator.sh runs with no --exclude flags — the validator unconditionally reads vault-sync.exclude from <VAULT_DIR>/CLAUDE.md (or AGENTS.md on Codex CLI repos) and seeds the exclusion list with those globs first. CLI --exclude flags are additive: they extend the config-loaded list rather than replacing it. If CLAUDE.md is missing, unparseable, or has no vault-sync.exclude: block, the validator silently falls back to an empty config list and proceeds with CLI-only excludes. Required env: VAULT_DIR (resolved against cwd if absent).
--check-expires — flag expired notes (expires: date in the past) as warnings. Default off.Environment variables:
VAULT_DIR — directory to scan. Defaults to $PWD. Can also be passed as the first positional argument to validator.sh.Example invocation:
VAULT_DIR=~/Projects/vault bash validator.sh \
--mode warn \
--exclude "**/_MOC.md" \
--exclude "**/_overview.md" \
--exclude "**/README.md"
The JSON output always includes the mode and excluded_count fields when the validator runs past the mode-off / no-vault short-circuits.
A "project vault" is a markdown-based knowledge base living under vault/ at the project root. Each file carries strict YAML frontmatter (id, title, tags, status, created, expires, sources) and uses wiki-style links to cross-reference peer notes. The vault is consumed by two audiences: humans browsing the knowledge base, and Sophie-style RAG agents that embed and retrieve notes during chat. Because both audiences depend on the same content, drift is expensive: a stale status: verified note with a dead source URL quietly poisons retrieval results, and a broken wiki-link breaks both navigation and graph traversal.
Automated validation is therefore mandatory, not optional. The vault needs four kinds of checks: frontmatter schema conformance, wiki-link integrity, source whitelist enforcement (especially for regulated content like austrian-law that must cite only approved government URLs), and freshness (expires date in the past). Session-orchestrator is the right home for the in-session layer because every project with a vault will eventually want this, and session lifecycle hooks (wave boundaries, session end, evolve) are exactly the points where drift becomes visible.
The reference architecture is 3 layers:
.gitlab-ci.yml. Final gate, catches anything the other two miss.Layer B is the continuous freshness layer. Its job is to run inside normal session flow without requiring developers to remember to validate. If Layers A and C are the bookends, Layer B is the spine.
session-orchestrator:session-end skill as part of Phase 1 (quality gates), alongside typecheck / lint / test.full-validation-threshold (see Inputs).session-orchestrator:wave-executor after any wave whose agents modified files under vault/** (detected via git diff --name-only).$WAVE_START_REF..HEAD). Frontmatter and wiki-link resolution run on the touched files only; the source whitelist check runs on touched files only.session-orchestrator:evolve as part of learning extraction.status: verified whose expires date has passed, and optionally (opt-in via config) probes source URLs for 404s.VAULT_DIR — directory to scan for .md files. Defaults to $PWD. Can also be passed as the first positional argument to validator.sh.vault-sync section in CLAUDE.md (or AGENTS.md on Codex CLI):
vault-sync.enabled: true|false (default: false; when false, the gate is skipped silently)vault-sync.mode: hard|warn|off (default: warn via Session Config; hard blocks session close on errors, warn reports but does not block, off short-circuits to status: skipped-mode-off. Note: validator.sh invoked directly without --mode defaults to hard — the warn default applies only when dispatched by session-end.)vault-sync.vault-dir: <path> (default: project root $PWD; passed to the validator via VAULT_DIR)vault-sync.exclude: [<glob>, ...] (default: []; repeatable glob patterns — files matching any pattern are counted in excluded_count but not validated)The following fields are planned for Phase 2/3 but are not consumed by the current validator:
full-validation-threshold: N — files above this count trigger incremental mode instead of full scan (Phase 2, wave-executor)network-source-check: true|false — opt-in URL probe for source whitelist enforcement (Phase 3, evolve advisory){
"status": "ok|invalid|skipped|skipped-mode-off",
"mode": "hard|warn|off",
"vault_dir": "<absolute path>",
"files_checked": N,
"excluded_count": N,
"files_skipped_no_frontmatter": N,
"errors": [{ "file": "<relative path>", "path": "<frontmatter field path>", "message": "<description>" }],
"warnings": [{ "file": "<relative path>", "type": "dangling-wiki-link|expired", "message": "<description>" }]
}
When the validator short-circuits early (no vault directory, no .md files, or mode: off), the files_checked, excluded_count, and files_skipped_no_frontmatter fields may be omitted or zero. In warn mode, errors is still populated but status is "ok" so callers can surface findings without blocking.0 -- vault is valid (or scan was skipped for a legitimate reason)1 -- validation errors (one or more files failed a rule)2 -- invalid invocation (VAULT_DIR unset + cwd not a vault) or infrastructure error (validator command not found, validator crashed). No JSON emitted to stdout in this case.| Error Type | Severity | Action |
|---|---|---|
| Frontmatter schema violation (missing required field) | ERROR | Block (hard gate) / add fix task (wave-executor) |
| Wiki-link resolution failure | ERROR | Block (hard gate) / add fix task (wave-executor) |
| Source whitelist violation (austrian-law without approved URL) | ERROR | Block (hard gate) / add fix task (wave-executor) |
Stale note (expires date in past) | WARNING | Advisory only -- never blocks |
Validator command not found (pnpm vault:validate missing) | INFRA ERROR | Skip with clear warning; do NOT fail the session |
| Vault directory does not exist | INFO | Skip silently (project may not use vault) |
created: date, tag case normalization, trailing whitespace) or always error out and leave fixes to humans? Auto-fix is convenient but risky inside an AI-driven session because it writes to files that agents are simultaneously editing.vault-sync.enabled: false opt-out in Session Config? Silent skip is user-friendly but masks misconfiguration.vault/, or a project that references a sibling repo's vault via a git submodule? Is there a single VAULT_ROOT or a list?sources field, should the skill block on it (SEC-type check) or is that strictly the job of the existing secret-scan pre-commit hook?type valuesThe vault-frontmatter type enum currently allows:
note, daily, project, person, reference, idea, learning, session, peer-card.
The peer-card value supports Honcho-style USER.md / AGENT.md operator/agent identity files written under .orchestrator/peers/ (introduced in #503). Peer cards complement the host-wide owner.yaml (see .claude/rules/owner-persona.md) with per-repo behavioural identity; the validator at scripts/lib/peer-cards/schema.mjs enforces the additional target/source_sessions fields, while validator.mjs here only checks that type is one of the values above.
The canonical schema lives in the private GitLab monorepo:
projects-baseline/packages/zod-schemas/src/vault-frontmatter.ts
The vendored copy in validator.mjs is auto-generated — it is never edited by hand inside the sentinel block.
When the canonical schema changes:
session-orchestrator root:
node scripts/sync-vault-schema.mjs --write
validator.mjs change (only the schema block between sentinels changes).--check mode: it clones the canonical source and asserts that the vendored copy contains no drift. The pipeline fails if the generated output differs from what is currently committed.The schema block in validator.mjs is delimited by:
// ── BEGIN GENERATED SCHEMA (sync-vault-schema.mjs) — do not edit between sentinels ──
...
// ── END GENERATED SCHEMA ──
Never edit the content between these sentinels by hand. Any manual edit will be overwritten on the next --write run and will cause --check to report drift.
tests/schema-drift.test.mjs covers 5 scenarios via vitest:
--write twice produces identical output.validator.mjs.node scripts/sync-vault-schema.mjs [options]
| Flag / Env var | Description |
|---|---|
--write | Overwrite the vendored schema block in validator.mjs with the canonical source. |
--check | Exit 0 if vendored copy matches canonical; exit 1 if drift detected. Used in CI. |
--canonical <path> | Override path to the canonical .ts source file. |
--validator <path> | Override path to the target validator.mjs file. |
CANONICAL_VAULT_FRONTMATTER | Env var alternative to --canonical <path>. |
| Exit code | Meaning |
|---|---|
0 | No drift (--check) or write succeeded (--write). |
1 | Drift detected (--check only). |
2 | Source or target file not found. |
3 | Malformed sentinels (BEGIN/END markers missing or out of order in validator.mjs). |
The validator supports three operating modes via --mode=<value>. Default is hard (legacy enforcement).
| Mode | Purpose | Exit code |
|---|---|---|
baseline | Snapshot current errors+warnings into <vault-dir>/.orchestrator/metrics/vault-sync-baseline.json with schema-hash header | 0 |
diff | Show only NEW errors since baseline. Schema-hash mismatch falls back to full enforcement with WARN. | 0 if new_errors === [], 1 otherwise |
full | Legacy enforcement (same as hard). Reports all errors. | 0 if no errors, 1 otherwise |
hard | Alias of full (backward-compat). | as above |
warn | Reports errors but always exits 0. | 0 |
off | Skip validation entirely. | 0 |
{
"schema_hash": "a1b2c3d4",
"generated_at": "2026-05-08T05:30:00Z",
"vault_dir": "/Users/.../vault",
"error_count": 12,
"warning_count": 3,
"errors": [...],
"warnings": [...]
}
{
"new_errors": [...],
"resolved_errors": [...],
"baseline_count": 12,
"current_count": 14,
"schema_hash": "a1b2c3d4"
}
When the vendored zod schema in validator.mjs changes, the schema-hash in the baseline file won't match. The validator emits WARN: baseline outdated (hash=<old>, current=<new>) — please re-snapshot via --mode=baseline to stderr and falls back to full enforcement. Re-run --mode=baseline once to refresh.
A zod major bump does NOT change the schema-hash: the hash covers only the text between the sentinels, while errors[].message is zod's own default text wherever the schema sets no custom message, and the diff matches errors on file, path and message. After the 3 → 4 bump (#1782) a baseline saved under zod 3 that holds such an error (Required, Invalid enum value…, String must contain at least…) reports it as both new and resolved, without the WARN above. Re-run --mode=baseline once after a zod major bump. Ceiling: the hash does not fold in the zod major; revisit if a non-empty baseline ever reports such a pair (both measured baselines held 0 errors on 2026-10-23).
Inter-wave integration: the wave-executor Quality-Lite checkpoint prefers
--mode=diffonce a baseline exists, surfacing only regressions introduced by that wave. Seeskills/wave-executor/SKILL.md§ Vault-Sync Diff Reporting (#327).
<project>/scripts/vault/validate.ts -- reference implementation of the validator (Layer A/C entry point)<project>/scripts/vault/schema.ts -- frontmatter schema (Zod)<project>/.husky/pre-commit STEP 3.1 -- Layer A local gate example<project>/.gitlab-ci.yml vault:validate job -- Layer C remote gate example<project>/vault/_meta/frontmatter-schema.md -- human-readable schema docVAULT_VALIDATOR_CMD, executes it, parses exit code + JSON output, surfaces errors in the quality gate report. Acceptance: a session with a broken vault file refuses to close; a session with a clean vault closes with a "vault: valid (N files)" line in the report.vault/** was touched. Wave progress reports findings inline. Introduce full-validation-threshold config. Acceptance: a wave that edits one vault file triggers a scan of exactly that file (plus its backlink graph); findings appear in the wave summary; errors generate a fix task for the next wave.expires date check, optional network source check (gated behind network-source-check: true). Output goes to the evolve report as a non-blocking advisory. Acceptance: an evolve run over a vault with 3 expired notes produces an advisory listing all 3, with no impact on session success or exit code.package.json (opens in a new tab)tests/fixtures/archive-test-vault/90-archive/bad-archived.md (opens in a new tab)tests/fixtures/archive-test-vault/live-note.md (opens in a new tab)tests/fixtures/broken-frontmatter-vault/bad-type.md (opens in a new tab)tests/fixtures/broken-frontmatter-vault/good-note.md (opens in a new tab)tests/fixtures/clean-vault/01-projects/foo/projects-baseline.md (opens in a new tab)tests/fixtures/clean-vault/03-daily/daily-2026-04-13.md (opens in a new tab)tests/fixtures/clean-vault/README.md (opens in a new tab)tests/fixtures/clean-vault/hello-world.md (opens in a new tab)tests/fixtures/dangling-link-vault/has-dangling.md (opens in a new tab)tests/fixtures/dangling-link-vault/real-target.md (opens in a new tab)tests/fixtures/missing-field-vault/missing-id.md (opens in a new tab)tests/fixtures/nested-tag-vault/03-daily/daily-2026-04-13.md (opens in a new tab)tests/fixtures/nested-tag-vault/nested-tags-note.md (opens in a new tab)tests/fixtures/no-frontmatter-vault/README.md (opens in a new tab)tests/fixtures/no-frontmatter-vault/_MOC.md (opens in a new tab)tests/fixtures/with-moc-vault/_MOC.md (opens in a new tab)tests/fixtures/with-moc-vault/hello-world.md (opens in a new tab)tests/schema-drift.test.mjs (opens in a new tab)validator.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
haikuThree short reads, in order
npx claudepluginhub kanevry/session-orchestrator --plugin session-orchestrator55 skills in this plugin
/architectureUse when the user asks to improve architecture, find refactoring opportunities, surface deepening opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable. Surfaces shallow modules and hypothetical seams using a precise vocabulary (Module / Interface / Implementation / Depth / Seam / Adapter / Leverage / Locality from LANGUAGE.md)./autopilotUse this skill when running an autonomous session-orchestration loop. Chains session-start → session-plan → wave-executor → session-end for N iterations with all 10 kill-switches (SPIRAL, FAILED wave, carryover > 50%, max-hours, max-sessions, resource-overload, token-budget, stall-timeout, sub-threshold confidence, user-abort). Reads Mode-Selector output (Phase B) to decide auto-execute vs. fallback. Writes one autopilot.jsonl record per loop run. Phase C scaffold (issue #277); implementation lives in scripts/lib/autopilot.mjs (Phase C-1 follow-up).
/backlogUse when a repository's issue backlog needs refinement so agents can start work without asking back. Measures the tracker with scripts/backlog-refine.mjs (labels, readiness of status:ready issues, size, dependencies, epics, closed-issue hygiene), then proposes splits, epics, merges, fills and closings for approval and applies them through gitlab-ops. Triggered by /backlog [repo], "refine the backlog", "is the backlog ready for agents", "Backlog aufräumen". Not for finding code defects (use discovery), not for cross-repo dashboards (use portfolio), and not for creating issues from scratch./bootstrapUse this skill when scaffolding the minimum repository structure required by session-orchestrator. Invoked automatically by the Bootstrap Gate when CLAUDE.md, Session Config, or bootstrap.lock is missing. Also available as /bootstrap for manual invocation. Three intensity tiers: fast (demos/spikes), standard (MVPs), deep (production/team).
/brainstormUse when you have a feature idea but the scope or UX is still ambiguous — runs a lightweight Socratic design dialogue (3-5 AUQ rounds) and writes a spec markdown file. Use BEFORE /plan feature when product intent needs validation; skip to /plan feature when scope is already clear. HARD-GATE prevents any code work until the design is user-approved./claude-md-drift-checkUse when detecting drift between CLAUDE.md (or AGENTS.md, the Codex CLI alias) / _meta narrative and live repository state. Ten checks: absolute-path resolution, 01-projects/ count claims, issue-reference freshness, session-file existence, command-count sync, session-config-parity (mandatory template keys = error, opt-in gaps = note, unknown local keys = warning), vault-dir-parity (CLAUDE.md vs AGENTS.md), generated-rule-staleness (WARN-only), rule-scoping (paths:/globs: frontmatter defects, dangling rule citations, zero-match globs), and docs-parity (docs/components.md count-claims vs on-disk counts, template-vs-reference config-key parity, stale .claude/metrics/ paths). Full per-check spec in the body table. Invoked as an opt-in session-end phase; mirrors vault-sync's lean JSON+exit-code contract.
Other plugins' skills for the same job