Distill skill hits "Prompt is too long" when processing many conversations
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 64/100
Direzione di ricerca
Esamina skills/distill/SKILL.md, concentrandoti sui prompt dei sub-agents e sul passaggio di raccolta del coordinatore. Esegui /distill su un batch di conversazioni, includendo un numero sufficiente di sessioni per riprodurre il limite di contesto. Il lavoro è completato quando i sub-agents scrivono direttamente nel journal, restituiscono solo brevi riepiloghi e l'intero flusso di distillation e aggiornamento viene completato senza un errore "Prompt is too long".
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
I have 10-25 Claude Code sessions/day. Today, the /distill skill's coordinator session started hitting "Prompt is too long" during the end-of-day/memory-maintenance runs — every API call after sub-agents completed returned this error, making the session completely unresponsive.
In my case, sub-agents were returning ~25-37KB of JSON each. With 18+ conversations to process, the accumulated results in the coordinator's context (~630KB / ~164K tokens estimated) plus the system prompt exceeded the context limit.
Root cause
Claude and I did some debugging and our understanding of the current flow is:
- Coordinator spawns sub-agents in parallel
- Each sub-agent reads a conversation, extracts JSON, returns it to the coordinator
- Coordinator collects all results, then writes to journal
Step 2 seems like the problem. All returned results accumulate in the coordinator's context. Claude Code context is append-only until compaction — there's no way to discard results between turns. The more conversations you have, the more result data piles up.
Fix attempted
Have sub-agents write directly to the journal via log_journal() instead of returning results to the coordinator. Each sub-agent returns only a short summary string (e.g., "Wrote 3 actions, 2 facts, 1 decision to journal.").
The coordinator then reads from the journal (get_recent_journal) when it needs the data for entity/state file updates.
Before: sub-agent → returns 35KB JSON → coordinator writes to journal
After: sub-agent → writes to journal directly → returns ~50 bytes
Tested
Patched locally and ran against 25 conversations without issue. Previously failed with 18 "Prompt is too long" results. All 25 conversations completed successfully — distillation, state file updates, entity updates, index maintenance finished without hitting context limits.
Proposed changes to skills/distill/SKILL.md
- Sub-agent prompt: instead of "Extract and return as JSON", instruct to call
log_journal()directly with topicsdistilled,distilled-fact,distilled-decision - Sub-agent prompt: "Return ONLY a short summary line" instead of "Return ONLY the JSON"
- Step 3 (Collect): coordinator reads from journal instead of parsing returned JSON
- Add note: "Sub-agents MUST write to journal themselves and return only a short summary"
Happy to open a PR with the full SKILL.md change if this approach looks good.
- Lingua principale
- TypeScript
- Stelle
- 119
- Fork
- 6
- Merge medio
- 1h 32m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 ascorbic/macrodata
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Support Cursor Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di ascorbic/macrodata
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
danielmiessler/LifeOS#2218 ·