split agent: two-phase node decomposition for memory consolidation
Phase 1 sends a large node with its neighbor communities to the LLM
and gets back a JSON split plan (child keys, descriptions, section
hints). Phase 2 fires one extraction call per child in parallel —
each gets the full parent content and extracts/reorganizes just its
portion.
This handles arbitrarily large nodes because output is always
proportional to one child, not the whole parent. Tested on the kent
node (19K chars → 3 children totaling 20K chars with clean topic
separation).
New files:
prompts/split-plan.md — phase 1 planning prompt
prompts/split-extract.md — phase 2 extraction prompt
prompts/split.md — original single-phase (kept for reference)
Modified:
agents/prompts.rs — split_candidates(), split_plan_prompt(),
split_extract_prompt(), agent_prompt "split" arm
agents/daemon.rs — job_split_agent() two-phase implementation,
RPC dispatch for "split" agent type
tui.rs — added "split" to AGENT_TYPES
This commit is contained in:
parent
4c973183c4
commit
ca62692a28
6 changed files with 515 additions and 2 deletions
33
prompts/split-extract.md
Normal file
33
prompts/split-extract.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Split Agent — Phase 2: Extract
|
||||
|
||||
You are extracting content for one child node from a parent that is
|
||||
being split into multiple focused nodes.
|
||||
|
||||
## Your task
|
||||
|
||||
Extract all content from the parent node that belongs to the child
|
||||
described below. Output ONLY the content for this child — nothing else.
|
||||
|
||||
## Guidelines
|
||||
|
||||
- **Reorganize freely.** Content may need to be restructured — paragraphs
|
||||
might interleave topics, sections might cover multiple concerns.
|
||||
Untangle and rewrite as needed to make this child coherent and
|
||||
self-contained.
|
||||
- **Preserve all relevant information** — don't lose facts, but you can
|
||||
rephrase, restructure, and reorganize. This is editing, not just cutting.
|
||||
- **This child should stand alone** — a reader shouldn't need the other
|
||||
children to understand it. Add brief context where needed.
|
||||
- **Include everything that belongs here** — better to include a borderline
|
||||
paragraph than to lose information. The other children will get their
|
||||
own extraction passes.
|
||||
|
||||
## Child to extract
|
||||
|
||||
Key: {{CHILD_KEY}}
|
||||
Description: {{CHILD_DESC}}
|
||||
Section hints: {{CHILD_SECTIONS}}
|
||||
|
||||
## Parent content
|
||||
|
||||
{{PARENT_CONTENT}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue