dsh-caveman 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -61,9 +61,11 @@ export function apply(ctx) {
61
61
  const projections = ctx.get('sessionProjections')
62
62
 
63
63
  if (projections !== undefined) {
64
+ // rc.7+: client visibility requires wire (viewSchema + view); the bare
65
+ // top-level schema/view fields are ignored by the rc.2 registry.
64
66
  projections.register({
65
67
  key: 'caveman',
66
- schema,
68
+ stateSchema: schema,
67
69
  stateVersion: 1,
68
70
  init: () => ({ mode: 'full' }),
69
71
  apply: (state, event) => {
@@ -72,7 +74,10 @@ export function apply(ctx) {
72
74
  if (!VALID.includes(mode) || state.mode === mode) return state
73
75
  return { mode }
74
76
  },
75
- view: (state) => ({ mode: state.mode }),
77
+ wire: {
78
+ viewSchema: schema,
79
+ view: (state) => ({ mode: state.mode }),
80
+ },
76
81
  })
77
82
  }
78
83
 
@@ -190,4 +195,4 @@ export function apply(ctx) {
190
195
  }
191
196
 
192
197
  console.log('[caveman] host active (event projection + KNOWN registration)')
193
- }
198
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-caveman",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -8,7 +8,7 @@
8
8
  "./client": "./lib/client.js",
9
9
  "./package.json": "./package.json"
10
10
  },
11
- "description": "Per-session caveman mode state (session projection unit) + composer dock badge + /caveman command + prompt-section injection. Ships the caveman family skills.",
11
+ "description": "Per-session caveman mode state (session projection unit) + composer dock badge + /caveman command + prompt-section injection. Caveman skills ship from the deployment shared skill library (see ~/.dsh/skills), not from this package.",
12
12
  "license": "MIT",
13
13
  "keywords": [
14
14
  "dsh",
@@ -21,9 +21,7 @@
21
21
  ],
22
22
  "files": [
23
23
  "lib",
24
- "skills",
25
- "cordis.patch.yml",
26
- "THIRD_PARTY_NOTICES"
24
+ "cordis.patch.yml"
27
25
  ],
28
26
  "dependencies": {
29
27
  "zod": "^4.4.3"
@@ -37,4 +35,4 @@
37
35
  "inject": []
38
36
  }
39
37
  }
