Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Feature ID: FW-50
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)

DependencyTypePurpose
PF-27 (Platform AI)Platform Integration LayerStructured output generation; module context fw / natural-language-workflow-generation; no PHI in prompts
FW-06 (Advanced Workflow Builder)FW internalCanvas, node types, branch config, draft editing
FW-18 (Workflow Variables)FW internalOptional suggested variables
FW-44 (AI-assisted form building)FW internalReference implementation for hooks, Zod schema, UI patterns

API / Contracts

  • Frontend: useAIWorkflowSuggestions, useApplyWorkflowSuggestions (spec-defined); AI path uses existing Platform AI / ai-assistant infrastructure where applicable.
  • Data writes: Supabase UPDATE to fw_workflow_definitions (JSONB merge on nodes, edges columns) with .eq('organization_id', orgId) RLS; no new edge function required unless platform requires one for this feature module.

Platform Integration Layer Usage

LayerLocationUsage
PF-27@/platform/aiuseAIStructuredOutput, module metadata, rate/credit handling

Security and Tenant Isolation

  • Permissions: No new keys. UI gated with existing fw.workflows.create (new draft) and fw.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).