Skip to content

Conversation

@plusplusoneplusplus
Copy link
Owner

Summary

This PR introduces two major enhancements to the workflow automation system:

  1. Session Persistence for Workflows: Enables workflows to save their state for debugging, resumption, and recovery
  2. Loop Step Implementation: Adds native loop support with array indexing and nested loops

Changes

Session Persistence (feat: Add session persistence to workflow engine)

  • Integrate SessionManager into WorkflowEngine for automatic state persistence
  • Add session creation, resumption, and listing capabilities
  • Implement load_from_session() and resume_from_session() methods
  • Save workflow state, step results, and outputs automatically during execution
  • Store session data in ~/.mcp/workflows/sessions/ directory
  • Update AI research demo to showcase session persistence features
  • Switch demo from copilot to claude CLI with haiku model for better performance
  • Enhanced CLI executor error logging with stdout/stderr details

Loop Step and Workflow Operations (wip: Refactor workflow operations)

  • Add LoopStep implementation with support for nested loops
  • Enhance WorkflowContext with array indexing syntax (e.g., tasks[0].items)
  • Replace AI split/mapreduce operations with unified decompose operation
  • Add comprehensive operation schemas for type safety and validation
  • Create new AI research demo showcasing decompose + explore pattern
  • Update tests to reflect new loop step functionality
  • Remove deprecated workflow examples and operations

Benefits

Session Persistence:

  • Workflows can be interrupted and resumed without losing progress
  • Complete state history for debugging failed workflows
  • Ability to inspect intermediate results after execution
  • Support for long-running workflows that span multiple sessions

Loop Step:

  • Native iteration over collections without custom code
  • Cleaner workflow definitions with declarative loops
  • Support for nested loops and complex iteration patterns
  • Better array handling with intuitive indexing syntax

Testing

  • Added comprehensive tests for loop step functionality
  • Updated runtime data tests for array indexing
  • Verified session persistence in AI research demo
  • All existing workflow tests continue to pass

Files Changed

Core Changes

  • plugins/automation/workflows/engine.py (+261 lines): Session persistence implementation
  • plugins/automation/workflows/steps/loop.py (+252 lines): New loop step
  • plugins/automation/runtime_data/state.py (+47 lines): Array indexing support

New Features

  • plugins/automation/workflows/steps/operations/decompose.py (+253 lines): New decompose operation
  • plugins/automation/workflows/steps/operations/schemas.py (+235 lines): Operation schemas
  • plugins/automation/workflows/examples/demo_ai_research.py (+259 lines): Interactive demo

Tests

  • plugins/automation/tests/test_loop_step.py (+307 lines): Loop step tests
  • plugins/automation/tests/test_runtime_data.py (+73 lines): Context tests
  • plugins/automation/tests/test_workflow_definition.py (+61 lines): Definition tests

Cleanup

  • Removed deprecated AI split and mapreduce operations
  • Removed outdated workflow examples
  • Consolidated operation schemas

Migration Notes

No breaking changes for existing workflows. Session persistence is opt-in via the persist parameter.

Demo

To see session persistence in action:

uv run python plugins/automation/workflows/examples/demo_ai_research.py

This will show:

  • AI-powered question decomposition
  • Parallel exploration of subtopics
  • Automatic session persistence
  • Session inspection capabilities

🤖 Generated with Claude Code

plusplusoneplusplus and others added 2 commits November 12, 2025 22:23
Temporary commit of workflow automation refactoring:
- Add loop step implementation with nested loop support
- Enhance WorkflowContext with array indexing (e.g., tasks[0].items)
- Replace AI split/mapreduce operations with decompose operation
- Add operation schemas for better type safety
- Update tests to reflect new loop step functionality
- Remove deprecated workflow examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…gging

- Add SessionManager integration to WorkflowEngine for state persistence
- Support session creation, resumption, and listing for workflows
- Save workflow state, step results, and outputs to sessions automatically
- Add load_from_session and resume_from_session methods for workflow recovery
- Update AI research demo to use session persistence and display session info
- Switch demo from copilot to claude CLI with haiku model
- Enhance CLI executor error logging with stdout/stderr details

This enables workflows to persist their state for debugging, resumption,
and long-running operations that may need to be interrupted and resumed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@plusplusoneplusplus plusplusoneplusplus enabled auto-merge (squash) November 17, 2025 15:44
@plusplusoneplusplus plusplusoneplusplus merged commit 418c139 into main Nov 17, 2025
16 checks passed
@plusplusoneplusplus plusplusoneplusplus deleted the feat/workflow-session-persistence branch November 17, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants