@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.
- package/README.md +23 -3
- package/assets/canonical-scorer/README.md +18 -0
- package/assets/canonical-scorer/analyze-10-problems.mjs +857 -0
- package/assets/canonical-scorer/build-session-waste-dashboard.mjs +1628 -0
- package/assets/canonical-scorer/golden_anchors.mjs +83 -0
- package/assets/canonical-scorer/optimizable_detail.mjs +633 -0
- package/dist/city/chaos-to-clarity-pencil.html +582 -0
- package/dist/city/echo-ai-city-only.html +1104 -105
- package/dist/city/echo-ai-city-only.template.html +1104 -105
- package/dist/city/pencil-pie-generator.html +883 -0
- package/dist/city/pencil-webgl-landscape.html +1239 -0
- package/dist/city/spatial-fan-story.html +479 -0
- package/dist/codex-session-files.js +283 -0
- package/dist/codex-sync.js +7 -2
- package/dist/context-analysis/canonical-golden.js +47 -0
- package/dist/context-analysis/claude-native-canonical.js +1193 -0
- package/dist/context-analysis/vendored-canonical.js +793 -0
- package/dist/context-analysis/workspace-report.js +1838 -0
- package/dist/context-metrics/calculate.js +56 -0
- package/dist/context-metrics/model-limits.js +26 -0
- package/dist/context-metrics/types.js +1 -0
- package/dist/forensics-10-problems.js +7 -6
- package/dist/forensics.js +863 -132
- package/dist/hud/adapters.js +8 -4
- package/dist/hud/metric.js +13 -4
- package/dist/hud/monitor.js +135 -16
- package/dist/hud/web.js +344 -298
- package/dist/index.js +7 -3
- package/dist/local-data-paths.js +87 -0
- package/dist/migrate.js +37 -29
- package/dist/report.js +101 -40
- package/dist/setup-page.js +3290 -196
- package/dist/setup-preview.js +245 -0
- package/dist/setup.js +432 -34
- package/package.json +5 -4
- package/templates/echomem-recall.md +2 -2
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
export const SETUP_PREVIEW_STATES = [
|
|
2
|
+
"report",
|
|
3
|
+
"extract-counting",
|
|
4
|
+
"extract-ready",
|
|
5
|
+
"extract-run",
|
|
6
|
+
"extract-overdue",
|
|
7
|
+
"extract-done",
|
|
8
|
+
"extract-ending",
|
|
9
|
+
"extract-skipped",
|
|
10
|
+
];
|
|
11
|
+
export function parseSetupPreviewState(value) {
|
|
12
|
+
return SETUP_PREVIEW_STATES.includes(value) ? value : null;
|
|
13
|
+
}
|
|
14
|
+
const previewReport = {
|
|
15
|
+
schemaVersion: 1,
|
|
16
|
+
dataOrigin: "design-preview",
|
|
17
|
+
generatedFrom: [],
|
|
18
|
+
llmCallsUsed: 0,
|
|
19
|
+
transcriptsUploaded: false,
|
|
20
|
+
scanStartDate: "2026-05-01",
|
|
21
|
+
scanEndDate: "2026-07-09",
|
|
22
|
+
firstSession: {
|
|
23
|
+
date: "2026-05-01T16:14:00.000Z",
|
|
24
|
+
source: "codex",
|
|
25
|
+
repo: "Preview Workspace",
|
|
26
|
+
},
|
|
27
|
+
activeSessionCoverage: { codex: 82, claudeCode: 54, total: 136 },
|
|
28
|
+
scale: {
|
|
29
|
+
sessionCount: 136,
|
|
30
|
+
repoCount: 4,
|
|
31
|
+
totalTokens: 140_400_000,
|
|
32
|
+
totalInputTokens: 138_000_000,
|
|
33
|
+
totalCommits: 312,
|
|
34
|
+
},
|
|
35
|
+
cost: { total: 428, byModel: { "preview-model": { total: 140_400_000, cost: 428 } } },
|
|
36
|
+
modelUsage: { topModel: "preview-model", topModelShare: 62, identityLabel: "Design preview" },
|
|
37
|
+
userWorkingHours: { userAttentionHours: 184.5, averageDailyAttentionHours: 3.8 },
|
|
38
|
+
rhythm: { lateNightShare: 18, hourHistogram: [0, 0, 0, 0, 0, 0, 1, 2, 5, 8, 10, 11, 9, 8, 7, 8, 10, 12, 11, 8, 5, 3, 1, 0] },
|
|
39
|
+
cleanliness: { staleReadSharePct: 42 },
|
|
40
|
+
contextWindow: { sampleCount: 0, metrics: {} },
|
|
41
|
+
rereadForensics: {
|
|
42
|
+
topFiles: [
|
|
43
|
+
{ file: "src/preview-alpha.ts", repo: "Preview Workspace", totalReads: 37, sessionsTouched: 12, daysTouched: 9, everChanged: true },
|
|
44
|
+
{ file: "src/preview-beta.ts", repo: "Sample Service", totalReads: 21, sessionsTouched: 7, daysTouched: 5, everChanged: true },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
avoidableWait: {},
|
|
48
|
+
counterfactual: { targetScore: 86, daysGained: 20.3, counterfactualDate: "2026-06-19" },
|
|
49
|
+
repos: [
|
|
50
|
+
{ name: "Preview Workspace", sessions: 62, tokens: 78_000_000, totalTokens: 78_000_000, attentionHours: 72, assistantMessages: 740 },
|
|
51
|
+
{ name: "Sample Service", sessions: 31, tokens: 41_000_000, totalTokens: 41_000_000, attentionHours: 39, assistantMessages: 360 },
|
|
52
|
+
{ name: "Example CLI", sessions: 27, tokens: 12_000_000, totalTokens: 12_000_000, attentionHours: 28, assistantMessages: 250 },
|
|
53
|
+
{ name: "Demo Library", sessions: 16, tokens: 7_000_000, totalTokens: 7_000_000, attentionHours: 22, assistantMessages: 180 },
|
|
54
|
+
],
|
|
55
|
+
canonicalGoldenStandard: {
|
|
56
|
+
summary: {
|
|
57
|
+
sessionsAnalyzed: 136,
|
|
58
|
+
reposAnalyzed: 4,
|
|
59
|
+
turnsAnalyzed: 1_840,
|
|
60
|
+
officialInputTokens: 18_400_000,
|
|
61
|
+
usefulTokens: 10_672_000,
|
|
62
|
+
wasteTokens: 7_728_000,
|
|
63
|
+
usefulPct: 58,
|
|
64
|
+
wastePct: 42,
|
|
65
|
+
attributedWasteTokens: 7_140_000,
|
|
66
|
+
unattributedWasteTokens: 588_000,
|
|
67
|
+
},
|
|
68
|
+
diagnostics: { skippedSessions: 0 },
|
|
69
|
+
buckets: { duplicate: 1_280_000, refind: 1_750_000, dead: 4_110_000, unattributed: 588_000 },
|
|
70
|
+
problems: [
|
|
71
|
+
{
|
|
72
|
+
id: "P13",
|
|
73
|
+
label: "Agent's Reasoning Notes",
|
|
74
|
+
bucket: "dead",
|
|
75
|
+
category: "Context Hygiene",
|
|
76
|
+
count: 96,
|
|
77
|
+
sessions: 32,
|
|
78
|
+
allocatedWasteTokens: 2_180_000,
|
|
79
|
+
examples: [{
|
|
80
|
+
repo: "Preview Workspace",
|
|
81
|
+
session: "preview-session-1",
|
|
82
|
+
agentSource: "codex",
|
|
83
|
+
turn: 30,
|
|
84
|
+
sessionTitle: "Preview context report",
|
|
85
|
+
sessionOrdinal: 82,
|
|
86
|
+
sourceSessionCount: 82,
|
|
87
|
+
sessionTurns: 41,
|
|
88
|
+
timestampMs: Date.UTC(2026, 6, 6),
|
|
89
|
+
tokens: 82_000,
|
|
90
|
+
turnInputTokens: 212_400,
|
|
91
|
+
turnUsefulTokens: 61_000,
|
|
92
|
+
turnWasteTokens: 151_400,
|
|
93
|
+
prompt: "Preview prompt. This is not local user data.",
|
|
94
|
+
evidence: "Preview evidence used only in an explicitly authorized design state.",
|
|
95
|
+
}],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "P01",
|
|
99
|
+
label: "Outdated Images & Screenshots",
|
|
100
|
+
bucket: "dead",
|
|
101
|
+
category: "Runtime Bug",
|
|
102
|
+
count: 70,
|
|
103
|
+
sessions: 18,
|
|
104
|
+
allocatedWasteTokens: 1_930_000,
|
|
105
|
+
examples: [{
|
|
106
|
+
repo: "Sample Service",
|
|
107
|
+
session: "preview-session-2",
|
|
108
|
+
agentSource: "codex",
|
|
109
|
+
turn: 67,
|
|
110
|
+
sessionTitle: "Preview visual verification",
|
|
111
|
+
sessionOrdinal: 79,
|
|
112
|
+
sourceSessionCount: 82,
|
|
113
|
+
sessionTurns: 88,
|
|
114
|
+
timestampMs: Date.UTC(2026, 6, 3),
|
|
115
|
+
tokens: 118_000,
|
|
116
|
+
turnInputTokens: 224_300,
|
|
117
|
+
turnUsefulTokens: 52_300,
|
|
118
|
+
turnWasteTokens: 172_000,
|
|
119
|
+
prompt: "Preview prompt. This is not local user data.",
|
|
120
|
+
evidence: "Preview evidence used only in an explicitly authorized design state.",
|
|
121
|
+
}],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "P12",
|
|
125
|
+
label: "Tool Call Logs",
|
|
126
|
+
bucket: "refind",
|
|
127
|
+
category: "Structural Accumulation",
|
|
128
|
+
count: 428,
|
|
129
|
+
sessions: 41,
|
|
130
|
+
allocatedWasteTokens: 1_750_000,
|
|
131
|
+
examples: [{
|
|
132
|
+
repo: "Example CLI",
|
|
133
|
+
session: "preview-session-3",
|
|
134
|
+
agentSource: "claude-code",
|
|
135
|
+
turn: 44,
|
|
136
|
+
sessionTitle: "Preview build repair",
|
|
137
|
+
sessionOrdinal: 51,
|
|
138
|
+
sourceSessionCount: 54,
|
|
139
|
+
sessionTurns: 63,
|
|
140
|
+
timestampMs: Date.UTC(2026, 6, 7),
|
|
141
|
+
tokens: 96_000,
|
|
142
|
+
turnInputTokens: 198_600,
|
|
143
|
+
turnUsefulTokens: 74_700,
|
|
144
|
+
turnWasteTokens: 123_900,
|
|
145
|
+
prompt: "Preview prompt. This is not local user data.",
|
|
146
|
+
command: "npm run build",
|
|
147
|
+
evidence: "Preview evidence used only in an explicitly authorized design state.",
|
|
148
|
+
}],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "P07",
|
|
152
|
+
label: "Failed Turn Leftovers",
|
|
153
|
+
bucket: "dead",
|
|
154
|
+
category: "Model Behavior",
|
|
155
|
+
count: 54,
|
|
156
|
+
sessions: 27,
|
|
157
|
+
allocatedWasteTokens: 1_280_000,
|
|
158
|
+
examples: [{
|
|
159
|
+
repo: "Demo Library",
|
|
160
|
+
session: "preview-session-4",
|
|
161
|
+
agentSource: "codex",
|
|
162
|
+
turn: 23,
|
|
163
|
+
sessionTitle: "Preview onboarding flow",
|
|
164
|
+
sessionOrdinal: 74,
|
|
165
|
+
sourceSessionCount: 82,
|
|
166
|
+
sessionTurns: 35,
|
|
167
|
+
timestampMs: Date.UTC(2026, 5, 30),
|
|
168
|
+
tokens: 74_000,
|
|
169
|
+
turnInputTokens: 176_800,
|
|
170
|
+
turnUsefulTokens: 68_900,
|
|
171
|
+
turnWasteTokens: 107_900,
|
|
172
|
+
prompt: "Preview prompt. This is not local user data.",
|
|
173
|
+
evidence: "Preview evidence used only in an explicitly authorized design state.",
|
|
174
|
+
}],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
billedWasteProjection: {
|
|
179
|
+
method: "canonical-window-share-over-provider-input",
|
|
180
|
+
billedInputTokens: 138_000_000,
|
|
181
|
+
canonicalInputTokens: 18_400_000,
|
|
182
|
+
canonicalUsefulTokens: 10_672_000,
|
|
183
|
+
canonicalWasteTokens: 7_728_000,
|
|
184
|
+
billingMultiplier: 7.5,
|
|
185
|
+
projectedUsefulTokens: 80_040_000,
|
|
186
|
+
projectedWasteTokens: 57_960_000,
|
|
187
|
+
usefulPct: 58,
|
|
188
|
+
wastePct: 42,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
function previewWatermarkScript() {
|
|
192
|
+
return `
|
|
193
|
+
document.body.setAttribute("data-preview", "true");
|
|
194
|
+
var previewWatermark = document.createElement("div");
|
|
195
|
+
previewWatermark.setAttribute("role", "status");
|
|
196
|
+
previewWatermark.textContent = "DESIGN PREVIEW · SAMPLE DATA · NOT YOUR LOCAL REPORT";
|
|
197
|
+
previewWatermark.style.cssText = "position:fixed;z-index:99999;left:50%;top:10px;transform:translateX(-50%);padding:7px 12px;border:1px solid #8b2c26;border-radius:999px;background:#fff4e8;color:#8b2c26;font:700 11px/1.2 ui-monospace,monospace;letter-spacing:.05em;box-shadow:0 4px 16px rgba(0,0,0,.12)";
|
|
198
|
+
document.body.appendChild(previewWatermark);
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
export function renderSetupPreviewBootstrap(state) {
|
|
202
|
+
const watermark = previewWatermarkScript();
|
|
203
|
+
if (state === "report") {
|
|
204
|
+
const reportJson = JSON.stringify(previewReport);
|
|
205
|
+
return `${watermark}
|
|
206
|
+
report = ${reportJson};
|
|
207
|
+
reportEnvelope = { schemaVersion: 1, kind: "ready", mode: "preview", scanId: "design-preview", report: report };
|
|
208
|
+
renderForensicReport();`;
|
|
209
|
+
}
|
|
210
|
+
if (state === "extract-counting") {
|
|
211
|
+
return `${watermark}
|
|
212
|
+
stats = null;
|
|
213
|
+
renderDashboard();`;
|
|
214
|
+
}
|
|
215
|
+
if (state === "extract-ready") {
|
|
216
|
+
return `${watermark}
|
|
217
|
+
stats = {
|
|
218
|
+
sessions: { total: 136, codex: 82, claudeCode: 54 },
|
|
219
|
+
migratable: {
|
|
220
|
+
pending: 28, pendingTotal: 28, pendingCodex: 19, pendingClaudeCode: 9,
|
|
221
|
+
alreadyMigrated: 108, skippedActive: 0,
|
|
222
|
+
eta: { estimatedLabel: "under 2 minutes" }, estimatedLabel: "under 2 minutes"
|
|
223
|
+
},
|
|
224
|
+
discovery: { phase: "account", exact: false }
|
|
225
|
+
};
|
|
226
|
+
renderDashboard();`;
|
|
227
|
+
}
|
|
228
|
+
if (state === "extract-run") {
|
|
229
|
+
return `${watermark}
|
|
230
|
+
renderProgress({ status: "running", total: 28, completed: 4, extracted: 19, failed: 1, latest: "preview session", latestRepo: "Preview Workspace" });`;
|
|
231
|
+
}
|
|
232
|
+
if (state === "extract-overdue") {
|
|
233
|
+
return `${watermark}
|
|
234
|
+
exStartAt = Date.now() - 200000;
|
|
235
|
+
exDeadline = Date.now() - 1000;
|
|
236
|
+
renderProgress({ status: "running", total: 28, completed: 21, extracted: 96, failed: 2, latest: "preview session", latestRepo: "Sample Service" });`;
|
|
237
|
+
}
|
|
238
|
+
if (state === "extract-done") {
|
|
239
|
+
return `${watermark}
|
|
240
|
+
renderProgress({ status: "completed", total: 28, completed: 28, extracted: 128, failed: 0 });`;
|
|
241
|
+
}
|
|
242
|
+
if (state === "extract-ending")
|
|
243
|
+
return `${watermark}\n renderEnding();`;
|
|
244
|
+
return `${watermark}\n renderSkipped();`;
|
|
245
|
+
}
|