@memnexus-ai/mx-agent-cli 0.1.287 → 0.1.289

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.
@@ -190,7 +190,27 @@ const SHIM_MAX_BYTES = 600;
190
190
  * first pass, superseded here, was
191
191
  * `459504baeba360f5761d4a33fec91ef11a84d619b99ff211be914d635f6a8453`.
192
192
  */
193
- const CANONICAL_SHA256 = 'e699c31cdf19d94405a2d561d943c635b8d9f35a3af8bbe82e30e6e71d4fbebe';
193
+ /*
194
+ * Re-derived after the credential-handling clause (customer-portal
195
+ * production-credential-in-transcript P0, 2026-08-09). Added one reviewed section to the
196
+ * instruction content: the no-echo rule covers EVERY credential an agent meets,
197
+ * not only the one the task is about — explicitly including pass-through
198
+ * credentials met incidentally while establishing access (database passwords,
199
+ * kubeconfig contents, auth-file formats, environment dumps, secret manifests).
200
+ * It cites the task-subject vs pass-through mechanism so the WHY travels with the
201
+ * rule, and composes with #5312 (transcripts are fleet-readable, so an echoed
202
+ * credential is not confined to its session). Sixth instance of the #4969 trap,
203
+ * so again: a clean compose --check is not evidence that this digest is current.
204
+ *
205
+ * Text changed in the SOURCE overlay (claude-md/CLAUDE.overlay.memnexus.md) and
206
+ * the template recomposed with compose.mjs --write (--check clean). Digest below
207
+ * re-derived by running this test's own deploy path — deployClaudeMd into a
208
+ * scratch worktree, hash the written bytes (23,435 bytes) — NOT by copying it out
209
+ * of a CI failure log. Template line count 198 (by the budget test's split('\n')
210
+ * count), inside the 200-line budget. The value superseded here is
211
+ * `e699c31cdf19d94405a2d561d943c635b8d9f35a3af8bbe82e30e6e71d4fbebe`.
212
+ */
213
+ const CANONICAL_SHA256 = '3c7cdab8c254991ecd3e1c54101a2ab8dde0cf829680100aef7d81921d652535';
194
214
  let worktree;
