@echomem/mcp 1.4.7 → 1.4.9

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.
Files changed (46) hide show
  1. package/README.md +35 -9
  2. package/assets/canonical-scorer/README.md +18 -0
  3. package/assets/canonical-scorer/analyze-10-problems.mjs +857 -0
  4. package/assets/canonical-scorer/build-session-waste-dashboard.mjs +1628 -0
  5. package/assets/canonical-scorer/golden_anchors.mjs +83 -0
  6. package/assets/canonical-scorer/optimizable_detail.mjs +633 -0
  7. package/assets/hud/claude.svg +1 -0
  8. package/assets/hud/codex.svg +1 -0
  9. package/assets/hud/session-viewer.html +35 -0
  10. package/dist/city/chaos-to-clarity-pencil.html +582 -0
  11. package/dist/city/echo-ai-city-only.html +1126 -109
  12. package/dist/city/echo-ai-city-only.template.html +1126 -109
  13. package/dist/city/echo-face-cutout.png +0 -0
  14. package/dist/city/pencil-pie-generator.html +883 -0
  15. package/dist/city/pencil-webgl-landscape.html +1239 -0
  16. package/dist/city/spatial-fan-story.html +479 -0
  17. package/dist/codex-session-files.js +283 -0
  18. package/dist/codex-sync.js +7 -2
  19. package/dist/context-analysis/canonical-golden.js +47 -0
  20. package/dist/context-analysis/claude-native-canonical.js +1193 -0
  21. package/dist/context-analysis/vendored-canonical.js +793 -0
  22. package/dist/context-analysis/workspace-report.js +1838 -0
  23. package/dist/context-metrics/calculate.js +56 -0
  24. package/dist/context-metrics/model-limits.js +26 -0
  25. package/dist/context-metrics/types.js +1 -0
  26. package/dist/forensics-10-problems.js +7 -6
  27. package/dist/forensics.js +863 -132
  28. package/dist/hud/adapters.js +8 -4
  29. package/dist/hud/autostart.js +66 -0
  30. package/dist/hud/cli.js +31 -0
  31. package/dist/hud/electron-main.js +182 -19
  32. package/dist/hud/metric.js +13 -4
  33. package/dist/hud/monitor.js +171 -84
  34. package/dist/hud/preload.cjs +3 -0
  35. package/dist/hud/server.js +321 -4
  36. package/dist/hud/web.js +880 -270
  37. package/dist/index.js +122 -24
  38. package/dist/local-data-paths.js +87 -0
  39. package/dist/migrate.js +55 -29
  40. package/dist/report.js +101 -40
  41. package/dist/setup-page.js +4257 -245
  42. package/dist/setup-preview.js +245 -0
  43. package/dist/setup.js +786 -75
  44. package/dist/v1-contract.js +20 -2
  45. package/package.json +6 -4
  46. package/templates/echomem-recall.md +2 -2
package/README.md CHANGED
@@ -35,19 +35,28 @@ legacy EchoMem-synthesized recall answer.
35
35
  ## Quick start (recommended)
36
36
 
37
37
  ```bash
38
- # One command: install the CLI, detect your editor, write MCP config, log in via the browser.
39
- npm i -g @echomem/mcp@latest && echomem-mcp setup
38
+ # One command, everything: download the bridge + HUD, configure every coding agent you have
39
+ # installed (Codex, Claude Code, Claude Desktop, Cursor, Windsurf…), log in, and launch the HUD.
40
+ npm i -g @echomem/mcp@latest && echomem-mcp init
40
41
  ```
41
42
 
42
- This keeps `echomem-mcp` available for later commands like `status`, `update`, `unlock`, and
43
- playground setup. `setup` detects the client (Cursor / Windsurf / Claude Desktop), writes its MCP
44
- config (with **no secret** in it credentials live in `~/.echomem/credentials.json`, mode 0600),
45
- then opens the browser to approve the device and, for encrypted accounts, unlock the vault. Reload
46
- your editor and you're done.
43
+ A global install (not `npx`) is recommended because it wires each editor to a **stable** path: a bare
44
+ `npx` run resolves the bridge into a throwaway `_npx/<hash>` cache dir that npm later garbage-collects,
45
+ which would break the MCP server after the fact (`setup` now refuses to pin such a path and falls back
46
+ to the global install, but installing globally avoids the issue entirely). The context HUD's
47
+ launch-at-login also runs from the installed path. `init` is the flagship one-liner — it wraps `setup --all --with-hud`: it writes each
48
+ installed agent's MCP config (with **no secret** in it — credentials live in
49
+ `~/.echomem/credentials.json`, mode 0600), adds the EchoMem memory guidance to their global
50
+ `AGENTS.md` / `CLAUDE.md`, opens the browser to approve the device (and unlock the vault for
51
+ encrypted accounts), then launches the context HUD. Reload your editors and you're done.
52
+
53
+ Prefer to keep it minimal? `echomem-mcp setup` configures only the auto-detected editor and skips the
54
+ HUD; the granular commands below still work.
47
55
 
48
56
  | Command | What it does |
49
57
  |---|---|
50
- | `npm i -g @echomem/mcp@latest && echomem-mcp setup` | Install the CLI globally and run setup in one explicit step |
58
+ | `npm i -g @echomem/mcp@latest && echomem-mcp init` | **Everything in one command** all installed agents + HUD + login |
59
+ | `npm i -g @echomem/mcp@latest && echomem-mcp setup` | Install the CLI globally and configure just the detected editor |
51
60
  | `npx -y @echomem/mcp@latest setup` | One-off setup without keeping a global CLI command |
52
61
  | `echomem-mcp setup [--client cursor\|windsurf\|claude-desktop\|claude-code\|codex]` | Write client config + log in |
53
62
  | `echomem-mcp setup --skip-login [--client cursor\|windsurf\|claude-desktop\|claude-code\|codex]` | Write client config without opening the browser or changing credentials |
@@ -90,6 +99,23 @@ because exact context composition and provider eviction are not observable.
90
99
  MCP fallback: agents can call `echo_context_health` to get the same score as markdown in-chat. This
91
100
  is on-demand; the passive HUD remains a separate local process.
92
101
 
102
+ ## Agent Doctor — local workspace forensics (new in 1.4.9)
103
+
104
+ `echomem-mcp init` / `setup` now ends with an **Agent Doctor report**: a local scan of your
105
+ Codex and Claude Code session logs that shows what your AI coding actually cost and where the
106
+ context went dirty — rendered as an interactive 3D "repo city" plus a full forensic breakdown.
107
+
108
+ - **Unified cost ledger.** Every provider request is priced individually from official API list
109
+ rates (model, cache write/read, long-context premiums, intro-pricing windows), so the headline
110
+ TOTAL SPENT, per-repo costs, per-model costs, and cost components all come from one path and
111
+ reconcile exactly. It is an **API-equivalent estimate of volume, not a bill you paid**.
112
+ - **Fail-closed validation.** The report refuses to render unless every ledger reconciles
113
+ (tokens, costs, canonical waste analysis). Stale or preview data can never appear as your data.
114
+ - **Wasteful-context analysis.** Canonical context windows label input tokens useful vs wasteful
115
+ (re-reads of unchanged files, re-finding, dead work) and project the waste over your billed input.
116
+ - **Fully local, zero upload.** The scan reads local JSONL logs only: no transcripts are uploaded
117
+ and no LLM calls are made to build the report.
118
+
93
119
  ### Manual / headless (SSH, containers, CI)
94
120
 
95
121
  No browser? Provide secrets directly — this is the documented headless path:
@@ -118,7 +144,7 @@ npm test # crypto compat + encrypted-local integration tests
118
144
 
119
145
  ### Add to your IDE (Cursor or Windsurf)
120
146
 
121
- > Prefer `npm i -g @echomem/mcp@latest && echomem-mcp setup` above — it writes these files for you and keeps secrets out of
147
+ > Prefer `npm i -g @echomem/mcp@latest && echomem-mcp init` above — it writes these files for you and keeps secrets out of
122
148
  > the client config. The manual steps below are the fallback.
123
149
 
124
150
  #### For Cursor
@@ -0,0 +1,18 @@
1
+ # Vendored Context Golden Standard
2
+
3
+ Copied from `/Users/erikhein/Desktop/Programming/iditor/context-golden-standard` on 2026-07-09:
4
+
5
+ - `ErikMachine-Context_Golden_Standard/tools/golden_anchors.mjs`
6
+ - `ErikMachine-Context_Golden_Standard/tools/optimizable_detail.mjs`
7
+ - `tools/analyze-10-problems.mjs`
8
+ - `tools/build-session-waste-dashboard.mjs`
9
+
10
+ The scoring and allocation rules are unchanged. Local adaptations are limited
11
+ to runner boundaries: `GOLDEN_JSON_ONLY=1` skips HTML/SVG rendering when the MCP
12
+ setup scan needs JSON data only. Claude Code does not run through these vendored
13
+ scripts; it uses a native JSONL/requestId/toolUseResult ledger in
14
+ `src/context-analysis/claude-native-canonical.ts` and is merged with the Codex
15
+ report at the workspace-report boundary.
16
+
17
+ `src/context-analysis/vendored-canonical.ts` runs these files and adapts their
18
+ JSON output to the setup-page report contract.