/kvendra-skills:sync-claudemdfrom kvendra-skills
Regenerate a project's CLAUDE.md from the canonical template (the STD found by its scope and doc-template tags), preserving the Particularidades section. Also materialises the broker policy at .kvendra-protected from STD-{PROJ}-BROKER-POLICY. Detects manual_version + tier drift.
Ships in kvendra-skills. 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.
None: SKILL.md is the whole skill.
Regenerates the CLAUDE.md of the current project (or a specified one) from the canonical template entity in the KB (found by entity_query for entity_type: "STD" with tags_all: ["scope:claudemd", "playbook_type:doc-template"]) AND materialises the project's broker policy as .kvendra-protected at the workspace root from STD-<PROJECT>-BROKER-POLICY. Preserves the ## Particularidades section verbatim unless --force is passed. Detects drift in manual_version, tier and broker-policy synced_version and warns the user before regenerating.
This skill closes the lifecycle of the CLAUDE.md ultra-minimum model (per REQ-KVD-SKILLS-50F9E4) and the broker-policy materialisation lifecycle (per REQ-KVD-SKILLS-48062A) — onboard-project generates the initial CLAUDE.md + .kvendra-protected; sync-claudemd keeps both aligned with the evolving canonical sources; lint-claudemd verifies conformance.
Engine calls in this skill use the bare tool name (entity_get(...), txn_create(...)). Your client adds its own prefix: call the tool of that name on the Kvendra server, the MCP server that exposes whoami, help and entity_get, whatever its name (mcp__plugin_kvendra-skills_kvendra-cloud__* from this plugin, mcp__claude_ai_<connector>__* from a claude.ai connector, mcp__<name>__* from claude mcp add, no prefix in other clients). Load its tools first if they are deferred. The local broker kvendra (kvendra_git, kvendra_aws…) is not the Kvendra server. If more than one server exposes them (for example the plugin server with a directory's KVENDRA_WS and a claude.ai connector on the default account), use the plugin server: it carries this directory's account. Without the plugin server, ask the user which one to use. Never mix two Kvendra servers in one task. If no server exposes those three tools, stop and tell the user the Kvendra environment is not available.
This skill respects the project's broker policy declared in
STD-<PROJ>-BROKER-POLICY and materialised at .kvendra-protected.
See help({topic:"broker-policy"}) for the schema and resolution
order. Ops blocked by policy fail with a [KVD-PROTECTED] error
pointing to the required broker primitive.
$ARGUMENTS may be:
<PROJECT_ID> (uppercase 3-6 chars) → regen for that project. Default: project_id from <cwd>/CLAUDE.md Project section.--dry-run → show the diff vs the would-be regenerated CLAUDE.md AND .kvendra-protected, do NOT write.--force → overwrite the Particularidades section too (DESTRUCTIVE).--policy-only → write only .kvendra-protected (broker policy), leave CLAUDE.md untouched. Useful when the policy STD evolves independently of the CLAUDE.md template.--enable-break-glass → opt this project into the additive break_glass: block (IF-840EE9 1.1) even if the STD does not set break_glass.enabled: true. Pins the local kvendra grant-pubkey into .kvendra-protected (see Step 6.3b). No-op if the project is already opted in.Syncs both CLAUDE.md AND .kvendra-protected. Each side is idempotent (no-op if local copy already matches its canonical KB source).
Identify project_id from $ARGUMENTS or from the current workspace CLAUDE.md (Project section, project_id: line).
If the MCP for the project's tier (read from current CLAUDE.md tier: line) does not respond, or the canonical template cannot be fetched, STOP and notify the user with the canonical message. NO Bash fallback to write the CLAUDE.md from memory.
Standard rules apply (see help({topic:"bootstrap"}) + help({topic:"naming"}) + help({topic:"txn"})). This skill writes one file on disk — no KB entities created. NO TXN required.
KB entities return private-value references raw ({{cfg:<key>}}), and this
skill writes them to CLAUDE.md and .kvendra-protected exactly as they
are. It never resolves a reference, never calls private_value_resolve, and
never replaces a reference with a value, a guess or a placeholder. Escaped
mentions (leading backslash) are copied verbatim too. Resolving is the
user's job, according to their role: with private_value_resolve or in the
Kvendra dashboard. This keeps values out of files that are versioned or
shared (owner decision 2026-10-07, ISSUE-KVD-SKILLS-BCC361).
An unescaped reference is {{cfg: + a concrete key (grammar
[a-z0-9][a-z0-9._-]{0,127}) + }} with no leading backslash; the generic
{{cfg:<key>}} of the note itself does not count. When a generated file
contains at least one unescaped reference, it carries
a one-line note saying so (the exact text is in Step 4 for CLAUDE.md and in
Step 6.6 for .kvendra-protected). When no reference remains, the note is
removed, so the output stays idempotent. List the keys found in the report;
never their values.
Local references ({{lvr:<key>}}) follow the same rule: copied verbatim,
never resolved, never replaced. They do not trigger the private-refs note —
they are per-machine values that only the kvendra broker substitutes, at
call time, from the owner's local vault; there is nothing to resolve in the
KB. List their keys in the report too.
The canonical template ships bundled with the plugin at <plugin-root>/CLAUDE.md.template. The KB STD entity is an optional discoverable mirror used for cross-session/cross-project audit and version comparison.
Read <plugin-root>/CLAUDE.md.template (resolved via the cwd of the agent or the plugin cache path). This is the canonical source: ships atomically with the plugin version, never out-of-sync with itself.
Extract from the file:
<!-- manual_version: X.Y --> → canonical version.If the file is missing or malformed: STOP and tell the user the plugin install is corrupted. Recommend /plugin update kvendra-skills to repair.
Look up the canonical STD by tags (not by literal id — force_id is reserved for PRJ/CMP/REL in the KB, so the entity id is server-generated). Well-known coordinate:
entity_query({
entity_type: "STD",
project_id: "KVD",
tags_all: ["scope:claudemd", "scope:template"],
status: "active",
order_by: "updated_at_desc",
limit: 1
})
metadata.manual_version with the local file's version (drift detection in Step 3).Read <cwd>/CLAUDE.md (or compute the workspace_root for the target project from PRJ-<PROJECT_ID>.metadata.workspace_layout if <cwd> is not the project root).
If the file does not exist: tell the user to run /onboard-project <PROJECT_ID> first. Do NOT auto-onboard from this skill.
Parse the file structure:
<!-- manual_version: X.Y --> from the first HTML comment.<!-- KVENDRA:MANUAL --> and <!-- /KVENDRA:MANUAL --> (current Manual section).<!-- KVENDRA:PROJECT --> and <!-- /KVENDRA:PROJECT --> (current Project section, including current tier: value).## Particulars heading — or the legacy ## Particularidades heading — to EOF (current Particulars section). Keep the heading the file already uses: a legacy Spanish heading is preserved verbatim, never reported as drift. A file with neither heading gets the template's ## Particulars. Canonical message: line inside the Manual section (current fail-safe message).The fail-safe message is the one Manual line a project may localise. The template ships it in English; a project may keep its own language. The known Spanish variant is "El entorno Kvendra no está disponible. Reconecta antes de avanzar — operar sin Kvendra rompe más de lo que arregla." Both are the same message: a difference in language alone is never drift.
If any marker is missing: tell the user the file is not conformant — recommend running /lint-claudemd first.
manual_version < canonical from STD → warn the user before applying. Show the diff between local Manual and canonical Manual.manual_version == canonical → Manual section unchanged. No regen needed for that section (but Project + Particularidades may still need updates).manual_version > canonical → suspicious (downgrade). Show the version mismatch and ask the user how to proceed.Call whoami and compare its tier with the CLAUDE.md tier: line.
pro → free (subscription change). Ask if the user wants to update the flag.whoami says pro but CLAUDE.md says free → likely the user upgraded and forgot. Suggest updating.The user has the final say. The skill does NOT silently change tier:.
Render the canonical template with substitutions:
{{PROJECT_ID}} → project_id (verified from the existing CLAUDE.md or PRJ.entity_id).{{TIER}} → tier resolved in Step 3 (with user's confirmation if drift detected).{{PARTICULARITIES}} → existing Particularidades section verbatim (or empty placeholder if --force is passed). Private-value references in it stay as they are.Canonical message: line → keep the project's existing line verbatim, like Particularidades, when it is the same message in another language (for example the Spanish variant). Use the template's English line only when the file has none, or with --force. Never list a language-only difference in the drift report or the diff.If the rendered file contains an unescaped {{cfg:<key>}} reference, insert this
HTML comment as line 2, right after the manual_version comment (it counts
toward the 40-line target):
<!-- kvendra:private-refs — this file contains private-value references ({{cfg:<key>}}) kept unresolved on purpose. Resolve them with private_value_resolve or the Kvendra dashboard, according to your role. -->
--dry-run modePrint a unified diff between the existing CLAUDE.md and the would-be regenerated version. Exit without writing. No KB writes either.
--force was NOT passed and Particularidades would be affected by the regen: STOP and ask the user. Default refusal — protect user data.--force modeReplace the entire file with the rendered template. Particularidades becomes empty (placeholder). DESTRUCTIVE — confirm one more time with the user before writing.
After writing, run the same checks lint-claudemd would run on the new file:
manual_version matches canonical.tier is valid enum.If any check fails, the regen produced a malformed file. STOP and recommend rollback via git checkout -- CLAUDE.md (the user is expected to have committed before running this skill).
## sync-claudemd: <PROJECT_ID>
### Source of canonical template
canonical template STD manual_version: <canonical>
### Drift detected
- manual_version: <local> → <canonical> (<no-drift|upgrade|downgrade|warning>)
- tier: <local> → <whoami> (<no-drift|change-confirmed|change-declined>)
### Diff (unified, --dry-run if applicable)
<diff>
### Result
<written | dry-run-only | aborted-by-user | failed-verification>
### Post-write verification
- Lines: <N> (≤40 target)
- 3 sections: <present|missing>
- manual_version: <X.Y>
- tier: <free|pro|team|enterprise>
- Particularidades: preserved
- Fail-safe message: preserved (<language>) | template (EN)
- Private-value references: none | <N> kept unresolved (keys: <list>), note present
### Next steps
- Commit the regenerated CLAUDE.md if it's the intended result.
- Run /lint-claudemd to double-check conformance.
- If the regen revealed drift in canonical Manual content, take note — the project's onboarding model has evolved and may apply to other projects too.
.kvendra-protected (broker policy)This step runs in the default mode (no flags) AND in --policy-only mode. In --policy-only mode, Steps 1-5 (CLAUDE.md side) are skipped.
Use tag-based discovery (per PAT-KVD-577667) — force_id only applies to PRJ/CMP/REL:
entity_query({
entity_type: "STD",
project_id: "<PROJECT>",
tags_all: ["scope:broker-policy", "playbook_type:broker-policy"],
status: "active",
order_by: "updated_at_desc",
limit: 1
})
0 results → FAIL-SAFE per ADR-KVD-SKILLS-BB0E8A. STOP and surface the canonical message:
"No
STD-<PROJECT>-BROKER-POLICYexists. Run/onboard-projectif this is a new project, or/requirements-analystto define one."
No improvisation, no inlined default policy.
1 result → continue. Record the STD's entity_id (will be written verbatim as std_id in the YAML payload) and version (will be written as synced_version).
>1 results → pick [0] (most recent), surface a WARNING and recommend archiving older duplicates.
If the STD read in Step 6.1 carries metadata.broker_install_skipped: true, the project has deliberately opted out of a workspace marker (see the broker-discovery step of onboard-project). Do NOT write .kvendra-protected, in default mode or under --policy-only. Report policy: not materialised (broker-less) and end the Step 6 branch.
.kvendra-protected exists at the workspace root regardless, do not delete it and do not rewrite it. Surface a WARNING: file and KB contract disagree, and the file wins at runtime, because the hook reads only the file.broker_install_skipped on the STD (this skill never writes to the KB), then re-run /sync-claudemd --policy-only.If a component context is in scope (cwd inside a known CMP.metadata.workspace_subdir), also query with component_id set to the bare component code (uppercase A-Z and digits, the component segment of the ids: TOY in CMP-ACME-TOY-1A2B3C; never the CMP id and never <PROJ>-<COMP>, which the engine rejects):
entity_query({
entity_type: "STD",
project_id: "<PROJECT>",
component_id: "<COMP>",
tags_all: ["scope:broker-policy"],
status: "active",
order_by: "updated_at_desc",
limit: 1
})
block_bash regex / require_broker entries; they MAY NOT remove or weaken PROJ-level entries.cmp_overrides_applied[] of the YAML provenance block.Extract from the STD content the canonical YAML block under ## Steps step 3 (the payload inside the fenced yaml … block). Substitute provenance:
schema_version ← STD.metadata.schema_version (or 1 default).std_id ← STD's entity_id.synced_version ← STD's version field.synced_at ← current ISO8601 UTC timestamp.synced_by ← "skill:sync-claudemd".cmp_overrides_applied ← list of CMP STD ids merged in Step 6.2.checksum ← sha256 hex of the STD-derived policy body: everything from mode: down to the last key rendered from the STD, break_glass: included (Step 6.3b). Additive blocks of local origin that no STD produces — broker_capabilities_seen: (Step 6.6b) — sit below that body and are EXCLUDED from the hash, so a refreshed snapshot never reads as policy drift in Step 6.4.The broker policy schema is extended additively with an optional
break_glass: mapping (IF-KVD-SKILLS-BROKER-POLICY 1.0 → 1.1). This is a
purely additive block — the schema_version field of .kvendra-protected
is NOT bumped (it stays 1); hook v2 reads break_glass when present and
ignores it when absent, so old and new files remain mutually compatible
(NFR-COMPAT-1).
A project opts into break-glass when its STD-<PROJECT>-BROKER-POLICY
declares break_glass.enabled: true in its canonical YAML payload (Step 6.3),
OR when the operator passes --enable-break-glass to this skill. If the
project does NOT opt in, skip this sub-step entirely and write the file with
no break_glass: block (byte-for-byte identical to the pre-1.1 output).
When the project opts in:
Obtain the local grant-signing public key (auth-less, no vault unlock, no master password):
kvendra grant-pubkey
verify-grant checks signatures against.kvendra is not on PATH → WARN and write the file with
break_glass.enabled: false and an empty pubkey_ed25519. Do NOT block
the whole sync; the hook fail-closes on a missing/empty pubkey anyway.kvendra grant-pubkey errors with "no grant signing key — run
kvendra bypass … once to generate it": the signing keypair has not been
created yet. Surface that message to the operator (they must run a
kvendra bypass once, from their own terminal, to generate it), and write
enabled: true with an empty pubkey_ed25519 so the hook fail-closes
until the key exists. Re-run /sync-claudemd --policy-only after the first
bypass to fill in the pubkey.Populate the break_glass: block in the rendered YAML payload:
break_glass:
enabled: true
pubkey_ed25519: "<output of kvendra grant-pubkey>"
grant_path: ".kvendra-grant" # informational; the CLI resolves the
# active grant from the local session.
Place the block as a top-level mapping (siblings: mode, block_bash,
allow_bash, require_broker). Keep enabled a bare YAML bool
(true/false), pubkey_ed25519 a double-quoted string.
Idempotency: pinning the pubkey is idempotent — kvendra grant-pubkey
returns the same key across runs (it only changes if the operator runs
kvendra bypass --rotate-key). Re-running the skill with an unchanged key
produces no diff.
Recompute the checksum (Step 6.3) over the canonical YAML body
INCLUDING the newly added break_glass: block, so Step 6.4's idempotency
check stays accurate. The break_glass block is part of the body hashed by
the checksum (everything from mode: down).
Schema-change record (IF-KVD-SKILLS-BROKER-POLICY): version
1.0 → 1.1, additivebreak_glass: { enabled: bool, pubkey_ed25519: string, grant_path: string? }.schema_version(file field) stays1. Consumers that predate 1.1 ignore the block; hook v2 honours it. Documented here per the change to ISSUE-KVD-SKILLS-924CAF.
Read existing .kvendra-protected if present. If:
schema_version == new schema_version, ANDsynced_version == new synced_version, ANDchecksum recomputes to itself (file body matches),then NO write is performed (no-op). Report policy: no-op (up to date).
mode must be one of strict|permissive|hybrid.block_bash, allow_bash, require_broker must be arrays (possibly empty).block_bash / allow_bash / require_broker[].op_pattern must compile under grep -E without error. Validate each pattern individually; on first failure, STOP and surface the offending pattern.require_broker[].primitive must be one of kvendra.git|kvendra.github|kvendra.aws|kvendra.npm|kvendra.pypi|kvendra.http|kvendra.shell.break_glass: block is present (IF-840EE9 1.1): enabled must be a bool; when enabled: true, pubkey_ed25519 must be a non-empty base64 string (44 chars for ed25519) OR explicitly empty only in the deferred-key case of Step 6.3b (hook fail-closes on empty). grant_path is an optional string.Validation runs on the text as written, references included. If a pattern fails only because of a reference, STOP and report the key: do not resolve it to make the check pass.
If any validation fails, STOP — do NOT write a broken policy file.
.kvendra-protectedWrite the YAML payload to the workspace root (resolved from PRJ.metadata.workspace_layout + <cwd>). Preserve the canonical header comment:
# synced from <std_id> (do not edit by hand — run /sync-claudemd --policy-only)
If the payload contains an unescaped {{cfg:<key>}} reference, add this second
header line. It sits above mode:, so it stays outside the checksum:
# kvendra:private-refs — contains private-value references ({{cfg:<key>}}) kept unresolved on purpose. Resolve them with private_value_resolve or the Kvendra dashboard, according to your role.
The file is rewritten atomically: write to .kvendra-protected.new, then mv over the existing one.
Step 6.6 renders the file from the STD payload, so any top-level block the STD does not produce is lost on every re-sync. One such block exists: broker_capabilities_seen:, written by the broker-discovery step of onboard-project as local telemetry for drift detection.
Immediately prior to the atomic replace, read the outgoing file and carry the block over:
broker_capabilities_seen, from that key down to the next top-level key or end of file.break_glass: when present, and keep it out of the checksum (Step 6.3).If the outgoing file is absent or holds no such block, this sub-step is a no-op.
If the KB query in 6.1 errors (broker / MCP unreachable): STOP with the canonical message "The Kvendra environment is not available. Reconnect before going on — working without Kvendra breaks more than it fixes." (or the project's localised variant from its CLAUDE.md, e.g. "El entorno Kvendra no está disponible. Reconecta antes de avanzar — operar sin Kvendra rompe más de lo que arregla."). Do NOT fall back to a hardcoded policy in this skill — the hook v2 has its own transition fallback for legacy markers.
.kvendra-protected no-op per Step 6.4).{{cfg:<key>}} reaches the files as-is, with the kvendra:private-refs note. The user resolves them with private_value_resolve or the dashboard.kvendra-platform local (tier:free) and kvendra-cloud Enterprise (tier:pro+).--policy-only flag is the canonical surface for re-syncing .kvendra-protected independently of CLAUDE.md drift..kvendra-protected. A missing marker is the contract's no-enforcement state, not a defect to repair: this skill materialises a marker only for projects whose STD does not carry broker_install_skipped.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kvendraai/kvendra-skills --plugin kvendra-skills28 skills in this plugin
/analyzerTechnical analyst — takes a bug report and produces a root-cause analysis with exact files and lines, using the Kvendra KB/bugBug-testing pipeline orchestrator — coordinates 6 subagents with TXN, draft/active entities, and Kvendra KB traceability/changelogChange query tool — shows what changed, who, when and why, reading entity history (entity_get with include_history) and REL membership from the Kvendra KB/deployDeploy a Kvendra component (e.g. CMP-KVD-WEB, CMP-KVD-ENTERPRISE) by executing the canonical deploy playbook from the KB. Generic, model-agnostic, STD-driven — no tech specifics in this skill.Other plugins' skills for the same job