195
215
  beforeEach(() => {
196
216
  worktree = mkdtempSync(join(tmpdir(), 'mx-agents-md-'));
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md-canonicalization.test.js","source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* `--by-agent` → parseAgentAttribution() (per-subagent table)
6
+ *
7
+ * Two defects are pinned here:
8
+ * 1. readProjectUsage called getRates() WITHOUT normalizeModelId(), so a dated
9
+ * model ID ("claude-opus-5-20260805") fell through to DEFAULT_RATES while
10
+ * --by-agent priced it correctly. Invisible today only because
11
+ * DEFAULT_RATES equals the opus-tier rate — a pricing-table coincidence.
12
+ * 2. The loud unknown-model fallback signal existed only on --by-agent; plain
13
+ * `usage` degraded silently, contradicting MODEL_PRICING's own comment.
14
+ *
15
+ * Fixtures use two separate project dirs so the two discovery walks cannot
16
+ * interfere: the plain path reads top-level transcripts, the attribution path
17
+ * reads <sessionId>/subagents/agent-<id>.jsonl children.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=usage-pricing.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-pricing.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/usage-pricing.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Tests for pricing consistency between the two `mx-agent usage` cost paths (#5283).
3
+ *
4
+ * plain `mx-agent usage` → readProjectUsage() (team cost table)
5
+ * `--by-agent` → parseAgentAttribution() (per-subagent table)
6
+ *
7
+ * Two defects are pinned here:
8
+ * 1. readProjectUsage called getRates() WITHOUT normalizeModelId(), so a dated
9
+ * model ID ("claude-opus-5-20260805") fell through to DEFAULT_RATES while
10
+ * --by-agent priced it correctly. Invisible today only because
11
+ * DEFAULT_RATES equals the opus-tier rate — a pricing-table coincidence.
12
+ * 2. The loud unknown-model fallback signal existed only on --by-agent; plain
13
+ * `usage` degraded silently, contradicting MODEL_PRICING's own comment.
14
+ *
15
+ * Fixtures use two separate project dirs so the two discovery walks cannot
16
+ * interfere: the plain path reads top-level transcripts, the attribution path
17
+ * reads <sessionId>/subagents/agent-<id>.jsonl children.
18
+ */
19
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
20
+ import { mkdirSync, rmSync, writeFileSync } from 'fs';
21
+ import { join } from 'path';
22
+ import { tmpdir } from 'os';
23
+ import { readProjectUsage, parseAgentAttribution, unknownModelsIn, calcLineCost, getRates, hasRates, normalizeModelId, newTotals, MODEL_PRICING, DEFAULT_RATES, } from '../lib/jsonl.js';
24
+ import { unknownModelsForRows } from '../commands/usage.js';
25
+ const T0 = '2026-08-06T10:00:00.000Z';
26
+ const PARENT_SESSION = 'parent-session-5283';
27
+ const TOKENS = { input: 1200, output: 640, cacheR: 30_000, cacheW: 900 };
28
+ const RECENT_MS = 365 * 24 * 60 * 60 * 1000; // wide window — fixtures are dated
29
+ let plainDir; // exercised by readProjectUsage
30
+ let childDir; // exercised by parseAgentAttribution
31
+ let childSubagents;
32
+ beforeEach(() => {
33
+ const stamp = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
34
+ plainDir = join(tmpdir(), `mx-price-plain-${stamp}`);
35
+ childDir = join(tmpdir(), `mx-price-child-${stamp}`);
36
+ childSubagents = join(childDir, PARENT_SESSION, 'subagents');
37
+ mkdirSync(plainDir, { recursive: true });
38
+ mkdirSync(childSubagents, { recursive: true });
39
+ });
40
+ afterEach(() => {
41
+ rmSync(plainDir, { recursive: true, force: true });
42
+ rmSync(childDir, { recursive: true, force: true });
43
+ });
44
+ // ── Fixture builders ──────────────────────────────────────────────────────────
45
+ function usageLine(model, u, sessionId = PARENT_SESSION) {
46
+ return JSON.stringify({
47
+ type: 'assistant',
48
+ timestamp: T0,
49
+ sessionId,
50
+ message: {
51
+ role: 'assistant',
52
+ model,
53
+ usage: {
54
+ input_tokens: u.input,
55
+ output_tokens: u.output,
56
+ cache_read_input_tokens: u.cacheR,
57
+ cache_creation_input_tokens: u.cacheW,
58
+ },
59
+ },
60
+ });
61
+ }
62
+ /** A lead transcript at <projectDir>/<sessionId>.jsonl — what plain usage reads. */
63
+ function writeLead(dir, lines) {
64
+ writeFileSync(join(dir, `${PARENT_SESSION}.jsonl`), lines.join('\n') + '\n');
65
+ }
66
+ /** An orphan child transcript — priced into the (unattributed) bucket. */
67
+ function writeChild(lines) {
68
+ writeFileSync(join(childSubagents, 'agent-aORPHAN.jsonl'), lines.join('\n') + '\n');
69
+ }
70
+ /** Total cost the --by-agent view reports for a project dir (attributed + residual). */
71
+ function attributionCost(dir) {
72
+ const r = parseAgentAttribution(dir);
73
+ let cost = r.unattributed.cost;
74
+ for (const agent of r.agents.values())
75
+ cost += agent.cost;
76
+ return cost;
77
+ }
78
+ // ── Tests ─────────────────────────────────────────────────────────────────────
79
+ describe('readProjectUsage pricing — dated model IDs (#5283 item 1)', () => {
80
+ it('prices a dated claude-opus-5-20260805 transcript at claude-opus-5 rates', () => {
81
+ writeLead(plainDir, [usageLine('claude-opus-5-20260805', TOKENS)]);
82
+ const { allTime } = readProjectUsage(plainDir, RECENT_MS);
83
+ const expected = calcLineCost(TOKENS.input, TOKENS.output, TOKENS.cacheR, TOKENS.cacheW, MODEL_PRICING['claude-opus-5']);
84
+ expect(allTime.cost).toBeCloseTo(expected, 10);
85
+ });
86
+ it('a dated ID whose family rate differs from the fallback is NOT priced at DEFAULT_RATES', () => {
87
+ // claude-opus-5 rates happen to equal DEFAULT_RATES, so that case alone
88
+ // cannot detect the bug. claude-fable-5 is 2x the opus tier, so a missed
89
+ // normalization is visible in the number.
90
+ writeLead(plainDir, [usageLine('claude-fable-5-20260724', TOKENS)]);
91
+ const { allTime } = readProjectUsage(plainDir, RECENT_MS);
92
+ const fable = calcLineCost(TOKENS.input, TOKENS.output, TOKENS.cacheR, TOKENS.cacheW, MODEL_PRICING['claude-fable-5']);
93
+ const fallback = calcLineCost(TOKENS.input, TOKENS.output, TOKENS.cacheR, TOKENS.cacheW, DEFAULT_RATES);
94
+ expect(allTime.cost).toBeCloseTo(fable, 10);
95
+ expect(allTime.cost).not.toBeCloseTo(fallback, 6);
96
+ });
97
+ it('both cost paths price the same dated transcript identically', () => {
98
+ const line = usageLine('claude-opus-5-20260805', TOKENS);
99
+ writeLead(plainDir, [line]);
100
+ writeChild([line]);
101
+ const plainCost = readProjectUsage(plainDir, RECENT_MS).allTime.cost;
102
+ expect(plainCost).toBeCloseTo(attributionCost(childDir), 10);
103
+ expect(plainCost).toBeGreaterThan(0);
104
+ });
105
+ it('undated IDs are unaffected — normalization is a no-op on them', () => {
106
+ writeLead(plainDir, [usageLine('claude-sonnet-5', TOKENS)]);
107
+ const { allTime } = readProjectUsage(plainDir, RECENT_MS);
108
+ expect(allTime.cost).toBeCloseTo(calcLineCost(TOKENS.input, TOKENS.output, TOKENS.cacheR, TOKENS.cacheW, MODEL_PRICING['claude-sonnet-5']), 10);
109
+ expect(normalizeModelId('claude-sonnet-5')).toBe('claude-sonnet-5');
110
+ });
111
+ });
112
+ describe('plain-path unknown-model warning (#5283 item 2)', () => {
113
+ it('reports an unpriced model from readProjectUsage totals', () => {
114
+ writeLead(plainDir, [
115
+ usageLine('claude-unpriced-9', TOKENS),
116
+ usageLine('claude-sonnet-5', TOKENS),
117
+ ]);
118
+ const { allTime, recent } = readProjectUsage(plainDir, RECENT_MS);
119
+ expect(unknownModelsIn(allTime)).toEqual(['claude-unpriced-9']);
120
+ expect(unknownModelsIn(recent)).toEqual(['claude-unpriced-9']);
121
+ // The priced model must not be flagged.
122
+ expect(unknownModelsIn(allTime)).not.toContain('claude-sonnet-5');
123
+ });
124
+ it('renders the unpriced model into the warning line the cost table prints', () => {
125
+ writeLead(plainDir, [usageLine('claude-unpriced-9', TOKENS)]);
126
+ const { allTime, recent } = readProjectUsage(plainDir, RECENT_MS);
127
+ const line = unknownModelsForRows([{ allTime, recent }]);
128
+ expect(line).toContain('claude-unpriced-9');
129
+ });
130
+ it('says nothing when every model is priced — the warning is not noise', () => {
131
+ writeLead(plainDir, [
132
+ usageLine('claude-opus-5-20260805', TOKENS),
133
+ usageLine('claude-haiku-4-5-20251001', TOKENS),
134
+ ]);
135
+ const { allTime, recent } = readProjectUsage(plainDir, RECENT_MS);
136
+ expect(unknownModelsForRows([{ allTime, recent }])).toEqual([]);
137
+ });
138
+ it('an empty rollup produces no warning', () => {
139
+ expect(unknownModelsIn(newTotals())).toEqual([]);
140
+ expect(unknownModelsForRows([])).toEqual([]);
141
+ });
142
+ });
143
+ describe('getRates argument invariant (#5283 item 3)', () => {
144
+ // The invariant: getRates() is only ever called with a TRANSCRIPT model ID
145
+ // (entry.message.model), never with a session-model config string. Config
146
+ // carries aliases ("opus", "sonnet"), transcripts carry resolved IDs
147
+ // ("claude-opus-5"). Pinned by behaviour rather than by call-graph analysis:
148
+ // if an alias ever reaches getRates it prices at the fallback AND is reported
149
+ // as unknown on both paths, so the mistake is loud rather than silent.
150
+ it('a session-model alias has no pricing entry and falls back loudly', () => {
151
+ for (const alias of ['opus', 'sonnet', 'haiku', 'fable']) {
152
+ expect(MODEL_PRICING[alias]).toBeUndefined();
153
+ expect(hasRates(alias)).toBe(false);
154
+ expect(getRates(alias)).toBe(DEFAULT_RATES);
155
+ }
156
+ });
157
+ it('the resolved ID the alias maps to IS priced — so the alias is the only failure mode', () => {
158
+ expect(hasRates('claude-opus-5')).toBe(true);
159
+ expect(getRates('claude-opus-5')).toBe(MODEL_PRICING['claude-opus-5']);
160
+ });
161
+ it('hasRates and getRates agree: !hasRates(m) iff getRates(m) is the fallback', () => {
162
+ const models = [
163
+ 'claude-opus-5', 'claude-opus-5-20260805', 'claude-fable-5-20260724',
164
+ 'claude-haiku-4-5-20251001', 'claude-unpriced-9', 'opus', '', '<synthetic>',
165
+ ];
166
+ for (const m of models) {
167
+ if (hasRates(m)) {
168
+ expect(getRates(m)).toBe(MODEL_PRICING[normalizeModelId(m)]);
169
+ }
170
+ else {
171
+ expect(getRates(m)).toBe(DEFAULT_RATES);
172
+ }
173
+ }
174
+ });
175
+ });
176
+ //# sourceMappingURL=usage-pricing.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-pricing.test.js","sourceRoot":"","sources":["../../src/__tests__/usage-pricing.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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5285).
4
+ *
5
+ * The real (current) layout, reproduced by these fixtures:
6
+ * <projectDir>/<sessionId>.jsonl — lead transcript
7
+ * <projectDir>/<sessionId>/subagents/agent-<id>.jsonl — child transcripts
8
+ * <projectDir>/<sessionId>/subagents/agent-<id>.meta.json — sidecar, not a transcript
9
+ * <projectDir>/<sessionId>/tool-results/*.txt — sidecar, not a transcript
10
+ * <projectDir>/subagents/*.jsonl — LEGACY flat layout
11
+ *
12
+ * collectJsonlFiles previously descended only into the legacy flat dir, so the
13
+ * team cost table and parseSessionRecords covered lead transcripts only and the
14
+ * fleet's primary cost instrument excluded all subagent spend.
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=usage-subagent-discovery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-subagent-discovery.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/usage-subagent-discovery.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Tests for subagent transcript discovery on the plain `mx-agent usage` /
3
+ * `mx-agent sync` path (#5285).
4
+ *
5
+ * The real (current) layout, reproduced by these fixtures:
6
+ * <projectDir>/<sessionId>.jsonl — lead transcript
7
+ * <projectDir>/<sessionId>/subagents/agent-<id>.jsonl — child transcripts
8
+ * <projectDir>/<sessionId>/subagents/agent-<id>.meta.json — sidecar, not a transcript
9
+ * <projectDir>/<sessionId>/tool-results/*.txt — sidecar, not a transcript
10
+ * <projectDir>/subagents/*.jsonl — LEGACY flat layout
11
+ *
12
+ * collectJsonlFiles previously descended only into the legacy flat dir, so the
13
+ * team cost table and parseSessionRecords covered lead transcripts only and the
14
+ * fleet's primary cost instrument excluded all subagent spend.
15
+ */
16
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
17
+ import { mkdirSync, rmSync, writeFileSync } from 'fs';
18
+ import { join } from 'path';
19
+ import { tmpdir } from 'os';
20
+ import { collectJsonlFiles, scanProjectDir, readProjectUsage, parseAgentAttribution, parseSessionRecords, calcLineCost, MODEL_PRICING, } from '../lib/jsonl.js';
21
+ const SESSION = 'session-5285';
22
+ const T0 = '2026-08-06T10:00:00.000Z';
23
+ const T1 = '2026-08-06T10:05:00.000Z';
24
+ const RECENT_MS = 365 * 24 * 60 * 60 * 1000;
25
+ const LEAD_TOKENS = { input: 1000, output: 500, cacheR: 20_000, cacheW: 800 };
26
+ const CHILD_TOKENS = { input: 300, output: 900, cacheR: 50_000, cacheW: 400 };
27
+ let projectDir;
28
+ let sessionDir;
29
+ let subagentsDir;
30
+ beforeEach(() => {
31
+ projectDir = join(tmpdir(), `mx-disc-${Date.now()}-${Math.random().toString(36).slice(2)}`);
32
+ sessionDir = join(projectDir, SESSION);
33
+ subagentsDir = join(sessionDir, 'subagents');
34
+ mkdirSync(subagentsDir, { recursive: true });
35
+ });
36
+ afterEach(() => {
37
+ rmSync(projectDir, { recursive: true, force: true });
38
+ });
39
+ // ── Fixture builders ──────────────────────────────────────────────────────────
40
+ function usageLine(model, u, opts = {}) {
41
+ return JSON.stringify({
42
+ type: 'assistant',
43
+ timestamp: opts.ts ?? T0,
44
+ sessionId: SESSION,
45
+ isSidechain: opts.sidechain ?? false,
46
+ message: {
47
+ role: 'assistant',
48
+ model,
49
+ usage: {
50
+ input_tokens: u.input,
51
+ output_tokens: u.output,
52
+ cache_read_input_tokens: u.cacheR,
53
+ cache_creation_input_tokens: u.cacheW,
54
+ },
55
+ },
56
+ });
57
+ }
58
+ /** The task prompt a spawning agent writes into its child's transcript. */
59
+ function sidechainPrompt(text) {
60
+ return JSON.stringify({
61
+ type: 'user',
62
+ timestamp: T0,
63
+ sessionId: SESSION,
64
+ isSidechain: true,
65
+ agentId: 'a1',
66
+ message: { role: 'user', content: text },
67
+ });
68
+ }
69
+ /** A genuine human turn in the lead transcript. */
70
+ function humanTurn(text, ts) {
71
+ return JSON.stringify({
72
+ type: 'user',
73
+ timestamp: ts,
74
+ sessionId: SESSION,
75
+ isSidechain: false,
76
+ promptSource: 'typed',
77
+ message: { role: 'user', content: text },
78
+ });
79
+ }
80
+ function writeLead(lines) {
81
+ writeFileSync(join(projectDir, `${SESSION}.jsonl`), lines.join('\n') + '\n');
82
+ }
83
+ function writeChild(agentId, lines) {
84
+ writeFileSync(join(subagentsDir, `agent-${agentId}.jsonl`), lines.join('\n') + '\n');
85
+ // Sidecar the harness writes next to every child transcript.
86
+ writeFileSync(join(subagentsDir, `agent-${agentId}.meta.json`), '{"agentId":"' + agentId + '"}');
87
+ }
88
+ function buildCurrentLayout() {
89
+ writeLead([usageLine('claude-opus-5', LEAD_TOKENS)]);
90
+ writeChild('a1', [
91
+ sidechainPrompt('Do the thing.'),
92
+ usageLine('claude-sonnet-5', CHILD_TOKENS, { ts: T1, sidechain: true }),
93
+ ]);
94
+ mkdirSync(join(sessionDir, 'tool-results'), { recursive: true });
95
+ writeFileSync(join(sessionDir, 'tool-results', 'abc123.txt'), 'tool output');
96
+ }
97
+ const leadCost = calcLineCost(LEAD_TOKENS.input, LEAD_TOKENS.output, LEAD_TOKENS.cacheR, LEAD_TOKENS.cacheW, MODEL_PRICING['claude-opus-5']);
98
+ const childCost = calcLineCost(CHILD_TOKENS.input, CHILD_TOKENS.output, CHILD_TOKENS.cacheR, CHILD_TOKENS.cacheW, MODEL_PRICING['claude-sonnet-5']);
99
+ // ── Tests ─────────────────────────────────────────────────────────────────────
100
+ describe('collectJsonlFiles — per-session subagent dirs (#5285)', () => {
101
+ it('finds lead and per-session child transcripts', () => {
102
+ buildCurrentLayout();
103
+ const files = collectJsonlFiles(projectDir);
104
+ expect(files).toContain(join(projectDir, `${SESSION}.jsonl`));
105
+ expect(files).toContain(join(subagentsDir, 'agent-a1.jsonl'));
106
+ expect(files).toHaveLength(2);
107
+ });
108
+ it('ignores non-transcript sidecars (.meta.json, tool-results/*.txt)', () => {
109
+ buildCurrentLayout();
110
+ const files = collectJsonlFiles(projectDir);
111
+ expect(files.some((f) => f.endsWith('.meta.json'))).toBe(false);
112
+ expect(files.some((f) => f.includes('tool-results'))).toBe(false);
113
+ });
114
+ it('returns no path twice — nothing can be double-counted', () => {
115
+ buildCurrentLayout();
116
+ // Add a second session with its own children, plus the legacy flat dir, so
117
+ // all three location classes are populated at once.
118
+ const s2 = join(projectDir, 'session-two');
119
+ mkdirSync(join(s2, 'subagents'), { recursive: true });
120
+ writeFileSync(join(projectDir, 'session-two.jsonl'), usageLine('claude-opus-5', LEAD_TOKENS) + '\n');
121
+ writeFileSync(join(s2, 'subagents', 'agent-b1.jsonl'), usageLine('claude-sonnet-5', CHILD_TOKENS) + '\n');
122
+ mkdirSync(join(projectDir, 'subagents'), { recursive: true });
123
+ writeFileSync(join(projectDir, 'subagents', 'old-child.jsonl'), usageLine('claude-sonnet-5', CHILD_TOKENS) + '\n');
124
+ const files = collectJsonlFiles(projectDir);
125
+ expect(new Set(files).size).toBe(files.length);
126
+ expect(files).toHaveLength(5); // 2 leads + 2 per-session children + 1 legacy
127
+ });
128
+ it('still collects the legacy flat subagents/ layout', () => {
129
+ writeLead([usageLine('claude-opus-5', LEAD_TOKENS)]);
130
+ mkdirSync(join(projectDir, 'subagents'), { recursive: true });
131
+ writeFileSync(join(projectDir, 'subagents', 'old-child.jsonl'), usageLine('claude-sonnet-5', CHILD_TOKENS) + '\n');
132
+ expect(collectJsonlFiles(projectDir)).toContain(join(projectDir, 'subagents', 'old-child.jsonl'));
133
+ });
134
+ it('scanProjectDir keeps the three location classes disjoint', () => {
135
+ buildCurrentLayout();
136
+ mkdirSync(join(projectDir, 'subagents'), { recursive: true });
137
+ writeFileSync(join(projectDir, 'subagents', 'old-child.jsonl'), '');
138
+ const scan = scanProjectDir(projectDir);
139
+ expect(scan.leadFiles).toHaveLength(1);
140
+ expect(scan.childFiles).toHaveLength(1);
141
+ expect(scan.childFiles[0].agentId).toBe('a1');
142
+ expect(scan.legacyChildFiles).toHaveLength(1);
143
+ });
144
+ it('a missing project dir yields nothing and does not throw', () => {
145
+ expect(collectJsonlFiles(join(projectDir, 'nope'))).toEqual([]);
146
+ });
147
+ });
148
+ describe('readProjectUsage totals include subagent spend (#5285)', () => {
149
+ it('counts child tokens and cost on top of the lead transcript', () => {
150
+ buildCurrentLayout();
151
+ const { allTime } = readProjectUsage(projectDir, RECENT_MS);
152
+ expect(allTime.inputTokens).toBe(LEAD_TOKENS.input + CHILD_TOKENS.input);
153
+ expect(allTime.outputTokens).toBe(LEAD_TOKENS.output + CHILD_TOKENS.output);
154
+ expect(allTime.cacheReadTokens).toBe(LEAD_TOKENS.cacheR + CHILD_TOKENS.cacheR);
155
+ expect(allTime.cacheWriteTokens).toBe(LEAD_TOKENS.cacheW + CHILD_TOKENS.cacheW);
156
+ expect(allTime.cost).toBeCloseTo(leadCost + childCost, 10);
157
+ expect(allTime.models).toEqual(new Set(['claude-opus-5', 'claude-sonnet-5']));
158
+ });
159
+ it('the lead transcript is counted exactly once', () => {
160
+ // Lead only, no children: totals must equal the single line, not double it.
161
+ writeLead([usageLine('claude-opus-5', LEAD_TOKENS)]);
162
+ const { allTime } = readProjectUsage(projectDir, RECENT_MS);
163
+ expect(allTime.inputTokens).toBe(LEAD_TOKENS.input);
164
+ expect(allTime.cost).toBeCloseTo(leadCost, 10);
165
+ });
166
+ it('child spend is the only difference from the --by-agent view', () => {
167
+ buildCurrentLayout();
168
+ const plain = readProjectUsage(projectDir, RECENT_MS).allTime.cost;
169
+ const attribution = parseAgentAttribution(projectDir);
170
+ let byAgent = attribution.unattributed.cost;
171
+ for (const a of attribution.agents.values())
172
+ byAgent += a.cost;
173
+ // --by-agent prices children only; plain usage prices lead + children.
174
+ expect(byAgent).toBeCloseTo(childCost, 10);
175
+ expect(plain - byAgent).toBeCloseTo(leadCost, 10);
176
+ });
177
+ it('subagent sessions do not inflate the session count', () => {
178
+ // Children carry the PARENT sessionId, so the session count is unchanged.
179
+ buildCurrentLayout();
180
+ const { allTime } = readProjectUsage(projectDir, RECENT_MS);
181
+ expect(allTime.sessions).toEqual(new Set([SESSION]));
182
+ });
183
+ });
184
+ describe('parseSessionRecords with child transcripts (#5285)', () => {
185
+ it('rolls subagent tokens into the parent session record', () => {
186
+ buildCurrentLayout();
187
+ const records = parseSessionRecords(projectDir);
188
+ expect(records).toHaveLength(1);
189
+ expect(records[0].sessionId).toBe(SESSION);
190
+ expect(records[0].inputTokens).toBe(LEAD_TOKENS.input + CHILD_TOKENS.input);
191
+ expect(records[0].outputTokens).toBe(LEAD_TOKENS.output + CHILD_TOKENS.output);
192
+ });
193
+ it('a subagent task prompt is not a human turn — autonomy stays uninverted', () => {
194
+ // Lead: startup prompt (skipped) + one genuine human turn.
195
+ // Child: one sidechain prompt written by the spawning agent.
196
+ writeLead([
197
+ humanTurn('startup prompt from mx-agent start', T0),
198
+ usageLine('claude-opus-5', LEAD_TOKENS),
199
+ humanTurn('a real human interruption', T1),
200
+ ]);
201
+ writeChild('a1', [
202
+ sidechainPrompt('Do the thing.'),
203
+ sidechainPrompt('Now do the other thing.'),
204
+ usageLine('claude-sonnet-5', CHILD_TOKENS, { ts: T1, sidechain: true }),
205
+ ]);
206
+ const records = parseSessionRecords(projectDir);
207
+ expect(records).toHaveLength(1);
208
+ // Exactly one: the startup prompt is spent on the grace, the two sidechain
209
+ // prompts are machine-authored. Delegating more must not look less autonomous.
210
+ expect(records[0].humanTurns).toBe(1);
211
+ });
212
+ });
213
+ //# sourceMappingURL=usage-subagent-discovery.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-subagent-discovery.test.js","sourceRoot":"","sources":["../../src/__tests__/usage-subagent-discovery.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,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,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,2DAA2D;QAC3D,6DAA6D;QAC7D,SAAS,CAAC;YACR,SAAS,CAAC,oCAAoC,EAAE,EAAE,CAAC;YACnD,SAAS,CAAC,eAAe,EAAE,WAAW,CAAC;YACvC,SAAS,CAAC,2BAA2B,EAAE,EAAE,CAAC;SAC3C,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,EAAE;YACf,eAAe,CAAC,eAAe,CAAC;YAChC,eAAe,CAAC,yBAAyB,CAAC;YAC1C,SAAS,CAAC,iBAAiB,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SACxE,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChC,2EAA2E;QAC3E,+EAA+E;QAC/E,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -87,6 +87,10 @@ unset MX_AGENT_OBSERVABILITY_TOKEN
87
87
 
88
88
  Sync URL is pre-configured in the StopHook.
89
89
 
90
+ ## Handling credentials — the no-echo rule covers pass-through credentials, not only the task's subject
91
+
92
+ The no-echo rule — never read, print, echo, or store a credential value or its length — covers **every** credential an agent meets, not only the one the task is *about*. It explicitly covers credentials met incidentally while establishing access: database passwords, kubeconfig contents, auth-file formats, environment dumps, secret manifests. This closes a specific mechanism: the protection gets written when the credential is the task's *subject* (it is salient, so whoever wrote the brief names it) and omitted when the credential is *pass-through* — infrastructure met on the way to the real target — so working out HOW to connect is the highest-risk moment for this rule, not an exception to it. (Precedent: 2026-08-09, an authorised read-only production census printed the production database username and password into its transcript while an agent worked out how to authenticate; the task was about account tiers, the credential was incidental plumbing, and no brief clause covered it — customer-portal P0.) Resolve credentials in-process or in-pod; never route one through a command whose output is captured — to a transcript, a scratchpad, or a log. This composes with #5312: transcripts on this machine are fleet-readable, so an echoed credential is not confined to the session that produced it.
93
+
90
94
  ## After merging a PR — blocking gate
91
95
 
92
96
  A PR is not done when it merges. It is done when it deploys and the deploy is verified.
@@ -24,6 +24,10 @@ Any error from {{PRODUCT_NAME}} tools (saving, retrieving, searching, updating m
24
24
 
25
25
  {{> core:first-use-setup}}
26
26
 
27
+ ## Handling credentials — the no-echo rule covers pass-through credentials, not only the task's subject
28
+
29
+ The no-echo rule — never read, print, echo, or store a credential value or its length — covers **every** credential an agent meets, not only the one the task is *about*. It explicitly covers credentials met incidentally while establishing access: database passwords, kubeconfig contents, auth-file formats, environment dumps, secret manifests. This closes a specific mechanism: the protection gets written when the credential is the task's *subject* (it is salient, so whoever wrote the brief names it) and omitted when the credential is *pass-through* — infrastructure met on the way to the real target — so working out HOW to connect is the highest-risk moment for this rule, not an exception to it. (Precedent: 2026-08-09, an authorised read-only production census printed the production database username and password into its transcript while an agent worked out how to authenticate; the task was about account tiers, the credential was incidental plumbing, and no brief clause covered it — customer-portal P0.) Resolve credentials in-process or in-pod; never route one through a command whose output is captured — to a transcript, a scratchpad, or a log. This composes with #5312: transcripts on this machine are fleet-readable, so an echoed credential is not confined to the session that produced it.
30
+
27
31
  {{> core:post-merge-gate}}
28
32
 
29
33
  ## Creating memories in this project
@@ -5,11 +5,20 @@
5
5
  * down by team. Shows all-time totals and a configurable recent window.
6
6
  * Subagent sessions are included in their team's totals.
7
7
  */
8
+ import { type Totals } from '../lib/jsonl.js';
8
9
  export interface UsageOptions {
9
10
  name?: string;
10
11
  recent: string;
11
12
  byAgent?: boolean;
12
13
  }
14
+ /**
15
+ * Distinct unpriced models across every team row (all-time and recent windows).
16
+ * Exported for tests: this is the string set the warning line renders.
17
+ */
18
+ export declare function unknownModelsForRows(rows: Array<{
19
+ allTime: Totals;
20
+ recent: Totals;
21
+ }>): string[];
13
22
  /**
14
23
  * Sanitize transcript-derived text before it reaches the terminal or the
15
24
  * committed report. subagent_type / model / unknown-model strings originate in
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/commands/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiiBD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAItC;AAkHD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFnE"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/commands/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAOL,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiPD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/C,MAAM,EAAE,CAOV;AA4TD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAItC;AAkHD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFnE"}
@@ -12,7 +12,7 @@ import { homedir } from 'os';
12
12
  import chalk from 'chalk';
13
13
  import { findProjectRoot, findWorktreePath } from '../lib/worktree.js';
14
14
  import { listTeams } from '../lib/catalog.js';
15
- import { readProjectUsage, parseAgentAttribution, pathToProjectDirName, newTotals, addToTotals, } from '../lib/jsonl.js';
15
+ import { readProjectUsage, parseAgentAttribution, pathToProjectDirName, newTotals, addToTotals, unknownModelsIn, } from '../lib/jsonl.js';
16
16
  // ── Helpers ──────────────────────────────────────────────────────────────────
17
17
  /**
18
18
  * Parse a period string ("7d", "30d", "24h", "1w") into milliseconds.
@@ -197,6 +197,26 @@ function renderCostTable(rows, recentLabel) {
197
197
  console.log();
198
198
  console.log(chalk.dim(' API = Anthropic API rates Max = Claude Max share of total (tokens vs dollars)'));
199
199
  console.log(chalk.dim(' Rates: anthropic.com/pricing — unknown models use Opus 4.6 rates'));
200
+ // Unknown-model warning — the plain path's loud fallback, mirroring the
201
+ // --by-agent view (#5283). Without it this table silently priced any model
202
+ // missing from MODEL_PRICING at the Opus 4.6 fallback with no operator signal.
203
+ const unknown = unknownModelsForRows(rows);
204
+ if (unknown.length > 0) {
205
+ console.log(` ${chalk.yellow.bold('Unknown models (priced at Opus 4.6 fallback rates):')} ` +
206
+ chalk.yellow(unknown.map(safe).join(', ')));
207
+ }
208
+ }
209
+ /**
210
+ * Distinct unpriced models across every team row (all-time and recent windows).
211
+ * Exported for tests: this is the string set the warning line renders.
212
+ */
213
+ export function unknownModelsForRows(rows) {
214
+ const out = new Set();
215
+ for (const row of rows) {
216
+ unknownModelsIn(row.allTime).forEach((m) => out.add(m));
217
+ unknownModelsIn(row.recent).forEach((m) => out.add(m));
218
+ }
219
+ return Array.from(out).sort();
200
220
  }
201
221
  function newPrMetrics() {
202
222
  return { prs: 0, additions: 0, deletions: 0, changedFiles: 0 };