kanevry/session-orchestrator/vault-sync
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 validate the Meta-Vault's Markdown frontmatter and wiki-link integrity before closing a session or after vault edits. Runs as a hard gate at session-end Phase 1 — blocks close if any `.md` file fails the Zod frontmatter schema or has dangling `[[wiki-links]]`. Supports three modes: `hard` (blocks on errors), `warn` (reports without blocking), `off` (skip). Reads `vault-sync.*` from Session Config; respects per-vault exclude globs from `CLAUDE.md`. Triggers: "vault validatio…
Install
npx vskill@latest install kanevry/session-orchestrator/vault-syncSemi-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-sync.
Vault Sync Skill
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
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.
Implementation
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.
Files
validator.mjs— Node.js ESM validator. Useszod+yamlnpm packages. ReadsVAULT_DIR(env or default cwd), walks the tree, skippingnode_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 inarchived_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. ResolvesVAULT_DIRfrom arg 1 or env, checks thatzodandyamlresolve 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 ciin the plugin root (#1070). Session-end and other callers use this entry point.package.json— Declareszod(^4.6.7, the projects-baseline major) andyaml(^2.5.0) as deps. No lockfile is committed (skills/vault-sync/package-lock.jsonis gitignored at the repo root);node_modules/is gitignored.tests/fixtures/— Seven fixture vaults matching each test scenario.
Schema source
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.
Dependencies
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:
- Nothing installs this sub-package. Neither CI host runs a nested install any more — both run only the root
npm ci, and.husky/pre-pushlinks only the rootnode_modules/into its tracked-tree clone. The nested install was dropped on 2026-10-05: it pulled unlockedzod/yamlversions (this folder's lockfile is gitignored) that the rootnpm auditnever saw, and the vault-sync test files ran 125 passed / 0 failed without it. - The root
package.jsondeclares noworkspaces, sonpm ciat the root never touches this folder's deps. Node resolveszod/yamlfrom this folder via the root's owndependencies(yaml ^2.9.0,zod ^4.6.7) — measured 2026-10-05 viaimport.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 localskills/vault-sync/node_modules/from an older manual install would still win resolution; delete it if versions disagree. - The
zodpin tracks the projects-baseline major (zod ^4.0.0inpackages/zod-schemas), not this repo's own version (scripts/release.mjs,evaluateDriftSweepcomment). Its floor is4.6.7because every 4.x below 4.6.6 carries GHSA-mrhx-c7xc-m3w5 (#1782); the same floor sits in the rootpackage.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.
How session-end invokes it
- Exit
0— vault valid (or skipped because no vault exists / no .md files). Warnings may still be present in the JSON report. - Exit
1— one or more validation errors. Session-end surfaces them in the quality gate report and refuses to close. - Exit
2— invalid invocation or infrastructure error. Two cases: (a)VAULT_DIRis not set andcwddoes not look like a Meta-Vault (no_meta/, no.obsidian/, noCLAUDE.mdorAGENTS.mdwith## Session Config+vault-sync:block) — actionable error printed to stderr; (b) infrastructure error (missingnode, missingvalidator.mjs, cannot bootstrap deps). In both cases no JSON is emitted to stdout.
JSON output shape (stdout):
Opt-in --check-expires flag downgrades expired notes to warnings; default off (Phase 1 leaves freshness for the Phase 3 evolve advisory).
CLI Flags
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.warnexits 0 but still populates theerrorsarray in the JSON output so callers can surface them as warnings.offshort-circuits tostatus: "skipped-mode-off"— useful during onboarding when the gate is enabled but the vault is not yet clean.--exclude <glob>— repeatable. Glob patterns (relative toVAULT_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 inexcluded_countand contribute nothing toerrors/warnings. Example:--exclude "**/_MOC.md" --exclude "**/README.md".
Bare-invocation config loading (#329)
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 tovalidator.sh.
Example invocation:
The JSON output always includes the mode and excluded_count fields when the validator runs past the mode-off / no-vault short-circuits.
Purpose
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:
- Layer A: local git hooks (pre-commit, pre-push) -- IMPLEMENTED in reference project. Fast, fail-early, blocks bad commits.
- Layer B: session-orchestrator:vault-sync skill (THIS SPEC) -- PENDING. Continuous freshness inside normal session flow.
- Layer C: remote CI job -- IMPLEMENTED in reference project's
.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.
Invocation Points
3.1 Session-End Hard Gate
- Trigger: called by
session-orchestrator:session-endskill as part of Phase 1 (quality gates), alongside typecheck / lint / test. - Behavior: full validation run over the entire vault. No incremental mode here -- a clean session close must prove the whole vault is valid.
- Error handling: validation errors block the session close. The session-end skill surfaces them in the quality gate report and refuses to commit until they are fixed.
- Rationale: a clean session must leave the vault in a valid state. This is the one place where the hard gate is non-negotiable.
- Timeout budget: ~30s for typical vaults (<500 files). Projects with larger vaults should override via
full-validation-threshold(see Inputs).
3.2 Wave-Executor Incremental Check
- Trigger: called by
session-orchestrator:wave-executorafter any wave whose agents modified files undervault/**(detected viagit diff --name-only). - Behavior: incremental validation scoped to the files changed in that wave (diff against
$WAVE_START_REF..HEAD). Frontmatter and wiki-link resolution run on the touched files only; the source whitelist check runs on touched files only. - Error handling: findings are reported inline in the wave progress output. Warnings do not block. Errors trigger a fix task for the next wave rather than aborting the current one -- the vault is a living document and incremental corrections are normal.
- Rationale: catch drift within a single session, not only at session end. A wave that introduces a broken wiki-link should surface it in the next wave's plan, not at the finish line.
3.3 Evolve Advisory Scan
- Trigger: called by
session-orchestrator:evolveas part of learning extraction. - Behavior: read-only freshness audit. Flags notes with
status: verifiedwhoseexpiresdate has passed, and optionally (opt-in via config) probes source URLs for 404s. - Error handling: output is an advisory section in the evolve report. Never blocks.
- Rationale: learning extraction is the moment when patterns surface. Staleness is a pattern. Surfacing it here turns vault maintenance into a natural byproduct of the evolve cycle.
Inputs
Phase 1 (implemented)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/vault-sync/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-sync)