Tighten agent token brief stop gate · Entire

Tighten agent token brief stop gate

0ccecb2·

peyton-alt·3w ago·2 files·+6 added/-2 removed

Sessions

1051aa7485b2View transcript

Changes

2

527 unmodified lines

528
529
530
531
531
532
533
534

527 unmodified lines

case hasTokenRecommendation(report, "api-call-amplification"):
        return agentBriefCostProxyBatchAction, true
    case hasTokenRecommendation(report, "context-replay-hotspot"):
        return "Use at most 2 focused reads after summarizing known findings, then answer. Avoid broad grep, broad diffs, and broad tests.", true
        return "Use at most 2 focused reads only if a named file or test can change the answer; otherwise answer now. Avoid broad grep, broad diffs, and broad tests.", true
    case hasTokenRecommendation(report, "subagent-heavy"):
        return "Do not launch broad subagents. Use one narrowly scoped check with a concrete expected output.", true
    case hasTokenRecommendation(report, "high-context-pressure"):

Mcmd/entire/cli/session_tokens.go+1/-1

1327 unmodified lines

1328
1329
1330
1331
1332
1333
1334
43 unmodified lines

1378
1379
1380
1380
1381
1382
1383
1384
113 unmodified lines

1498
1499
1500
1501
1502
1503
1504
29 unmodified lines

1534
1535
1536
1537
1538
1539
1540
404 unmodified lines

1945
1946
1947
1948
1949
1950
1951

1327 unmodified lines

"Token usage: 6213.6k total; 97.4% cache/context replay; 70 API calls.",
    "Next best action:",
    "Use at most 3 batched reads before answering.",
    "Continue only if a named file or test can change the verdict; otherwise answer now.",
    "Avoid broad grep, broad diffs, broad tests, and repeated token diagnostics; keep the answer tight.",
    "Signals:",
    "- Cache/context replay dominates token volume."
43 unmodified lines

out := stdout.String()
    checks := []string{
        "Token usage: 637.7k total; 95.5% cache/context replay; 3 API calls.",
        "Use at most 2 focused reads after summarizing known findings, then answer.",
        "Use at most 2 focused reads only if a named file or test can change the answer; otherwise answer now.",
        "Avoid broad grep, broad diffs, and broad tests.",
        "- Cache/context replay dominates token volume.",
    }
113 unmodified lines

"Session: test-cost-proxy-brief",
        "Use at most 3 batched reads",
        "Avoid broad grep, broad diffs, broad tests",
        "otherwise answer now",
        "keep the answer tight",
        "- Cache write/new context pressure is elevated.",
        "- Output pressure is elevated."
29 unmodified lines

"Checkpoint: c05e500cafe0",
        "Use at most 3 batched reads",
        "Avoid broad grep, broad diffs, broad tests",
        "otherwise answer now",
        "keep the answer tight",
        "- Cache write/new context pressure is elevated.",
        "- Output pressure is elevated."
404 unmodified lines

"Token usage: 6213.6k total; 97.4% cache/context replay; 70 API calls.",
        "Next best action:",
        "Use at most 3 batched reads before answering.",
        "Continue only if a named file or test can change the verdict; otherwise answer now.",
        "Avoid broad grep, broad diffs, broad tests, and repeated token diagnostics; keep the answer tight.",
        "Signals:",
        "- Cache/context replay dominates token volume."