cavekit-archive
Archive old project-root SPEC.md content when file exceeds 500 lines. Copies full SPEC.md to .cavekit/archive/ before trimming completed tasks, old bugs, and uncited constraints/interfaces/invariants. Use when users invoke /ck:archive or ask to archive, trim, or compact Cavekit SPEC.md.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 16
- Forks
- 9
01 前言 Front Matter
- name
- cavekit-archive
- description
- Archive old project-root SPEC.md content when file exceeds 500 lines. Copies full SPEC.md to .cavekit/archive/ before trimming completed tasks, old bugs, and uncited constraints/interfaces/invariants. Use when users invoke /ck:archive or ask to archive, trim, or compact Cavekit SPEC.md.
03 SKILL.md 正文
cavekit-archive — compact SPEC.md
Archive long project-root SPEC.md files. Full copy first; trim working copy only after explicit user approval.
Read bundled ../../FORMAT.md before interpreting or editing SPEC.md. The bundled file defines section order, pipe-table rules, archive comments, ID monotonicity, and caveman-style encoding.
PRECHECK
- Read project-root
SPEC.md. If missing, reportno SPEC.md, nothing to archiveand stop. - Count lines. If
SPEC.mdhas≤500lines, reportSPEC.md is <N> lines. Nothing to archive.and stop with no writes. - Read bundled
../../FORMAT.mdif not already loaded. - Determine target archive path:
.cavekit/archive/SPEC-<YYYY-MM-DD>.md; if it exists, use-2,-3, etc.
DRY-RUN PREVIEW — no writes
Analyze SPEC.md. Do not create directories, archive files, or edit SPEC.md during preview.
Compute:
lines before= total line count.- §T candidates: rows with status
x; list IDs/ranges and line count. - §B candidates: rows whose
dateis older than 90 days; list IDs/ranges and line count. - Active cites: collect
citescells from §T rows with status.or~. - §V candidates:
V<n>lines not cited by active §T; list IDs/ranges and line count. - §I candidates: interface items not cited by active §T; list refs and line count.
- §C candidates: constraints not cited by active §T; list count and line count.
lines after=lines beforeminus removed candidate lines plus one archive comment per trimmed section.
Show preview:
## archive preview
archive target: .cavekit/archive/SPEC-<YYYY-MM-DD>.md
§T would archive: T1, T3-T8, T12 (9 tasks completed)
§B would archive: B1-B4 (4 bugs older than 90 days)
§V would archive: V1,V3-V5 (4 invariants, no active task cites them)
§I would archive: I.cli (1 interface, no active task cites it)
§C would archive: 2 constraints, no active task cites them
§G untouched
lines before: 533
lines after: 100
Ask approval with ask_user_question after preview. Do not use a prose-only Proceed? prompt. Offer 2-4 options:
Proceed (Recommended)→ continue to ARCHIVE + TRIM.Amend preview→ user changes include/exclude choices, then rerun dry-run preview.Stop→ stop with no writes.
If user approves, continue to ARCHIVE + TRIM. If user stops, write nothing. If user amends, incorporate requested include/exclude changes and rerun dry-run preview.
ARCHIVE
- Create
.cavekit/archive/if absent. - Copy exact full pre-trim
SPEC.mdto chosen archive path. - Do not normalize line endings, rewrite content, or modify the archive copy.
- Only after archive copy succeeds, edit working
SPEC.md.
TRIM
Trim only working SPEC.md. Archive copy remains exact and untouched.
§T — completed tasks
- Remove rows with status
x. - Preserve remaining
.and~rows. - Insert archive comment above §T table header:
<!-- archive: .cavekit/archive/SPEC-<date>.md §T T1-T12 -->
§B — old bugs
- Remove §B rows older than 90 days.
- Preserve recent rows.
- Insert archive comment above §B table header:
<!-- archive: .cavekit/archive/SPEC-<date>.md §B B1-B5 -->
§V — uncited invariants
- Collect live
V<n>refs from active §T rows only (.or~). - Remove
V<n>lines not in live set. - Insert archive comment above §V archived range:
<!-- archive: .cavekit/archive/SPEC-<date>.md §V V1,V3-V5 -->
§I — uncited interfaces
- Collect live
I.*refs from active §T rows only (.or~). - Remove §I items not in live set.
- Insert archive comment above §I archived range:
<!-- archive: .cavekit/archive/SPEC-<date>.md §I I.api,I.cli -->
§C — uncited constraints
- Collect live §C refs from active §T rows only (
.or~). - Remove §C bullets not in live set.
- Insert archive comment above §C archived range:
<!-- archive: .cavekit/archive/SPEC-<date>.md §C -->
§G — never touched
Do not edit §G.
REPORT
After writes, show changed path, archive path, and diff summary:
## archive report
saved to: .cavekit/archive/SPEC-2026-05-15.md
§T archived: T1, T3-T8, T12 (9 tasks completed)
§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)
§C archived: 2 constraints
§G untouched
lines before: 542
lines after: 218
RULES
- Archive = exact full pre-trim copy. Content loss ⊥.
- No writes before dry-run preview and explicit user OK through
ask_user_question. - Missing
SPEC.mdor≤500lines → no write. - One archive file per run. If same-day archive exists, suffix
-2,-3, etc. - §G never removed or changed.
- §T removes only completed rows (
x). - §B removes only rows older than 90 days.
- §C, §I, and §V remove only items uncited by active §T (
.or~). - Archive comments must include archive path, section, and ranges/refs when applicable.
- After archive, cavekit-spec/build/check must resolve IDs/cites from current tables plus archive comments and archived
SPEC.mdcopies. Never reuse IDs. - Do not commit unless user explicitly asks in this session.
04 同仓库更多 Skills
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
unslop
Cut AI tells from any writing.
typescript-best-practices
TypeScript best practices. Use when reading or editing any .ts or .tsx file.
technical-writing
Layered technical-writing standard: Diátaxis structure, Google developer style sentences, STE instruction rules, Global English syntax. Use for /skill:technical-writing or when writing or reviewing docs, RFCs, readmes, PR descriptions, or commit messages.
teach
Explain a body of work plainly so a person actually understands it. Runs the `how` and `why` skills and weaves what they find into one clear explanation. Use for 'teach me this', 'help me really understand X', 'explain this change or subsystem to me'.
tdd
Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.