@unerr-ai/unerr 0.0.1 → 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.
package/README.md CHANGED
@@ -106,65 +106,76 @@ The agent reads from the same store through MCP — every claim on the dashboard
106
106
 
107
107
  ## Quick Start
108
108
 
109
- > unerr is **per-repository**. Each project gets its own `.unerr/` directory, graph DB, and config. Run install once per repo.
110
-
111
- ### 1. Install the CLI globally
109
+ ### 1. Install globally
112
110
 
113
111
  ```bash
114
112
  npm install -g @unerr-ai/unerr
115
- # verify
116
- unerr --version
117
113
  ```
118
114
 
119
- ### 2. `cd` into the **root of the repository** you want to enhance
115
+ ### 2. Choose your mode
116
+
117
+ <table>
118
+ <tr>
119
+ <th width="50%">Standalone (single repo, simple)</th>
120
+ <th width="50%">Daemon Mode (multi-repo, recommended)</th>
121
+ </tr>
122
+ <tr>
123
+ <td>
120
124
 
121
125
  ```bash
122
- cd /path/to/your-project # must be the repo root (where .git or package.json lives)
126
+ cd ~/project
127
+ unerr install cursor # install MCP config + skills
128
+ unerr # start per-repo process
123
129
  ```
124
130
 
125
- This matters: every file unerr writes `.mcp.json`, `.claude/`, `.cursor/`, `.unerr/`, `.gitignore` entry — is scoped to the current working directory. Running install from a subdirectory will create a stray, broken setup.
126
-
127
- ### 3. Install unerr for your coding agent
131
+ One `unerr` process per repo. You start it manually. Good for single-project workflows.
128
132
 
129
- Pick the agent you actually use. Each command writes the MCP config, agent-specific skill files, instruction injection, and (where supported) hooks — all in the current repo:
133
+ </td>
134
+ <td>
130
135
 
131
136
  ```bash
132
- unerr install claude-code # .mcp.json + CLAUDE.md + .claude/skills/ + hooks
133
- unerr install cursor # → .cursor/mcp.json + .cursor/rules/ + hooks
134
- unerr install antigravity # .antigravity/mcp_config.json + .agents/rules/ + .agents/skills/
135
- unerr install windsurf # ~/.codeium/windsurf/mcp_config.json + .windsurf/rules/ + .windsurf/skills/
136
- unerr install gemini-cli # → .gemini/settings.json + GEMINI.md + .gemini/skills/
137
- unerr install github-copilot-cli # → .copilot/mcp-config.json + .github/copilot-instructions.md + .github/skills/
137
+ unerr daemon initialize # one-time: register at boot + start
138
+ cd ~/project
139
+ unerr install cursor # install config + register repo
140
+ # done IDE auto-connects via unerrd
138
141
  ```
139
142
 
140
- What it does:
143
+ A single `unerrd` supervisor manages all repos. Starts at login, spawns per-repo processes on demand, idles unused ones, unified dashboard at `localhost:9847`.
144
+
145
+ </td>
146
+ </tr>
147
+ </table>
141
148
 
142
- 1. Writes a project-level MCP config (`{"command": "unerr", "args": ["--mcp"]}`) never global.
143
- 2. Drops 11 bundled skills into the agent's skills directory so the agent knows when to call which tool.
144
- 3. Injects a tool-preference section into the agent's instruction file (CLAUDE.md, .cursor/rules, etc.) — idempotent, removable with `unerr uninstall`.
145
- 4. Installs hooks where the agent supports them (Claude Code, Cursor, Cline) — these compress shell output and steer the agent back to graph tools.
146
- 5. Adds `.unerr` to `.gitignore`.
147
- 6. For Claude Code, denies built-in `Read`/`Grep`/`Glob` so the agent must use unerr's graph-aware equivalents (opt out with `--no-force-tools`).
149
+ > **Important:** After running `unerr install`, restart your coding AI session (close and reopen the IDE or start a new chat) for unerr to take effect. The agent needs to pick up the newly installed MCP config, skills, and instructions.
148
150
 
149
- > Need a different agent or doing it by hand? `unerr install --show-instructions <agent>` prints copy-pasteable setup.
151
+ ### What each command does (no hidden behaviors)
150
152
 
151
- ### 4. Run `unerr` and **keep it running**
153
+ | Command | What it does | What it does NOT do |
154
+ |---------|------|------|
155
+ | `unerr daemon initialize` | Registers unerrd at boot (launchd/systemd/schtasks) + starts it | - |
156
+ | `unerr install <agent>` | MCP config + skills + hooks + instructions + gitignore. If unerrd running: registers the repo | Start unerrd, start per-repo process |
157
+ | `unerr --mcp` | Bridges to running process (standalone or daemon-managed) | Spawn unerrd, register repos, start processes |
158
+ | `unerr` (no args) | Starts a standalone per-repo proxy | Touch the daemon |
159
+
160
+ ### Supported agents
152
161
 
