From cogni-knowledge
Run a read-only structural health check on a cogni-knowledge base — page/link/schema integrity plus entries-count and claim drift for the bound wiki. Use this skill whenever the user says 'check knowledge health', 'knowledge health', 'is my knowledge base healthy', 'audit the knowledge base structure', 'knowledge integrity check', 'health-check the wiki', or wants a structural verdict on a bound base without running the research pipeline.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cogni-knowledge:knowledge-healthThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Give the user a fast, grounded **structural health verdict** for a cogni-knowledge base — the page/link/schema integrity of the bound wiki, plus entries-count drift and claim drift. This is the standalone analog of `cogni-wiki:wiki-health`, computed **natively on the vendored `health.py` engine** (resolved vendored-first via `resolve_wiki_scripts()`), so a Karpathy base is health-checkable with...
Give the user a fast, grounded structural health verdict for a cogni-knowledge base — the page/link/schema integrity of the bound wiki, plus entries-count drift and claim drift. This is the standalone analog of cogni-wiki:wiki-health, computed natively on the vendored health.py engine (resolved vendored-first via resolve_wiki_scripts()), so a Karpathy base is health-checkable with no cogni-wiki plugin installed.
This skill is fully read-only — health.py writes nothing (it emits JSON to stdout only). The health-check log line the retired cogni-wiki:wiki-health dispatch used to append was a workflow step of that skill, not of the engine; the native path has no append step.
Read ${CLAUDE_PLUGIN_ROOT}/references/delegation-contract.md once at the start of a session so you remember the wiki-engine boundary — cogni-knowledge computes the health verdict on the vendored wiki-health engine, it does not dispatch cogni-wiki:wiki-health.
knowledge-ingest or a knowledge-finalize run, to confirm the base is still structurally sound.cogni-knowledge/binding.json and the user asks "is everything OK?".cogni-knowledge/binding.json — offer knowledge-setup instead.knowledge-resume runs the same health.py engine for its one-line verdict but layers a full status overlay (deposited projects, next action). Use knowledge-health when you want the structural detail only, without the binding overlay.knowledge-lint is the semantic pass (stale pages, claim drift, reverse-link repair with --fix). knowledge-health is the cheap structural gate; knowledge-lint is the tokenful curation pass. Run health first; reach for lint when health flags drift you want to fix.| Parameter | Required | Description |
|---|---|---|
--knowledge-slug | Yes | Slug of the knowledge base to check. Resolves to cogni-knowledge/<slug>/ unless --knowledge-root overrides. |
--knowledge-root | No | Override the default knowledge-base directory. |
Required engine. This skill computes the health verdict on the vendored wiki-health engine — cogni-knowledge ships a byte-identical copy in-tree under scripts/vendor/cogni-wiki/, so a bound base shows its health without cogni-wiki installed. The cogni-wiki install is only a fallback layout. Probe both so the skill aborts cleanly here rather than failing mid-skill:
# vendored-first: the in-tree wiki-health scripts are self-contained
test -d "${CLAUDE_PLUGIN_ROOT}/scripts/vendor/cogni-wiki/skills/wiki-health/scripts" && WIKI_OK=yes || WIKI_OK=no
# fallback: an installed cogni-wiki sibling / marketplace cache (legacy layout)
if [ "$WIKI_OK" = "no" ]; then
probe_plugin() {
local plugin="$1" skill="$2"
test -f "${CLAUDE_PLUGIN_ROOT}/../${plugin}/skills/${skill}/SKILL.md" && return 0
for d in "${CLAUDE_PLUGIN_ROOT}/../../${plugin}/"*/skills/"${skill}"/SKILL.md; do
[ -f "$d" ] && return 0
done
return 1
}
probe_plugin cogni-wiki wiki-setup && WIKI_OK=yes || WIKI_OK=no
fi
If WIKI_OK is no, abort:
cogni-knowledge's vendored wiki-health scripts are missing and no
cogni-wikiinstall was found. Reinstall cogni-knowledge, then retry.
This probe is the early-abort gate only — Step 2's resolve_wiki_scripts is the authoritative resolver for the actual health.py path; keep the two vendored-first precedences in sync.
Resolve knowledge_root:
--knowledge-root is set, use it.knowledge_root = cogni-knowledge/<knowledge-slug>/ (relative to the current working directory).Read the binding:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/knowledge-binding.py read \
--knowledge-root <knowledge_root>
On success: false, abort and offer knowledge-setup. Do not auto-create.
Extract from the binding: knowledge_slug, knowledge_title, wiki_path. Note that wiki_path is read straight from the binding here and not pre-validated at this step — health.py in Step 2 is the authoritative validator of wiki_path / config.json (it is what surfaces a missing or broken wiki path, per the Edge-cases section below).
Validate the binding's knowledge_slug matches --knowledge-slug. Mismatch → abort.
health.py)Resolve the vendored wiki-health scripts dir vendored-first (the same resolve_wiki_scripts posture knowledge-resume / knowledge-dashboard use), then invoke health.py directly — no Skill dispatch:
. "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-wiki-scripts.sh"
WIKI_HEALTH_SCRIPTS=$(resolve_wiki_scripts wiki-health health.py) \
|| abort "cogni-wiki wiki-health scripts not found (vendored copy missing)"
Run the vendored health.py against the bound wiki (it resolves _wikilib itself; fully read-only — JSON to stdout, no file writes):
python3 "${WIKI_HEALTH_SCRIPTS}/health.py" --wiki-root "<wiki_path>"
On a curated-layout base (schema_version >= 0.0.8) the engine additionally asserts the layout shape:
curated_layout_violation (error) — a control file (log.md / context_brief.md / open_questions.md) at the flat wiki/ root, a missing wiki/meta/, or an overview.md still carrying the narrative machine block. Repair: knowledge-lint --fix=misplaced_control_files.missing_subindex (warning) — a sub-indexed type dir with pages but no index.md. Repair: knowledge-index.schema_version_lag (warning) — the base's config.json schema_version trails the engine's current expected structure (ENGINE_SCHEMA), so it predates a curated-layout contract the engine now produces. Repair: knowledge-index --migrate.structural_drift (warning) — a machine-owned curated front-door region a completed phase should have populated is still on its bootstrap state: the index.md OVERVIEW-NARRATIVE block still carries the finalize placeholder, or a ROOT-LINKS span has no theme-scoped deep links. Repair: re-run knowledge-finalize (or knowledge-index) to regenerate the front door. These two structural-drift classes are read-only and fail-soft, never fire on a pre-0.0.8 base, and move the verdict OK -> WARN (never a hard error).render_engine_lag (warning) — the base's curated indexes were rendered by an engine version behind the installed one (its stamped last_rendered_engine_version trails ENGINE_RENDER_VERSION), or carry no engine stamp at all, so a shipped index-renderer upgrade has not been re-rendered into this base. Repair: run knowledge-index to rebuild the indexes (which re-stamps the engine version). Read-only and fail-soft, same posture as schema_version_lag; never fires on a pre-0.0.8 base.entries_count and the page walk; pre-0.0.8 bases are untouched by these assertions.Parse the JSON envelope {success, data, error}. On success: false (e.g. <wiki_path>/.cogni-wiki/config.json absent), surface error and stop. Otherwise capture data.errors, data.warnings, and data.stats (pages_audited, entries_count_config, entries_count_actual, entries_count_drift, claim_drift_count).
Print a compact verdict block:
<knowledge_title> (<knowledge_slug>) — <wiki_path>data.errors is empty, else <N> error(s) — <first error class(es)>.<pages_audited> pages audited · entries config/actual <config>/<actual> + · entries drift <±N> when entries_count_drift != 0 + · claim drift <N> when claim_drift_count > 0.data.errors is non-empty, list each (cap 20, "and N more" for the rest) — each as its class + the affected page/link.data.warnings is non-empty, list each the same way (cap 10).knowledge-lint --knowledge-slug <slug> for the semantic pass (stale pages, claim drift) when you want it."knowledge-lint --knowledge-slug <slug> --fix=all to reconcile, then re-run health."knowledge-lint --knowledge-slug <slug> --fix=all repairs the mechanical classes; the rest need a manual look." A curated_layout_violation repairs via knowledge-lint --knowledge-slug <slug> --fix=misplaced_control_files.missing_subindex warning present (any verdict state) → "Re-render the per-type sub-indexes via knowledge-index."schema_version_lag warning present → "Schema behind the engine — run knowledge-index --migrate to converge the curated layout."structural_drift warning present → "Curated front door degraded (placeholder overview / empty root-links) — re-run knowledge-finalize (or knowledge-index) to regenerate it."render_engine_lag warning present → "Indexes rendered by an older engine — run knowledge-index to rebuild and re-stamp the renderer version."wiki_path no longer does. health.py returns success: false (missing .cogni-wiki/config.json). Surface its error and stop with a clear message.health.py fails for another reason. Surface its error verbatim; do not fabricate a verdict.wiki-lint pass — that is knowledge-lint, a deliberate tokenful pass the user invokes separately.cogni-wiki:wiki-health — the verdict is computed natively on the vendored engine.health.py emits JSON to stdout, nothing else).A health verdict block printed to the user. No files written.
${CLAUDE_PLUGIN_ROOT}/references/delegation-contract.md — delegation boundary (wiki health computed natively on the vendored engine)${CLAUDE_PLUGIN_ROOT}/scripts/vendor/cogni-wiki/skills/wiki-health/scripts/health.py — the vendored health engine invoked in Step 2${CLAUDE_PLUGIN_ROOT}/scripts/knowledge-binding.py --helpnpx claudepluginhub cogni-work/insight-wave --plugin cogni-knowledgeRun semantic lint on a cogni-knowledge base — surface stale pages/drafts, claim drift, and broken reverse links, optionally repairing the mechanical classes with --fix. Use this skill whenever the user says 'lint the knowledge base', 'knowledge lint', 'fix knowledge drift', 'clean up the wiki', 'repair reverse links', 'reconcile entries count', 'fix misplaced control files / a curated_layout_violation', 'what's stale in my knowledge base', or wants to audit-or-repair the structural hygiene of a bound base without running the research pipeline.
Scan agent-maintained directories for health issues: orphan pages, broken wikilinks, stale content, frontmatter violations, tag taxonomy drift, oversized pages. Use this skill whenever the user wants to audit knowledge base quality, check for broken links, find stale or orphan pages, or says anything like "check my wiki", "are there any issues", "audit the knowledge base", "find broken links", or "what needs fixing".
Audits knowledge graph for orphan nodes, missing cross-references, stale claims, unresolved contradictions, low-confidence clusters, and code-knowledge gaps. Outputs health report with auto-fixes.