1 Commits

Author SHA1 Message Date
CoreRasurae 964e87cc0f feat(tool-loop): add token-budget awareness and tool output pruning
CI / lint (pull_request) Successful in 1m31s
CI / typecheck (pull_request) Successful in 50s
CI / security (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 33s
CI / unit_tests (pull_request) Successful in 3m5s
CI / integration_tests (pull_request) Successful in 1m7s
CI / build (pull_request) Successful in 34s
CI / coverage (pull_request) Successful in 3m7s
CI / status-check (pull_request) Successful in 3s
CI / lint (push) Successful in 33s
CI / typecheck (push) Successful in 50s
CI / security (push) Successful in 50s
CI / quality (push) Successful in 33s
CI / integration_tests (push) Successful in 1m12s
CI / build (push) Successful in 33s
CI / unit_tests (push) Successful in 3m5s
CI / coverage (push) Successful in 3m6s
CI / status-check (push) Successful in 6s
Implement token-budget awareness (§4.4.7) and tool output pruning
(§4.4.8-9) for the multi-turn tool-call loop to prevent context-window
exhaustion.

Token budget: tracks estimated token count before each ainvoke(), emits
warning at 75% budget, injects synthesis prompt at exhaustion with one
final tool-call round. Estimation via chat_model.get_num_tokens() with
len(content)//4 heuristic fallback. Config key: token_budget_percent.

Tool output pruning: implicit LLM extraction pass scoped to file_read
calls. Schema augmentation injects output_prune (bool) and
output_prune_context (string) meta-arguments. Pruning model responds
with [PRUNE_INFO_START/END] and [PRUNE_OUTPUT_START/END] markers.
Config keys: allow_tool_output_pruning, pruning_model.

- Capture output_prune value in budget synthesis flow with proper guard
- Fix ADR D-4: synthesis prompt is HumanMessage not SystemMessage
- Fix Robot tests: replace /dev/null with temp file path

ADR-2031 documents all specification extensions. 21 new BDD scenarios,
5 Robot integration tests, 16 ASV benchmarks.

ISSUES CLOSED: #61
2026-06-26 18:21:14 +01:00