Skip to content

Multi-tenant program management: per-user stateful programs with reactive + proactive control #1207

@vybe

Description

@vybe

Summary

Let an agent run a structured, stateful program for each of many users in a multi-tenant fashion — each user enrolled in their own program, progressing through stages over days/months/years. The agent advances a user's program both reactively (in conversation) and proactively (scheduled program reviews + playbook-driven updates pushed to the user's channel). Per-user program state ("user memory") lives in Trinity, not inside the agent, so it survives reset/redeploy/deletion and can move between agents.

Context

Generalizes the existing per-user memory primitive (MEM-001, #888) from a flat blob to structured, stage-aware program state. Multi-user channel access (Slack/Telegram/WhatsApp/web), verified-email identity (#311), proactive messaging, and capacity-gated dispatch already exist; this composes them into a program engine. Preferred implementation is a purpose-built native (non-Docker) runtime rather than per-agent Claude Code logic — see #1206.

Acceptance Criteria

  • Data model: programs (definition: stages, per-stage skill, review cadence, advance criteria), program_enrollments (one per user per program: current_stage, status, next_review_at, state_json), program_events (append-only per-user timeline)
  • Reactive path: extend the message_router injection seam to load + inject a user's program context into the execution at conversation time
  • Proactive path: a due-date sweep service that finds enrollments due for review and dispatches one execution per user carrying that user's context; agent advances/nudges/escalates and messages the user on their originating channel
  • Control surface: enroll_user, get_program_enrollment, update_program_state, advance_program_stage, list_enrollments (cohort), record_program_event
  • Operator "Programs" view: cohort funnel (users per stage), stalled/overdue list, per-user timeline
  • Identity keyed on verified email; auto-enroll on first verified contact gated by access policy
  • Cost controls at scale: staggered next_review_at, capacity backpressure, model tiering (cheap routine reviews, escalate on state change)

Technical Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-highComplexity: high (board points 13)priority-p2Importantstatus-incubatingIdea under consideration — pre-Todo, not yet greenlit for developmenttheme-channelsTheme: Channelstype-featureNew functionality

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions