[Feature Request] Mitigate exponential token consumption & add token budget guardrails
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
- #2482 de @juniorhillory-creator — cerrado sin fusionar
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- ai-infra-agents
Línea de trabajo
The request names no files, tests, or entry points. Start by locating where task context and tool outputs are added to conversation history, then trace how token usage is tracked. Done means the team has defined and implemented the requested budget pause, output truncation, and targeted edit behavior, with tests covering those flows.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
When running multi-step agentic tasks (like a 10-step debugging loop), token consumption scales exponentially due to the sliding window context. By step 5 or 6, the agent is re-sending the system prompt and all previous tool outputs (like massive linter errors or read_file contents), which drastically inflates API costs and quickly eats up the context window.
Describe the solution you'd like
To make agentic loops more sustainable, I suggest implementing a few context-management guardrails:
- Hard Token Budgets / Limits: Add a UI setting to set a maximum token budget per task (e.g., "Pause agent if task exceeds 100,000 tokens"). If the loop hits this, it pauses and asks the user if they want to summarize the context or continue.
- Raw Output Truncation: Automatically truncate or summarize massive terminal outputs (like
npm errorlogs or largeread_filepayloads) before injecting them back into the context history. - Targeted Diff Enforcement: Provide a built-in strict mode (or update system instructions) that heavily penalizes full-file rewrites via
write_fileand enforces targeted edits viaedit_fileto save on expensive output tokens.
Describe alternatives you've considered
Currently, my only workaround is to manually kill the task when the history gets too long and start a fresh session, or route repetitive tasks to my local Ollama models to avoid API costs.
Additional context
When the agent rewrites large files, it not only burns output tokens but also frequently busts the API prompt cache for subsequent turns. Better context pruning would keep cache hit rates higher and significantly reduce user costs.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2k
- Forks
- 301
- Merge medio
- 3 d 14 h
- PR fusionados (30 d)
- 103
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Zoo-Code-Org/Zoo-Code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Zoo-Code-Org/Zoo-Code#2515 ·
Los mantenedores suelen responder en 3 días
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on WindowsPosiblemente ocupada @easonLiangWorldedtech la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
Los mantenedores suelen responder en 3 días
-
[BUG] search_files hides matching text on long linesPosiblemente ocupada @DananjayaNadun la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 3 días
Todos los issues de Zoo-Code-Org/Zoo-Code
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 modelAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
tashfeenahmed/freellmapi#2169 ·
Los mantenedores suelen responder en 1 día
-
via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on recordAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
vercel-labs/ui#1563 ·
Los mantenedores suelen responder en 1 día