Skip to content

Refactor TEMPLATE system into event-driven workflow assignments #29

@nam20485

Description

@nam20485

Overview

The current template system (BEFORE_STARTING_TEMPLATE, PROGRESS_REPORTING_TEMPLATE, ERROR_RECOVERY_TEMPLATE) uses text inclusion patterns. This issue proposes refactoring to an event-driven architecture with workflow lifecycle hooks.

This issue only needs to:

  1. change the the static text inclusion to be removed
  2. convert the TEMPLATES to workflow assignments
  3. attach the new workflow-assignments to the correct event-handlers:
    a. BEFORE_STARTING_TEMPLATE --> preSciptBegins
    b. PROGRESS_REPORTING_TEMPLATE --> postAssignemtnComplete
    c. ERROR_RECOVERY_TEMPLATE --> onAssignmentFailure

Current State

Templates are included via static text references:

  • BEFORE_STARTING_TEMPLATE - Pre-execution checklist
  • PROGRESS_REPORTING_TEMPLATE - Status update format
  • ERROR_RECOVERY_TEMPLATE - Error handling protocol

Included in 4 assignments:

  • orchestrate-dynamic-workflow.md
  • orchestrate-new-project.md
  • create-app-plan.md
  • create-application-foundation.md

Proposed Architecture

Replace templates with event hooks:

Event Lifecycle

  • preScriptBegins - Before workflow execution starts
  • postStepComplete - After each step completes
  • on-assignment-failure -assignment failure or error
  • preCreateAssignment - Before creating sub-assignments
  • postAssignmentComplete - After sub-assignment finishes

Dynamic-workflow event system already exists.

  • documented in dynamic0workflow-syntax.

Benefits

  1. Separation of Concerns - Workflow logic separate from procedural checks
  2. Reusability - Event handlers can be shared across workflows
  3. Flexibility - Add/modify hooks without changing core workflow
  4. Traceability - Clear audit trail of lifecycle events
  5. Testability - Event handlers can be tested independently

Implementation Plan

  1. Migrate existing 4 assignments to new pattern
  2. Document migration guide for custom workflows

Acceptance Criteria

  • All 4 existing assignments migrated
  • No regression in workflow execution

Related

  • Follows completion of FB-010 (template integration)
  • Builds on FB-012 (workflow documentation)
  • Part of architectural evolution toward more modular system

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions