Skip to content

Add InformationNode for conversational memory#9

Open
shreyasrajesh0308 wants to merge 6 commits into
mainfrom
feature/conversational-information-nodes
Open

Add InformationNode for conversational memory#9
shreyasrajesh0308 wants to merge 6 commits into
mainfrom
feature/conversational-information-nodes

Conversation

@shreyasrajesh0308

Copy link
Copy Markdown
Collaborator

Summary

  • Adds InformationNode and EntityMention models alongside existing VerbPhraseNode (backwards compatible)
  • Extends Question with optional speaker_id and evidence_turn_ids fields
  • Adds CONVERSATIONAL prompt type with two-stage extraction prompts (Stage 1: info unit identification, Stage 2: entity + QA pair extraction)
  • Updates reconciler to handle InformationNode ID remapping and entity reference reconciliation
  • InformationNodes are never merged across sessions — only entity IDs get reconciled

Test plan

  • All 56 existing tests pass (no regressions)
  • ruff check src/ passes
  • ruff format --check src/ passes
  • Integration test with conversational data (in gsw-personal-memory pilot)

🤖 Generated with Claude Code

shreyasrajesh0308 and others added 5 commits March 16, 2026 17:30
Introduces InformationNode (entity clique + QA pairs grounded in communicated
information) alongside existing VerbPhraseNode. Extends Question with optional
speaker_id and evidence_turn_ids. Updates GSWStructure with information_nodes
field and management methods (add, get, search, merge, copy, connectivity).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stage 1: Identify discrete information units from conversation sessions.
Stage 2: Extract entities + generate hybrid QA pairs (basics + model-generated)
per information unit. Designed for conversational memory where verb-phrase
anchoring produces unusable QA pairs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Handles information nodes in _prepare_new_gsw (ID remapping, entity mention
updates), branches in reconcile() for information_nodes vs verb_phrase_nodes,
and adds _update_information_node_answers + _add_information_nodes helpers.
InformationNodes are never merged across sessions — only entity references
get reconciled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: Stage 2 included <full_session> which caused the LLM to extract
entities from the entire conversation instead of just the info unit's source
turns. This led to entity ID cross-contamination across info units.

Changes:
- Remove <full_session> from Stage 2 prompt
- Add <known_entities> block for within-session ID reuse
- Add explicit scoping rules in system prompt
- Require TEXT: prefix for all non-entity answers
- Clarify ID collision avoidance for new entities

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shreyasrajesh0308
shreyasrajesh0308 force-pushed the feature/conversational-information-nodes branch from bfcb49a to b85679d Compare March 17, 2026 00:30
@github-actions

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

- Reframe Stage 2 as situation-guided: the information unit description
  defines scope, source turns are just evidence. Entities and QA pairs
  are only extracted if relevant to the described situation.
- Add Task 3 (Spatio-Temporal Grounding): LLM resolves relative time
  references against session timestamp and extracts location.
- Add session_timestamp template variable to Stage 2 prompt.
- Add location field to InformationNode model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant