@kulapard/pi-caveman 0.3.0 → 0.4.1
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/AGENTS.md +8 -2
- package/CHANGELOG.md +42 -1
- package/README.md +15 -5
- package/package.json +3 -2
- package/skills/caveman/SKILL.md +8 -1
- package/skills/caveman-compress/README.md +11 -4
- package/skills/caveman-compress/SKILL.md +9 -3
package/AGENTS.md
CHANGED
|
@@ -30,12 +30,18 @@ Project memory for agents working in this repo. Non-obvious conventions only.
|
|
|
30
30
|
- **Verbatim preservation**: caveman-compress never alters code blocks, inline
|
|
31
31
|
code, URLs, file paths, commands, or exact error strings. The skill instructs
|
|
32
32
|
the agent to self-validate these against the original and, on any mismatch it
|
|
33
|
-
cannot fix, restore from the `.original` backup
|
|
33
|
+
cannot fix, restore from the `.original` backup that was created during the
|
|
34
|
+
same invocation (stale backups are rejected before compression starts).
|
|
34
35
|
- `caveman-compress` is **prompt-only**: the Pi agent performs the compression
|
|
35
36
|
with its own model and file tools, driven by `SKILL.md`. There is no Python and
|
|
36
37
|
no external model CLI; coverage is the doc-guard test `tests/compress-docs.test.mjs`.
|
|
37
38
|
|
|
38
|
-
##
|
|
39
|
+
## Changelog
|
|
40
|
+
|
|
41
|
+
Every notable change must update `CHANGELOG.md` under `[Unreleased]`. Before
|
|
42
|
+
finishing a task, run `npm run changelog:check` to confirm the changelog was
|
|
43
|
+
updated for the files you changed. CI also runs this check on every pull
|
|
44
|
+
request.
|
|
39
45
|
|
|
40
46
|
- `npm test` runs `pretest` (`npm run typecheck` → `tsc --noEmit`) first, then the
|
|
41
47
|
`node --test` suites under `tests/`. Typecheck failures fail the test run.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.1] - 2026-06-29
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- README install instructions now recommend `pi install
|
|
15
|
+
https://github.com/kulapard/pi-caveman` as the primary direct-load method,
|
|
16
|
+
keeping `pi -e` documented as a per-session fallback.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Guard tests for `caveman-compress` backup rules, the GitHub install URL in
|
|
21
|
+
the root README, and the `caveman` skill's delegation to `caveman-commit` /
|
|
22
|
+
`caveman-review`.
|
|
23
|
+
|
|
24
|
+
## [0.4.0] - 2026-06-29
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `caveman-compress` no longer restores from a potentially stale `.original`
|
|
29
|
+
backup on validation failure; it now aborts if a backup already exists and
|
|
30
|
+
only restores from the backup created during the same invocation.
|
|
31
|
+
- `caveman-compress` README clarified: users should edit the source file and
|
|
32
|
+
remove/rename the old `.original` backup before re-compressing; extensionless
|
|
33
|
+
files now have an explicit `.original` backup rule.
|
|
34
|
+
- Extension command handler tests now `await` async handlers, preventing false
|
|
35
|
+
greens if handlers become asynchronous.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- Workflow test now matches the actual `run: npm publish` step instead of any
|
|
40
|
+
`npm publish` substring.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- `scripts/check-changelog.mjs` and a CI check (`npm run changelog:check`)
|
|
45
|
+
enforce that `CHANGELOG.md` is updated for any notable file change; the
|
|
46
|
+
project convention also instructs agents to update the changelog under
|
|
47
|
+
`[Unreleased]`.
|
|
48
|
+
|
|
10
49
|
## [0.3.0] - 2026-06-29
|
|
11
50
|
|
|
12
51
|
### Fixed
|
|
@@ -65,7 +104,9 @@ port of [caveman](https://github.com/JuliusBrussee/caveman).
|
|
|
65
104
|
token, automatic provenance, a tag-equals-version guard, and a concurrency
|
|
66
105
|
group).
|
|
67
106
|
|
|
68
|
-
[Unreleased]: https://github.com/kulapard/pi-caveman/compare/v0.
|
|
107
|
+
[Unreleased]: https://github.com/kulapard/pi-caveman/compare/v0.4.1...HEAD
|
|
108
|
+
[0.4.1]: https://github.com/kulapard/pi-caveman/compare/v0.4.0...v0.4.1
|
|
109
|
+
[0.4.0]: https://github.com/kulapard/pi-caveman/compare/v0.3.0...v0.4.0
|
|
69
110
|
[0.3.0]: https://github.com/kulapard/pi-caveman/compare/v0.2.0...v0.3.0
|
|
70
111
|
[0.2.0]: https://github.com/kulapard/pi-caveman/compare/v0.1.0...v0.2.0
|
|
71
112
|
[0.1.0]: https://github.com/kulapard/pi-caveman/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -20,13 +20,23 @@ Install it into a Pi setup with:
|
|
|
20
20
|
pi install npm:@kulapard/pi-caveman
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
You can also load it straight from a checkout on disk
|
|
24
|
-
|
|
23
|
+
You can also load it straight from a checkout on disk — see the `pi -e`
|
|
24
|
+
mechanism below.
|
|
25
25
|
|
|
26
|
-
###
|
|
26
|
+
### Install from GitHub
|
|
27
27
|
|
|
28
|
-
The simplest
|
|
29
|
-
|
|
28
|
+
The simplest way to load the latest version directly from the repository is:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi install https://github.com/kulapard/pi-caveman
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Pi resolves the `pi` block in `package.json` and loads both the extension and
|
|
35
|
+
all skills from the cloned directory.
|
|
36
|
+
|
|
37
|
+
### Load the extension directly (per-session)
|
|
38
|
+
|
|
39
|
+
For quick testing without installing, use Pi's `-e` flag for a single session:
|
|
30
40
|
|
|
31
41
|
```bash
|
|
32
42
|
pi -e /path/to/pi-caveman/extensions/caveman.ts --skill /path/to/pi-caveman/skills
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kulapard/pi-caveman",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Caveman for Pi: ultra-compressed agent output that preserves technical substance. Six intensity modes, slash commands, natural-language activation, and a session statusline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"pretest": "npm run typecheck",
|
|
46
46
|
"test": "node --experimental-strip-types --test tests/**/*.test.mjs",
|
|
47
47
|
"typecheck": "tsc --noEmit",
|
|
48
|
-
"prepublishOnly": "npm test"
|
|
48
|
+
"prepublishOnly": "npm test",
|
|
49
|
+
"changelog:check": "node scripts/check-changelog.mjs --base origin/master"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@earendil-works/pi-coding-agent": "^0.80.2",
|
package/skills/caveman/SKILL.md
CHANGED
|
@@ -41,6 +41,7 @@ Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
|
|
|
41
41
|
| **wenyan-ultra** | Extreme abbreviation while keeping classical Chinese feel. Maximum compression, ultra terse |
|
|
42
42
|
|
|
43
43
|
Example — "Why React component re-render?"
|
|
44
|
+
|
|
44
45
|
- lite: "Your component re-renders because you create a new object reference each render. Wrap it in `useMemo`."
|
|
45
46
|
- full: "New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`."
|
|
46
47
|
- ultra: "Inline obj prop → new ref → re-render. `useMemo`."
|
|
@@ -49,6 +50,7 @@ Example — "Why React component re-render?"
|
|
|
49
50
|
- wenyan-ultra: "新參照→重繪。useMemo Wrap。"
|
|
50
51
|
|
|
51
52
|
Example — "Explain database connection pooling."
|
|
53
|
+
|
|
52
54
|
- lite: "Connection pooling reuses open connections instead of creating new ones per request. Avoids repeated handshake overhead."
|
|
53
55
|
- full: "Pool reuse open DB connections. No new connection per request. Skip handshake overhead."
|
|
54
56
|
- ultra: "Pool = reuse DB conn. Skip handshake → fast under load."
|
|
@@ -58,6 +60,7 @@ Example — "Explain database connection pooling."
|
|
|
58
60
|
## Auto-Clarity
|
|
59
61
|
|
|
60
62
|
Drop caveman when:
|
|
63
|
+
|
|
61
64
|
- Security warnings
|
|
62
65
|
- Irreversible action confirmations
|
|
63
66
|
- Multi-step sequences where fragment order or omitted conjunctions risk misread
|
|
@@ -68,11 +71,15 @@ Resume caveman after clear part done.
|
|
|
68
71
|
|
|
69
72
|
Example — destructive op:
|
|
70
73
|
> **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.
|
|
74
|
+
>
|
|
71
75
|
> ```sql
|
|
72
76
|
> DROP TABLE users;
|
|
73
77
|
> ```
|
|
78
|
+
>
|
|
74
79
|
> Caveman resume. Verify backup exist first.
|
|
75
80
|
|
|
76
81
|
## Boundaries
|
|
77
82
|
|
|
78
|
-
Code/
|
|
83
|
+
Code explanations / architecture discussion: write normal. "stop caveman" or "normal mode": revert. Level persist until changed or session end.
|
|
84
|
+
|
|
85
|
+
Note: when the user asks for a commit message, use `caveman-commit`. When asked to review a diff/PR, use `caveman-review`. Those skills override this line for their specific output.
|
|
@@ -22,10 +22,10 @@ The agent reads its memory file (`AGENTS.md` / `CLAUDE.md`) on every session sta
|
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
AGENTS.md ← compressed (the agent reads this — fewer tokens every session)
|
|
25
|
-
AGENTS.original.md ← human-readable backup (
|
|
25
|
+
AGENTS.original.md ← human-readable backup (snapshot taken at first compression)
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Original never lost.
|
|
28
|
+
Original never lost — first compression writes a verbatim backup. To edit and re-compress, **edit `AGENTS.md` itself**, then delete or rename the existing `AGENTS.original.md` so the next `/caveman-compress` can create a fresh backup.
|
|
29
29
|
|
|
30
30
|
## Benchmarks
|
|
31
31
|
|
|
@@ -81,6 +81,7 @@ its own model and file tools — there is no separate tool or language to instal
|
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
Examples:
|
|
84
|
+
|
|
84
85
|
```
|
|
85
86
|
/caveman-compress AGENTS.md
|
|
86
87
|
/caveman-compress CLAUDE.md
|
|
@@ -96,6 +97,7 @@ Examples:
|
|
|
96
97
|
| Extensionless natural language | ✅ Yes |
|
|
97
98
|
| `.py`, `.js`, `.ts`, `.json`, `.yaml` | ❌ Skip (code/config) |
|
|
98
99
|
| `*.original.md` | ❌ Skip (backup files) |
|
|
100
|
+
| `*.original` (extensionless) | ❌ Skip (backup files) |
|
|
99
101
|
|
|
100
102
|
## How It Work
|
|
101
103
|
|
|
@@ -104,15 +106,20 @@ Examples:
|
|
|
104
106
|
↓
|
|
105
107
|
agent detects file type (prose? else skip)
|
|
106
108
|
↓
|
|
107
|
-
agent
|
|
109
|
+
agent checks for existing backup → abort if stale `.original` exists
|
|
110
|
+
↓
|
|
111
|
+
agent backs up original once → AGENTS.original.md (verbatim snapshot)
|
|
108
112
|
↓
|
|
109
113
|
agent rewrites prose to caveman, code/URLs/paths left exact
|
|
110
114
|
↓
|
|
111
115
|
agent self-validates: protected tokens byte-identical to original
|
|
112
116
|
↓
|
|
113
|
-
if a protected token changed: fix it, or restore from backup and report
|
|
117
|
+
if a protected token changed: fix it, or restore from the just-created backup and report
|
|
114
118
|
↓
|
|
115
119
|
write compressed → AGENTS.md
|
|
120
|
+
|
|
121
|
+
To re-compress, edit `AGENTS.md`, then remove/rename the old `AGENTS.original.md`
|
|
122
|
+
so the skill can create a fresh snapshot.
|
|
116
123
|
```
|
|
117
124
|
|
|
118
125
|
The agent does this with its own model and file tools — no external CLI, no separate runtime.
|
|
@@ -21,12 +21,12 @@ Compress natural language files (`AGENTS.md`, `CLAUDE.md`, todos, preferences) i
|
|
|
21
21
|
|
|
22
22
|
You (the Pi agent) perform the compression directly — there is no separate tool to run. Given `/caveman-compress <filepath>`:
|
|
23
23
|
|
|
24
|
-
1. **Skip backups.** If the path ends in `.original.<ext>` (e.g. `AGENTS.original.md`), stop — never compress a backup file.
|
|
24
|
+
1. **Skip backups.** If the path ends in `.original.<ext>` or, for extensionless files, in `.original` (e.g. `AGENTS.original.md`, `NOTES.original`), stop — never compress a backup file.
|
|
25
25
|
2. **Check it is compressible** per **Boundaries** below: prose files (`.md`, `.txt`, `.rst`, `.typ`, `.typst`, `.tex`, or extensionless natural language). If it is code/config (`.py`, `.js`, `.ts`, `.json`, `.yaml`, …) or larger than ~500 KB, report it is out of scope and stop.
|
|
26
26
|
3. **Read** the file's full contents.
|
|
27
|
-
4. **Back up the original.**
|
|
27
|
+
4. **Back up the original.** If a `.original`/`.original.<ext>` backup already exists, **abort** and tell the user to remove or rename the stale backup before re-compressing. Otherwise write a verbatim copy to `<filename>.original.<ext>` (or `<filename>.original` for extensionless files) before any rewrite.
|
|
28
28
|
5. **Rewrite** the file in place, applying the **Compression Rules** below. Treat code blocks, inline code, URLs, paths, commands, headings, and table structure as read-only regions.
|
|
29
|
-
6. **Self-validate** against the contents you read in step 3: every protected token — fenced and inline code, URLs, file paths, heading text, table structure, dates/version numbers — must be byte-for-byte identical. If any changed, fix just that region; if you cannot make it identical, restore the file from the
|
|
29
|
+
6. **Self-validate** against the contents you read in step 3: every protected token — fenced and inline code, URLs, file paths, heading text, table structure, dates/version numbers — must be byte-for-byte identical. If any changed, fix just that region; if you cannot make it identical, restore the file from the backup you wrote in step 4 and report the failure rather than leave a corrupted file.
|
|
30
30
|
7. **Report** the result: bytes before/after and the approximate reduction.
|
|
31
31
|
|
|
32
32
|
Only the rewrite needs the model (you); detection, backup, and validation are mechanical.
|
|
@@ -34,6 +34,7 @@ Only the rewrite needs the model (you); detection, backup, and validation are me
|
|
|
34
34
|
## Compression Rules
|
|
35
35
|
|
|
36
36
|
### Remove
|
|
37
|
+
|
|
37
38
|
- Articles: a, an, the
|
|
38
39
|
- Filler: just, really, basically, actually, simply, essentially, generally
|
|
39
40
|
- Pleasantries: "sure", "certainly", "of course", "happy to", "I'd recommend"
|
|
@@ -42,6 +43,7 @@ Only the rewrite needs the model (you); detection, backup, and validation are me
|
|
|
42
43
|
- Connective fluff: "however", "furthermore", "additionally", "in addition"
|
|
43
44
|
|
|
44
45
|
### Preserve EXACTLY (never modify)
|
|
46
|
+
|
|
45
47
|
- Code blocks (fenced ``` and indented)
|
|
46
48
|
- Inline code (`backtick content`)
|
|
47
49
|
- URLs and links (full URLs, markdown links)
|
|
@@ -53,6 +55,7 @@ Only the rewrite needs the model (you); detection, backup, and validation are me
|
|
|
53
55
|
- Environment variables (`$HOME`, `NODE_ENV`)
|
|
54
56
|
|
|
55
57
|
### Preserve Structure
|
|
58
|
+
|
|
56
59
|
- All markdown headings (keep exact heading text, compress body below)
|
|
57
60
|
- Bullet point hierarchy (keep nesting level)
|
|
58
61
|
- Numbered lists (keep numbering)
|
|
@@ -60,6 +63,7 @@ Only the rewrite needs the model (you); detection, backup, and validation are me
|
|
|
60
63
|
- Frontmatter/YAML headers in markdown files
|
|
61
64
|
|
|
62
65
|
### Compress
|
|
66
|
+
|
|
63
67
|
- Use short synonyms: "big" not "extensive", "fix" not "implement a solution for", "use" not "utilize"
|
|
64
68
|
- Fragments OK: "Run tests before commit" not "You should always run tests before committing"
|
|
65
69
|
- Drop "you should", "make sure to", "remember to" — just state the action
|
|
@@ -69,6 +73,7 @@ Only the rewrite needs the model (you); detection, backup, and validation are me
|
|
|
69
73
|
CRITICAL RULE:
|
|
70
74
|
Anything inside ``` ... ``` must be copied EXACTLY.
|
|
71
75
|
Do not:
|
|
76
|
+
|
|
72
77
|
- remove comments
|
|
73
78
|
- remove spacing
|
|
74
79
|
- reorder lines
|
|
@@ -79,6 +84,7 @@ Inline code (`...`) must be preserved EXACTLY.
|
|
|
79
84
|
Do not modify anything inside backticks.
|
|
80
85
|
|
|
81
86
|
If file contains code blocks:
|
|
87
|
+
|
|
82
88
|
- Treat code blocks as read-only regions
|
|
83
89
|
- Only compress text outside them
|
|
84
90
|
- Do not merge sections around code
|