一键导入
ctx-consolidate
Consolidate redundant entries in LEARNINGS.md or DECISIONS.md. Use when ctx drift reports high entry counts or entries overlap.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Consolidate redundant entries in LEARNINGS.md or DECISIONS.md. Use when ctx drift reports high entry counts or entries overlap.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ctx-consolidate |
| description | Consolidate redundant entries in LEARNINGS.md or DECISIONS.md. Use when ctx drift reports high entry counts or entries overlap. |
| allowed-tools | Bash(ctx:*), Read, Edit, Write |
Analyze entries in LEARNINGS.md and/or DECISIONS.md, group overlapping entries by topic, and (with user approval) merge groups into denser consolidated entries. Originals are archived, not deleted.
Consolidation != archival. Archival moves old entries to the archive directory. Consolidation replaces verbose entries with tighter ones: the file stays useful, just denser. The originals move to archive as a paper trail.
ctx drift reports entry counts above threshold
(default: 30 learnings, 20 decisions)Read the target file(s):
# Check entry counts first
ctx drift --json
Then read the files directly:
Parse entries by their ## [YYYY-MM-DD-HHMMSS] Title headers. Each
entry extends from its header to the line before the next header or
end of file.
For each entry, extract keywords from its title and body:
Build a keyword-to-entries map. Entries sharing 2 or more non-trivial keywords are candidates for the same group.
Grouping rules:
Show the user what you found. Format:
Consolidation candidates for LEARNINGS.md:
Group 1: "Hook behavior" (5 entries)
- [2026-01-15] Hook scripts can lose execute permission
- [2026-01-20] Two-tier hook output is sufficient
- [2026-02-03] Claude Code Hook Key Names
- [2026-02-09] Agent ignores repeated hook output
- [2026-02-16] Security docs vulnerable after migrations
-> Proposed: merge into 1 consolidated entry
Group 2: "Path handling" (3 entries)
- [2026-01-10] Path construction uses stdlib
- [2026-02-05] G304 gosec false positives
- [2026-02-16] gosec G301/G306 permissions
-> Proposed: merge into 1 consolidated entry
Ungrouped: 12 entries (no consolidation needed)
Wait for the user to approve, modify, or reject each group. Do NOT proceed without explicit confirmation.
For each approved group, write a consolidated entry that:
YYYY-MM-DD-HHMMSS format**Consolidated from** lineFormat:
## [YYYY-MM-DD-HHMMSS] Hook behavior (consolidated)
**Consolidated from**: 5 entries (2026-01-15 to 2026-02-16)
- Hook scripts can lose execute permission without warning; always
restore +x after sync operations
- Two-tier output (stdout for AI context, stderr+exit for blocks)
is sufficient; don't over-engineer severity levels
- Claude Code hook key names are case-sensitive: PreToolUse, not
pre_tool_use
- Agents develop repetition fatigue: vary hook output phrasing
across invocations
- After infrastructure migrations, audit security docs first:
stale paths in security guidance give false confidence
For each approved group:
# Learnings or # Decisions header)archive/learnings-consolidated-YYYY-MM-DD.md in the context
directory (or decisions-consolidated-YYYY-MM-DD.md)No index rebuild is needed: the quick-reference index is computed on
demand by ctx index <file>, never stored in the file.
Consolidated LEARNINGS.md:
- Group "Hook behavior": 5 entries -> 1 (originals archived)
- Group "Path handling": 3 entries -> 1 (originals archived)
Total: 8 entries consolidated into 2. File reduced from 47 to 41 entries.
Archive: archive/learnings-consolidated-2026-02-19.md (in context dir)
The archive file uses the same Markdown format as the source file. Each archived entry keeps its original timestamp and content, preceded by a header noting which consolidated entry replaced it:
# Archived Learnings (consolidated 2026-02-19)
Originals replaced by consolidated entries in LEARNINGS.md.
## Group: Hook behavior
## [2026-01-15-120000] Hook scripts can lose execute permission
(original content preserved verbatim)
## [2026-01-20-093000] Two-tier hook output is sufficient
(original content preserved verbatim)
ctx task archive
for tasks; conventions rarely need consolidationBefore reporting results:
Dry-run the progressive-disclosure pass: inspect a knowledge file's staging zone, propose a theme per staged entry, author gists, and show the digest plan — WITHOUT moving anything. Use to preview how LEARNINGS.md / DECISIONS.md would fold into themes when a file grows large.
Dry-run the progressive-disclosure pass: inspect a knowledge file's staging zone, propose a theme per staged entry, author gists, and show the digest plan — WITHOUT moving anything. Use to preview how LEARNINGS.md / DECISIONS.md would fold into themes when a file grows large.
Scaffold a pull-request body from the current branch's commits, Spec: trailers, and closed TASKS into gitignored inbox/ for the human to paste. Use when preparing or opening a PR for a ctx branch. Never pushes and never creates the PR.
Enrich architecture artifacts with code intelligence data. Takes existing /ctx-architecture output as baseline, verifies and quantifies with GitNexus MCP (blast radius, execution flows, domain clustering, registration sites). Run after /ctx-architecture, not instead of it.
Recall project context and present structured readback. Use when the user asks 'do you remember?', at session start, or when context seems lost.
Recall project context and present structured readback. Use when the user asks 'do you remember?', at session start, or when context seems lost.