composto-ai 0.4.1 → 0.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/README.md +79 -7
- package/dist/index.js +883 -84
- package/dist/mcp/server.js +54 -37
- package/dist/memory/api.js +53 -200
- package/dist/memory/worker.js +71 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,15 +46,84 @@ composto index --status
|
|
|
46
46
|
|
|
47
47
|
### MCP plugin (Claude Code, Cursor, Claude Desktop)
|
|
48
48
|
|
|
49
|
-
The MCP server is bundled inside `composto-ai`. Install the package globally first, then register the server:
|
|
49
|
+
The MCP server is bundled inside `composto-ai`. Install the package globally first, then register the server with your client:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
npm install -g composto-ai
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Claude Code:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
53
58
|
claude mcp add composto -- composto-mcp
|
|
54
59
|
```
|
|
55
60
|
|
|
61
|
+
**Cursor** — add to `~/.cursor/mcp.json` (or project-local `.cursor/mcp.json`):
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"composto": {
|
|
67
|
+
"command": "composto-mcp"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then restart Cursor and verify under Settings → MCP that `composto` is green.
|
|
74
|
+
|
|
75
|
+
**Claude Desktop** — add the same block to `~/Library/Application Support/Claude/claude_desktop_config.json`.
|
|
76
|
+
|
|
56
77
|
Composto adds 5 tools to your AI assistant: `composto_ir`, `composto_benchmark`, `composto_context`, `composto_scan`, and `composto_blastradius` (the last one gated by `COMPOSTO_BLASTRADIUS=1` during beta).
|
|
57
78
|
|
|
79
|
+
#### Cursor: one-command setup
|
|
80
|
+
|
|
81
|
+
Registering the MCP server only *exposes* the tools — Cursor's agent often defaults to its built-in `read_file` / `codebase_search`. To configure both the MCP server **and** a project rule that tells the agent when to call Composto, run:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd your-project
|
|
85
|
+
composto init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This writes `.cursor/mcp.json` (project-local MCP registration) and `.cursor/rules/composto.mdc` (an `alwaysApply: true` rule that gets injected into every conversation). Existing files are merged, never overwritten. Restart Cursor and check Settings → MCP that `composto` is green.
|
|
89
|
+
|
|
90
|
+
Without the rule, hit rate is ~30-50%; with it, ~85-95%. The rule template is embedded in [`src/cli/init.ts`](src/cli/init.ts) (`CURSOR_RULES_MDC`) — open the generated `.cursor/rules/composto.mdc` to customize per-project.
|
|
91
|
+
|
|
92
|
+
#### Hook-enforced injection (v0.6.0+)
|
|
93
|
+
|
|
94
|
+
Instead of asking the agent to remember to call `composto_blastradius`, wire a hook so it gets consulted **automatically** before every Edit / Write / MultiEdit. The agent receives a `<composto_blastradius>` context block in-line when verdict is `medium` or `high` — you don't do anything, the warning just shows up where it's needed.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cd your-project
|
|
98
|
+
composto init --client=claude-code # or cursor, or gemini-cli
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This writes:
|
|
102
|
+
- The platform's MCP config (same as before)
|
|
103
|
+
- A **`PreToolUse` hook** (Claude Code / Gemini CLI) that invokes `composto hook <platform> pretooluse` on every file-targeting tool call. The hook extracts the target file, runs `composto_blastradius`, and injects the verdict as `additionalContext`. Passthrough on `low` verdict — no noise.
|
|
104
|
+
- For Cursor: a `.cursor/hooks.json` entry that **denies** the tool call on `verdict: high` (Cursor's `additional_context` is dropped per [forum #155689](https://forum.cursor.com/t/...), so hybrid strategy — the existing `.cursor/rules/composto.mdc` rule carries `medium`/`low`, the hook only interrupts on `high`).
|
|
105
|
+
|
|
106
|
+
Existing settings are merged, never overwritten. Re-running `composto init` is idempotent — no duplicate hook entries.
|
|
107
|
+
|
|
108
|
+
**Observe what's happening:**
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
composto stats # hook invocations, verdict distribution, p50/p95 latency
|
|
112
|
+
composto stats --json # machine-readable
|
|
113
|
+
composto stats --disable # opt out (writes .composto/telemetry-disabled marker)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Telemetry is **local-only** — writes to `.composto/memory.db` in your repo, nothing leaves your machine. No user ID, no cloud sync, no account.
|
|
117
|
+
|
|
118
|
+
**Platform matrix:**
|
|
119
|
+
|
|
120
|
+
| Platform | MCP | Hook | Strategy |
|
|
121
|
+
|---|:---:|:---:|---|
|
|
122
|
+
| Claude Code | ✅ | ✅ `PreToolUse` | `additionalContext` on medium\|high\|unknown, passthrough on low |
|
|
123
|
+
| Cursor | ✅ | ✅ `preToolUse` | Deny-on-high via `permissionDecision`; medium/low via `.mdc` rule |
|
|
124
|
+
| Gemini CLI | ✅ | ✅ `BeforeTool` | `additionalContext` on medium\|high\|unknown |
|
|
125
|
+
| Claude Desktop | ✅ | — | MCP-only (no hook API yet) |
|
|
126
|
+
|
|
58
127
|
---
|
|
59
128
|
|
|
60
129
|
## How It Works
|
|
@@ -108,9 +177,9 @@ composto index --status # diagnostics: schema, freshness, calibration
|
|
|
108
177
|
|
|
109
178
|
## BlastRadius (beta)
|
|
110
179
|
|
|
111
|
-
Beyond compression, Composto indexes your repo's git history into a local SQLite graph and exposes it as a queryable risk surface. Before your agent edits a file, it can ask: *"has this region been reverted?
|
|
180
|
+
Beyond compression, Composto indexes your repo's git history into a local SQLite graph and exposes it as a queryable risk surface. Before your agent edits a file, it can ask: *"has this region been reverted? who fixed the last similar bug? is the last author still around?"* — signals no LLM can infer from current code alone.
|
|
112
181
|
|
|
113
|
-
|
|
182
|
+
Four signals per query: `revert_match`, `hotspot`, `fix_ratio`, `author_churn`. Verdict is `low` / `medium` / `high` / `unknown`; when confidence is low the tool returns `unknown` rather than guessing. Precision is repo-calibrated (self-validation over the repo's own fix history).
|
|
114
183
|
|
|
115
184
|
```
|
|
116
185
|
verdict: high
|
|
@@ -122,7 +191,9 @@ signals:
|
|
|
122
191
|
...
|
|
123
192
|
```
|
|
124
193
|
|
|
125
|
-
**
|
|
194
|
+
**Where we are, honestly.** The v2.1 time-travel backtest (rewinds the DB to each pre-fix snapshot) shows `revert_match` carrying most of the product's value — it clears the ship gate on picomatch (precision 0.65, recall 0.78 on the `medium|high` band). Signal-attributed precision (excluding `revert_match`) is weaker: the three non-revert signals are alive but need calibration work. See [docs/blastradius-proof-v2.md](docs/blastradius-proof-v2.md) for numbers on all four band combinations across two public repos + the per-signal diagnostic behind them.
|
|
195
|
+
|
|
196
|
+
The honest framing: **BlastRadius is a bug-history memory layer that agents query before editing.** "This file was reverted three weeks ago" is the primary promise v1 delivers. The other signals expand the query surface — calibration work on `hotspot` and `fix_ratio` is the open follow-on.
|
|
126
197
|
|
|
127
198
|
Feature-flagged via `COMPOSTO_BLASTRADIUS=1` during the beta. Available as both CLI (`composto impact`, `composto index`) and MCP tool (`composto_blastradius`).
|
|
128
199
|
|
|
@@ -227,9 +298,10 @@ Overall compression: 89.2%
|
|
|
227
298
|
L0 compression: 97.5%
|
|
228
299
|
AST engine: 51/51 files (0 regex fallback)
|
|
229
300
|
Languages: TypeScript, JavaScript, Python, Go, Rust
|
|
230
|
-
Tests:
|
|
231
|
-
BlastRadius
|
|
232
|
-
|
|
301
|
+
Tests: 251 passing
|
|
302
|
+
BlastRadius v2.1: precision 0.65, recall 0.78 (picomatch, time-travel,
|
|
303
|
+
medium|high band). Honest signal-attributed numbers
|
|
304
|
+
in docs/blastradius-proof-v2.md.
|
|
233
305
|
```
|
|
234
306
|
|
|
235
307
|
---
|