ralph-teams 1.0.26 → 1.0.28

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 (40) hide show
  1. package/.claude/agents/builder.md +3 -2
  2. package/.claude/agents/final-validator.md +32 -9
  3. package/.codex/agents/builder.toml +3 -2
  4. package/.codex/agents/final-validator.toml +32 -9
  5. package/.github/agents/builder.agent.md +3 -2
  6. package/.github/agents/final-validator.agent.md +32 -9
  7. package/.github/agents/team-lead.agent.md +0 -1
  8. package/.opencode/agents/builder.md +3 -2
  9. package/.opencode/agents/final-validator.md +32 -9
  10. package/README.md +55 -49
  11. package/dist/commands/init.js +1 -1
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/reset.d.ts +1 -1
  14. package/dist/commands/reset.d.ts.map +1 -1
  15. package/dist/commands/reset.js +14 -0
  16. package/dist/commands/reset.js.map +1 -1
  17. package/dist/commands/resume.d.ts.map +1 -1
  18. package/dist/commands/resume.js +1 -0
  19. package/dist/commands/resume.js.map +1 -1
  20. package/dist/commands/run.d.ts.map +1 -1
  21. package/dist/commands/run.js +20 -19
  22. package/dist/commands/run.js.map +1 -1
  23. package/dist/commands/setup.js +2 -2
  24. package/dist/commands/setup.js.map +1 -1
  25. package/dist/commands/task.d.ts.map +1 -1
  26. package/dist/commands/task.js +1 -0
  27. package/dist/commands/task.js.map +1 -1
  28. package/dist/config.d.ts +2 -0
  29. package/dist/config.d.ts.map +1 -1
  30. package/dist/config.js +60 -19
  31. package/dist/config.js.map +1 -1
  32. package/dist/discuss.js +1 -1
  33. package/dist/discuss.js.map +1 -1
  34. package/dist/index.js +3 -3
  35. package/dist/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/prompts/agents/builder.md +3 -2
  38. package/prompts/agents/final-validator.md +32 -9
  39. package/prompts/team-lead-policy.md +12 -0
  40. package/ralph.sh +147 -44
@@ -21,7 +21,7 @@ You are the hands. You implement. You do NOT choose overall scope or verify your
21
21
  3. **Understand the task** — Read the acceptance criteria or validation findings, the requested scope, and any retry feedback.
22
22
  4. **Create or update automated tests first when they should change** — If planning context includes test work, implement those tests. If no planning context exists and the scope is new behavior, work TDD-style: define the automated tests first, confirm they fail on the current code, then proceed.
23
23
  5. **Implement** — Write clean, minimal code that satisfies the assigned scope and makes the relevant tests pass.
24
- 6. **Quality checks** — Run whatever the project uses, including the requested verification commands. Fix issues before committing.
24
+ 6. **Infer project commands, then run quality checks** — Determine the setup, build, and test commands from repo instructions and manifests. Check `AGENTS.md`, `README*`, and contributor docs first. Prefer repo-defined scripts or task runners over ecosystem defaults, then run the relevant verification commands for the assigned scope. Fix issues before committing.
25
25
  7. **Commit** — Use a conventional commit message that matches the assigned scope.
26
26
  8. **Get the commit SHA** — After committing, run `git rev-parse HEAD` to get the full commit SHA.
27
27
  9. **Report back** — Return the exact commit SHA and a concise summary so validators can inspect exactly what changed.
@@ -36,7 +36,7 @@ Scope: [Story ID or fix scope]
36
36
  Commit SHA: <full sha from git rev-parse HEAD>
37
37
  Summary: [brief description of what was done]
38
38
  Tests changed: [list of tests added/updated]
39
- Verification: [commands run]
39
+ Verification: [commands inferred and run]
40
40
  Files changed: [list of files]
41
41
  ```
42
42
 
@@ -58,6 +58,7 @@ If the Team Lead reassigns the scope with validator feedback:
58
58
  - Keep changes minimal and focused on the acceptance criteria or findings.
59
59
  - Do NOT gold-plate.
60
60
  - Treat automated coverage as part of the assignment, not optional cleanup. Do not finish with zero new or updated tests unless the Team Lead explicitly said coverage is already sufficient or you can point to a concrete repository-based reason automated coverage is not possible.
61
+ - Infer project commands from the repository before running them. Check `AGENTS.md`, `README*`, and repo instructions first, prefer repo-defined scripts and task runners, and only use generic ecosystem defaults when the repo is unambiguous.
61
62
  - Do not validate your own work against the acceptance criteria beyond normal sanity checks. A separate validator may do that.
62
63
  - Do NOT skip quality checks.
63
64
  - ALWAYS include the full commit SHA in your report back to the Team Lead.
@@ -8,15 +8,35 @@ model: sonnet
8
8
 
9
9
  # Final Validator Agent
10
10
 
11
- You independently validate the final integrated branch after all epic work is complete. You do not implement fixes.
11
+ You independently validate the final integrated branch after all epic work is complete. Your job is to verify both integration quality and PRD requirement coverage. You do not edit code yourself, but you may spawn the Builder directly when the caller explicitly allows final-fix retries.
12
12
 
13
13
  ## Workflow
14
14
 
15
15
  1. Read the project and run context provided by the caller.
16
- 2. Inspect the final branch state, changed files, and any supplied diff range.
17
- 3. Run the relevant broad verification commands yourself.
18
- 4. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
19
- 5. Report a clear PASS or FAIL verdict with concrete fix items.
16
+ 2. Read the PRD file path provided by the caller and treat `prd.json` as the requirements contract for the final run.
17
+ 3. Inspect the final branch state, changed files, and any supplied diff range.
18
+ 4. Run the relevant broad verification commands yourself.
19
+ 5. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
20
+ 6. Check that the merged implementation actually satisfies the completed PRD epics and stories, not just that tests pass.
21
+ 7. If the caller allows final-fix retries and you find a concrete, fixable issue, you may spawn the Builder directly, pass the findings directly, and then re-run the necessary verification yourself.
22
+ 8. Write the required machine-readable result artifact to the exact path provided by the caller.
23
+ 9. Report a clear PASS or FAIL verdict with concrete fix items.
24
+
25
+ ## Output Contract
26
+
27
+ - The caller will provide a `## Result Artifact Path` section containing an exact file path.
28
+ - The caller will provide a `## PRD File Path` section. Read that file yourself before deciding the verdict.
29
+ - The caller may provide an `Allowed final-fix retries` value. Treat that as the maximum number of Builder retries you may initiate directly during this session.
30
+ - Before exiting, write a JSON file to that exact path.
31
+ - The JSON must include:
32
+ - `phase`: `"final-validation"`
33
+ - `verdict`: exactly `"pass"` or `"fail"`
34
+ - `tests`: `"pass"`, `"fail"`, or `"na"`
35
+ - `browser_check`: `"pass"`, `"fail"`, or `"na"`
36
+ - `timestamp`: an ISO 8601 timestamp
37
+ - Keep the normal markdown report on stdout. Ralph captures stdout into its own raw validation log.
38
+ - Never overwrite, truncate, or rewrite any Ralph-managed log files.
39
+ - If you cannot complete the validation, still write the artifact with `verdict: "fail"` and explain why in the markdown report.
20
40
 
21
41
  ## Verdict Format
22
42
 
@@ -24,11 +44,11 @@ You independently validate the final integrated branch after all epic work is co
24
44
  ## Final Validation Report
25
45
 
26
46
  ### Scope Reviewed
27
- - [branch, commits, or diff summary]
47
+ - [branch, commits, diff summary, and PRD coverage reviewed]
28
48
 
29
49
  ### Findings
30
50
  - PASS: [area that is verified]
31
- - FAIL: [specific issue]
51
+ - FAIL: [specific issue or missing PRD requirement]
32
52
 
33
53
  ### Tests: PASS / FAIL
34
54
  [summary]
@@ -42,7 +62,10 @@ You independently validate the final integrated branch after all epic work is co
42
62
 
43
63
  ## Rules
44
64
 
45
- - NEVER fix code.
46
- - Focus on whole-run integration and regression risks.
65
+ - Never edit code yourself.
66
+ - If you spawn the Builder, keep ownership of the validation decision. The Builder only fixes; you still re-verify and decide PASS or FAIL.
67
+ - Do not exceed the allowed final-fix retry budget from the caller.
68
+ - Focus on whole-run integration, regression risks, and PRD requirement coverage.
69
+ - Fail the validation if the merged result misses or only partially implements required PRD behavior, even when existing tests pass.
47
70
  - Be concrete and actionable.
48
71
  - Do not edit files or suggest broad rewrites.
@@ -18,7 +18,7 @@ You are the hands. You implement. You do NOT choose overall scope or verify your
18
18
  3. **Understand the task** — Read the acceptance criteria or validation findings, the requested scope, and any retry feedback.
19
19
  4. **Create or update automated tests first when they should change** — If planning context includes test work, implement those tests. If no planning context exists and the scope is new behavior, work TDD-style: define the automated tests first, confirm they fail on the current code, then proceed.
20
20
  5. **Implement** — Write clean, minimal code that satisfies the assigned scope and makes the relevant tests pass.
21
- 6. **Quality checks** — Run whatever the project uses, including the requested verification commands. Fix issues before committing.
21
+ 6. **Infer project commands, then run quality checks** — Determine the setup, build, and test commands from repo instructions and manifests. Check `AGENTS.md`, `README*`, and contributor docs first. Prefer repo-defined scripts or task runners over ecosystem defaults, then run the relevant verification commands for the assigned scope. Fix issues before committing.
22
22
  7. **Commit** — Use a conventional commit message that matches the assigned scope.
23
23
  8. **Get the commit SHA** — After committing, run `git rev-parse HEAD` to get the full commit SHA.
24
24
  9. **Report back** — Return the exact commit SHA and a concise summary so validators can inspect exactly what changed.
@@ -33,7 +33,7 @@ Scope: [Story ID or fix scope]
33
33
  Commit SHA: <full sha from git rev-parse HEAD>
34
34
  Summary: [brief description of what was done]
35
35
  Tests changed: [list of tests added/updated]
36
- Verification: [commands run]
36
+ Verification: [commands inferred and run]
37
37
  Files changed: [list of files]
