Tighten agent token brief stop gate · Entire

Tighten agent token brief stop gate

741e87b·

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

Sessions

1051aa7485b2View transcript

Changes

2

65 unmodified lines

66
67
68
69
69
70
71
72
424 unmodified lines

497
498
499
500
500
501
502
503

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
424 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

1253 unmodified lines

1254
1255
1256
1257
1258
1259
1260
43 unmodified lines

1304
1305
1306
1306
1307
1308
1309
1310
113 unmodified lines

1424
1425
1426
1427
1428
1429
1430
29 unmodified lines

1460
1461
1462
1463
1464
1465
1466
396 unmodified lines

1863
1864
1865
1866
1867
1868
1869

1253 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."
396 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."