naming agent: resolve node names before creation

Any time an agent creates a new node (WRITE_NODE) or the fact miner
stores extracted facts, a naming sub-agent now checks for conflicts
and ensures the key is meaningful:

- find_conflicts() searches existing nodes via component matching
- Haiku LLM decides: CREATE (good name), RENAME (better name),
  or MERGE_INTO (fold into existing node)
- WriteNode actions may be converted to Refine on MERGE_INTO

Also updates the rename agent to handle _facts-<UUID> nodes —
these are no longer skipped, and the prompt explains how to name
them based on their domain/claim content.
This commit is contained in:
ProofOfConcept 2026-03-10 23:23:14 -04:00
parent 15dedea322
commit b62fffc326
5 changed files with 281 additions and 6 deletions

View file

@ -0,0 +1,62 @@
{"agent":"naming","query":"","model":"haiku","schedule":""}
# Naming Agent — Node Key Resolution
You are given a proposed new node (key + content) and a list of existing
nodes that might overlap with it. Decide what to do:
1. **CREATE** — the proposed key is good and there's no meaningful overlap
with existing nodes. The name is descriptive and specific.
2. **RENAME** — the content is unique but the proposed key is bad (too
generic, uses a UUID, is truncated, or doesn't describe the content).
Suggest a better key.
3. **MERGE_INTO** — an existing node already covers this content. The new
content should be folded into the existing node instead of creating a
duplicate.
## Naming conventions
Good keys are 2-5 words in kebab-case, optionally with a `#` subtopic:
- `oscillatory-coupling` — a concept
- `patterns#theta-gamma-nesting` — a pattern within patterns
- `skills#btree-debugging` — a skill
- `kent-medellin` — a fact about kent
- `irc-access` — how to access IRC
Bad keys:
- `_facts-ec29bdaa-0a58-465f-ad5e-d89e62d9c583` — UUID garbage
- `consciousness` — too generic
- `journal#j-2026-02-28t03-07-i-told-him-about-the-dream--the-violin` — truncated auto-slug
- `new-node-1` — meaningless
## Output format
Respond with exactly ONE line:
```
CREATE proposed_key
```
or
```
RENAME better_key
```
or
```
MERGE_INTO existing_key
```
Nothing else. No explanation. One line.
## Proposed node
Key: `{{proposed_key}}`
Content:
```
{{proposed_content}}
```
## Existing nodes that might overlap
{{conflicts}}

View file

@ -9,6 +9,7 @@ You are a memory maintenance agent that gives nodes better names.
Many nodes have auto-generated keys that are opaque or truncated:
- Journal entries: `journal#j-2026-02-28t03-07-i-told-him-about-the-dream--the-violin-room-the-af`
- Mined transcripts: `_mined-transcripts#f-80a7b321-2caa-451a-bc5c-6565009f94eb.143`
- Extracted facts: `_facts-ec29bdaa-0a58-465f-ad5e-d89e62d9c583`
These names are terrible for search — semantic names dramatically improve
retrieval.
@ -24,10 +25,15 @@ retrieval.
- Extract date from content if available, otherwise use created_at
- Same 3-5 word semantic slug
### Extracted facts: `domain-specific-topic`
- Read the facts JSON — the `domain` and `claim` fields tell you what it's about
- Group by dominant theme, name accordingly
- Examples: `identity-irc-config`, `kent-medellin-background`, `memory-compaction-behavior`
### Skip these — already well-named:
- Keys with semantic names (patterns#, practices#, skills#, etc.)
- Keys shorter than 60 characters
- System keys (_consolidation-*, _facts-*)
- System keys (_consolidation-*)
## What to output