prompt-hook: make the injection cap configurable and allow a nudge-only mode
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #2572 de @mitunmanav — cerrado sin fusionar
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- c
- Área
- ai-infra-agents
Línea de trabajo
Start by locating where PROMPT_HOOK_INJECTION_MAX is defined and how the prompt hook selects its output tier; inspect the existing environment-variable handling and tests for the hook. Compare the two proposed approaches and check related issues #1282, #1694, #2184, #914, and #1279 before choosing scope. Done means users can configure a lower cap or select nudge-only output, with tests covering the default and behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
PROMPT_HOOK_INJECTION_MAX is hardcoded (9,000 chars in 1.6.2, 16,000 before #1694). The only user-facing control is the kill-switch (CODEGRAPH_NO_PROMPT_HOOK=1), so the choice is all or nothing.
On Claude Code, hook output stays in the conversation and is re-read from cache on every later model call until the next compaction. A full-explore injection therefore costs its size multiplied by the number of calls that follow it, not just once.
What I measured
One long Claude Code session on Windows (v1.5.0, a TypeScript monorepo, prompts mostly in Spanish), counted from the session transcript:
| Metric | Value |
|---|---|
| Model calls | 2,256 |
| User prompts | 226 |
| prompt-hook injections | 119 |
| Compactions | 4 (about 450 calls per segment) |
In this session, a large share of the injections were not related to the prompt. For example, a prompt asking to read a blog post about token usage injected the source of unrelated UI components.
1.6.1 and 1.6.2 already remove three of the triggers I saw: <task-notification> (#1832), <agent-message> hand-backs (#2184) and everyday "como" (#1654). Thanks for those.
The new 9,000-char cap fixes #1694 by keeping the output inline. A side effect is that each full injection now enters the context whole. In 1.5.0, oversized output was persisted to a file and only a 2 KB preview reached the model. For users whose prompts often pass the gate, the total context cost per session can go up even as the number of injections goes down.
Proposal
Either of these would let users choose the trade-off without turning the hook off:
CODEGRAPH_PROMPT_HOOK_MAX_CHARS, defaulting to the current 9,000 and clamped to it, so users can lower the cap (for example to 3,000).CODEGRAPH_PROMPT_HOOK_MODE=nudge, which always uses the existing medium-tier output: a short list of matching symbols plus the "call codegraph_explore" line. The agent then pulls source only when it needs it.
Option 2 matches the hook's own design, where the agent writes the explore query. It also keeps the hook useful as a reminder to query the graph, which is the behavior that #914 and #1279 report as missing.
Related: #1282 (output budget for explore), #1694, #2184.
Environment
- codegraph 1.5.0 at the time of measurement, now 1.6.2
- Claude Code on Windows 11, Git Bash
- Lenguaje dominante
- C
- Estrellas
- 73.2k
- Forks
- 4.7k
- Merge medio
- 3 h 31 min
- PR fusionados (30 d)
- 546
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 colbymchenry/codegraph
-
A `../` entry in package.json `workspaces` makes a folder outside the project count as a workspace package, and a call gets linked to the wrong functionPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
colbymchenry/codegraph#3093 ·
Los mantenedores suelen responder en 1 día
-
Windows: npm-shim spawnSync missing windowsHide flashes a console window on every MCP server launchAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
colbymchenry/codegraph#3054 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
colbymchenry/codegraph#2974 ·
Los mantenedores suelen responder en 1 día
-
[Security Vulnerabiliy] Vulnerable bundled `node.exe` detected (Node2Shell - CVE-2026-111497)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
colbymchenry/codegraph#2959 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
codegraph ui - does not workAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
colbymchenry/codegraph#1900 · 2 comentarios · 5 reacciones ·
Los mantenedores suelen responder en 1 día
Todos los issues de colbymchenry/codegraph
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
elf_loader: Xtensa ignores the addend of R_XTENSA_GLOB_DAT / R_XTENSA_JMP_SLOT (C++ vtables)Posiblemente ocupada @diplfranzhoepfinger la tomó hoy. Abiertoelf_loader
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
espressif/esp-iot-solution#813 ·
Los mantenedores suelen responder en 1 día
-
Status: Opened Type: Bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día