153
162
  ```bash
154
- unerr # first run: indexes the repo, starts the daemon; subsequent: resumes in <1s
163
+ unerr install claude-code # .mcp.json + CLAUDE.md + .claude/skills/ + hooks
164
+ unerr install cursor # → .cursor/mcp.json + .cursor/rules/ + hooks
165
+ unerr install antigravity # → .antigravity/mcp_config.json + .agents/rules/ + .agents/skills/
166
+ unerr install windsurf # → ~/.codeium/windsurf/mcp_config.json + .windsurf/rules/ + .windsurf/skills/
167
+ unerr install gemini-cli # → .gemini/settings.json + GEMINI.md + .gemini/skills/
168
+ unerr install github-copilot-cli # → .copilot/mcp-config.json + .github/copilot-instructions.md + .github/skills/
155
169
  ```
156
170
 
157
- **This is the part most people skip.** The `unerr --mcp` process your IDE spawns is just a **stdio bridge** it owns nothing. All the intelligence (graph indexing, file watching, drift detection, fact storage, behavior automation) lives in the long-lived `unerr` daemon.
158
-
159
- If the daemon isn't running, you still get tool responses, but they go stale: file edits won't show up in the graph, no incremental re-index, no live drift overlay, no convention auto-detection from new code. **Leave `unerr` running in a terminal tab or as a background service for the whole work session.** It uses ~80–200 MB and idles at near-zero CPU.
171
+ You can install multiple agents in the same repoeach writes its own config, the repo is registered once:
160
172
 
161
173
  ```bash
162
- # typical workflow
163
- unerr & # start daemon in background (or run in a tmux/screen pane)
164
- # now open Claude Code / Cursor / etc. — it auto-connects via MCP
174
+ unerr install cursor # registers repo (if daemon running), writes cursor config
175
+ unerr install claude-code # skips registration (already done), writes claude-code config
165
176
  ```
166
177
 
167
- After this, your agent connects automatically the next time you open the IDE. No config files to edit by hand.
178
+ > Need manual setup? `unerr install --show-instructions <agent>` prints copy-pasteable steps.
168
179
 
169
180
  <details>
170
181
  <summary>Manual MCP config (any MCP-compatible client)</summary>
@@ -182,6 +193,23 @@ After this, your agent connects automatically the next time you open the IDE. No
182
193
 
183
194
  </details>
184
195
 
196
+ <details>
197
+ <summary>What <code>unerr install</code> does (detailed)</summary>
198
+
199
+ | Step | What | File(s) written |
200
+ |------|------|------|
201
+ | MCP config | Agent-specific config pointing to `unerr --mcp` | `.mcp.json`, `.cursor/mcp.json`, etc. |
202
+ | Skills | 12 skill definitions teaching the agent when to use each tool | `.claude/skills/`, `.cursor/rules/`, etc. |
203
+ | Instructions | Tool-routing table injected into agent instruction file | `CLAUDE.md`, `.cursor/rules/unerr-instructions.mdc` |
204
+ | Hooks | Shell compression + tool-adoption nudging | `.claude/settings.json`, `.cursor/hooks.json` |
205
+ | Repo registration | If unerrd is running: registers repo with supervisor | Only when daemon is active |
206
+ | Gitignore | Ensures `.unerr/` isn't committed | `.gitignore` |
207
+ | Force tools | Claude Code only: denies built-in Read/Grep/Glob (opt out: `--no-force-tools`) | `.claude/settings.json` |
208
+
209
+ Idempotent — re-running updates if content changed, skips if identical. Remove with `unerr uninstall`.
210
+
211
+ </details>
212
+
185
213
  ---
186
214
 
187
215
  ## What changes the moment you connect
@@ -247,6 +275,33 @@ When `unerr` is running long-lived, these activate in the background:
247
275
 
248
276
  ---
249
277
 
278
+ ## How unerr compares
279
+
280
+ Adjacent tools each own one layer — graph navigation, persistent memory, or output compression. unerr integrates all three, plus the drift prevention that keeps the graph tools in active rotation. Peer strengths are real; the table credits them where they win.
281
+
282
+ | Capability | unerr | Graphify (~47K) | Serena (~23K) | claude-mem (~75K) | RTK (~40K) |
283
+ |---|:---:|:---:|:---:|:---:|:---:|
284
+ | **Code intelligence** | | | | | |
285
+ | Pre-hoc file-read intercept — resolves entity via graph, returns ~200 lines + conventions + blast radius instead of a 3,000-line file | ✓ | ✗ | Partial | ✗ | ✗ |
286
+ | Convention auto-detection — naming, structure, import direction from ≥70% adherence; no manual rules file | ✓ | ✗ | ✗ | ✗ | ✗ |
287
+ | Drift / staleness signals — `ur\|dft` fires when code moves under stored memory | ✓ | ✗ | ✗ | ✗ | ✗ |
288
+ | **Memory & continuity** | | | | | |
289
+ | Persistent across sessions — typed facts with per-type decay, contradiction handling | ✓ | ✗ | ✗ | ✓ | ✗ |
290
+ | Per-repo isolation — all state in `.unerr/` inside the repo, no cross-project leakage | ✓ | ✓ | ✓ | ✗ | — |
291
+ | **Runtime** | | | | | |
292
+ | Zero LLM in core — no API keys, no per-turn inference cost | ✓ | ✓ | ✓ | ✗ | ✓ |
293
+ | Keeps MCP tools in active rotation — without enforcement, agents revert to built-in Read/Grep/Glob within 3–5 turns | ✓ | ✗ | ✗ | ✗ | ✗ |
294
+
295
+ Three numbers behind the table:
296
+
297
+ - **~84%** of an AI coding agent's tokens are tool output, mostly file reads (JetBrains, NeurIPS 2025 DL4Code Workshop) — unerr intercepts before the read.
298
+ - **0** LLM calls per query in the Free tier — facts, conventions, and drift signals are algorithmic.
299
+ - **3–5** turns is how long agents take to revert to built-in Read/Grep/Glob without drift prevention.
300
+
301
+ Honest acknowledgements: unerr is the new entrant with fewer stars than every peer; the install is heavier than `brew install` (Node + index step); TypeScript is deepest, other languages run on tree-sitter; no semantic vector retrieval and no narrative session resume in the Free tier.
302
+
303
+ ---
304
+
250
305
  ## How it works
251
306
 
252
307
  ```
@@ -327,12 +382,31 @@ Every response includes `_meta` (latency, risk level, drift status) and inline `
327
382
  <summary><strong>CLI commands</strong></summary>
328
383
 
329
384
  ```bash
330
- unerr # Start the long-lived daemon (or resume; auto-spawned by IDE if missing)
385
+ unerr # Start per-repo daemon (or resume; auto-spawned by IDE if missing)
331
386
  unerr --mcp # Stdio bridge — what your IDE invokes via .mcp.json
332
387
  unerr install <agent> # Install MCP config + skills + instructions for one agent
333
388
  unerr uninstall # Remove unerr integration from agents in this repo
389
+ unerr status # Show proxy health, entity count, graph age
390
+ unerr stats # Session statistics (tokens, tool calls, compression)
391
+ ```
392
+
393
+ **Daemon supervisor** (multi-repo management):
394
+
395
+ ```bash
396
+ unerr daemon start # Start the unerrd supervisor
397
+ unerr daemon stop # Gracefully stop unerrd + all managed repos
398
+ unerr daemon status # Show all managed repos, PIDs, memory, idle time
399
+ unerr daemon add <path> # Register a repo (indexes on next access)
400
+ unerr daemon remove <path> # Unregister a repo
401
+ unerr daemon config <path> <k=v> # Set per-repo settings (idleTimeout, javaBuildTool, etc.)
402
+ unerr daemon autostart on|off|status # Manage start-at-login (launchd/systemd/schtasks)
403
+ unerr daemon logs [--repo <path>] [--follow] # Tail daemon/repo logs
404
+ unerr daemon dashboard # Open the unified dashboard in browser
405
+ unerr daemon update # Check for updates, install, restart
334
406
  ```
335
407
 