40
- }
38
+ }
@@ -1,37 +0,0 @@
1
- Third-party notices for dsh-caveman
2
- ====================================
3
-
4
- This package bundles skills under `skills/`. Their provenance:
5
-
6
- - `skills/caveman-*` (caveman, caveman-commit, caveman-compress,
7
- caveman-help, caveman-review, caveman-stats): derived from / inspired by
8
- the open-source caveman toolkit
9
- (https://github.com/JuliusBrussee/caveman), which declares an MIT license
10
- ("this MIT license covers this repo"). The Python scripts under
11
- `skills/caveman-compress/scripts/` are covered by that MIT declaration.
12
- Redistributed under MIT with gratitude to the original author.
13
-
14
- - `skills/cavecrew`: original work of this package's authors.
15
-
16
- MIT License
17
- -----------
18
-
19
- Copyright (c) 2026 dsh-caveman contributors
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice and this permission notice shall be included in all
29
- copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
@@ -1,61 +0,0 @@
1
- # cavecrew
2
-
3
- Decision guide. When to delegate to caveman subagents instead of doing the work inline.
4
-
5
- ## What it does
6
-
7
- Tells the main thread when to spawn a caveman-style subagent versus the vanilla equivalent. The win: subagent tool-results inject back into main context verbatim, and caveman output is roughly 1/3 the size of vanilla prose. Across 20 delegations in one session, that is the difference between context exhaustion and finishing the task.
8
-
9
- Three subagents:
10
-
11
- | Subagent | Job | Use when |
12
- |----------|-----|----------|
13
- | `cavecrew-investigator` | Locate code (read-only) | "Where is X defined / what calls Y / list uses of Z" |
14
- | `cavecrew-builder` | Surgical edit, 1-2 files | Scope is obvious, ≤2 files. Refuses 3+ file scope. |
15
- | `cavecrew-reviewer` | Diff/file review | One-line findings with severity emoji |
16
-
17
- Use vanilla `Explore` or `Code Reviewer` when you want prose, architecture commentary, or rationale. Use main thread directly for one-line answers and 3+ file refactors.
18
-
19
- This skill is a decision guide, not a slash command. It activates when the conversation mentions delegation.
20
-
21
- ## How to invoke
22
-
23
- Triggers on phrases like "delegate to subagent", "use cavecrew", "spawn investigator", "save context", "compressed agent output".
24
-
25
- ## Example chaining
26
-
27
- Locate → fix → verify (most common):
28
-
29
- 1. `cavecrew-investigator` returns site list (`path:line — symbol — note`)
30
- 2. Main thread picks 1-2 sites, hands paths to `cavecrew-builder`
31
- 3. `cavecrew-reviewer` audits the resulting diff
32
-
33
- Parallel scout: spawn 2-3 `cavecrew-investigator` calls in one message with different angles (defs, callers, tests). Aggregate in main.
34
-
35
- ## Model overrides
36
-
37
- By default, `cavecrew-reviewer` and `cavecrew-investigator` pin `model: haiku` in their frontmatter; `cavecrew-builder` has no `model:` line (uses the API session default). Set env vars in your shell before launching Claude Code to override per-agent:
38
-
39
- | Env var | Agent |
40
- |---|---|
41
- | `CAVECREW_REVIEWER_MODEL` | `cavecrew-reviewer` |
42
- | `CAVECREW_BUILDER_MODEL` | `cavecrew-builder` |
43
- | `CAVECREW_INVESTIGATOR_MODEL` | `cavecrew-investigator` |
44
-
45
- Example — run reviewer on sonnet, keep others on default:
46
-
47
- ```sh
48
- export CAVECREW_REVIEWER_MODEL=sonnet
49
- ```
50
-
51
- Use the same model name strings you'd use in any Claude Code agent frontmatter (e.g. `haiku`, `sonnet`, `opus`).
52
-
53
- Overrides patch only the `model:` line in the installed agent's frontmatter; the prompt body is untouched and keeps receiving upstream updates. Plugin installs only — standalone hook installs have no local agent files to patch. Unset or blank = no change. The patch persists in the installed file until the plugin is updated or reinstalled.
54
-
55
- ## See also
56
-
57
- - [`SKILL.md`](./SKILL.md) — full decision matrix and output contracts
58
- - [`agents/cavecrew-investigator.md`](../../agents/cavecrew-investigator.md)
59
- - [`agents/cavecrew-builder.md`](../../agents/cavecrew-builder.md)
60
- - [`agents/cavecrew-reviewer.md`](../../agents/cavecrew-reviewer.md)
61
- - [Caveman README](../../README.md) — repo overview
@@ -1,82 +0,0 @@
1
- ---
2
- name: cavecrew
3
- description: >
4
- Decision guide for delegating to caveman-style subagents. Tells the main
5
- thread WHEN to spawn `cavecrew-investigator` (locate code), `cavecrew-builder`
6
- (1-2 file edit), or `cavecrew-reviewer` (diff review) instead of doing the
7
- work inline or using vanilla `Explore`. Subagent output is caveman-compressed
8
- so the tool-result injected back into main context is ~60% smaller — main
9
- context lasts longer across long sessions.
10
- Trigger: "delegate to subagent", "use cavecrew", "spawn investigator/builder/reviewer",
11
- "save context", "compressed agent output".
12
- ---
13
-
14
- Cavecrew = three subagent presets that emit caveman output. Same job as Anthropic defaults (`Explore`, edit-style agents, reviewer); difference is the tool-result they return is compressed, so main context shrinks per delegation.
15
-
16
- ## When to use cavecrew vs alternatives
17
-
18
- | Task | Use |
19
- |---|---|
20
- | "Where is X defined / what calls Y / list uses of Z" | `cavecrew-investigator` |
21
- | Same but you also want suggestions/architecture commentary | `Explore` (vanilla) |
22
- | Surgical edit, ≤2 files, scope obvious | `cavecrew-builder` |
23
- | New feature / 3+ files / cross-cutting refactor | Main thread or `feature-dev:code-architect` |
24
- | Review diff, branch, or file for bugs | `cavecrew-reviewer` |
25
- | Deep code review with rationale + alternatives | `Code Reviewer` (vanilla) |
26
- | One-line answer you already know | Main thread, no subagent |
27
-
28
- Rule of thumb: **if you'd want the subagent's output in 1/3 the tokens, pick cavecrew. If you'd want prose, pick vanilla.**
29
-
30
- ## Why this exists (the real win)
31
-
32
- Subagent tool results get injected into main context verbatim. A vanilla `Explore` that returns 2k tokens of prose costs 2k tokens of main-context budget every time. The same finding from `cavecrew-investigator` returns ~700 tokens. Across 20 delegations in one session that's the difference between context exhaustion and finishing the task.
33
-
34
- ## Output contracts
35
-
36
- What main thread can rely on per agent:
37
-
38
- **`cavecrew-investigator`**
39
- ```
40
- <Header>:
41
- - path:line — `symbol` — short note
42
- totals: <counts>.
43
- ```
44
- Or `No match.` Always file-path-first, line-number-attached, backticked symbols. Safe to grep with `path:\d+`.
45
-
46
- **`cavecrew-builder`**
47
- ```
48
- <path:line-range> — <change ≤10 words>.
49
- verified: <re-read OK | mismatch @ path:line>.
50
- ```
51
- Or one of: `too-big.` / `needs-confirm.` / `ambiguous.` / `regressed.` (terminal first token).
52
-
53
- **`cavecrew-reviewer`**
54
- ```
55
- path:line: <emoji> <severity>: <problem>. <fix>.
56
- totals: N🔴 N🟡 N🔵 N❓
57
- ```
58
- Or `No issues.` Findings sorted file → line ascending.
59
-
60
- ## Chaining patterns
61
-
62
- **Locate → fix → verify** (most common):
63
- 1. `cavecrew-investigator` returns site list.
64
- 2. Main thread picks 1-2 sites, hands paths to `cavecrew-builder`.
65
- 3. `cavecrew-reviewer` audits the diff.
66
-
67
- **Parallel scout** (when investigation is broad):
68
- Spawn 2-3 `cavecrew-investigator` calls in one message (different angles: defs vs callers vs tests). Aggregate in main thread.
69
-
70
- **Single-shot edit** (when site is already known):
71
- Skip investigator. Hand exact path:line to `cavecrew-builder` directly.
72
-
73
- ## What NOT to do
74
-
75
- - Don't use `cavecrew-builder` when you don't already know the file. Spawn investigator first or main thread will eat tokens passing context.
76
- - Don't chain `cavecrew-investigator → cavecrew-builder` for a 5-file refactor. Builder will return `too-big.` and you'll have wasted a turn.
77
- - Don't ask `cavecrew-reviewer` for "general feedback" — it returns findings only, no architecture opinions. Use `Code Reviewer` for that.
78
- - Don't expect prose. Cavecrew output is structured, sometimes terse to the point of cryptic. If a human will read it directly, paraphrase.
79
-
80
- ## Auto-clarity (inherited)
81
-
82
- Subagents drop caveman → normal English for security warnings, irreversible-action confirmations, and any output where fragment ambiguity could be misread. Resume caveman after.
@@ -1,48 +0,0 @@
1
- # caveman
2
-
3
- Talk like smart caveman. Same brain, fewer tokens.
4
-
5
- ## What it does
6
-
7
- Compress every model response to caveman-style prose. Drops articles, filler, pleasantries, and hedging. Keeps every technical detail, code block, error string, and symbol exact. Cuts 65% of output tokens (measured) with full accuracy preserved. Mode persists for the whole session until changed or stopped.
8
-
9
- Six intensity levels:
10
-
11
- | Level | What change |
12
- |-------|-------------|
13
- | `lite` | Drop filler/hedging. Sentences stay full. Professional but tight. |
14
- | `full` | Default. Drop articles, fragments OK, short synonyms. |
15
- | `ultra` | Bare fragments. Abbreviations (DB, auth, fn). Arrows for causality. |
16
- | `wenyan-lite` | Classical Chinese register, light compression. |
17
- | `wenyan-full` | Maximum 文言文. 80-90% character reduction. |
18
- | `wenyan-ultra` | Extreme classical compression. |
19
-
20
- Auto-clarity rule: caveman drops to normal prose for security warnings, irreversible-action confirmations, multi-step sequences where fragment ambiguity risks misread, and when user repeats a question. Resumes after the clear part.
21
-
22
- ## How to invoke
23
-
24
- ```
25
- /caveman # full mode (default)
26
- /caveman lite # lighter compression
27
- /caveman ultra # extreme compression
28
- /caveman wenyan # classical Chinese
29
- stop caveman # back to normal prose
30
- ```
31
-
32
- ## Example output
33
-
34
- Question: "Why does my React component re-render?"
35
-
36
- Normal prose:
37
- > Your component re-renders because you create a new object reference each render. Wrapping it in `useMemo` will fix the issue.
38
-
39
- Caveman (full):
40
- > New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`.
41
-
42
- Caveman (ultra):
43
- > Inline obj prop → new ref → re-render. `useMemo`.
44
-
45
- ## See also
46
-
47
- - [`SKILL.md`](./SKILL.md) — full LLM-facing instructions
48
- - [Caveman README](../../README.md) — repo overview, install, benchmarks
@@ -1,78 +0,0 @@
1
- ---
2
- name: caveman
3
- description: >
4
- Ultra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman
5
- while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra,
6
- wenyan-lite, wenyan-full, wenyan-ultra.
7
- Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens",
8
- "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
9
- ---
10
-
11
- Respond terse like smart caveman. All technical substance stay. Only fluff die.
12
-
13
- ## Persistence
14
-
15
- ACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure. Off only: "stop caveman" / "normal mode".
16
-
17
- Default: **full**. Switch: `/caveman lite|full|ultra`.
18
-
19
- ## Rules
20
-
21
- Drop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not "implement a solution for"). No tool-call narration, no decorative tables/emoji, no dumping long raw error logs unless asked — quote shortest decisive line. Standard well-known tech acronyms OK (DB/API/HTTP); never invent new abbreviations (cfg/impl/req/res/fn) — tokenizer split them same as full word: zero token saved, reader still decode. Full word cheaper AND clearer. No causal arrows (→) either — own token, save nothing. Technical terms exact. Code blocks unchanged. Errors quoted exact.
22
-
23
- Preserve user's dominant language. User write Portuguese → reply Portuguese caveman. User write Spanish → reply Spanish caveman. Compress the style, not the language. No forced English openings or status phrases. ALWAYS keep technical terms, code, API names, CLI commands, commit-type keywords (feat/fix/...), and exact error strings verbatim — unless user explicitly ask for translation.
24
-
25
- No self-reference. Never name or announce the style. No "caveman mode on", "me caveman think", no third-person caveman tags. Output caveman-only — never normal answer plus "Caveman:" recap. Exception: user explicitly ask what the mode is.
26
-
27
- Pattern: `[thing] [action] [reason]. [next step].`
28
-
29
- Not: "Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by..."
30
- Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
31
-
32
- ## Intensity
33
-
34
- | Level | What change |
35
- |-------|------------|
36
- | **lite** | No filler/hedging. Keep articles + full sentences. Professional but tight |
37
- | **full** | Drop articles, fragments OK, short synonyms. Classic caveman. No tool-call narration, no decorative tables/emoji, no long raw error-log dumps unless asked. Standard acronyms OK; no invented abbreviations |
38
- | **ultra** | Strip conjunctions when cause-then-effect stay unambiguous. One word when one word enough. State each fact once. NO prose abbreviations (cfg/impl/req/res/fn/auth), NO arrows (X → Y) — measured zero token saving under tokenizer, cost decode clarity. Code symbols, function names, API names, error strings: never touch |
39
- | **wenyan-lite** | Semi-classical. Drop filler/hedging but keep grammar structure, classical register |
40
- | **wenyan-full** | Maximum classical terseness. Fully 文言文. 80-90% character reduction. Classical sentence patterns, verbs precede objects, subjects often omitted, classical particles (之/乃/為/其) |
41
- | **wenyan-ultra** | Extreme abbreviation while keeping classical Chinese feel. Maximum compression, ultra terse |
42
-
43
- Example — "Why React component re-render?"
44
- - lite: "Your component re-renders because you create a new object reference each render. Wrap it in `useMemo`."
45
- - full: "New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`."
46
- - ultra: "Inline obj prop, new ref, re-render. `useMemo`."
47
- - wenyan-lite: "組件頻重繪,以每繪新生對象參照故。以 useMemo 包之。"
48
- - wenyan-full: "每繪新生對象參照,故重繪;以 useMemo 包之則免。"
49
- - wenyan-ultra: "新參照則重繪。useMemo 包之。"
50
-
51
- Example — "Explain database connection pooling."
52
- - lite: "Connection pooling reuses open connections instead of creating new ones per request. Avoids repeated handshake overhead."
53
- - full: "Pool reuse open DB connections. No new connection per request. Skip handshake overhead."
54
- - ultra: "Pool reuse open DB connections. No per-request handshake."
55
- - wenyan-full: "池蓄已開之連,不逐請而新開,省握手之費。"
56
- - wenyan-ultra: "池蓄連,免逐請新開,省握手。"
57
-
58
- ## Auto-Clarity
59
-
60
- Drop caveman when:
61
- - Security warnings
62
- - Irreversible action confirmations
63
- - Multi-step sequences where fragment order or omitted conjunctions risk misread
64
- - Compression itself creates technical ambiguity (e.g., `"migrate table drop column backup first"` — order unclear without articles/conjunctions)
65
- - User asks to clarify or repeats question
66
-
67
- Resume caveman after clear part done.
68
-
69
- Example — destructive op:
70
- > **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.
71
- > ```sql
72
- > DROP TABLE users;
73
- > ```
74
- > Caveman resume. Verify backup exist first.
75
-
76
- ## Boundaries
77
-
78
- Code/commits/PRs: write normal. "stop caveman" or "normal mode": revert. Level persist until changed or session end.
@@ -1,44 +0,0 @@
1
- # caveman-commit
2
-
3
- Terse Conventional Commits. Why over what.
4
-
5
- ## What it does
6
-
7
- Generates commit messages in Conventional Commits format. Subject ≤50 chars, hard cap 72. Imperative mood. Body only when the *why* is non-obvious or there are breaking changes. No AI attribution, no "this commit does X", no emoji unless the project uses them. Body always required for breaking changes, security fixes, data migrations, and reverts — future debuggers need the context.
8
-
9
- Outputs only the message. Does not stage, commit, or amend.
10
-
11
- ## How to invoke
12
-
13
- ```
14
- /caveman-commit
15
- ```
16
-
17
- Also triggers on phrases like "write a commit", "commit message", "generate commit".
18
-
19
- ## Example output
20
-
21
- Diff: new endpoint for user profile.
22
-
23
- ```
24
- feat(api): add GET /users/:id/profile
25
-
26
- Mobile client needs profile data without the full user payload
27
- to reduce LTE bandwidth on cold-launch screens.
28
-
29
- Closes #128
30
- ```
31
-
32
- Diff: breaking API rename.
33
-
34
- ```
35
- feat(api)!: rename /v1/orders to /v1/checkout
36
-
37
- BREAKING CHANGE: clients on /v1/orders must migrate to /v1/checkout
38
- before 2026-06-01. Old route returns 410 after that date.
39
- ```
40
-
41
- ## See also
42
-
43
- - [`SKILL.md`](./SKILL.md) — full LLM-facing instructions
44
- - [Caveman README](../../README.md) — repo overview
@@ -1,65 +0,0 @@
1
- ---
2
- name: caveman-commit
3
- description: >
4
- Ultra-compressed commit message generator. Cuts noise from commit messages while preserving
5
- intent and reasoning. Conventional Commits format. Subject ≤50 chars, body only when "why"
6
- isn't obvious. Use when user says "write a commit", "commit message", "generate commit",
7
- "/commit", or invokes /caveman-commit. Auto-triggers when staging changes.
8
- ---
9
-
10
- Write commit messages terse and exact. Conventional Commits format. No fluff. Why over what.
11
-
12
- ## Rules
13
-
14
- **Subject line:**
15
- - `<type>(<scope>): <imperative summary>` — `<scope>` optional
16
- - Types: `feat`, `fix`, `refactor`, `perf`, `docs`, `test`, `chore`, `build`, `ci`, `style`, `revert`
17
- - Imperative mood: "add", "fix", "remove" — not "added", "adds", "adding"
18
- - ≤50 chars when possible, hard cap 72
19
- - No trailing period
20
- - Match project convention for capitalization after the colon
21
-
22
- **Body (only if needed):**
23
- - Skip entirely when subject is self-explanatory
24
- - Add body only for: non-obvious *why*, breaking changes, migration notes, linked issues
25
- - Wrap at 72 chars
26
- - Bullets `-` not `*`
27
- - Reference issues/PRs at end: `Closes #42`, `Refs #17`
28
-
29
- **What NEVER goes in:**
30
- - "This commit does X", "I", "we", "now", "currently" — the diff says what
31
- - "As requested by..." — use Co-authored-by trailer
32
- - "Generated with Claude Code" or any AI attribution — unless the user's own rule requires an `Assisted-by`/AI-attribution trailer, then add it as a trailer
33
- - Emoji (unless project convention requires)
34
- - Restating the file name when scope already says it
35
-
36
- ## Examples
37
-
38
- Diff: new endpoint for user profile with body explaining the why
39
- - ❌ "feat: add a new endpoint to get user profile information from the database"
40
- - ✅
41
- ```
42
- feat(api): add GET /users/:id/profile
43
-
44
- Mobile client needs profile data without the full user payload
45
- to reduce LTE bandwidth on cold-launch screens.
46
-
47
- Closes #128
48
- ```
49
-
50
- Diff: breaking API change
51
- - ✅
52
- ```
53
- feat(api)!: rename /v1/orders to /v1/checkout
54
-
55
- BREAKING CHANGE: clients on /v1/orders must migrate to /v1/checkout
56
- before 2026-06-01. Old route returns 410 after that date.
57
- ```
58
-
59
- ## Auto-Clarity
60
-
61
- Always include body for: breaking changes, security fixes, data migrations, anything reverting a prior commit. Never compress these into subject-only — future debuggers need the context.
62
-
63
- ## Boundaries
64
-
65
- Only generates the commit message. Does not run `git commit`, does not stage files, does not amend. Output the message as a code block ready to paste. "stop caveman-commit" or "normal mode": revert to verbose commit style.
@@ -1,163 +0,0 @@
1
- <p align="center">
2
- <img src="https://em-content.zobj.net/source/apple/391/rock_1faa8.png" width="80" />
3
- </p>
4
-
5
- <h1 align="center">caveman-compress</h1>
6
-
7
- <p align="center">
8
- <strong>shrink memory file. save token every session.</strong>
9
- </p>
10
-
11
- ---
12
-
13
- A Claude Code skill that compresses your project memory files (`CLAUDE.md`, todos, preferences) into caveman format — so every session loads fewer tokens automatically.
14
-
15
- Claude read `CLAUDE.md` on every session start. If file big, cost big. Caveman make file small. Cost go down forever.
16
-
17
- ## What It Do
18
-
19
- ```
20
- /caveman-compress CLAUDE.md
21
- ```
22
-
23
- ```
24
- CLAUDE.md ← compressed (Claude reads this — fewer tokens every session)
25
- CLAUDE.original.md ← human-readable backup (you edit this)
26
- ```
27
-
28
- Original never lost. You can read and edit `.original.md`. Run skill again to re-compress after edits.
29
-
30
- ## Benchmarks
31
-
32
- Real results on real project files:
33
-
34
- | File | Original | Compressed | Saved |
35
- |------|----------:|----------:|------:|
36
- | `claude-md-preferences.md` | 706 | 285 | **59.6%** |
37
- | `project-notes.md` | 1145 | 535 | **53.3%** |
38
- | `claude-md-project.md` | 1122 | 636 | **43.3%** |
39
- | `todo-list.md` | 627 | 388 | **38.1%** |
40
- | `mixed-with-code.md` | 888 | 560 | **36.9%** |
41
- | **Average** | **898** | **481** | **46%** |
42
-
43
- All validations passed ✅ — headings, code blocks, URLs, file paths preserved exactly.
44
-
45
- ## Before / After
46
-
47
- <table>
48
- <tr>
49
- <td width="50%">
50
-
51
- ### 📄 Original (706 tokens)
52
-
53
- > "I strongly prefer TypeScript with strict mode enabled for all new code. Please don't use `any` type unless there's genuinely no way around it, and if you do, leave a comment explaining the reasoning. I find that taking the time to properly type things catches a lot of bugs before they ever make it to runtime."
54
-
55
- </td>
56
- <td width="50%">
57
-
58
- ### <img src="../../docs/assets/dancing-rock.svg" width="20" height="20" alt="rock"/> Caveman (285 tokens)
59
-
60
- > "Prefer TypeScript strict mode always. No `any` unless unavoidable — comment why if used. Proper types catch bugs early."
61
-
62
- </td>
63
- </tr>
64
- </table>
65
-
66
- **Same instructions. 60% fewer tokens. Every. Single. Session.**
67
-
68
- ## Security
69
-
70
- `caveman-compress` is flagged as Snyk High Risk due to subprocess and file I/O patterns detected by static analysis. This is a false positive — see [SECURITY.md](./SECURITY.md) for a full explanation of what the skill does and does not do.
71
-
72
- ## Install
73
-
74
- Compress is built in with the `caveman` plugin. Install `caveman` once, then use `/caveman-compress`.
75
-
76
- If you need local files, the compress skill lives at:
77
-
78
- ```bash
79
- caveman-compress/
80
- ```
81
-
82
- **Requires:** Python 3.10+
83
-
84
- ## Usage
85
-
86
- ```
87
- /caveman-compress <filepath>
88
- ```
89
-
90
- Examples:
91
- ```
92
- /caveman-compress CLAUDE.md
93
- /caveman-compress docs/preferences.md
94
- /caveman-compress todos.md
95
- ```
96
-
97
- ### What files work
98
-
99
- | Type | Compress? |
100
- |------|-----------|
101
- | `.md`, `.txt`, `.rst`, `.typ`, `.typst`, `.tex` | ✅ Yes |
102
- | Extensionless natural language | ✅ Yes |
103
- | `.py`, `.js`, `.ts`, `.json`, `.yaml` | ❌ Skip (code/config) |
104
- | `*.original.md` | ❌ Skip (backup files) |
105
-
106
- ## How It Work
107
-
108
- ```
109
- /caveman-compress CLAUDE.md
110
-
111
- detect file type (no tokens)
112
-
113
- Claude compresses (tokens — one call)
114
-
115
- validate output (no tokens)
116
- checks: headings, code blocks, URLs, file paths, bullets
117
-
118
- if errors: Claude fixes cherry-picked issues only (tokens — targeted fix)
119
- does NOT recompress — only patches broken parts
120
-
121
- retry up to 2 times
122
-
123
- write compressed → CLAUDE.md
124
- write original → CLAUDE.original.md
125
- ```
126
-
127
- Only two things use tokens: initial compression + targeted fix if validation fails. Everything else is local Python.
128
-
129
- ## What Is Preserved
130
-
131
- Caveman compress natural language. It never touch:
132
-
133
- - Code blocks (` ``` ` fenced or indented)
134
- - Inline code (`` `backtick content` ``)
135
- - URLs and links
136
- - File paths (`/src/components/...`)
137
- - Commands (`npm install`, `git commit`)
138
- - Technical terms, library names, API names
139
- - Headings (exact text preserved)
140
- - Tables (structure preserved, cell text compressed)
141
- - Dates, version numbers, numeric values
142
-
143
- ## Why This Matter
144
-
145
- `CLAUDE.md` loads on **every session start**. A 1000-token project memory file costs tokens every single time you open a project. Over 100 sessions that's 100,000 tokens of overhead — just for context you already wrote.
146
-
147
- Caveman cut that by ~46% on average. Same instructions. Same accuracy. Less waste.
148
-
149
- ```
150
- ┌────────────────────────────────────────────┐
151
- │ TOKEN SAVINGS PER FILE █████ 46% │
152
- │ SESSIONS THAT BENEFIT ██████████ 100% │
153
- │ INFORMATION PRESERVED ██████████ 100% │
154
- │ SETUP TIME █ 1x │
155
- └────────────────────────────────────────────┘
156
- ```
157
-
158
- ## Part of Caveman
159
-
160
- This skill is part of the [caveman](https://github.com/JuliusBrussee/caveman) toolkit — making Claude use fewer tokens without losing accuracy.
161
-
162
- - **caveman** — make Claude *speak* like caveman (cuts response tokens ~65%)
163
- - **caveman-compress** — make Claude *read* less (cuts context tokens ~46%)