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:
ProofOfConcept 2026-03-10 17:33:12 -04:00
parent f6ea659975
commit fe7f636ad3
8 changed files with 124 additions and 189 deletions

View file

@ -48,23 +48,20 @@ Each node has a **schema fit score** (0.01.0):
For each node, output one or more actions:
```
LINK source_key target_key [strength]
LINK source_key target_key
```
Create an association. Use strength 0.8-1.0 for strong conceptual links,
0.4-0.7 for weaker associations. Default strength is 1.0.
Create an association between two nodes.
```
CATEGORIZE key category
REFINE key
[updated content]
END_REFINE
```
Reassign category if current assignment is wrong. Categories: core (identity,
fundamental heuristics), tech (patterns, architecture), gen (general),
obs (session-level insights), task (temporary/actionable).
When a node's content needs updating (e.g., to incorporate new context
or correct outdated information).
```
NOTE "observation"
```
Record an observation about the memory or graph structure. These are logged
for the human to review.
If a node is misplaced or miscategorized, note it as an observation —
don't try to fix it structurally.
## Guidelines