408
+ See the [full command reference](#daemon-command-reference) below.
409
+
336
410
  </details>
337
411
 
338
412
  <details>
@@ -399,6 +473,112 @@ See [CLAUDE.md](./CLAUDE.md) for full conventions.
399
473
 
400
474
  ---
401
475
 
476
+ ## Daemon Command Reference
477
+
478
+ The `unerrd` supervisor is a single lightweight process that manages all your registered repositories. It replaces the need to run `unerr` separately in each repo.
479
+
480
+ ### Lifecycle
481
+
482
+ ```bash
483
+ unerr daemon start # Start supervisor (PID-locked, one instance per machine)
484
+ unerr daemon stop # Graceful shutdown — stops all child processes, flushes state
485
+ unerr daemon status # Overview: all repos, their state (running/stopped/idle), PIDs,
486
+ # memory usage, connection count, idle time, update notices
487
+ ```
488
+
489
+ ### Repository Management
490
+
491
+ ```bash
492
+ unerr daemon add <path> # Register a repo with the supervisor
493
+ # - Auto-derives a unique label from the directory name
494
+ # - Mirrors settings to <repo>/.unerr/config.json
495
+ # - Detects parent/child directory conflicts
496
+ # - Installs platform auto-start on first add
497
+
498
+ unerr daemon remove <path> # Unregister — stops the child process if running, removes entry
499
+
500
+ unerr daemon config <path> <key>=<value> # Set per-repo settings:
501
+ # idleTimeout=600 seconds before idle sweep stops the repo
502
+ # javaBuildTool=gradle skip detection heuristic
503
+ # autostart=false exclude from warm-start at boot
504
+ ```
505
+
506
+ ### Auto-Start (Start at Login)
507
+
508
+ ```bash
509
+ unerr daemon autostart on # Install platform service:
510
+ # macOS: ~/Library/LaunchAgents/dev.unerr.daemon.plist
511
+ # Linux: ~/.config/systemd/user/unerr-daemon.service
512
+ # Windows: schtasks /create ... (or Startup folder .cmd)
513
+
514
+ unerr daemon autostart off # Remove the platform service
515
+ unerr daemon autostart status # Show whether auto-start is installed and running
516
+ ```
517
+
518
+ Auto-start is also installed automatically on your first `unerr install` or `daemon add` — no manual step needed. Skipped in CI/container environments.
519
+
520
+ ### Warm Start
521
+
522
+ After boot, the supervisor pre-spawns your Most Recently Used repos at low priority:
523
+
524
+ ```bash
525
+ unerr daemon set --warm-start-budget 3 # Max repos to warm-start (default: 3)
526
+ unerr daemon set --warm-start-idle-days 7 # Skip repos inactive for >N days
527
+ unerr daemon set --warm-start-delay-ms 5000 # Delay before warm-start begins
528
+ ```
529
+
530
+ Warm-start aborts if the system is on battery or under high load.
531
+
532
+ ### Logs
533
+
534
+ ```bash
535
+ unerr daemon logs # Tail the supervisor log (~/.unerr/logs/unerrd.log)
536
+ unerr daemon logs --repo <path> # Tail a specific repo's log
537
+ unerr daemon logs --bridge # Tail bridge session logs
538
+ unerr daemon logs --follow # Stream continuously (like tail -f)
539
+ unerr daemon logs -n 50 # Last N lines
540
+ unerr daemon logs --boot # Show only the most recent boot sequence
541
+ ```
542
+
543
+ ### Dashboard
544
+
545
+ ```bash
546
+ unerr daemon dashboard # Opens http://localhost:9847 in your default browser
547
+ ```
548
+
549
+ The unified dashboard shows:
550
+ - **Global overview** — all registered repos, their health, active sessions
551
+ - **Repo switcher** — click into any repo for its full intelligence dashboard
552
+ - **Supervisor info** — uptime, memory, warm-start events, version status
553
+
554
+ ### Updates
555
+
556
+ ```bash
557
+ unerr daemon update # Check npm registry → confirm → stop → install → restart → verify
558
+ unerr daemon dismiss-update <version> # Suppress notification for a specific version
559
+ ```
560
+
561
+ Update notifications appear as:
562
+ - A CLI banner on `unerr daemon status` and `unerr` startup
563
+ - A dashboard banner with version diff and changelog link
564
+ - An `_meta["dev.unerr/update_available"]` field in MCP responses (when >2 minor versions behind)
565
+
566
+ Updates are never auto-applied — the agent and supervisor remain stable mid-session.
567
+
568
+ ### How auto-spawn works
569
+
570
+ When your IDE opens and spawns `unerr --mcp`:
571
+
572
+ 1. Bridge checks for a per-repo UDS socket (`.unerr/state/proxy.sock`)
573
+ 2. If not found, queries the supervisor's UDS socket (`~/.unerr/state/unerrd.sock`)
574
+ 3. If supervisor isn't running, auto-spawns it as a detached background process
575
+ 4. Supervisor ensures the repo is registered and its child process is running
576
+ 5. Bridge connects — MCP requests flow through
577
+
578
+ Total cold-start latency (supervisor not running → first MCP response): **<2 seconds**.
579
+
580
+ ---
581
+
402
582
  ## License
403
583
 
404
584
  [Elastic License 2.0 (ELv2)](./LICENSE) — free to use, modify, and distribute. Cannot be offered as a hosted service.