Keep prompt prefix stable in the chat path (cache-friendly conversation history)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature request
Disclaimer
Initial spec elicited via STT
whisper-base, partially polished withopencode:GLM-5.3post-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.pyrewrite 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
- Claude Code prompt-caching lessons: static first / dynamic last, never mutate tools or history mid-session.
- Lingua principale
- Python
- Stelle
- 26
- Fork
- 20
- Merge medio
- 2g 9h
- PR unite (30g)
- 4
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nextcloud/context_agent
-
enhancement priority normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
nextcloud/context_agent#270 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
nextcloud/context_agent#242 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add endpoint to create new CollectivesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nextcloud/context_agent#240 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
find_person_in_contacts fails with Niquests content argument and cannot serialize vCard AddressApertabug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
nextcloud/context_agent#217 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Failed to schedule taskApertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
nextcloud/context_agent#271 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di nextcloud/context_agent
Issue simili
-
bot-triaged module: LrScheduler module: optimizer triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
documentation glm5 llm-model
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vllm-project/vllm-ascend#19062 ·
I maintainer di solito rispondono entro 1 giorno
-
Author Page: shuai-zhao-llmApertaauthor-page correction
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
acl-org/acl-anthology#10496 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Issue Type: Bug Report
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
celery/celery#10875 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
SasanLabs/VulnerableApp#836 ·
I maintainer di solito rispondono entro 1 giorno