Tighten agent token brief stop gate · Entire
Tighten agent token brief stop gate
ce3f47f·
peyton-alt·3w ago·2 files·+7 added/-3 removed
Sessions
1051aa7485b2 View transcript
Changes
2
cmd/entire/cli
Msession_tokens.go +2/-2
Msessions_test.go +5/-1
65 unmodified lines
66
67
68
69
69
70
71
72
432 unmodified lines
505
506
507
508
508
509
510
511
65 unmodified lines
CheckpointCount int
}
const agentBriefCostProxyBatchAction = "Use at most 3 batched reads before answering. Avoid broad grep, broad diffs, broad tests, and repeated token diagnostics; keep the answer tight."
const agentBriefCostProxyBatchAction = "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."
func newTokensCmd() *cobra.Command {
var jsonFlag bool
432 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 +2/-2
1272 unmodified lines
1273
1274
1275
1276
1277
1278
1279
43 unmodified lines
1323
1324
1325
1325
1326
1327
1328
1329
113 unmodified lines
1443
1444
1445
1446
1447
1448
1449
29 unmodified lines
1479
1480
1481
1482
1483
1484
1485
404 unmodified lines
1890
1891
1892
1893
1894
1895
1896
1272 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."