rl-workspaces 0.5.0 → 0.7.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 (55) hide show
  1. package/README.md +234 -193
  2. package/bin/rl +2 -54
  3. package/dist/agent-launch.js +1 -1
  4. package/dist/agent-presets.js +42 -17
  5. package/dist/agent-resume.js +2 -2
  6. package/dist/agent-runner.js +20 -0
  7. package/dist/agent-workflows.js +60 -16
  8. package/dist/automation-config.js +144 -5
  9. package/dist/bootstrap.js +74 -0
  10. package/dist/cli.js +2 -0
  11. package/dist/command-context.js +1 -1
  12. package/dist/common.js +3 -2
  13. package/dist/dependencies.js +197 -0
  14. package/dist/doctor.js +1 -1
  15. package/dist/git-workflow.js +8 -102
  16. package/dist/help.js +113 -116
  17. package/dist/hooks.js +1 -1
  18. package/dist/install.js +143 -0
  19. package/dist/mcp-setup.js +171 -0
  20. package/dist/mcp.js +13 -16
  21. package/dist/picker.js +24 -7
  22. package/dist/pr-workflow.js +7 -28
  23. package/dist/repos.js +5 -1
  24. package/dist/session-workflows.js +122 -18
  25. package/dist/session.js +1 -1
  26. package/dist/state.js +4 -14
  27. package/dist/storage.js +2 -2
  28. package/dist/store.js +2 -2
  29. package/dist/summary.js +1 -1
  30. package/dist/workflow-collaboration.js +531 -0
  31. package/dist/workflow.js +24 -38
  32. package/lib/entry.zsh +54 -0
  33. package/lib/rl.zsh +37 -9
  34. package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
  35. package/node_modules/smol-toml/LICENSE +24 -0
  36. package/node_modules/smol-toml/README.md +605 -0
  37. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  38. package/node_modules/smol-toml/dist/date.js +156 -0
  39. package/node_modules/smol-toml/dist/error.d.ts +37 -0
  40. package/node_modules/smol-toml/dist/error.js +67 -0
  41. package/node_modules/smol-toml/dist/extract.js +293 -0
  42. package/node_modules/smol-toml/dist/index.cjs +771 -0
  43. package/node_modules/smol-toml/dist/index.d.ts +44 -0
  44. package/node_modules/smol-toml/dist/index.js +34 -0
  45. package/node_modules/smol-toml/dist/parse.d.ts +73 -0
  46. package/node_modules/smol-toml/dist/parse.js +164 -0
  47. package/node_modules/smol-toml/dist/primitive.js +151 -0
  48. package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
  49. package/node_modules/smol-toml/dist/stringify.js +219 -0
  50. package/node_modules/smol-toml/dist/struct.js +156 -0
  51. package/node_modules/smol-toml/dist/util.d.ts +43 -0
  52. package/node_modules/smol-toml/dist/util.js +57 -0
  53. package/node_modules/smol-toml/package.json +68 -0
  54. package/package.json +6 -3
  55. package/shell/rl.zsh +1 -1
package/README.md CHANGED
@@ -6,31 +6,41 @@ Create a workspace, start an agent, and keep task notes and sessions together.
6
6
  Switch projects, prepare local dependencies, check PRs, and merge finished work
7
7
  without losing your place.
8
8
 
9
- Requires macOS or Linux, Git, zsh, and Node.js 22+. Bash users can use the Bash
10
- integration. Install `fzf` for pickers, `gh` for PR commands, and whichever agent
11
- you use.
9
+ Requires macOS or Linux and Node.js 22+. Global npm installation sets up Git,
10
+ zsh, fzf, GitHub CLI and integration for your zsh or bash terminal.
12
11
 
13
12
  ## Install
14
13
 
15
14
  Install from npm:
16
15
 
17
16
  ```sh
18
- npm install --global rl-workspaces
17
+ npm install --global rl-workspaces --foreground-scripts
19
18
  ```
20
19
 
21
- The first npm release is pending; see Development below to build the unpublished version.
20
+ See Development below to build and try unpublished changes.
22
21
 
23
- Add one line to your shell configuration, then open a new terminal:
22
+ The installer installs missing tools through your package manager, preserves
23
+ your shell settings, and registers one RL integration block. Open a new terminal
24
+ after installation; bare `rl` can then select a workspace and change directory.
25
+ For the terminal that ran the install, use the activation command printed by the
26
+ installer, or:
24
27
 
25
28
  ```sh
26
- eval "$(command rl setup shell zsh)" # ~/.zshrc
29
+ eval "$(command rl setup shell zsh)"
27
30
  # or
28
- eval "$(command rl setup shell bash)" # ~/.bashrc
31
+ eval "$(command rl setup shell bash)"
29
32
  ```
30
33
 
31
- Shell integration lets `rl` change your terminal's directory. Direct executable
32
- calls print the selected path. The integration loads the current runtime on
33
- each call, so an npm upgrade does not leave you using old commands.
34
+ This activates the setup already registered for future terminals. Shell
35
+ integration is what lets `rl` change the calling terminal's directory; an
36
+ executable by itself can only print the selected path. The integration loads
37
+ the current runtime on each call, including after npm upgrades.
38
+
39
+ Tool installation needs Homebrew on macOS, or Homebrew/APT/DNF/Yum/Pacman/APK
40
+ on Linux, with permission to install packages. A failed setup reports the command
41
+ to finish in your terminal. If lifecycle scripts were disabled, run
42
+ `rl setup install` to complete everything. `rl setup dependencies --check`
43
+ checks tools without changing them. GitHub PR commands require `gh auth login`.
34
44
 
35
45
  ## Get started
36
46
 
@@ -81,13 +91,17 @@ under `rl agent`, cleanup under `rl storage`, and project/shell setup under
81
91
  | `rl delete` | Remove workspaces |
82
92
  | `rl storage` | Inspect disk usage and clean generated files |
83
93
 
84
- `rl help switch` also documents the specialized `new`, `open`, and `path`
85
- helpers. `rl help exec` describes running an arbitrary command in a workspace.
94
+ `rl switch <branch>` opens an existing checkout or creates a managed workspace
95
+ for an existing local or origin branch. Remote branches are tracked automatically.
96
+ `rl switch -c <branch>` creates a feature workspace from the configured base and
97
+ refuses an already checked-out branch. Both use nested branch names as directory
98
+ paths. Switching installs hooks and preserves existing notes. A checkout that RL
99
+ adopts outside its usual worktree folder also appears in the open picker and can
100
+ be selected by directory name or branch. Unadopted outside checkouts stay hidden;
101
+ the delete picker remains restricted to the managed worktree folder.
86
102
 
87
- Switching installs hooks and preserves existing notes. Creation validates names
88
- and refuses path escapes or an already checked-out branch. `switch -c` requires a
89
- new checkout; `new` and `open` can reopen an existing checkout. `open` flattens
90
- slashes in directory names; `new` and `switch -c` retain nested names.
103
+ `rl help path` documents printing workspace paths, and `rl help exec` describes
104
+ running a command with a workspace's configured environment.
91
105
 
92
106
  Pickers show cached PR state, commits ahead/behind the base, and recent use.
93
107
  The `COMMITS + / −` column counts commits ahead/behind, rather than changed lines.
@@ -173,21 +187,14 @@ deleted automatically.
173
187
 
174
188
  ## Finish a feature
175
189
 
190
+ Use Git directly to inspect changes, commit, rebase, or squash feature history.
191
+ RL handles merging across checkouts and removing the finished workspace:
192
+
176
193
  ```sh
177
- rl git diff --base origin/test -- --stat
178
- rl git log --base origin/test -- --graph
179
- rl git commit -m "Add login" # staged changes
180
- rl git commit --all -m "Fix login" # tracked changes; untracked files require git add
181
- rl git rebase --base origin/test
182
- rl git squash --base origin/test -m "Add login"
183
194
  rl git merge test --dry-run
184
195
  rl git merge test --cleanup
185
196
  ```
186
197
 
187
- Git mutation commands also accept `--dry-run`. Rebase and squash require a clean
188
- workspace. Squash preserves the original HEAD under a printed
189
- `refs/rl/backups/<UUID>` ref; it rewrites local feature history without pushing.
190
-
191
198
  Merge targets a checked-out local branch in the main or a managed checkout.
192
199
  It requires clean source and target workspaces and defaults to fast-forward only.
193
200
  For an explicit squash merge, use `rl git merge test --squash -m "Add login"`.
@@ -217,7 +224,6 @@ rl pr # open this branch's PR in your browser
217
224
  rl pr sync # save this branch's PR state
218
225
  rl pr show # readable saved snapshot with the full PR link
219
226
  rl pr show --json # saved metadata for scripts
220
- rl pr checks [--json] # query checks and preserve gh's exit status
221
227
  rl pr checkout 123 # new managed pr-123 workspace
222
228
  rl pr checkout 123 --name review/login
223
229
  rl pr update --base test # select your RL session PRs behind test, then update them
@@ -231,7 +237,8 @@ refresh output. `rl pr show` works offline. `rl pr` uses the saved URL when
231
237
  available; if the browser cannot open, that link remains in its output. With no
232
238
  saved PR, it looks up the current branch through `gh pr view --web`.
233
239
 
234
- Opening, refreshing, checks, and checkout require authenticated `gh`. Checkout verifies the origin repository,
240
+ Opening, refreshing, and checkout require authenticated `gh`. Use `gh pr checks`
241
+ to inspect CI results. Checkout verifies the origin repository,
235
242
  PR identity, and fetched commit before creating a workspace. Fork PR checkout
236
243
  is currently rejected. It does not change your current branch, publish, or merge
237
244
  a PR. Failed refreshes retain the previous snapshot.
