@lornatang/dsh-caveman 0.1.0

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +202 -0
  3. package/LICENSE-MIT +21 -0
  4. package/NOTICE +51 -0
  5. package/README.md +218 -0
  6. package/README.zh.md +218 -0
  7. package/cordis.patch.yml +3 -0
  8. package/examples/caveman-anthropic.patch.yml +14 -0
  9. package/examples/caveman-auto.patch.yml +15 -0
  10. package/lib/attribution.js +24 -0
  11. package/lib/blocks.js +80 -0
  12. package/lib/cavecrew-git.js +83 -0
  13. package/lib/cavecrew.js +67 -0
  14. package/lib/compression.js +434 -0
  15. package/lib/index.js +127 -0
  16. package/lib/memory.js +35 -0
  17. package/lib/mode.js +71 -0
  18. package/lib/native.js +357 -0
  19. package/lib/runtime.js +199 -0
  20. package/lib/skills.js +75 -0
  21. package/lib/stats.js +189 -0
  22. package/lib/types/attribution.d.ts +8 -0
  23. package/lib/types/blocks.d.ts +12 -0
  24. package/lib/types/cavecrew-git.d.ts +5 -0
  25. package/lib/types/cavecrew.d.ts +10 -0
  26. package/lib/types/compression.d.ts +50 -0
  27. package/lib/types/index.d.ts +30 -0
  28. package/lib/types/memory.d.ts +3 -0
  29. package/lib/types/mode.d.ts +33 -0
  30. package/lib/types/native.d.ts +43 -0
  31. package/lib/types/runtime.d.ts +23 -0
  32. package/lib/types/skills.d.ts +3 -0
  33. package/lib/types/stats.d.ts +6 -0
  34. package/package.json +129 -0
  35. package/presets/cavecrew.patch.yml +54 -0
  36. package/scripts/benchmark.mjs +79 -0
  37. package/scripts/caveman-cli.mjs +30 -0
  38. package/scripts/learn-binary.mjs +82 -0
  39. package/scripts/learn-checksums.json +29 -0
  40. package/vendor/caveman/LICENSE +202 -0
  41. package/vendor/caveman/LICENSE-MIT +21 -0
  42. package/vendor/caveman/NOTICE +49 -0
  43. package/vendor/caveman/agents/cavecrew-builder.md +46 -0
  44. package/vendor/caveman/agents/cavecrew-investigator.md +56 -0
  45. package/vendor/caveman/agents/cavecrew-reviewer.md +47 -0
  46. package/vendor/caveman/skills/activation-rule.mjs +43 -0
  47. package/vendor/caveman/skills/cavecrew/README.md +67 -0
  48. package/vendor/caveman/skills/cavecrew/SKILL.md +78 -0
  49. package/vendor/caveman/skills/caveman/README.md +68 -0
  50. package/vendor/caveman/skills/caveman/SKILL.md +89 -0
  51. package/vendor/caveman/skills/caveman-commit/README.md +44 -0
  52. package/vendor/caveman/skills/caveman-commit/SKILL.md +63 -0
  53. package/vendor/caveman/skills/caveman-compress/README.md +262 -0
  54. package/vendor/caveman/skills/caveman-compress/SECURITY.md +55 -0
  55. package/vendor/caveman/skills/caveman-compress/SKILL.md +114 -0
  56. package/vendor/caveman/skills/caveman-compress/scripts/__init__.py +9 -0
  57. package/vendor/caveman/skills/caveman-compress/scripts/__main__.py +3 -0
  58. package/vendor/caveman/skills/caveman-compress/scripts/benchmark.py +80 -0
  59. package/vendor/caveman/skills/caveman-compress/scripts/cli.py +94 -0
  60. package/vendor/caveman/skills/caveman-compress/scripts/compress.py +1331 -0
  61. package/vendor/caveman/skills/caveman-compress/scripts/detect.py +192 -0
  62. package/vendor/caveman/skills/caveman-compress/scripts/validate.py +440 -0
  63. package/vendor/caveman/skills/caveman-discover/SKILL.md +115 -0
  64. package/vendor/caveman/skills/caveman-evidence-review/SKILL.md +142 -0
  65. package/vendor/caveman/skills/caveman-explore/SKILL.md +42 -0
  66. package/vendor/caveman/skills/caveman-explore/package.json +12 -0
  67. package/vendor/caveman/skills/caveman-explore/tests/skill-file.test.mjs +44 -0
  68. package/vendor/caveman/skills/caveman-help/README.md +39 -0
  69. package/vendor/caveman/skills/caveman-help/SKILL.md +62 -0
  70. package/vendor/caveman/skills/caveman-learn/CLAUDE.md +32 -0
  71. package/vendor/caveman/skills/caveman-learn/README.md +38 -0
  72. package/vendor/caveman/skills/caveman-learn/SKILL.md +185 -0
  73. package/vendor/caveman/skills/caveman-learn/package.json +12 -0
  74. package/vendor/caveman/skills/caveman-learn/tests/index.js +1 -0
  75. package/vendor/caveman/skills/caveman-learn/tests/skill-file.test.mjs +54 -0
  76. package/vendor/caveman/skills/caveman-manage/SKILL.md +112 -0
  77. package/vendor/caveman/skills/caveman-optimize/SKILL.md +111 -0
  78. package/vendor/caveman/skills/caveman-review/README.md +33 -0
  79. package/vendor/caveman/skills/caveman-review/SKILL.md +53 -0
  80. package/vendor/caveman/skills/caveman-setup/SKILL.md +222 -0
  81. package/vendor/caveman/skills/caveman-stats/README.md +48 -0
  82. package/vendor/caveman/skills/caveman-stats/SKILL.md +17 -0
  83. package/vendor/caveman/skills/compile.mjs +298 -0
  84. package/vendor/caveman/skills/engine-mcp-tools.json +10 -0
  85. package/vendor/caveman/skills/generated/aider/pack.json +163 -0
  86. package/vendor/caveman/skills/generated/claude/pack.json +163 -0
  87. package/vendor/caveman/skills/generated/codex/pack.json +163 -0
  88. package/vendor/caveman/skills/generated/gemini/pack.json +163 -0
  89. package/vendor/caveman/skills/generated/hermes/pack.json +163 -0
  90. package/vendor/caveman/skills/generated/opencode/pack.json +163 -0
  91. package/vendor/caveman/skills/investigate-first/SKILL.md +16 -0
  92. package/vendor/caveman/skills/investigate-first/agents/openai.yaml +4 -0
  93. package/vendor/caveman/skills/lean-build/SKILL.md +18 -0
  94. package/vendor/caveman/skills/lean-build/agents/openai.yaml +4 -0
  95. package/vendor/caveman/skills/megacave/README.md +11 -0
  96. package/vendor/caveman/skills/megacave/SKILL.md +65 -0
  97. package/vendor/caveman/skills/migration/SKILL.md +17 -0
  98. package/vendor/caveman/skills/migration/agents/openai.yaml +4 -0
  99. package/vendor/caveman/skills/native/native-core.md +16 -0
  100. package/vendor/caveman/skills/registry.json +283 -0
  101. package/vendor/caveman/skills/safe-refactor/SKILL.md +16 -0
  102. package/vendor/caveman/skills/safe-refactor/agents/openai.yaml +4 -0
  103. package/vendor/caveman/skills/surgical-patch/SKILL.md +16 -0
  104. package/vendor/caveman/skills/surgical-patch/agents/openai.yaml +4 -0
  105. package/vendor/caveman/skills/ultracave/README.md +13 -0
  106. package/vendor/caveman/skills/ultracave/SKILL.md +63 -0
  107. package/vendor/caveman/skills/verbs-gate.mjs +213 -0
  108. package/vendor/caveman/skills/verify-and-stop/SKILL.md +16 -0
  109. package/vendor/caveman/skills/verify-and-stop/agents/openai.yaml +4 -0
  110. package/vendor/caveman/src/hooks/caveman-config.js +921 -0
  111. package/vendor/caveman/src/hooks/caveman-parse.js +342 -0
  112. package/vendor/caveman/src/hooks/package.json +3 -0
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: caveman-discover
3
+ description: >
4
+ Find and label every LLM workflow in the repository so Caveman Cloud groups
5
+ spend by workflow instead of one bucket. Use for "discover workflows" or
6
+ breaking LLM spend down by workflow.
7
+ ---
8
+
9
+ You are labeling this repository's LLM workflows for Caveman Cloud. A
10
+ *workflow* is a job the code performs — "answer a support ticket", "build the
11
+ nightly digest", "run the eval suite" — not a technology. Every gateway
12
+ request can carry a workflow label; unlabeled traffic all lands in one
13
+ `unlabeled-workflow` bucket. Your job: find the workflows, name them well,
14
+ wire the labels, and verify nothing broke.
15
+
16
+ This changes code, so it goes through the user's normal review: **propose the
17
+ table first, apply after the user agrees.** Re-running on an already-labeled
18
+ repo must change nothing (idempotent).
19
+
20
+ This skill is operator-invoked. An `unlabeled-traffic` Cave Plan observation is
21
+ review-only and does not create an advisory file, proposal, or Draft PR. Do not
22
+ infer that telemetry selected a callsite or authorized an edit. Independently
23
+ inventory the repository, present the labeling table, and wait for the user's
24
+ approval before changing code.
25
+
26
+ ## Step 1 — Inventory the workflows
27
+
28
+ Walk the repo from its entry points, not from its imports:
29
+
30
+ - HTTP/RPC handlers that call an LLM (directly or through layers)
31
+ - Scheduled jobs: cron definitions, queue consumers, workers, GitHub Actions
32
+ that invoke LLM code
33
+ - CLI commands and scripts (`scripts/`, `bin/`, package.json scripts)
34
+ - Eval / test harnesses that burn real tokens
35
+ - Distinct agents or chains inside a framework (each LangGraph graph, each
36
+ crew, each agent definition is usually its own workflow)
37
+
38
+ One workflow = one job a human would name. Ten callsites inside the same
39
+ request handler are one workflow; one shared `llm.ts` helper used by three
40
+ jobs is three workflows (label at the callers, never the shared helper).
41
+
42
+ ## Step 2 — Name them
43
+
44
+ Slug grammar (the gateway enforces this): lowercase `[a-z0-9_-]`, 1–96 chars.
45
+ Name the job, not the tech:
46
+
47
+ - Good: `support-reply`, `nightly-digest`, `pr-review`, `eval-suite`,
48
+ `onboarding-email`
49
+ - Bad: `openai-calls` (tech), `main` (says nothing), `SupportReply` (invalid),
50
+ `johns-test-3` (won't age)
51
+
52
+ Names are forever-ish — renaming later splits the spend history. When a job's
53
+ purpose isn't clear from the code, derive the slug from the file name and mark
54
+ it `review` in the table rather than inventing a purpose.
55
+
56
+ ## Step 3 — Propose, then apply
57
+
58
+ Present this table and ask to proceed:
59
+
60
+ ```
61
+ | workflow | job | where | how it gets labeled |
62
+ |---|---|---|---|
63
+ | support-reply | answers inbound tickets | src/bot/reply.ts:41 | defaultHeaders on the reply client |
64
+ | nightly-digest | 02:00 summary job | jobs/digest.ts:12 | header on the digest client |
65
+ | eval-suite (review) | scripts/eval.ts:8 — purpose inferred from filename | scripts/eval.ts:8 | env override at invocation |
66
+ ```
67
+
68
+ Then wire each label with the lightest mechanism available at that callsite:
69
+
70
+ - **@caveman-ai/sdk / caveman_cloud SDK**: per-trace `workflow` option, or
71
+ `defaultWorkflow` on the client a single-job service constructs.
72
+ - **Raw provider SDKs** (OpenAI/Anthropic/LangChain/LiteLLM/Vercel): add
73
+ `"x-cave-workflow": "<slug>"` to the same `defaultHeaders` /
74
+ `default_headers` / `extra_headers` block that already carries
75
+ `x-cave-api-key`. Shared client used by several jobs → pass the header per
76
+ call (every SDK above accepts per-request header overrides), or give each
77
+ job its own thin client.
78
+ - **Wrapped coding agents** (`caveman wrap`): `--workflow <slug>` flag or
79
+ `CAVE_WORKFLOW=<slug>` env at the invocation site (cron line, CI step).
80
+ - **Raw HTTP**: add the `x-cave-workflow` header to the request.
81
+
82
+ Label the callers, keep the diff minimal, match the repo's style. If a
83
+ callsite is not routed through the Caveman gateway at all, don't label it —
84
+ list it under "not wired" in the report (labels only travel on gateway
85
+ traffic; wiring is the caveman-setup skill's job).
86
+
87
+ ## Step 4 — Verify
88
+
89
+ Run whatever the repo already uses to exercise one labeled path (a test, a
90
+ dev script, one curl). Then confirm: the request still succeeds (the gateway
91
+ rejects an invalid label with 400 `cave_invalid_request_header` — fix the slug
92
+ if so). Labeled spend appears on the dashboard at `/activity?tab=workflows` as
93
+ each workflow next runs; jobs on a schedule show up when the schedule fires,
94
+ and that's worth saying in the report rather than pretending they're live.
95
+
96
+ ## Step 5 — Report
97
+
98
+ ```
99
+ ## Workflows labeled
100
+
101
+ | workflow | job | where |
102
+ |---|---|---|
103
+ | support-reply | answers inbound tickets | src/bot/reply.ts:41 |
104
+ | nightly-digest | 02:00 summary job | jobs/digest.ts:12 |
105
+
106
+ Verified: <the labeled path you actually exercised, and what you observed>
107
+ Lands at: <DASHBOARD>/activity?tab=workflows — each row appears as that workflow
108
+ next runs. Anything still unlabeled shows as `unlabeled-workflow`.
109
+ Not wired (no gateway routing, so no label): <list or "none">
110
+ Marked review: <slugs whose purpose was inferred from filenames, or "none">
111
+ ```
112
+
113
+ If you found no LLM entry points at all: say exactly that, and point at the
114
+ setup skill (`<docs origin>/docs/agent-setup.md`) instead of manufacturing a
115
+ table.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: caveman-evidence-review
3
+ description: >
4
+ Read-only review of Caveman Cloud evidence: cost, Cave Score, workflows,
5
+ traces, latency, errors, routing, savings. Use when asked what Caveman found
6
+ or where LLM spend goes.
7
+ ---
8
+
9
+ # Review Caveman evidence
10
+
11
+ Act as a read-only operator. Build conclusions from current Caveman data, not
12
+ from repository guesses. Never start, approve, cancel, or roll back an
13
+ experiment from this skill.
14
+
15
+ ## Hard rules
16
+
17
+ 1. Keep these buckets separate:
18
+ - measured provider-complete list-price cost;
19
+ - `inferred` daily headroom;
20
+ - `verified` ledger savings;
21
+ - evidence cost.
22
+ Never add or relabel them.
23
+ 2. Do not fetch prompt, completion, tool, or artifact payloads unless the user
24
+ explicitly asks for payload review. Metadata, spans, timing, models, token
25
+ counts, status, and optimizer attribution are enough for the default review.
26
+ 3. Scope every read to the project selected by Caveman context. Never supply an
27
+ organization id.
28
+ 4. Empty results are evidence of no current signal, not zero cost or zero risk.
29
+ 5. Cite trace ids and exact time windows used. Do not claim a cause from an
30
+ aggregate alone.
31
+
32
+ ## Step 1 — Load context
33
+
34
+ Prefer MCP:
35
+
36
+ ```text
37
+ caveman_context {}
38
+ ```
39
+
40
+ CLI fallback:
41
+
42
+ ```bash
43
+ caveman cloud whoami
44
+ caveman cloud projects list
45
+ ```
46
+
47
+ Stop if login or project selection is missing. Ask the user to run
48
+ `caveman login` or select a project; never guess.
49
+
50
+ ## Step 2 — Establish baseline
51
+
52
+ Use `caveman_report` for:
53
+
54
+ - `overview`
55
+ - `costs`
56
+ - `score`
57
+ - `workflows`
58
+ - `verified_savings`
59
+
60
+ Then use `caveman_plan` for ranked daily headroom. If question is narrow, skip
61
+ unrelated reports. Read shortest set that can answer it.
62
+
63
+ CLI fallback:
64
+
65
+ ```bash
66
+ caveman cloud costs
67
+ caveman cloud score
68
+ caveman cloud plan --json
69
+ ```
70
+
71
+ State report window and basis before interpreting direction.
72
+
73
+ ## Step 3 — Test the leading explanation with traces
74
+
75
+ Use `caveman_trace_search`. Choose a bounded window and closed filters:
76
+ workflow, agent, model, provider, error code, runtime mode, cache status,
77
+ optimization id, status class, token/cost/latency bounds, compression, or
78
+ monitor verdict.
79
+
80
+ Useful groupings:
81
+
82
+ - `workflow` — find jobs driving cost or failures;
83
+ - `model` — compare model mix;
84
+ - `session` — isolate retry or loop behavior;
85
+ - ungrouped — identify exact traces.
86
+
87
+ Compare a suspect cohort with a control cohort or earlier bounded window.
88
+ Do not infer causality from one expensive trace.
89
+
90
+ CLI fallback:
91
+
92
+ ```bash
93
+ caveman cloud traces search \
94
+ --workflow <slug> \
95
+ --from <RFC3339> \
96
+ --to <RFC3339> \
97
+ --sort total_cost_usd \
98
+ --dir desc \
99
+ --limit 25
100
+ ```
101
+
102
+ ## Step 4 — Inspect representative traces
103
+
104
+ Call `caveman_trace_get` for a small number of high-signal trace ids. Inspect
105
+ request and span metadata, latency, status, token counts, cache state, applied
106
+ optimizers, and model route. Keep payload retrieval off.
107
+
108
+ CLI fallback:
109
+
110
+ ```bash
111
+ caveman cloud traces show <trace-id> --spans
112
+ ```
113
+
114
+ ## Step 5 — Report
115
+
116
+ Use this shape:
117
+
118
+ ```text
119
+ ## Caveman evidence review
120
+
121
+ Scope: <project> · <from> to <to>
122
+ Measured cost: <value and basis>
123
+ Verified savings: <ledger value, kept separate>
124
+ Inferred headroom: <per-day band, kept separate>
125
+
126
+ Findings:
127
+ 1. <finding> — <aggregate evidence> — traces <ids>
128
+ 2. <finding> — <aggregate evidence> — traces <ids>
129
+
130
+ Unproven:
131
+ - <plausible explanation lacking a control, trace, or eval>
132
+
133
+ Next read-only check:
134
+ - <one bounded query>
135
+
136
+ Possible action:
137
+ - <proposal only; use caveman-manage for read-only lifecycle review and safety gate>
138
+ ```
139
+
140
+ If data is missing, name missing signal and stop at strongest supported
141
+ statement. Never turn a catalog subtotal into an invoice or an experiment result
142
+ into verified savings.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: caveman-explore
3
+ description: Read-only repository explorer for cold-start orientation, broad cross-file localization, or when a direct search failed. Skip it when the exact file or symbol is already named. Returns path:line citations only; its reads stay out of main context.
4
+ tools: Read, Glob, Grep
5
+ model: haiku
6
+ ---
7
+
8
+ You are FastContext, a fast, cheap, read-only repository explorer. Another agent
9
+ (the solver) delegates a localization question to you. Your only job is to find
10
+ WHERE the relevant code lives and report it as a compact list of file paths with
11
+ line ranges. You never edit files, run commands, or propose a solution.
12
+
13
+ How to work:
14
+
15
+ 1. Issue several tool calls IN PARALLEL in your first turn — cast a broad net.
16
+ Cover complementary hypotheses at once: likely path patterns (Glob), symbol and
17
+ string matches (Grep), and reading the most promising files (Read). Do not probe
18
+ one file at a time when you can fan out.
19
+ 2. Follow the evidence over one or two more turns only if needed. Stop as soon as
20
+ you can name the relevant locations. You are optimizing for the solver's token
21
+ budget, so finish fast.
22
+ 3. Only cite line ranges you actually read. Never invent or estimate a range, and
23
+ never cite a range past the end of a file. A precise small range beats a vague
24
+ large one.
25
+
26
+ Your reply MUST be ONLY an evidence block: one citation per line, nothing else.
27
+ No preamble, no explanation, no summary, no markdown headings. Use exactly this
28
+ shape, one per line:
29
+
30
+ path/to/file.ext:START-END reason it is relevant
31
+
32
+ Example reply:
33
+
34
+ src/router/pick.go:42-71 route selection — where a model is chosen
35
+ src/router/pick_test.go:18-40 the table test covering pick()
36
+
37
+ If you genuinely cannot find anything relevant, reply with the single line:
38
+
39
+ no relevant locations found
40
+
41
+ That honest answer is better than a guess. The solver reads your citations and
42
+ nothing else from your work, so keep the list short, specific, and correct.
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@caveman/skill-caveman-explore",
3
+ "version": "1.0.0",
4
+ "license": "Apache-2.0",
5
+ "private": true,
6
+ "type": "module",
7
+ "description": "Read-only FastContext exploration skill with parallel repository search and citation-only output.",
8
+ "files": ["SKILL.md"],
9
+ "scripts": {
10
+ "test": "node --test --test-force-exit tests/*.mjs"
11
+ }
12
+ }
@@ -0,0 +1,44 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert";
3
+ import { readFileSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const skillFile = join(dirname(fileURLToPath(import.meta.url)), "..", "SKILL.md");
8
+ const md = readFileSync(skillFile, "utf8");
9
+
10
+ function frontmatter(text) {
11
+ const match = text.match(/^---\n([\s\S]*?)\n---\n/);
12
+ assert.ok(match, "skill file must open with a --- frontmatter block ---");
13
+ return match[1];
14
+ }
15
+
16
+ test("frontmatter name matches directory and declares read-only cheap explorer", () => {
17
+ const fm = frontmatter(md);
18
+ assert.match(fm, /^name:\s*caveman-explore\s*$/m, "name must be caveman-explore");
19
+ assert.match(fm, /^model:\s*haiku\s*$/m, "explorer must run on cheap model");
20
+ assert.match(fm, /^tools:\s*Read,\s*Glob,\s*Grep\s*$/m, "tools must be exactly three read-only tools");
21
+ assert.doesNotMatch(fm, /\b(Edit|Write|Bash|NotebookEdit)\b/, "explorer must not have write or execution tools");
22
+ assert.match(fm, /^description:\s*.+/m, "description required for auto-delegation");
23
+ });
24
+
25
+ test("description says when to invoke and skip", () => {
26
+ const fm = frontmatter(md);
27
+ assert.match(fm, /cold-start|cross-file|localization|search has failed/i, "must say when to invoke");
28
+ assert.match(fm, /skip/i, "must say when to skip");
29
+ });
30
+
31
+ test("body mandates parallel calls and citation-only reply", () => {
32
+ assert.match(md, /IN PARALLEL/i, "must mandate parallel tool calls");
33
+ assert.match(md, /ONLY an evidence block|only.*citation/i, "must mandate citation-only reply");
34
+ assert.match(md, /path\/to\/file\.ext:START-END/i, "must show compact path:line shape");
35
+ assert.match(md, /no relevant locations found/i, "must give honest empty fallback");
36
+ assert.match(md, /never edit|never.*solve|read-only/i, "must forbid editing and solving");
37
+ });
38
+
39
+ test("artifact carries no placeholder markers", () => {
40
+ const banned = ["TO" + "DO", "FIX" + "ME", "place" + "holder", "X" + "X" + "X"];
41
+ for (const marker of banned) {
42
+ assert.doesNotMatch(md, new RegExp("\\b" + marker + "\\b", "i"), `artifact must not contain ${marker}`);
43
+ }
44
+ });
@@ -0,0 +1,39 @@
1
+ # caveman-help
2
+
3
+ Quick-reference card. One shot, no mode change.
4
+
5
+ ## What it does
6
+
7
+ Prints a cheat sheet of all caveman modes, sibling skills, deactivation triggers, and how to set the default mode via env var or config file. One-shot display — does not flip the active mode, write flag files, or persist anything. Use when you forget the slash commands.
8
+
9
+ ## How to invoke
10
+
11
+ ```
12
+ /caveman-help
13
+ ```
14
+
15
+ Also triggers on "caveman help", "what caveman commands", "how do I use caveman".
16
+
17
+ ## Example output
18
+
19
+ ```
20
+ Modes:
21
+ /caveman the voice (default)
22
+ /ultracave grammar stripped
23
+ /megacave classical Chinese
24
+ /caveman status report the mode, change nothing
25
+
26
+ Skills:
27
+ /caveman-commit terse Conventional Commits
28
+ /caveman-review one-line PR comments
29
+ /caveman-compress smaller Markdown memory files
30
+ /caveman-stats recorded token usage (savings unknown)
31
+
32
+ Deactivate:
33
+ "stop caveman" or "normal mode"
34
+ ```
35
+
36
+ ## See also
37
+
38
+ - [`SKILL.md`](./SKILL.md) — full reference card
39
+ - [Caveman README](../../README.md) — repo overview
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: caveman-help
3
+ description: >
4
+ Quick-reference card for the three caveman skills and their commands.
5
+ Trigger: /caveman-help or "caveman help".
6
+ ---
7
+
8
+ # Caveman Help
9
+
10
+ Display this reference card when invoked. One-shot — do NOT change mode, write flag files, or persist anything. Output in caveman style.
11
+
12
+ ## Modes
13
+
14
+ | Mode | Trigger | What change |
15
+ |------|---------|-------------|
16
+ | **caveman** | `/caveman` | The voice. Answer first, no fluff, every fact kept. Default. |
17
+ | **ultracave** | `/ultracave` (alias `/caveman ultra`) | Grammar stripped. Fragments, one word when enough, each fact once. |
18
+ | **megacave** | `/megacave` (alias `/caveman wenyan`) | Classical Chinese 文言文. Far fewer characters, technical terms verbatim. |
19
+
20
+ Mode stick until changed or session end.
21
+ `/caveman status` reports current mode without changing it. Claude Code and the standalone OpenCode plugin read stored state; other hosts answer from the conversation and mark it `(not tracked by this host)`.
22
+
23
+ ## Skills
24
+
25
+ | Skill | Trigger | What it do |
26
+ |-------|---------|-----------|
27
+ | **caveman-commit** | `/caveman-commit` | Terse commit messages. Conventional Commits. ≤50 char subject. |
28
+ | **caveman-review** | `/caveman-review` | One-line PR comments: `L42: bug: user null. Add guard.` |
29
+ | **caveman-compress** | `/caveman-compress <file>` | Compress .md files to caveman prose. 33.2% fewer tokens on the repo's five test files. |
30
+ | **caveman-help** | `/caveman-help` | This card. |
31
+
32
+ ## Deactivate
33
+
34
+ Say "stop caveman" or "normal mode". Resume anytime with `/caveman`.
35
+
36
+ ## Language
37
+
38
+ Keep user's language by default — reply in the language user writes, never switch regardless of example text or multilingual context elsewhere. Compress the style, not the language. Technical terms, code, commands, commit types, and exact error strings stay verbatim unless user ask for translation.
39
+
40
+ ## Configure Default Mode
41
+
42
+ Default mode = `caveman`. Change it:
43
+
44
+ **Environment variable** (highest priority):
45
+ ```bash
46
+ export CAVEMAN_DEFAULT_MODE=ultracave
47
+ ```
48
+
49
+ **Config file** (`~/.config/caveman/config.json`):
50
+ ```json
51
+ { "defaultMode": "ultracave" }
52
+ ```
53
+
54
+ For opt-in activation in Claude Code, set `defaultMode` to `manual`. Sessions start off; `/caveman` or `talk like caveman` activates caveman. `off` also disables bare-command activation. `manual` is a startup policy, not a mode. OpenCode still starts in caveman mode because its installer also supplies static activation rules.
55
+
56
+ Set `"off"` to suppress automatic and bare-command activation. Use `"manual"` when bare `/caveman` should activate.
57
+
58
+ Resolution: env var > repo config > user config > `caveman`. Legacy values `lite`, `full`, `ultra`, `wenyan*` still resolve.
59
+
60
+ ## More
61
+
62
+ Full docs: https://github.com/JuliusBrussee/caveman
@@ -0,0 +1,32 @@
1
+ # skills/caveman-learn — the Caveman Learn editing skill (Apache-2.0, public)
2
+
3
+ The consent-gated half of `caveman learn`. The analyzer (the Go proxy) **measures**
4
+ where an agent's tokens go and writes a ranked plan; this skill is what an agent
5
+ loads to **act** on that plan — proposing each fix and applying it only with the
6
+ user's per-edit yes. It is the loop-closer the learn spec §10
7
+ describes, plus the new `cavemem_offload` move.
8
+
9
+ ## Layout
10
+ - `SKILL.md` — the canonical skill body (frontmatter `name: caveman-learn` + a
11
+ trigger-phrase `description`; body = the read-plan → per-class consent loop). This
12
+ file is the source of truth.
13
+ - `tests/skill-file.test.mjs` — asserts the canonical file is well-formed and honest
14
+ (frontmatter present; the net-token-negative gate, the never-make-the-agent-dumber
15
+ guard, consent-per-edit, and reversibility are all stated; no imperative for
16
+ behavioral findings; no placeholders).
17
+
18
+ ## Install path
19
+ `caveman tools skills install caveman-learn` (in `../../cli/src/index.ts`) writes this file
20
+ into a repo's `.claude/skills/caveman-learn/SKILL.md` (Claude Code) or
21
+ `~/.codex/skills/caveman-learn/SKILL.md` (Codex). The CLI **embeds a byte-identical copy**
22
+ (`CAVEMAN_LEARN_SKILL_MD`) because the published CLI ships no sibling assets;
23
+ `../../cli/tests/skills.runtime.mjs` asserts the embedded copy equals this canonical
24
+ file (the drift guard). **Change this file and that constant together.**
25
+
26
+ ## Boundary (binding)
27
+ The skill — using the agent's own file tools — is the ONLY thing that edits a user's
28
+ config. `caveman learn apply` stays read-only (it materializes candidates), and
29
+ `caveman mem *` are mechanical store ops. The offload move enforces a net-token-negative
30
+ gate and the never-make-the-agent-dumber guard before any trim.
31
+
32
+ See ../../mem/CLAUDE.md (cavemem) · ../caveman-explore/SKILL.md (the packaging precedent)
@@ -0,0 +1,38 @@
1
+ # caveman-learn skill
2
+
3
+ Close the loop on `caveman learn`. The command finds where your agent's tokens
4
+ go; this skill walks through the findings with you and applies the fixes, one
5
+ approved edit at a time.
6
+
7
+ ## Install
8
+
9
+ caveman skills install caveman-learn # this repo's .claude/skills
10
+ caveman skills install caveman-learn --user # all repos (~/.claude/skills)
11
+ caveman skills install caveman-learn --agent codex
12
+
13
+ ## What it does
14
+
15
+ 1. Runs `caveman learn report --json` and shows your Setup Score and the
16
+ findings, biggest first.
17
+ 2. For each finding you pick, it proposes a fix and asks yes or no:
18
+ - **Safe fix** (a heavy CLAUDE.md, a skill you never use): a concrete trim.
19
+ It is kept only if it measurably makes every message smaller.
20
+ - **Repeated text** (text you paste again in session after session): move it
21
+ to **Caveman memory** (cavemem). The full text is stored once, the agent
22
+ recalls a short version when it needs it, and a small pointer stays
23
+ behind. Kept only when it beats pasting, and only after a test recall
24
+ proves the text still comes back.
25
+ - **Needed** (setup your agent relies on): never touched.
26
+
27
+ After an approved edit passes its re-check, `caveman learn applied <id>`
28
+ records which finding was fixed, how, when, and its size before. Later scans
29
+ compare the sessions after the fix and report `improved`, `unchanged`,
30
+ `regressed`, or `insufficient_data` (not enough sessions yet). This record
31
+ does not edit your own or your repository's files.
32
+
33
+ ## Honesty
34
+
35
+ Everything is an estimate (`inferred`): no currency, never "verified". Every
36
+ edit waits for your yes and can be undone. A move to memory that would leave
37
+ the agent unable to recall the text is rejected. `caveman learn` itself never
38
+ edits your files; this skill does, and only with your yes.