compound-agent 1.5.0 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [1.6.0] - 2026-03-02
13
+
14
+ ### Added
15
+
16
+ - **`ca watch` command**: Live pretty-printer for infinity loop trace files. Tails `agent_logs/trace_*.jsonl` and formats stream-json events (tool calls, text deltas, token usage, epic markers) with colored output. Supports `--epic <id>` to watch a specific epic and `--no-follow` for one-shot reads.
17
+ - **Stream-json micro logging**: Generated infinity loop scripts now use `--output-format stream-json --include-partial-messages` to capture structured JSONL event traces alongside the existing macro text log. Trace files written to `agent_logs/trace_<epic>-<ts>.jsonl` with `.latest` symlink for easy discovery.
18
+ - **`/compound:learn-that` slash command**: Conversation-aware lesson capture with user confirmation before saving
19
+ - **`/compound:check-that` slash command**: Search lessons and proactively apply them to current work
20
+ - **Eager knowledge embedding**: Knowledge chunks from `docs/` are now embedded for semantic search when the model is available
21
+ - `ca index-docs --embed` embeds chunks after indexing
22
+ - `ca init` now downloads the embedding model (with `--skip-model` opt-out) and installs the post-commit hook
23
+ - Background embedding spawns after `ca init`/`ca setup` so users can start working immediately
24
+ - PID-based lock file prevents concurrent embedding processes
25
+ - Status file (`embed-status.json`) tracks background embedding progress
26
+ - **New modules**: `embed-chunks.ts`, `embed-lock.ts`, `embed-status.ts`, `embed-background.ts` with full test coverage
27
+
28
+ ### Removed
29
+
30
+ - **`/compound:learn` slash command**: Replaced by `/compound:learn-that` with conversation-aware capture and user confirmation
31
+ - **`ca worktree` command family**: All five subcommands (`create`, `merge`, `list`, `cleanup`, `wire-deps`) removed. Claude Code now provides native `EnterWorktree` support. Running `ca worktree` prints a deprecation notice.
32
+ - **`/compound:set-worktree` slash command**: Use Claude Code's native worktree workflow instead.
33
+ - **Conditional Merge gate in `verify-gates`**: Only Review and Compound gates remain.
34
+ - **`shortId` utility**: Dead code after worktree removal, cleaned up.
35
+
36
+ ### Changed
37
+
38
+ - **Loop script uses piped stream splitting**: Claude invocation changed from `&>` capture to a `tee | extract_text` pipeline. Raw JSONL streams to trace file while extracted text feeds the macro log for marker detection. Backwards compatible — all existing markers (EPIC_COMPLETE, EPIC_FAILED, HUMAN_REQUIRED) still work.
39
+ - **`ca setup --update` now cleans deprecated paths**: Automatically removes stale worktree skill/command files from `.claude/` and `.gemini/` directories.
40
+ - **`ca setup` also cleans deprecated paths**: Fresh setup runs now remove stale files from prior versions.
41
+ - **SKILLS.md template**: Command inventory now lists all 11 slash commands (was 7).
42
+
43
+ ### Fixed
44
+
45
+ - **Eager embedding hardening** (production readiness fixes from triple review):
46
+ - **P0**: Background worker spawn now resolves `dist/cli.js` deterministically instead of relying on `npx ca` (which failed silently in dev/built contexts)
47
+ - **P0**: `embed-worker` command hidden from `ca --help` output
48
+ - **P1**: Stale lock recovery uses atomic delete-then-`wx` to prevent two processes both reclaiming
49
+ - **P1**: DB connection opened after lock acquisition to prevent leak on contention
50
+ - **P1**: `--embed` now throws when model unavailable (was silently returning 0)
51
+ - **P2**: Batch embedding (16 chunks per call) with per-batch SQLite transactions (was 1 fsync per row)
52
+ - **P2**: `EmbedStatus` rewritten as discriminated union; removed dead `chunksTotal` field
53
+ - **P2**: `readLock` validates JSON shape instead of blind `as` cast
54
+ - **P2**: Vector batch length assertion guards against short responses from embedding backend
55
+ - **P3**: Extracted `indexAndSpawnEmbed()` shared helper — `init.ts` and `all.ts` no longer duplicate logic
56
+ - **P3**: `ca setup` now prints feedback when background embedding spawns
57
+ - **P3**: `filesErrored` count shown in `ca index-docs` output
58
+ - **P3**: Barrel re-exports consolidated through `./memory/knowledge/index.js`
59
+ - **`EPIC_ID_PATTERN` duplication**: `loop.ts` now uses distinctly named `LOOP_EPIC_ID_PATTERN` to avoid confusion with the canonical pattern in `cli-utils.ts`.
60
+ - **Stale worktree lesson invalidated**: Memory item `Ld204372e` marked invalid to prevent irrelevant context injection.
61
+
62
+ ### Performance
63
+
64
+ - **Eliminate double model initialization**: `ca search` now uses `isModelAvailable()` (fs.existsSync, zero cost) instead of `isModelUsable()` which loaded the 278MB native model just to probe availability, then loaded it again for actual embedding
65
+ - **Bulk-read cached embeddings**: `getCachedEmbeddingsBulk()` replaces N individual `getCachedEmbedding()` SQLite queries with a single bulk read
66
+ - **Eliminate redundant JSONL parsing**: `searchVector()` and `findSimilarLessons()` now use `readAllFromSqlite()` after `syncIfNeeded()` instead of re-parsing the JSONL file
67
+ - **Float32Array consistency**: Lesson embedding path now keeps `Float32Array` from node-llama-cpp instead of converting via `Array.from()` (4x memory savings per vector)
68
+ - **Pre-warm lesson embedding cache**: `ca init` now pre-computes embeddings for all lessons with missing or stale cache entries, eliminating cold-start latency on first search
69
+ - **Graceful embedding fallback**: `ca search` falls back to keyword-only search on runtime embedding failures instead of crashing
70
+
12
71
  ## [1.5.0] - 2026-02-24
