Skip to main content

Persona Manager (archived 2026-05-25 โ€” pre-Tavus-rename snapshot)

๐Ÿ—„๏ธ Archived 2026-05-25. These docs describe the persona-manager module as of 2026-05-25, mid-rename to Tavus Manager (tracked in #630 / #632). The content is frozen on this archive path; do not edit it in place. Live docs will be added under docs/tavus/ (or the equivalent post-rename location) when the rename completes.

If you're looking for the current state of the system, check /ops/personas/* in the app, the open issues #630 and #632, and the future docs/tavus/ directory.


Persona Manager

โš ๏ธ Naming transition (2026-05-23): "Persona Manager" is being split into two named surfaces:

  • Specialist Meetings โ€” the client-facing onboarding + reporting video flows (moved to /client/specialists/[id]/* in #632). Old /client/admin/specialists/[id]/* paths return 308 redirects.
  • Tavus Manager โ€” the SuperAdmin-only catalog management at /ops/personas/* (rename to /ops/tavus/* tracked in #630).

This README still describes the system as one unit. The split is being driven through #630 + #632.

Two video-conversation workflows on top of h.work.

What it doesโ€‹

WorkflowPurposeWho it's forOutput
OnboardingSingle ~60-min structured video intake with the AI Specialist when a client first deploys it.Client managerAn Environment Profile (systems, processes, vocabulary, guardrails, stakeholders, priorities) that the Specialist uses as operating context day-to-day.
ReportingPeriodic or ad-hoc video check-in with the Specialist.Client managerDecisions, priority changes, escalations, environment-change flags, scheduled next check-in โ€” all captured as durable, audited rows.

The video frontend is Tavus. The system prompts, brief assembly, function-call dispatch, audit, and the queue/escalation surface all live inside the existing h.work API.

Architecture in a paragraphโ€‹

A meeting record is created in the new meetings table (onboarding | reporting). The API renders a per-meeting system prompt from agent/prompts/{onboarding,reporting}_meeting.txt, fetches the active function-call definitions for the meeting kind from tavus_function_definitions, then calls Tavus to create a persona and a conversation. The conversation URL goes back to the client manager. As the call progresses, Tavus posts function-call events to /tavus/webhooks/function-call (HMAC-SHA256 verified, Redis-deduped). Those events route to onboarding handlers (which mutate the environment_profiles row) or reporting handlers (which write meeting_decisions + the existing actions table, and route escalations through ExpertQueueService.createQueueItem). Socket.io events (meeting_started, meeting_function_call, meeting_completed) fan out on the existing /notifications namespace.

Integration philosophyโ€‹

We added new modules to the existing monorepo without modifying production code. The full philosophy is in prompts/archive/persona-builder.md and ADR-0001 below. Three permitted touches to existing files:

  • frontend/src/lib/api.ts โ€” additive functions only.
  • api/src/app.module.ts โ€” single-line module imports + imports[] entries.
  • .github/workflows/nightly-isolation.yml โ€” additive entity entries.

Every other existing file is read-only.

File mapโ€‹

api/src/
tavus/ Tavus client, webhook verifier, router,
function-call CRUD + controller
environment-profiles/ env profile entity + service + onboarding
function-call handlers + SOUL.md generator
meetings/ meeting/decision/priority entities,
service (onboarding + reporting start),
brief assembler, persona generator,
reporting handlers, BullMQ cleanup processor
agent/prompts/
onboarding_meeting.txt system prompt for the onboarding persona
reporting_meeting.txt system prompt for the reporting persona
(with {{ BRIEF_JSON }} placeholder)
api/migrations/
1746000000010-PersonaManagerInit.ts five new tables + RLS
1746000000011-SeedPersonaManagerFunctions.ts 12 v1 function definitions
frontend/src/app/
client/specialists/[id]/onboarding/ client-side onboarding flow
client/specialists/[id]/meetings/ list, detail (start + outputs)
ops/personas/function-calls/ SuperAdmin function-call CRUD
ops/personas/replicas/ SuperAdmin replica catalogue
ops/personas/templates/ SuperAdmin template reference
frontend/e2e/persona-manager/
01-onboarding.spec.ts full onboarding E2E
02-reporting.spec.ts full reporting E2E
03-replica-not-set.spec.ts negative 409 path
docs/
decisions/persona-manager/ADR-0001-integration-approach.md
specs/persona-manager-integration.md
persona-manager/README.md (this file), api.md, function-calls.md

Configurationโ€‹

Env varPurpose
TAVUS_API_KEYAuth for Tavus REST calls.
TAVUS_API_BASE_URLDefaults to https://tavusapi.com. Override for staging.
TAVUS_WEBHOOK_SECRETHMAC-SHA256 secret for verifying inbound webhooks. Hard-fails at boot in deployed envs if unset.
TAVUS_DEFAULT_REPLICA_IDThe Tavus replica id used as the default for persona creation.
TAVUS_WEBHOOK_BASE_URLThe public URL Tavus posts back to. Defaults to APP_BASE_URL.
PERSONA_CLEANUP_AFTER_DAYSHow old ended_at must be before the cleanup sweep archives a persona. Default 14.
PERSONA_CLEANUP_CADENCE_MSHow often the BullMQ cleanup job runs. Default 86_400_000 (24h). Requires REDIS_URL.
HWORK_ORGS_DIRWhere SOUL.proposed.md files are written. Default: repo orgs/ directory.
HWORK_AGENT_PROMPTS_DIRWhere the prompt templates live. Default: repo agent/prompts/.

Statusโ€‹

  • Phase 0 โ€” Foundation: schema, entities, isolation env var โœ“
  • Phase 1 โ€” Tavus integration layer: client, webhook verifier, router, controller โœ“
  • Phase 2 โ€” Function-call library: CRUD, seed migration, SuperAdmin UI โœ“
  • Phase 3 โ€” Environment Profile + onboarding: service, handlers, SOUL.md generator, start endpoint, prompt, frontend โœ“
  • Phase 4 โ€” Brief assembly + reporting: brief assembler, persona generator, reporting handlers, Socket.io events, frontend โœ“
  • Phase 5 โ€” SuperAdmin surfaces: replicas catalogue, templates reference, audit-via-existing-viewer โœ“
  • Phase 6 โ€” Hardening: Playwright E2Es (skip-by-default unless PERSONA_MANAGER_E2E=1), cross-tenant isolation spec, BullMQ cleanup job, rate-limit inheritance โœ“
  • Docs: this README, api.md, function-calls.md.

See BUILD_LOG.jsonl for the per-task trail and TODO_PERSONA.md for the canonical task list.