app-design-thinking
Design the app mechanism and build pipeline for the produced app — the app-phase analog of [[schema-design]]. Use this skill…
Turn the raw event-log entries from extraction into clean, cross-linked, deduplicated knowledge ready for packaging. Use after the extract phase has produced events and canonical state, when the user mentions rewriting or polishing, or when [[ralph-loop]] advances into the
Claude Code
$ npx -y skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite --agent claude-code
Codex
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a codex -y
Cursor
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a cursor -y
Gemini CLI
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a gemini-cli -y
GitHub Copilot
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a github-copilot -y
OpenCode
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a opencode -y
Windsurf
$ npx skills add kitchen-engineer42/joharnessburg --skill knowledge-rewrite -a windsurf -y
name: knowledge-rewrite
description: Turn the raw event-log entries from extraction into clean, cross-linked, deduplicated knowledge ready for packaging. Use after the extract phase has produced events and canonical state, when the user mentions rewriting or polishing, or when [[ralph-loop]] advances into the rewrite phase. Header+body progressive disclosure, two-tier dedup, and cross-link enrichment are the three jobs.
metadata:
triggers:
- rewrite the knowledge
- polish entries
- cross-link entries
- deduplicate
- rewrite phase
- progressive disclosure
- finalize the knowledgeExtraction is fan-out; rewrite is consolidation. The raw event log from [[knowledge-extraction]] has redundancies, near-duplicates, missing cross-references, inconsistent terminology, and entries that don't yet have the header+body split. Rewrite fixes all of that and produces the entries [[packaging]] will emit.
1. **Header + body progressive disclosure** — every entry gets a one-line header (description + classification + cross-refs) and a full body. The header is what loads cheap; the body is what loads on demand. 2. **Cross-linking** — entries reference each other; shared vocabulary lives in a glossary; relationships are typed where the schema supports it. 3. **Dedup** — two-tier (cheap quick-scan + expensive deep-read) to remove duplicates without false positives or false negatives.
**Why this matters at scale.** At 1000+ entries, loading all bodies into a context consumes 2M+ tokens — impossible. Loading all *headers* is more like 4K tokens — easy. The header+body split is what makes large knowledge bases work at all; it's not an optimization, it's the only way. It's one of the strengths of the knowledge pipeline worth preserving universally.
**Header** is the entry's "first impression." Pinned in indexes, included in cross-link contexts, cheap to load. Includes:
**Body** is the entry's full content. Loaded when the entry is actually consumed (by extraction subagents in a later phase, by the runtime, or by a John-equipped agent reading the deliverable). Includes:
The split is universal — applies regardless of knowledge-format. Facts, rules, stories, skills, all get header+body.
The reducer's canonical state has a flat list of entries. Rewrite enriches with relationships:
Glossary entries deserve special treatment: a single entry per term, with all uses cross-linked back. KC's pattern (see `references/cross-linking.md`).
Three-fold reason dedup is hard:
1. The same fact extracted from two chunks is genuinely duplicate. 2. A fact and its rephrasing-with-different-context look similar but aren't duplicates. 3. Two entries that look different but describe the same thing in different vocabulary ARE duplicates.
The two-tier dedup pattern handles this without false positives or false negatives at scale:
Tier 1 filters out obvious non-duplicates cheaply (the bulk). Tier 2 spends real tokens only on plausible candidates. The ratio matters — in a typical run the vast majority of pairs are filtered cheaply by tier 1, and only a small fraction reach tier 2.
When duplicates are confirmed, the rewrite phase has options:
1. **Merge** — combine the two entries' bodies, keep both sources in `source_chunk_ids`, drop the duplicate ID. 2. **Supersede** — keep one, emit a corrective event marking the other deprecated. 3. **Cross-link** — keep both as distinct but explicitly mark them as "different views of the same X." Use when both add real value (e.g., user-facing vs developer-facing view).
[[workspace-discipline]]'s "append-only events" applies — the dedup decision is itself an event the reducer folds into the rewrite phase's canonical state.
**Warning — corrective events + dedup interaction.** If the corpus already contains corrective events from prior iterations (entry A superseded by entry A-v2), the tier-2 deep-read may find A and A-v2 highly similar and propose a merge. **Don't merge correction chains.** When tier 2 encounters a candidate pair where one is a supersession of the other (check the `supersedes` field), the
中文版: README_ZH.md John turns unstructured source material into a working knowledge-dense app. It keeps knowledge engineering and app building in one durable run, coordinates large per-entry fan-outs, and leaves auditable events and checkpoints on disk.
Design the app mechanism and build pipeline for the produced app — the app-phase analog of [[schema-design]]. Use this skill…
Bundle a finished John workspace from Codex. Use when the user wants to archive, package, hand off, or preserve a John project,…
Break parsed markdown into a tree of progressively-disclosed chunks for downstream extraction. Use this skill whenever a phase…
Apply deterministic quality checks to the code John produces — catch the 80% of issues (leaked API keys, hardcoded prod URLs,…
Generate John's process scorecard, auditor manifests, and shareable run report from a Codex project using John's provider-neutral…
Activate a Hamster-built or otherwise applied John template for Codex in the current project. Use when a merged template plugin…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.