Get the FREE Ultimate OpenClaw Setup Guide →

doc-consolidation

npx machina-cli add skill athola/claude-night-market/doc-consolidation --openclaw
Files (1)
SKILL.md
9.4 KB

Table of Contents

Doc Consolidation

Extracts valuable knowledge from ephemeral LLM outputs and merges it into permanent documentation.

When To Use

Use this skill when:

  • You have untracked *_REPORT.md or *_ANALYSIS.md files from Claude sessions
  • Git status shows markdown files that shouldn't be committed but contain useful content
  • You want to preserve insights from code reviews, refactoring reports, or API audits
  • Preparing a PR and need to clean up working artifacts

Do NOT use when:

  • Files are already in proper documentation locations (docs/, skills/)
  • Files are intentionally temporary scratch notes
  • User explicitly wants to preserve the original report format
  • Source files have no extractable value (pure log output)

When NOT To Use

  • Files are already in docs/ or skills/ locations
  • Files are intentionally temporary scratch notes
  • Source files have no extractable value
  • Files are already in docs/ or skills/ locations

Quick Start

/consolidate-docs

Verification: Run the command with --help flag to verify availability.

Or invoke directly:

**Verification:** Run the command with `--help` flag to verify availability.
I have some report files that need consolidating into permanent docs.

Verification: Run the command with --help flag to verify availability.

Two-Phase Workflow

Phase 1: Triage (Fast Model)

Read-only analysis to generate a consolidation plan:

  1. Detect candidates - Find untracked markdown files with LLM output markers
  2. Analyze content - Extract and categorize valuable sections
  3. Route destinations - Match content to existing docs or propose new files
  4. Present plan - Show user what will be consolidated and where

Checkpoint: User reviews and approves plan before execution.

Phase 2: Execute (Main Model)

After approval, performs the consolidation:

  1. Merge content - Weave into existing docs or create new files
  2. Delete sources - Remove ephemeral files after successful merge
  3. Generate summary - Report what was created/updated/deleted

Workflow Details

Step 1: Candidate Detection

Load: @modules/candidate-detection.md

Identifies files using:

  • Git status (untracked .md files)
  • Location (not in standard doc directories)
  • Naming (ALL_CAPS non-standard names)
  • Content markers (Executive Summary, Findings, Action Items)

Step 2: Content Analysis

Load: @modules/content-analysis.md

For each candidate:

  • Extract sections as content chunks
  • Categorize: Actionable Items, Decisions, Findings, Metrics, Migration Guides, API Changes
  • Score value: high/medium/low

Step 3: Destination Routing

Load: @modules/destination-routing.md

For each valuable chunk:

  • Semantic match against existing documentation
  • Apply default mappings if no good match
  • Determine merge strategy (weave, replace, append, create)

Step 4: Generate Plan

Present consolidation plan to user:

# Consolidation Plan

## Source: API_REVIEW_REPORT.md

| Content | Category | Value | Destination | Action |
|---------|----------|-------|-------------|--------|
| API inventory | Findings | High | docs/api-overview.md | Create |
| Action items | Actionable | High | docs/plans/2025-12-06-api.md | Create |

### Post-Consolidation
- Delete: API_REVIEW_REPORT.md

Proceed with consolidation? [Y/n]

Verification: Run the command with --help flag to verify availability.

Step 5: Execute Merges

Load: @modules/merge-execution.md

After user approval:

  • Group operations by destination file
  • Apply merge strategies
  • Validate results (frontmatter intact, structure preserved)
  • Delete source files
  • Generate execution summary

Fast Model Delegation

Phase 1 tasks are delegated to haiku-class models for efficiency:

# plugins/sanctum/scripts/consolidation_planner.py handles:
- scan_for_candidates()
- extract_content_chunks()
- categorize_chunks()
- score_value()
- find_semantic_matches()

Verification: Run the command with --help flag to verify availability.

Phase 2 stays on the main model for careful merge execution.

Content Categories

CategoryDescriptionDefault Destination
Actionable ItemsTasks, TODOs, next stepsdocs/plans/YYYY-MM-DD-{topic}.md
Decisions MadeArchitecture choicesdocs/adr/NNNN-{date}-{topic}.md
Findings/InsightsAudit results, analysisBest-match existing doc
Metrics/BaselinesBefore/after comparisonsdocs/benchmarks/
Migration GuidesStep-by-step proceduresdocs/migration-guide.md
API ChangesBreaking changes, deprecationsCHANGELOG or api docs

Merge Strategies

Intelligent Weave

Insert content into matching existing sections, preserving style.

Use when: Destination has relevant section, content is additive.

Replace Section

Replace existing section with more detailed new content.

Use when: New content 2x+ more detailed or has later date.

Append with Context

Add new section with date and source reference.

Use when: No matching section, content doesn't fit existing structure.

Create New File

Generate complete new document.

Use when: No suitable destination exists, content warrants standalone doc.

Integration

Works with other sanctum skills:

  • git-workspace-review: May suggest consolidation when untracked reports detected
  • pr-prep: Warns about untracked analysis files before PR creation
  • doc-updates: Can invoke for final polish after consolidation

Example Session

**Verification:** Run the command with `--help` flag to verify availability.
User: I have API_REVIEW_REPORT.md from our review session. Can you consolidate it?

Claude: I'll consolidate the report into permanent documentation.

**Phase 1: Triage**

Scanning for candidates...
- Found: API_REVIEW_REPORT.md (untracked, LLM markers detected)

Analyzing content...
- Extracted 6 content chunks
- High value: API inventory, action items, CLI recommendation
- Medium value: security assessment
- Low value: executive summary (generic)

Routing destinations...
- API inventory → docs/api-overview.md (CREATE)
- Action items → docs/plans/2025-12-06-api-consistency.md (CREATE)
- CLI naming → docs/adr/0002-cli-naming.md (CREATE ADR)
- Security → Already covered in docs/security.md (SKIP)

**Consolidation Plan**
[table shown]

Proceed? [Y/n]

User: Y

Claude: **Phase 2: Executing**

Created: docs/api-overview.md (1,247 bytes)
Created: docs/plans/2025-12-06-api-consistency.md (892 bytes)
Created: docs/adr/0002-2025-12-06-cli-naming.md (634 bytes)
Deleted: API_REVIEW_REPORT.md

Consolidation complete. Review the created files and commit when ready.

Verification: Run the command with --help flag to verify availability.

Troubleshooting

No candidates found

  • Check git status for untracked files
  • Files may already be in standard locations
  • Try explicit file path: "Consolidate API_REVIEW_REPORT.md"

Low-quality extractions

  • Source file may lack structured sections
  • Content may be too generic to categorize
  • Try manual extraction for unstructured reports

Merge conflicts

  • Destination file structure changed
  • Try APPEND strategy instead of WEAVE
  • Manual intervention may be needed

Related Skills

  • sanctum:doc-updates - General documentation updates
  • sanctum:git-workspace-review - Pre-flight workspace analysis
  • sanctum:pr-prep - Pull request preparation
  • imbue:catchup - Understanding recent changes

Source

git clone https://github.com/athola/claude-night-market/blob/master/plugins/sanctum/skills/doc-consolidation/SKILL.mdView on GitHub

Overview

Doc Consolidation extracts valuable knowledge from ephemeral LLM outputs and merges it into permanent documentation. It targets untracked *_REPORT.md and *_ANALYSIS.md files, analyzes content, and routes it to existing docs or creates new files, then deletes the source artifacts after a successful merge. This helps preserve insights from code reviews and API audits while keeping the repo clean for PRs.

How This Skill Works

The process runs in two phases. Phase 1 (Triage) performs a read-only analysis to detect candidate files, extract valuable sections, route destinations, and present a consolidation plan for user review. Phase 2 (Execute) merges the approved content into the target documentation and deletes the original source files to maintain git hygiene.

When to Use It

  • You have untracked *_REPORT.md or *_ANALYSIS.md files from Claude sessions.
  • Git status shows markdown artifacts that contain useful content you don’t want to commit.
  • You want to preserve insights from code reviews, refactoring reports, or API audits.
  • You are preparing a PR and need to clean up working artifacts while keeping findings.
  • You need to turn ephemeral outputs into permanent docs for long-term knowledge management.

Quick Start

  1. Step 1: Run /consolidate-docs to begin gathering content from untracked markdown files.
  2. Step 2: Verify availability and detected candidates with the --help flag to confirm options.
  3. Step 3: Review the proposed plan, approve the consolidation, and let the tool merge and clean up source artifacts.

Best Practices

  • Validate the consolidation destination before merging by reviewing the generated plan in Phase 1.
  • Only consolidate files with extractable value; skip pure logs or empty artifacts.
  • Ensure sources are not already stored in docs/ or skills/ locations before running.
  • Follow the two-phase workflow and obtain explicit user approval prior to execution.
  • After a successful merge, delete the original *_REPORT.md and *_ANALYSIS.md files to avoid drift.

Example Use Cases

  • Consolidate a Claude session REPORT.md into docs/api/SESSION.md to preserve API usage insights.
  • Merge a FEAT_ANALYSIS.md into docs/architecture/FEATURE_AUDIT.md after a refactor.
  • Move CODE_REVIEW_ANALYSIS.md content into docs/reviews/CHANGELOG.md to capture decisions.
  • Incorporate an API_REVIEW_REPORT.md into docs/api/endpoints.md for updated endpoint details.
  • Consolidate an ephemeral QA_REPORT.md into docs/testing/QA.md for test coverage improvements.

Frequently Asked Questions

Add this skill to your agents

Related Skills

pdf

anthropics/skills

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

claude-md-optimizer

smith-horn/product-builder-starter

Optimize oversized CLAUDE.md files using progressive disclosure. Analyzes content tiers, detects encryption constraints, creates sub-documents, and rewrites the main file with a Sub-Documentation Table. Triggers: optimize CLAUDE.md, reduce CLAUDE.md size, CLAUDE.md too long, apply progressive disclosure to CLAUDE.md

explain-codebase

suryast/free-ai-agent-skills

Drop into any repo and generate a structured architecture overview. Maps the codebase, identifies entry points, frameworks, and dependencies — then produces a "start here" guide for new contributors.

pattern-capture

Pamacea/smite

Invoke AFTER successful feature implementation when 'that went well', 'save this pattern', 'document this approach', 'capture this solution' - captures reusable code patterns with context (before/after, steps, benefits, trade-offs) for future team knowledge sharing. Auto-triggers on multi-file refactors or complex problem solutions. Specific phrases: 'save pattern', 'document approach', 'capture solution'. (user)

doc-coauthoring

anthropics/skills

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

docx

anthropics/skills

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

Sponsor this space

Reach thousands of developers