agents: extract shared run_one_agent, standardize output formats
Three places duplicated the agent execution loop (build prompt → call LLM → store output → parse actions → record visits): consolidate.rs, knowledge.rs, and daemon.rs. Extract into run_one_agent() in knowledge.rs that all three now call. Also standardize consolidation agent prompts to use WRITE_NODE/LINK/REFINE — the same commands the parser handles. Previously agents output CATEGORIZE/NOTE/EXTRACT/DIGEST/DIFFERENTIATE/MERGE/COMPRESS which were silently dropped after the second-LLM-call removal.
This commit is contained in:
parent
f6ea659975
commit
fe7f636ad3
8 changed files with 124 additions and 189 deletions
|
|
@ -63,42 +63,29 @@ These patterns, once extracted, help calibrate future emotional responses.
|
|||
## What to output
|
||||
|
||||
```
|
||||
EXTRACT key topic_file.md section_name
|
||||
WRITE_NODE key
|
||||
CONFIDENCE: high|medium|low
|
||||
COVERS: source_episode_key1, source_episode_key2
|
||||
[extracted pattern or insight]
|
||||
END_NODE
|
||||
```
|
||||
Move a specific insight from an episodic entry to a semantic topic file.
|
||||
The episode keeps a link back; the extracted section becomes a new node.
|
||||
Create a new semantic node from patterns found across episodes. Always
|
||||
LINK it back to the source episodes. Choose a descriptive key like
|
||||
`patterns#lock-ordering-asymmetry` or `skills#btree-error-checking`.
|
||||
|
||||
```
|
||||
DIGEST "title" "content"
|
||||
```
|
||||
Create a digest that synthesizes multiple episodes. Digests are nodes in
|
||||
their own right, with type `episodic_daily` or `episodic_weekly`. They
|
||||
should:
|
||||
- Capture what happened across the period
|
||||
- Note what was learned (not just what was done)
|
||||
- Preserve emotional highlights (peak moments, not flat summaries)
|
||||
- Link back to the source episodes
|
||||
|
||||
A good daily digest is 3-5 sentences. A good weekly digest is a paragraph
|
||||
that captures the arc of the week.
|
||||
|
||||
```
|
||||
LINK source_key target_key [strength]
|
||||
LINK source_key target_key
|
||||
```
|
||||
Connect episodes to the semantic concepts they exemplify or update.
|
||||
|
||||
```
|
||||
COMPRESS key "one-sentence summary"
|
||||
REFINE key
|
||||
[updated content]
|
||||
END_REFINE
|
||||
```
|
||||
When an episode has been fully extracted (all insights moved to semantic
|
||||
nodes, digest created), propose compressing it to a one-sentence reference.
|
||||
The full content stays in the append-only log; the compressed version is
|
||||
what the graph holds.
|
||||
|
||||
```
|
||||
NOTE "observation"
|
||||
```
|
||||
Meta-observations about patterns in the consolidation process itself.
|
||||
When an existing semantic node needs updating with new information from
|
||||
recent episodes, or when an episode has been fully extracted and should
|
||||
be compressed to a one-sentence reference.
|
||||
|
||||
## Guidelines
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue