54d9540c08
Files changed: - .wikitool-kb.json - AGENTS.md - CHANGES.md - INSTALL-MCP.md - INSTALL.md - README.md - VERSION - instructions/capture-session.md - instructions/dev/issue-tracking.md - instructions/german-terminology.md - instructions/kb-profiles.md - instructions/migrate-corpus.md - instructions/migrations/5.0.0-confidence-removal.md - instructions/private-instance.md - instructions/setup-instance.md - instructions/wiki-lint/SKILL.md - instructions/wiki-manage/SKILL.md - instructions/wiki-query/SKILL.md - kb/CONTRACT.md - kb/CONVENTIONS.md - kb/CONVENTIONS.md.template - kb/concepts/architectures/Consolidation Tiers.md - kb/concepts/architectures/Context Isolation.md - kb/concepts/architectures/Cross-platform Agent Skills.md - kb/concepts/architectures/Episodic Memory.md - kb/concepts/architectures/Hybrid Search.md - kb/concepts/architectures/Implementation Spectrum.md - kb/concepts/architectures/Knowledge Graph.md - kb/concepts/architectures/LLM Wiki Pattern.md - kb/concepts/architectures/MCP-Leseserver.md - kb/concepts/architectures/Memory Lifecycle.md - kb/concepts/architectures/OKF Compatibility.md - kb/concepts/architectures/Optional Instance Context File.md - kb/concepts/architectures/Personalization Plane.md - kb/concepts/architectures/Procedural Memory.md - kb/concepts/architectures/RAG.md - kb/concepts/architectures/Scale Ceiling.md - kb/concepts/architectures/Semantic Memory.md - kb/concepts/architectures/Three-Layer Architecture.md - kb/concepts/architectures/Token Economics.md - kb/concepts/architectures/Working Memory.md - kb/concepts/decisions/Delete Rather Than Anonymize.md - kb/concepts/decisions/Denylist over Allowlist.md - kb/concepts/decisions/Diff-Reviewable Agent Edits.md - kb/concepts/decisions/Dual Licensing by File Plan.md - kb/concepts/decisions/Issue Label Scheme.md - kb/concepts/decisions/KB Stack Versioning.md - kb/concepts/decisions/Structural Enforcement over Documented Rule.md - kb/concepts/patterns/Audit Trail.md - kb/concepts/patterns/BM25.md - kb/concepts/patterns/Command Round-Trip Integrity.md - kb/concepts/patterns/Confidence Scoring.md - kb/concepts/patterns/Contradiction Resolution.md - kb/concepts/patterns/Entity Extraction.md - kb/concepts/patterns/Filter on Ingest.md - kb/concepts/patterns/Forgetting.md - kb/concepts/patterns/Graph Traversal.md - kb/concepts/patterns/Mesh Sync.md - kb/concepts/patterns/Quality Scoring.md - kb/concepts/patterns/Reciprocal Rank Fusion.md - kb/concepts/patterns/Self-Healing.md - kb/concepts/patterns/Shared vs Private.md - kb/concepts/patterns/Typed Relationships.md - kb/concepts/patterns/Vector Search.md - kb/concepts/patterns/Work Coordination.md - kb/concepts/problems/Ambient Environment Dependency.md - kb/concepts/problems/Detect-Repair Asymmetry.md - kb/concepts/problems/Green Suite Blind Spot.md - kb/concepts/problems/Naming Convention Conflict.md - kb/concepts/problems/Write-Once Frontmatter Fields.md - kb/concepts/protocols/CPPC.md - kb/concepts/protocols/Modbus.md - kb/concepts/protocols/SSD TRIM.md - kb/concepts/workflows/Anti-Cramming Heuristic.md - kb/concepts/workflows/Bulk Operations.md - kb/concepts/workflows/CI Integration.md - kb/concepts/workflows/Checkpoint Audit.md - kb/concepts/workflows/Claude Code Auto Mode.md - kb/concepts/workflows/Content Quality Control.md - kb/concepts/workflows/Crystallization.md - kb/concepts/workflows/Event-Driven Automation.md - kb/concepts/workflows/Hooks.md - kb/concepts/workflows/Index Scaling.md - kb/concepts/workflows/Iteration and Cost Limits.md - kb/concepts/workflows/KB Migration.md - kb/concepts/workflows/Knowledge Compounding.md - kb/concepts/workflows/Lint Workflow.md - kb/concepts/workflows/Mass-Update Gate.md - kb/concepts/workflows/Multi-Agent Collaboration.md - kb/concepts/workflows/Privacy and Governance.md - kb/concepts/workflows/Publish-Remote Gate.md - kb/concepts/workflows/Quality and Self-Correction.md - kb/concepts/workflows/Semantic Lint Automation.md - kb/concepts/workflows/Session Orientation.md - kb/concepts/workflows/Split Merge Reclassify.md - kb/concepts/workflows/Split Threshold.md - kb/concepts/workflows/Stub Threshold.md - kb/concepts/workflows/Supersession.md - kb/concepts/workflows/User Management.md - kb/concepts/workflows/Workflow Extraction.md - kb/concepts/workflows/Workflow Orchestration.md - kb/entities/people/Andrej Karpathy.md - kb/entities/people/E3DC GmbH.md - kb/entities/people/Rohit Gupta.md - kb/entities/people/Vannevar Bush.md - kb/entities/projects/BCDModule.md - kb/entities/projects/Chemenu.md - kb/entities/projects/andybalholm-edl.md - kb/entities/projects/goresponsiveness.md - kb/entities/projects/ha-core.md - kb/entities/projects/hacs-e3dc.md - kb/entities/projects/hacs-integration-blueprint.md - kb/entities/projects/llm-wiki-skills.md - kb/entities/projects/plugnburn-edl.md - kb/entities/projects/wiki-skills-vanillaflava.md - kb/entities/projects/wiki-skills.md - kb/entities/systems/AGENTS.md.md - kb/entities/systems/CLAUDE.md.md - kb/entities/systems/E3DC.md - kb/entities/systems/ENVIRONMENT.md.md - kb/entities/systems/Memex.md - kb/entities/systems/Tolkien Gateway.md - kb/entities/technologies/Arch Linux.md - kb/entities/technologies/Disk Encryption.md - kb/entities/technologies/Docker.md - kb/entities/technologies/GRUB.md - kb/entities/technologies/Gitea Actions.md - kb/entities/technologies/Gitea.md - kb/entities/technologies/Go.md - kb/entities/technologies/Home Assistant.md - kb/entities/technologies/Kernel PM Governors.md - kb/entities/technologies/LVM.md - kb/entities/technologies/Linux Kernel.md - kb/entities/technologies/MQTT.md - kb/entities/technologies/OPC UA.md - kb/entities/technologies/Python.md - kb/entities/technologies/Rust.md - kb/entities/technologies/Wine GE.md - kb/entities/technologies/Wine-Staging.md - kb/entities/technologies/acpi-cpufreq.md - kb/entities/technologies/amd-pstate.md - kb/entities/technologies/iii Engine.md - kb/entities/tools/AUR.md - kb/entities/tools/Act Runner.md - kb/entities/tools/Agent Memory.md - kb/entities/tools/Aura.md - kb/entities/tools/Bottles.md - kb/entities/tools/ChatGPT.md - kb/entities/tools/Claude Code.md - kb/entities/tools/Codex CLI.md - kb/entities/tools/Dataview.md - kb/entities/tools/GPG.md - kb/entities/tools/GitHub Copilot.md - kb/entities/tools/Gitea MCP Server.md - kb/entities/tools/Lutris.md - kb/entities/tools/Marp.md - kb/entities/tools/Mistral Vibe.md - kb/entities/tools/NotebookLM.md - kb/entities/tools/Obsidian Web Clipper.md - kb/entities/tools/Obsidian.md - kb/entities/tools/OpenAI Codex.md - kb/entities/tools/OpenCode.md - kb/entities/tools/Pi.md - kb/entities/tools/Proton.md - kb/entities/tools/Steam.md - kb/entities/tools/Wine.md - kb/entities/tools/awesome-llm-wiki.md - kb/entities/tools/farzaa gist.md - kb/entities/tools/gdeploy.md - kb/entities/tools/makepkg.md - kb/entities/tools/pascalandy schema.md - kb/entities/tools/qmd.md - kb/entities/tools/wikitool.md - kb/index.md - kb/log.md - raw/CONTRACT.md - tools/CONTRACT.md - tools/README.md - tools/chemenu/api.py - tools/chemenu/cli.py - tools/chemenu/commands/confidence_decay.py - tools/chemenu/commands/docs_verify.py - tools/chemenu/commands/doctor.py - tools/chemenu/commands/index_build.py - tools/chemenu/commands/new_page.py - tools/chemenu/commands/search.py - tools/chemenu/commands/touch.py - tools/chemenu/commands/version_cmd.py - tools/chemenu/conventions.py - tools/chemenu/corpus_diff.py - tools/chemenu/frontmatter_io.py - tools/chemenu/lint_core.py - tools/chemenu/mcp/server.py - tools/chemenu/page.py - tools/chemenu/search/base.py - tools/chemenu/search/filters.py - tools/chemenu/search/ripgrep.py - tools/chemenu/search/service.py - tools/chemenu/search/types.py - tools/chemenu/tests/conftest.py - tools/chemenu/tests/test_api.py - tools/chemenu/tests/test_confidence_decay.py - tools/chemenu/tests/test_corpus_diff.py - tools/chemenu/tests/test_docs_verify.py - tools/chemenu/tests/test_frontmatter_io.py - tools/chemenu/tests/test_index_build.py - tools/chemenu/tests/test_kb_scan.py - tools/chemenu/tests/test_lint.py - tools/chemenu/tests/test_mcp_server.py - tools/chemenu/tests/test_new_page.py - tools/chemenu/tests/test_page_ops.py - tools/chemenu/tests/test_provenance.py - tools/chemenu/tests/test_raw_cmd.py - tools/chemenu/tests/test_search.py - tools/chemenu/tests/test_touch.py - tools/chemenu/tests/test_type_resolver.py - tools/chemenu/tests/test_version_cmd.py - tools/chemenu/tests/test_xref.py - tools/chemenu/version.py - types/concept.md - types/concept.schema.yaml - types/entity.md - types/entity.schema.yaml - types/instruction.md - types/type-spec.md
133 lines
6.8 KiB
Markdown
133 lines
6.8 KiB
Markdown
---
|
||
type: types/instruction.md
|
||
name: migrate-corpus
|
||
description: Change the shape of every kb/ page at once - a schema field, a vocabulary, a language - in planned units, with a mechanical check per unit and a recorded KB version at the end.
|
||
---
|
||
# Migrate the corpus
|
||
|
||
A change that touches the *shape* of pages rather than their content: a new required
|
||
frontmatter field, a renamed enum value, a section heading vocabulary, a language. It is not an
|
||
ingest and not a lint fix - nothing new is learned, the same knowledge is restated in a new
|
||
form. The failure mode is therefore specific and quiet: **something present before is missing
|
||
afterwards**, and the corpus is still internally consistent, so `lint` reports nothing.
|
||
|
||
Every rule below was paid for once already. The German translation of 248 pages found four
|
||
defects this way - a dropped citation that silently unsourced a claim, a dropped wikilink, an
|
||
invented one, and a translated H1 - and three of the four had unchanged link *sets* and only
|
||
changed counts.
|
||
|
||
<!-- wikitool:toc -->
|
||
## Contents
|
||
|
||
- [When to run](#when-to-run)
|
||
- [Steps](#steps)
|
||
- [Decision points](#decision-points)
|
||
- [Writing the migration document](#writing-the-migration-document)
|
||
- [Scope](#scope)
|
||
<!-- /wikitool:toc -->
|
||
|
||
## When to run
|
||
|
||
A change that would otherwise be applied to more than a handful of pages by hand, or any change
|
||
declared by a migration document under `instructions/migrations/`. A single page is
|
||
`wiki-manage`; a raw tree is [ingest-large-tree.md](ingest-large-tree.md).
|
||
|
||
## Steps
|
||
|
||
1. **Open a workshop.** `tools/wikitool work new --key <slug>` - not `ingest-`, which is
|
||
reserved for keys derived from a `raw/` path. `plan.md` cuts the corpus into units and says
|
||
why each cut falls where it does; `README.md` carries the closing condition and the
|
||
decisions made so far. See [work/CONTRACT.md](../work/CONTRACT.md).
|
||
|
||
2. **Size the units by the iteration budget, not by feel.** One unit costs roughly
|
||
`N × touch` + `index rebuild` + `log append` + `publish` (twice - the Mass-Update Gate
|
||
refuses once and publishes on the confirm), plus `sources rebuild-index` if it contains
|
||
source pages. Against the 60-call ceiling that puts the ceiling near 55 pages; aim for 48 or
|
||
fewer.
|
||
|
||
**Units and publishes are not the same boundary.** The budget is per session id; the gate is
|
||
per publish. Several units may run back to back, each with its own
|
||
`WIKITOOL_SESSION_ID="<slug>/u<N>"`, and publish once together - which is what the written
|
||
unit boundaries in `plan.md` make legitimate rather than a way around a gate refusal (see
|
||
[gates.md](gates.md)).
|
||
|
||
3. **Rewrite the unit's pages.** Bodies only. Frontmatter is written with `touch`, never by
|
||
hand, and never by a subagent.
|
||
|
||
4. **Check mechanically, before anything else:**
|
||
|
||
```bash
|
||
tools/wikitool migrate verify --from HEAD --path kb/<area> --fail-on-error
|
||
```
|
||
|
||
This is the step the whole procedure exists for. It compares wikilink and citation
|
||
**counts**, footnote definitions, H1 and structural frontmatter against the last commit.
|
||
Run it before the summaries, before `lint`, before anything - it is the cheapest place to
|
||
catch a subagent that helpfully translated a link target.
|
||
|
||
5. **Write the summaries yourself** with `touch --summary`, from the original. Never paste a
|
||
subagent's proposal unread: they embellish, and a summary is a claim about the page.
|
||
|
||
6. **`index rebuild`, then `lint` - and read the whole report**, not only the sections this
|
||
unit could plausibly have touched. The translation's first unit had a frontmatter
|
||
round-trip bug that surfaced as a schema error on a field nobody had edited.
|
||
|
||
7. **`log append`, then publish** through [publish-cycle.md](publish-cycle.md). Expect exit 42
|
||
on a corpus-sized change; reproduce the breakdown for the user and wait.
|
||
|
||
8. **Carry the vocabulary between units.** Terminology settled in unit 5 and re-decided in unit
|
||
9 is the failure a glossary file in the workshop exists to prevent. Add to it *before*
|
||
dispatching the next unit.
|
||
|
||
9. **Record the migration** once the last unit is published:
|
||
|
||
```bash
|
||
tools/wikitool migrate done <version> --pages <N>
|
||
```
|
||
|
||
This advances `kb_version` in `.wikitool-kb.json`. It refuses any version that is not the
|
||
next link in the chain, so a multi-step upgrade cannot silently skip one.
|
||
|
||
10. **Close the workshop** per [work/CONTRACT.md](../work/CONTRACT.md), after promoting whatever
|
||
outlives the run. The translation's glossary became
|
||
[german-terminology.md](german-terminology.md); its checklist and unit plan died with the
|
||
directory, correctly.
|
||
|
||
## Decision points
|
||
|
||
- **Can the change be made backwards-compatible instead?** Prefer it. A vocabulary migration
|
||
does not need a flag day: `tools/chemenu/sections.py` gives each heading one canonical name
|
||
and any number of aliases, so a page is found under the old name and takes the new one only
|
||
when it is rewritten. Removing an alias afterwards is a second breaking change, not a cleanup.
|
||
- **Mechanical or assisted?** A rename with a fixed rule is `mechanical` and wants a script; a
|
||
change needing a judgment call per page is `assisted` and wants this procedure. There is no
|
||
`migrate run` today - `migration_kind` describes the work, it does not perform it.
|
||
- **The check finds something mid-unit.** Fix it in that unit and re-run `verify`. Never carry
|
||
a finding into the next unit "to fix later": the next unit's diff baseline is this unit's
|
||
commit, so an uncorrected drop becomes invisible.
|
||
- **Contradiction with an existing page.** Never overwrite. Record both, ask the user, and hedge
|
||
the page's prose to the weaker of the two sources if it stays unresolved (kb/CONVENTIONS.md §
|
||
Hedging).
|
||
|
||
## Writing the migration document
|
||
|
||
A migration that a distributed instance must also run is a `manual: true` instruction under
|
||
`instructions/migrations/<version>-<slug>.md`, carrying `migrates_to:` and `migration_kind:`.
|
||
`tools/wikitool migrate status` builds the outstanding chain from those files, and `version
|
||
bump` refuses a compatibility-breaking release that has none.
|
||
|
||
Write it for a reader who has the new machinery and the old content, and who is not you: what
|
||
changed, which pages are affected, how to tell a migrated page from an unmigrated one, and what
|
||
`migrate verify` should report when it is done.
|
||
|
||
**Baseline: 1.0.0.** Migrations that predate it - the type-system move, the `confidence_base`
|
||
backfill, the German section headings, the translation itself - have no documents and will not
|
||
get any. An instance older than that is re-exported, not migrated.
|
||
|
||
## Scope
|
||
|
||
For `kb/` content. A single page is `wiki-manage`; a `raw/` tree is
|
||
[ingest-large-tree.md](ingest-large-tree.md). Changing the machinery that *causes* a migration
|
||
is a different job with its own rules, and in a distributed instance it is not done at all -
|
||
the stack is developed in the origin repo.
|