13
72
 
14
73
  ### Added
@@ -783,7 +842,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
783
842
  - Vitest test suite
784
843
  - tsup build configuration
785
844
 
786
- [Unreleased]: https://github.com/Nathandela/compound-agent/compare/v1.4.4...HEAD
845
+ [Unreleased]: https://github.com/Nathandela/compound-agent/compare/v1.5.0...HEAD
846
+ [1.5.0]: https://github.com/Nathandela/compound-agent/compare/v1.4.4...v1.5.0
787
847
  [1.4.4]: https://github.com/Nathandela/compound-agent/compare/v1.4.3...v1.4.4
788
848
  [1.4.3]: https://github.com/Nathandela/compound-agent/compare/v1.4.2...v1.4.3
789
849
  [1.4.2]: https://github.com/Nathandela/compound-agent/compare/v1.4.1...v1.4.2
package/README.md CHANGED
@@ -1,16 +1,21 @@
1
1
  # Compound Agent
2
2
 
3
- **Semantic memory for Claude Code -- capture mistakes once, never repeat them.**
3
+ **Memory. Knowledge. Structure. Accountability. For AI coding agents.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/compound-agent)](https://www.npmjs.com/package/compound-agent)
6
6
  [![license](https://img.shields.io/npm/l/compound-agent)](LICENSE)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3+-blue)](https://www.typescriptlang.org/)
8
8
 
9
- ## Overview
9
+ - **Memory** -- capture mistakes once, surface them forever
10
+ - **Knowledge** -- hybrid vector search over your project docs
11
+ - **Structure** -- 5-phase workflows with 35+ specialized agents
12
+ - **Accountability** -- git-tracked issues, multi-agent reviews, quality gates
13
+
14
+ Fully local. Fully offline. Everything in git.
10
15
 
11
- Claude Code forgets everything between sessions. Compound Agent fixes this with a three-layer system: issue tracking (Beads) at the foundation, semantic memory with vector search in the middle, and structured workflow phases on top. It captures knowledge from corrections, discoveries, and completed work, then retrieves it precisely when relevant -- at session start, during planning, and before architectural decisions. Every cycle through the loop makes subsequent cycles smarter.
16
+ ## Overview
12
17
 
13
- ## The Compound Loop
18
+ AI coding agents forget everything between sessions. Compound Agent fixes this with a three-layer system: issue tracking at the foundation, semantic memory with vector search in the middle, and structured workflows with multi-agent review on top. It captures knowledge from corrections, discoveries, and completed work, then retrieves it precisely when relevant. Every cycle through the loop makes subsequent cycles smarter.
14
19
 
15
20
  ```mermaid
16
21
  graph LR
@@ -20,42 +25,49 @@ graph LR
20
25
  R --> C[COMPOUND]
21
26
  C --> M[(MEMORY)]
22
27
  M --> P
23
- ```
24
-
25
- A bug found in review becomes a lesson. That lesson surfaces during planning of similar work. The plan accounts for the known issue. Work avoids the mistake.
26
28
 
27
- ## Architecture
29
+ style M fill:#f9f,stroke:#333
30
+ ```
28
31
 
29
32
  ```mermaid
30
33
  block-beta
31
34
  columns 1
32
- block:L3["Layer 3: Workflows"]
33
- A["Slash commands"] B["Agent teams"] C["5-phase cycle"]
35
+ block:L3["Workflows"]
36
+ A["5-phase cycle"] B["35+ specialized agents"] C["Multi-model review"]
34
37
  end
35
- block:L2["Layer 2: Semantic Memory"]
36
- D["JSONL source of truth"] E["SQLite FTS5 index"] F["Vector embeddings"]
38
+ block:L2["Semantic Memory"]
39
+ D["Vector search"] E["Hybrid retrieval"] F["Cross-cutting patterns"]
37
40
  end
38
- block:L1["Layer 1: Beads"]
39
- G["Issue tracking"] H["Git-backed sync"] I["Dependency graph"]
41
+ block:L1["Foundation"]
42
+ G["Issue tracking"] H["Git-backed sync"] I["Quality gates"]
40
43
  end
41
44
 
42
45
  L3 --> L2
43
46
  L2 --> L1
44
47
  ```
45
48
 
46
- Four memory types -- `lesson`, `solution`, `pattern`, `preference` -- share one store, one schema, and one ranked retrieval mechanism combining vector similarity, severity, recency, and confirmation status.
49
+ ## Is this for you?
50
+
51
+ **"It keeps making the same mistake every session."**
52
+ Capture it once. Compound Agent surfaces it automatically before the agent repeats it.
53
+
54
+ **"I explained our auth pattern three sessions ago. Now it's reimplementing from scratch."**
55
+ Architectural decisions persist as searchable lessons. Next session, they inject into context before planning starts.
56
+
57
+ **"My agent uses pandas when we standardized on Polars months ago."**
58
+ Preferences survive across sessions and projects. Once captured, they appear at the right moment.
59
+
60
+ **"Code reviews keep catching the same class of bugs."**
61
+ 35+ specialized review agents (security, performance, architecture, test coverage) run in parallel. Findings feed back as lessons that become test requirements in future work.
62
+
63
+ **"I have no idea what my agent actually learned or if it's reliable."**
64
+ `ca list` shows all captured knowledge. `ca stats` shows health. `ca wrong <id>` invalidates bad lessons. Everything is git-tracked JSONL -- you can read, diff, and audit it.
47
65
 
48
- ## Why Not Just X?
66
+ **"I want structured phases, not just 'go build this'."**
67
+ Five workflow phases (brainstorm, plan, work, review, compound) with mandatory gates between them. Each phase searches memory and docs for relevant context before starting.
49
68
 
50
- | Feature | `.claude/CLAUDE.md` | Claude Reflect | mem0 | Compound Agent |
51
- |---------|---------------------|----------------|------|----------------|
52
- | Persists across sessions | Manual edits | Yes | Yes | Yes |
53
- | Semantic search | No | No (regex) | Yes (cloud) | Yes (local) |
54
- | Quality gate on capture | No | No | No | Yes (novelty + specificity) |
55
- | Runs fully offline | Yes | Yes | No (API) | Yes |
56
- | Git-tracked knowledge | Yes | No | No | Yes (JSONL) |
57
- | Structured workflow phases | No | No | No | Yes (5 phases) |
58
- | Claude Code native integration | N/A | Yes | No | Yes (hooks + commands) |
69
+ **"My agent doesn't read the project docs before making decisions."**
70
+ `ca knowledge "auth flow"` runs hybrid search (vector + keyword) over your indexed docs. Agents query it automatically during planning -- ADRs, specs, and standards surface before code gets written.
59
71
 
60
72
  ## Installation
61
73
 
@@ -120,9 +132,9 @@ The CLI binary is `ca` (alias: `compound-agent`).
120
132
 
121
133
  | Command | Description |
122
134
  |---------|-------------|
123
- | `ca learn "<insight>"` | Capture a memory item manually |
135
+ | `ca learn "<insight>"` | Capture a lesson manually |
124
136
  | `ca learn "<insight>" --trigger "<context>"` | Capture with trigger context |
125
- | `ca learn "<insight>" --severity high` | Set severity level |
137
+ | `ca learn "<insight>" --severity high` | Set severity (low/medium/high) |
126
138
  | `ca learn "<insight>" --citation src/api.ts:42` | Attach file provenance |
127
139
  | `ca capture --input <file>` | Capture from structured input file |
128
140
  | `ca detect --input <file>` | Detect correction patterns in input |
@@ -159,16 +171,6 @@ The CLI binary is `ca` (alias: `compound-agent`).
159
171
  | `ca rules check` | Run repository-defined rule checks |
160
172
  | `ca test-summary` | Run tests and output a compact summary |
161
173
 
162
- ### Worktree
163
-
164
- | Command | Description |
165
- |---------|-------------|
166
- | `ca worktree create <epic-id>` | Create isolated worktree for an epic |
167
- | `ca worktree wire-deps <epic-id>` | Wire Review/Compound as merge blockers |
168
- | `ca worktree merge <epic-id>` | Two-phase merge back to main |
169
- | `ca worktree list` | List active worktrees with status |
170
- | `ca worktree cleanup <epic-id>` | Remove worktree and clean up (--force for dirty) |
171
-
172
174
  ### Automation
173
175
 
174
176
  | Command | Description |
@@ -179,6 +181,13 @@ The CLI binary is `ca` (alias: `compound-agent`).
179
181
  | `ca loop --max-retries <n>` | Max retries per epic on failure (default: 1) |
180
182
  | `ca loop --force` | Overwrite existing script |
181
183
 
184
+ ### Knowledge
185
+
186
+ | Command | Description |
187
+ |---------|-------------|
188
+ | `ca knowledge "<query>"` | Hybrid search over indexed project docs |
189
+ | `ca index-docs` | Index docs/ directory into knowledge base |
190
+
182
191
  ### Setup
183
192
 
184
193
  | Command | Description |
@@ -219,7 +228,7 @@ confirmation_boost: confirmed=1.3, unconfirmed=1.0
219
228
  ## FAQ
220
229
 
221
230
  **Q: How is this different from mem0?**
222
- A: mem0 is a cloud memory layer for general AI agents. Compound Agent is local-first, designed specifically for Claude Code, with git-tracked storage and local embeddings -- no API keys or cloud services needed.
231
+ A: mem0 is a cloud memory layer for general AI agents. Compound Agent is local-first with git-tracked storage and local embeddings -- no API keys or cloud services needed. It also goes beyond memory with structured workflows, multi-agent review, and issue tracking.
223
232
 
224
233
  **Q: Does this work offline?**
225
234
  A: Yes, completely. Embeddings run locally via node-llama-cpp. No network requests after the initial model download.
@@ -228,10 +237,10 @@ A: Yes, completely. Embeddings run locally via node-llama-cpp. No network reques
228
237
  A: ~278MB for the embedding model (one-time download, shared across projects) plus negligible space for lessons.
229
238
 
230
239
  **Q: Can I use it with other AI coding tools?**
231
- A: The CLI (`ca`) works standalone, but hooks and slash commands are Claude Code specific. The TypeScript API can be integrated into other tools.
240
+ A: The CLI (`ca`) works standalone with any tool. Full hook integration is available for Claude Code and Gemini CLI. The TypeScript API can be integrated into other tools.
232
241
 
233
242
  **Q: What happens if the embedding model isn't available?**
234
- A: Compound Agent hard-fails rather than silently degrading. Run `npx ca doctor` to diagnose issues.
243
+ A: Search gracefully falls back to keyword-only mode. Other commands that require embeddings will tell you what's missing. Run `npx ca doctor` to diagnose issues.
235
244
 
236
245
  ## Development
237
246
 
@@ -285,6 +294,10 @@ Compound Agent builds on ideas and patterns from these projects:
285
294
 
286
295
  Also informed by research into [Reflexion](https://arxiv.org/abs/2303.11366) (verbal reinforcement learning), [Voyager](https://github.com/MineDojo/Voyager) (executable skill libraries), and production systems from mem0, Letta, and GitHub Copilot Memory.
287
296
 
297
+ ## Contributing
298
+
299
+ Bug reports and feature requests are welcome via [Issues](https://github.com/Nathandela/compound-agent/issues). Pull requests are not accepted at this time -- see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
300
+
288
301
  ## License
289
302
 
290
303
  MIT -- see [LICENSE](LICENSE) for details.