Repository navigation
Description
Summary
Implement per-client structured memory that accumulates over time through agent interactions. Each agent builds a profile of each client it communicates with — preferences, communication style, past decisions, recurring requests — and this profile is injected into context on subsequent conversations.
Context
Current Trinity agents start every conversation from zero. A business agent that talked to a client last week about email campaigns has no recollection of that conversation's conclusions. Chat history exists in the database, but raw message logs are not the same as distilled client knowledge. This is the difference between a chatbot and a business partner.
Related existing issues:
- MEMORY.md Convention #33 (MEMORY.md Convention) — general agent memory structure
- Memory Folding #21 (Memory Folding) — compressing old context
- Vectorized Episodic Memory #39 (Vectorized Episodic Memory) — semantic search over history
This issue is specifically about structured client profiles, not general agent memory.
Requirements
Client Profile Schema
Per agent-client pair, maintain a structured profile:
client_id: "[email protected]"
agent_name: "sales-agent"
first_contact: "2025-01-15"
last_contact: "2025-02-20"
interaction_count: 47
preferences:
communication_style: "concise, bullet points preferred"
timezone: "EST"
response_format: "summaries with action items"
learned_facts:
- "Prefers invoices sent on Fridays"
- "Email campaigns should use casual tone"
- "Reports to VP of Marketing (Sarah)"
- "Q2 budget approved for $50k"
active_context:
current_projects:
- "Q2 email campaign redesign"
- "Website copy refresh"
pending_decisions:
- "Choose between Template A and B for newsletter"
deadlines:
- "Campaign launch: March 15"
interaction_summary:
topics_discussed: ["email campaigns", "brand voice", "analytics"]
decisions_made:
- date: "2025-02-10"
decision: "Switch to weekly newsletter cadence"
- date: "2025-02-18"
decision: "Use Template A for product announcements"Profile Accumulation
- After each conversation, the agent (or a post-processing step) extracts and updates the client profile
- Extraction should be LLM-powered: summarize new facts, update preferences, note decisions
- Profile updates are additive — new facts added, contradictions resolved (latest wins)
- Rate-limited: don't re-process on every single message, batch per session close or periodically
Context Injection
- When a client messages an agent (via any channel), inject a condensed profile summary into the system prompt
- Token budget: profile summary should fit in ~500-1000 tokens
- Include: key preferences, active projects, recent decisions, pending items
- Exclude: full interaction history (that's what chat sessions are for)
Storage
- Store profiles in agent filesystem (
/home/developer/memory/clients/) for agent-local access - Mirror to platform database for cross-agent visibility and backup
- Consider: should profiles be shared between agents owned by the same user? (configurable)
API Endpoints
GET /api/agents/{name}/clients— List known clientsGET /api/agents/{name}/clients/{email}/profile— Get client profilePUT /api/agents/{name}/clients/{email}/profile— Manual profile updatePOST /api/agents/{name}/clients/{email}/profile/extract— Trigger extraction from recent sessionsDELETE /api/agents/{name}/clients/{email}/profile— Clear profile
Acceptance Criteria
- Client profile schema defined and documented
- Profiles persist in agent filesystem and platform database
- LLM-powered extraction updates profiles after session close
- Profile summary injected into context for returning clients
- API endpoints for CRUD operations on profiles
- Profile injection works across channels (Slack, public chat, dashboard)
- Profiles respect agent boundaries (agent A's profile of a client is separate from agent B's)
Non-Goals
- No UI for browsing/editing client profiles (API-only for now)
- No cross-agent profile sharing in MVP (flag it as future)
- No vector/semantic search over profiles (see Vectorized Episodic Memory #39)
Activity
vybe commentedon Mar 30, 2026
Actualization (2026-03-30)
Current state: Partially addressed by MEM-001 (#147):
(agent_name, user_email), injected into every agent call, updated via background summarization every 5 messagespublic_user_memorytable stores structured text blobs per user-agent pairGap vs. this issue:
Recommendation: Keep open. MEM-001 is a foundation. This issue's value is the structured profile concept (vs. raw text blob) and extending it to authenticated sessions.
chore(.claude): bump the submodule pointer to main (f7ff3e7 -> 60ddc16)
chore(.claude): bump the submodule pointer to main (f7ff3e7 -> 60ddc1…