Kinic Wiki

Console

Skip to main content
Skills

Repeated improvement

Maintain

Use maintenance workflows to improve agent catalogs, reader descriptions, links, and evidence-backed article organization. Inspect mode is read-only; repair mode requires explicit authorization.

SKILL.md

Read the skill as documentation or switch to the exact source.

Frontmatter

name
kinic-wiki-maintain
description
Run bounded LLM-led Kinic Wiki maintenance through inspection, evidence-backed edits, and reinspection. Use for repeated improvement or scheduled maintenance; use kinic-wiki-lint alone for a read-only health report.

Kinic Wiki Maintain

Use maintain.md for the execution contract, stopping rules, and report validation. Use kinic-wiki-lint for inspection and kinic-wiki-edit for accepted repairs. These skills must be installed together from the same repository revision.

The LLM selects and writes improvements; this skill does not add automatic catalog updates to the server. An explicit mode: repair authorizes non-destructive maintenance inside the supplied Knowledge prefix. Otherwise inspect only. Never infer permission to delete articles, rewrite sources, change access, publish, or deploy.

Maintenance execution contract

Target, modes, and budgets

  • Require explicit canister_id, database_id, absolute Knowledge prefix (default /Knowledge), and mode (inspect default, or explicitly authorized repair). Confirm access via status --json.
  • Default positive budgets: max_passes: 3, max_changed_nodes: 20, max_minutes: 15 (count distinct changed paths across the run including indexes/descriptions; inspect changes 0 nodes). Check elapsed time & remaining budget before each read batch or mutation; record actual elapsed time even if an in-flight call overruns.
  • repair scope: evidence-backed index/link/description and article-organization edits within prefix (including creating missing useful index/overview). Disallowed: article deletion, moving nodes, access changes, raw /Sources edits, unsubstantiated factual edits, edits outside prefix (report parent-index edits separately). Lint findings alone never authorize writes.

Bounded pass loop

  1. Inspect (kinic-wiki-lint): pass prefix explicitly as query_context.namespace / CLI --namespace (public API defaults to /Memory). Inventory comes from actual nodes, not catalogs. Record commands/queries and inspected paths.
  2. Coverage: bounded listings at limit don't prove completeness — use list-children or escaped read-only SQL keyset batches (path > last_path, exact prefix boundary). Mark unread required subtrees/bodies as uninspected (coverage: partial). Reconcile inventory after edits.
  3. Findings: record stable id, paths, impact, evidence, and focused repair (empty/stale catalogs, broken links, missing routes, misleading descriptions, duplicates/isolates, role violations, verified bloated-canonical-root / unbacked-claim). Curated omission without navigation impact is not a defect.
  4. Repair: inspect stops with 0 writes. repair picks supported in-scope repairs within remaining budget, reads current content+etag immediately before each write, uses --expected-etag, skips unchanged content, and never silently rebuilds or replaces curated indexes with full inventories.
  5. Conflicts/errors: on etag conflict, reread, reevaluate, retry at most once within budget, else keep unresolved. Permission error stops mutations; preserve earlier successful edits and report partial progress.
  6. Reinspect: read saved body, verify links resolve, check preserved content/roles, rerun affected lint checks, and reconcile folder inventory before marking resolved (write ack alone is not verification).
  7. Stop when complete inspection has 0 actionable issues, budget/error stops apply, or nothing actionable remains (never rewrite stable content).

Catalog, budget, and split rules

  • /Knowledge/index.md = root agent navigation; subfolder index.md = child navigation (no empty/none templates). overview.md = optional browser-facing description (never empty).
  • Keep <namespace>/index.md and subfolder index.md compact (target <= 2,000 chars) and combined canonical roots (index.md, facts.md, overview.md, summary.md, etc.) under half the tightest default query_context budget (4 chars/token: MCP default 2,000 tokens ≈ 8,000 chars [max 8,000]; CLI default 8,000 ≈ 32,000; paths/metadata/links also count).
  • Crash-safe splits (never delete index.md; on failure, keep recoverable state and report unfinished split):
    • Prose → overview.md: read existing overview → merge unique claims/provenance/links → verify overview → remove only transferred prose from index.md.
    • Bloated listings → subfolder index.md or <namespace>/catalog.md: first verify split (>=2 changed nodes: destination + index.md) fits max_changed_nodes (else leave unresolved). Without moving/deleting articles: read destination (keep links + 1-line descriptions only so destination doesn't bloat search) → adjust relative links & merge unique links/claims → write & read back to verify destination links → shorten <namespace>/index.md with --expected-etag linking destination & verify that link. Mark resolved only after re-running query_context with lint's exact task/entities and effective budget and recording previously omitted matched paths now in nodes as verification evidence. Report out-of-scope parent bloat without editing outside prefix.
  • Validate relative links against actual paths; never invent replacement targets; preserve settled values; flag ambiguous claims and destructive dedup for user review. Append to existing log.md only when required within budget (never create by default).

Output, validation, and scheduler handoff

Write local JSON report to caller path (default outputs/wiki-maintenance/report.json, never implicitly into Wiki):

  • Required fields: target (canister_id, database_id, prefix, mode), budgets (max_passes, max_changed_nodes, max_minutes), passes, elapsed_minutes, coverage (complete/partial, inspected_paths, uninspected_paths, evidence), findings (id, paths, impact, evidence, status: open/resolved, verification required when resolved), changed_paths, verification (chronological {path, result: passed|failed, evidence}; last entry per path is final), unresolved, stop_reason, status.
  • status: complete only for complete coverage with 0 open findings, 0 unverified changes, 0 unresolved blockers, and no path ending in failed verification. inspect with findings → needs_repair; budget/coverage/permission/conflict/verification stops → incomplete.
  • stop_reason values: clean, inspection_only, pass_limit, node_limit, time_limit, coverage_incomplete, permission_denied, conflict, verification_failed.
  • Validate with python3 scripts/validate-report.py <report.json> and python3 -m unittest discover -s tests (offline rehearsal: tests/fixture_wiki.py --state <file> --mode repair). Never edit reports to hide failures.
  • No scheduler is installed by this skill; schedulers must supply target, mode, credentials, budgets, unique report path, and prevent overlapping runs (or report etag-conflict overlap).