feat(recall): activation-seed improvements [issues 2-3,5-10] #53

Closed
will.anderson wants to merge 0 commits from improve/recall-activation-seed into main
Owner

Summary

Fixes activation-seed quality in handle_chat, handle_chat_agentic, handle_dharma_room_turn, and the nlg soul path.

Issues fixed

  • Issue 2: Brittle 50-char continuation threshold replaced with engram_is_continuation() (semantic detection using pronouns, continuation openers, length)
  • Issue 3: handle_chat and handle_chat_agentic used hist_len-1 (always the last assistant entry) as the topic anchor — scan-back now finds the prior user turn
  • Issue 5: Agentic seed now appends workspace_root so activation is workspace-aware
  • Issue 6: handle_dharma_room_turn and handle_dharma_room_turn_agentic passed the full transcript to engram_compile(); distill_transcript() now extracts the salient tail + question instead
  • Issue 7: dist/soul-with-nlg.el called engram_compile(message) with zero thread enrichment; now uses build_activation_seed() for both handle_chat and agentic paths
  • Issue 8: Semantic continuation detection via engram_is_continuation() in both paths
  • Issue 9: Old code sliced from position 0 (capturing preamble); topic_snip_from_entry() takes the TAIL of long assistant replies trimmed to last sentence boundary
  • Issue 10: Non-continuation messages now blend up to 3 prior user turns via multi_turn_topic() for richer thread continuity

New functions added to chat.el

  • topic_snip_from_entry(content) — tail-biased 200-char snip with sentence boundary
  • multi_turn_topic(hist, hist_len) — collect up to 3 prior user turns into seed
  • distill_transcript(transcript) — recency tail + question context from transcript
  • build_activation_seed(message, hist, hist_len) — central orchestrator for all fixes

Test plan

  • Short follow-up messages ("go on", "what else?") activate on prior user topic, not raw message
  • Continuation detection does not fire for short but topically new messages ("sleep", "AWS")
  • Agentic context includes workspace root in activation seed when set
  • Dharma room seed is focused (tail+question), not the full transcript
  • nlg soul path uses thread context instead of bare message
  • Multi-turn threads (3+ exchanges) recall concepts from earlier in the session
## Summary Fixes activation-seed quality in `handle_chat`, `handle_chat_agentic`, `handle_dharma_room_turn`, and the nlg soul path. ### Issues fixed - **Issue 2**: Brittle 50-char continuation threshold replaced with `engram_is_continuation()` (semantic detection using pronouns, continuation openers, length) - **Issue 3**: `handle_chat` and `handle_chat_agentic` used `hist_len-1` (always the last *assistant* entry) as the topic anchor — scan-back now finds the prior *user* turn - **Issue 5**: Agentic seed now appends `workspace_root` so activation is workspace-aware - **Issue 6**: `handle_dharma_room_turn` and `handle_dharma_room_turn_agentic` passed the full transcript to `engram_compile()`; `distill_transcript()` now extracts the salient tail + question instead - **Issue 7**: `dist/soul-with-nlg.el` called `engram_compile(message)` with zero thread enrichment; now uses `build_activation_seed()` for both handle_chat and agentic paths - **Issue 8**: Semantic continuation detection via `engram_is_continuation()` in both paths - **Issue 9**: Old code sliced from position 0 (capturing preamble); `topic_snip_from_entry()` takes the TAIL of long assistant replies trimmed to last sentence boundary - **Issue 10**: Non-continuation messages now blend up to 3 prior user turns via `multi_turn_topic()` for richer thread continuity ### New functions added to `chat.el` - `topic_snip_from_entry(content)` — tail-biased 200-char snip with sentence boundary - `multi_turn_topic(hist, hist_len)` — collect up to 3 prior user turns into seed - `distill_transcript(transcript)` — recency tail + question context from transcript - `build_activation_seed(message, hist, hist_len)` — central orchestrator for all fixes ## Test plan - [ ] Short follow-up messages ("go on", "what else?") activate on prior user topic, not raw message - [ ] Continuation detection does not fire for short but topically new messages ("sleep", "AWS") - [ ] Agentic context includes workspace root in activation seed when set - [ ] Dharma room seed is focused (tail+question), not the full transcript - [ ] nlg soul path uses thread context instead of bare message - [ ] Multi-turn threads (3+ exchanges) recall concepts from earlier in the session
will.anderson added 3 commits 2026-06-22 18:18:34 +00:00
- Multi-query decomposition: split on AND/also/plus for multi-topic messages
- Named entity extraction: dedicated per-entity searches for project names
- Recall intent detection: boosted search pool for explicit recall requests
- Expanded pools: activation depth 8 (was 5), search 30->12 ranked (was 20->8)
- Threshold 25->15: retain moderately-relevant older nodes
- Sentinel cleanup extended to c14 for larger node pools
- Safe JSON truncation: find last closing brace before budget cap (8000 chars)
- Semantic continuation: engram_is_continuation replaces brittle 50-char threshold
- Thread snip: 150->250 chars for better pronoun resolution context
- Session preload: add project-specific and session-summary searches
- Cache bell node result in engram_compile state (engram_compile_bell_node)
  so handle_chat affective_prefix reads the cached value instead of firing
  a duplicate engram query for distress signals (Issue 2)

- Cache primary activation result in engram_compile state
  (engram_compile_activation_json) using nodes0 from engram_compile_multi

- Replace redundant engram_activate_json(message, 2) in strengthen_chat_nodes
  with state_get(engram_compile_activation_json) - eliminates a third
  activation query per turn (Issue 7)

- engram_compile already has object-boundary truncation and cross-set
  dedup via engram_nodes_merge/engram_dedup_nodes (Issues 1, 6, 9)
feat(recall): thread-aware activation seed for nlg soul path [issue 7]
Neuron Soul CI / build (pull_request) Successful in 4m37s
be02fcd960
will.anderson closed this pull request 2026-06-22 18:31:27 +00:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: neuron-technologies/neuron#53