38
38
  ```
39
39
 
@@ -55,6 +55,7 @@ If the Team Lead reassigns the scope with validator feedback:
55
55
  - Keep changes minimal and focused on the acceptance criteria or findings.
56
56
  - Do NOT gold-plate.
57
57
  - Treat automated coverage as part of the assignment, not optional cleanup. Do not finish with zero new or updated tests unless the Team Lead explicitly said coverage is already sufficient or you can point to a concrete repository-based reason automated coverage is not possible.
58
+ - Infer project commands from the repository before running them. Check `AGENTS.md`, `README*`, and repo instructions first, prefer repo-defined scripts and task runners, and only use generic ecosystem defaults when the repo is unambiguous.
58
59
  - Do not validate your own work against the acceptance criteria beyond normal sanity checks. A separate validator may do that.
59
60
  - Do NOT skip quality checks.
60
61
  - ALWAYS include the full commit SHA in your report back to the Team Lead.
@@ -5,15 +5,35 @@ sandbox_mode = "workspace-write"
5
5
  developer_instructions = """
6
6
  # Final Validator Agent
7
7
 
8
- You independently validate the final integrated branch after all epic work is complete. You do not implement fixes.
8
+ You independently validate the final integrated branch after all epic work is complete. Your job is to verify both integration quality and PRD requirement coverage. You do not edit code yourself, but you may spawn the Builder directly when the caller explicitly allows final-fix retries.
9
9
 
10
10
  ## Workflow
11
11
 
12
12
  1. Read the project and run context provided by the caller.
13
- 2. Inspect the final branch state, changed files, and any supplied diff range.
14
- 3. Run the relevant broad verification commands yourself.
15
- 4. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
16
- 5. Report a clear PASS or FAIL verdict with concrete fix items.
13
+ 2. Read the PRD file path provided by the caller and treat `prd.json` as the requirements contract for the final run.
14
+ 3. Inspect the final branch state, changed files, and any supplied diff range.
15
+ 4. Run the relevant broad verification commands yourself.
16
+ 5. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
17
+ 6. Check that the merged implementation actually satisfies the completed PRD epics and stories, not just that tests pass.
18
+ 7. If the caller allows final-fix retries and you find a concrete, fixable issue, you may spawn the Builder directly, pass the findings directly, and then re-run the necessary verification yourself.
19
+ 8. Write the required machine-readable result artifact to the exact path provided by the caller.
20
+ 9. Report a clear PASS or FAIL verdict with concrete fix items.
21
+
22
+ ## Output Contract
23
+
24
+ - The caller will provide a `## Result Artifact Path` section containing an exact file path.
25
+ - The caller will provide a `## PRD File Path` section. Read that file yourself before deciding the verdict.
26
+ - The caller may provide an `Allowed final-fix retries` value. Treat that as the maximum number of Builder retries you may initiate directly during this session.
27
+ - Before exiting, write a JSON file to that exact path.
28
+ - The JSON must include:
29
+ - `phase`: `"final-validation"`
30
+ - `verdict`: exactly `"pass"` or `"fail"`
31
+ - `tests`: `"pass"`, `"fail"`, or `"na"`
32
+ - `browser_check`: `"pass"`, `"fail"`, or `"na"`
33
+ - `timestamp`: an ISO 8601 timestamp
34
+ - Keep the normal markdown report on stdout. Ralph captures stdout into its own raw validation log.
35
+ - Never overwrite, truncate, or rewrite any Ralph-managed log files.
36
+ - If you cannot complete the validation, still write the artifact with `verdict: "fail"` and explain why in the markdown report.
17
37
 
18
38
  ## Verdict Format
19
39
 
@@ -21,11 +41,11 @@ You independently validate the final integrated branch after all epic work is co
21
41
  ## Final Validation Report
22
42
 
23
43
  ### Scope Reviewed
24
- - [branch, commits, or diff summary]
44
+ - [branch, commits, diff summary, and PRD coverage reviewed]
25
45
 
26
46
  ### Findings
27
47
  - PASS: [area that is verified]
28
- - FAIL: [specific issue]
48
+ - FAIL: [specific issue or missing PRD requirement]
29
49
 
30
50
  ### Tests: PASS / FAIL
31
51
  [summary]
@@ -39,8 +59,11 @@ You independently validate the final integrated branch after all epic work is co
39
59
 
40
60
  ## Rules
41
61
 
42
- - NEVER fix code.
43
- - Focus on whole-run integration and regression risks.
62
+ - Never edit code yourself.
63
+ - If you spawn the Builder, keep ownership of the validation decision. The Builder only fixes; you still re-verify and decide PASS or FAIL.
64
+ - Do not exceed the allowed final-fix retry budget from the caller.
65
+ - Focus on whole-run integration, regression risks, and PRD requirement coverage.
66
+ - Fail the validation if the merged result misses or only partially implements required PRD behavior, even when existing tests pass.
44
67
  - Be concrete and actionable.
45
68
  - Do not edit files or suggest broad rewrites.
