Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Keep prompt prefix stable in the chat path (cache-friendly conversation history)

Abierto
#268 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
15/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
ai, backend

Línea de trabajo

This is design work across the chat path. Start with nc_model.py, where history truncation and cutoff rewrite already-sent messages, and find where the system prompt, tool list and task usage are assembled per request. Done would need a maintainer-agreed design for a pinned system prompt, a stable tool order, append-only truncation, and cache-token fields in usage. Settle the design with maintainers before writing code.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Feature request

Disclaimer

Initial spec elicited via STT whisper-base, partially polished with opencode:GLM-5.3 post-explore.

Is your feature request related to a problem? Please describe.

Prompt-cache hit rate on the context_agent chat path is degraded because the request prefix mutates during a conversation, which raises cost and latency on every long chat. All major providers (OpenAI, Anthropic, Gemini) cache by prefix match, so any mutation re-bills everything after it as uncached input.

Mutations on main:

  • System prompt recomposed per task: current date, conditional tool lines, memories, skills list.
  • Tool output truncation and history cutoff in nc_model.py rewrite already-sent history.
  • Tool list/ordering rebuilt per request.

Describe the solution you'd like

  • Deterministic system prompt per conversation; updates (date, memories) go in a reminder block in the next user message instead (Anthropic: mid-conversation system/tool changes).
  • Stable tool list and ordering for the session's lifetime (tool use with prompt caching).
  • Append-only history: large tool outputs truncated once when first sent, never re-truncated as thresholds shift, keeps the #91 payload-cap fix without rewriting the prefix.
  • Expose cache hits in task usage (cached_tokens / cache_creation_input_tokens) so regressions are measurable.

Describe alternatives you've considered

Doing nothing: caching still partially works, but every prefix mutation re-bills the whole conversation as uncached input.

Additional context / related

  • nextcloud/assistant#698
    • conversation branching; per-branch caches depend on these guarantees.
  • #246
    • configurable system prompt; must also be pinned per conversation, same code path.
  • #202 / #247
    • tool-set management; mid-session tool changes are themselves prefix invalidations, need a session-stable or deferred-loading design.
  • #213
    • compaction should use cache-safe forking (identical prefix, summary appended) or it defeats this.
  • #91 (closed)
    • TaskProcessing payload cap that motivated retroactive truncation; constraint on the append-only approach.
  • reference
Lenguaje dominante
Python
Estrellas
26
Forks
20
Merge medio
2 d 9 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nextcloud/context_agent

Todos los issues de nextcloud/context_agent

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.