roast-ai 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +2 -2
  3. data/CHANGELOG.md +65 -0
  4. data/CLAUDE.md +55 -9
  5. data/Gemfile +1 -0
  6. data/Gemfile.lock +8 -1
  7. data/README.md +69 -3
  8. data/bin/console +1 -0
  9. data/docs/AGENT_STEPS.md +33 -9
  10. data/docs/VALIDATION.md +178 -0
  11. data/examples/agent_continue/add_documentation/prompt.md +5 -0
  12. data/examples/agent_continue/add_error_handling/prompt.md +5 -0
  13. data/examples/agent_continue/analyze_codebase/prompt.md +7 -0
  14. data/examples/agent_continue/combined_workflow.yml +24 -0
  15. data/examples/agent_continue/continue_adding_features/prompt.md +4 -0
  16. data/examples/agent_continue/create_integration_tests/prompt.md +3 -0
  17. data/examples/agent_continue/document_with_context/prompt.md +5 -0
  18. data/examples/agent_continue/explore_api/prompt.md +6 -0
  19. data/examples/agent_continue/implement_client/prompt.md +6 -0
  20. data/examples/agent_continue/inline_workflow.yml +20 -0
  21. data/examples/agent_continue/refactor_code/prompt.md +2 -0
  22. data/examples/agent_continue/verify_changes/prompt.md +6 -0
  23. data/examples/agent_continue/workflow.yml +27 -0
  24. data/examples/agent_workflow/workflow.png +0 -0
  25. data/examples/api_workflow/workflow.png +0 -0
  26. data/examples/apply_diff_demo/README.md +58 -0
  27. data/examples/apply_diff_demo/apply_simple_change/prompt.md +13 -0
  28. data/examples/apply_diff_demo/create_sample_file/prompt.md +11 -0
  29. data/examples/apply_diff_demo/workflow.yml +24 -0
  30. data/examples/available_tools_demo/workflow.png +0 -0
  31. data/examples/bash_prototyping/api_testing.png +0 -0
  32. data/examples/bash_prototyping/system_analysis.png +0 -0
  33. data/examples/case_when/workflow.png +0 -0
  34. data/examples/cmd/basic_workflow.png +0 -0
  35. data/examples/cmd/dev_workflow.png +0 -0
  36. data/examples/cmd/explorer_workflow.png +0 -0
  37. data/examples/conditional/simple_workflow.png +0 -0
  38. data/examples/conditional/workflow.png +0 -0
  39. data/examples/context_management_demo/README.md +43 -0
  40. data/examples/context_management_demo/workflow.yml +42 -0
  41. data/examples/direct_coerce_syntax/workflow.png +0 -0
  42. data/examples/dot_notation/workflow.png +0 -0
  43. data/examples/exit_on_error/workflow.png +0 -0
  44. data/examples/grading/workflow.png +0 -0
  45. data/examples/interpolation/workflow.png +0 -0
  46. data/examples/interpolation/workflow.yml +1 -1
  47. data/examples/iteration/workflow.png +0 -0
  48. data/examples/json_handling/workflow.png +0 -0
  49. data/examples/mcp/database_workflow.png +0 -0
  50. data/examples/mcp/env_demo/workflow.png +0 -0
  51. data/examples/mcp/filesystem_demo/workflow.png +0 -0
  52. data/examples/mcp/github_workflow.png +0 -0
  53. data/examples/mcp/multi_mcp_workflow.png +0 -0
  54. data/examples/mcp/workflow.png +0 -0
  55. data/examples/no_model_fallback/README.md +17 -0
  56. data/examples/no_model_fallback/analyze_file/prompt.md +1 -0
  57. data/examples/no_model_fallback/analyze_patterns/prompt.md +27 -0
  58. data/examples/no_model_fallback/generate_report_for_md/prompt.md +10 -0
  59. data/examples/no_model_fallback/generate_report_for_rb/prompt.md +3 -0
  60. data/examples/no_model_fallback/sample.rb +42 -0
  61. data/examples/no_model_fallback/workflow.yml +19 -0
  62. data/examples/openrouter_example/workflow.png +0 -0
  63. data/examples/pre_post_processing/workflow.png +0 -0
  64. data/examples/rspec_to_minitest/workflow.png +0 -0
  65. data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
  66. data/examples/shared_config/shared.png +0 -0
  67. data/examples/single_target_prepost/workflow.png +0 -0
  68. data/examples/smart_coercion_defaults/workflow.png +0 -0
  69. data/examples/step_configuration/workflow.png +0 -0
  70. data/examples/swarm_example.yml +25 -0
  71. data/examples/tool_config_example/workflow.png +0 -0
  72. data/examples/user_input/funny_name/workflow.png +0 -0
  73. data/examples/user_input/simple_input_demo/workflow.png +0 -0
  74. data/examples/user_input/survey_workflow.png +0 -0
  75. data/examples/user_input/workflow.png +0 -0
  76. data/examples/workflow_generator/workflow.png +0 -0
  77. data/lib/roast/helpers/timeout_handler.rb +91 -0
  78. data/lib/roast/services/context_threshold_checker.rb +42 -0
  79. data/lib/roast/services/token_counting_service.rb +44 -0
  80. data/lib/roast/tools/apply_diff.rb +128 -0
  81. data/lib/roast/tools/bash.rb +15 -9
  82. data/lib/roast/tools/cmd.rb +32 -12
  83. data/lib/roast/tools/coding_agent.rb +64 -9
  84. data/lib/roast/tools/context_summarizer.rb +108 -0
  85. data/lib/roast/tools/swarm.rb +124 -0
  86. data/lib/roast/version.rb +1 -1
  87. data/lib/roast/workflow/agent_step.rb +9 -2
  88. data/lib/roast/workflow/base_iteration_step.rb +3 -2
  89. data/lib/roast/workflow/base_workflow.rb +41 -2
  90. data/lib/roast/workflow/configuration.rb +2 -1
  91. data/lib/roast/workflow/configuration_loader.rb +63 -1
  92. data/lib/roast/workflow/context_manager.rb +89 -0
  93. data/lib/roast/workflow/each_step.rb +1 -1
  94. data/lib/roast/workflow/output_handler.rb +1 -1
  95. data/lib/roast/workflow/repeat_step.rb +1 -1
  96. data/lib/roast/workflow/replay_handler.rb +1 -1
  97. data/lib/roast/workflow/sqlite_state_repository.rb +342 -0
  98. data/lib/roast/workflow/state_manager.rb +2 -2
  99. data/lib/roast/workflow/state_repository_factory.rb +36 -0
  100. data/lib/roast/workflow/step_completion_reporter.rb +27 -0
  101. data/lib/roast/workflow/step_executor_coordinator.rb +19 -18
  102. data/lib/roast/workflow/step_executor_with_reporting.rb +68 -0
  103. data/lib/roast/workflow/step_loader.rb +1 -1
  104. data/lib/roast/workflow/step_name_extractor.rb +84 -0
  105. data/lib/roast/workflow/validation_command.rb +197 -0
  106. data/lib/roast/workflow/validators/base_validator.rb +44 -0
  107. data/lib/roast/workflow/validators/dependency_validator.rb +223 -0
  108. data/lib/roast/workflow/validators/linting_validator.rb +113 -0
  109. data/lib/roast/workflow/validators/schema_validator.rb +90 -0
  110. data/lib/roast/workflow/validators/step_collector.rb +57 -0
  111. data/lib/roast/workflow/validators/validation_orchestrator.rb +52 -0
  112. data/lib/roast/workflow/workflow_executor.rb +11 -4
  113. data/lib/roast/workflow/workflow_runner.rb +6 -0
  114. data/lib/roast/workflow_diagram_generator.rb +298 -0
  115. data/lib/roast.rb +157 -0
  116. data/roast.gemspec +2 -1
  117. data/schema/workflow.json +77 -1
  118. metadata +101 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c0f1a837c5dafcaecb8443e93a4076c11566f1c3bea1d6835121628fbdf79a7
4
- data.tar.gz: ab3679b374486831cbf90ab3a259178d48d4e53d5d5dbdc2a2d43537399e4ca9
3
+ metadata.gz: b31e95a8d65d0b1fa798c0baed8bcbf9249cc67fca752154865d914d01ffbd8d
4
+ data.tar.gz: 21205a0a50e2301dda0936e67b02d05af94085b0e383f859aec282827649ebb3
5
5
  SHA512:
6
- metadata.gz: 3061d9f04b7f886e3a6d588eb729e10062f6310d5973c7ed5181975f27a385c20d8ff8880ecb7e61abd54dfbd87795211313e1c9a6d2a630269d7c4559ae7cae
7
- data.tar.gz: 7962e4991590700003f3f8a827435214ef9aa90fa4324d34d3b421f11d5f647e43663e17189a0b43f81d6fa124bbf68a269f9674a493994832b9ab5c03f192a6
6
+ metadata.gz: 80b5ceada69faff53f5893e9378e628474b103c3d6b60a8701be80b1bfe11cb6e4bde252670d890a2ae7e460d90d956daed7813d251cf6d84399ab70d321b0d8
7
+ data.tar.gz: 620e7d46fc6f7e9b10a71807f213ba101cb2bbd9a3bad073a153057bd67bc842cf74e4ffaa179596a2ed3655dc7a864c366034a37f4a720d2fd6faafa86f5541
@@ -23,8 +23,8 @@ jobs:
23
23
  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
24
24
  steps:
25
25
  - uses: actions/checkout@v4
26
- - name: Install ripgrep
27
- run: sudo apt-get update && sudo apt-get install -y ripgrep
26
+ - name: Install dependencies
27
+ run: sudo apt-get update && sudo apt-get install -y ripgrep graphviz
28
28
  - uses: ruby/setup-ruby@v1
29
29
  with:
30
30
  ruby-version: ${{ matrix.ruby }}
data/CHANGELOG.md CHANGED
@@ -5,6 +5,71 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.1] - 2025-06-18
9
+
10
+ ### Added
11
+ - **SQLite session storage** as the default storage backend (#252)
12
+ - Provides better performance and advanced querying capabilities
13
+ - Sessions are stored in `~/.roast/sessions.db` by default (configurable via `ROAST_SESSIONS_DB`)
14
+ - New `roast sessions` command to list and filter stored sessions
15
+ - New `roast session <id>` command to view detailed session information
16
+ - Session cleanup with `roast sessions --cleanup --older-than <duration>`
17
+ - Filter sessions by status, workflow name, or age
18
+ - Maintains full backward compatibility with filesystem storage
19
+ - **`--file-storage` CLI option** to use legacy filesystem storage instead of SQLite
20
+ - Use `-f` or `--file-storage` flag to opt into filesystem storage
21
+ - Environment variable `ROAST_STATE_STORAGE=file` still supported for compatibility
22
+ - **Foundation for wait_for_event feature** (#251)
23
+ - New `roast resume` command infrastructure for resuming paused workflows
24
+ - Event storage and tracking in SQLite sessions table
25
+ - **Configurable agent step options** for CodingAgent (#266)
26
+ - New `continue` option for agent steps to maintain session context across multiple agent invocations
27
+ - New `include_context_summary` option to provide AI-generated workflow context summaries to agents
28
+ - Context summaries are intelligently tailored to the agent's specific task using LLM analysis
29
+ - Helps reduce token usage by including only relevant context information
30
+ - **Token consumption reporting** for step execution (#264)
31
+ - Displays token usage (prompt and completion) after each step execution
32
+ - Helps users monitor and optimize their LLM token consumption
33
+ - Automatically enabled for all workflow runs
34
+ - **Timeout functionality for bash and cmd steps** (#261)
35
+ - New `timeout` option for bash and cmd steps to prevent hanging commands
36
+ - Configurable timeout duration in seconds
37
+ - Commands are automatically terminated if they exceed the specified timeout
38
+ - Prevents workflows from getting stuck on unresponsive commands
39
+ - **Claude Swarm tool integration** (#254)
40
+ - New `Roast::Tools::Swarm` for integrating with Claude Swarm framework
41
+ - Enables using Swarm's multi-agent orchestration capabilities within Roast workflows
42
+ - Provides seamless handoffs between specialized AI agents
43
+ - **Workflow visualization with diagram command** (#256)
44
+ - New `roast diagram` command to generate visual representations of workflows
45
+ - Creates GraphViz-based diagrams showing workflow structure and flow
46
+ - Supports both DOT format output and PNG/SVG image generation
47
+ - Helps understand complex workflow logic at a glance
48
+ - **Comprehensive workflow validation** (#244)
49
+ - New `roast validate` command to check workflow syntax and structure
50
+ - Validates YAML syntax, step references, and configuration options
51
+ - Provides detailed error messages for invalid workflows
52
+ - Helps catch errors before running workflows
53
+ - **apply_diff tool** (#246)
54
+ - New built-in tool for applying unified diff patches to files
55
+ - Supports standard diff format for making precise file modifications
56
+ - Enables AI models to suggest changes in diff format
57
+ - More reliable than search-and-replace for complex edits
58
+ - **Model fallback mechanism** (#257)
59
+ - Workflows without explicit model configuration now use a sensible default
60
+ - Prevents errors when model is not specified at workflow or step level
61
+ - Improves user experience for simple workflows
62
+ - **Context management foundation for auto-compaction** (#264)
63
+ - Infrastructure for future automatic context size management
64
+ - Enables intelligent token usage optimization in long-running workflows
65
+
66
+ ### Changed
67
+ - Session storage now defaults to SQLite instead of filesystem
68
+ - Existing filesystem sessions remain accessible when using `--file-storage` flag
69
+ - No migration required - both storage backends can coexist
70
+
71
+ [0.4.1]: https://github.com/Shopify/roast/compare/v0.4.0...v0.4.1
72
+
8
73
  ## [0.4.0] - 2025-06-12
9
74
 
10
75
  ### Added
data/CLAUDE.md CHANGED
@@ -7,15 +7,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
7
7
  - Note that this project now uses Zeitwerk, which means you don't have to manually require project files anymore
8
8
 
9
9
  ## Commands
10
-
11
- - Default (tests + lint): `bundle exec rake`
12
- - Test all: `bundle exec test`
10
+ - Default THE SUITE RUNS FAST SO USE THIS IN MOST CASES (tests + lint w/autocorrect): `bundle exec rake`
13
11
  - Run single test: `bundle exec ruby -Itest test/path/to/test_file.rb`
14
12
  - Lint: `bundle exec rubocop`
15
13
  - Lint (with autocorrect, preferred): `bundle exec rubocop -A`
16
14
  - Whenever you want to run the whole test suite just run `bundle exec rake` to also run linting, and note the linting errors too (most will auto correct but not all)
17
15
  - **Run roast locally**: Use `bin/roast` (not `bundle exec roast` which may use the installed gem)
18
- - Alternative: `bundle exec exe/roast`
19
16
 
20
17
  ## Tech stack
21
18
  - `thor` and `cli-ui` for the CLI tool
@@ -23,7 +20,6 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
23
20
  - Prefer using the more literate `test "this is a test description" do` type of testing that we get from extending ActiveSupport::TestCase over the primitive XUnit-style def test_description headings for tests
24
21
 
25
22
  ## Code Style Guidelines
26
-
27
23
  - Naming: snake_case for variables/methods, CamelCase for classes/modules, ALL_CAPS for constants
28
24
  - Module structure: Use nested modules under the `Roast` namespace
29
25
  - Command pattern: Commands implement a `call` method and class-level `help` method
@@ -41,7 +37,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
41
37
  - Always leave a blank line after module includes and before the rest of the class
42
38
 
43
39
  ## Architecture Guidelines
44
-
40
+ - **SOLID principles are important** - don't violate them
45
41
  - **Maintain proper separation of concerns**: Don't mix unrelated concepts in the same class or module
46
42
  - Example: Conditional execution (if/unless) should NOT be mixed with iteration execution (each/repeat)
47
43
  - Each concept should have its own executor class and be handled separately
@@ -55,14 +51,64 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
51
  - When faced with the choice between working around an architectural issue or code smell versus actually diving into fixing the design issue or code smell, choose the latter more principled approach
56
52
  - When fixing code smells, you don't have to worry about internal backwards compatibility
57
53
 
58
- ## Guidance and Expectations
54
+ ## Workflow Configuration Syntax
55
+ - The `steps` key in the workflow configuration is an array of step names
56
+ - Only step names, inline prompts, and control flow keywords are allowed in the steps array
57
+ - Additional per-step configuration is provided in a top-level hash with the step name as the key, not within steps!!! (Very important)
58
+ - The reason that steps are not configured "inline" within the steps array is so that the shape of the workflow is as obvious as possible
59
+ - Step labels are inferred for most steps and optional for inline prompts, but required for steps that need custom configuration
60
+ - The result of running a step is stored in the `workflow.output` hash with the step label as the key
61
+
62
+ ## How Roast Tools Work (CRITICAL - READ THIS!)
63
+ **Tools in Roast are NOT explicitly invoked in workflow steps!** This is a fundamental concept that differs from many other workflow systems.
64
+
65
+ ### Key Concepts:
66
+ 1. **Tools are capabilities available to the LLM** - They are functions the LLM can choose to call while executing a step
67
+ 2. **Steps contain prompts** - Steps describe what needs to be done, not how to do it
68
+ 3. **The LLM decides when to use tools** - While executing a step's prompt, the LLM analyzes the task and calls tools as needed
69
+ 4. **Tools are registered, not declared in steps** - Use the `tools:` section to make tools available, but never use a `tool:` key in step configuration
70
+
71
+ ### Correct inline prompt syntax:
72
+ ```yaml
73
+ steps:
74
+ - analyze_code: |
75
+ Analyze the codebase and identify performance bottlenecks.
76
+ Use any available tools to read files and search for patterns.
77
+ ```
78
+
79
+ ### INCORRECT syntax (DO NOT USE):
80
+ ```yaml
81
+ # WRONG - no 'prompt:' key
82
+ steps:
83
+ - analyze_code:
84
+ prompt: "Analyze the codebase"
85
+
86
+ # WRONG - no 'tool:' key
87
+ steps:
88
+ - run_analysis:
89
+ tool: coding_agent
90
+ prompt: "Analyze code"
91
+ ```
92
+
93
+ ### How tools are actually used:
94
+ When the LLM executes the `analyze_code` step above, it might:
95
+ 1. Decide it needs to read files and call `read_file(path)`
96
+ 2. Decide it needs to search and call `grep(pattern, path)`
97
+ 3. Decide it needs Claude Swarm and call `swarm(prompt, config_path)`
98
+
99
+ The LLM makes these decisions based on the prompt and available tools, similar to how Claude (you) decides when to use Bash, Read, or other tools when responding to user requests.
59
100
 
101
+ ## Step Configuration
102
+ - The `path` key in a step configuration is the path to a Ruby file that defines a custom step.
103
+ - The `model` key in a step configuration is the model to use for the step.
104
+ - The `print_response` key in a step configuration is a boolean that determines whether the step's response should be printed to the console.
105
+
106
+ ## Coding Guidance and Expectations
60
107
  - Do not decide unilaterally to leave code for the sake of "backwards compatibility"... always run those decisions by me first.
61
108
  - Don't ever commit and push changes unless directly told to do so
62
- - You can't test input steps yourself, ask me to do it
109
+ - You can't test input steps yourself since they block, so ask me to do it manually
63
110
 
64
111
  ## Git Workflow Practices
65
-
66
112
  1. **Amending Commits**:
67
113
  - Use `git commit --amend --no-edit` to add staged changes to the last commit without changing the commit message
68
114
  - This is useful for incorporating small fixes or changes that belong with the previous commit
data/Gemfile CHANGED
@@ -18,5 +18,6 @@ gem "rubocop-shopify", require: false
18
18
  gem "vcr", require: false
19
19
  gem "webmock", require: false
20
20
  gem "minitest-rg"
21
+ gem "sqlite3", "~> 1.7"
21
22
 
22
23
  gem "claude_swarm"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roast-ai (0.4.0)
4
+ roast-ai (0.4.1)
5
5
  activesupport (>= 7.0)
6
6
  cli-ui (= 2.3.0)
7
7
  diff-lcs (~> 1.5)
@@ -9,6 +9,7 @@ PATH
9
9
  json-schema
10
10
  open_router (~> 0.3)
11
11
  raix (~> 1.0)
12
+ ruby-graphviz (~> 1.2)
12
13
  thor (~> 1.3)
13
14
  zeitwerk (~> 2.6)
14
15
 
@@ -132,6 +133,7 @@ GEM
132
133
  logger
133
134
  mime-types-data (~> 3.2025, >= 3.2025.0507)
134
135
  mime-types-data (3.2025.0603)
136
+ mini_portile2 (2.8.9)
135
137
  minitest (5.25.5)
136
138
  minitest-rg (5.3.0)
137
139
  minitest (~> 5.0)
@@ -190,6 +192,8 @@ GEM
190
192
  prism (~> 1.4)
191
193
  rubocop-shopify (2.17.1)
192
194
  rubocop (~> 1.62)
195
+ ruby-graphviz (1.2.5)
196
+ rexml
193
197
  ruby-openai (7.4.0)
194
198
  event_stream_parser (>= 0.3.0, < 2.0.0)
195
199
  faraday (>= 1)
@@ -198,6 +202,8 @@ GEM
198
202
  ruby2_keywords (0.0.5)
199
203
  securerandom (0.4.1)
200
204
  shellany (0.0.1)
205
+ sqlite3 (1.7.3)
206
+ mini_portile2 (~> 2.8.0)
201
207
  thor (1.3.2)
202
208
  tzinfo (2.0.6)
203
209
  concurrent-ruby (~> 1.0)
@@ -229,6 +235,7 @@ DEPENDENCIES
229
235
  rake
230
236
  roast-ai!
231
237
  rubocop-shopify
238
+ sqlite3 (~> 1.7)
232
239
  vcr
233
240
  webmock
234
241
 
data/README.md CHANGED
@@ -405,6 +405,72 @@ For typical AI workflows, the continuous conversation history provides seamless
405
405
  - `-c, --concise`: Use concise output templates (exposed as a boolean flag on `workflow`)
406
406
  - `-v, --verbose`: Show output from all steps as they execute
407
407
  - `-r, --replay STEP_NAME`: Resume a workflow from a specific step, optionally with a specific session timestamp
408
+ - `-f, --file-storage`: Use filesystem storage for sessions instead of SQLite (default: SQLite)
409
+
410
+ #### Workflow Validation
411
+
412
+ Roast provides a `validate` command to check workflow configuration files for errors and potential issues before execution:
413
+
414
+ ```bash
415
+ # Validate a specific workflow
416
+ roast validate workflow.yml
417
+
418
+ # Validate a workflow in a subdirectory
419
+ roast validate my_workflow
420
+
421
+ # Validate with strict mode (treats warnings as errors)
422
+ roast validate workflow.yml --strict
423
+ ```
424
+
425
+ The validator checks for:
426
+ - YAML syntax errors
427
+ - Missing required fields
428
+ - Invalid step references
429
+ - Circular dependencies
430
+ - Tool availability
431
+ - Prompt file existence
432
+ - Configuration consistency
433
+
434
+ This helps catch configuration errors early and ensures workflows will run smoothly.
435
+
436
+ #### Session Storage and Management
437
+
438
+ Roast uses SQLite by default for session storage, providing better performance and advanced querying capabilities. Sessions are automatically saved during workflow execution, capturing each step's state including conversation transcripts and outputs.
439
+
440
+ **Storage Options:**
441
+
442
+ ```bash
443
+ # Use default SQLite storage (recommended)
444
+ roast execute workflow.yml
445
+
446
+ # Use legacy filesystem storage
447
+ roast execute workflow.yml --file-storage
448
+
449
+ # Set storage type via environment variable
450
+ ROAST_STATE_STORAGE=file roast execute workflow.yml
451
+ ```
452
+
453
+ **Session Management Commands:**
454
+
455
+ ```bash
456
+ # List all sessions
457
+ roast sessions
458
+
459
+ # Filter sessions by status
460
+ roast sessions --status waiting
461
+
462
+ # Filter sessions by workflow
463
+ roast sessions --workflow my_workflow
464
+
465
+ # Show sessions older than 7 days
466
+ roast sessions --older-than 7d
467
+
468
+ # Clean up old sessions
469
+ roast sessions --cleanup --older-than 30d
470
+
471
+ # View detailed session information
472
+ roast session <session_id>
473
+ ```
408
474
 
409
475
  #### Session Replay
410
476
 
@@ -418,14 +484,14 @@ roast execute workflow.yml -r step_name
418
484
  roast execute workflow.yml -r 20250507_123456_789:step_name
419
485
  ```
420
486
 
421
- Sessions are automatically saved during workflow execution. Each step's state, including the conversation transcript and output, is persisted to a session directory. The session directories are organized by workflow name and file, with timestamps for each run.
422
-
423
487
  This feature is particularly useful when:
424
488
  - Debugging specific steps in a long workflow
425
489
  - Iterating on prompts without rerunning the entire workflow
426
490
  - Resuming after failures in long-running workflows
427
491
 
428
- Sessions are stored in the `.roast/sessions/` directory in your project. Note that there is no automatic cleanup of session data, so you might want to periodically delete old sessions yourself.
492
+ **Storage Locations:**
493
+ - SQLite: `~/.roast/sessions.db` (configurable via `ROAST_SESSIONS_DB`)
494
+ - Filesystem: `.roast/sessions/` directory in your project
429
495
 
430
496
  #### Target Option (`-t, --target`)
431
497
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
 
data/docs/AGENT_STEPS.md CHANGED
@@ -19,6 +19,35 @@ steps:
19
19
 
20
20
  Both file-based prompts (with directories like `implement_fix/prompt.md`) and inline prompts (text with spaces) are supported.
21
21
 
22
+ ## Agent Step Configuration Options
23
+
24
+ Agent steps support two special configuration options:
25
+
26
+ ### `continue` (boolean, default: false)
27
+ When set to `true`, the agent continues from its previous session instead of starting fresh. This is useful for iterative development where you want the agent to maintain context across multiple steps.
28
+
29
+ ### `include_context_summary` (boolean, default: false)
30
+ When set to `true`, the agent receives an AI-generated summary of the workflow context as a system directive. This summary is intelligently tailored to the agent's upcoming task, including only relevant information from previous steps. The summary is generated by analyzing:
31
+ - The agent's prompt to understand what context would be helpful
32
+ - Previous step outputs and their relevance to the current task
33
+ - Workflow description and configuration
34
+ - Current working directory
35
+
36
+ This helps the agent understand what has been done so far without overwhelming it with irrelevant details. NOTE: Without this option, the agent relies solely on what it is instructed to do either by the prompt or your specific step instructions.
37
+
38
+ ```yaml
39
+ steps:
40
+ - analyze_code
41
+ - implement_fix: ^Fix the issues identified in the analysis
42
+ - add_tests: ^Prepare and publish PR
43
+
44
+ implement_fix:
45
+ include_context_summary: true # Include a summary of the workflow context so far
46
+
47
+ add_tests:
48
+ continue: true # does not need context since is continuing from the previous step
49
+ ```
50
+
22
51
  ## When to Use Agent Steps
23
52
 
24
53
  ### Use Agent Steps When:
@@ -63,22 +92,18 @@ This benefits from LLM interpretation because:
63
92
  ```markdown
64
93
  Create a new migration file with the following specifications:
65
94
 
66
- 1. Use MultiEdit to create file: db/migrate/{{timestamp}}_add_user_preferences.rb
95
+ 1. Create a new migration file: db/migrate/{{timestamp}}_add_user_preferences.rb
67
96
  2. The migration must include:
68
97
  - Add column :users, :preferences, :jsonb, default: {}
69
98
  - Add index :users, :preferences, using: :gin
70
99
  - Add column :users, :notification_settings, :jsonb, default: {}
71
100
  3. Ensure proper up/down methods
72
101
  4. Follow Rails migration conventions exactly
73
-
74
- Required tools: MultiEdit
75
- Do not use Write tool for migrations.
76
102
  ```
77
103
 
78
104
  This is better as an agent step because:
79
- - It requires specific tool usage (MultiEdit, not Write)
80
105
  - The instructions are precise and technical
81
- - No interpretation needed - just execution
106
+ - No interpretation needed - just execution of steps known beforehand
82
107
 
83
108
  ### Example 2: Code Refactoring
84
109
 
@@ -216,9 +241,6 @@ Use exact module structure and method signatures shown.
216
241
  Use MultiEdit tool to update the following files:
217
242
  - app/models/user.rb: Add validation
218
243
  - test/models/user_test.rb: Add test case
219
-
220
- # Avoid in agent steps
221
- Update the user model with better validation
222
244
  ```
223
245
 
224
246
  2. **Include specific line numbers or code markers when possible**
@@ -261,4 +283,6 @@ Use exact module structure and method signatures shown.
261
283
 
262
284
  Agent steps are powerful when you need direct control over tool usage and precise execution of technical tasks. They complement regular steps by handling the implementation details while regular steps handle the analysis and planning.
263
285
 
286
+ The `continue` and `include_context_summary` options make agent steps even more powerful for iterative development workflows where maintaining context is important.
287
+
264
288
  Choose agent steps when precision matters more than interpretation. Choose regular steps when context and judgment are important.
@@ -0,0 +1,178 @@
1
+ # Workflow Validation
2
+
3
+ Roast provides comprehensive validation for workflow configurations to catch errors early and improve the development experience.
4
+
5
+ ## Using the Validation Command
6
+
7
+ ### Validate a Single Workflow
8
+
9
+ ```bash
10
+ # Validate a specific workflow by path
11
+ roast validate path/to/workflow.yml
12
+
13
+ # Or by workflow name (assumes roast/ directory structure)
14
+ roast validate my_workflow
15
+ ```
16
+
17
+ ### Validate All Workflows
18
+
19
+ ```bash
20
+ # Validate all workflows in the roast/ directory
21
+ roast validate
22
+ ```
23
+
24
+ ### Strict Mode
25
+
26
+ Use the `--strict` or `-s` flag to treat warnings as errors:
27
+
28
+ ```bash
29
+ roast validate --strict
30
+ ```
31
+
32
+ ## Validation Levels
33
+
34
+ ### 1. Schema Validation
35
+
36
+ Ensures your workflow conforms to the JSON schema:
37
+ - Required fields (name, tools, steps)
38
+ - Correct data types
39
+ - Valid structure for complex steps (if/then, case/when, each, repeat)
40
+
41
+ ### 2. Dependency Checking
42
+
43
+ #### Tool Dependencies
44
+ Validates that all declared tools are available:
45
+ - Checks for tool module existence
46
+ - Supports MCP tool configurations
47
+ - Provides helpful suggestions for typos
48
+
49
+ #### Step References
50
+ Validates that steps referenced in conditions exist:
51
+ - Checks `if`, `unless`, and `case` conditions
52
+ - Distinguishes between step references and expressions
53
+
54
+ #### Resource Dependencies
55
+ Validates file resources:
56
+ - Warns if target files don't exist (unless using glob patterns)
57
+ - Checks for missing prompt files
58
+
59
+ ### 3. Configuration Linting
60
+
61
+ #### Naming Conventions
62
+ - Workflows should have descriptive names
63
+ - Step names should use snake_case
64
+
65
+ #### Complexity Checks
66
+ - Warns about workflows with too many steps (>20)
67
+ - Detects excessive nesting depth (>5 levels)
68
+
69
+
70
+ #### Best Practices
71
+ - Warns about missing error handling
72
+ - Detects unused tool declarations
73
+
74
+ ## Error Messages
75
+
76
+ The validator provides clear, actionable error messages:
77
+
78
+ ```
79
+ Workflow validation failed with 2 error(s):
80
+
81
+ • Missing required field: 'steps' (Add 'steps' to your workflow configuration)
82
+ • Tool 'Roast::Tools::BashCommand' is not available (Did you mean: Roast::Tools::Bash?)
83
+ ```
84
+
85
+ ## Example Workflow
86
+
87
+ Here's an example of a well-validated workflow:
88
+
89
+ ```yaml
90
+ name: Data Processing Workflow
91
+ tools:
92
+ - Roast::Tools::Bash
93
+ - Roast::Tools::ReadFile
94
+ - Roast::Tools::WriteFile
95
+
96
+ # Use inputs for sensitive data
97
+ inputs:
98
+ - api_token: "Enter your API token"
99
+
100
+ # Enable error handling
101
+ exit_on_error: true
102
+
103
+ steps:
104
+ - validate_input
105
+ - fetch_data
106
+ - process_data
107
+ - save_results
108
+ ```
109
+
110
+ ## Integration with CI/CD
111
+
112
+ You can integrate workflow validation into your CI/CD pipeline:
113
+
114
+ ```yaml
115
+ # .github/workflows/validate.yml
116
+ name: Validate Workflows
117
+ on: [push, pull_request]
118
+
119
+ jobs:
120
+ validate:
121
+ runs-on: ubuntu-latest
122
+ steps:
123
+ - uses: actions/checkout@v2
124
+ - uses: ruby/setup-ruby@v1
125
+ with:
126
+ ruby-version: '3.0'
127
+ bundler-cache: true
128
+ - name: Validate all workflows
129
+ run: bundle exec roast validate --strict
130
+ ```
131
+
132
+ ## Programmatic Usage
133
+
134
+ You can also use the validator programmatically:
135
+
136
+ ```ruby
137
+ require 'roast'
138
+
139
+ yaml_content = File.read('workflow.yml')
140
+ validator = Roast::Workflow::Validators::ValidationOrchestrator.new(yaml_content, 'workflow.yml')
141
+
142
+ if validator.valid?
143
+ puts "Workflow is valid!"
144
+
145
+ # Check for warnings
146
+ validator.warnings.each do |warning|
147
+ puts "Warning: #{warning[:message]}"
148
+ puts " → #{warning[:suggestion]}"
149
+ end
150
+ else
151
+ # Handle errors
152
+ validator.errors.each do |error|
153
+ puts "Error: #{error[:message]}"
154
+ puts " → #{error[:suggestion]}"
155
+ end
156
+ end
157
+ ```
158
+
159
+ ## Architecture
160
+
161
+ The validation system follows SOLID principles with a modular design:
162
+
163
+ - **ValidationOrchestrator**: Coordinates all validators and aggregates results
164
+ - **SchemaValidator**: Handles YAML parsing and JSON schema validation
165
+ - **DependencyValidator**: Validates tools, step references, and resources
166
+ - **LintingValidator**: Enforces best practices and code quality standards
167
+ - **StepCollector**: Provides efficient caching for step traversal
168
+
169
+ This architecture makes it easy to extend validation with new rules or customize existing behavior.
170
+
171
+ ## Future Enhancements
172
+
173
+ The validation system is designed to be extensible. Future enhancements may include:
174
+
175
+ - Detection of circular dependencies
176
+ - Performance analysis and optimization suggestions
177
+ - Custom validation rules via plugins
178
+ - Integration with language servers for real-time validation
@@ -0,0 +1,5 @@
1
+ Add documentation to the refactored code.
2
+ Include:
3
+ - Method documentation
4
+ - Class-level documentation
5
+ - Usage examples where appropriate
@@ -0,0 +1,5 @@
1
+ Enhance the GitHub client with comprehensive error handling:
2
+ - Network errors
3
+ - Authentication failures
4
+ - Rate limit exceeded
5
+ - API validation errors
@@ -0,0 +1,7 @@
1
+ Analyze this Ruby codebase and identify areas that could benefit from refactoring.
2
+ Focus on:
3
+ - Code duplication
4
+ - Complex methods that could be simplified
5
+ - Missing abstractions
6
+
7
+ Create a list of suggested improvements.
@@ -0,0 +1,24 @@
1
+ description: Example combining both continue and context summary features
2
+
3
+ # This example shows how both parameters can work together for complex workflows
4
+
5
+ steps:
6
+ # Initial exploration
7
+ - explore_api
8
+
9
+ # First coding agent task
10
+ - ^implement_client
11
+
12
+ # Continue with context awareness
13
+ - ^add_error_handling
14
+
15
+ # Final implementation with full context
16
+ - ^create_integration_tests
17
+
18
+ add_error_handling:
19
+ continue: true # Continue working on the same client
20
+ include_context_summary: true # Include context about what was explored and built
21
+
22
+ create_integration_tests:
23
+ continue: true # Continue in the same session
24
+ include_context_summary: true # Full context of implementation
@@ -0,0 +1,4 @@
1
+ Now add these additional features to the todo list class:
2
+ - Mark items as complete
3
+ - Filter by status (complete/incomplete)
4
+ - Save to and load from a JSON file
@@ -0,0 +1,3 @@
1
+ Create integration tests for the GitHub client.
2
+ Test all the functionality including error scenarios.
3
+ Use VCR for recording API interactions.
@@ -0,0 +1,5 @@
1
+ Based on what has been implemented so far, create a comprehensive README.md file that includes:
2
+ - Overview of the TodoList class
3
+ - All available methods and their usage
4
+ - Code examples
5
+ - Installation instructions