Skip to content

Add bidirectional conversation-code reverse index #11

Description

@jeremiepas

Problem

Conversation edges are one-way: conversation → code. There are no back-edges from code nodes to conversations that reference them. When exploring a code node, you can't find "which conversations discussed this?" without a full graph scan.

Solution

Build a reverse index: Map NodeId [ConversationId] that maps each code node to the conversations that reference it.

New function:

conversationsForNode :: NodeId -> Graph -> [ConversationNode]
-- Find all conversations that reference this code node

Use in select_context:

When selecting context for a query, boost nodes that have recent conversations associated with them. This creates a feedback loop: frequently discussed code gets higher relevance.

Acceptance Criteria

  • Reverse index: Map NodeId [ConversationId]
  • conversationsForNode returns all conversations referencing a code node
  • select_context boosts nodes with recent conversations
  • Reverse index updated when add_conversation is called

Files to Modify

  • src/Graphos/UseCase/Conversation.hs — add conversationsForNode
  • src/Graphos/UseCase/SelectContext.hs — boost nodes with conversations
  • src/Graphos/Infrastructure/Server/MCP.hs — maintain reverse index

Effort: 0.5 days

Priority: Low

See: docs/proposals/memory-agent/02-gap-analysis.md (Gap 7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmemory-agentMemory agent capabilitiesphase-4Phase 4: Incremental Mutation + MCP Tools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions