@unerr-ai/unerr 0.0.0-beta.1 → 0.0.0-beta.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/README.md CHANGED
@@ -7,20 +7,19 @@
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- Local code intelligence that gives your AI agent a graph of your entire codebase.<br/>
11
- It stops looping, stops re-reading, stops breaking things it can't see.
10
+ The intelligence layer between your AI agent and your codebase.<br/>
11
+ It sees every dependency, remembers every session, and gets smarter the longer you use it.
12
12
  </p>
13
13
 
14
14
  <p align="center">
15
- <a href="#get-started"><img src="https://img.shields.io/badge/install-npx_@unerr/unerr-8B5CF6?style=flat-square&logo=npm" alt="Install" /></a>
15
+ <a href="https://www.npmjs.com/package/@unerr-ai/unerr"><img src="https://img.shields.io/badge/install-npm_i_@unerr--ai/unerr-8B5CF6?style=flat-square&logo=npm" alt="Install" /></a>
16
16
  <img src="https://img.shields.io/badge/runtime-Node.js_≥20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js" />
17
17
  <img src="https://img.shields.io/badge/protocol-MCP-7C3AED?style=flat-square" alt="MCP" />
18
- <img src="https://img.shields.io/badge/tests-1455_passing-34D399?style=flat-square" alt="Tests" />
19
18
  <img src="https://img.shields.io/badge/license-ELv2-A1A1AA?style=flat-square" alt="License" />
20
19
  </p>
21
20
 
22
21
  <p align="center">
23
- <code>npx @unerr/unerr</code>
22
+ <code>npm install -g @unerr-ai/unerr</code>
24
23
  </p>
25
24
 
26
25
  ---
@@ -35,16 +34,12 @@ You've seen it. You ask Claude or Cursor to refactor a function. It reads 30 fil
35
34
  - It doesn't know your team uses `fetch` prefixes, not `get`
36
35
  - It forgot everything from yesterday's session
37
36
 
38
- unerr gives it a graph. Every caller, every dependency, every convention. The agent lands at the right code instead of searching for it.
37
+ unerr gives it an intelligence layer that compounds. Every caller, every convention, every session accumulated, not re-derived. The agent stops searching and starts knowing.
39
38
 
40
39
  ---
41
40
 
42
41
  ## What happens when you run it
43
42
 
44
- ```bash
45
- npx @unerr/unerr
46
- ```
47
-
48
43
  **5 seconds later**, your agent has:
49
44
 
50
45
  | Before unerr | After unerr |
@@ -52,39 +47,89 @@ npx @unerr/unerr
52
47
  | Reads 30 files to understand a call graph | Queries the graph in 5ms |
53
48
  | Misses downstream callers, breaks things | Sees full blast radius before editing |
54
49
  | Re-derives conventions every session | Knows your patterns, enforces them |
55
- | Session degrades at 70% context fill | Stays sharp — 93% shell compression, context lasts 3-5x longer |
50
+ | Session degrades at 70% context fill | Stays sharp — 93% shell compression, context lasts 35x longer |
56
51
  | Starts from zero tomorrow | Resumes where it left off |
57
52
 
58
- ```
59
- unerr session (12 min)
60
- Tool calls 47 (all local, <5ms each)
61
- Tokens saved ~120K (93% shell compression + graph-targeted reads)
62
- Turns saved ~8 (approaches that would have failed, prevented)
63
- ```
53
+ ### See it in action
54
+
55
+ <p align="center">
56
+ <table>
57
+ <tr>
58
+ <td align="center">
59
+ <img src="public/screenshots/token-trace-main.png" alt="unerr token trace — main view" width="250" />
60
+ <br/><sub>Token trace</sub>
61
+ </td>
62
+ <td align="center">
63
+ <img src="public/screenshots/token-session.png" alt="unerr session token tracking" width="250" />
64
+ <br/><sub>Session tracking</sub>
65
+ </td>
66
+ <td align="center">
67
+ <img src="public/screenshots/token-turn.png" alt="unerr per-turn token breakdown" width="250" />
68
+ <br/><sub>Per-turn breakdown</sub>
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </p>
64
73
 
65
74
  ---
66
75
 
67
- ## Get Started
76
+ ## Quick Start
77
+
78
+ ### Install from npm
68
79
 
69
80
  ```bash
70
- npx @unerr/unerr
81
+ # 1. Install globally
82
+ npm install -g @unerr-ai/unerr
83
+
84
+ # 2. Add to your AI agent (in your project directory)
85
+ unerr install claude-code # or: cursor, vscode, windsurf, codex, etc.
86
+
87
+ # 3. Run (indexes your codebase, starts MCP server)
88
+ unerr
89
+ ```
90
+
91
+ ### Install from source
92
+
93
+ ```bash
94
+ # 1. Clone and build
95
+ git clone https://github.com/unerr-cli.git
96
+ cd unerr-cli
97
+ pnpm install
98
+ pnpm run build
99
+
100
+ # 2. Link globally (makes `unerr` command available)
101
+ pnpm link --global
102
+
103
+ # 3. Add to your AI agent (in your project directory)
104
+ cd /path/to/your/project
105
+ unerr install claude-code # or: cursor, vscode, windsurf, codex, etc.
106
+
107
+ # 4. Run
108
+ unerr
71
109
  ```
72
110
 
73
- That's it. Auto-detects your IDE, indexes your codebase (~30s), starts serving intelligence via MCP.
111
+ After install, your AI agent automatically connects to unerr via MCP. No config files to edit manually.
112
+
113
+ ---
74
114
 
75
- ### Add to more agents
115
+ ## Supported Agents
76
116
 
77
117
  ```bash
78
- unerr install claude-code # .mcp.json + .claude/skills/ + PreToolUse hook
79
- unerr install cursor # .cursor/mcp.json + .cursor/rules/
80
- unerr install vscode # .vscode/mcp.json + .github/copilot/
81
- unerr install windsurf # .windsurf/mcp.json + .windsurf/rules/
82
- unerr install zed # .zed/mcp.json
83
- unerr install codex # .codex/mcp.json
84
- unerr install gemini-cli # .gemini/settings.json
85
- unerr install kiro # .kiro/mcp.json
86
- unerr install aider # .aider/mcp.json
87
- unerr install continue # .continue/config.json
118
+ unerr install claude-code # .mcp.json + CLAUDE.md + .claude/skills/ + hooks
119
+ unerr install cursor # .cursor/mcp.json + .cursor/rules/
120
+ unerr install vscode # .vscode/mcp.json + .github/copilot-instructions.md
121
+ unerr install windsurf # .windsurf/mcp.json
122
+ unerr install zed # .zed/mcp.json
123
+ unerr install cline # .cline/mcp.json + .clinerules
124
+ unerr install kiro # .kiro/mcp.json
125
+ unerr install gemini-cli # .gemini/settings.json + GEMINI.md
126
+ unerr install codex # .codex/mcp.json + AGENTS.md
127
+ unerr install aider # .aider/mcp.json
128
+ unerr install opencode # .opencode/mcp.json
129
+ unerr install trae # .trae/mcp.json
130
+ unerr install augment # .augment/mcp.json
131
+ unerr install github-copilot-cli # .github/mcp.json + .github/copilot-instructions.md
132
+ unerr install continue # .continue/config.json
88
133
  ```
89
134
 
90
135
  Works with any MCP-compatible agent. 15 supported out of the box.
@@ -97,7 +142,7 @@ Works with any MCP-compatible agent. 15 supported out of the box.
97
142
  "mcpServers": {
98
143
  "unerr": {
99
144
  "command": "npx",
100
- "args": ["@unerr/unerr", "--mcp"]
145
+ "args": ["@unerr-ai/unerr", "--mcp"]
101
146
  }
102
147
  }
103
148
  }
@@ -111,24 +156,39 @@ Works with any MCP-compatible agent. 15 supported out of the box.
111
156
 
112
157
  ### Instant (first session)
113
158
 
114
- - **Graph navigation** — `get_callers` · `get_callees` · `get_imports` · `search_code` in <5ms. The agent stops reading 30 files to find one function.
115
- - **Blast radius** — before editing, the agent sees every downstream dependency. No more confident wrong changes.
159
+ - **Graph navigation** — `get_entity` · `get_references` · `get_imports` · `search_code` in <5ms. The agent stops reading 30 files to find one function.
160
+ - **Blast radius** — before editing, the agent sees every downstream caller via `get_references`. No more confident wrong changes.
116
161
  - **Smart file reads** — `file_read({entity: "functionName"})` returns just that function + context. Not 2000 lines.
117
- - **Shell compression** — 10 strategies, 645 command classifiers. Diffs, errors, logs, test results, key-value, tabular — each compressed differently. **93% average compression** across real-world benchmarks (2MB → 138KB).
162
+ - **Shell compression** — 11 strategies, 645+ command classifiers. Diffs, errors, logs, test results, YAML, key-value, tabular — each compressed differently. **93% average compression** across real-world benchmarks (2MB → 138KB).
118
163
  - **Full output recovery** — when compression is significant, raw output is saved to disk with a recovery path. The agent can always access the original.
