Feature ID: FW-50Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Status: 📋 Specification
Spec Reference: FW-50-natural-language-workflow-generation.md
Last Updated: 2026-03-20
Overview
FW-50 adds AI-assisted workflow structure suggestions from a short natural-language description. All AI calls go through PF-27 (Platform AI) via@/platform/ai (useAIStructuredOutput). Suggestions are applied by merging into fw_workflow_definitions JSONB nodes/edges columns (no new tables). Pattern aligns with FW-44 (AI form building) and FW-30 (workflow optimization AI).
Integration Points (from Spec)
| Dependency | Type | Purpose |
|---|---|---|
| PF-27 (Platform AI) | Platform Integration Layer | Structured output generation; module context fw / natural-language-workflow-generation; no PHI in prompts |
| FW-06 (Advanced Workflow Builder) | FW internal | Canvas, node types, branch config, draft editing |
| FW-18 (Workflow Variables) | FW internal | Optional suggested variables |
| FW-44 (AI-assisted form building) | FW internal | Reference implementation for hooks, Zod schema, UI patterns |
API / Contracts
- Frontend:
useAIWorkflowSuggestions,useApplyWorkflowSuggestions(spec-defined); AI path uses existing Platform AI /ai-assistantinfrastructure where applicable. - Data writes: Supabase UPDATE to
fw_workflow_definitions(JSONB merge onnodes,edgescolumns) with.eq('organization_id', orgId)RLS; no new edge function required unless platform requires one for this feature module.
Platform Integration Layer Usage
| Layer | Location | Usage |
|---|---|---|
| PF-27 | @/platform/ai | useAIStructuredOutput, module metadata, rate/credit handling |
Security and Tenant Isolation
- Permissions: No new keys. UI gated with existing
fw.workflows.create(new draft) andfw.workflows.edit(existing draft), same as Workflow Builder context. - Prompts: workflow name + purpose description only; do not send resident/patient/employee identifiers, existing node labels/config, or free-text field values from existing workflows (Phase 1).
- Mutations: scoped to workflows the user can edit;
.eq('organization_id', orgId)on updates (defense in depth). Apply is all-or-nothing (single row UPDATE on JSONB columns is inherently atomic; no orphaned nodes without edges). - Audit:
ai_workflow_suggestions_applied(canonical) with counts and IDs; no PHI in payload. - Logs: avoid pairing user description with org-identifying detail in plain-text logs where unnecessary.
Event Contracts
- No new cross-core domain events in Phase 1. Optional internal audit event only (see spec).
Related Docs
- FW-50 Spec
- FW-06 Spec
- FW-44 Spec
- FW-30 Spec
- PF-27 (Platform AI)