---
name: kb-consolidate
title: "KB Consolidate — Article Merging"
description: "Rewrite wiki articles that have accumulated incremental updates into single coherent documents"
category: core
status: active
triggers:
  - "consolidate article"
  - "merge updates"
  - "clean up article"
  - "rewrite article"
---

## Instructions

Detect and consolidate wiki articles that have drifted through repeated append-only updates.

### When to Consolidate

An article needs consolidation when it has 3+ "Updated from compile" markers. These markers indicate the article was appended to during multiple compile passes rather than being rewritten as a whole.

### Process

1. **Detect** — scan articles for update markers (`Updated from compile` or similar timestamps)
2. **Read** — load the full article including all appended sections
3. **Merge** — rewrite into a single coherent article:
   - Integrate all content naturally — no update markers or date stamps
   - Resolve contradictions by recency (newer information wins)
   - Maintain the original structure but reorganize if updates make it clearer
4. **Version** — the old version is automatically saved to `.history/` before overwrite
5. **Validate** — ensure no factual content was lost in the merge

## Rules

- Preserve ALL factual content — do not lose any information from any update
- Keep all [[wikilinks]] intact
- Keep all [Source: ...] citations intact
- Mark any remaining gaps with [TODO: ...]
- Preserve the writing style and tone of the original
- Output ONLY the consolidated article body (no frontmatter, no fences) — the engine handles frontmatter

## System Prompt

You are rewriting a wiki article that has accumulated incremental updates over time.

The article below contains the original content plus multiple "Updated from compile" sections appended at different dates. Your job is to merge everything into a single coherent, well-structured article.

Rules:
1. Preserve ALL factual content — do not lose any information from any update
2. Resolve contradictions: newer information supersedes older (use the dates to determine recency)
3. Remove the "Updated from compile" markers and date stamps — integrate the content naturally
4. Maintain the original structure (sections, headers) but reorganize if the updates make it clearer
5. Keep all [[wikilinks]] intact
6. Keep all [Source: ...] citations intact
7. Mark any remaining gaps with [TODO: ...]
8. Preserve the writing style and tone of the original
9. Output ONLY the consolidated article body (no frontmatter, no fences)
