@klaudworks/rmr 1.1.2 → 1.2.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.
package/README.md CHANGED
@@ -162,6 +162,25 @@ rmr install feature-dev
162
162
  rmr run .rmr/workflows/feature-dev/workflow.yaml
163
163
  ```
164
164
 
165
+ <details>
166
+ <summary><strong>beads</strong> (requires beads + toon)</summary>
167
+
168
+ Autonomous issue loop powered by Beads: pick the next issue, plan, implement,
169
+ review, then continue with the next issue.
170
+
171
+ See docs: [docs/workflows/beads/](docs/workflows/beads/)
172
+
173
+ Prerequisites:
174
+ - [beads](https://github.com/steveyegge/beads)
175
+ - [toon](https://github.com/toon-format/toon?tab=readme-ov-file)
176
+
177
+ ```bash
178
+ rmr install beads
179
+ rmr run .rmr/workflows/beads/workflow.yaml
180
+ ```
181
+
182
+ </details>
183
+
165
184
  ## Supported Harnesses
166
185
 
167
186
  Specify a default harness (and optionally model) at the top level of your workflow file. Individual steps can override both, so you can mix providers within a single workflow.
package/dist/index.js CHANGED
@@ -10838,7 +10838,7 @@ function bashScript() {
10838
10838
  " fi",
10839
10839
  "",
10840
10840
  ' if [[ "${prev}" == "install" ]]; then',
10841
- ' COMPREPLY=( $(compgen -W "feature-dev" -- "${cur}") )',
10841
+ ' COMPREPLY=( $(compgen -W "feature-dev beads" -- "${cur}") )',
10842
10842
  " return 0",
10843
10843
  " fi",
10844
10844
  "}",
@@ -10869,7 +10869,7 @@ function zshScript() {
10869
10869
  " fi",
10870
10870
  "",
10871
10871
  " if [[ ${words[2]} == install && $CURRENT -eq 3 ]]; then",
10872
- " compadd -- feature-dev",
10872
+ " compadd -- feature-dev beads",
10873
10873
  " return",
10874
10874
  " fi",
10875
10875
  "}",
@@ -10891,7 +10891,7 @@ function fishScript() {
10891
10891
  `complete -c ${binaryName} -n '__fish_use_subcommand' -a 'install run continue complete completion'`,
10892
10892
  `complete -c ${binaryName} -n '__fish_seen_subcommand_from continue' -a '(__rex_complete_run_id)'`,
10893
10893
  `complete -c ${binaryName} -n '__fish_seen_subcommand_from run' -a '(__rex_complete_workflow)'`,
10894
- `complete -c ${binaryName} -n '__fish_seen_subcommand_from install' -a 'feature-dev'`
10894
+ `complete -c ${binaryName} -n '__fish_seen_subcommand_from install' -a 'feature-dev beads'`
10895
10895
  ].join(`
