diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md new file mode 100644 index 0000000..3d84200 --- /dev/null +++ b/.planning/REQUIREMENTS.md @@ -0,0 +1,131 @@ +# Requirements: Konstruct + +**Defined:** 2026-03-23 +**Core Value:** An AI employee that works in the channels your team already uses — no new tools to learn, no dashboards to check, just a capable coworker in Slack or WhatsApp. + +## v1 Requirements + +Requirements for beta-ready release. Each maps to roadmap phases. + +### Channel Infrastructure + +- [ ] **CHAN-01**: Channel Gateway normalizes messages from all channels into unified KonstructMessage format +- [ ] **CHAN-02**: User can interact with AI employee via Slack (Events API — @mentions, DMs, thread replies) +- [ ] **CHAN-03**: User can interact with AI employee via WhatsApp Business Cloud API +- [ ] **CHAN-04**: WhatsApp adapter enforces business-function scoping per Meta 2026 policy +- [ ] **CHAN-05**: Platform rate-limits requests per tenant and per channel with configurable thresholds + +### Agent Core + +- [ ] **AGNT-01**: Tenant can configure a single AI employee with custom name, role, and persona +- [ ] **AGNT-02**: Agent maintains conversational memory within sessions (sliding window) +- [ ] **AGNT-03**: Agent retrieves relevant past context via vector search (pgvector long-term memory) +- [ ] **AGNT-04**: Agent can invoke registered tools to perform actions (tool registry + execution) +- [ ] **AGNT-05**: Agent escalates to human when configured rules trigger, transferring full conversation context +- [ ] **AGNT-06**: Every agent action (LLM call, tool invocation, handoff) is logged in an audit trail +- [ ] **AGNT-07**: Agent token usage is tracked per-agent per-tenant with configurable budget limits + +### LLM Backend + +- [ ] **LLM-01**: LiteLLM router abstracts LLM provider selection with fallback routing +- [ ] **LLM-02**: Platform supports Ollama (local) and commercial APIs (Anthropic, OpenAI) as LLM providers +- [ ] **LLM-03**: Tenant can provide their own API keys for supported LLM providers (BYO keys, encrypted at rest) + +### Multi-Tenancy & Security + +- [ ] **TNNT-01**: All tenant data is isolated via PostgreSQL Row Level Security +- [ ] **TNNT-02**: Inbound messages are resolved to the correct tenant via channel metadata +- [ ] **TNNT-03**: Per-tenant Redis namespace isolation for cache and session state +- [ ] **TNNT-04**: All data encrypted at rest (PostgreSQL, object storage) and in transit (TLS 1.3) + +### Admin Portal + +- [ ] **PRTA-01**: Operator can create, view, update, and delete tenants +- [ ] **PRTA-02**: Operator can configure agent role, persona, tools, and escalation rules via web UI +- [ ] **PRTA-03**: Operator can connect messaging channels (Slack, WhatsApp) via guided wizard +- [ ] **PRTA-04**: New tenants are guided through structured onboarding (connect channel, configure agent, test message) +- [ ] **PRTA-05**: Operator can manage subscription plans and billing via Stripe integration +- [ ] **PRTA-06**: Portal displays agent cost tracking and usage metrics per tenant + +## v2 Requirements + +Deferred to future release. Tracked but not in current roadmap. + +### Channel Expansion + +- **CHAN-06**: User can interact with AI employee via Microsoft Teams +- **CHAN-07**: User can interact with AI employee via Mattermost +- **CHAN-08**: User can interact with AI employee via Telegram + +### Agent Advanced + +- **AGNT-08**: Same agent maintains unified memory across Slack and WhatsApp (cross-channel identity) +- **AGNT-09**: Agent detects negative sentiment and proactively escalates before user requests it +- **AGNT-10**: Pre-built tool integrations for common SMB tools (Zendesk, HubSpot, Google Calendar) + +### Multi-Agent Teams + +- **TEAM-01**: Coordinator agent routes inbound messages to specialist agents +- **TEAM-02**: Specialist agents execute domain-specific tasks and return results to coordinator +- **TEAM-03**: All inter-agent communication logged for audit + +### Enterprise + +- **ENTR-01**: Schema-per-tenant isolation for Team tier +- **ENTR-02**: Self-hosted deployment via Helm chart and Docker Compose +- **ENTR-03**: Agent marketplace with pre-built role templates + +## Out of Scope + +| Feature | Reason | +|---------|--------| +| Voice/telephony channels (Twilio) | Completely different tech stack and regulatory environment; validate messaging first | +| Open-ended general-purpose WhatsApp bot | Banned by Meta (Jan 2026 policy); agents must serve specific business functions | +| Real-time token streaming in chat | Slack/WhatsApp don't support partial message streaming; zero user benefit | +| Full no-code agent builder | Premature abstraction before agent quality is proven; config-based setup is sufficient | +| Cross-tenant agent communication | Security/isolation violation; no compliance framework supports it | +| Dashboard-first UX for end users | Defeats core value proposition; agent interactions stay in messaging channels | +| White-labeling for agencies | Secondary market; validate direct SMB first | +| AI company hierarchy (teams of teams) | Requires proven multi-agent foundation; v3+ | +| SOC 2 / HIPAA compliance | Post-revenue; self-hosted option covers compliance-sensitive customers | + +## Traceability + +Which phases cover which requirements. Updated during roadmap creation. + +| Requirement | Phase | Status | +|-------------|-------|--------| +| CHAN-01 | — | Pending | +| CHAN-02 | — | Pending | +| CHAN-03 | — | Pending | +| CHAN-04 | — | Pending | +| CHAN-05 | — | Pending | +| AGNT-01 | — | Pending | +| AGNT-02 | — | Pending | +| AGNT-03 | — | Pending | +| AGNT-04 | — | Pending | +| AGNT-05 | — | Pending | +| AGNT-06 | — | Pending | +| AGNT-07 | — | Pending | +| LLM-01 | — | Pending | +| LLM-02 | — | Pending | +| LLM-03 | — | Pending | +| TNNT-01 | — | Pending | +| TNNT-02 | — | Pending | +| TNNT-03 | — | Pending | +| TNNT-04 | — | Pending | +| PRTA-01 | — | Pending | +| PRTA-02 | — | Pending | +| PRTA-03 | — | Pending | +| PRTA-04 | — | Pending | +| PRTA-05 | — | Pending | +| PRTA-06 | — | Pending | + +**Coverage:** +- v1 requirements: 25 total +- Mapped to phases: 0 +- Unmapped: 25 ⚠️ + +--- +*Requirements defined: 2026-03-23* +*Last updated: 2026-03-23 after initial definition*