@@ -343,7 +350,7 @@ used matching session directly.
343
350
  `rl continue` still resumes the exact session saved in its task handoff.
344
351
 
345
352
  Run Codex normally in an adopted RL workspace, including in the Codex app.
346
- `rl status`, `rl list`, `rl instances`, `rl agent sessions`, and `rl resume` / `rl resume codex`
353
+ `rl status`, `rl list`, `rl agent sessions`, and `rl resume` / `rl resume codex`
347
354
  automatically discover and save matching sessions through Codex's
348
355
  [`thread/list` API](https://learn.chatgpt.com/docs/app-server#list-threads-with-pagination--filters).
349
356
  Discovery filters by the exact workspace directory, excludes subagents and
@@ -388,176 +395,223 @@ and [Claude hooks](https://code.claude.com/docs/en/hooks) contracts.
388
395
 
389
396
  ## Session-driven agent workflows
390
397
 
391
- Your current Codex or Claude session owns its native subagents. RL supplies
392
- reusable roles, workflow dependencies, trigger rules, policies and durable run
393
- records. RL never launches a provider CLI, model API or check process for a
394
- workflow. The parent session claims ready steps, creates native children and
395
- reports their evidence; it runs configured checks itself.
398
+ An adopted workspace has a built-in `writer-reviewer-dry` workflow immediately,
399
+ without creating configuration files. Your current Codex or Claude session
400
+ creates and controls its native children. RL supplies their editable roles,
401
+ handoff rules, review policy and durable run records. RL never launches a
402
+ provider CLI, model API or check process for a workflow.
403
+
404
+ Use your normal agent session in the workspace. RL's hooks advertise discovery
405
+ automatically; a special launcher or pasted workflow prompt is unnecessary.
406
+ An agent can run `rl workflow context --json` through its ordinary shell tool.
407
+ The response includes active definitions plus `protocol.tools`: each operation's
408
+ input schema, CLI command, positional/flag mappings and JSON stdin requirements.
409
+ The same schemas are advertised through MCP, so an agent can use either connection.
410
+ Native subagent support still comes from the current session's host.
411
+
412
+ The default team starts together and stays available for the task:
413
+
414
+ - **Writer** implements scoped changes. Before adding a function, it asks DRY
415
+ about existing implementations and waits for the answer. It submits stable
416
+ file groups to the reviewer, then fixes and resubmits rejected work.
417
+ - **Reviewer** stays read-only, reviews writer checkpoints and returns a rating
418
+ with evidence and actionable feedback. On suspected duplication it asks the
419
+ same DRY agent before returning its review.
420
+ - **DRY** stays read-only and serves both peers, returning paths, symbols,
421
+ behavioral differences and reuse options, or explicitly reporting that no
422
+ suitable implementation was found.
423
+
424
+ Submitted files stay frozen while awaiting review; the writer can work on
425
+ unrelated files meanwhile. Ratings apply to saved file contents and staged
426
+ versions. RL rejects changed or superseded checkpoints and requires current
427
+ accepted reviews for the writer's changes before completion. The defaults are
428
+ **90/100** and at most **five review rounds** per file group. Required fixes
429
+ and incomplete coverage block acceptance regardless of rating. Pending check
430
+ requests or routing leads must be resolved before a checkpoint can be accepted.
396
431
 
397
432
  ```sh
398
- rl workflow init # configure this adopted workspace and refresh hooks
399
- rl agent add auth --instructions auth-review.md --description "Authentication reviewer"
433
+ rl workflow context --json # discover active definitions and their source
400
434
  rl agent list
401
- rl agent show auth
402
- rl workflow add auth-review --file auth-workflow.json
403
- rl workflow set auth-review --file auth-workflow.json
404
- rl workflow context --json # discover definitions and trigger rules
405
- rl workflow status # latest saved run
406
- rl workflow metrics
435
+ rl agent show writer
407
436
  rl policy show review
437
+ rl workflow init # write editable copies and refresh workspace hooks
438
+ rl agent set writer --instructions writer.md
439
+ rl workflow set writer-reviewer-dry --file workflow.json --default
440
+ rl workflow status # latest saved run and checkpoint ratings
441
+ rl workflow metrics
408
442
  ```
409
443
 
410
- Configuration stays in this worktree:
444
+ Export a definition before editing it:
445
+ `rl workflow show writer-reviewer-dry --json > workflow.json`.
446
+ `agent set --instructions` preserves the profile's other settings. Complete
447
+ profiles can be saved with `rl agent set writer --file profile.json`.
448
+ Use `rl agent add` and `rl workflow add` to create additional definitions.
449
+
450
+ Configuration stays in this worktree. The three concerns remain separate:
411
451
 
412
452
  | File | Owns |
413
453
  | --- | --- |
414
- | `.rl/agents.json` | Roles: description, instructions, optional model/reasoning and `access` preferences; provider defaults to `inherit` |
415
- | `.rl/agent-workflows.json` | Trigger rules, ordered/parallel steps, concurrency, retry budget, report deadlines and selected policy |
416
- | `.rl/policies.json` | Criteria, severity deduction weights and acceptance requirements |
454
+ | `.rl/agents.json` | Roles: description, instructions, optional model/reasoning and access preferences; provider defaults to inherit |
455
+ | `.rl/agent-workflows.json` | Default workflow, triggers, dependencies, concurrency, retries, deadlines, collaboration routes and review rounds |
456
+ | `.rl/policies.json` | Review criteria, rating scale/threshold, severity deduction weights and acceptance requirements |
417
457
 
418
458
  Each file has `"version": 1` and a named `agents`, `workflows` or `policies` map.
419
- `rl agent add/set <name> --file profile.json` also saves complete profiles.
420
- Missing files use preset definitions for discovery, but automatic trigger
421
- handling requires at least one explicit configuration file. Existing legacy
422
- provider preferences remain readable; they never authorize starting a separate
423
- Codex/Claude process. Native model and reasoning options are applied by the
424
- parent where supported; unavailable settings must be reported explicitly.
425
-
426
- Session-start hooks detect configuration and teach the parent the protocol.
427
- Prompt hooks refresh it after configuration changes, including after compaction.
428
- Tool hooks deliver matching requests as the parent works. Before-edit/tool rules
429
- deny the pending tool until their request completes or is explicitly dismissed
430
- (or the user cancels its run), so the parent can delegate before retrying.
431
- Workflow coordination tools are excluded from this gate. The preset queues
432
- `triple-review` before finishing changed work: behavior/security, reuse/complexity
433
- and implementation-quality roles, all read-only. Child hooks do not recursively
434
- queue workflows. Normal session resume and task checkpoints remain independent.
435
-
436
- For example, save the following as `auth-workflow.json`, then add it using the
437
- command above:
459
+ The workflow file also accepts `"default": "writer-reviewer-dry"`; use
460
+ `workflow add/set --default` to select a different default. Existing explicit
461
+ configurations are preserved, including workspaces with partial legacy settings.
462
+ A missing file uses built-in definitions, which
463
+ are active for automatic triggers too. Run `workflow init` only when you want
464
+ editable copies and none of the three files exists yet.
465
+
466
+ The default workflow's `collaboration` section is editable:
438
467
 
439
468
  ```json
440
469
  {
441
- "description": "Review authentication changes before finishing",
442
- "policy": "review",
443
- "concurrency": 2,
444
- "retries": 1,
445
- "timeoutSeconds": 600,
446
- "triggers": [
447
- { "event": "before_edit", "tools": ["Edit", "apply_patch"], "paths": ["src/auth/**"] },
448
- { "event": "before_finish", "changes": true },
449
- { "event": "task_planned" }
450
- ],
451
- "steps": [
452
- { "id": "types", "command": ["pnpm", "tsc", "--noEmit"], "after": [] },
453
- { "id": "auth", "agent": "auth", "after": ["types"] },
454
- { "id": "quality", "agent": "quality", "after": ["types"] }
470
+ "writer": "writer",
471
+ "reviewer": "reviewer",
472
+ "dry": "dry",
473
+ "maxRounds": 5,
474
+ "rules": [
475
+ { "from": "writer", "event": "new_function", "to": "dry", "required": true },
476
+ { "from": "reviewer", "event": "suspected_duplicate", "to": "dry", "required": true }
455
477
  ]
456
478
  }
457
479
  ```
458
480
 
481
+ These names refer to step IDs. All three collaboration steps must be ready at
482
+ startup with concurrency at least three; reviewer and DRY must be read-only.
483
+ Change routes, requirements, review rounds, triggers and profiles as needed.
484
+ Required gates support writer `new_function` and reviewer `suspected_duplicate`;
485
+ additional event routes can be added with `required: false` for optional messaging.
486
+ Other workflows can use sequential/parallel dependencies and parent-run command
487
+ steps without collaboration. A writing stage runs exclusively in those workflows;
488
+ explicit dependency results are shared and independent reviews remain isolated.
489
+
490
+ The separate policy has a `rating` object with `min`, `max`, `minimum` and
491
+ `instructions`. Agents use that rubric to rate checkpoints. RL also calculates
492
+ a separate score from findings: the default deducts 50/20/10/2 for
493
+ critical/high/medium/low findings, deduplicates exact file/line/root-cause matches,
494
+ and blocks readiness on required fixes or coverage gaps. `rl workflow score`
495
+ rescores saved evidence without agent calls. Native model/reasoning settings are
496
+ preferences applied by the parent where supported; unsupported settings must be
497
+ reported. Provider preferences never authorize another provider process.
498
+
499
+ Session-start hooks identify the active configuration and teach the parent the
500
+ protocol. Prompt hooks refresh it after configuration changes and compaction.
501
+ The default queues the team at the parent's `task_planned` coding milestone or
502
+ before its first edit. Before-edit/tool rules deny the pending tool until their
503
+ request completes, is explicitly dismissed or its run is cancelled. Coordination
504
+ tools are excluded from this gate. Child hooks do not recursively queue teams.
505
+ Normal session resume and task checkpoints remain independent.
506
+
459
507
  Automatic events are `session_start`, `prompt`, `before_edit`, `after_edit`,
460
- `before_tool`, `after_tool`, and `before_finish`. Edit events recognize
508
+ `before_tool`, `after_tool` and `before_finish`. Edit events recognize
461
509
  Edit/Write/MultiEdit/apply_patch; other tools, including shell commands, use the
462
510
  tool events. `tools` matches exact hook tool names; `paths` matches workspace
463
- relative file paths with `*` (one path segment) and `**` (across segments).
464
- Path filtering uses structured edit paths/patch headers, not guesses about shell
465
- commands. `changes: true` requires changes in the locally available comparison
466
- scope. Semantic events such as `task_planned` are explicitly reported by the
467
- parent, since RL cannot observe private reasoning. All conditions on a rule
468
- must match; multiple rules are alternatives.
469
-
470
- Matching events queue requests for that parent conversation only. Identical
511
+ relative paths with `*` and `**`. Path filtering reads structured edit paths
512
+ and patch headers, without guessing about shell commands. `changes: true`
513
+ requires changes in the local comparison scope. Semantic events such as
514
+ `task_planned` are reported by the parent, since RL cannot observe private
515
+ reasoning. All conditions on a rule must match; multiple rules are alternatives.
516
+
517
+ Matching requests belong to that parent conversation only. Identical
471
518
  scope/configuration events are deduplicated; newer changes coalesce into an
472
- unclaimed request. Before-finish hooks can continue the turn once with the
473
- request, and guard against repeated Stop-hook loops. They cannot force a client
474
- to offer or use native delegation. If unavailable or disallowed by current
475
- instructions, the session must dismiss the request with its concrete reason
476
- and report that limitation. Current permissions and workspace boundaries apply
477
- to every child. Read-only roles receive instructions to remain read-only; host
478
- permissions are enforced by the host, not by RL.
519
+ unclaimed request. Before-finish hooks can continue the turn once, guarding
520
+ against repeated Stop-hook loops. If native delegation is unavailable or
521
+ disallowed, the session must dismiss the request with its concrete reason and
522
+ report that limitation. Current permissions and workspace boundaries apply to
523
+ every child. Host permissions are enforced by the host.
479
524
 
480
525
  The MCP server (`rl agent mcp`) exposes:
481
526
 
482
- 1. `rl_workflow_context`: discover roles, workflows, triggers and policies.
483
- 2. `rl_workflow_pending`: read this parent session's queued requests.
484
- 3. `rl_workflow_event`: report an explicit milestone and match trigger rules.
485
- 4. `rl_workflow_start`: create a session-owned run, optionally from a request ID.
486
- 5. `rl_workflow_claim`: atomically claim one ready stage and receive its prompt,
487
- dependencies, scope path, output schema and native settings.
488
- 6. `rl_workflow_report`: submit the claim token and child findings, an actual
489
- check result, or a failure. RL validates the report and calculates the score.
490
- 7. `rl_workflow_dismiss`: decline a queued request with a recorded reason.
491
-
492
- Supply `agent` and the parent conversation's full `sessionId`; Codex may infer
493
- its ID from the environment, while Claude supplies its UUID explicitly. Observed
494
- Codex `thr_` IDs also coordinate workflows, but never enter UUID-based resumable
495
- session history. These are
496
- coordination identities within the local workspace, not an authentication
497
- boundary against a process that already has access to its state files.
498
- CLI equivalents are available when the session has no MCP connection:
527
+ | Tool | Purpose |
528
+ | --- | --- |
529
+ | `rl_workflow_context` | Discover roles, workflows, triggers, policies and configuration source |
530
+ | `rl_workflow_pending` | Read this parent's queued requests |
531
+ | `rl_workflow_event` | Report a milestone and match trigger rules |
532
+ | `rl_workflow_start` | Prepare a session-owned run, optionally from a request |
533
+ | `rl_workflow_claim` | Claim a ready step and receive its prompt, scope, result schema and native settings |
534
+ | `rl_workflow_report` | Return final evidence, actual check output or failure with the claim token |
535
+ | `rl_workflow_dismiss` | Decline a queued request with a recorded reason |
536
+ | `rl_workflow_bind` | Bind a claimed role to its unique native child ID |
537
+ | `rl_workflow_inbox` | Read that role's consultations, submissions, ratings and peer handles |
538
+ | `rl_workflow_consult` | Ask an existing peer through a configured route |
539
+ | `rl_workflow_answer` | Answer a consultation addressed to that role |
540
+ | `rl_workflow_submit` | Submit a writer checkpoint and declare new functions as path#function subjects |
541
+ | `rl_workflow_review` | Return a rating, rationale, evidence and declared duplicate suspicions |
542
+
543
+ The parent claims, spawns and binds all three peers, then announces readiness.
544
+ Handoff tools return a `notify` destination with the peer's native handle. The
545
+ caller delivers it through native messaging or asks the parent to relay it.
546
+ RL persists the handoff; it cannot wake native children on its own. Peers use
547
+ native wait/messaging tools while idle. Finish the writer first, then reviewer,
548
+ then DRY, reporting final evidence through `rl_workflow_report`.
549
+
550
+ RL verifies answered consultations for declared new functions and duplicate
551
+ suspicions. Identifying those semantic events and declaring them honestly is
552
+ the agents' responsibility; RL cannot independently prove that every new
553
+ function was declared.
554
+
555
+ Supply `agent` and the parent's full `sessionId`; Codex may infer its ID from
556
+ the environment, while Claude supplies its UUID explicitly. Observed Codex
557
+ `thr_` IDs also coordinate workflows, but never enter UUID-based resumable
558
+ history. These are local coordination identities, not an authentication boundary
559
+ against a process that already has access to the state files.
560
+
561
+ CLI equivalents are available without an MCP connection:
499
562
 
500
563
  ```sh
501
564
  rl workflow pending --agent claude --session <UUID>
502
- rl workflow run --request <request-UUID> --agent claude --session <UUID>
503
565
  rl workflow event --file event.json --agent claude --session <UUID>
504
- rl workflow run auth-review --base origin/test --agent claude --session <UUID>
505
- rl workflow claim <run> --agent claude --session <UUID>
566
+ rl workflow run --request <request-UUID> --agent claude --session <UUID>
567
+ rl workflow claim <run> --step writer --agent claude --session <UUID>
568
+ rl workflow bind <run> --file binding.json --agent claude --session <UUID>
569
+ rl workflow inbox <run> --step writer --claim <token> --agent claude --session <UUID>
506
570
  rl workflow report <run> --file report.json --agent claude --session <UUID>
507
571
  ```
508
572
 
509
- An event file contains `{ "event": "task_planned" }`; report files contain
510
- `step`, `claim`, and `result` (the returned schema), or `check` with actual
511
- `stdout`, `stderr`, `exitCode`, or `error`. Reports may include `childId` and
512
- parent-reported token/cost usage. Commands and reports return data for the parent;
513
- `workflow run` prepares work and returns without spawning agents. `--dry-run`
514
- previews scope without creating a run.
515
-
516
- Dependencies and concurrency are enforced when stages are claimed. Explicit
517
- predecessor results are supplied to dependent agents; independent roles receive
518
- no peer reports. A failed check blocks dependents. Reported agent failures may
519
- be retried within the configured budget. Routing leads receive one focused
520
- follow-up by their owning role. Further leads remain coverage limitations.
573
+ An event file contains `{ "event": "task_planned" }`. Binding files contain
574
+ `step`, `claim` and `childId`. CLI equivalents for `consult`, `answer`,
575
+ `submit` and `review` take `--file` with the same tool fields. Each role's
576
+ prompt supplies its claim token and parent conversation identity. Final reports
577
+ contain `step`, `claim` and `result` (the supplied schema), or an actual
578
+ `check` result or `error`. Reports may include native `childId` and token/cost
579
+ usage. `workflow run` prepares work without spawning agents; `--dry-run`
580
+ previews the scope without creating a run.
521
581
 
522
582
  Review scope includes committed branch changes from the merge-base, staged,
523
- unstaged and non-ignored untracked changes, capped at 4 MiB. The selected base
524
- uses local refs, without fetching; event detection uses HEAD if the saved base
525
- is not locally resolvable. RL checks fingerprints before claims and reports.
526
- Unexpected changed scope requires a new run. Roles default to read-only. A profile with `"access": "workspace-write"` may
527
- implement its assigned changes within the host's existing permissions. Writing
528
- stages run exclusively. RL refreshes scope after the writer reports, so later
529
- reviewers inspect its changes. Earlier checks/reviews remain historical; they
530
- cannot justify readiness for changed code unless refreshed after writing. Place
531
- final validation after the writer in the workflow. Unexpected edits during a
532
- read-only stage still invalidate its result.
533
-
534
- Policies remain separate. The default deducts 50/20/10/2 for
535
- critical/high/medium/low findings, deduplicates exact file/line/root-cause matches,
536
- and blocks readiness on required fixes or coverage gaps. Agents return evidence
537
- without assigning scores. `rl workflow score --policy review` rescores recorded
538
- findings and preserves assessment history without agent calls.
539
-
540
- `workflow pause` stops new claims but accepts reports from already claimed
541
- children. The parent owns child cancellation and must stop its native agents.
542
- After existing children have reported, that parent can `workflow resume` using
543
- the saved configuration. Cancellation rejects further results and requires a
544
- new run. Neither command sends process signals. Runs retain their parent UUID,
545
- claim tokens, native child IDs, evidence, scope and policy assessments under the
546
- current instance's `workflow-runs/` directory. RL measures claim-to-report elapsed
547
- time; token/cost usage is parent-reported and missing totals remain unknown.
583
+ unstaged and non-ignored untracked changes, capped at 4 MiB. Bases use local refs
584
+ without fetching; event detection falls back to HEAD if the saved base is
585
+ unresolvable. Generic workflows validate whole-scope fingerprints; collaborative
586
+ reviews validate each saved file group while implementation continues. Initial
587
+ unrelated dirty files need no submission unless changed during the run. RL
588
+ refreshes the whole scope when the writer closes and verifies it for remaining
589
+ final reports. Earlier checks/reviews in generic workflows remain historical
590
+ after writing; place final validation after the writer. Failed checks block
591
+ dependents. Reported failures can be retried within the configured budget.
592
+ Generic routing leads receive one focused follow-up; further leads remain
593
+ limitations. Collaborative peers handle consultations without replacement stages.
594
+
595
+ `workflow pause` stops new claims and submissions but lets claimed children
596
+ report and finish pending answers/reviews. The parent owns child cancellation.
597
+ `workflow resume` lets collaborative peers continue with the same claims and
598
+ native handles. Generic workflows require running children to report first.
599
+ Cancellation rejects further results and requires a new run. Neither command
600
+ sends process signals. Run records retain the parent identity, native IDs,
601
+ claims, evidence, checkpoints and assessments under this instance's
602
+ `workflow-runs/` directory. RL measures claim-to-report elapsed time; token/cost
603
+ usage is parent-reported and missing totals remain unknown.
548
604
 
549
605
  After upgrading existing workspaces, run `rl doctor --repair` to add tool hooks,
550
- and restart/review hooks as required by your host. Native hook integration follows
551
- the [Codex hooks](https://learn.chatgpt.com/docs/hooks) and
552
- [Claude hooks](https://code.claude.com/docs/en/hooks) contracts. Automated tests
553
- exercise hook payloads and MCP/CLI coordination; they do not certify live model
554
- compliance or native delegation availability in every client.
606
+ and restart/review hooks as required by your host. Automated tests exercise
607
+ hook payloads and MCP/CLI coordination; they do not certify live model compliance
608
+ or native delegation availability in every client.
555
609
 
556
610
  ## Let agents use notes through MCP
557
611
 
558
612
  `rl agent mcp` serves workspace-scoped tools over stdio: `rl_status`, `rl_context`,
559
613
  `rl_progress`, `rl_context_append`, `rl_progress_append`, `rl_session_save`,
560
- `rl_task_pause`, and the seven `rl_workflow_*` coordination tools described above.
614
+ `rl_task_pause`, and the thirteen `rl_workflow_*` coordination tools described above.
561
615
  `rl_task_pause` accepts the handoff JSON described above and atomically saves
562
616
  the session and task checkpoint. `rl_status` includes task state and handoff history.
563
617
  `rl_status` automatically discovers Codex sessions for this workspace.
@@ -568,27 +622,30 @@ the server does not inherit it. Claude requires an explicit UUID.
568
622
  Append tools take `{"text":"..."}`. They share the same locked document updates
569
623
  as the CLI and expose no arbitrary command, deletion, or filesystem tool.
570
624
 
571
- In the adopted workspace, add an entry to its trusted `.codex/config.toml`:
572
-
573
- ```toml
574
- [mcp_servers.rl]
575
- command = "rl"
576
- args = ["agent", "mcp"]
577
- ```
625
+ From an adopted RL workspace, connect your current agent with:
578
626
 
579
- For Claude, merge this entry into the workspace's `.mcp.json`:
580
-
581
- ```json
582
- {
583
- "mcpServers": {
584
- "rl": { "type": "stdio", "command": "rl", "args": ["agent", "mcp"] }
585
- }
586
- }
627
+ ```sh
628
+ rl setup mcp
587
629
  ```
588
630
 
589
- The client must launch the server in this workspace with `rl` on PATH.
590
- With custom state settings, pass the same `RL_STATE_DIR` in the server environment.
591
- Review project trust/server approval normally. Configuration follows the official
631
+ This configures both `.codex/config.toml` and `.mcp.json` in the current checkout.
632
+ Pass `codex` or `claude` to select one client, or `--dry-run` to preview changes.
633
+ Setup preserves other servers and settings, including Codex comments. It updates
634
+ RL-managed entries on later runs and leaves a conflicting manually configured
635
+ `rl` entry for you to resolve. Both files are validated before writing either.
636
+
637
+ The client starts the installed Node and RL entry point directly. The server is
638
+ bound to this checkout, repository and RL state directory, even when the client
639
+ starts it elsewhere or has no `rl` executable on PATH. Entries contain local
640
+ installation/workspace paths: run setup in each checkout and rerun after moving
641
+ Node or RL. Setup changes only this workspace's configuration.
642
+
643
+ Reload the client and review its normal project trust/MCP approval. The server
644
+ supplies discovery, consultations and rated reviews to your existing session;
645
+ the host supplies native agent creation and messaging. CLI discovery remains
646
+ available without an MCP connection. The stdio server can also be launched with
647
+ `rl agent mcp`, or `rl agent mcp --workspace <absolute-path>` when the repository
648
+ has been selected explicitly. Configuration follows the official
592
649
  [Codex MCP guide](https://learn.chatgpt.com/docs/extend/mcp?surface=cli) and
593
650
  [Claude MCP guide](https://code.claude.com/docs/en/mcp).
594
651
  RL does not modify global client settings or relax agent sandbox permissions.
@@ -665,22 +722,6 @@ Environment variables can also come from trusted zsh configuration selected by
665
722
  [config.example.zsh](config.example.zsh). Registration supplies repository/base
666
723
  settings; `rl help` and individual `--help` show command options.
667
724
 
668
- ## Compatibility aliases
669
-
670
- Existing commands keep their behavior. They are omitted from the main help to
671
- keep one primary spelling for each operation:
672
-
673
- | Previous command | Primary command |
674
- | --- | --- |
675
- | `rl step commit/rebase/squash`, `rl diff/log/merge` | `rl git commit/rebase/squash/diff/log/merge` |
676
- | `rl context/progress show/set/append/path` | `rl notes show/set/append/path context/progress` |
677
- | `rl summary` | `rl notes summary` |
678
- | `rl session list/save/add` | `rl agent sessions/save` |
679
- | `rl handoff`, `rl mcp` | `rl agent handoff`, `rl agent mcp` |
680
- | `rl clean` | `rl storage clean` |
681
- | `rl config init/show`, `rl adopt`, `rl init` | `rl setup init/show`, `rl setup adopt`, `rl setup shell` |
682
- | `rl status --list`, `rl status --all` | `rl list`, `rl list --all` |
683
-
684
725
  ## Development
685
726
 
686
727
  ```sh
package/bin/rl CHANGED
@@ -1,54 +1,2 @@
1
- #!/bin/zsh -f
2
- emulate -L zsh
3
- readonly rl_home="${${(%):-%x}:A:h:h}"
4
- if [[ "$1" == __hook ]]; then
5
- # Hooks resolve the installed CLI on PATH, not a version-specific package path.
6
- # Their explicit repository/state arguments must not be replaced by user config.
7
- shift
8
- exec node "$rl_home/dist/cli.js" state "$@"
9
- fi
10
- if [[ "$1" == --version || "$1" == -V ]]; then
11
- exec node -p 'JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8")).version' "$rl_home/package.json"
12
- fi
13
- if [[ "$1" == init ]]; then
14
- if (( $# == 1 )); then
15
- exec node "$rl_home/dist/help.js" init
16
- fi
17
- for argument in "$@"; do
18
- [[ "$argument" == -- ]] && break
19
- if [[ "$argument" == --help || "$argument" == -h ]]; then
20
- exec node "$rl_home/dist/help.js" "$@"
21
- fi
22
- done
23
- if [[ "$2" != zsh && "$2" != bash || $# != 2 ]]; then
24
- print -u2 'Usage: rl setup shell <zsh|bash>'
25
- exit 1
26
- fi
27
- if [[ "$2" == zsh ]]; then
28
- print -r -- "source ${(q)rl_home}/shell/rl.zsh"
29
- else
30
- print -r -- "_rl_executable=${(qq)rl_home}/bin/rl"
31
- cat <<'BASH'
32
- rl() {
33
- local destination_file destination result previous="$PWD"
34
- local -a arguments=("$@")
35
- if [[ "$1" == switch && "${2:-}" == - ]]; then
36
- [[ -n "${RL_PREVIOUS_WORKSPACE:-}" ]] || { printf '%s\n' 'No previous workspace in this shell' >&2; return 1; }
37
- arguments[1]="$RL_PREVIOUS_WORKSPACE"
38
- fi
39
- destination_file=$(mktemp "${TMPDIR:-/tmp}/rl-shell.XXXXXXXX") || return 1
40
- if RL_SHELL_OUTPUT="$destination_file" command "$_rl_executable" "${arguments[@]}"; then result=0; else result=$?; fi
41
- destination=$(cat -- "$destination_file")
42
- rm -f -- "$destination_file"
43
- if [[ -n "$destination" ]]; then
44
- builtin cd -- "$destination" || return 1
45
- RL_PREVIOUS_WORKSPACE="$previous"
46
- fi
47
- return "$result"
48
- }
49
- BASH
50
- fi
51
- exit 0
52
- fi
53
- source "$rl_home/lib/rl.zsh" || exit 1
54
- _rl_main "$@"
1
+ #!/usr/bin/env node
2
+ await import('../dist/bootstrap.js');