Skip to content

feat: archive#30

Open
zanz9 wants to merge 1 commit into
JuliusBrussee:mainfrom
zanz9:feat-archive
Open

feat: archive#30
zanz9 wants to merge 1 commit into
JuliusBrussee:mainfrom
zanz9:feat-archive

Conversation

@zanz9

@zanz9 zanz9 commented May 15, 2026

Copy link
Copy Markdown

Why

SPEC.md grows unbounded as projects accumulate tasks, bugs, and invariants. FORMAT.md mentions a 500-line limit but provides no mechanism to enforce it. Without compaction, spec files become expensive to load and slow to parse.

What

Adds /archive command — two-phase spec compaction:

  1. RESEARCH (dry-run) — scans SPEC.md, identifies what can be archived, shows exact lines before → lines after. No files touched.
  2. ARCHIVE + TRIM — only after user confirmation. Copies full SPEC.md to .cavekit/archive/SPEC-<date>.md, then trims working copy.

Archives:

  • §T — completed tasks (status x)
  • §B — bugs older than 90 days
  • §V — invariants not cited by any active task
  • §I — interfaces not cited by any active task
  • §C — constraints not cited by any active task
  • §G — untouched (project identity)

Archive comments in SPEC.md carry ID ranges (<!-- archive: .cavekit/archive/SPEC-2026-05-15.md §T T1-T12 -->) so numbering stays monotonic and new tasks can reference archived items.

All existing skills (spec, build, check, backprop) updated to read .cavekit/archive/ when needed.

Files

file change
commands/archive.md new — /archive slash command
skills/archive/SKILL.md new — /archive skill
FORMAT.md ARCHIVE section + /archive in command table
commands/spec.md next ID parses archive comments
skills/spec/SKILL.md monotonic IDs across archives
skills/check/SKILL.md archive-aware drift checks
skills/build/SKILL.md reads archive for invariant context
skills/backprop/SKILL.md searches archive for similar past bugs

How to test

1. Create a SPEC.md with 500+ lines
2. Run /archive
3. Verify dry-run shows correct lines before → lines after
4. Confirm → verify .cavekit/archive/SPEC-<date>.md is exact copy
5. Verify SPEC.md trimmed correctly, archive comments present
6. Run /ck:spec — new tasks should continue numbering from archived max

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces an /archive workflow to keep SPEC.md compact (targeting the documented 500-line limit) by copying the full spec into .cavekit/archive/ and trimming completed/old/unreferenced sections, while updating other skills/commands to be archive-aware (notably for ID monotonicity and historical lookup).

Changes:

  • Added /archive command docs and an archive skill describing a two-phase (dry-run → confirm) compaction process.
  • Updated /spec and spec skill guidance to keep IDs monotonic across archives by incorporating archive comment ranges.
  • Updated check, build, and backprop skills, plus FORMAT.md, to account for .cavekit/archive/ as historical context.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
commands/archive.md New /archive command documentation (research + archive + trim).
commands/spec.md Updates /spec rules to consider archive ranges for monotonic IDs.
FORMAT.md Adds ARCHIVE section and documents /archive in the command table.
skills/archive/SKILL.md New archive skill defining archiving/trimming behavior and reporting.
skills/backprop/SKILL.md Adds guidance to consult archives for similar historical bugs.
skills/build/SKILL.md Adds guidance to consult archives for historical invariant/interface context.
skills/check/SKILL.md Adds archive awareness and guidance for historical checks.
skills/spec/SKILL.md Updates spec-writing rules for monotonic IDs across archives.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commands/spec.md
Comment on lines +67 to +70
- Numbering monotonic — never reuse §V.N, §B.N, or §T.N.
- Next ID = max(current table IDs + archive comment ranges) + 1.
Parse `<!-- archive: ... §T T1-T12 -->` to find archived ranges.
Never start from T1/B1 if archive comments exist.
Comment thread skills/spec/SKILL.md
Comment on lines +75 to +78
- Numbering monotonic — never reuse §V.N, §B.N, or §T.N.
- Next ID = max(current table IDs + archive comment ranges) + 1.
Parse `<!-- archive: ... §T T1-T12 -->` to find archived ranges.
Never start from T1/B1 if archive comments exist.
Comment thread FORMAT.md
Comment on lines +111 to +114
When SPEC.md > 500 lines, `/archive` skill handles it:

1. Copy **full** SPEC.md → `.cavekit/archive/SPEC-<date>.md`
2. In working SPEC.md:
Comment thread FORMAT.md
| `/spec new` | creates | all |
| `/spec amend` | edits | chosen |
| `/spec bug` | appends | §B + §V |
| `/archive` | archives + trims | §T done, §B old |
Comment thread skills/build/SKILL.md
1. Read `SPEC.md`. If missing → tell user to invoke the spec skill first. Stop.
2. Read `FORMAT.md` once if not loaded.
3. Parse invocation args:
3. Check `.cavekit/archive/` — if task cites an invariant that archive comments link to archived §T rows, read relevant archive file for context on how that invariant was previously implemented.
Comment thread commands/archive.md

### §B — old bugs

1. Find all rows where date column > 90 days old.
Comment thread commands/archive.md
§B archived: B1-B4 (4 bugs older than 90 days)
§V archived: V1,V3-V5 (4 invariants, no active task cites them)
§I archived: I.cli (1 interface, no active task cites it)
§G §C untouched
Comment thread skills/archive/SKILL.md
Steps:
1. Count total lines → `lines before`.
2. §T: count rows with status `x`. List their IDs. Count their lines.
3. §B: count rows with date > 90 days old. List their IDs. Count their lines.
Comment thread skills/archive/SKILL.md

### §B — old bugs

1. Find all rows where date column > 90 days old.
Comment thread skills/archive/SKILL.md
§B archived: B1-B4 (4 bugs older than 90 days)
§V archived: V1,V3-V5 (4 invariants, no active task cites them)
§I archived: I.cli (1 interface, no active task cites it)
§G §C untouched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants