Generalize Memory identity for multi-agent support

t-501·WorkTask·
·
·
Created3 weeks ago·Updated3 weeks ago

Description

Edit

Generalize Memory identity to support non-Telegram agents.

Problem

Memory.hs and MemorySources.hs are tied to Telegram-specific identity:

  • user_id is a Telegram user UUID
  • chat_id is a Telegram chat ID (Int)
  • MemorySources functions require these specific types

Solution

Introduce a generic MemoryIdentity type:

data MemoryIdentity = MemoryIdentity
  { miOwner :: Text    -- who owns this data (user, org, agent)
  , miContext :: Text  -- session/conversation context
  }
  • Telegram: MemoryIdentity telegramUserId ("telegram:" <> show chatId)
  • CLI: MemoryIdentity "ben" "cli:session-123"
  • agentd: MemoryIdentity "system" ("agentd:" <> runId)

Changes

1. Add MemoryIdentity type to Memory.hs 2. Update MemorySources to accept MemoryIdentity 3. Update buildHydrationConfig signature 4. Update Telegram.hs to construct MemoryIdentity 5. Create memory.md skill for active memory use

Non-goals (for now)

  • Schema migration (keep existing columns, just use them more flexibly)
  • Provider abstraction (separate task t-500)

Timeline (4)

🔄[human]Open → InProgress3 weeks ago
💬[human]3 weeks ago

Phase 1 complete (commit 88e8ff3): MemoryIdentity abstraction.

Done:

  • MemoryIdentity type with owner + context fields
  • MemorySources uses MemoryIdentity (not userId/chatId)
  • Telegram.hs constructs MemoryIdentity

Remaining for full multi-agent support:

  • Create memory.md skill for active memory use
  • Wire up CLI/agentd agents with memory identity
  • Test with non-Telegram agents
🔄[human]InProgress → Done3 weeks ago