agentic-forge 0.0.0

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 (110) hide show
  1. package/.gitattributes +24 -0
  2. package/.github/workflows/ci.yml +70 -0
  3. package/.markdownlint-cli2.jsonc +16 -0
  4. package/.prettierignore +3 -0
  5. package/.prettierrc +6 -0
  6. package/.vscode/agentic-forge.code-workspace +26 -0
  7. package/CHANGELOG.md +100 -0
  8. package/CLAUDE.md +158 -0
  9. package/CONTRIBUTING.md +152 -0
  10. package/LICENSE +21 -0
  11. package/README.md +145 -0
  12. package/agentic-forge-banner.png +0 -0
  13. package/biome.json +21 -0
  14. package/package.json +5 -0
  15. package/scripts/copy-assets.js +21 -0
  16. package/src/agents/explorer.md +97 -0
  17. package/src/agents/reviewer.md +137 -0
  18. package/src/checkpoints/manager.ts +119 -0
  19. package/src/claude/.claude/skills/analyze/SKILL.md +241 -0
  20. package/src/claude/.claude/skills/analyze/references/bug.md +62 -0
  21. package/src/claude/.claude/skills/analyze/references/debt.md +76 -0
  22. package/src/claude/.claude/skills/analyze/references/doc.md +67 -0
  23. package/src/claude/.claude/skills/analyze/references/security.md +76 -0
  24. package/src/claude/.claude/skills/analyze/references/style.md +72 -0
  25. package/src/claude/.claude/skills/create-checkpoint/SKILL.md +88 -0
  26. package/src/claude/.claude/skills/create-log/SKILL.md +75 -0
  27. package/src/claude/.claude/skills/fix-analyze/SKILL.md +102 -0
  28. package/src/claude/.claude/skills/git-branch/SKILL.md +71 -0
  29. package/src/claude/.claude/skills/git-commit/SKILL.md +107 -0
  30. package/src/claude/.claude/skills/git-pr/SKILL.md +96 -0
  31. package/src/claude/.claude/skills/orchestrate/SKILL.md +120 -0
  32. package/src/claude/.claude/skills/sdlc-plan/SKILL.md +163 -0
  33. package/src/claude/.claude/skills/sdlc-plan/references/bug.md +115 -0
  34. package/src/claude/.claude/skills/sdlc-plan/references/chore.md +105 -0
  35. package/src/claude/.claude/skills/sdlc-plan/references/feature.md +130 -0
  36. package/src/claude/.claude/skills/sdlc-review/SKILL.md +215 -0
  37. package/src/claude/.claude/skills/workflow-builder/SKILL.md +185 -0
  38. package/src/claude/.claude/skills/workflow-builder/references/REFERENCE.md +487 -0
  39. package/src/claude/.claude/skills/workflow-builder/references/workflow-example.yaml +427 -0
  40. package/src/cli.ts +182 -0
  41. package/src/commands/config-cmd.ts +28 -0
  42. package/src/commands/index.ts +21 -0
  43. package/src/commands/init.ts +96 -0
  44. package/src/commands/release-notes.ts +85 -0
  45. package/src/commands/resume.ts +103 -0
  46. package/src/commands/run.ts +234 -0
  47. package/src/commands/shortcuts.ts +11 -0
  48. package/src/commands/skills-dir.ts +11 -0
  49. package/src/commands/status.ts +112 -0
  50. package/src/commands/update.ts +64 -0
  51. package/src/commands/version.ts +27 -0
  52. package/src/commands/workflows.ts +129 -0
  53. package/src/config.ts +129 -0
  54. package/src/console.ts +790 -0
  55. package/src/executor.ts +354 -0
  56. package/src/git/worktree.ts +236 -0
  57. package/src/logging/logger.ts +95 -0
  58. package/src/orchestrator.ts +815 -0
  59. package/src/parser.ts +225 -0
  60. package/src/progress.ts +306 -0
  61. package/src/prompts/agentic-system.md +31 -0
  62. package/src/ralph-loop.ts +260 -0
  63. package/src/renderer.ts +164 -0
  64. package/src/runner.ts +634 -0
  65. package/src/signal-manager.ts +55 -0
  66. package/src/steps/base.ts +71 -0
  67. package/src/steps/conditional-step.ts +144 -0
  68. package/src/steps/index.ts +15 -0
  69. package/src/steps/parallel-step.ts +213 -0
  70. package/src/steps/prompt-step.ts +121 -0
  71. package/src/steps/ralph-loop-step.ts +186 -0
  72. package/src/steps/serial-step.ts +84 -0
  73. package/src/templates/analysis/bug.md.j2 +35 -0
  74. package/src/templates/analysis/debt.md.j2 +38 -0
  75. package/src/templates/analysis/doc.md.j2 +45 -0
  76. package/src/templates/analysis/security.md.j2 +35 -0
  77. package/src/templates/analysis/style.md.j2 +44 -0
  78. package/src/templates/analysis-summary.md.j2 +58 -0
  79. package/src/templates/checkpoint.md.j2 +27 -0
  80. package/src/templates/implementation-report.md.j2 +81 -0
  81. package/src/templates/memory.md.j2 +16 -0
  82. package/src/templates/plan-bug.md.j2 +42 -0
  83. package/src/templates/plan-chore.md.j2 +27 -0
  84. package/src/templates/plan-feature.md.j2 +41 -0
  85. package/src/templates/progress.json.j2 +16 -0
  86. package/src/templates/ralph-report.md.j2 +45 -0
  87. package/src/types.ts +141 -0
  88. package/src/workflows/analyze-codebase-merge.yaml +328 -0
  89. package/src/workflows/analyze-codebase.yaml +196 -0
  90. package/src/workflows/analyze-single.yaml +56 -0
  91. package/src/workflows/demo.yaml +180 -0
  92. package/src/workflows/one-shot.yaml +54 -0
  93. package/src/workflows/plan-build-review.yaml +160 -0
  94. package/src/workflows/ralph-loop.yaml +73 -0
  95. package/tests/config.test.ts +219 -0
  96. package/tests/console.test.ts +506 -0
  97. package/tests/executor.test.ts +339 -0
  98. package/tests/init.test.ts +86 -0
  99. package/tests/logger.test.ts +110 -0
  100. package/tests/parser.test.ts +290 -0
  101. package/tests/progress.test.ts +345 -0
  102. package/tests/ralph-loop.test.ts +418 -0
  103. package/tests/renderer.test.ts +350 -0
  104. package/tests/runner.test.ts +497 -0
  105. package/tests/setup.test.ts +7 -0
  106. package/tests/signal-manager.test.ts +26 -0
  107. package/tests/steps.test.ts +412 -0
  108. package/tests/worktree.test.ts +411 -0
  109. package/tsconfig.json +18 -0
  110. package/vitest.config.ts +8 -0
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: af-create-log
3
+ description: Add a log entry to the workflow log
4
+ argument-hint: <workflow-id> <level> <step> <message>
5
+ ---
6
+
7
+ # Create Log
8
+
9
+ ## Overview
10
+
11
+ Add a structured log entry to the workflow's NDJSON log file. Use this skill for progress milestones, errors, warnings, decisions, and context that should be recorded. Creates a structured log entry in the workflow's log file for tracking and debugging.
12
+
13
+ ## Arguments
14
+
15
+ ### Definitions
16
+
17
+ - **`<workflow-id>`** (required): The workflow identifier for output organization.
18
+ - **`<level>`** (required): Log level. Values: `Critical`, `Error`, `Warning`, `Information`.
19
+ - **`<step>`** (required): Step name for context (e.g., analyze, plan, review).
20
+ - **`<message>`** (required): Log message.
21
+
22
+ ### Values
23
+
24
+ \$ARGUMENTS
25
+
26
+ ## Core Principles
27
+
28
+ - Use appropriate log levels for severity
29
+ - Include step context for traceability
30
+ - Messages should be concise but informative
31
+ - Logs are append-only
32
+
33
+ ### Log Levels
34
+
35
+ | Level | When to Use |
36
+ | ----------- | ---------------------------------------- |
37
+ | Critical | Fatal error causing workflow to stop |
38
+ | Error | Any error that occurred |
39
+ | Warning | Unexpected issue that may need attention |
40
+ | Information | Regular progress logging |
41
+
42
+ ## Instructions
43
+
44
+ 1. Parse the workflow-id, level, step, and message
45
+ 2. Generate timestamp in ISO 8601 format
46
+ 3. Create NDJSON log entry
47
+ 4. Append to `agentic/outputs/{workflow-id}/logs.ndjson`
48
+ 5. Return confirmation with entry details
49
+
50
+ ## Output Guidance
51
+
52
+ Return JSON confirmation:
53
+
54
+ ```json
55
+ {
56
+ "success": true,
57
+ "entry": {
58
+ "timestamp": "2024-01-15T10:30:00Z",
59
+ "level": "Information",
60
+ "step": "implement",
61
+ "message": "Completed milestone 1"
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Templates
67
+
68
+ ### Log File Format
69
+
70
+ Logs are stored in `agentic/outputs/{workflow-id}/logs.ndjson` as NDJSON:
71
+
72
+ ```json
73
+ {"timestamp":"2024-01-15T10:30:00Z","level":"Information","step":"implement","message":"Started implementation","context":null}
74
+ {"timestamp":"2024-01-15T10:35:00Z","level":"Warning","step":"implement","message":"Rate limit approached","context":{"remaining":10}}
75
+ ```
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: af-fix-analyze
3
+ description: Fix issues from an analysis document iteratively
4
+ argument-hint: <type> <severity> [context]
5
+ ---
6
+
7
+ # Fix Analysis Issues
8
+
9
+ ## Overview
10
+
11
+ Iteratively fix issues identified in an analysis document. This skill reads the analysis output, prioritizes issues by severity, and fixes them one at a time. Use this skill after running any of the analyze commands (bug, debt, doc, security, style) when autofix is enabled.
12
+
13
+ ## Arguments
14
+
15
+ ### Definitions
16
+
17
+ - **`<type>`** (required): Analysis type. Values: `bug`, `debt`, `doc`, `security`, `style`.
18
+ - **`<severity>`** (required): Minimum severity to fix. Values: `minor`, `major`, `critical`.
19
+ - **`[context]`** (optional): Additional context or constraints for the fixes.
20
+
21
+ ### Values
22
+
23
+ \$ARGUMENTS
24
+
25
+ ## Core Principles
26
+
27
+ - Fix only ONE issue per iteration, then end the session
28
+ - Process issues in severity order (highest first)
29
+ - Skip issues that cannot be fixed and document the reason
30
+ - Verify fixes compile and pass lint before committing
31
+ - Preserve existing functionality when making changes
32
+ - Follow project conventions for code style and patterns
33
+
34
+ ## Instructions
35
+
36
+ 1. **Read the Analysis Document**
37
+ - Load the analysis document at `agentic/analysis/<type>.md`
38
+ - If the document does not exist, return the completion promise immediately
39
+ - Parse the list of issues and their statuses
40
+
41
+ 2. **Select Next Issue**
42
+ - Filter issues by minimum severity level
43
+ - Skip issues already marked as fixed or skipped
44
+ - Select the highest severity unfixed issue
45
+ - If no qualifying issues remain, return the completion promise
46
+
47
+ 3. **Understand the Issue**
48
+ - Read the affected file(s) mentioned in the issue
49
+ - Understand the surrounding context and dependencies
50
+ - Identify the root cause and potential fix approaches
51
+
52
+ 4. **Implement the Fix**
53
+ - Make the minimal change needed to resolve the issue
54
+ - Follow existing code patterns and conventions
55
+ - Ensure the fix does not break other functionality
56
+
57
+ 5. **Verify the Fix**
58
+ - Run build/lint commands to check for errors
59
+ - Fix any introduced issues before continuing
60
+ - Run relevant tests if available
61
+
62
+ 6. **Update and Commit**
63
+ - Mark the issue as fixed in the analysis document
64
+ - Create a commit with title starting with the issue ID
65
+ - Use `/git-commit` to create a properly formatted commit
66
+
67
+ 7. **End Session**
68
+ - Do NOT continue to the next issue
69
+ - Return session output for orchestrator to continue loop
70
+
71
+ ## Output Guidance
72
+
73
+ When all qualifying issues are fixed or the document does not exist, output the completion signal:
74
+
75
+ ```json
76
+ {
77
+ "ralph_complete": true,
78
+ "promise": "ANALYSIS_FIXES_COMPLETE",
79
+ "summary": "Brief description of what was done"
80
+ }
81
+ ```
82
+
83
+ When an issue was fixed this iteration:
84
+
85
+ ```json
86
+ {
87
+ "issue_id": "BUG-001",
88
+ "status": "fixed",
89
+ "files_changed": ["src/example.ts"],
90
+ "commit": "abc123"
91
+ }
92
+ ```
93
+
94
+ When an issue cannot be fixed:
95
+
96
+ ```json
97
+ {
98
+ "issue_id": "BUG-002",
99
+ "status": "skipped",
100
+ "reason": "Requires external dependency update"
101
+ }
102
+ ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: af-git-branch
3
+ description: Create a git branch following naming convention
4
+ argument-hint: [category] [name] [base]
5
+ ---
6
+
7
+ # Git Branch
8
+
9
+ ## Overview
10
+
11
+ Create and checkout a new git branch following the naming convention: `<category>/<issue-id>_<branch-name>` or `<category>/<branch-name>` when no issue ID is provided. Links to issue tracking when available.
12
+
13
+ ## Arguments
14
+
15
+ ### Definitions
16
+
17
+ - **`[category]`** (optional): Branch type. Common values: poc, feature, fix, chore, doc, refactor. Accepts any value. Defaults to `feature`.
18
+ - **`[name]`** (optional): Short kebab-case description of the work. Infer from context if not provided, default to `agentic/<random-id>`.
19
+ - **`[base]`** (optional): Base branch to create from. If not provided, branch from current location.
20
+
21
+ ### Values
22
+
23
+ \$ARGUMENTS
24
+
25
+ ## Core Principles
26
+
27
+ - Use kebab-case for branch names (lowercase, hyphens)
28
+ - Keep branch names concise but descriptive
29
+ - Include issue ID when context provides one
30
+ - Never prompt interactively - extract from context or use defaults
31
+ - Accept any category value provided
32
+
33
+ ## Instructions
34
+
35
+ 1. Parse the provided arguments to extract category, name, and base (if present)
36
+ 2. If arguments are incomplete, infer from conversation context:
37
+ - Look for GitHub issue references (#123, issue 123)
38
+ - Derive branch name from the task description
39
+ - Default category to `feature` if not provided
40
+ - Default name to `agentic/<random-id>` if not provided
41
+ 3. Use the provided category or default to `feature`. Common categories: poc, feature, fix, chore, doc, refactor
42
+ 4. Determine base branch:
43
+ - If base is provided, checkout that branch first
44
+ - Otherwise branch from current location
45
+ 5. Construct the branch name:
46
+ - With issue: `<category>/<issue-id>_<name>`
47
+ - Without issue: `<category>/<name>`
48
+ 6. Execute: `git checkout -b <constructed-branch-name>` (from base if provided)
49
+ 7. Return JSON output with branch details
50
+
51
+ ## Output Guidance
52
+
53
+ Return JSON with branch creation details:
54
+
55
+ ```json
56
+ {
57
+ "success": true,
58
+ "branch": "{{branch}}",
59
+ "base": "{{base}}",
60
+ "category": "{{category}}",
61
+ "issue_id": "{{issue_id}}"
62
+ }
63
+ ```
64
+
65
+ <!--
66
+ Placeholders:
67
+ - {{branch}}: Full branch name created (e.g., feature/123_add-user-auth)
68
+ - {{base}}: Base branch it was created from
69
+ - {{category}}: Branch category used (feature, fix, chore, etc.)
70
+ - {{issue_id}}: Issue ID if present, otherwise omit this field
71
+ -->
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: af-git-commit
3
+ description: Create a git commit with structured message
4
+ argument-hint: [message] [files...] [plan_step]
5
+ ---
6
+
7
+ # Git Commit
8
+
9
+ ## Overview
10
+
11
+ Create a well-structured commit with a concise title and optional bullet-point description. Commits staged changes with proper formatting and AI attribution.
12
+
13
+ ## Arguments
14
+
15
+ ### Definitions
16
+
17
+ - **`[message]`** (optional): Override commit title. If not provided, auto-generate from changes.
18
+ - **`[files...]`** (optional): Specific files to commit. Default: all staged.
19
+ - **`[plan_step]`** (optional): Reference to plan step being completed.
20
+
21
+ ### Values
22
+
23
+ \$ARGUMENTS
24
+
25
+ ## Core Principles
26
+
27
+ - Title must be short (50 chars ideal, 120 max) and focus on the main task completed
28
+ - Description is optional for small commits
29
+ - Description uses 1-5 bullet points for larger commits highlighting important aspects
30
+ - Always include AI attribution with your model name: `Co-Authored-By: Claude <model> <noreply@anthropic.com>`
31
+
32
+ ## Skill-Specific Guidelines
33
+
34
+ ### Plan Step Reference
35
+
36
+ When following a plan (implementation plan, milestone plan, etc.), include the current step reference at the start of the commit title in brackets:
37
+
38
+ - **Task-based plans**: `[Task N]` where N is the task number (e.g., `[Task 1]`, `[Task 8]`)
39
+ - **Milestone-based plans**: `[Milestone N]` when committing after completing a milestone
40
+ - **Nested plans**: `[Task M.N]` for tasks within milestones (e.g., `[Task 1.1]`, `[Task 2.3]`)
41
+
42
+ Only include this prefix if you are actively following a plan with numbered steps. If no plan context exists, omit the brackets entirely.
43
+
44
+ **Examples:**
45
+
46
+ - `[Task 8] Update CLI with orchestrator integration`
47
+ - `[Milestone 1] Complete authentication module`
48
+ - `[Task 2.3] Add unit tests for validation logic`
49
+ - `Add helper function for date parsing` (no plan context)
50
+
51
+ ## Instructions
52
+
53
+ 1. Run `git status` to verify there are changes to commit
54
+ 2. Run `git diff --staged` to analyze staged changes (if none, stage all with `git add .`)
55
+ 3. Analyze the changes to determine:
56
+ - Primary purpose of the changes (the "what")
57
+ - Impact and scope (small fix vs. larger feature)
58
+ 4. Determine plan step reference (if following a plan):
59
+ - Check if there is an active plan with numbered tasks or milestones
60
+ - Identify which task/milestone these changes correspond to
61
+ - Format the prefix accordingly (e.g., `[Task 3]`, `[Milestone 2]`, `[Task 1.2]`)
62
+ 5. Construct commit message:
63
+ - **Title**: `[Step Ref]` prefix (if applicable) + imperative mood, capitalize first letter, no period
64
+ - **Description**: Only if changes are substantial; 1-5 bullets on key aspects
65
+ 6. Execute commit using HEREDOC for proper formatting:
66
+
67
+ ```bash
68
+ git commit -m "$(cat <<'EOF'
69
+ [Task N] <title>
70
+
71
+ - bullet 1 (optional)
72
+ - bullet 2 (optional)
73
+
74
+ Co-Authored-By: Claude <model> <noreply@anthropic.com>
75
+ EOF
76
+ )"
77
+ ```
78
+
79
+ 7. Return JSON output with commit details
80
+
81
+ ## Output Guidance
82
+
83
+ Return JSON with commit details:
84
+
85
+ ```json
86
+ {
87
+ "success": true,
88
+ "commit_hash": "{{commit_hash}}",
89
+ "message": "{{message}}",
90
+ "files_committed": ["{{files}}"],
91
+ "stats": {
92
+ "files_changed": "{{files_changed}}",
93
+ "insertions": "{{insertions}}",
94
+ "deletions": "{{deletions}}"
95
+ }
96
+ }
97
+ ```
98
+
99
+ <!--
100
+ Placeholders:
101
+ - {{commit_hash}}: Short commit hash (e.g., abc1234)
102
+ - {{message}}: Commit title/message
103
+ - {{files}}: Array of committed file paths
104
+ - {{files_changed}}: Number of files changed
105
+ - {{insertions}}: Lines added
106
+ - {{deletions}}: Lines removed
107
+ -->
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: af-git-pr
3
+ description: Create a pull request with contextual title and description
4
+ argument-hint: [title] [body] [base] [--draft]
5
+ ---
6
+
7
+ # Git PR
8
+
9
+ ## Overview
10
+
11
+ Create a pull request using the GitHub CLI with a descriptive title and appropriately-sized description. The PR description is automatically scaled based on the scope and impact of the changes.
12
+
13
+ ## Arguments
14
+
15
+ ### Definitions
16
+
17
+ - **`[title]`** (optional): PR title. Auto-generated if not provided.
18
+ - **`[body]`** (optional): PR body/description. Auto-generated if not provided.
19
+ - **`[base]`** (optional): Target branch for the PR. Defaults to main/master.
20
+ - **`[--draft]`** (optional): Create as draft PR. Defaults to false.
21
+
22
+ ### Values
23
+
24
+ \$ARGUMENTS
25
+
26
+ ## Core Principles
27
+
28
+ - PR size dictates description length - small changes get small descriptions
29
+ - Title should clearly convey the primary change
30
+ - Description focuses on WHY and context, not WHAT (diff shows the what)
31
+ - Use `gh pr create` for PR creation
32
+ - Always include AI attribution at the end of the body
33
+
34
+ ## Instructions
35
+
36
+ 1. Verify current branch is not the base branch
37
+ 2. Push current branch to remote if needed
38
+ 3. Fetch the latest remote base branch: `git fetch origin <base>`
39
+ 4. Run `git log origin/<base>..HEAD --oneline` to get commits in this PR
40
+ 5. Run `git diff origin/<base>...HEAD --stat` to assess change scope
41
+ 6. Determine PR size category:
42
+ - **Trivial**: <10 lines, single file, style/typo fix
43
+ - **Small**: <50 lines, focused change
44
+ - **Medium**: 50-200 lines, feature or significant fix
45
+ - **Large**: >200 lines, major feature or refactor
46
+ 7. Construct PR content based on size:
47
+
48
+ **Trivial/Small**: Brief description with attribution
49
+
50
+ ```bash
51
+ gh pr create --title "Fix typo in README" --body "Corrects spelling error
52
+
53
+ 🤖 Generated with [Claude Code](https://claude.com/product/claude-code)"
54
+ ```
55
+
56
+ **Medium/Large**: Structured description with attribution
57
+
58
+ ```bash
59
+ gh pr create --title "<title>" --body "## Summary
60
+ <1-2 sentence overview>
61
+
62
+ ## Details
63
+ - <Key change 1 with context>
64
+ - <Key change 2 with context>
65
+
66
+ 🤖 Generated with [Claude Code](https://claude.com/product/claude-code)"
67
+ ```
68
+
69
+ 8. Execute `gh pr create` with constructed content
70
+ 9. Return JSON output with PR details
71
+
72
+ ## Output Guidance
73
+
74
+ Return JSON with PR details:
75
+
76
+ ```json
77
+ {
78
+ "success": true,
79
+ "pr_number": "{{pr_number}}",
80
+ "url": "{{url}}",
81
+ "title": "{{title}}",
82
+ "base": "{{base}}",
83
+ "head": "{{head}}",
84
+ "draft": "{{draft}}"
85
+ }
86
+ ```
87
+
88
+ <!--
89
+ Placeholders:
90
+ - {{pr_number}}: PR number assigned by GitHub
91
+ - {{url}}: Full URL to the PR
92
+ - {{title}}: PR title used
93
+ - {{base}}: Target branch (e.g., main)
94
+ - {{head}}: Source branch name
95
+ - {{draft}}: Boolean indicating if created as draft
96
+ -->
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: af-orchestrate
3
+ description: Evaluate workflow state and determine next action
4
+ ---
5
+
6
+ # Orchestrate
7
+
8
+ ## Overview
9
+
10
+ You are the workflow orchestrator. Your job is to evaluate the current workflow state and determine what action should be taken next. You receive the workflow definition, current progress, and last step output, then return a JSON decision.
11
+
12
+ ## Core Principles
13
+
14
+ - Check for completion first: if all steps are done, return `workflow_status: completed`
15
+ - Check for failures: if a step failed and max retries reached, return `workflow_status: failed`
16
+ - Check for blocking: if human input is required, return `workflow_status: blocked`
17
+ - Handle errors gracefully: if last step failed but retries remain, return `retry_step`
18
+ - Always provide clear reasoning for decisions
19
+
20
+ ## Skill-Specific Guidelines
21
+
22
+ ### Condition Evaluation
23
+
24
+ For conditional steps, evaluate the Jinja2 condition using the available context:
25
+
26
+ - `outputs.{step_name}` - Previous step outputs
27
+ - `variables.{var_name}` - Workflow variables
28
+
29
+ ### Decision Examples
30
+
31
+ **Execute Next Step:**
32
+
33
+ ```json
34
+ {
35
+ "workflow_status": "in_progress",
36
+ "next_action": {
37
+ "type": "execute_step",
38
+ "step_name": "implement",
39
+ "context_to_pass": "Implement the feature based on the plan in step 'plan'"
40
+ },
41
+ "reasoning": "Plan step completed successfully, proceeding to implementation",
42
+ "progress_update": "Starting implementation phase"
43
+ }
44
+ ```
45
+
46
+ **Workflow Complete:**
47
+
48
+ ```json
49
+ {
50
+ "workflow_status": "completed",
51
+ "next_action": {
52
+ "type": "complete"
53
+ },
54
+ "reasoning": "All steps completed successfully, PR created",
55
+ "progress_update": "Workflow completed successfully"
56
+ }
57
+ ```
58
+
59
+ **Retry Failed Step:**
60
+
61
+ ```json
62
+ {
63
+ "workflow_status": "in_progress",
64
+ "next_action": {
65
+ "type": "retry_step",
66
+ "step_name": "review",
67
+ "error_context": "Test failures in auth.test.ts - fix the mock setup"
68
+ },
69
+ "reasoning": "Validation failed with test errors, 2 retries remaining",
70
+ "progress_update": "Retrying validation after fixing test issues"
71
+ }
72
+ ```
73
+
74
+ ## Instructions
75
+
76
+ 1. **Receive Input**
77
+ - Workflow definition (YAML)
78
+ - Current progress document (JSON)
79
+ - Last step output (if any)
80
+
81
+ 2. **Analyze Workflow State**
82
+ - Check if all steps are completed
83
+ - Check for failed steps and retry counts
84
+ - Check for blocking conditions
85
+
86
+ 3. **Determine Next Action**
87
+ - Based on step dependencies and conditions
88
+ - Evaluate any Jinja2 conditions
89
+ - Identify the appropriate action type
90
+
91
+ 4. **Return JSON Decision**
92
+
93
+ ## Output Guidance
94
+
95
+ Return ONLY a valid JSON object in this exact format:
96
+
97
+ ```json
98
+ {
99
+ "workflow_status": "{{status}}",
100
+ "next_action": {
101
+ "type": "{{action_type}}",
102
+ "step_name": "{{step_name}}",
103
+ "context_to_pass": "{{context}}",
104
+ "error_context": "{{error_context}}"
105
+ },
106
+ "reasoning": "{{reasoning}}",
107
+ "progress_update": "{{progress_update}}"
108
+ }
109
+ ```
110
+
111
+ <!--
112
+ Placeholders:
113
+ - {{status}}: One of in_progress, completed, failed, blocked
114
+ - {{action_type}}: One of execute_step, retry_step, wait_for_human, complete, abort
115
+ - {{step_name}}: Name of step to execute (if applicable, omit otherwise)
116
+ - {{context}}: Context string for the step (if applicable, omit otherwise)
117
+ - {{error_context}}: Error details for retry (if retrying, omit otherwise)
118
+ - {{reasoning}}: Brief explanation of why this decision was made
119
+ - {{progress_update}}: What to record in progress document
120
+ -->