119
164
  - **Convention awareness** — auto-detected naming, structure, and import patterns injected into agent context.
165
+ - **Semantic search** — `semantic_search` finds conceptually similar code even with different naming. `find_similar` discovers related entities by embedding distance.
166
+ - **Business context** — `get_business_context` explains why code exists — purpose, feature area, taxonomy.
120
167
 
121
168
  ### Compounding (session 2+)
122
169
 
123
170
  - **Session persistence** — the agent tomorrow knows what the agent learned today. No more starting from zero.
171
+ - **Fact memory** — `record_fact` persists conventions, decisions, and anti-patterns across sessions. `recall_facts` retrieves them with decay-adjusted confidence.
124
172
  - **Convention enforcement** — patterns detected in session 1 are enforced in session 5. No manual `.cursorrules` maintenance.
125
173
  - **Anti-pattern rules** — when you revert bad code, unerr learns. That mistake never happens again.
126
- - **Durability scoring** — code that keeps getting rewritten gets flagged before the agent touches it.
174
+ - **Shadow ledger** — `unerr_mark_working` snapshots known-good state. `unerr_revert_to_working_state` rolls back when things break. `unerr_get_timeline` shows what changed across sessions.
127
175
  - **Loop prevention** — circuit breaker fires after repeated failed attempts.
128
176
 
177
+ ### Agent behaviors (long-lived mode)
178
+
179
+ When running `unerr` as a daemon, these automated behaviors activate:
180
+
181
+ - **Architecture guard** — flags structural violations before they ship
182
+ - **Cascade guard** — warns when a change has wide blast radius
183
+ - **Convention drift** — detects when new code diverges from established patterns
184
+ - **Auto-doc** — generates documentation for undocumented entities
185
+ - **Change narrative** — tracks the story behind multi-step refactors
186
+ - **Loop breaker** — intervenes when the agent is stuck in a retry loop
187
+ - **Session continuity** — preserves context across restarts
188
+
129
189
  ### Shell compression benchmarks
130
190
 
131
- Every shell command the agent runs is classified (645 command patterns + content heuristics) and compressed with the best-fit strategy:
191
+ Every shell command the agent runs is classified (645+ command patterns + content heuristics) and compressed with the best-fit strategy:
132
192
 
133
193
  | Strategy | What it compresses | Avg compression |
134
194
  |----------|-------------------|:-:|
@@ -141,28 +201,36 @@ Every shell command the agent runs is classified (645 command patterns + content
141
201
  | **error_diagnostic** | `tsc`, `eslint`, `rustc`, `shellcheck` | **72%** |
142
202
  | **key_value** | `env`, `kubectl describe`, `systemctl status` | **48%** |
143
203
  | **tree_paths** | `find`, `tree`, `ls -R` | **42%** |
204
+ | **yaml** | YAML configs, `kubectl get -o yaml`, Helm output | adaptive |
144
205
  | **omni** | Fallback for unrecognized output | adaptive |
145
206
 
146
207
  **Overall: 93% compression** (2MB → 138KB across 40 real-world test cases). Low-confidence classifications use smart fallback — tries both the best-guess strategy and generic compression, picks whichever saves more tokens.
147
208
 
148
209
  ### Language support
149
210
 
150
- | Language | Entity Extraction | Edge Extraction | Tree-sitter AST | SCIP |
151
- |----------|:-:|:-:|:-:|:-:|
152
- | TypeScript | ✓ | ✓ | ✓ | ✓ |
153
- | JavaScript | ✓ | ✓ | ✓ | ✓ |
154
- | Python | ✓ | ✓ | ✓ | ✓ |
155
- | Go | ✓ | ✓ | ✓ | ✓ |
156
- | Java | ✓ | ✓ | ✓ | ✓ |
157
- | Rust | ✓ | ✓ | ✓ | ✓ |
158
- | C# | ✓ | ✓ | ✓ | — |
159
- | C / C++ | ✓ | ✓ | ✓ | — |
160
- | Ruby | ✓ | ✓ | ✓ | — |
161
- | PHP | ✓ | ✓ | ✓ | — |
162
- | Kotlin | ✓ | ✓ | ✓ | — |
163
- | Swift | ✓ | ✓ | ✓ | — |
164
-
165
- All 13 languages get full regex-based entity extraction (functions, classes, interfaces, methods with `parent_class` detection) and tree-sitter AST extraction when WASM grammars are available. SCIP integration provides compiler-verified call graphs for TypeScript, Python, Go, Java, and Rust.
211
+ | Language | Tier | Entity Extraction | Edge Extraction | Tree-sitter AST | SCIP |
212
+ |----------|:---:|:-:|:-:|:-:|:-:|
213
+ | TypeScript | 1 | ✓ | ✓ | ✓ | ✓ |
214
+ | JavaScript | 1 | ✓ | ✓ | ✓ | ✓ |
215
+ | Python | 1 | ✓ | ✓ | ✓ | ✓ |
216
+ | Go | 1 | ✓ | ✓ | ✓ | ✓ |
217
+ | Java | 1 | ✓ | ✓ | ✓ | ✓ |
218
+ | Rust | 1 | ✓ | ✓ | ✓ | ✓ |
219
+ | Ruby | 1 | ✓ | ✓ | ✓ | — |
220
+ | C# | 1 | ✓ | ✓ | ✓ | — |
221
+ | C | 2 | ✓ | ✓ | ✓ | — |
222
+ | C++ | 2 | ✓ | ✓ | ✓ | — |
223
+ | PHP | 2 | ✓ | ✓ | ✓ | — |
224
+ | Swift | 2 | ✓ | ✓ | ✓ | — |
225
+ | Kotlin | 2 | ✓ | ✓ | ✓ | — |
226
+ | Scala | 2 | | | | |
227
+ | Lua | 2 | ✓ | ✓ | ✓ | — |
228
+ | Dart | 2 | ✓ | ✓ | ✓ | — |
229
+ | Elixir | 2 | ✓ | ✓ | ✓ | — |
230
+ | Zig | 2 | ✓ | ✓ | ✓ | — |
231
+
232
+ **Tier 1** (8 languages): Full tree-sitter AST + dedicated extraction plugins + SCIP compiler-verified call graphs where available.
233
+ **Tier 2** (10 languages): Tree-sitter AST + generic extraction. Regex fallback for unsupported languages.
166
234
 
167
235
  ---
168
236
 
@@ -174,9 +242,10 @@ AI Agent (Claude Code / Cursor / VS Code / Windsurf / any MCP client)
174
242
  ├── MCP tools ──→ unerr ──→ CozoDB graph (in-process, <5ms)
175
243
  │ │
176
244
  │ ├── Convention engine (auto-detects patterns)
177
- │ ├── Session ledger (cross-session memory)
245
+ │ ├── Fact store (cross-session memory)
246
+ │ ├── Shadow ledger (mark-working / revert / timeline)
178
247
  │ ├── Token budgeter (prevents context rot)
179
- │ └── Compression engine (10 strategies, 645 classifiers)
248
+ │ └── Compression engine (11 strategies, 645+ classifiers)
180
249
 
181
250
  └── CLI hooks ──→ Output compression ──→ Graph-aware prioritization
182
251
  ```
@@ -185,24 +254,49 @@ One process. Fully local. No API keys. No network calls. No cloud.
185
254
 
186
255
  ---
187
256
 
188
- ## MCP Tools (17)
257
+ ## MCP Tools (20)
258
+
259
+ ### Graph Intelligence (15)
260
+
261
+ | Tool | What the agent gets |
262
+ |------|-----|
263
+ | `get_entity` | Any code entity (function, class, type) — signature, body, callers, callees, risk level |
264
+ | `get_file` | All entities defined in a file with risk summary |
265
+ | `get_references` | All callers (blast radius) or callees (dependencies) of an entity |
266
+ | `get_imports` | Import/dependency graph for a file |
267
+ | `search_code` | Graph-ranked full-text search across all indexed entities |
268
+ | `get_rules` | Active rules for a path — optionally validates code against them |
269
+ | `get_conventions` | Detected naming, structure, import conventions with adherence rates |
270
+ | `get_business_context` | Why code exists — purpose, taxonomy, feature area |
271
+ | `get_critical_nodes` | High fan-in/fan-out chokepoints (structural bottlenecks) |
272
+ | `get_cross_boundary_links` | Unexpected cross-module dependencies scored by surprise |
273
+ | `semantic_search` | Vector-based conceptual search (finds similar code with different names) |
274
+ | `find_similar` | Entities similar to a given entity by embedding distance |
275
+ | `get_project_stats` | Project-wide entity counts, risk distribution, health grade |
276
+ | `file_connections` | Connected files — imports, co-change correlations, structure |
277
+ | `get_test_coverage` | Direct and transitive test coverage for any entity |
278
+
279
+ ### File Protocol (2)
280
+
281
+ | Tool | What the agent gets |
282
+ |------|-----|
283
+ | `file_read` | Context-aware file reading — auto-injects conventions and facts |
284
+ | `file_outline` | File structure (functions, classes, exports) without reading content |
285
+
286
+ ### Persistent Intelligence (2)
287
+
288
+ | Tool | What the agent gets |
289
+ |------|-----|
290
+ | `record_fact` | Persist a convention, decision, or anti-pattern to the fact store |
291
+ | `recall_facts` | Retrieve stored facts with decay-adjusted confidence scoring |
292
+
293
+ ### Shadow Ledger (3)
189
294
 
190
295
  | Tool | What the agent gets |
191
296
  |------|-----|
192
- | `get_function` | Function body + callers + blast radius + applicable conventions |
193
- | `get_class` | Class with inheritance, methods, and dependents |
194
- | `get_file` | All entities, imports, exports, risk summary |
195
- | `get_callers` | Every caller with file location and risk level |
196
- | `get_callees` | All downstream dependencies |
197
- | `get_imports` | Import/dependency graph |
198
- | `search_code` | Graph-ranked full-text search |
199
- | `get_rules` | Active rules for a path |
200
- | `check_rules` | Evaluate rules — returns violations |
201
- | `get_conventions` | Naming, structure, import conventions |
202
- | `get_god_nodes` | High fan-in chokepoints |
203
- | `get_surprising_connections` | Unexpected cross-module dependencies |
204
- | `file_read` | Entity-targeted reads (not full file dumps) |
205
- | `file_outline` | File structure without content |
297
+ | `unerr_mark_working` | Snapshot current known-good state before risky changes |
298
+ | `unerr_revert_to_working_state` | Roll back to last working snapshot |
299
+ | `unerr_get_timeline` | View modification timeline across sessions |
206
300
 
207
301
  Every response includes `_meta` (latency, risk level, drift status) and contextual warnings.
208
302
 
@@ -216,6 +310,7 @@ unerr # Start MCP proxy (auto-started by IDE via MCP config)
216
310
  unerr status # Graph stats, health grade, active rules
217
311
  unerr stats # Session and weekly efficiency metrics
218
312
  unerr install <agent> # Add unerr to a specific AI coding agent
313
+ unerr uninstall # Remove unerr integration from agents
219
314
  unerr init # Initialize unerr in a new project
220
315
  unerr timeline # What happened across sessions
221
316
  unerr rewind # Restore to a previous working state
@@ -230,15 +325,19 @@ unerr debug # Diagnostic dump
230
325
 
231
326
  ```
232
327
  src/
233
- entrypoints/ CLI entry + state machine
234
- intelligence/ CozoDB graph, AST, conventions, rules, search
235
- proxy/ MCP server, compression, session stats, token tracking
328
+ entrypoints/ CLI entry + boot state machine
329
+ intelligence/ CozoDB graph, AST extraction, conventions, rules, search, semantic
330
+ proxy/ MCP server, shell compression, session stats, token tracking
236
331
  tracking/ Prompt ledger, drift detection, git attribution
237
- commands/ CLI commands
238
- tools/ MCP tool implementations
239
- behaviors/ Agent behavior modules (cascade guard, loop breaker)
240
- config/ Agent registry, MCP config writer
241
- schemas/ Zod schemas
332
+ behaviors/ Agent behavior modules (cascade guard, loop breaker, auto-doc, etc.)
333
+ commands/ CLI commands (install, status, stats, timeline, learn, debug, etc.)
334
+ tools/ MCP tool implementations (intelligence + coding)
335
+ hooks/ Claude Code hook system integration
336
+ skills/ Bundled skill definitions for agent installation
337
+ server/ HTTP dashboard API server
338
+ ui/ React (Vite) dashboard frontend
339
+ config/ Agent registry, MCP config writer, settings
340
+ schemas/ Zod schemas for entity/edge/rule types
242
341
  utils/ Logging, detection, git helpers
243
342
  ```
244
343
 
@@ -260,7 +359,7 @@ src/
260
359
  pnpm install
261
360
  pnpm run build # tsup → dist/ (ESM, node20)
262
361
  pnpm run dev # tsx watch
263
- pnpm run test:run # full suite (1455 tests)
362
+ pnpm run test:run # full suite
264
363
  pnpm run lint # biome check
265
364
  pnpm run typecheck # tsc --noEmit
266
365
  ```
@@ -295,7 +394,7 @@ See [CLAUDE.md](./CLAUDE.md) for detailed conventions.
295
394
  ---
296
395
 
297
396
  <p align="center">
298
- <code>npx @unerr/unerr</code>
397
+ <code>npm install -g @unerr-ai/unerr</code>
299
398
  <br /><br />
300
- <sub>One command. No cloud. No account. Free.</sub>
399
+ <a href="https://www.npmjs.com/package/@unerr-ai/unerr"><sub>npm registry</sub></a> · <sub>No cloud. No account. Free.</sub>
301
400
  </p>