/kb-lifecycle:kb-wiki-maintainerfrom kb-lifecycle
Maintain a project Knowledge Base, ingest raw sources, file typed records, refresh the derived markdown wiki, and run lifecycle maintenance. Use when the project has a `.kb/` directory, when the user mentions "KB", "knowledge base", "ingest source", "session start", "update wiki", "answer from KB", or when bootstrapping memory for a new project.
Ships in kb-lifecycle. 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.
Use this skill when a project has a .kb/ directory or when the user wants to ingest sources, update a derived wiki, answer from the KB, or maintain memory lifecycle policies.
.kb/ is the durable memory layer.If the project has no .kb/ directory, establish the canonical runtime before
using the session flows below:
kb-factory init in the
project root.scaffold/ directory to .kb/, then
run python .kb/kb.py init --name "<Project Title>" --slug <project-slug> --domains <a,b,c> --seed .kb/seed/initial_records.jsonl.
The flags render the {{...}} placeholders and prefix record IDs with the
slug (<SLUG>-KB-...); ask the user for them instead of inventing them.
Every platform-specific Lifecycle artifact must carry this scaffold from the
canonical core/templates/kb/ source.kb_next.py install-classic performs the same
copy and init.Confirm the result with python .kb/kb.py stats, and do not create a second
plugin-owned memory store. Every command except init refuses to run when
.kb/kb.db is missing; it never creates an empty KB silently.
In a linked Git worktree (for example a per-session desktop worktree) the
runtime uses the main worktree's .kb/ when it has a kb.db, so every session
shares one KB. python .kb/kb.py doctor --json shows the resolution under
storage; set storage.worktree_scope to local in kb.config.json (or
KB_FACTORY_WORKTREE_SCOPE=local) only when a worktree needs its own KB.
Use the bootstrap mode that matches the session purpose. When in doubt, start thin.
In a KB/Wiki vNext workspace (.kb-next/kb-next.config.json exists), defer to
vNext. Where the kb-wiki-vnext SessionStart hook text is present (it says it
replaces the vNext session start), the session has already started: run nothing more
to begin and follow that text. Without it, use the plugin command
vnext-session-start (runtime equivalent:
python .kb-next/runtime/kb_next.py session-start --json) and read only
.kb-next/memory/NOW.md. Classic NOW, HOT, and INDEX then become
on-demand reads; the modes below apply to workspaces without vNext.
python .kb/kb.py lifecycle session-start --json reports the resolved memory
files under paths (now, hot, index). When a linked Git worktree shares
the main worktree's KB (see above), they point at the main worktree's .kb/;
read those paths instead of local .kb/memory/ copies.
python .kb/kb.py lifecycle session-start --json.paths.now from that output (the resolved NOW.md).python .kb/kb.py lifecycle session-start --json.paths.now (the resolved NOW.md).paths.hot (the resolved HOT.md).python .kb/kb.py lifecycle session-start --json.paths.now (the resolved NOW.md).paths.hot (the resolved HOT.md).paths.index (the resolved INDEX.md).These surfaces are always available during the conversation but are not preloaded at startup:
.kb/memory/HOT.md — load when you need the current working set.kb/memory/INDEX.md — load when you need the broader KB mappython .kb/kb.py search "<term>" — search before assuming. Search ORs the
words of a query and ranks records that match more words first, so widen it
with the words a record might use instead: the original words first, at
most six words in total, synonyms in the language of the records before
translations, and no broad words when you want one item or the most recent
one. On a host SQLite without FTS5, search falls back to matching the whole
query as one substring; search one word at a time there.python .kb/kb.py pending — check open pendenciasDECISAOPREMISSAFATOPENDENCIAAPRENDIZADOupdate only for routing metadata such as tier, tags, review date, or confidence adjustments.supersede, not update.In a project with .kb-next/kb-next.config.json, records change only through
a proposal the user approves, so the record writes in the workflows below do
not run there. A record the user already approved in chat takes one
python .kb-next/runtime/kb_next.py approved-filing ... --json call (the
hook text has the exact flags). Otherwise a new record or a content change
starts with
python .kb-next/runtime/kb_next.py filing-proposal --input @candidate.json --category FATO --domain operations --judgment @judgment.json --json
(use one of the domains in .kb/kb.config.json).
A HOT demotion, a resolved open item or a retired record starts with
python .kb-next/runtime/kb_next.py semantic-hygiene --json. After the user
approves, python .kb-next/runtime/kb_next.py proposal-apply --proposal filing-20261021T120000Z-0a1b2c3d --approve --approval-note "Approved by the user in chat" --actor-runtime claude-code --json
applies it, with the proposal id the earlier command returned
(--actor-runtime codex or cowork in those clients). The
kb-wiki-vnext plugin's write gate denies direct create, file, supersede,
update, resolve, bulk-import, init --seed, raw-query --allow-write and demotions
(lifecycle scheduled-maintenance, --apply-demotions), and the classic
runtime skips automatic demotions there from 0.2.6. ingest and
lifecycle session-end stay direct. The kb-wiki-vnext skill has the details.
python .kb/kb.py ingest <path> --domain <domain> --json.
.kb/sources/ and cataloged.python .kb/kb.py sources --json.python .kb/kb.py source-info <source_id> --json.python .kb/kb.py create --category FATO --domain <domain> --title "..." --content "..." --source-id <source_id> --json--source-id on create and supersede to link records to their originating source.ingest runs the source-ingest lifecycle event and each create runs record-filed; both refresh exports and, when the wiki is enabled, sync .kb/wiki/live (skipped with --no-auto-lifecycle). python .kb/kb.py lifecycle source-ingest --json remains an optional manual re-run.python .kb/kb.py summarize-status --json.has_summary is false:
a. Read content: python .kb/kb.py source-content <source_id>.
b. Write a structured summary:
python .kb/kb.py create --category FATO --domain <domain> --title "Summary: <filename>" --content "<structured summary>" --source-id <source_id> --tags source-summary --confidence <value> --json.python .kb/kb.py supersede <existing_summary_id> --content "<new summary>" --source-id <source_id> --tags source-summary --json.python .kb/kb.py summarize-status --json.Do not:
python .kb/kb.py analysis-status --json.has_analysis is false and a summary exists:
a. Read source: python .kb/kb.py source-content <source_id>.
b. Review the existing summary.
c. Write a structured analysis:
python .kb/kb.py create --category APRENDIZADO --domain <domain> --title "Analysis: <filename>" --content "<structured analysis>" --source-id <source_id> --tags filed-analysis --confidence <value> --json.python .kb/kb.py supersede <existing_analysis_id> --content "<new analysis>" --source-id <source_id> --tags filed-analysis --json.python .kb/kb.py analysis-status --json.Do not:
Note: For source-linked analyses, you can also use python .kb/kb.py file --filing-type analysis which automatically tags and logs the filing to the operation log.
Use the file command when a conversation result has lasting value and should be preserved as a KB record. This command wraps create with explicit filing intent, automatic tagging, and operation log auditing.
Filing policy is advisory. The runtime does not gate kb file on category, confidence, or provenance. Enforcement is agent + operator responsibility. The authoritative thresholds and per-type expectations are defined by the project policy — read them with:
python .kb/kb.py filing-policy --json
Agents, reviewers, and workflows should cite that command's output instead of hardcoding thresholds.
Source: filing_policy.when_to_file. Typical criteria:
Source: filing_policy.when_not_to_file. Typical criteria:
--source-id. Equivalent to the existing analysis filing workflow.The filing type determines the automatic tag (filed-answer, filed-analysis, filed-synthesis). It does NOT determine the record category — choose FATO, APRENDIZADO, DECISAO, or PREMISSA based on the nature of the content. Per-type allowed_categories and requires_source_id expectations are listed in the policy readout.
Bands come from filing_policy.confidence_bands. Read them with python .kb/kb.py filing-policy --json. Behavioral guidance at each band:
high → file directly.review ≤ confidence < high → present to user for review before filing.review → do not file without explicit approval.Do not hardcode the numeric values in skill or workflow guidance. The policy is the single source of truth; changing a threshold means editing kb.config.json#filing_policy and the new value flows to filing-status banding and to every consumer of filing-policy --json.
File an answer:
python .kb/kb.py file --filing-type answer --category APRENDIZADO --domain <domain> --title "..." --content "..." --confidence <value> --json
File a source-linked analysis:
python .kb/kb.py file --filing-type analysis --category APRENDIZADO --domain <domain> --title "Analysis: <filename>" --content "..." --source-id <source_id> --confidence <value> --json
File a synthesis:
python .kb/kb.py file --filing-type synthesis --category FATO --domain <domain> --title "..." --content "..." --confidence <value> --json
Check filing status: python .kb/kb.py filing-status --json
Check filing audit trail: python .kb/kb.py oplog --category record_filing --json
file as a replacement for create when there is no filing intent.Look for:
Domain overview pages are grouped by record category in this order:
Each record shows its tier badge ([HOT], [WARM], [COLD]), title, and a content excerpt (up to ~200 characters). Records within each group are ordered by tier (HOT first) then recency.
If the domain contains source-linked summaries (FATO + source-summary tag) or filed analyses (APRENDIZADO + filed-analysis tag), a "Sources & Analyses" section appears at the bottom. Categories with no records are omitted.
Research synthesis pages use the same category-grouped format as domain overviews, without the Sources & Analyses section (since they aggregate across domains by tag).
Source detail pages are generated for sources that have linked records, a summary, or a filed analysis. Each source page shows source metadata, the summary (if present), the analysis (if present), and linked records. Sources with no linked data do not generate pages.
Other page types use a flat bullet-list format.
All wiki pages remain deterministic and rebuildable from DB state.
Run python .kb/kb.py wiki-config --enable --json once. It sets
wiki.enabled = true, enables run_wiki_sync on the record_filed,
source_ingest, session_end and scheduled_maintenance lifecycle events
(keeping every other config key), and runs the first wiki-sync. From then
on create, file, supersede, resolve, ingest and
lifecycle session-end keep .kb/wiki/live current with no manual sync.
wiki-config --disable turns it off. wiki-check --json reports the state,
lifecycle_sync_events, and under publication which candidates would
publish and which are held back by a hygiene gate (with the reason).
The activation_mode field in wiki config controls how the wiki becomes
active when it is not explicitly enabled:
wiki.enabled = true always turns the wiki on, in every mode; signals never veto an explicit opt-in.manual (default): with enabled = false the wiki stays off.signal: with enabled = false the wiki activates when the hard and soft signal thresholds pass.profile: like signal, with thresholds from project_profile presets.Available profiles (set via wiki.project_profile):
| Profile | min_active_records | min_soft_signal_score | Wiki stance |
|---|---|---|---|
corporate_companion | 50 | 2 | Selective |
strategic_framework | 15 | 1 | Required |
hybrid_research_ops | 30 | 1 | Recommended |
User-specified eligibility thresholds in config always override profile presets. Use wiki-check --json to inspect the effective thresholds and activation decision.
Review recent operational events: python .kb/kb.py oplog --json.
Filter by category: python .kb/kb.py oplog --category lifecycle --json.
The operation log tracks lifecycle runs and ingest events as an immutable audit trail. It does not track individual record changes (see audit_log for that). A read-only python .kb/kb.py lifecycle session-start writes no row, and read commands (list, get, search, stats, pending, wiki-check, doctor) open the database read-only, so reading never changes kb.db. Record access counting is opt-in (tracking.record_access).
New sources are stored with KB-relative paths, so the KB survives a move or a
fresh clone. For KBs created before 0.2.4, run
python .kb/kb.py source-relink --dry-run --json and then without
--dry-run to rewrite legacy absolute paths.
In a KB/Wiki vNext project, use the plugin command vnext-session-end: it
files approved records, runs lifecycle session-end and, with the wiki on,
wiki-draft-status. Curation (semantic-hygiene proposals) runs in the
weekly maintenance run, not at session end, and demotions are denied there.
Elsewhere, if shell access is available:
python .kb/kb.py lifecycle session-end --json. When the wiki is
enabled this also syncs .kb/wiki/live.python .kb/kb.py hygiene-audit --json before any maintenance action.python .kb/kb.py lifecycle scheduled-maintenance --apply-demotions --json.If shell access is not available:
HOT.See reference.md for lifecycle and automation guidance.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub regismvargas/kb-factory --plugin kb-lifecycle