Skip to content
Back to skills

Condense

ASecurity

SPEC.md condenser — token-budget sweep. Triggers when user invokes `/sdd:condense` or asks to condense spec or /sdd:check emits `## advisory` token-budget overflow line. Phrasings: "/sdd:condense", "condense SPEC.md", "SPEC too big", "shrink the spec", "token budget".

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 25, 2026
developmentpythongobashsqlgit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 25, 2026

npx -y skills add kborovik/spec-driven-dev --skill condense --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Condense?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Condense
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kborovik-condense/badge)](https://www.skillsdirectory.com/skills/kborovik-condense)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: condense
description: |
  SPEC.md condenser — token-budget sweep.
  Triggers when user invokes `/sdd:condense` or asks to condense spec or /sdd:check
  emits `## advisory` token-budget overflow line. Phrasings: "/sdd:condense",
  "condense SPEC.md", "SPEC too big", "shrink the spec", "token budget".
allowed-tools: AskUserQuestion, Read, Edit, Write, Bash(git *), Bash(python3 ${CLAUDE_SKILL_DIR}/../../scripts/check-mechanical.py *), Agent, Skill(sdd:*), TaskCreate, TaskUpdate
model: sonnet
---

# condense — SPEC.md condenser

Operator-triggered six-prong sweep.
Scope: SPEC.md + `SPEC.archive.md` + `.spec/check-extras.md`.
Not auto-fire — /sdd:check emits advisory when token estimate > 20k; operator invokes next turn.
Single atomic commit (all firing prongs or none); rollback `git revert`.
Writes serialize main-thread; per-prong scan reads delegable to sub-agents.

## PROGRESS

Multi-phase run per response-shape invariant → emit live harness checklist.
Phases: LOAD, PROPOSE (six-prong scan), CONFIRM, EXECUTE.
TaskCreate one task per phase @ LOAD start; TaskUpdate `in_progress` @ phase entry → `completed` @ phase exit.
CONFIRM cancel / subset-skip → unreached phases `deleted`, not `completed`.
Checklist = ephemeral harness UI: never repo state, never substitutes the `## Next` block.

## LOAD

1. Read `SPEC.md`.
   Missing → "no spec, nothing to condense."
   Stop.
2. Read `${CLAUDE_PLUGIN_ROOT}/SPEC-FORMAT.md` — row schema + section catalog.
3. Baseline tokens = bytes / `check-mechanical.py` `TOKEN_RATIO` (single source; not hardcode divisor).
   Record.

## PROPOSE

Six prongs, execution order 1 → 6.
Per prong: scan SPEC.md for trigger match; emit firing-set + skip-set w/ 1-line rationale each.

Script modes below run `python3 ${CLAUDE_SKILL_DIR}/../../scripts/check-mechanical.py <mode>`; exact script-path grant pin via `${CLAUDE_SKILL_DIR}` frontmatter substitution (script-sole use, same variable in grant + body cmd) per tooling-preference invariant.

### Prong 1 — §V fold-first sweep

Fold pattern-mirrored sibling §V rows into target row inline.
Seed script-computed: `check-mechanical.py emit-fold-seeds` emits `cluster_members|co_citers` table — connected components of live §V rows sharing a citer (§T `cites` or §B `fix` naming ≥ 2 live §V rows).
Seed advisory not auto-apply: co-citation is candidacy signal not proof; operator confirms each fold @ CONFIRM (LLM judges topic coherence).
Augment seed w/ topic-keyword overlap (shared scope tokens / procedure refs / verb pattern) where co-citation thin.
Fires first — fold reshapes later prongs (prong 6 inherits folded shape).

### Prong 2 — SUPERSEDED §T inline marker

Candidates script-computed: `check-mechanical.py emit-superseded` emits `tid|superseded_v|original_cites` table — closed §T (status `x`) whose §V cite resolves into no live §V row (only archived §V.retired block or nowhere) → SUPERSEDED candidate.
Live-only resolution — distinct from cite-DAG audit live+archive scope.
Consume table; not by-hand per-cite resolution.
Operator confirms each (content-amend-away not cite-detectable).
Replace task body wholesale: `T<n>|x|SUPERSEDED — §V.<m> amend|<original cites>`.
Preserves row id; closes cite-DAG-miss audit noise.

### Prong 3 — §T/§B window-vs-archive split

Trigger: closed §T rows > 50.
Older closed rows → `SPEC.archive.md` (repo-root sibling, committed, id ascending). §T/§B gain per-section marker `## archived: §<S>.<a>..§<S>.<b> → SPEC.archive.md (<n> rows)`.
Archive carries verbatim row text. /sdd:check cite-DAG sweep eager-probes archive; archived rows stable so memo HOLD-SINCE-CLEAN across runs.

### Prong 4 — history-residue prune

Prune history residue across live §V/§T/§B row bodies — SPEC.md is clean current design; history lives in commit log + archive.
Member set = script-owned `PRUNE_PATTERNS` (sole source per freshness-contract + mechanical-realization invariants — shared w/ /sdd:check audit + /sdd:spec write-time prune); consume `check-mechanical.py emit-prune-patterns` → `id|role|pattern|action` table, never a restated member list.
Role application @ trim: `residue` rows → apply `action` (drop; commit msg + `§B.cause`/`§T.cites` cite-DAG preserve narrative); `fold` rows → apply fold action; `pre-filter` rows → exempt match.

**§T body-trim** — owned here because /sdd:build flips status cell only, so §T body not reachable by /sdd:spec write-time prune: oversized `task` cell carrying step-by-step transcript → one-line goal; surplus → commit-msg body.
Mirrors §B `cause` one-line trim.

Verbatim-preservation holds: code, paths, URLs, identifiers, error strings, regex.

### Prong 5 — §V prose → telegraph rewrite

Rewrite embedded English connectives per telegraph skill.
Targets: `Why:`, `For example`, `In other words`, explanatory `because` / `due to` clauses.
Verbatim-preservation holds: code, paths, URLs, identifiers, numbers, versions, error strings, SQL, regex, JSON, YAML, quoted strings.

### Prong 6 — §V audit-recipe extraction

Heavy set script-computed: `check-mechanical.py emit-v-weights` emits `v_row|bytes|tokens|cum_pct|heavy` table, heaviest first; heavy = top rows whose cumulative weight first reaches ≥ 50% of §V-section total (tie-break descending weight then ascending id — run-stable).
Not by inspection.
Heavy rows: extract audit-recipe content → `.spec/check-extras.md` (REPO-LOCAL extension); SPEC.md row keeps 1-line ref.
Check skill loader already path-probes `.spec/check-extras.md` — no check-skill amend.

## CONFIRM

Always fires post-PROPOSE.
Single bulk AskUserQuestion covers full sweep — mid-flow re-prompt not allowed:

- **question**: `Condense SPEC.md: prongs {<firing-set>} firing, {<skip-set>} skipped. Baseline ~<n>k tokens, est. ~<m>k post-sweep. Apply?`
- **header**: `Condense gate`
- **options** (4, mutually exclusive, label is action description):
  - `apply all firing prongs` → EXECUTE full firing set.
  - `force-skip prong 3` → EXECUTE minus prong 3 (archive split deferred; prong 3 load-bearing so explicit override).
  - `subset` → user supplies N in {1..6} via Other-typed input; EXECUTE prong N only.
  - `cancel` → no mutation; PROPOSE report retained as final output.

## EXECUTE

Single atomic commit:

1. Apply firing prongs in order (1 → 6 minus skips).
2. Prong 3 fired → `git add SPEC.archive.md`.
3. Prong 6 fired → `git add .spec/check-extras.md`.
4. Prong 1 fired → cite-DAG sweep same commit; touch REPO-LOCAL citers renumbered by fold.
5. Stage remaining artifacts + `SPEC.md` (`git add`), then path-scoped commit `git commit -m <subject> -- <staged artifacts> SPEC.md` (write-ownership invariant — commit scopes to staged owned set, pre-staged files never leak; `-m` flags ! precede `--`); auto-commit msg `condense SPEC.md: prongs {<firing-set>} (~<n>k → ~<m>k tokens)`; no user prompt.

EXECUTE ends @ commit.
Rollback `git revert <condense-sha>`.
Drift cascade → Next-block item #1; operator dispatches next turn.

## MECHANIZE — script-candidate scan

Recipe end → before the `## Next` block, scan this run for a mechanization candidate.
Candidate = any of:

- ≥ 2 same-shape deterministic calls this run (identical command modulo args)
- LLM-side join / sort / count / dedup over script-emittable data
- multi-step parse collapsible to one script emit mode
- fresh regex paraphrase of an existing mechanical rule (mechanical-realization invariant class)

Hit → emit exactly one `## Next` item naming the observed pattern + proposed script mode; none → no item.
Never self-implement the mechanization mid-run (recipe-step-no-dispatch + write-ownership invariants).
Route by cwd:

- dev repo (this plugin) → /sdd:spec → new §T row
- consumer repo, plugin-target → monitor dispatched `mechanization-candidate` path (monitor-protocol invariant)
- consumer repo-local → consumer /sdd:spec → `.spec/check-extras` row

## OUTPUT — "Next" block

Heading `## Next`; 1–5 atomic items (one sentence each, no `Reply` prefix); positional dispatch (`run <int>` or `run /<plugin>:<cmd> [args]`).
Optional `## Hint` (≤ 3 lines) precedes when item selection needs hidden state.
State-mutator → post-EXECUTE prefer `/sdd:check` (confirm cite-DAG + format-layer + token-budget clean).

Example after EXECUTE (firing-set {1,2,3,4,5}; commit auto-fired):

```
## Next

1. /sdd:check — cascade scan over condensed SPEC.md
2. /sdd:build --next — start the next pending §T row
3. git revert <condense-sha> — rollback if condensation breaks downstream
```

Variants: CONFIRM cancel (no commit) → swap item 1 for `/sdd:condense` (re-run to apply after spec review), drop item 3.
CONFIRM subset → Next-block unchanged.

## NON-GOALS

- not auto-fire — /sdd:check emits advisory; operator invokes /sdd:condense next turn.
- not partial commit — every firing prong applies or none.
- not retune thresholds (20k-token advisory, > 50 closed-§T archive trigger) in this skill body — canonical values live in the token-budget-condense invariant row (SPEC.md) w/ mechanical mirrors in `check-mechanical.py` constants; retune via /sdd:spec AMEND + sync the script constant same commit.

Files in this skill

  • SKILL.md9.1 KB
  • evals/evals.json1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.