[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GXNMTG36DW96DRYWHD4XT9":3,"skill-same:01M6GXNMTG36DW96DRYWHD4XT9":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":55,"ownerDescription":57,"updatedAt":58,"install":59,"resources":71},"01M6GXNMTG36DW96DRYWHD4XT9","learn",null,"Knowledge compiler. Extracts patterns, decisions, and anti-patterns from completed campaigns and evolve cycles, then compiles them into structured wiki pages that integrate with existing knowledge rather than appending isolated files. Implements flush→compile→lint pipeline. Auto-triggered by \u002Fpostmortem and \u002Fevolve Phase 6.","SethGammon\u002FCitadel","SethGammon","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5523585?v=4","01M6GXJ90FD2CE9QF5GQERWN06","Seth Gammon","01M6GXJ94VXYGK5KAW14EYE901",931,"MIT","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Flearn\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"true","lint","false","pages","campaigns","patterns","files","campaign","integrate","auto","anti-patterns","evolve","decisions","postmortem","knowledge","wiki","save","pipeline","compile","2026-11-10 10:12:30",false,"---\nname: learn\nlicense: MIT\ndescription: >-\n  Knowledge compiler. Extracts patterns, decisions, and anti-patterns from\n  completed campaigns and evolve cycles, then compiles them into structured wiki\n  pages that integrate with existing knowledge rather than appending isolated\n  files. Implements flush→compile→lint pipeline. Auto-triggered by \u002Fpostmortem\n  and \u002Fevolve Phase 6.\nuser-invocable: true\nauto-trigger: false\ntrigger_keywords:\n  - learn\n  - extract patterns\n  - learn from that\n  - save what worked\n  - patterns from campaign\nlast-updated: 2026-05-07\n---\n\n# \u002Flearn — Knowledge Compiler\n\n## Orientation\n\n**Use when:** You have a completed campaign or evolve cycle and want to compile\nits findings into the project's growing knowledge wiki — so future sessions\nstart smarter, not from scratch.\n\n**Don't use when:** You want a structured incident analysis first (use `\u002Fpostmortem`\n— run it before `\u002Flearn`); you haven't finished any campaigns (nothing to compile);\nyou want a context transfer only (use `\u002Fsession-handoff`).\n\n**Key difference from appending:** `\u002Flearn` doesn't create isolated per-campaign\nfiles. It integrates new findings into existing wiki pages — updating evidence\nlists, raising confidence where a pattern is confirmed again, and flagging\ncontradictions. A wiki is a compiler; a log is an interpreter.\n\n## Invocation Forms\n\n```\n\u002Flearn                              — most recently completed campaign\n\u002Flearn {slug}                       — specific campaign by slug\n\u002Flearn {file-path}                  — specific campaign file path\n\u002Flearn --from-evolve {target}       — compile from \u002Fevolve pattern library\n\u002Flearn --from-evolve {target} --cycle {n}  — specific evolve cycle only\n\u002Flearn --lint                       — lint-only pass (no new extraction)\n\u002Flearn --compile                    — re-compile staging area into wiki (no new extraction)\n\u002Flearn --memory                     — compile semantic memory blocks from planning artifacts\n\u002Flearn --doc-sync                   — process doc-sync queue into .planning\u002Fdoc-sync\u002Flatest.md\n```\n\n## Inputs\n\n1. A campaign slug, file path, evolve target, or \"most recent\" resolution\n2. Corresponding postmortem in `.planning\u002Fpostmortems\u002F` (optional)\n3. `.planning\u002Ftelemetry\u002Faudit.jsonl` filtered to this campaign (optional)\n4. For `--from-evolve`: `.planning\u002Fevolve\u002F{target}\u002Fpattern-library.md`\n\n## Protocol\n\n### Step 1: RESOLVE TARGET\n\n**If `\u002Flearn` (no argument):**\n- Glob `.planning\u002Fcampaigns\u002Fcompleted\u002F*.md` or `.planning\u002Fcampaigns\u002F*.md`\n  where `Status: completed`\n- Sort by modification time descending, take most recent\n- If none found: \"No completed campaigns found. Run \u002Flearn after a campaign completes.\" Stop.\n\n**If `\u002Flearn {slug}`:**\n- Search `.planning\u002Fcampaigns\u002F` for a file whose name contains `{slug}`\n- Check `.planning\u002Fcampaigns\u002Fcompleted\u002F` if not found in active\n- If still not found: \"No campaign found matching '{slug}'.\"\n\n**If `\u002Flearn --from-evolve {target}`:**\n- Read `.planning\u002Fevolve\u002F{target}\u002Fpattern-library.md` — this is the source\n- If `--cycle {n}`: filter to sections beginning with `## Cycle {n}` only\n- If file not found: \"No evolve pattern library for '{target}'.\" Stop.\n\n**If `\u002Flearn --doc-sync`:** Run:\n```\nnode hooks_src\u002Fdoc-sync.js\n```\nThen review `.planning\u002Fdoc-sync\u002Flatest.md`. Stop after reporting the queue count,\nfiles surfaced, skipped deleted files, and report path. Do not run campaign\nextraction unless the user separately asks for it.\n\n**If `\u002Flearn --lint`, `\u002Flearn --compile`, or `\u002Flearn --memory`:** Skip to Step 4, 5, or 5.5 respectively.\n\n### Step 2: GATHER SOURCES\n\nFor campaign-based runs only (skip for `--from-evolve`):\n\n**Campaign file (required):**\n- Full content — direction, phases, Decision Log, circuit breaker activations\n\n**Postmortem (optional):**\n- Search `.planning\u002Fpostmortems\u002F` for files matching `*{slug}*`\n- If not found: note \"Postmortem not found — proceeding without it\" and continue\n\n**Audit telemetry (optional):**\n- Read last 200 lines of `.planning\u002Ftelemetry\u002Faudit.jsonl`\n- Filter entries that match the campaign slug or its active period\n- If none: note \"No audit telemetry found for this campaign\"\n\n### Step 3: FLUSH\n\nExtract raw findings and write to staging.\n\n**For campaign sources:**\n\nExtract four categories:\n\n**A. Successful Patterns** — approaches that demonstrably worked (phases completed without rework, postmortem positives, no reverts).\nPer pattern: `name`, `mechanism` (what caused success), `evidence` (phase\u002Fcommit\u002Fentry), `topic` (infer from subject matter), `applicability`.\n\n**B. Anti-patterns** — what was tried and failed (rework phases, circuit breaker trips, quality gate blocks, reverts).\nPer pattern: `name`, `what-was-tried`, `failure-mode`, `evidence`, `topic`, `avoidance`.\n\n**C. Key Decisions** — from Decision Log or inferred from phase descriptions.\nPer decision: `what`, `rationale`, `outcome` (completed or rework).\n\n**D. Quality Rule Candidates** — only generate if: specific regex, applies to a specific file pattern, occurred more than once or was severe. Per candidate: regex, file pattern, trigger message, confidence (`high`\u002F`medium`\u002F`low` — skip `low`).\n\n**For evolve sources:**\n\nParse the pattern library's sections. For each pattern record:\n- `name`: section heading\n- `mechanism`: \"**Mechanism:**\" field\n- `delta`: \"**Delta:**\" field\n- `topic`: infer from \"**Axis class:**\" (e.g., `orientation_precision` → `skill-orientation`)\n- `applies-to`: \"**Applies to:**\" field\n- `confidence`: \"**Confidence:**\" field\n- `evidence`: source file + cycle number\n\n**Staging write:**\n\nCreate `.planning\u002Fwiki\u002F_staging\u002F` if it does not exist.\nWrite staged findings to `.planning\u002Fwiki\u002F_staging\u002F{source-slug}-{timestamp}.jsonl` —\none JSON record per finding (newline-delimited).\n\nIf zero findings are extractable: write staging file with a single `{\"type\":\"empty\",\"source\":\"{slug}\"}` record and note \"Campaign may have been too brief.\"\n\n### Step 4: COMPILE\n\nIntegrate staged findings into wiki pages.\n\nCreate `.planning\u002Fwiki\u002F` if it does not exist.\n\nFor each staged finding:\n1. Determine the wiki page: `.planning\u002Fwiki\u002F{topic}.md` where `topic` is the finding's `topic` field (normalized to kebab-case).\n2. Read the wiki page if it exists.\n3. **If the page exists and contains a section for this pattern** (match on `## {name}`):\n   - Append the new source to the `**Evidence:**` list\n   - Update `**Last confirmed:**` to today\n   - If new confidence >= existing confidence: raise it\n   - If new evidence contradicts the existing mechanism: add a `**Conflict:**` field — do not silently overwrite\n4. **If the page exists but has no section for this pattern:**\n   - Append a new section with the full finding\n5. **If the page does not exist:**\n   - Create it with the frontmatter template (see below) and the finding as the first section\n\n**Wiki page format:**\n```markdown\n---\ntopic: {slug}\nlast-compiled: {ISO date}\nsources: {N}\n---\n\n# {Topic Title}\n\n## {Pattern Name}\n**Mechanism:** {what causes success\u002Ffailure}\n**Evidence:** {source-1 (date)}, {source-2 (date)}, ...\n**Confidence:** high\u002Fmedium\u002Flow\n**Last confirmed:** {ISO date}\n**Applies to:** {scope}\n```\n\nAfter compiling all findings: update `.planning\u002Fwiki\u002Findex.md` —\none line per wiki page: `- [{topic}]({topic}.md) — {one-line description}`.\nCreate `index.md` if it does not exist.\n\n### Step 5: LINT\n\nScan all `.planning\u002Fwiki\u002F*.md` pages (skip `index.md`).\n\n**Contradiction check:** For each page, if two sections contain opposing directives\n(\"always X\" vs \"never X\", \"prefer X\" vs \"avoid X\"), flag as:\n`CONFLICT: [{page}] {section-A} contradicts {section-B} — requires human resolution`\n\n**Staleness check:** Sections with `**Last confirmed:**` older than 60 days are flagged as:\n`STALE: [{page}] {section} — last confirmed {date}, consider re-testing`\n\n**Coverage check:** Warn if a wiki page has fewer than 2 sections — single-entry pages are fragile.\n\nLint results are reported in the summary. Lint does not modify wiki pages.\n\n### Step 5.5: COMPILE SEMANTIC MEMORY BLOCKS\n\nRun a safe deterministic memory compile pass:\n\n```\nnode scripts\u002Fmemory-compile.js compile\n```\n\nThis writes compact semantic blocks to `.planning\u002Fmemory\u002Fblocks\u002F` and updates\n`.planning\u002Fmemory\u002Findex.json`. Blocks must include `id`, `type`, `scope`,\n`owner`, `confidence`, `last_verified`, `sources`, and `body`.\nCompile only source-supported categories; absent categories and zero blocks are valid.\nDefault context listing excludes stale\u002Funverified records, including digestless legacy notes.\n\nFor lint-only memory checks, run:\n\n```\nnode scripts\u002Fmemory-compile.js lint\n```\n\nFor agent context loading, use scoped listing instead of rereading full\nhistories:\n\n```\nnode scripts\u002Fmemory-compile.js list --scope verification\nnode scripts\u002Fmemory-compile.js list --query \"Fleet readiness\"\n```\n\nMemory block lint must pass before calling the compile successful. Missing\nsource paths, changed or unverified source bytes, stale blocks, and contradictions\nare reported as actionable failures.\n\n### Step 6: APPEND QUALITY RULES\n\n`.claude\u002Fharness.json` is Citadel's shared configuration path for every runtime, including Codex. Create that path when it is missing; do not substitute a runtime-specific config file.\n\nFor each high\u002Fmedium-confidence rule candidate in the staged findings:\n1. Read `.claude\u002Fharness.json` (create with `{}` if missing)\n2. Initialize `qualityRules.custom` to `[]` if absent\n3. Skip if a rule with the same `pattern` already exists\n4. Append: `{ \"name\": \"auto-{slug}-{N}\", \"pattern\": \"{regex}\", \"filePattern\": \"{glob}\", \"message\": \"Learned from {slug}: {message}\" }`\n5. Write updated harness.json\n\nSkip low-confidence rules.\n\n### Step 7: OUTPUT SUMMARY\n\nFor the optional promotion in the summary, Codex uses `AGENTS.md`. Claude Code uses\n`CLAUDE.md` when the project has one; where its `AGENTS.md` capability is available,\nthe default uses `AGENTS.md` if no project `CLAUDE.md` exists. The operator can\nconfigure Claude Code to load both under **Project instructions**. Check the active\nsetting or startup notice before choosing a file, and do not duplicate a rule into\nan instruction file the runtime is not loading. Preserve user-authored guidance.\n\n```\n=== \u002Flearn: {Source} ===\nMode: {campaign | evolve-{target} | lint-only | compile-only}\nSources: {campaign path | evolve path} | postmortem {path or \"not found\"} | {N} audit entries\nStaged: {N} findings → .planning\u002Fwiki\u002F_staging\u002F{file}\nCompiled: {N} patterns integrated | {M} new wiki sections | {K} existing sections updated\nWiki pages: .planning\u002Fwiki\u002F{topic-1}.md, ...\nLint: {conflicts found | clean} | {stale entries} | {coverage warnings}\nMemory blocks: {N} compiled | lint {PASS|FAIL} | .planning\u002Fmemory\u002Findex.json\nRules added to harness.json: {M} ({K} skipped — already exist)\nNext: review .planning\u002Fwiki\u002Findex.md — promote stable patterns to the project's active instruction file(s).\n```\n\n## Fringe Cases\n\n**No completed campaigns:** Output message and stop.\n\n**`.planning\u002F` does not exist:** Bare `\u002Flearn` follows Step 1's \"No completed campaigns found\" response and stops without creating files. Other invocation forms output \"Run \u002Fdo setup first to initialize the harness state directory.\" Stop.\n\n**No Decision Log:** Extract decisions from phase descriptions; note \"inferred from phase descriptions.\"\n\n**harness.json missing:** Create with only the qualityRules section; do not invent other fields.\n\n**Duplicate quality rule:** Skip silently; count in \"skipped — already exist.\"\n\n**Postmortem missing:** Proceed without it; note in summary.\n\n**Large telemetry file:** Read last 200 lines only.\n\n**Zero extractable findings:** Write staging file noting source was empty. Do not skip wiki\u002Findex update.\n\n**Wiki page conflict detected at compile time:** Add a `**Conflict:**` field to the section. Never silently overwrite the existing mechanism.\n\n**Memory compile has missing sources:** Report the missing source paths and keep\nthe existing memory blocks untouched until the source issue is resolved.\n\n**Doc-sync queue empty:** Output \"No doc-sync work is queued.\" Stop.\n\n**Doc-sync queue has only surfaced entries:** Output \"All doc-sync items are already surfaced.\" Stop.\n\n**evolve pattern-library.md missing:** \"No evolve pattern library for '{target}'. Run \u002Fevolve {target} first to generate patterns.\" Stop.\n\n## Contextual Gates\n\n**Disclosure:** \"Compiling findings into .planning\u002Fwiki\u002F. Modifies wiki pages in-place; creates staging files.\"\n**Reversibility:** green — all writes are to `.planning\u002Fwiki\u002F` and `.planning\u002Fwiki\u002F_staging\u002F`; `git restore .planning\u002Fwiki\u002F` or delete the directory to undo. Quality rule additions to harness.json can be manually removed.\n**Trust gates:**\n- Any: run on any completed campaign or evolve target\n\n## Quality Gates\n\n- Never invent patterns not supported by evidence in the source files\n- Never write a quality rule with confidence \u003C medium\n- Never duplicate an existing quality rule (check before appending)\n- Wiki index must be updated on every compile run\n- Lint must run after every compile (not skipped)\n- Memory block lint must pass after `--memory` or the Step 5.5 compile pass\n- `\u002Flearn --doc-sync` must leave no `pending` or `needs-review` entries for\n  processed queue items unless run with `--dry-run`\n- Conflicts must be flagged, never silently resolved\n- Summary output must include counts for all phases\n\n## Exit Protocol\n\n\u002Flearn does not produce a full HANDOFF block (it is a utility, not a campaign).\nIt outputs the summary block in Step 7 and waits for the next command.\n","# \u002Flearn — Knowledge Compiler\n\n## Orientation\n\n**Use when:** You have a completed campaign or evolve cycle and want to compile\nits findings into the project's growing knowledge wiki — so future sessions\nstart smarter, not from scratch.\n\n**Don't use when:** You want a structured incident analysis first (use `\u002Fpostmortem`\n— run it before `\u002Flearn`); you haven't finished any campaigns (nothing to compile);\nyou want a context transfer only (use `\u002Fsession-handoff`).\n\n**Key difference from appending:** `\u002Flearn` doesn't create isolated per-campaign\nfiles. It integrates new findings into existing wiki pages — updating evidence\nlists, raising confidence where a pattern is confirmed again, and flagging\ncontradictions. A wiki is a compiler; a log is an interpreter.\n\n## Invocation Forms\n\n```\n\u002Flearn                              — most recently completed campaign\n\u002Flearn {slug}                       — specific campaign by slug\n\u002Flearn {file-path}                  — specific campaign file path\n\u002Flearn --from-evolve {target}       — compile from \u002Fevolve pattern library\n\u002Flearn --from-evolve {target} --cycle {n}  — specific evolve cycle only\n\u002Flearn --lint                       — lint-only pass (no new extraction)\n\u002Flearn --compile                    — re-compile staging area into wiki (no new extraction)\n\u002Flearn --memory                     — compile semantic memory blocks from planning artifacts\n\u002Flearn --doc-sync                   — process doc-sync queue into .planning\u002Fdoc-sync\u002Flatest.md\n```\n\n## Inputs\n\n1. A campaign slug, file path, evolve target, or \"most recent\" resolution\n2. Corresponding postmortem in `.planning\u002Fpostmortems\u002F` (optional)\n3. `.planning\u002Ftelemetry\u002Faudit.jsonl` filtered to this campaign (optional)\n4. For `--from-evolve`: `.planning\u002Fevolve\u002F{target}\u002Fpattern-library.md`\n\n## Protocol\n\n### Step 1: RESOLVE TARGET\n\n**If `\u002Flearn` (no argument):**\n- Glob `.planning\u002Fcampaigns\u002Fcompleted\u002F*.md` or `.planning\u002Fcampaigns\u002F*.md`\n  where `Status: completed`\n- Sort by modification time descending, take most recent\n- If none found: \"No completed campaigns found. Run \u002Flearn after a campaign completes.\" Stop.\n\n**If `\u002Flearn {slug}`:**\n- Search `.planning\u002Fcampaigns\u002F` for a file whose name contains `{slug}`\n- Check `.planning\u002Fcampaigns\u002Fcompleted\u002F` if not found in active\n- If still not found: \"No campaign found matching '{slug}'.\"\n\n**If `\u002Flearn --from-evolve {target}`:**\n- Read `.planning\u002Fevolve\u002F{target}\u002Fpattern-library.md` — this is the source\n- If `--cycle {n}`: filter to sections beginning with `## Cycle {n}` only\n- If file not found: \"No evolve pattern library for '{target}'.\" Stop.\n\n**If `\u002Flearn --doc-sync`:** Run:\n```\nnode hooks_src\u002Fdoc-sync.js\n```\nThen review `.planning\u002Fdoc-sync\u002Flatest.md`. Stop after reporting the queue count,\nfiles surfaced, skipped deleted files, and report path. Do not run campaign\nextraction unless the user separately asks for it.\n\n**If `\u002Flearn --lint`, `\u002Flearn --compile`, or `\u002Flearn --memory`:** Skip to Step 4, 5, or 5.5 respectively.\n\n### Step 2: GATHER SOURCES\n\nFor campaign-based runs only (skip for `--from-evolve`):\n\n**Campaign file (required):**\n- Full content — direction, phases, Decision Log, circuit breaker activations\n\n**Postmortem (optional):**\n- Search `.planning\u002Fpostmortems\u002F` for files matching `*{slug}*`\n- If not found: note \"Postmortem not found — proceeding without it\" and continue\n\n**Audit telemetry (optional):**\n- Read last 200 lines of `.planning\u002Ftelemetry\u002Faudit.jsonl`\n- Filter entries that match the campaign slug or its active period\n- If none: note \"No audit telemetry found for this campaign\"\n\n### Step 3: FLUSH\n\nExtract raw findings and write to staging.\n\n**For campaign sources:**\n\nExtract four categories:\n\n**A. Successful Patterns** — approaches that demonstrably worked (phases completed without rework, postmortem positives, no reverts).\nPer pattern: `name`, `mechanism` (what caused success), `evidence` (phase\u002Fcommit\u002Fentry), `topic` (infer from subject matter), `applicability`.\n\n**B. Anti-patterns** — what was tried and failed (rework phases, circuit breaker trips, quality gate blocks, reverts).\nPer pattern: `name`, `what-was-tried`, `failure-mode`, `evidence`, `topic`, `avoidance`.\n\n**C. Key Decisions** — from Decision Log or inferred from phase descriptions.\nPer decision: `what`, `rationale`, `outcome` (completed or rework).\n\n**D. Quality Rule Candidates** — only generate if: specific regex, applies to a specific file pattern, occurred more than once or was severe. Per candidate: regex, file pattern, trigger message, confidence (`high`\u002F`medium`\u002F`low` — skip `low`).\n\n**For evolve sources:**\n\nParse the pattern library's sections. For each pattern record:\n- `name`: section heading\n- `mechanism`: \"**Mechanism:**\" field\n- `delta`: \"**Delta:**\" field\n- `topic`: infer from \"**Axis class:**\" (e.g., `orientation_precision` → `skill-orientation`)\n- `applies-to`: \"**Applies to:**\" field\n- `confidence`: \"**Confidence:**\" field\n- `evidence`: source file + cycle number\n\n**Staging write:**\n\nCreate `.planning\u002Fwiki\u002F_staging\u002F` if it does not exist.\nWrite staged findings to `.planning\u002Fwiki\u002F_staging\u002F{source-slug}-{timestamp}.jsonl` —\none JSON record per finding (newline-delimited).\n\nIf zero findings are extractable: write staging file with a single `{\"type\":\"empty\",\"source\":\"{slug}\"}` record and note \"Campaign may have been too brief.\"\n\n### Step 4: COMPILE\n\nIntegrate staged findings into wiki pages.\n\nCreate `.planning\u002Fwiki\u002F` if it does not exist.\n\nFor each staged finding:\n1. Determine the wiki page: `.planning\u002Fwiki\u002F{topic}.md` where `topic` is the finding's `topic` field (normalized to kebab-case).\n2. Read the wiki page if it exists.\n3. **If the page exists and contains a section for this pattern** (match on `## {name}`):\n   - Append the new source to the `**Evidence:**` list\n   - Update `**Last confirmed:**` to today\n   - If new confidence >= existing confidence: raise it\n   - If new evidence contradicts the existing mechanism: add a `**Conflict:**` field — do not silently overwrite\n4. **If the page exists but has no section for this pattern:**\n   - Append a new section with the full finding\n5. **If the page does not exist:**\n   - Create it with the frontmatter template (see below) and the finding as the first section\n\n**Wiki page format:**\n```markdown\n---\ntopic: {slug}\nlast-compiled: {ISO date}\nsources: {N}\n---\n\n# {Topic Title}\n\n## {Pattern Name}\n**Mechanism:** {what causes success\u002Ffailure}\n**Evidence:** {source-1 (date)}, {source-2 (date)}, ...\n**Confidence:** high\u002Fmedium\u002Flow\n**Last confirmed:** {ISO date}\n**Applies to:** {scope}\n```\n\nAfter compiling all findings: update `.planning\u002Fwiki\u002Findex.md` —\none line per wiki page: `- [{topic}]({topic}.md) — {one-line description}`.\nCreate `index.md` if it does not exist.\n\n### Step 5: LINT\n\nScan all `.planning\u002Fwiki\u002F*.md` pages (skip `index.md`).\n\n**Contradiction check:** For each page, if two sections contain opposing directives\n(\"always X\" vs \"never X\", \"prefer X\" vs \"avoid X\"), flag as:\n`CONFLICT: [{page}] {section-A} contradicts {section-B} — requires human resolution`\n\n**Staleness check:** Sections with `**Last confirmed:**` older than 60 days are flagged as:\n`STALE: [{page}] {section} — last confirmed {date}, consider re-testing`\n\n**Coverage check:** Warn if a wiki page has fewer than 2 sections — single-entry pages are fragile.\n\nLint results are reported in the summary. Lint does not modify wiki pages.\n\n### Step 5.5: COMPILE SEMANTIC MEMORY BLOCKS\n\nRun a safe deterministic memory compile pass:\n\n```\nnode scripts\u002Fmemory-compile.js compile\n```\n\nThis writes compact semantic blocks to `.planning\u002Fmemory\u002Fblocks\u002F` and updates\n`.planning\u002Fmemory\u002Findex.json`. Blocks must include `id`, `type`, `scope`,\n`owner`, `confidence`, `last_verified`, `sources`, and `body`.\nCompile only source-supported categories; absent categories and zero blocks are valid.\nDefault context listing excludes stale\u002Funverified records, including digestless legacy notes.\n\nFor lint-only memory checks, run:\n\n```\nnode scripts\u002Fmemory-compile.js lint\n```\n\nFor agent context loading, use scoped listing instead of rereading full\nhistories:\n\n```\nnode scripts\u002Fmemory-compile.js list --scope verification\nnode scripts\u002Fmemory-compile.js list --query \"Fleet readiness\"\n```\n\nMemory block lint must pass before calling the compile successful. Missing\nsource paths, changed or unverified source bytes, stale blocks, and contradictions\nare reported as actionable failures.\n\n### Step 6: APPEND QUALITY RULES\n\n`.claude\u002Fharness.json` is Citadel's shared configuration path for every runtime, including Codex. Create that path when it is missing; do not substitute a runtime-specific config file.\n\nFor each high\u002Fmedium-confidence rule candidate in the staged findings:\n1. Read `.claude\u002Fharness.json` (create with `{}` if missing)\n2. Initialize `qualityRules.custom` to `[]` if absent\n3. Skip if a rule with the same `pattern` already exists\n4. Append: `{ \"name\": \"auto-{slug}-{N}\", \"pattern\": \"{regex}\", \"filePattern\": \"{glob}\", \"message\": \"Learned from {slug}: {message}\" }`\n5. Write updated harness.json\n\nSkip low-confidence rules.\n\n### Step 7: OUTPUT SUMMARY\n\nFor the optional promotion in the summary, Codex uses `AGENTS.md`. Claude Code uses\n`CLAUDE.md` when the project has one; where its `AGENTS.md` capability is available,\nthe default uses `AGENTS.md` if no project `CLAUDE.md` exists. The operator can\nconfigure Claude Code to load both under **Project instructions**. Check the active\nsetting or startup notice before choosing a file, and do not duplicate a rule into\nan instruction file the runtime is not loading. Preserve user-authored guidance.\n\n```\n=== \u002Flearn: {Source} ===\nMode: {campaign | evolve-{target} | lint-only | compile-only}\nSources: {campaign path | evolve path} | postmortem {path or \"not found\"} | {N} audit entries\nStaged: {N} findings → .planning\u002Fwiki\u002F_staging\u002F{file}\nCompiled: {N} patterns integrated | {M} new wiki sections | {K} existing sections updated\nWiki pages: .planning\u002Fwiki\u002F{topic-1}.md, ...\nLint: {conflicts found | clean} | {stale entries} | {coverage warnings}\nMemory blocks: {N} compiled | lint {PASS|FAIL} | .planning\u002Fmemory\u002Findex.json\nRules added to harness.json: {M} ({K} skipped — already exist)\nNext: review .planning\u002Fwiki\u002Findex.md — promote stable patterns to the project's active instruction file(s).\n```\n\n## Fringe Cases\n\n**No completed campaigns:** Output message and stop.\n\n**`.planning\u002F` does not exist:** Bare `\u002Flearn` follows Step 1's \"No completed campaigns found\" response and stops without creating files. Other invocation forms output \"Run \u002Fdo setup first to initialize the harness state directory.\" Stop.\n\n**No Decision Log:** Extract decisions from phase descriptions; note \"inferred from phase descriptions.\"\n\n**harness.json missing:** Create with only the qualityRules section; do not invent other fields.\n\n**Duplicate quality rule:** Skip silently; count in \"skipped — already exist.\"\n\n**Postmortem missing:** Proceed without it; note in summary.\n\n**Large telemetry file:** Read last 200 lines only.\n\n**Zero extractable findings:** Write staging file noting source was empty. Do not skip wiki\u002Findex update.\n\n**Wiki page conflict detected at compile time:** Add a `**Conflict:**` field to the section. Never silently overwrite the existing mechanism.\n\n**Memory compile has missing sources:** Report the missing source paths and keep\nthe existing memory blocks untouched until the source issue is resolved.\n\n**Doc-sync queue empty:** Output \"No doc-sync work is queued.\" Stop.\n\n**Doc-sync queue has only surfaced entries:** Output \"All doc-sync items are already surfaced.\" Stop.\n\n**evolve pattern-library.md missing:** \"No evolve pattern library for '{target}'. Run \u002Fevolve {target} first to generate patterns.\" Stop.\n\n## Contextual Gates\n\n**Disclosure:** \"Compiling findings into .planning\u002Fwiki\u002F. Modifies wiki pages in-place; creates staging files.\"\n**Reversibility:** green — all writes are to `.planning\u002Fwiki\u002F` and `.planning\u002Fwiki\u002F_staging\u002F`; `git restore .planning\u002Fwiki\u002F` or delete the directory to undo. Quality rule additions to harness.json can be manually removed.\n**Trust gates:**\n- Any: run on any completed campaign or evolve target\n\n## Quality Gates\n\n- Never invent patterns not supported by evidence in the source files\n- Never write a quality rule with confidence \u003C medium\n- Never duplicate an existing quality rule (check before appending)\n- Wiki index must be updated on every compile run\n- Lint must run after every compile (not skipped)\n- Memory block lint must pass after `--memory` or the Step 5.5 compile pass\n- `\u002Flearn --doc-sync` must leave no `pending` or `needs-review` entries for\n  processed queue items unless run with `--dry-run`\n- Conflicts must be flagged, never silently resolved\n- Summary output must include counts for all phases\n\n## Exit Protocol\n\n\u002Flearn does not produce a full HANDOFF block (it is a utility, not a campaign).\nIt outputs the summary block in Step 7 and waits for the next command.\n",{"name":5,"license":15,"description":7,"auto-trigger":39,"last-updated":43,"user-invocable":44,"trigger_keywords":45},1778112000000,true,[5,46,47,48,49],"extract patterns","learn from that","save what worked","patterns from campaign","main","e1a3d45697a0f323aaedcbea0ab6a0387b5fe722","skills\u002Flearn",84,"https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel","https:\u002F\u002Fsethgammon.github.io\u002FCitadel\u002F","https:\u002F\u002Fgithub.com\u002FSethGammon","Building Citadel, the repo-local operating layer for Claude Code and Codex. Persistent work, routing, verification, and coordinated agent fleets.","2026-11-13 02:05:13",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":44},[61,64,67],{"tool":62,"command":63},"npx","npx skills add SethGammon\u002FCitadel --skill learn",{"tool":65,"command":66},"bunx","bunx skills add SethGammon\u002FCitadel --skill learn",{"tool":68,"command":69},"pnpm","pnpm dlx skills add SethGammon\u002FCitadel --skill learn","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Flearn\u002FSKILL.md",[72,78],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"__benchmarks__\u002Fcampaign-no-postmortem.md","REFERENCE","参考文档",929,"https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Flearn\u002F__benchmarks__\u002Fcampaign-no-postmortem.md",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"__benchmarks__\u002Fno-completed-campaigns.md",816,"https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Flearn\u002F__benchmarks__\u002Fno-completed-campaigns.md",[83,106,132,155,180,199],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":38},"01M6GXSBKE9A2HQWF8QRAZ4WJ5","workspace","Multi-repo campaign coordinator. Same lifecycle as fleet -- scope claims, discovery relay, wave-based execution -- but the unit of work is a repo, not a file. Coordinates campaigns across repositories with shared context.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Fworkspace\u002FSKILL.md",[],[85,90,91,92,93,94,26,95,96,97,23,98,99,21,100,101,102,103,104,105],"repos","snowflake","multi-repo","work","context","coordinate","but","across","shared","as","scope","add","unit","coordinator","fleet","claims",{"skillNo":107,"name":34,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":116,"publishedAt":38},"01M6GXS873AD1Y6RTM6GV47F3E","Markdown-first knowledge base where the LLM acts as librarian. Ingests raw sources, compiles and interlinks topic files, self-maintains an index. No vector DB or embeddings required -- uses LLM-native navigation over structured markdown up to ~400K words.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Fwiki\u002FSKILL.md",[111],{"categoryNo":112,"categoryName":113,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000021","资料检索与研究","SCENARIO","使用场景",[34,117,118,119,120,33,121,122,123,124,25,125,126,127,128,129,99,21,130,131],"vector","embeddings","librarian","markdown","karpathy","knowledge management","karpathy wiki","up","maintain","self","knowledge base","project","db","sources","native",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":38},"01M6GXS2840SJ61285SZ43EJC3","watch","File sentinel that monitors the working directory for changes and marker comments, then auto-triggers appropriate skills. Poll-based via git diff against the last scan commit. Writes intake items for batch processing and routes marker actions through \u002Fdo. Use for automatic reactions to file changes; do NOT use for one-off inspection or tasks needing human judgment per file.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Fwatch\u002FSKILL.md",[],[134,139,140,141,142,143,144,145,146,147,28,148,25,149,150,151,152,153,21,154],"directory","commit","tasks","git","batch","actions","start","sentinel","diff","stop","do","scan","human","judgment","reactions","processing",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":164,"publishedAt":38},"01M6GXRXHYJ5RD9RZP81S2VFSW","verify","Self-test the Citadel hook pipeline from within a live session. Exercises real tool calls (Write, Edit, Bash, Read) and checks that hooks fired, telemetry accumulated, and no errors occurred. Reports HOOK HEALTH: PASS or HOOK HEALTH: FAIL with a per-hook breakdown.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Fverify\u002FSKILL.md",[161],{"categoryNo":162,"categoryName":163,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000008","测试与质量",[157,165,166,167,36,168,169,170,171,172,173,174,175,126,176,21,177,178,179,19],"citadel","telemetry","harness","Bash","tool","read","write","edit","session","hooks","reports","live","hook","errors","calls",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":38},"01M6GXRS9MCJFMQZ917H2XH3AC","unharness","Safely leave Citadel using the active adoption receipt. Produces a no-write, reviewable plan, preserves a portable archive, removes only exact owned material, and reports modified or externally registered surfaces as retained or unknown. Legacy installs must be imported before exact leave is claimed.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Funharness\u002FSKILL.md",[],[182,187,165,167,188,189,190,191,192,124,175,193,194,195,196,197,99,21,198,19],"uninstall","adoption","plan","archive","remove","only","Legacy","surfaces","clean","imported","active","material",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":213,"publishedAt":38},"01M6GXRMEJ2VHD43R9FNPD4910","triage","GitHub issue and PR investigator. Pulls open issues\u002FPRs, classifies them, searches the codebase for root cause or reviews contributed code, proposes fixes with file:line references, and optionally implements fixes. Use for investigating GitHub issues and reviewing PRs; do NOT use for general code review unrelated to GitHub issues.","https:\u002F\u002Fgithub.com\u002FSethGammon\u002FCitadel\u002Fblob\u002Fmain\u002Fskills\u002Ftriage\u002FSKILL.md",[205,208],{"categoryNo":206,"categoryName":207,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":209,"categoryName":210,"taxonomyType":211,"taxonomyTypeDesc":212},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[201,214,215,216,217,218,219,220,221,222,223,224,225,226,149,21,227,228,229,19],"code review","review","review pr","pr","code","github issues","issues","open","use","unrelated","issue","general","references","line","investigator","reviews"]