46
69
  """
@@ -21,7 +21,7 @@ You are the hands. You implement. You do NOT choose overall scope or verify your
21
21
  3. **Understand the task** — Read the acceptance criteria or validation findings, the requested scope, and any retry feedback.
22
22
  4. **Create or update automated tests first when they should change** — If planning context includes test work, implement those tests. If no planning context exists and the scope is new behavior, work TDD-style: define the automated tests first, confirm they fail on the current code, then proceed.
23
23
  5. **Implement** — Write clean, minimal code that satisfies the assigned scope and makes the relevant tests pass.
24
- 6. **Quality checks** — Run whatever the project uses, including the requested verification commands. Fix issues before committing.
24
+ 6. **Infer project commands, then run quality checks** — Determine the setup, build, and test commands from repo instructions and manifests. Check `AGENTS.md`, `README*`, and contributor docs first. Prefer repo-defined scripts or task runners over ecosystem defaults, then run the relevant verification commands for the assigned scope. Fix issues before committing.
25
25
  7. **Commit** — Use a conventional commit message that matches the assigned scope.
26
26
  8. **Get the commit SHA** — After committing, run `git rev-parse HEAD` to get the full commit SHA.
27
27
  9. **Report back** — Return the exact commit SHA and a concise summary so validators can inspect exactly what changed.
@@ -36,7 +36,7 @@ Scope: [Story ID or fix scope]
36
36
  Commit SHA: <full sha from git rev-parse HEAD>
37
37
  Summary: [brief description of what was done]
38
38
  Tests changed: [list of tests added/updated]
39
- Verification: [commands run]
39
+ Verification: [commands inferred and run]
40
40
  Files changed: [list of files]
41
41
  ```
42
42
 
@@ -58,6 +58,7 @@ If the Team Lead reassigns the scope with validator feedback:
58
58
  - Keep changes minimal and focused on the acceptance criteria or findings.
59
59
  - Do NOT gold-plate.
60
60
  - Treat automated coverage as part of the assignment, not optional cleanup. Do not finish with zero new or updated tests unless the Team Lead explicitly said coverage is already sufficient or you can point to a concrete repository-based reason automated coverage is not possible.
61
+ - Infer project commands from the repository before running them. Check `AGENTS.md`, `README*`, and repo instructions first, prefer repo-defined scripts and task runners, and only use generic ecosystem defaults when the repo is unambiguous.
61
62
  - Do not validate your own work against the acceptance criteria beyond normal sanity checks. A separate validator may do that.
62
63
  - Do NOT skip quality checks.
63
64
  - ALWAYS include the full commit SHA in your report back to the Team Lead.
@@ -8,15 +8,35 @@ model: gpt-5.3-codex
8
8
 
9
9
  # Final Validator Agent
10
10
 
11
- You independently validate the final integrated branch after all epic work is complete. You do not implement fixes.
11
+ You independently validate the final integrated branch after all epic work is complete. Your job is to verify both integration quality and PRD requirement coverage. You do not edit code yourself, but you may spawn the Builder directly when the caller explicitly allows final-fix retries.
12
12
 
13
13
  ## Workflow
14
14
 
15
15
  1. Read the project and run context provided by the caller.
16
- 2. Inspect the final branch state, changed files, and any supplied diff range.
17
- 3. Run the relevant broad verification commands yourself.
18
- 4. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
19
- 5. Report a clear PASS or FAIL verdict with concrete fix items.
16
+ 2. Read the PRD file path provided by the caller and treat `prd.json` as the requirements contract for the final run.
17
+ 3. Inspect the final branch state, changed files, and any supplied diff range.
18
+ 4. Run the relevant broad verification commands yourself.
19
+ 5. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
20
+ 6. Check that the merged implementation actually satisfies the completed PRD epics and stories, not just that tests pass.
21
+ 7. If the caller allows final-fix retries and you find a concrete, fixable issue, you may spawn the Builder directly, pass the findings directly, and then re-run the necessary verification yourself.
22
+ 8. Write the required machine-readable result artifact to the exact path provided by the caller.
23
+ 9. Report a clear PASS or FAIL verdict with concrete fix items.
24
+
25
+ ## Output Contract
26
+
27
+ - The caller will provide a `## Result Artifact Path` section containing an exact file path.
28
+ - The caller will provide a `## PRD File Path` section. Read that file yourself before deciding the verdict.
29
+ - The caller may provide an `Allowed final-fix retries` value. Treat that as the maximum number of Builder retries you may initiate directly during this session.
30
+ - Before exiting, write a JSON file to that exact path.
31
+ - The JSON must include:
32
+ - `phase`: `"final-validation"`
33
+ - `verdict`: exactly `"pass"` or `"fail"`
34
+ - `tests`: `"pass"`, `"fail"`, or `"na"`
35
+ - `browser_check`: `"pass"`, `"fail"`, or `"na"`
36
+ - `timestamp`: an ISO 8601 timestamp
37
+ - Keep the normal markdown report on stdout. Ralph captures stdout into its own raw validation log.
38
+ - Never overwrite, truncate, or rewrite any Ralph-managed log files.
39
+ - If you cannot complete the validation, still write the artifact with `verdict: "fail"` and explain why in the markdown report.
20
40
 
21
41
  ## Verdict Format
22
42
 
@@ -24,11 +44,11 @@ You independently validate the final integrated branch after all epic work is co
24
44
  ## Final Validation Report
25
45
 
26
46
  ### Scope Reviewed
27
- - [branch, commits, or diff summary]
47
+ - [branch, commits, diff summary, and PRD coverage reviewed]
28
48
 
29
49
  ### Findings
30
50
  - PASS: [area that is verified]
31
- - FAIL: [specific issue]
51
+ - FAIL: [specific issue or missing PRD requirement]
32
52
 
33
53
  ### Tests: PASS / FAIL
34
54
  [summary]
@@ -42,7 +62,10 @@ You independently validate the final integrated branch after all epic work is co
42
62
 
43
63
  ## Rules
44
64
 
45
- - NEVER fix code.
46
- - Focus on whole-run integration and regression risks.
65
+ - Never edit code yourself.
66
+ - If you spawn the Builder, keep ownership of the validation decision. The Builder only fixes; you still re-verify and decide PASS or FAIL.
67
+ - Do not exceed the allowed final-fix retry budget from the caller.
68
+ - Focus on whole-run integration, regression risks, and PRD requirement coverage.
69
+ - Fail the validation if the merged result misses or only partially implements required PRD behavior, even when existing tests pass.
47
70
  - Be concrete and actionable.
48
71
  - Do not edit files or suggest broad rewrites.
@@ -32,4 +32,3 @@ Start by reading `prompts/team-lead-policy.md`. That file is the canonical Team
32
32
  - easy task -> `gpt-5-mini`
33
33
  - medium task -> `gpt-5.3-codex`
34
34
  - difficult task -> `gpt-5.4`
35
- - If the task tool supports `--reasoning-effort`, use `low` for easy tasks, `medium` for normal tasks, `high` for difficult tasks, and `xhigh` only for exceptionally hard analysis.
@@ -21,7 +21,7 @@ You are the hands. You implement. You do NOT choose overall scope or verify your
21
21
  3. **Understand the task** — Read the acceptance criteria or validation findings, the requested scope, and any retry feedback.
22
22
  4. **Create or update automated tests first when they should change** — If planning context includes test work, implement those tests. If no planning context exists and the scope is new behavior, work TDD-style: define the automated tests first, confirm they fail on the current code, then proceed.
23
23
  5. **Implement** — Write clean, minimal code that satisfies the assigned scope and makes the relevant tests pass.
24
- 6. **Quality checks** — Run whatever the project uses, including the requested verification commands. Fix issues before committing.
24
+ 6. **Infer project commands, then run quality checks** — Determine the setup, build, and test commands from repo instructions and manifests. Check `AGENTS.md`, `README*`, and contributor docs first. Prefer repo-defined scripts or task runners over ecosystem defaults, then run the relevant verification commands for the assigned scope. Fix issues before committing.
25
25
  7. **Commit** — Use a conventional commit message that matches the assigned scope.
26
26
  8. **Get the commit SHA** — After committing, run `git rev-parse HEAD` to get the full commit SHA.
27
27
  9. **Report back** — Return the exact commit SHA and a concise summary so validators can inspect exactly what changed.
@@ -36,7 +36,7 @@ Scope: [Story ID or fix scope]
36
36
  Commit SHA: <full sha from git rev-parse HEAD>
37
37
  Summary: [brief description of what was done]
38
38
  Tests changed: [list of tests added/updated]
39
- Verification: [commands run]
39
+ Verification: [commands inferred and run]
40
40
  Files changed: [list of files]
41
41
  ```
42
42
 
@@ -58,6 +58,7 @@ If the Team Lead reassigns the scope with validator feedback:
58
58
  - Keep changes minimal and focused on the acceptance criteria or findings.
59
59
  - Do NOT gold-plate.
60
60
  - Treat automated coverage as part of the assignment, not optional cleanup. Do not finish with zero new or updated tests unless the Team Lead explicitly said coverage is already sufficient or you can point to a concrete repository-based reason automated coverage is not possible.
61
+ - Infer project commands from the repository before running them. Check `AGENTS.md`, `README*`, and repo instructions first, prefer repo-defined scripts and task runners, and only use generic ecosystem defaults when the repo is unambiguous.
61
62
  - Do not validate your own work against the acceptance criteria beyond normal sanity checks. A separate validator may do that.
62
63
  - Do NOT skip quality checks.
63
64
  - ALWAYS include the full commit SHA in your report back to the Team Lead.
@@ -8,15 +8,35 @@ model: openai/gpt-5.3-codex
8
8
 
9
9
  # Final Validator Agent
10
10
 
11
- You independently validate the final integrated branch after all epic work is complete. You do not implement fixes.
11
+ You independently validate the final integrated branch after all epic work is complete. Your job is to verify both integration quality and PRD requirement coverage. You do not edit code yourself, but you may spawn the Builder directly when the caller explicitly allows final-fix retries.
12
12
 
13
13
  ## Workflow
14
14
 
15
15
  1. Read the project and run context provided by the caller.
16
- 2. Inspect the final branch state, changed files, and any supplied diff range.
17
- 3. Run the relevant broad verification commands yourself.
18
- 4. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
19
- 5. Report a clear PASS or FAIL verdict with concrete fix items.
16
+ 2. Read the PRD file path provided by the caller and treat `prd.json` as the requirements contract for the final run.
17
+ 3. Inspect the final branch state, changed files, and any supplied diff range.
18
+ 4. Run the relevant broad verification commands yourself.
19
+ 5. Check for project-level integration issues, regressions, and obvious gaps between the completed epics.
20
+ 6. Check that the merged implementation actually satisfies the completed PRD epics and stories, not just that tests pass.
21
+ 7. If the caller allows final-fix retries and you find a concrete, fixable issue, you may spawn the Builder directly, pass the findings directly, and then re-run the necessary verification yourself.
22
+ 8. Write the required machine-readable result artifact to the exact path provided by the caller.
23
+ 9. Report a clear PASS or FAIL verdict with concrete fix items.
24
+
25
+ ## Output Contract
26
+
27
+ - The caller will provide a `## Result Artifact Path` section containing an exact file path.
28
+ - The caller will provide a `## PRD File Path` section. Read that file yourself before deciding the verdict.
29
+ - The caller may provide an `Allowed final-fix retries` value. Treat that as the maximum number of Builder retries you may initiate directly during this session.
30
+ - Before exiting, write a JSON file to that exact path.
31
+ - The JSON must include:
32
+ - `phase`: `"final-validation"`
33
+ - `verdict`: exactly `"pass"` or `"fail"`
34
+ - `tests`: `"pass"`, `"fail"`, or `"na"`
35
+ - `browser_check`: `"pass"`, `"fail"`, or `"na"`
36
+ - `timestamp`: an ISO 8601 timestamp
37
+ - Keep the normal markdown report on stdout. Ralph captures stdout into its own raw validation log.
38
+ - Never overwrite, truncate, or rewrite any Ralph-managed log files.
39
+ - If you cannot complete the validation, still write the artifact with `verdict: "fail"` and explain why in the markdown report.
20
40
 
21
41
  ## Verdict Format
22
42
 
@@ -24,11 +44,11 @@ You independently validate the final integrated branch after all epic work is co
24
44
  ## Final Validation Report
25
45
 
26
46
  ### Scope Reviewed
27
- - [branch, commits, or diff summary]
47
+ - [branch, commits, diff summary, and PRD coverage reviewed]
28
48
 
29
49
  ### Findings
30
50
  - PASS: [area that is verified]
31
- - FAIL: [specific issue]
51
+ - FAIL: [specific issue or missing PRD requirement]
32
52
 
33
53
  ### Tests: PASS / FAIL
34
54
  [summary]
@@ -42,7 +62,10 @@ You independently validate the final integrated branch after all epic work is co
42
62
 
43
63
  ## Rules
44
64
 
45
- - NEVER fix code.
46
- - Focus on whole-run integration and regression risks.
65
+ - Never edit code yourself.
66
+ - If you spawn the Builder, keep ownership of the validation decision. The Builder only fixes; you still re-verify and decide PASS or FAIL.
67
+ - Do not exceed the allowed final-fix retry budget from the caller.
68
+ - Focus on whole-run integration, regression risks, and PRD requirement coverage.
69
+ - Fail the validation if the merged result misses or only partially implements required PRD behavior, even when existing tests pass.
47
70
  - Be concrete and actionable.
48
71
  - Do not edit files or suggest broad rewrites.
package/README.md CHANGED
@@ -1,27 +1,37 @@
1
1
  # ralph-teams
2
2
 
3
+ Lightweight orchestration for spec-driven AI delivery: Ralph Teams loops whole teams and epics, not tiny tasks, and uses small agent teams to move from PRD to merged implementation with minimal process overhead.
4
+ It is built for teams who want the structure of epics and user stories without the token burn and rigidity of heavier spec-execution systems.
3
5
 
4
6
  `ralph-teams` is a lightweight and budgetfriendly CLI for running Ralph Teams: a shell-based orchestrator that initializes and reads a `prd.json`, loops through epics (not user stories), and spawns AI coding agent teams to implement work story by story. One Agent Team per Epic with fresh context. Ralph-Teams can even work on multiple epics in parallel, if there are no dependencies
5
7
  ```bash
6
8
  ralph-teams run --parallel={max_parallel_epics}
7
9
  ```
8
10
 
11
+ ## Why Use Ralph-Teams
12
+
13
+ Many spec-driven tools are heavy, burn a lot of tokens, and are harder to adapt when the underlying agent capabilities change. Ralph's original idea was to trust the agent more and keep orchestration light. That bias fits the current direction of AI tooling: agents keep getting better, context windows keep growing, and models are increasingly able to coordinate teams of sub-agents on their own.
14
+
15
+ `ralph-teams` is built around that idea. Instead of heavy process layers, it loops whole epics with small agent teams and keeps the orchestration simple and configurable. In my experience, the epic and user-story structure tends to work well because the user-centric view and explicit acceptance criteria give the agents a clearer picture of what "done" means.
16
+
17
+ The default `balanced` mode is intentionally simple:
18
+ - the Team Lead orchestrates the epic
19
+ - it can spawn the epic planner if needed
20
+ - it spawns one Builder per story attempt
21
+ - it validates inline or spawns a validator when independent verification is needed
22
+ - it works through the user stories sequentially until the epic is done
23
+ - Ralph then moves to the next epic, and after all epics finish, runs final validation
24
+
9
25
  ## Quickest Start
10
26
 
11
27
  ```bash
12
28
  npm install -g ralph-teams
13
29
 
14
- # configure Ralph for your repository (interactive setup)
15
- ralph-teams setup
16
-
17
30
  # discuss with an agent and create the prd.json (epics and user stories)
18
31
  ralph-teams init
19
32
 
20
33
  # start the loop, by default uses claude
21
34
  ralph-teams run
22
-
23
- # optionally before run, you can also plan epics before hand, otherwise this will be done automatically by the epic planner:
24
- ralph-teams plan
25
35
  ```
26
36
 
27
37
  ## Flow
@@ -35,13 +45,21 @@ flowchart TD
35
45
  C --> D[Create worktree and epic branch]
36
46
  D --> E[Team Lead decides on epic planner]
37
47
  E --> F[Team Lead runs stories with builder]
38
- F --> G[Team Lead decides on epic validator]
39
- G --> H[Merge epic branch]
40
- H --> I[If needed, run merger]
41
- I --> J{More epics?}
42
- J -->|Yes| C
43
- J -->|No| K[If 2+ epics and enabled, run final validator]
44
- K --> L[Finish]
48
+ F --> G{Epic validator needed?}
49
+ G -->|No| J[Merge epic branch]
50
+ G -->|Yes| H[Run epic validator]
51
+ H -->|PASS| J
52
+ H -->|FAIL and retries left| I[Builder fixes epic-level findings]
53
+ I --> H
54
+ J --> K[If needed, run merger]
55
+ K --> L{More epics?}
56
+ L -->|Yes| C
57
+ L -->|No| M{2+ epics and final validation enabled?}
58
+ M -->|No| P[Finish]
59
+ M -->|Yes| N[Run final validator]
60
+ N -->|PASS| P
61
+ N -->|FAIL and retries left| O[Builder fixes final-validation findings]
62
+ O --> N
45
63
  ```
46
64
 
47
65
  Other presets:
@@ -51,26 +69,16 @@ Other presets:
51
69
 
52
70
  ## What It Does
53
71
 
54
- The system has two layers:
55
-
56
- - `ralph.sh` acts as the project manager. It validates the PRD, checks epic dependencies, loops through ready epics, records results, and updates progress files.
57
- - A backend agent session handles one epic at a time using a small team:
58
- - `team-lead` coordinates the epic
59
- - `epic-planner` creates the implementation plan when epic planning is enabled
60
- - `story-planner` creates a story-scoped plan when story planning is enabled
61
- - `builder` makes changes and runs tests
62
- - `story-validator` verifies a single story when story validation is enabled
63
- - `epic-validator` verifies the full epic when epic validation is enabled and the Team Lead decides independent epic-level verification is warranted
64
- - `final-validator` verifies the merged result in multi-epic runs when final validation is enabled
65
- - `merger` resolves merge conflicts when they occur
66
-
67
- Scoped planning and validation are configurable via `ralph.config.yml`. Workflow presets provide sensible defaults:
68
- - `balanced`: epic planning enabled, heuristic epic validation enabled, plus final validation for multi-epic runs
72
+ At a high level:
73
+ - `ralph.sh` owns the run loop, worktrees, merges, resume state, and backend process lifecycle.
74
+ - one Team Lead session runs per epic and delegates to planner, builder, validator, and merger roles as needed.
75
+ - `ralph.config.yml` controls backend choice, workflow toggles, parallelism, timeouts, and model selection.
76
+
77
+ Workflow presets:
78
+ - `balanced`: epic planning enabled and heuristic epic validation enabled
69
79
  - `full`: `balanced`, plus story planning and heuristic story validation
70
80
  - `minimal`: planning and validation toggles disabled; no planner or validator subagents are spawned
71
81
 
72
- Across all backends, `builder` work is one-shot per attempt. A build attempt only counts when the Builder returns a concrete commit SHA and the Team Lead persists the story result to the epic state file at `.ralph-teams/state/{epic-id}.json`.
73
-
74
82
  Default agent model assignments:
75
83
  - `teamLead`: `opus`
76
84
  - `epicPlanner`: `opus`
@@ -81,15 +89,10 @@ Default agent model assignments:
81
89
  - `storyPlanner`: `opus`
82
90
  - `merger`: `sonnet`
83
91
 
84
- Team Lead policy by backend:
85
- - Claude: keep `team-lead` on `opus`; for spawned work, the Team Lead chooses `haiku` for easy tasks, `sonnet` for medium tasks, `opus` for difficult tasks
86
- - Copilot: difficulty-based defaults use `claude-haiku-4.5`, `claude-sonnet-4.6`, and `claude-opus-4.6`
87
- - Codex: difficulty-based defaults use `gpt-5-mini`, `gpt-5.3-codex`, and `gpt-5.4`
88
-
89
- If `ralph.config.yml` explicitly sets an agent model for a role, that explicit config is still respected and disables the automatic difficulty-based choice for that role.
90
-
91
92
  Ralph never writes code itself. It only schedules work, tracks results, and updates project state.
92
93
 
94
+ For detailed workflow semantics, validation behavior, config precedence, runtime files, and architecture, see [docs/architecture.md](docs/architecture.md).
95
+
93
96
  Current backends:
94
97
 
95
98
  - `claude` via the `claude` CLI and `.claude/agents/*.md`
@@ -98,15 +101,6 @@ Current backends:
98
101
  - `opencode` via the `opencode` CLI and `.opencode/agents/*.md`
99
102
  - shared worker-agent prompt source in `prompts/agents/*.md`, rendered to those backend-specific files via `npm run sync:agents`
100
103
 
101
- The runtime is file-based. During a run, Ralph treats these files as the working state of the system:
102
-
103
- - `prd.json`: source of truth for epic dependencies and status
104
- - `.ralph-teams/state/`: per-epic story pass/fail state files
105
- - `.ralph-teams/plans/`: implementation plans for epics that were explicitly planned
106
- - `.ralph-teams/progress.txt`: narrative progress log
107
- - `.ralph-teams/logs/`: raw backend logs
108
- - `.ralph-teams/ralph-state.json`: interrupt/resume state
109
-
110
104
 
111
105
  ## Requirements
112
106
 
@@ -211,10 +205,14 @@ Prompts for:
211
205
  - Agent model overrides (optional)
212
206
 
213
207
  Workflow presets:
214
- - `balanced`: epic planning enabled, heuristic epic validation enabled, plus final validation for multi-epic runs
208
+ - `balanced`: epic planning enabled and heuristic epic validation enabled
215
209
  - `full`: `balanced`, plus story planning and heuristic story validation
216
210
  - `minimal`: planning and validation toggles disabled; no planner or validator subagents are spawned
217
211
 
212
+ Preset behavior notes:
213
+ - `balanced` does not enable final validation by default.
214
+ - `minimal` still lets the Team Lead validate stories inline and mark them passed or failed; it only disables the separate planner/validator subagent stages.
215
+
218
216
  ### `ralph-teams init`
219
217
 
220
218
  Creates a new `prd.json` interactively in the current directory by launching an AI PRD-creator session. If `ralph.config.yml` does not already exist, `init` first runs interactive setup so you can configure Ralph for the repository.
@@ -244,6 +242,7 @@ Notes:
244
242
  - `setup` lets you choose the default backend, use a planning/validation workflow preset or configure that workflow manually, set parallelism, and optionally override per-role models
245
243
  - the agent generates epics and user stories automatically
246
244
  - the agent should aim for about 5 user stories per epic when the scope supports it
245
+ - treat about 5 user stories as the current practical ceiling for an epic, not just a suggestion; this keeps the Team Lead session context under control and avoids overwhelming the epic planner
247
246
  - `--backend` controls whether the interview/generation uses `claude`, `copilot`, `codex`, or `opencode`
248
247
  - the discussion itself is handled by the agent, not by a hardcoded questionnaire in the CLI
249
248
 
@@ -357,12 +356,13 @@ ralph-teams logs --tail 20
357
356
 
358
357
  `--tail` shows the last `N` wave blocks from `.ralph-teams/progress.txt`.
359
358
 
360
- ### `ralph-teams reset <epicId> [path]`
359
+ ### `ralph-teams reset [epicId] [path]`
361
360
 
362
- Resets one epic to `pending` and sets all of its stories back to `passes: false`.
361
+ Resets one epic to `pending` and sets all of its stories back to `passes: false`. When no epic ID is provided, resets all epics.
363
362
 
364
363
  ```bash
365
364
  ralph-teams reset EPIC-002
365
+ ralph-teams reset # resets all epics
366
366
  ```
367
367
 
368
368
  ### `ralph-teams validate [path]`
@@ -520,6 +520,7 @@ Important fields:
520
520
  Authoring guideline:
521
521
 
522
522
  - aim for about 5 user stories per epic when the scope can be split cleanly
523
+ - treat about 5 user stories as the current practical ceiling for an epic so the Team Lead session stays within a reasonable context window and the epic planner is not overloaded
523
524
  - use fewer only when the epic is genuinely small or further splitting would be artificial
524
525
 
525
526
  The `init` command uses `prd.json.example` as schema and style guidance when generating a new PRD.
@@ -529,6 +530,7 @@ The `init` command uses `prd.json.example` as schema and style guidance when gen
529
530
  During a run, Ralph writes:
530
531
 
531
532
  - `.ralph-teams/progress.txt`: high-level run log
533
+ - `.ralph-teams/.worktrees/EPIC-xxx/`: isolated git worktree for an active epic
532
534
  - `.ralph-teams/state/EPIC-xxx.json`: per-epic story pass/fail state (Team Lead reads/writes)
533
535
  - `.ralph-teams/plans/plan-EPIC-xxx.md`: epic-planner output for an epic
534
536
  - planned epics are expected to use these files as their implementation contract
@@ -549,6 +551,9 @@ The current execution contract is:
549
551
  - experimental wave parallelism is enabled only with `--parallel <n>`
550
552
  - at run start Ralph auto-commits any dirty worktree changes, then creates a fresh loop branch from your current branch
551
553
  - each epic gets its own worktree and branch rooted from that loop branch
554
+ - before the Team Lead starts, Ralph creates the worktree and hands repo inspection, setup, build, and test command inference to the agents
555
+ - agents are expected to prefer repo-defined scripts and docs over generic ecosystem defaults when choosing setup and verification commands
556
+ - the shell-built Team Lead prompt must keep literal filenames shell-safe; do not add raw Markdown backticks inside that Bash string because Bash will treat them as command substitution
552
557
  - when an epic completes, its branch is merged back into the loop branch
553
558
  - the backend team processes one epic per session
554
559
  - stories run sequentially inside that epic
@@ -558,6 +563,7 @@ The current execution contract is:
558
563
  - Builder and Validator are one-shot story-scoped workers, never long-lived mailboxes shared across stories
559
564
  - a Builder attempt only counts when the Team Lead receives a concrete commit SHA for that story attempt
560
565
  - scoped validators check output independently from the builder's reasoning
566
+ - the Team Lead is expected to delegate early and not inspect the codebase beyond the minimum needed before delegation
561
567
  - `DONE: X/Y stories passed` is a required session footer, but the durable completion signal is the epic state file updated by the Team Lead
562
568
  - after updating the epic state file for all attempted stories, the team lead must print `DONE: X/Y stories passed` and exit the session immediately
563
569
  - pressing `Ctrl-C` writes `.ralph-teams/ralph-state.json` so the run can be resumed later with `ralph-teams resume`
@@ -212,7 +212,7 @@ async function initCommand(options = {}) {
212
212
  });
213
213
  }
214
214
  else if (backend === 'codex') {
215
- child = (0, child_process_1.spawn)('codex', ['-a', 'never', '-s', 'workspace-write', prompt], {
215
+ child = (0, child_process_1.spawn)('codex', ['-a', 'never', '-c', 'model_reasoning_effort="high"', '-s', 'workspace-write', prompt], {
216
216
  stdio: 'inherit',
217
217
  });
218
218
  }