@echomem/mcp 1.4.8 → 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 (36) hide show
  1. package/README.md +23 -3
  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/dist/city/chaos-to-clarity-pencil.html +582 -0
  8. package/dist/city/echo-ai-city-only.html +1104 -105
  9. package/dist/city/echo-ai-city-only.template.html +1104 -105
  10. package/dist/city/pencil-pie-generator.html +883 -0
  11. package/dist/city/pencil-webgl-landscape.html +1239 -0
  12. package/dist/city/spatial-fan-story.html +479 -0
  13. package/dist/codex-session-files.js +283 -0
  14. package/dist/codex-sync.js +7 -2
  15. package/dist/context-analysis/canonical-golden.js +47 -0
  16. package/dist/context-analysis/claude-native-canonical.js +1193 -0
  17. package/dist/context-analysis/vendored-canonical.js +793 -0
  18. package/dist/context-analysis/workspace-report.js +1838 -0
  19. package/dist/context-metrics/calculate.js +56 -0
  20. package/dist/context-metrics/model-limits.js +26 -0
  21. package/dist/context-metrics/types.js +1 -0
  22. package/dist/forensics-10-problems.js +7 -6
  23. package/dist/forensics.js +863 -132
  24. package/dist/hud/adapters.js +8 -4
  25. package/dist/hud/metric.js +13 -4
  26. package/dist/hud/monitor.js +135 -16
  27. package/dist/hud/web.js +344 -298
  28. package/dist/index.js +7 -3
  29. package/dist/local-data-paths.js +87 -0
  30. package/dist/migrate.js +37 -29
  31. package/dist/report.js +101 -40
  32. package/dist/setup-page.js +3290 -196
  33. package/dist/setup-preview.js +245 -0
  34. package/dist/setup.js +432 -34
  35. package/package.json +5 -4
  36. package/templates/echomem-recall.md +2 -2
package/README.md CHANGED
@@ -40,8 +40,11 @@ legacy EchoMem-synthesized recall answer.
40
40
  npm i -g @echomem/mcp@latest && echomem-mcp init
41
41
  ```
42
42
 
43
- A global install (not `npx`) is recommended because the context HUD's launch-at-login runs from the
44
- installed path. `init` is the flagship one-liner it wraps `setup --all --with-hud`: it writes each
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
45
48
  installed agent's MCP config (with **no secret** in it — credentials live in
46
49
  `~/.echomem/credentials.json`, mode 0600), adds the EchoMem memory guidance to their global
47
50
  `AGENTS.md` / `CLAUDE.md`, opens the browser to approve the device (and unlock the vault for
@@ -96,6 +99,23 @@ because exact context composition and provider eviction are not observable.
96
99
  MCP fallback: agents can call `echo_context_health` to get the same score as markdown in-chat. This
97
100
  is on-demand; the passive HUD remains a separate local process.
98
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
+
99
119
  ### Manual / headless (SSH, containers, CI)
100
120
 
101
121
  No browser? Provide secrets directly — this is the documented headless path:
@@ -124,7 +144,7 @@ npm test # crypto compat + encrypted-local integration tests
124
144
 
125
145
  ### Add to your IDE (Cursor or Windsurf)
126
146
 
127
- > 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
128
148
  > the client config. The manual steps below are the fallback.
129
149
 
130
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.