Skip to content

Commit 130a76e

Browse files
vsumnerjamiepine
authored andcommitted
feat(memory): add participant context foundation
1 parent 4b2f0d7 commit 130a76e

16 files changed

Lines changed: 884 additions & 153 deletions

File tree

docs/design-docs/participant-awareness.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ The participant summary loop would then use the canonical user ID for memory rec
253253

254254
## Configuration
255255

256+
The current codebase already has a smaller `ParticipantContextConfig` runtime surface for prompt-time rendering and a per-channel active participant map. The config below is still the intended full-pipeline target once summary generation and persistence land.
257+
256258
```rust
257259
pub struct ParticipantConfig {
258260
pub enabled: bool, // default: true

docs/design-docs/working-memory.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ Per-user context injected when specific users are active in the current channel.
350350

351351
### Relationship to existing designs
352352

353-
This layer is the `participant-awareness.md` design, integrated into the layered context assembly. The design is unchanged -- `humans` table, cortex-generated summaries, cached and injected when `participants.len() >= min_participants`. The only change is its position in the prompt (it moves from "after Memory Context" to its own layer in the new assembly order).
353+
The long-term target for this layer is still the `participant-awareness.md` design, but the current implementation is a lighter config-backed variant. The channel now maintains a per-session active participant map keyed by canonical human ID when available and by `platform:sender_id` otherwise. Prompt rendering reads from that tracked participant set, matches known humans against configured `HumanDef` entries, and renders the available profile fields (`display_name`, `role`, `description` / `bio`) inline. There is still no dedicated `humans` table or cortex-generated participant summary cache on the current code path yet.
354354

355-
If user-scoped memories lands first, the `humans` table merges with `user_identifiers` as described in that design doc. The working memory system does not depend on which identity table is canonical.
355+
If user-scoped memories or the full participant-awareness pipeline lands later, this layer can switch to that richer source without changing the prompt shape. The working memory system does not depend on which identity store is canonical.
356356

357357
### Enhancement: Recent Activity Per User
358358

@@ -370,9 +370,9 @@ The participant summary (2-3 sentences about who this person is) is augmented wi
370370
Recent: asked about Docker runtime deps in #talk-to-spacebot 10m ago.
371371
```
372372

373-
The "Recent:" line is programmatic -- a query against `working_memory_events WHERE user_id = X ORDER BY timestamp DESC LIMIT 3`. The summary paragraph is the cached cortex-generated profile from the participant-awareness design. No additional LLM call.
373+
The "Recent:" line is programmatic -- a query against `working_memory_events WHERE user_id = X ORDER BY timestamp DESC LIMIT 3`. The profile paragraph currently comes from configured human metadata when available. No additional LLM call.
374374

375-
**Token budget:** Configurable, default 400 tokens. Max 5 participants rendered. In a 50-person channel, only the 5 most recently active participants get profiles.
375+
**Token budget:** Configurable via the dedicated participant-context config, default 400 tokens. Max 5 participants rendered. In a 50-person channel, only the 5 most recently active participants get profiles.
376376

377377
---
378378

prompts/en/channel.md.j2

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ When in doubt, skip. Being a lurker who speaks when it matters is better than be
159159
{{ project_context }}
160160
{%- endif %}
161161

162+
{%- if working_memory %}
163+
{{ working_memory }}
164+
{%- endif %}
165+
166+
{%- if channel_activity_map %}
167+
{{ channel_activity_map }}
168+
{%- endif %}
169+
170+
{%- if participant_context %}
171+
{{ participant_context }}
172+
{%- endif %}
173+
162174
{%- if knowledge_synthesis %}
163175
## Knowledge Context
164176

@@ -171,14 +183,6 @@ When in doubt, skip. Being a lurker who speaks when it matters is better than be
171183
{{ memory_bulletin }}
172184
{%- endif %}
173185

174-
{%- if working_memory %}
175-
{{ working_memory }}
176-
{%- endif %}
177-
178-
{%- if channel_activity_map %}
179-
{{ channel_activity_map }}
180-
{%- endif %}
181-
182186
{%- if conversation_context %}
183187
## Conversation Context
184188

0 commit comments

Comments
 (0)