@ritualai/cli 0.36.9 → 0.36.14

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 (37) hide show
  1. package/dist/commands/lite.js +102 -0
  2. package/dist/commands/lite.js.map +1 -0
  3. package/dist/commands/project.js +82 -0
  4. package/dist/commands/project.js.map +1 -0
  5. package/dist/index.js +21 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/agents/launch.js +21 -5
  8. package/dist/lib/agents/launch.js.map +1 -1
  9. package/dist/lib/okf-projection.js +118 -0
  10. package/dist/lib/okf-projection.js.map +1 -0
  11. package/dist/lib/worktree.js +87 -0
  12. package/dist/lib/worktree.js.map +1 -0
  13. package/package.json +1 -1
  14. package/skills/claude-code/ritual/.ritual-bundle.json +3 -3
  15. package/skills/claude-code/ritual/SKILL.md +1 -1
  16. package/skills/claude-code/ritual/references/build-flow.md +89 -8
  17. package/skills/claude-code/ritual/references/lite-flow.md +115 -9
  18. package/skills/codex/ritual/.ritual-bundle.json +3 -3
  19. package/skills/codex/ritual/SKILL.md +1 -1
  20. package/skills/codex/ritual/references/build-flow.md +89 -8
  21. package/skills/codex/ritual/references/lite-flow.md +115 -9
  22. package/skills/cursor/ritual/.ritual-bundle.json +3 -3
  23. package/skills/cursor/ritual/SKILL.md +1 -1
  24. package/skills/cursor/ritual/references/build-flow.md +89 -8
  25. package/skills/cursor/ritual/references/lite-flow.md +115 -9
  26. package/skills/gemini/ritual/.ritual-bundle.json +3 -3
  27. package/skills/gemini/ritual/SKILL.md +1 -1
  28. package/skills/gemini/ritual/references/build-flow.md +89 -8
  29. package/skills/gemini/ritual/references/lite-flow.md +115 -9
  30. package/skills/kiro/ritual/.ritual-bundle.json +3 -3
  31. package/skills/kiro/ritual/SKILL.md +1 -1
  32. package/skills/kiro/ritual/references/build-flow.md +89 -8
  33. package/skills/kiro/ritual/references/lite-flow.md +115 -9
  34. package/skills/vscode/ritual/.ritual-bundle.json +3 -3
  35. package/skills/vscode/ritual/SKILL.md +1 -1
  36. package/skills/vscode/ritual/references/build-flow.md +89 -8
  37. package/skills/vscode/ritual/references/lite-flow.md +115 -9
@@ -1,5 +1,5 @@
1
1
  <!-- GENERATED from references/build-flow.md by apps/cli/scripts/generate-lite-flow.js — DO NOT EDIT. -->
2
- <!-- source-sha: d91bf82d5264e811 -->
2
+ <!-- source-sha: 3d973c8d7e6a514b -->
3
3
 
4
4
  # /ritual lite — fast build (generated; do not edit)
5
5
 
@@ -40,6 +40,31 @@ Follow build-flow.md's steps below EXACTLY, with these **LITE OVERRIDES**:
40
40
  UX brief review, plan-fidelity audit, and sibling-exploration forks are omitted
41
41
  (they're removed from the flow below).
42
42
 
43
+ ## Autonomous worktree mode (discovery — no human, stop at the brief)
44
+ **Trigger:** the invocation carries the `--worktree` flag (you were launched by
45
+ `ritual lite --worktree "<ask>"` — a git worktree was spun up and you are running
46
+ HEADLESS inside it, with no human present). A developer parked an unchosen option
47
+ for background discovery (unchosen-options → discovery worktrees). When you see
48
+ `--worktree`, apply these EXTRA rules on top of the lite overrides above:
49
+ - **There is no human, so auto-resolve EVEN the two touchpoints.** Accept the
50
+ classified job (Step 0.7) and the recommendations (Step 9) without waiting —
51
+ take the default at every gate, including those two. (If the job comes back
52
+ generic, proceed as the generic `Feature Brief` build; there's no one to
53
+ clarify with.)
54
+ - **Create the exploration with `spawn_origin: 'discovery_worktree'`** (Step 6,
55
+ `create_exploration`) so `get_exploration_status` reports
56
+ `autonomousDiscovery: true`.
57
+ - **Materialize the reasoning as files (OKF projection).** Once the brief is
58
+ written, run `ritual project <exploration-id>` — it projects the exploration
59
+ (index + build-brief + scope-contract + recommendations) into `.ritual/` in
60
+ this worktree, so the developer who `cd`s in reads the reasoning as files, not
61
+ just a graph id. Projection, not replica: the live graph stays authoritative.
62
+ - **STOP there.** Do NOT branch, plan, implement, or open a PR — that is the
63
+ developer's call when they land in the worktree. The brief is **agent-authored
64
+ and NOT human-reviewed**; surface it as such so it's read with skepticism.
65
+ This mode adds no new skill — it IS `lite`, just with no human to pause for and a
66
+ hard stop at the brief. A normal (attended) `lite` run ignores this section.
67
+
43
68
  ---
44
69
 
45
70
  ## /ritual build
@@ -151,6 +176,7 @@ If the user types `always audit for this build` mid-flow at the Step 9.6 prompt,
151
176
  Persist `auditMode` to `Exploration.metadata.auditMode` at `create_exploration` time (additive JSONB key — no schema migration) so `/ritual resume <exploration-id>` picks up the same mode the original build started with, and `/ritual lineage <exploration-id>` can render which gates ran + their outcomes.
152
177
 
153
178
 
179
+ <!-- skill-options:no-gate-change: 2b (clarifying question) + 2c (generic terminal) are loud-fallback COPY variants of the same gate; options are unchanged (proceed | name-the-job) -->
154
180
  #### Step 0.7 — The Job gate: classify the job to be done
155
181
 
156
182
  **The FIRST tool call of a fresh build.** The server — not you — classifies the user's raw ask into
@@ -166,9 +192,16 @@ When this gate runs:
166
192
 
167
193
  1. **Call `mcp__ritual__classify_work_item`** with `raw_input` = the user's ask, verbatim. Do NOT
168
194
  classify yourself, do NOT pre-filter to development jobs. It returns
169
- `{ jtbd, workItemLabel, deliverableTemplate, why, personaCoverage }`.
195
+ `{ jtbd, workItemLabel, deliverableTemplate, why, confidence, isGenericFallback, personaCoverage }`.
196
+ `isGenericFallback` (and `confidence`) are the typed-uncertainty signal: when it's `true`, the
197
+ result is the catch-all (`build-feature` / `produce-deliverable`) or the classifier wasn't sure —
198
+ it is NOT a confident match, and which render variant you use in step 2 depends on it.
199
+
200
+ 2. **Render the validation prompt** (rail stage `Job`). This gate is a plain-language VALIDATION of
201
+ what you're about to build: restate the ask + the matched job in the user's words, then let them
202
+ confirm or correct. Which variant you render depends on `isGenericFallback`.
170
203
 
171
- 2. **Render the validation prompt** (rail stage `Job`):
204
+ **2a Confident match** (`isGenericFallback` is `false`): the classifier matched a specific job.
172
205
 
173
206
  ```text
174
207
  Ritual build
@@ -182,21 +215,68 @@ When this gate runs:
182
215
  job actually is.
183
216
  ```
184
217
 
218
+ **2b — No specific job matched, FIRST time** (`isGenericFallback` is `true` — the result is the
219
+ catch-all `build-feature` / `produce-deliverable`, or `confidence` is `low` — AND you have not yet
220
+ asked the clarifying question this gate): do NOT present the catch-all as a verdict. This case
221
+ should be RARE. Instead ask ONE clarifying question that elicits the missing signal — what KIND of
222
+ work this is — grounded in their ask, with concrete examples that lead the reply. The examples
223
+ span the catalog's functions so the user can self-identify; tailor the wording to their ask. This
224
+ is the fallback step that lets us classify properly instead of defaulting blind (see
225
+ `loud-fallback-escalation.md`).
226
+
227
+ ```text
228
+ Ritual build
229
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
230
+
231
+ You're looking to: {restate the ask in one short clause}
232
+
233
+ I couldn't pin this to a specific job — your ask reads as an outcome, and the flow scopes much
234
+ better when I know what KIND of work it is. Which is closest (or say it in your own words)?
235
+ • A coding-agent / MCP / skill capability — tooling the agent itself uses
236
+ • A backend service or API
237
+ • A frontend / UI feature
238
+ • A refactor, migration, or infra / platform change
239
+ • Something else — tell me in a sentence
240
+
241
+ Reply with the closest fit (or your own words) and I'll lock the job.
242
+ ```
243
+
244
+ When the user answers, call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input` plus
245
+ `correction` = their reply (and `previous_jtbd`), then re-render: **2a** if it now matched a
246
+ specific job, otherwise **2c**.
247
+
248
+ **2c — Still generic after the clarifying question** (`isGenericFallback` is STILL `true` after the
249
+ user answered 2b): do NOT ask again. Proceed as a generic build with the function-agnostic
250
+ `Feature Brief` deliverable, and note the job can be renamed later. The job name stays generic —
251
+ never show a function-specific deliverable (e.g. "Frontend Web") for an unclassified build.
252
+
253
+ ```text
254
+ Ritual build
255
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
256
+
257
+ You're looking to: {restate the ask in one short clause}
258
+ I'll treat this as a generic build — deliverable: Feature Brief. You can rename the job later.
259
+
260
+ Reply `proceed` to frame the problem.
261
+ ```
262
+
185
263
  Do not render `personaCoverage` — persona representation is handled server-side now; only surface
186
264
  it if the user explicitly asks who's involved.
187
265
 
188
266
  Rail naming (deliverable-named rail, 2026-06-11): render `{Deliverable}` as the PROPOSED job's
189
- `deliverableTemplate` (e.g. `Launch Brief`, `PRD`, `Service Build Brief`; `Build brief` for the
190
- generic `build-feature`), and OMIT the `Implementation (Your agent)` stage entirely when the
191
- proposed job is not a development job — non-dev rails have FIVE stages ending at the deliverable.
192
- A correction that changes the job updates the rail on the next render. Spec:
267
+ `deliverableTemplate` from the classify result (e.g. `Launch Brief`, `PRD`, `Service Build Brief`;
268
+ `Feature Brief` for the generic `build-feature`), and OMIT the `Implementation (Your agent)` stage
269
+ entirely when the proposed job is not a development job — non-dev rails have FIVE stages ending at
270
+ the deliverable. A correction that changes the job updates the rail on the next render. Spec:
193
271
  `references/cli-output-contract.md` § Canonical stage table.
194
272
 
195
273
  3. **[USER PAUSE]** — wait for the user's actual reply. Never infer confirmation from the original
196
274
  ask, auto-mode, or silence. `proceed` / `yes` / `ok` confirms. ANY other substantive reply is a
197
275
  correction: call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input`, plus
198
276
  `correction` (the user's words) and `previous_jtbd` (the rejected slug), then re-render step 2.
199
- Loop until the user proceeds.
277
+ The clarifying QUESTION (2b) is asked AT MOST ONCE per gate — if the re-classification after the
278
+ user's answer is still generic, render **2c** (proceed as a generic `Feature Brief`); do not ask
279
+ the clarifying question again. Loop until the user proceeds.
200
280
 
201
281
  4. **Remember the confirmed `jtbd`** — you pass it to `create_exploration` at Step 6. Only after the
202
282
  user proceeds does the flow enter the `Scope` stage (workspace pick onward).
@@ -543,7 +623,33 @@ Steps:
543
623
  f. **If the user picks one (1-N):**
544
624
  - Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
545
625
  - **Skip Step 1.5 step 8 (overlap check)** — the user just picked from system suggestions explicitly grounded in workspace state; a fresh overlap pass would be redundant noise.
546
- - Continue to Step 2 (template selection).
626
+ - **Run the unchosen-candidates gate (f.1) BEFORE continuing**, then continue to Step 2.
627
+
628
+ <!-- skill-options:no-gate-change: f.1 is an OPTIONAL skippable sub-prompt nested in Step 1.5 step 6 (default skip); adds no tracked pause gate or Step header, so the structural fingerprint is unchanged (check-skill-options-contract green). -->
629
+ f.1 **Unchosen-candidates gate (2026-06-14, unchosen-options → discovery worktrees).** The candidates the user did NOT pick are paths worth not silently dropping. Render ONE compact, SKIPPABLE prompt — for each unchosen candidate, the user can spin up **discovery now** (a background worktree reasons it to a build brief) or **log it as a future job**. Promote DELIBERATELY: the default is to drop. (This gate is itself skipped in autonomous/worktree mode — never spawn discovery recursively.)
630
+
631
+ ```text
632
+ You picked #{k}. The other {M} — want to keep any going?
633
+ • `discover <nums>` — spin up discovery NOW in a background git worktree: an agent reasons it
634
+ end-to-end to a build brief (reasoning only, no code). e.g. `discover 1`
635
+ • `next-job <nums>` — just log it as a future job (a draft exploration in this workspace; nothing runs)
636
+ • `skip` — drop them (default)
637
+ ```
638
+
639
+ Resolve the reply, then continue to Step 2 for the picked candidate:
640
+ - **`discover <nums>`** → for each, run `ritual lite "{candidate.summary}" --worktree` **in the
641
+ BACKGROUND** (do not block the build — use your shell's background/async execution). It spins a
642
+ git worktree and runs autonomous discovery to a brief there; tell the user where (`<repo>.ritual-discover/<slug>`).
643
+ The result is an exploration with `spawn_origin: 'discovery_worktree'`; its brief is
644
+ agent-authored, not human-reviewed. (See `references/unchosen-options-discovery-worktrees.md` in `documents/architecture/`.)
645
+ - **`next-job <nums>`** → for each, call `mcp__ritual__create_exploration` with the candidate's
646
+ `title` as `name`, its `summary` as `problem_statement`, `spawn_origin: 'next_job'`, and NO
647
+ `agentic` flag — a NOT_STARTED draft that shows in the workspace roster as a future job. Cheap; nothing runs.
648
+ - **`skip` / no reply about them** → drop silently.
649
+
650
+ Keep it ONE prompt, never per-candidate pauses. If the user just proceeds without addressing it, treat as `skip`.
651
+
652
+ f.2 **Continue to Step 2 (template selection)** for the picked candidate.
547
653
 
548
654
  g. **If the user says "none" / "let me describe":** continue to Step 2 normally; treat as if they had originally picked "start fresh" with no raw_input yet (they'll provide one at Step 3-4 time).
549
655
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "cliVersion": "0.36.9",
3
- "builtAt": "2026-06-14T10:07:00.491Z",
4
- "skillsHash": "26b50ff4f856"
2
+ "cliVersion": "0.36.14",
3
+ "builtAt": "2026-06-14T21:33:31.224Z",
4
+ "skillsHash": "ee9a77046c96"
5
5
  }
@@ -3,7 +3,7 @@ name: ritual
3
3
  description: "Use when an engineer wants a coding agent to plan or build a feature, refactor, or implementation-heavy change that depends on context the agent can't infer on its own — strategic intent, constraints, prior decisions, and trade-offs that live in the user's head. Ritual runs a structured exploration to surface that context through targeted discovery questions, combines it with codebase signals and prior explorations, and delivers a validated build brief (sub-problems, recommendations, dependencies) — additional context to fold into plan mode before the agent writes code. Prefer this over jumping straight to implementation or plan mode when the problem is ambiguous, cross-cutting, or has non-obvious constraints. Subcommands: build (full planning-to-sync cycle — default for new features), resume (continue an in-flight exploration), lineage (file-path KG history — what decisions shaped this code), context-pulse (readiness and context-debt scoring — is this safe to build yet?)."
4
4
  argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3', 'resume', 'lineage src/checkout/views.py', 'context-pulse Add billing export')"
5
5
  user-invocable: true
6
- stamp: 26b50ff4f856
6
+ stamp: ee9a77046c96
7
7
  ---
8
8
 
9
9
  # /ritual
@@ -107,6 +107,7 @@ If the user types `always audit for this build` mid-flow at the Step 9.6 prompt,
107
107
  Persist `auditMode` to `Exploration.metadata.auditMode` at `create_exploration` time (additive JSONB key — no schema migration) so `/ritual resume <exploration-id>` picks up the same mode the original build started with, and `/ritual lineage <exploration-id>` can render which gates ran + their outcomes.
108
108
 
109
109
  <!-- lite:keep-start -->
110
+ <!-- skill-options:no-gate-change: 2b (clarifying question) + 2c (generic terminal) are loud-fallback COPY variants of the same gate; options are unchanged (proceed | name-the-job) -->
110
111
  #### Step 0.7 — The Job gate: classify the job to be done
111
112
 
112
113
  **The FIRST tool call of a fresh build.** The server — not you — classifies the user's raw ask into
@@ -122,9 +123,16 @@ When this gate runs:
122
123
 
123
124
  1. **Call `mcp__ritual__classify_work_item`** with `raw_input` = the user's ask, verbatim. Do NOT
124
125
  classify yourself, do NOT pre-filter to development jobs. It returns
125
- `{ jtbd, workItemLabel, deliverableTemplate, why, personaCoverage }`.
126
+ `{ jtbd, workItemLabel, deliverableTemplate, why, confidence, isGenericFallback, personaCoverage }`.
127
+ `isGenericFallback` (and `confidence`) are the typed-uncertainty signal: when it's `true`, the
128
+ result is the catch-all (`build-feature` / `produce-deliverable`) or the classifier wasn't sure —
129
+ it is NOT a confident match, and which render variant you use in step 2 depends on it.
126
130
 
127
- 2. **Render the validation prompt** (rail stage `Job`):
131
+ 2. **Render the validation prompt** (rail stage `Job`). This gate is a plain-language VALIDATION of
132
+ what you're about to build: restate the ask + the matched job in the user's words, then let them
133
+ confirm or correct. Which variant you render depends on `isGenericFallback`.
134
+
135
+ **2a — Confident match** (`isGenericFallback` is `false`): the classifier matched a specific job.
128
136
 
129
137
  ```text
130
138
  Ritual build
@@ -138,21 +146,68 @@ When this gate runs:
138
146
  job actually is.
139
147
  ```
140
148
 
149
+ **2b — No specific job matched, FIRST time** (`isGenericFallback` is `true` — the result is the
150
+ catch-all `build-feature` / `produce-deliverable`, or `confidence` is `low` — AND you have not yet
151
+ asked the clarifying question this gate): do NOT present the catch-all as a verdict. This case
152
+ should be RARE. Instead ask ONE clarifying question that elicits the missing signal — what KIND of
153
+ work this is — grounded in their ask, with concrete examples that lead the reply. The examples
154
+ span the catalog's functions so the user can self-identify; tailor the wording to their ask. This
155
+ is the fallback step that lets us classify properly instead of defaulting blind (see
156
+ `loud-fallback-escalation.md`).
157
+
158
+ ```text
159
+ Ritual build
160
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
161
+
162
+ You're looking to: {restate the ask in one short clause}
163
+
164
+ I couldn't pin this to a specific job — your ask reads as an outcome, and the flow scopes much
165
+ better when I know what KIND of work it is. Which is closest (or say it in your own words)?
166
+ • A coding-agent / MCP / skill capability — tooling the agent itself uses
167
+ • A backend service or API
168
+ • A frontend / UI feature
169
+ • A refactor, migration, or infra / platform change
170
+ • Something else — tell me in a sentence
171
+
172
+ Reply with the closest fit (or your own words) and I'll lock the job.
173
+ ```
174
+
175
+ When the user answers, call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input` plus
176
+ `correction` = their reply (and `previous_jtbd`), then re-render: **2a** if it now matched a
177
+ specific job, otherwise **2c**.
178
+
179
+ **2c — Still generic after the clarifying question** (`isGenericFallback` is STILL `true` after the
180
+ user answered 2b): do NOT ask again. Proceed as a generic build with the function-agnostic
181
+ `Feature Brief` deliverable, and note the job can be renamed later. The job name stays generic —
182
+ never show a function-specific deliverable (e.g. "Frontend Web") for an unclassified build.
183
+
184
+ ```text
185
+ Ritual build
186
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
187
+
188
+ You're looking to: {restate the ask in one short clause}
189
+ I'll treat this as a generic build — deliverable: Feature Brief. You can rename the job later.
190
+
191
+ Reply `proceed` to frame the problem.
192
+ ```
193
+
141
194
  Do not render `personaCoverage` — persona representation is handled server-side now; only surface
142
195
  it if the user explicitly asks who's involved.
143
196
 
144
197
  Rail naming (deliverable-named rail, 2026-06-11): render `{Deliverable}` as the PROPOSED job's
145
- `deliverableTemplate` (e.g. `Launch Brief`, `PRD`, `Service Build Brief`; `Build brief` for the
146
- generic `build-feature`), and OMIT the `Implementation (Your agent)` stage entirely when the
147
- proposed job is not a development job — non-dev rails have FIVE stages ending at the deliverable.
148
- A correction that changes the job updates the rail on the next render. Spec:
198
+ `deliverableTemplate` from the classify result (e.g. `Launch Brief`, `PRD`, `Service Build Brief`;
199
+ `Feature Brief` for the generic `build-feature`), and OMIT the `Implementation (Your agent)` stage
200
+ entirely when the proposed job is not a development job — non-dev rails have FIVE stages ending at
201
+ the deliverable. A correction that changes the job updates the rail on the next render. Spec:
149
202
  `references/cli-output-contract.md` § Canonical stage table.
150
203
 
151
204
  3. **[USER PAUSE]** — wait for the user's actual reply. Never infer confirmation from the original
152
205
  ask, auto-mode, or silence. `proceed` / `yes` / `ok` confirms. ANY other substantive reply is a
153
206
  correction: call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input`, plus
154
207
  `correction` (the user's words) and `previous_jtbd` (the rejected slug), then re-render step 2.
155
- Loop until the user proceeds.
208
+ The clarifying QUESTION (2b) is asked AT MOST ONCE per gate — if the re-classification after the
209
+ user's answer is still generic, render **2c** (proceed as a generic `Feature Brief`); do not ask
210
+ the clarifying question again. Loop until the user proceeds.
156
211
 
157
212
  4. **Remember the confirmed `jtbd`** — you pass it to `create_exploration` at Step 6. Only after the
158
213
  user proceeds does the flow enter the `Scope` stage (workspace pick onward).
@@ -499,7 +554,33 @@ Steps:
499
554
  f. **If the user picks one (1-N):**
500
555
  - Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
501
556
  - **Skip Step 1.5 step 8 (overlap check)** — the user just picked from system suggestions explicitly grounded in workspace state; a fresh overlap pass would be redundant noise.
502
- - Continue to Step 2 (template selection).
557
+ - **Run the unchosen-candidates gate (f.1) BEFORE continuing**, then continue to Step 2.
558
+
559
+ <!-- skill-options:no-gate-change: f.1 is an OPTIONAL skippable sub-prompt nested in Step 1.5 step 6 (default skip); adds no tracked pause gate or Step header, so the structural fingerprint is unchanged (check-skill-options-contract green). -->
560
+ f.1 **Unchosen-candidates gate (2026-06-14, unchosen-options → discovery worktrees).** The candidates the user did NOT pick are paths worth not silently dropping. Render ONE compact, SKIPPABLE prompt — for each unchosen candidate, the user can spin up **discovery now** (a background worktree reasons it to a build brief) or **log it as a future job**. Promote DELIBERATELY: the default is to drop. (This gate is itself skipped in autonomous/worktree mode — never spawn discovery recursively.)
561
+
562
+ ```text
563
+ You picked #{k}. The other {M} — want to keep any going?
564
+ • `discover <nums>` — spin up discovery NOW in a background git worktree: an agent reasons it
565
+ end-to-end to a build brief (reasoning only, no code). e.g. `discover 1`
566
+ • `next-job <nums>` — just log it as a future job (a draft exploration in this workspace; nothing runs)
567
+ • `skip` — drop them (default)
568
+ ```
569
+
570
+ Resolve the reply, then continue to Step 2 for the picked candidate:
571
+ - **`discover <nums>`** → for each, run `ritual lite "{candidate.summary}" --worktree` **in the
572
+ BACKGROUND** (do not block the build — use your shell's background/async execution). It spins a
573
+ git worktree and runs autonomous discovery to a brief there; tell the user where (`<repo>.ritual-discover/<slug>`).
574
+ The result is an exploration with `spawn_origin: 'discovery_worktree'`; its brief is
575
+ agent-authored, not human-reviewed. (See `references/unchosen-options-discovery-worktrees.md` in `documents/architecture/`.)
576
+ - **`next-job <nums>`** → for each, call `mcp__ritual__create_exploration` with the candidate's
577
+ `title` as `name`, its `summary` as `problem_statement`, `spawn_origin: 'next_job'`, and NO
578
+ `agentic` flag — a NOT_STARTED draft that shows in the workspace roster as a future job. Cheap; nothing runs.
579
+ - **`skip` / no reply about them** → drop silently.
580
+
581
+ Keep it ONE prompt, never per-candidate pauses. If the user just proceeds without addressing it, treat as `skip`.
582
+
583
+ f.2 **Continue to Step 2 (template selection)** for the picked candidate.
503
584
 
504
585
  g. **If the user says "none" / "let me describe":** continue to Step 2 normally; treat as if they had originally picked "start fresh" with no raw_input yet (they'll provide one at Step 3-4 time).
505
586
 
@@ -1,5 +1,5 @@
1
1
  <!-- GENERATED from references/build-flow.md by apps/cli/scripts/generate-lite-flow.js — DO NOT EDIT. -->
2
- <!-- source-sha: d91bf82d5264e811 -->
2
+ <!-- source-sha: 3d973c8d7e6a514b -->
3
3
 
4
4
  # /ritual lite — fast build (generated; do not edit)
5
5
 
@@ -40,6 +40,31 @@ Follow build-flow.md's steps below EXACTLY, with these **LITE OVERRIDES**:
40
40
  UX brief review, plan-fidelity audit, and sibling-exploration forks are omitted
41
41
  (they're removed from the flow below).
42
42
 
43
+ ## Autonomous worktree mode (discovery — no human, stop at the brief)
44
+ **Trigger:** the invocation carries the `--worktree` flag (you were launched by
45
+ `ritual lite --worktree "<ask>"` — a git worktree was spun up and you are running
46
+ HEADLESS inside it, with no human present). A developer parked an unchosen option
47
+ for background discovery (unchosen-options → discovery worktrees). When you see
48
+ `--worktree`, apply these EXTRA rules on top of the lite overrides above:
49
+ - **There is no human, so auto-resolve EVEN the two touchpoints.** Accept the
50
+ classified job (Step 0.7) and the recommendations (Step 9) without waiting —
51
+ take the default at every gate, including those two. (If the job comes back
52
+ generic, proceed as the generic `Feature Brief` build; there's no one to
53
+ clarify with.)
54
+ - **Create the exploration with `spawn_origin: 'discovery_worktree'`** (Step 6,
55
+ `create_exploration`) so `get_exploration_status` reports
56
+ `autonomousDiscovery: true`.
57
+ - **Materialize the reasoning as files (OKF projection).** Once the brief is
58
+ written, run `ritual project <exploration-id>` — it projects the exploration
59
+ (index + build-brief + scope-contract + recommendations) into `.ritual/` in
60
+ this worktree, so the developer who `cd`s in reads the reasoning as files, not
61
+ just a graph id. Projection, not replica: the live graph stays authoritative.
62
+ - **STOP there.** Do NOT branch, plan, implement, or open a PR — that is the
63
+ developer's call when they land in the worktree. The brief is **agent-authored
64
+ and NOT human-reviewed**; surface it as such so it's read with skepticism.
65
+ This mode adds no new skill — it IS `lite`, just with no human to pause for and a
66
+ hard stop at the brief. A normal (attended) `lite` run ignores this section.
67
+
43
68
  ---
44
69
 
45
70
  ## /ritual build
@@ -151,6 +176,7 @@ If the user types `always audit for this build` mid-flow at the Step 9.6 prompt,
151
176
  Persist `auditMode` to `Exploration.metadata.auditMode` at `create_exploration` time (additive JSONB key — no schema migration) so `/ritual resume <exploration-id>` picks up the same mode the original build started with, and `/ritual lineage <exploration-id>` can render which gates ran + their outcomes.
152
177
 
153
178
 
179
+ <!-- skill-options:no-gate-change: 2b (clarifying question) + 2c (generic terminal) are loud-fallback COPY variants of the same gate; options are unchanged (proceed | name-the-job) -->
154
180
  #### Step 0.7 — The Job gate: classify the job to be done
155
181
 
156
182
  **The FIRST tool call of a fresh build.** The server — not you — classifies the user's raw ask into
@@ -166,9 +192,16 @@ When this gate runs:
166
192
 
167
193
  1. **Call `mcp__ritual__classify_work_item`** with `raw_input` = the user's ask, verbatim. Do NOT
168
194
  classify yourself, do NOT pre-filter to development jobs. It returns
169
- `{ jtbd, workItemLabel, deliverableTemplate, why, personaCoverage }`.
195
+ `{ jtbd, workItemLabel, deliverableTemplate, why, confidence, isGenericFallback, personaCoverage }`.
196
+ `isGenericFallback` (and `confidence`) are the typed-uncertainty signal: when it's `true`, the
197
+ result is the catch-all (`build-feature` / `produce-deliverable`) or the classifier wasn't sure —
198
+ it is NOT a confident match, and which render variant you use in step 2 depends on it.
199
+
200
+ 2. **Render the validation prompt** (rail stage `Job`). This gate is a plain-language VALIDATION of
201
+ what you're about to build: restate the ask + the matched job in the user's words, then let them
202
+ confirm or correct. Which variant you render depends on `isGenericFallback`.
170
203
 
171
- 2. **Render the validation prompt** (rail stage `Job`):
204
+ **2a Confident match** (`isGenericFallback` is `false`): the classifier matched a specific job.
172
205
 
173
206
  ```text
174
207
  Ritual build
@@ -182,21 +215,68 @@ When this gate runs:
182
215
  job actually is.
183
216
  ```
184
217
 
218
+ **2b — No specific job matched, FIRST time** (`isGenericFallback` is `true` — the result is the
219
+ catch-all `build-feature` / `produce-deliverable`, or `confidence` is `low` — AND you have not yet
220
+ asked the clarifying question this gate): do NOT present the catch-all as a verdict. This case
221
+ should be RARE. Instead ask ONE clarifying question that elicits the missing signal — what KIND of
222
+ work this is — grounded in their ask, with concrete examples that lead the reply. The examples
223
+ span the catalog's functions so the user can self-identify; tailor the wording to their ask. This
224
+ is the fallback step that lets us classify properly instead of defaulting blind (see
225
+ `loud-fallback-escalation.md`).
226
+
227
+ ```text
228
+ Ritual build
229
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
230
+
231
+ You're looking to: {restate the ask in one short clause}
232
+
233
+ I couldn't pin this to a specific job — your ask reads as an outcome, and the flow scopes much
234
+ better when I know what KIND of work it is. Which is closest (or say it in your own words)?
235
+ • A coding-agent / MCP / skill capability — tooling the agent itself uses
236
+ • A backend service or API
237
+ • A frontend / UI feature
238
+ • A refactor, migration, or infra / platform change
239
+ • Something else — tell me in a sentence
240
+
241
+ Reply with the closest fit (or your own words) and I'll lock the job.
242
+ ```
243
+
244
+ When the user answers, call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input` plus
245
+ `correction` = their reply (and `previous_jtbd`), then re-render: **2a** if it now matched a
246
+ specific job, otherwise **2c**.
247
+
248
+ **2c — Still generic after the clarifying question** (`isGenericFallback` is STILL `true` after the
249
+ user answered 2b): do NOT ask again. Proceed as a generic build with the function-agnostic
250
+ `Feature Brief` deliverable, and note the job can be renamed later. The job name stays generic —
251
+ never show a function-specific deliverable (e.g. "Frontend Web") for an unclassified build.
252
+
253
+ ```text
254
+ Ritual build
255
+ ● Job ○ Scope ○ Discovery ○ Recommendations ○ Feature Brief
256
+
257
+ You're looking to: {restate the ask in one short clause}
258
+ I'll treat this as a generic build — deliverable: Feature Brief. You can rename the job later.
259
+
260
+ Reply `proceed` to frame the problem.
261
+ ```
262
+
185
263
  Do not render `personaCoverage` — persona representation is handled server-side now; only surface
186
264
  it if the user explicitly asks who's involved.
187
265
 
188
266
  Rail naming (deliverable-named rail, 2026-06-11): render `{Deliverable}` as the PROPOSED job's
189
- `deliverableTemplate` (e.g. `Launch Brief`, `PRD`, `Service Build Brief`; `Build brief` for the
190
- generic `build-feature`), and OMIT the `Implementation (Your agent)` stage entirely when the
191
- proposed job is not a development job — non-dev rails have FIVE stages ending at the deliverable.
192
- A correction that changes the job updates the rail on the next render. Spec:
267
+ `deliverableTemplate` from the classify result (e.g. `Launch Brief`, `PRD`, `Service Build Brief`;
268
+ `Feature Brief` for the generic `build-feature`), and OMIT the `Implementation (Your agent)` stage
269
+ entirely when the proposed job is not a development job — non-dev rails have FIVE stages ending at
270
+ the deliverable. A correction that changes the job updates the rail on the next render. Spec:
193
271
  `references/cli-output-contract.md` § Canonical stage table.
194
272
 
195
273
  3. **[USER PAUSE]** — wait for the user's actual reply. Never infer confirmation from the original
196
274
  ask, auto-mode, or silence. `proceed` / `yes` / `ok` confirms. ANY other substantive reply is a
197
275
  correction: call `mcp__ritual__classify_work_item` AGAIN with the same `raw_input`, plus
198
276
  `correction` (the user's words) and `previous_jtbd` (the rejected slug), then re-render step 2.
199
- Loop until the user proceeds.
277
+ The clarifying QUESTION (2b) is asked AT MOST ONCE per gate — if the re-classification after the
278
+ user's answer is still generic, render **2c** (proceed as a generic `Feature Brief`); do not ask
279
+ the clarifying question again. Loop until the user proceeds.
200
280
 
201
281
  4. **Remember the confirmed `jtbd`** — you pass it to `create_exploration` at Step 6. Only after the
202
282
  user proceeds does the flow enter the `Scope` stage (workspace pick onward).
@@ -543,7 +623,33 @@ Steps:
543
623
  f. **If the user picks one (1-N):**
544
624
  - Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
545
625
  - **Skip Step 1.5 step 8 (overlap check)** — the user just picked from system suggestions explicitly grounded in workspace state; a fresh overlap pass would be redundant noise.
546
- - Continue to Step 2 (template selection).
626
+ - **Run the unchosen-candidates gate (f.1) BEFORE continuing**, then continue to Step 2.
627
+
628
+ <!-- skill-options:no-gate-change: f.1 is an OPTIONAL skippable sub-prompt nested in Step 1.5 step 6 (default skip); adds no tracked pause gate or Step header, so the structural fingerprint is unchanged (check-skill-options-contract green). -->
629
+ f.1 **Unchosen-candidates gate (2026-06-14, unchosen-options → discovery worktrees).** The candidates the user did NOT pick are paths worth not silently dropping. Render ONE compact, SKIPPABLE prompt — for each unchosen candidate, the user can spin up **discovery now** (a background worktree reasons it to a build brief) or **log it as a future job**. Promote DELIBERATELY: the default is to drop. (This gate is itself skipped in autonomous/worktree mode — never spawn discovery recursively.)
630
+
631
+ ```text
632
+ You picked #{k}. The other {M} — want to keep any going?
633
+ • `discover <nums>` — spin up discovery NOW in a background git worktree: an agent reasons it
634
+ end-to-end to a build brief (reasoning only, no code). e.g. `discover 1`
635
+ • `next-job <nums>` — just log it as a future job (a draft exploration in this workspace; nothing runs)
636
+ • `skip` — drop them (default)
637
+ ```
638
+
639
+ Resolve the reply, then continue to Step 2 for the picked candidate:
640
+ - **`discover <nums>`** → for each, run `ritual lite "{candidate.summary}" --worktree` **in the
641
+ BACKGROUND** (do not block the build — use your shell's background/async execution). It spins a
642
+ git worktree and runs autonomous discovery to a brief there; tell the user where (`<repo>.ritual-discover/<slug>`).
643
+ The result is an exploration with `spawn_origin: 'discovery_worktree'`; its brief is
644
+ agent-authored, not human-reviewed. (See `references/unchosen-options-discovery-worktrees.md` in `documents/architecture/`.)
645
+ - **`next-job <nums>`** → for each, call `mcp__ritual__create_exploration` with the candidate's
646
+ `title` as `name`, its `summary` as `problem_statement`, `spawn_origin: 'next_job'`, and NO
647
+ `agentic` flag — a NOT_STARTED draft that shows in the workspace roster as a future job. Cheap; nothing runs.
648
+ - **`skip` / no reply about them** → drop silently.
649
+
650
+ Keep it ONE prompt, never per-candidate pauses. If the user just proceeds without addressing it, treat as `skip`.
651
+
652
+ f.2 **Continue to Step 2 (template selection)** for the picked candidate.
547
653
 
548
654
  g. **If the user says "none" / "let me describe":** continue to Step 2 normally; treat as if they had originally picked "start fresh" with no raw_input yet (they'll provide one at Step 3-4 time).
549
655
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "cliVersion": "0.36.9",
3
- "builtAt": "2026-06-14T10:07:00.491Z",
4
- "skillsHash": "26b50ff4f856"
2
+ "cliVersion": "0.36.14",
3
+ "builtAt": "2026-06-14T21:33:31.224Z",
4
+ "skillsHash": "ee9a77046c96"
5
5
  }
@@ -3,7 +3,7 @@ name: ritual
3
3
  description: "Use when an engineer wants a coding agent to plan or build a feature, refactor, or implementation-heavy change that depends on context the agent can't infer on its own — strategic intent, constraints, prior decisions, and trade-offs that live in the user's head. Ritual runs a structured exploration to surface that context through targeted discovery questions, combines it with codebase signals and prior explorations, and delivers a validated build brief (sub-problems, recommendations, dependencies) — additional context to fold into plan mode before the agent writes code. Prefer this over jumping straight to implementation or plan mode when the problem is ambiguous, cross-cutting, or has non-obvious constraints. Subcommands: build (full planning-to-sync cycle — default for new features), resume (continue an in-flight exploration), lineage (file-path KG history — what decisions shaped this code), context-pulse (readiness and context-debt scoring — is this safe to build yet?)."
4
4
  argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3', 'resume', 'lineage src/checkout/views.py', 'context-pulse Add billing export')"
5
5
  user-invocable: true
6
- stamp: 26b50ff4f856
6
+ stamp: ee9a77046c96
7
7
  ---
8
8
 
9
9
  # /ritual