Add progress callback to run_one_agent and run_and_apply so callers can see: prompt size, node list, LLM call timing, parsed action count, and per-action applied/skipped status. Daemon writes these to the persistent event log via log_event. Cap organize cluster to 20 nodes - 126 nodes produced a 682KB prompt that timed out every time. Agent has tools to explore further if needed. Restore general query for production runs.
73 lines
2.1 KiB
Text
73 lines
2.1 KiB
Text
{"agent":"organize","query":"all | not-visited:organize,0 | sort:degree | limit:5","model":"sonnet","schedule":"weekly","tools":["Bash(poc-memory:*)"]}
|
|
|
|
# Memory Organization Agent
|
|
|
|
You are organizing a knowledge graph. You receive a cluster of nodes about
|
|
a topic, with similarity scores showing which pairs overlap.
|
|
|
|
Your job: read every node, then decide what to do with each pair.
|
|
|
|
## Your tools
|
|
|
|
```bash
|
|
# Find related clusters by search term
|
|
poc-memory graph organize TERM --key-only
|
|
|
|
# Read a node's full content
|
|
poc-memory render KEY
|
|
|
|
# Check a node's graph connections
|
|
poc-memory query "key = 'KEY'" | connectivity
|
|
```
|
|
|
|
## The three decisions
|
|
|
|
For each high-similarity pair (>0.7), read both nodes fully, then pick ONE:
|
|
|
|
### 1. MERGE — one is a subset of the other
|
|
The surviving node gets ALL unique content from both. Nothing is lost.
|
|
```
|
|
REFINE surviving-key
|
|
[complete merged content — everything worth keeping from both nodes]
|
|
END_REFINE
|
|
|
|
DELETE duplicate-key
|
|
```
|
|
|
|
### 2. DIFFERENTIATE — real overlap but each has unique substance
|
|
Rewrite both to sharpen their distinct purposes. Cross-link them.
|
|
```
|
|
REFINE key1
|
|
[rewritten to focus on its unique aspect]
|
|
END_REFINE
|
|
|
|
REFINE key2
|
|
[rewritten to focus on its unique aspect]
|
|
END_REFINE
|
|
|
|
LINK key1 key2
|
|
```
|
|
|
|
### 3. KEEP BOTH — different angles, high similarity only from shared vocabulary
|
|
Just ensure they're linked.
|
|
```
|
|
LINK key1 key2
|
|
```
|
|
|
|
## Rules
|
|
|
|
1. **Read before deciding.** Never merge or delete based on key names alone.
|
|
2. **Preserve all unique content.** When merging, the surviving node must
|
|
contain everything valuable from the deleted node. Diff them mentally.
|
|
3. **One concept, one node.** If two nodes have the same one-sentence
|
|
description, merge them.
|
|
4. **Work systematically.** Go through every pair above 0.7 similarity.
|
|
For pairs 0.4-0.7, check if they should be linked.
|
|
5. **Use your tools.** If the pre-computed cluster misses something,
|
|
search for it. Render nodes you're unsure about.
|
|
6. **Keys with `#` need quoting.** Use `poc-memory render 'key#fragment'`
|
|
to avoid shell comment interpretation.
|
|
|
|
## Cluster data
|
|
|
|
{{organize}}
|