Files
konstruct/.planning/phases/01-foundation/01-CONTEXT.md

83 lines
3.6 KiB
Markdown

# Phase 1: Foundation - Context
**Gathered:** 2026-03-23
**Status:** Ready for planning
<domain>
## Phase Boundary
Secure multi-tenant pipeline: a Slack message triggers an LLM response in-thread, with full tenant isolation. Includes monorepo scaffolding, Docker Compose dev environment, PostgreSQL with RLS, Redis namespacing, LiteLLM backend pool, Channel Gateway (Slack adapter), Message Router, basic Agent Orchestrator (single agent per tenant, no memory/tools), and a Next.js admin portal with tenant CRUD and Agent Designer.
**Scope change from roadmap:** Portal (PRTA-01, partial PRTA-02) pulled forward into Phase 1. Phase 3 retains billing, onboarding wizard, cost dashboard, and channel connection wizard.
</domain>
<decisions>
## Implementation Decisions
### Tenant Provisioning
- Next.js portal starts in Phase 1 — not deferred to Phase 3
- Portal includes tenant CRUD (create, list, view, edit, delete tenants)
- Portal includes Agent Designer module (job description, SOW, persona, system prompt, tool assignments, escalation rules)
- Auth.js v5 with email/password authentication from the start — no hardcoded credentials, no throwaway auth code
- Phase 3 scope narrows to: Stripe billing integration, onboarding wizard, cost tracking dashboard, channel connection wizard, and portal polish
### Agent Identity
- AI employees have human-like names by default (e.g., "Mara", "Alex") — matches the "hire an AI employee" branding
- Default persona tone: professional + warm — friendly but business-appropriate, like a good colleague
- Always transparent about being AI when asked directly — never pretends to be human
- Silent until spoken to — no auto-introduction message when added to a Slack channel
- Operator configures name, role, persona, and system prompt via the Agent Designer in the portal
### Slack Interaction Model
- Agent responds to: @mentions in channels and direct messages
- Does NOT monitor entire channels or respond to all messages (no "designated support channel" mode in v1)
- Always replies in threads — keeps channels clean
- Shows typing indicator while LLM is generating a response
- Thread follow-up behavior: Claude's discretion (auto-follow engaged threads vs require @mention for each reply)
### Claude's Discretion
- Thread follow-up behavior (auto-follow after first engagement vs always require @mention)
- Portal UI layout and component choices (within shadcn/ui)
- Default AI employee name suggestions
- Agent Designer form layout and field ordering
- Error message copy and formatting
</decisions>
<specifics>
## Specific Ideas
- The Agent Designer is a dedicated, prominent module in the portal — not buried in a settings page. It's the primary way operators define what their AI employee does.
- Agent Designer fields include: job description, statement of work, persona, system prompt, tool assignments, and escalation rules — all text inputs, not drag-and-drop.
- The "employee" metaphor is central to the product — names, roles, and behavior should reinforce this (not "bot" or "assistant" language).
</specifics>
<code_context>
## Existing Code Insights
### Reusable Assets
- None — greenfield project, no existing code
### Established Patterns
- None yet — Phase 1 establishes all foundational patterns
### Integration Points
- CLAUDE.md defines the full repo structure and tech stack choices
- Research docs (.planning/research/) provide library version recommendations and architectural patterns
</code_context>
<deferred>
## Deferred Ideas
None — discussion stayed within phase scope
</deferred>
---
*Phase: 01-foundation*
*Context gathered: 2026-03-23*