Skip to content

LLM-driven conversation summarization #8

@jeremiepas

Description

@jeremiepas

Problem

ConversationNode.convSummary is empty when reconstructed from graph nodes. Without summaries, conversation_history returns raw question text only. Summaries enable compact context for future queries and semantic search over past answers.

The LLM client (Infrastructure.LLM.OpenAI) already exists but isn't wired to conversation creation.

Solution

Wire Infrastructure.LLM.OpenAI to conversation creation. When add_conversation is called with an empty answer_summary:

  1. Generate summary via LLM (gpt-4o-mini or local model)
  2. Store summary in ConversationNode
  3. Save to disk

Fallback: if no LLM available, use question text as summary.

Configuration (graphos.yaml):

summarization:
  provider: openai  # openai | ollama | none
  model: gpt-4o-mini
  api_key: "${OPENAI_API_KEY}"
  max_tokens: 100

Acceptance Criteria

  • add_conversation with empty summary triggers LLM summarization
  • Fallback: without LLM, summary = question text
  • SummarizationConfig in graphos.yaml and PipelineConfig
  • Test: mock LLM returns predictable summary
  • Test: no-LLM fallback uses question text

Files to Modify

  • src/Graphos/UseCase/Conversation.hs — add summarizeConversationWithLLM
  • src/Graphos/Infrastructure/Server/MCP.hs — wire summarization to add_conversation
  • src/Graphos/Domain/Config.hs — add SummarizationConfig
  • src/Graphos/Infrastructure/Config.hs — parse summarization config from YAML

Effort: 1-2 days

Priority: High

See: docs/proposals/memory-agent/05-technical-specifications.md (Spec 4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmemory-agentMemory agent capabilitiesphase-3Phase 3: LLM Summarization + Temporal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions