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-51
Status: 📋 Specification
Spec: FW-51-automation-rule-copilot.md
Last Updated: 2026-03-20

Overview

FW-51 adds natural-language assistance for drafting automation rules. It extends FW-03 using Platform AI (PF-27) only—no new database tables. Suggestions apply to existing fw_automation_rules and fw_automation_actions under existing RLS and permissions.

Integration Points (from Spec)

DependencyPatternPurpose
PF-27 (Platform AI)Platform Layer (@/platform/ai, useAIStructuredOutput)Structured rule suggestions; module context module: 'fw', feature: 'automation-rule-copilot'; no PHI in prompts.
PF-10 (Notifications)Platform dependencySuggested actions may use create_notification and PF-10 delivery paths.
FW-03 (Automation Engine)Intra-coreRule builder UI, rule persistence, execution semantics.
FW-44 (AI Form Building)Pattern alignmentReuse prompts/schema/hook/UI patterns where practical.
FW-50 (NL Workflow Generation)Pattern alignmentShared AI infrastructure and UX patterns for “describe → preview → apply.”

Event / API Contracts

  • No new domain events for FW-51 Phase 1.
  • AI invocation: Existing Platform AI / ai-assistant path used by useAIStructuredOutput (same as FW-44/FW-50). Request/response shapes are defined by the feature Zod schema in FW code; tenant and auth follow PF-27 standards.
  • Apply mutations: Transactional SECURITY DEFINER RPC (fw_apply_rule_with_actions) on fw_automation_rules / fw_automation_actions with organization_id enforced inside the function. Existing RLS still applies for non-RPC reads.

Security and Tenant Isolation

  • Suggest and apply gated by existing automation-rule edit permissions; organization_id enforced on all writes.
  • Prompts: rule name + purpose description only; do not send existing rule payloads that could contain PHI/PII.
  • Audit: log apply events with counts and metadata only (see spec)—no user description in audit plain text.

Permissions (Phase 1)

  • No new pf_module_permissions rows. Use the same gates as Automation Rule Builder; spec references fw.automations.admin (FW_PERMISSIONS.AUTOMATIONS_ADMIN) as the canonical automation admin key—keep UI consistent with builder when implementing.