10896
10896
  `);
10897
10897
  }
@@ -12028,8 +12028,18 @@ class ContinueCommand extends BaseCommand {
12028
12028
  // src/commands/install.ts
12029
12029
  import { cp, readdir as readdir2 } from "node:fs/promises";
12030
12030
  import { existsSync } from "node:fs";
12031
- import { dirname as dirname3, resolve as resolve7 } from "node:path";
12031
+ import { basename as basename2, dirname as dirname3, resolve as resolve7 } from "node:path";
12032
12032
  import { fileURLToPath as fileURLToPath2 } from "node:url";
12033
+
12034
+ // src/lib/workflow-utils.ts
12035
+ function workflowRequiresTask(workflow) {
12036
+ return workflow.steps.some((step) => step.requires.inputs.includes("task"));
12037
+ }
12038
+ function getWorkflowDefaultHarness(workflow) {
12039
+ return workflow.harness ?? "(none - step-level harnesses only)";
12040
+ }
12041
+
12042
+ // src/commands/install.ts
12033
12043
  function getExamplesWorkflowsDir() {
12034
12044
  const thisDir = dirname3(fileURLToPath2(import.meta.url));
12035
12045
  const fromDist = resolve7(thisDir, "..", "examples", "workflows");
@@ -12040,6 +12050,17 @@ function getExamplesWorkflowsDir() {
12040
12050
  return fromSrc;
12041
12051
  return fromSrc;
12042
12052
  }
12053
+ function resolveWorkflowFilePath(workflowDir) {
12054
+ const yamlPath = resolve7(workflowDir, "workflow.yaml");
12055
+ if (existsSync(yamlPath)) {
12056
+ return yamlPath;
12057
+ }
12058
+ const ymlPath = resolve7(workflowDir, "workflow.yml");
12059
+ if (existsSync(ymlPath)) {
12060
+ return ymlPath;
12061
+ }
12062
+ throw new UserInputError(`Workflow directory does not contain workflow.yaml or workflow.yml: ${workflowDir}`);
12063
+ }
12043
12064
 
12044
12065
  class InstallCommand extends BaseCommand {
12045
12066
  static paths = [["install"]];
@@ -12065,14 +12086,28 @@ class InstallCommand extends BaseCommand {
12065
12086
  const hint = available.length > 0 ? ` Available: ${available.join(", ")}.` : " No bundled workflows found.";
12066
12087
  throw new UserInputError(`Unknown workflow "${this.workflowName}".${hint}`);
12067
12088
  }
12089
+ const sourceWorkflowPath = resolveWorkflowFilePath(sourceDir);
12090
+ const sourceWorkflow = await loadWorkflowDefinition(sourceWorkflowPath).catch((error) => {
12091
+ const message = error instanceof Error ? error.message : String(error);
12092
+ throw new UserInputError(`Bundled workflow "${this.workflowName}" is invalid: ${message}`);
12093
+ });
12094
+ const workflowFileName = basename2(sourceWorkflowPath);
12095
+ const installedWorkflowPath = `.rmr/workflows/${this.workflowName}/${workflowFileName}`;
12096
+ const runHint = workflowRequiresTask(sourceWorkflow) ? `${binaryName} run ${installedWorkflowPath} --task "Describe your task"` : `${binaryName} run ${installedWorkflowPath}`;
12097
+ const defaultHarness = getWorkflowDefaultHarness(sourceWorkflow);
12098
+ const harnessHint = `To use codex or opencode, edit ${installedWorkflowPath} and change "harness:"` + ` (optionally "model:").`;
12068
12099
  if (existsSync(destinationDir)) {
12069
12100
  ui.info(`Workflow already installed at .rmr/workflows/${this.workflowName}/`);
12070
- ui.info(`Run it with: ${binaryName} run .rmr/workflows/${this.workflowName}/workflow.yaml --task "Describe your task"`);
12101
+ ui.info(`Run it with: ${runHint}`);
12102
+ ui.info(`Default harness: ${defaultHarness}`);
12103
+ ui.info(harnessHint);
12071
12104
  return 0;
12072
12105
  }
12073
12106
  await cp(sourceDir, destinationDir, { recursive: true, force: false, errorOnExist: true });
12074
12107
  ui.success(`installed .rmr/workflows/${this.workflowName}/`);
12075
- ui.info(`Run it with: ${binaryName} run .rmr/workflows/${this.workflowName}/workflow.yaml --task "Describe your task"`);
12108
+ ui.info(`Run it with: ${runHint}`);
12109
+ ui.info(`Default harness: ${defaultHarness}`);
12110
+ ui.info(harnessHint);
12076
12111
  return 0;
12077
12112
  }
12078
12113
  }
@@ -12193,13 +12228,13 @@ class ListCommand extends BaseCommand {
12193
12228
  }
12194
12229
 
12195
12230
  // src/commands/root.ts
12196
- import { basename as basename2 } from "node:path";
12231
+ import { basename as basename3 } from "node:path";
12197
12232
  function detectShell() {
12198
12233
  const raw = process.env.SHELL;
12199
12234
  if (!raw) {
12200
12235
  return null;
12201
12236
  }
12202
- const shell = basename2(raw);
12237
+ const shell = basename3(raw);
12203
12238
  if (shell === "bash" || shell === "zsh" || shell === "fish") {
12204
12239
  return shell;
12205
12240
  }
@@ -12319,9 +12354,6 @@ async function resolveWorkflowPath(inputPath) {
12319
12354
  throw new UserInputError(`Failed to access workflow path "${absolutePath}": ${getErrorMessage(error)}`);
12320
12355
  }
12321
12356
  }
12322
- function workflowRequiresTask(workflow) {
12323
- return workflow.steps.some((step) => step.requires.inputs.includes("task"));
12324
- }
12325
12357
 
12326
12358
  class RunCommand extends BaseCommand {
12327
12359
  static paths = [["run"]];
@@ -0,0 +1,79 @@
1
+ # Implement
2
+
3
+ You are implementing one beads issue selected by the planner.
4
+ Use issue comments as the source of truth for research context and plan.
5
+
6
+ ## Subagent Use
7
+
8
+ - Do not use subagents for basic code exploration.
9
+ - Read files and grep directly for general repo understanding.
10
+ - Use subagents sparingly, only when a focused deep lookup is needed.
11
+
12
+ ## Workflow
13
+
14
+ 1. Determine issue id:
15
+ - Use `{{verify.issue_id}}` if present (loop-back from review).
16
+ - Otherwise use `{{plan.issue_id}}`.
17
+ 2. If needed, claim issue:
18
+ `bd update <issue-id> --status in_progress --json | toon`
19
+ 3. Read issue comments once:
20
+ `bd comments <issue-id> --json -q | toon`
21
+ - Find latest planning comment and any review feedback.
22
+ 4. Read relevant source files broadly.
23
+ 5. Confirm project checks pass before changes:
24
+ - `go build ./...`
25
+ - `go vet ./...`
26
+ 6. Implement the planned change.
27
+ 7. Verify:
28
+ - Build passes
29
+ - All tests pass -- not just the ones related to your change.
30
+ If a pre-existing test fails, investigate and fix it.
31
+ Do not skip, disable, or weaken tests to work around breakage.
32
+ - Any additional verification from the issue plan comment.
33
+ 8. Commit with a clear message describing what changed and why.
34
+ 9. Add implementation handoff comment with:
35
+ - commit hash
36
+ - what changed
37
+ - verification results
38
+ Example:
39
+ `bd comments add <issue-id> "Review target commit: <hash>\n\nImplementation summary: ...\n\nVerification: ..." --json | toon`
40
+ 10. Keep the issue open and `in_progress` for review:
41
+ - `bd update <issue-id> --status in_progress --json | toon`
42
+
43
+ ## Principles
44
+
45
+ - One atomic commit per task. The review agent expects a single coherent
46
+ change to evaluate.
47
+ - Do NOT fix unrelated issues you happen to notice -- note them in your
48
+ output so they can be filed separately.
49
+ - Do NOT gold-plate. Implement what the plan asks for, elegantly, then stop.
50
+ - Do NOT skip verification. Every change must leave the project in a
51
+ working state.
52
+
53
+ ## Output
54
+
55
+ Emit `<rmr:*>` tags at the end of your response. rmr parses these automatically.
56
+
57
+ On success:
58
+
59
+ ```
60
+ <rmr:status>done</rmr:status>
61
+ <rmr:issue_id><issue-id></rmr:issue_id>
62
+ <rmr:summary>What was implemented and why</rmr:summary>
63
+ <rmr:commit>The commit hash</rmr:commit>
64
+ <rmr:tests>Test results summary</rmr:tests>
65
+ ```
66
+
67
+ If blocked after 3 attempts:
68
+
69
+ ```
70
+ <rmr:status>human_intervention_required</rmr:status>
71
+ <rmr:issue_id><issue-id></rmr:issue_id>
72
+ <rmr:reason>What is blocking and what was tried</rmr:reason>
73
+ ```
74
+
75
+ ## Context
76
+
77
+ Reviewer feedback: {{verify.issues}}
78
+ Planned issue: {{plan.issue_id}}
79
+ Loop issue: {{verify.issue_id}}
@@ -0,0 +1,69 @@
1
+ # Planner
2
+
3
+ You are the combined research + planning step for a beads issue loop.
4
+ Pick one issue, validate it, research it, write the implementation plan to
5
+ issue comments, and hand off by issue id.
6
+
7
+ ## Command Rules
8
+
9
+ - Use `--json | toon` for beads commands.
10
+ - Prefer narrow issue-scoped reads after selection.
11
+ - Do not run `bd prime` in this loop.
12
+
13
+ ## Subagent Use
14
+
15
+ - Do not use subagents for basic code exploration.
16
+ - Read files and grep directly for general repo understanding.
17
+ - Use subagents sparingly, only when a focused deep lookup is needed.
18
+
19
+ ## Workflow
20
+
21
+ 1. Select next work (highest priority):
22
+ - `bd list --status in_progress --sort priority --limit 1 --json -q | toon`
23
+ - If an in-progress issue exists, use it.
24
+ - Otherwise: `bd ready --sort priority --limit 1 --json -q | toon`
25
+ 2. If no issue is available, stop the loop for this run:
26
+ ```
27
+ <rmr:status>done</rmr:status>
28
+ <rmr:next_state>done</rmr:next_state>
29
+ <rmr:summary>No ready beads issues.</rmr:summary>
30
+ <rmr:issue_id>N/A</rmr:issue_id>
31
+ ```
32
+ 3. If selected issue is not `in_progress`, claim it:
33
+ `bd update <issue-id> --status in_progress --json | toon`
34
+ 4. Read issue comments once:
35
+ `bd comments <issue-id> --json -q | toon`
36
+ 5. Validate problem and value. If invalid/low-value:
37
+ - Add concise evidence comment.
38
+ - Close the issue with reason.
39
+ - Emit `<rmr:next_state>plan</rmr:next_state>` to continue loop.
40
+ 6. For valid issues, research and plan in one pass:
41
+ - Local code touchpoints (paths + symbols)
42
+ - Relevant spec anchors under `spec/`
43
+ - `.cache/repos/` references when useful
44
+ - Risks, edge cases, and test guidance
45
+ 7. Write one structured comment that contains both research and plan.
46
+ 8. Keep the issue `in_progress` and hand off by `<rmr:issue_id>`.
47
+
48
+ ## Output
49
+
50
+ Valid issue handoff:
51
+
52
+ ```
53
+ <rmr:status>done</rmr:status>
54
+ <rmr:issue_id><issue-id></rmr:issue_id>
55
+ <rmr:summary>Planned issue <issue-id></rmr:summary>
56
+ ```
57
+
58
+ Invalid/low-value issue (continue loop):
59
+
60
+ ```
61
+ <rmr:status>done</rmr:status>
62
+ <rmr:next_state>plan</rmr:next_state>
63
+ <rmr:summary>Closed issue <issue-id>: <reason></rmr:summary>
64
+ <rmr:issue_id><issue-id></rmr:issue_id>
65
+ ```
66
+
67
+ ## Context
68
+
69
+ No external task input is required. Select work from beads only.
@@ -0,0 +1,91 @@
1
+ # Review
2
+
3
+ You are reviewing a change made by the implement agent.
4
+ Use the beads issue comments as the source of truth for plan, implementation
5
+ notes, and review history.
6
+
7
+ ## Subagent Use
8
+
9
+ - Do not use subagents for basic code exploration.
10
+ - Read files and grep directly for general repo understanding.
11
+ - Use subagents sparingly, only when a focused deep lookup is needed.
12
+
13
+ ## Workflow
14
+
15
+ 1. Use `{{implement.issue_id}}` as the active issue id.
16
+ 2. Read issue comments once:
17
+ `bd comments <issue-id> --json -q | toon`
18
+ - Find latest `Review target commit: <hash>` marker.
19
+ 3. Read the commit diff to see the actual changes.
20
+ 4. If the diff is not enough to understand the change (large refactors,
21
+ structural moves), read the affected files in their final state.
22
+ 5. Evaluate:
23
+ - **Correctness**: Does the change achieve what the plan intended?
24
+ - **No regressions**: Could it break existing behavior?
25
+ - **Code quality**: Clean, idiomatic code? Is the result elegant?
26
+ - **Behavioral preservation**: For refactors, does the code still do
27
+ exactly the same thing?
28
+ - **Net improvement**: Is the codebase clearly better after this change?
29
+ 6. Verify the build passes and all tests are green.
30
+ 7. Make your decision.
31
+
32
+ ## Routing Actions
33
+
34
+ - **Approve**:
35
+ - `bd comments add <issue-id> "Review: approved" --json | toon`
36
+ - `bd close <issue-id> --reason "Approved" --json | toon`
37
+ - **Request changes**:
38
+ - `bd comments add <issue-id> "Review issues: <what to fix and why>" --json | toon`
39
+ - `bd update <issue-id> --status in_progress --json | toon`
40
+ - **Escalate**:
41
+ - `bd comments add <issue-id> "Review blocked: <reason>" --json | toon`
42
+
43
+ ## What to Look For
44
+
45
+ - Semantic changes: refactors that subtly change behavior
46
+ - Missing error handling
47
+ - Test validity: new tests that do not actually test what they claim
48
+ - Unrelated changes sneaking in (but touching many files for a consistent
49
+ refactor is fine)
50
+
51
+ ## Decisions
52
+
53
+ Use `<rmr:next_state>` to route the workflow.
54
+
55
+ **Approve** -- the change is correct and improves the codebase:
56
+
57
+ ```
58
+ <rmr:status>done</rmr:status>
59
+ <rmr:issue_id><issue-id></rmr:issue_id>
60
+ <rmr:next_state>plan</rmr:next_state>
61
+ <rmr:summary>Why this change is good</rmr:summary>
62
+ ```
63
+
64
+ **Request changes** -- issues that need fixing (sends back to implement):
65
+
66
+ ```
67
+ <rmr:status>done</rmr:status>
68
+ <rmr:issue_id><issue-id></rmr:issue_id>
69
+ <rmr:next_state>implement</rmr:next_state>
70
+ <rmr:issues>What needs to be fixed and why</rmr:issues>
71
+ ```
72
+
73
+ **Escalate** -- needs human judgment:
74
+
75
+ ```
76
+ <rmr:status>human_intervention_required</rmr:status>
77
+ <rmr:issue_id><issue-id></rmr:issue_id>
78
+ <rmr:reason>Why human input is needed</rmr:reason>
79
+ ```
80
+
81
+ ## Do NOT
82
+
83
+ - Make improvements -- review only
84
+ - Refactor code touched by the commit
85
+ - Add unrelated tests
86
+ - Approve changes that fail build or tests
87
+ - Skip or weaken tests to make the suite pass
88
+
89
+ ## Context
90
+
91
+ Issue: {{implement.issue_id}}
@@ -0,0 +1,28 @@
1
+ # Beads autonomous loop for rmr.
2
+ # Three steps: plan (select + research + plan), implement, verify (review).
3
+ # verify routes back to plan after approval to continue processing issues.
4
+
5
+ id: beads
6
+ name: Beads Development Workflow
7
+ harness: claude # Default harness for all steps; set codex or opencode to switch.
8
+ # model: <provider/model> # Optional: uncomment to pin a default model.
9
+
10
+ steps:
11
+ - id: plan
12
+ prompt_file: planner-agent.md
13
+ next_step: implement
14
+ requires:
15
+ outputs: [issue_id]
16
+
17
+ - id: implement
18
+ prompt_file: implement-agent.md
19
+ next_step: verify
20
+ requires:
21
+ inputs: [plan.issue_id]
22
+ outputs: [issue_id]
23
+
24
+ - id: verify
25
+ prompt_file: review-agent.md
26
+ next_step: plan
27
+ requires:
28
+ inputs: [implement.issue_id]
@@ -1,6 +1,7 @@
1
1
  id: feature-dev
2
2
  name: Feature Development
3
- harness: claude
3
+ harness: claude # Default harness for all steps; set codex or opencode to switch.
4
+ # model: <provider/model> # Optional: uncomment to pin a default model.
4
5
 
5
6
  steps:
6
7
  - id: plan
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@klaudworks/rex",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@klaudworks/rex",
9
- "version": "1.1.2",
9
+ "version": "1.2.1",
10
10
  "dependencies": {
11
11
  "clipanion": "^4.0.0-rc.4",
12
12
  "yaml": "^2.8.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klaudworks/rmr",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "Define multi-step coding workflows for AI agents",
5
5
  "license": "MIT",
6
6
  "repository": {