Title: perf: add adaptive reasoning effort and token-cost optimizations by andrelncampos · Pull Request #166 · lessweb/deepcode-cli · GitHub
Open Graph Title: perf: add adaptive reasoning effort and token-cost optimizations by andrelncampos · Pull Request #166 · lessweb/deepcode-cli
X Title: perf: add adaptive reasoning effort and token-cost optimizations by andrelncampos · Pull Request #166 · lessweb/deepcode-cli
Description: This PR reduces token cost during long agent sessions by adding adaptive reasoning effort and related token-usage optimizations. Main changes: Adds RuntimeReasoningEffortManager to dynamically switch reasoning_effort between high and max. Escalates to max after repeated tool failures or repeated identical tool-call loops. Downgrades back to high after stable clean turns. Adds cooldowns and anti-flapping behavior to avoid oscillation. Integrates runtime effort changes into the session loop. Reuses cached tool definitions during the loop. Caches the system prompt per model. Uses estimated context size for active token tracking instead of relying only on response usage. Adds tests for escalation, downgrade, reset, cooldown and anti-flapping behavior. Why: Using max reasoning effort for every turn is expensive. This change keeps the default effort lower and escalates only when runtime signals indicate that the model needs more reasoning depth. Validation: npm run format npm run build npm run check npm test Result: 421 passing tests 0 failing tests 8 skipped tests
Open Graph Description: This PR reduces token cost during long agent sessions by adding adaptive reasoning effort and related token-usage optimizations. Main changes: Adds RuntimeReasoningEffortManager to dynamically swi...
X Description: This PR reduces token cost during long agent sessions by adding adaptive reasoning effort and related token-usage optimizations. Main changes: Adds RuntimeReasoningEffortManager to dynamically swi...
Opengraph URL: https://github.com/lessweb/deepcode-cli/pull/166
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6db8008b-62b6-61b7-c1b9-3ed99ba44100 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8A26:FC5F:889CF3:C7A38C:6A4E1664 |
| html-safe-nonce | 632e4482891e9fe803de3f3deee58b74e1742c5efc3520f43e03211580d5680d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTI2OkZDNUY6ODg5Q0YzOkM3QTM4Qzo2QTRFMTY2NCIsInZpc2l0b3JfaWQiOiI0ODk2OTYxMjE0MDQ5ODE4MjEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9d29bc177e8ea7c8caf257d0d03c9e58fddbbf35ce7be55c81d05d6cd0f73bdf |
| hovercard-subject-tag | pull_request:3812782045 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/lessweb/deepcode-cli/pull/166/files |
| twitter:image | https://avatars.githubusercontent.com/u/41524488?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/41524488?s=400&v=4 |
| og:image:alt | This PR reduces token cost during long agent sessions by adding adaptive reasoning effort and related token-usage optimizations. Main changes: Adds RuntimeReasoningEffortManager to dynamically swi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/lessweb/deepcode-cli git https://github.com/lessweb/deepcode-cli.git |
| octolytics-dimension-user_id | 118287711 |
| octolytics-dimension-user_login | lessweb |
| octolytics-dimension-repository_id | 1223512305 |
| octolytics-dimension-repository_nwo | lessweb/deepcode-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1223512305 |
| octolytics-dimension-repository_network_root_nwo | lessweb/deepcode-cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ea9187571e3edc5f2780f750631138669441ca50 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width