@ritualai/cli 0.9.6 → 0.24.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.
- package/dist/commands/doctor.js +59 -23
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.js +33 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/uninstall.js +114 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/agents/providers.js +44 -4
- package/dist/lib/agents/providers.js.map +1 -1
- package/dist/lib/memory-update.js +158 -0
- package/dist/lib/memory-update.js.map +1 -0
- package/dist/lib/uninstall-plan.js +102 -0
- package/dist/lib/uninstall-plan.js.map +1 -0
- package/package.json +1 -1
- package/skills/claude-code/ritual/.ritual-bundle.json +2 -2
- package/skills/claude-code/ritual/SKILL.md +14 -11
- package/skills/claude-code/ritual/manifest.json +0 -5
- package/skills/claude-code/ritual/references/async-polling.md +5 -5
- package/skills/claude-code/ritual/references/build-flow.md +739 -497
- package/skills/claude-code/ritual/references/change-preflight.md +81 -0
- package/skills/claude-code/ritual/references/cli-output-contract.md +2 -2
- package/skills/claude-code/ritual/references/context-pulse-flow.md +0 -1
- package/skills/claude-code/ritual/references/lite-flow.md +2781 -0
- package/skills/claude-code/ritual/references/scoring-fallback.md +1 -1
- package/skills/codex/ritual/.ritual-bundle.json +2 -2
- package/skills/codex/ritual/SKILL.md +14 -11
- package/skills/codex/ritual/manifest.json +0 -5
- package/skills/codex/ritual/references/async-polling.md +5 -5
- package/skills/codex/ritual/references/build-flow.md +739 -497
- package/skills/codex/ritual/references/change-preflight.md +81 -0
- package/skills/codex/ritual/references/cli-output-contract.md +2 -2
- package/skills/codex/ritual/references/context-pulse-flow.md +0 -1
- package/skills/codex/ritual/references/lite-flow.md +2781 -0
- package/skills/codex/ritual/references/scoring-fallback.md +1 -1
- package/skills/cursor/ritual/.ritual-bundle.json +2 -2
- package/skills/cursor/ritual/SKILL.md +14 -11
- package/skills/cursor/ritual/manifest.json +0 -5
- package/skills/cursor/ritual/references/async-polling.md +5 -5
- package/skills/cursor/ritual/references/build-flow.md +739 -497
- package/skills/cursor/ritual/references/change-preflight.md +81 -0
- package/skills/cursor/ritual/references/cli-output-contract.md +2 -2
- package/skills/cursor/ritual/references/context-pulse-flow.md +0 -1
- package/skills/cursor/ritual/references/lite-flow.md +2781 -0
- package/skills/cursor/ritual/references/scoring-fallback.md +1 -1
- package/skills/gemini/ritual/.ritual-bundle.json +2 -2
- package/skills/gemini/ritual/SKILL.md +14 -11
- package/skills/gemini/ritual/manifest.json +0 -5
- package/skills/gemini/ritual/references/async-polling.md +5 -5
- package/skills/gemini/ritual/references/build-flow.md +739 -497
- package/skills/gemini/ritual/references/change-preflight.md +81 -0
- package/skills/gemini/ritual/references/cli-output-contract.md +2 -2
- package/skills/gemini/ritual/references/context-pulse-flow.md +0 -1
- package/skills/gemini/ritual/references/lite-flow.md +2781 -0
- package/skills/gemini/ritual/references/scoring-fallback.md +1 -1
- package/skills/kiro/ritual/.ritual-bundle.json +2 -2
- package/skills/kiro/ritual/SKILL.md +14 -11
- package/skills/kiro/ritual/manifest.json +0 -5
- package/skills/kiro/ritual/references/async-polling.md +5 -5
- package/skills/kiro/ritual/references/build-flow.md +739 -497
- package/skills/kiro/ritual/references/change-preflight.md +81 -0
- package/skills/kiro/ritual/references/cli-output-contract.md +2 -2
- package/skills/kiro/ritual/references/context-pulse-flow.md +0 -1
- package/skills/kiro/ritual/references/lite-flow.md +2781 -0
- package/skills/kiro/ritual/references/scoring-fallback.md +1 -1
- package/skills/vscode/ritual/.ritual-bundle.json +2 -2
- package/skills/vscode/ritual/SKILL.md +14 -11
- package/skills/vscode/ritual/manifest.json +0 -5
- package/skills/vscode/ritual/references/async-polling.md +5 -5
- package/skills/vscode/ritual/references/build-flow.md +739 -497
- package/skills/vscode/ritual/references/change-preflight.md +81 -0
- package/skills/vscode/ritual/references/cli-output-contract.md +2 -2
- package/skills/vscode/ritual/references/context-pulse-flow.md +0 -1
- package/skills/vscode/ritual/references/lite-flow.md +2781 -0
- package/skills/vscode/ritual/references/scoring-fallback.md +1 -1
- package/skills/claude-code/ritual/references/discovery-classification.md +0 -175
- package/skills/codex/ritual/references/discovery-classification.md +0 -175
- package/skills/cursor/ritual/references/discovery-classification.md +0 -175
- package/skills/gemini/ritual/references/discovery-classification.md +0 -175
- package/skills/kiro/ritual/references/discovery-classification.md +0 -175
- package/skills/vscode/ritual/references/discovery-classification.md +0 -175
|
@@ -0,0 +1,2781 @@
|
|
|
1
|
+
<!-- GENERATED from references/build-flow.md by apps/cli/scripts/generate-lite-flow.js — DO NOT EDIT. -->
|
|
2
|
+
<!-- source-sha: 31cf08b9ce5c9988 -->
|
|
3
|
+
|
|
4
|
+
# /ritual lite — fast build (generated; do not edit)
|
|
5
|
+
|
|
6
|
+
`/ritual lite` is `/ritual build` run unattended: the **same Ritual pipeline**
|
|
7
|
+
(real discovery → recommendations → requirements → deliverable/build brief →
|
|
8
|
+
implement → PR → next job), just a **smaller discovery surface and fewer pauses**.
|
|
9
|
+
It is **not** lighter in provenance, staged records, constraints, lineage,
|
|
10
|
+
auditability, or KG sync — only in interaction cost.
|
|
11
|
+
|
|
12
|
+
Follow build-flow.md's steps below EXACTLY, with these **LITE OVERRIDES**:
|
|
13
|
+
|
|
14
|
+
## Global lite rules
|
|
15
|
+
- **Auto-pick the recommended/default option at every gate without pausing** —
|
|
16
|
+
EXCEPT the two human touchpoints below. Do NOT render "Reply …" prompts or stop
|
|
17
|
+
at gates marked `[LITE AUTO …]`.
|
|
18
|
+
- **Workspace (Step 1):** use `.ritual/config.json`'s workspace, or the only/first
|
|
19
|
+
project workspace. No pause.
|
|
20
|
+
- **Scope / problem frame (Step 5):** auto-lock the first draft. No pause.
|
|
21
|
+
- **Discovery (Step 7):** auto-accept the **top 2–3 most impactful (server-ranked)
|
|
22
|
+
questions per Area** — do NOT walk Area-by-Area. Commit in ONE batch, then run
|
|
23
|
+
the agentic exploration.
|
|
24
|
+
- **Recommendations are auto-accepted at generation**; requirements + deliverable
|
|
25
|
+
+ build brief generate automatically. The review never blocks them.
|
|
26
|
+
|
|
27
|
+
## The only human touchpoints in lite
|
|
28
|
+
1. **Front gate (Step 3.9) — confirm the job + pick the lead persona.** Render the
|
|
29
|
+
two beats: (a) "run lite discovery for *<feature>*? It'll produce a
|
|
30
|
+
*<deliverable>*" with a `deep` escape to `/ritual build`; then (b) after
|
|
31
|
+
`work_item`, "Which persona should the agent take on?" (recommended first).
|
|
32
|
+
2. **Recommendation review (Step 9) — "review or proceed" (NON-BLOCKING).** Offer:
|
|
33
|
+
`edit R{N}` (suggest-edit → preview → accept persists) or `proceed`. **No
|
|
34
|
+
reject CTA.** Artifacts are already generating; proceeding never blocks.
|
|
35
|
+
|
|
36
|
+
## Skipped in lite
|
|
37
|
+
UX brief review, plan-fidelity audit, and sibling-exploration forks are omitted
|
|
38
|
+
(they're removed from the flow below).
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## /ritual build
|
|
43
|
+
|
|
44
|
+
Walks the engineer from a free-form problem statement to vetted, accepted Ritual recommendations using the Ritual MCP tool surface.
|
|
45
|
+
|
|
46
|
+
Output: a fully-closed loop — **exploration in COMPLETE state, recommendations accepted (or explicitly handed off to an admin), build brief generated, code implemented, and `sync_implementation` called to register the result in the knowledge graph**. The engineer stays in the driver's seat through concise status updates and explicit pauses only at real decision gates.
|
|
47
|
+
|
|
48
|
+
### Vocabulary mapping (engineer-tone)
|
|
49
|
+
|
|
50
|
+
The Ritual data model uses product-research terminology. This skill translates to engineer-natural terms when speaking to the user. The underlying API still uses original names — keep this table mental when you read tool inputs / outputs:
|
|
51
|
+
|
|
52
|
+
| User-facing term (the skill says) | Tool field name (the API uses) |
|
|
53
|
+
|---|---|
|
|
54
|
+
| **scope** | `problemStatement` |
|
|
55
|
+
| **sub-problem** | `consideration` |
|
|
56
|
+
| **Area** (NOT "matter") | `matter` |
|
|
57
|
+
| **discovery question** | `question` |
|
|
58
|
+
| **recommendation** | `recommendation` |
|
|
59
|
+
|
|
60
|
+
When the user says "tighten the scope," call `generate_problem_statement(...)` with their refinement. When you tell the user "I picked these sub-problems," you mean the items you put in `considerations[]`. The tools don't change; only the language to the user does.
|
|
61
|
+
|
|
62
|
+
**On "Area" vs "matter":** the API field is `matter` for historical reasons. The user-facing label is **Area** because it's plainer and reads less research-y in a developer flow. NEVER surface "matter" or "matter.name" in user-facing copy — use "Area" / "Area name" instead.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Runtime contracts
|
|
66
|
+
|
|
67
|
+
Before running this flow, apply `references/cli-output-contract.md` and `references/async-polling.md`. Keep raw recon internal, pass the `codebase_context_packet` downstream, and show the user only the compact `recon_digest`.
|
|
68
|
+
|
|
69
|
+
**Build rail is load-bearing.** Every top-level user-facing message below MUST begin with the 6-stage build rail per `references/cli-output-contract.md` § Build progress anchor. Examples in this file show the rail in context; the canonical stage table + `progressHeader(stage)` spec lives in the output contract. Do not drop the rail to save space.
|
|
70
|
+
|
|
71
|
+
For narrow/mobile chat surfaces, use the **compact progress anchor** defined in `references/cli-output-contract.md` § Build progress anchor (the `Ritual build · 2/6 Scope` chip) instead of forcing the full six-stage rail to wrap. Same contract, different rendering.
|
|
72
|
+
|
|
73
|
+
### When to use
|
|
74
|
+
|
|
75
|
+
- The user describes a new feature, refactor, migration, or implementation-heavy change that needs planning before coding
|
|
76
|
+
- The user wants the coding agent to gather codebase context, prior decisions, sub-problems, discovery questions, recommendations, and a build brief before implementation
|
|
77
|
+
- The user describes a problem they want explored ("we need to figure out X", "let's scope Y", "I want recommendations on Z")
|
|
78
|
+
- The user wants the full pipeline — sub-problems → scope → discovery → recommendations → build brief — not just one step
|
|
79
|
+
- The user runs `/ritual build` from inside a repo that already has explorations in the workspace — the resume path (Step 1.5) decides whether to continue an existing exploration or start a new one based on the per-exploration state badge
|
|
80
|
+
|
|
81
|
+
When **not** to use:
|
|
82
|
+
- The user already has a specific exploration id and just wants a quick status check — call `get_exploration` directly
|
|
83
|
+
- The user wants to *implement* a feature from a build brief that's already been generated and accepted — that's a separate downstream coding-agent task (the build brief itself is the input)
|
|
84
|
+
|
|
85
|
+
### Workflow — 13 steps (Steps 10-13 cover the build-brief → implement → sync close-the-loop phase; unpicked considerations are preserved as later candidates by default)
|
|
86
|
+
|
|
87
|
+
Use explicit **[LITE AUTO — no pause; auto-pick the recommended default]** only at decision gates. Pause when the user must choose among options, approve creation or acceptance, resolve ambiguity, authorize implementation, accept cost/time, or provide missing non-code context. Do **not** pause for status-only steps, safe defaults, internal recon, or silent checks.
|
|
88
|
+
|
|
89
|
+
**Pauses are not optional even in auto-mode** (load-bearing). When the host agent has auto-accept / bypass-permissions enabled, the SKILL must still honor every `**[LITE AUTO — no pause; auto-pick the recommended default]**` as a hard stop. Inferring an answer from context, choosing a default, or pressing on without an actual user reply defeats the build flow's value: Ritual is producing aligned recommendations because the human shaped the inputs, not because the agent guessed plausibly. The auto-mode reminder in Step 0 below is informational only — it does not relax this rule; it's a heads-up to the user, not permission to bypass pauses.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### CLI and async guardrails
|
|
94
|
+
|
|
95
|
+
Follow `references/cli-output-contract.md` for terminal output, dense-list formatting, user-facing vocabulary, and the no-internal-step-label rule. Follow `references/async-polling.md` for every long-running server operation. Whenever the user asks to **change or add** something via free text (refine sub-problems, reframe scope, add an anti-goal), follow `references/change-preflight.md` — restate the request and show the exact instruction before calling the mutating tool, and wait for confirmation. It is a hard pause even in auto-mode.
|
|
96
|
+
|
|
97
|
+
#### Step 0 — Auto-mode heads-up (informational, NOT a pause)
|
|
98
|
+
|
|
99
|
+
> **Changed 2026-05-21.** Pre-0.8.3 this was a blocking pause: the agent asked the user to confirm they were not in auto-mode and waited for a `1`/`2` reply before proceeding. That broke FTUE: a brand-new user running their first `/ritual build` hit a meta-question about a Claude Code TUI setting before they had any context for what Ritual does. Friction without value. Worse, no reliable programmatic signal exists for "is the agent in auto-mode" — every coding agent represents the state differently, the MCP request carries no mode flag, and the SKILL itself admitted "I can't read your Claude Code TUI footer from here." So the pause was theatre: it forced the user to assert something the agent had no way to verify.
|
|
100
|
+
>
|
|
101
|
+
> The new shape: one informational line in the FIRST user-visible message of the flow. No pause. No `**[LITE AUTO — no pause; auto-pick the recommended default]**` here. If the user IS in auto-mode, the next genuine decision pause (workspace pick, scope pick, etc.) is the natural place they'll notice it racing past. The line below gives them the right cue + remediation.
|
|
102
|
+
|
|
103
|
+
The SKILL MUST include the following one-line heads-up at the top of the **first** user-visible message in a `/ritual build` flow (typically the workspace summary in Step 1, or the no-args prompt in Step 1.1). Include it once per flow only:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
|
|
107
|
+
scope, discovery picks, rec acceptance, implementation approval). If your
|
|
108
|
+
agent is in auto-accept / bypass-permissions mode, those pauses won't
|
|
109
|
+
actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
|
|
110
|
+
back to "default").
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
That's it. No menu. No required reply. Just inform.
|
|
114
|
+
|
|
115
|
+
Pausing discipline is still load-bearing — every `**[LITE AUTO — no pause; auto-pick the recommended default]**` later in the flow is a hard stop regardless of whether the user reads or ignores this heads-up. The agent's contract is unchanged from the preamble: never infer an answer, never pick a default, never press on without an actual user reply. Auto-mode collapsing those pauses is the user's risk to accept; the SKILL's job is just to surface that risk visibly once, then enforce the gates regardless.
|
|
116
|
+
|
|
117
|
+
**Per-agent indicators** (informational, for the SKILL's own awareness — NOT to gate behavior):
|
|
118
|
+
|
|
119
|
+
| Agent | Where the mode shows up |
|
|
120
|
+
|---|---|
|
|
121
|
+
| **Claude Code** | TUI footer shows `auto-accept edits` or `bypass permissions`. Toggled with **Shift+Tab**. |
|
|
122
|
+
| **Cursor** | "Auto" / "Yolo" toggle in the Composer/Agent panel. |
|
|
123
|
+
| **Codex** | `--full-auto` CLI flag or the equivalent setting in the IDE extension. |
|
|
124
|
+
| **Kiro** | Per-server `autoApprove[]` arrays in `mcp.json`, plus any global "auto" toggle in the Agent panel. |
|
|
125
|
+
| **Windsurf / VS Code Copilot / Gemini CLI** | Each has its own auto-accept mode in settings. |
|
|
126
|
+
|
|
127
|
+
The table is here so future contributors understand WHY the heads-up mentions Claude Code's Shift+Tab specifically — that's the dominant target client. If we add an elicitation-based picker (see `documents/architecture/selection-cursor-pattern.md` §"Future — MCP elicitation"), the auto-mode concern reduces further because elicitation form-mode requires actual user input regardless of agent mode.
|
|
128
|
+
|
|
129
|
+
##### Step 0.1 — Parse build-mode flags (load-bearing for Step 9.6, future Audit 2/3 gates)
|
|
130
|
+
|
|
131
|
+
Per `documents/architecture/audit-suite.md` § 7a, `/ritual build` accepts three audit-mode levels:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
/ritual build <problem> → auditMode = 'normal' (today's behavior, default proceed)
|
|
135
|
+
/ritual build --audited <problem> → auditMode = 'audited' (recommend at each gate)
|
|
136
|
+
/ritual build --audit=strict <problem> → auditMode = 'strict' (auto-run with 90s/chain time budget)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Aliases the SKILL accepts (for agent-friendly UX):
|
|
140
|
+
- `--audit` (no-equals form, treated identically to `--audited`)
|
|
141
|
+
- `audited` (bareword form, agent-friendly when users type conversationally)
|
|
142
|
+
|
|
143
|
+
At Step 0 (or whenever the agent first parses the user's `/ritual build` invocation), extract the audit-mode flag and store as `auditMode` in working memory. Default to `'normal'` if no flag present. The audit gate at Step 9.6 (and future Audits 2/3 at Steps 10b.5 + 11.1, ships in PRs B/C) read this variable to choose between three prompt styles.
|
|
144
|
+
|
|
145
|
+
If the user types `always audit for this build` mid-flow at the Step 9.6 prompt, upgrade `auditMode` from `'normal'` or `'audited'` → `'strict'` for any remaining audit gates in the same session. The upgrade is session-scoped (doesn't persist across `/ritual build` invocations).
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
#### Step 1 — Pick a workspace
|
|
150
|
+
|
|
151
|
+
<!-- skill-options:no-gate-change: connection-freshness ping check is a non-interactive warn, adds no user-facing gate or option -->
|
|
152
|
+
**Connection freshness check (one-time, warn-only) — fire on your FIRST MCP call this session.** Alongside the first `list_workspaces` call below, call `mcp__ritual__ping` **once** and inspect the returned identity:
|
|
153
|
+
|
|
154
|
+
- If the response is **missing `gitSha` or `toolContractHash`**, or reports **`version: "1.0.0"`** (the legacy hardcoded value), the user is connected to an **outdated / legacy Ritual MCP** — emit exactly ONE line, then continue normally (warn-only, never block):
|
|
155
|
+
|
|
156
|
+
`⚠ Connected to an outdated Ritual MCP (no build identity) — some build features may be unavailable. Run \`ritual doctor\` to check, then \`ritual init\` if it flags a refresh.`
|
|
157
|
+
|
|
158
|
+
- Otherwise (identity present and not legacy), say nothing and proceed.
|
|
159
|
+
|
|
160
|
+
Do this **at most once per session** — don't re-ping on later steps.
|
|
161
|
+
|
|
162
|
+
Resolution order:
|
|
163
|
+
|
|
164
|
+
1. **Project-bound workspace (preferred).** Check for a `.ritual/config.json` at the project root (you can use the Read tool — the file is a small JSON with `workspaceId` + `workspaceName`). If it exists, that's the workspace this repo is bound to. Use it without pausing.
|
|
165
|
+
|
|
166
|
+
**Validate the binding + get exploration count in one call.** Call `mcp__ritual__list_workspaces()` (no args). Each row in the response carries `_count.explorations` — the authoritative count, server-side, including any explorations created via web UI / other agents / out-of-band API calls. Find the row matching the bound `workspaceId`:
|
|
167
|
+
|
|
168
|
+
- **Not found** (deleted, access revoked, wrong id in config): pause with a clear error and offer `workspace: list` to re-bind. Don't fall through to `list_explorations` later — it errors with a less actionable message.
|
|
169
|
+
- **Found:** store `workspace.explorationCount` for Step 1.5. The SKILL never maintains a local "empty workspace" cache because that goes stale against anything that mutates the workspace outside this CLI's view.
|
|
170
|
+
|
|
171
|
+
User-visible (per Step 0, prepend the one-line auto-mode heads-up — once per flow):
|
|
172
|
+
|
|
173
|
+
> Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace, scope, discovery picks, rec acceptance, implementation approval). If your agent is in auto-accept / bypass-permissions mode, those pauses won't actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle back to "default").
|
|
174
|
+
>
|
|
175
|
+
> Using workspace: **{workspaceName}** from `.ritual/config.json`.
|
|
176
|
+
> Override with `workspace: list`.
|
|
177
|
+
|
|
178
|
+
Pause only if the file is missing/malformed, the workspace cannot be accessed (validation failed above), or the user explicitly asks to switch.
|
|
179
|
+
2. **List existing project workspaces.** If no `.ritual/config.json`, call `mcp__ritual__list_workspaces` — this returns project-type workspaces (the General workspace is excluded by default; agents never use it). Present as a numbered list (id, name). **[LITE AUTO — no pause; auto-pick the recommended default]** for selection.
|
|
180
|
+
3. **Create a new one if none exist or user wants a fresh one.** Call `mcp__ritual__create_workspace` with a name — convention is to name it after the repo (basename of cwd, or origin remote). Confirm the name with the user first. **[LITE AUTO — no pause; auto-pick the recommended default]**
|
|
181
|
+
|
|
182
|
+
Store `workspace_id` for the rest of the flow.
|
|
183
|
+
|
|
184
|
+
If you created a new workspace, persist the binding to `.ritual/config.json` so future runs in this repo skip the workspace-selection prompt. Write it yourself if you have filesystem write access; otherwise show the user the JSON and have them save it.
|
|
185
|
+
|
|
186
|
+
**`.ritual/config.json` is committed to the repo — it is shared, not per-user.** Same model as `.eslintrc.json` or `tsconfig.json`: it binds this codebase to a Ritual workspace + pins team-level defaults (`workspaceId`, `personaSlug` — set by `ritual init`'s FTUE — or the legacy `defaultTemplateId`). Everyone working on this repo wants the same values. Per-user state (PATs, auth tokens) lives in `~/.config/ritual/` and never in this file.
|
|
187
|
+
|
|
188
|
+
When you write the config, also write `.ritual/.gitignore` if it doesn't already exist so any future per-user state files in this directory get ignored while `config.json` itself stays tracked:
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
# .ritual/.gitignore — auto-generated by the SKILL.
|
|
192
|
+
# config.json is repo-shared and meant to be committed (workspace
|
|
193
|
+
# binding + team defaults). Per-user state files go below.
|
|
194
|
+
*
|
|
195
|
+
!.gitignore
|
|
196
|
+
!config.json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
When you later see `.ritual/config.json` in `git status` output (modified or untracked), it's correct to commit it — don't ask the user whether it's per-user state; this comment is the answer.
|
|
200
|
+
|
|
201
|
+
#### Step 1.1 — No-arg `/ritual build` entry
|
|
202
|
+
|
|
203
|
+
If the user invokes `/ritual build` with no problem statement, set `raw_input = null` and **do not ask for a problem statement before checking the workspace**. A no-arg build is often a continuation or next-work discovery intent, so `resume` and `suggest high-leverage work` must remain available.
|
|
204
|
+
|
|
205
|
+
After workspace selection, proceed into the existing-exploration check below. User-facing copy should avoid internal step labels and should offer these paths when applicable:
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
I can help you continue existing work or find the next high-leverage thing.
|
|
209
|
+
|
|
210
|
+
{existing exploration summary, if any}
|
|
211
|
+
|
|
212
|
+
Reply with:
|
|
213
|
+
- a number/name to resume
|
|
214
|
+
- `suggest` to have me look for high-leverage candidates from repo + workspace history
|
|
215
|
+
- a feature/problem description to start fresh
|
|
216
|
+
- `none` to exit
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If there are **zero existing explorations** and `raw_input = null`, do not say "starting fresh" and do not advance to template selection yet. Ask for the feature/problem first:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
Ritual build
|
|
223
|
+
● Context ○ Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
224
|
+
|
|
225
|
+
Heads-up: Ritual's build flow needs ~5 real decisions from you (workspace,
|
|
226
|
+
scope, discovery picks, rec acceptance, implementation approval). If your
|
|
227
|
+
agent is in auto-accept / bypass-permissions mode, those pauses won't
|
|
228
|
+
actually pause for you — toggle off first (Claude Code: Shift+Tab to cycle
|
|
229
|
+
back to "default").
|
|
230
|
+
|
|
231
|
+
Using workspace: {workspaceName}.
|
|
232
|
+
|
|
233
|
+
No Ritual history here yet.
|
|
234
|
+
|
|
235
|
+
Next: start with a feature, or let Ritual suggest high-leverage work from the repo.
|
|
236
|
+
|
|
237
|
+
Reply with a feature/problem description, `suggest`, `pulse <ask>`, or `none`.
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
For `pulse <ask>`, route to `/ritual context-pulse <ask>`. Keep it as an optional side path; do not make context-pulse feel like the required first move for `/ritual build`.
|
|
241
|
+
|
|
242
|
+
If the user replies `suggest` but the workspace has no prior explorations, explain that suggestions need prior workspace signal and ask for a feature/problem instead.
|
|
243
|
+
|
|
244
|
+
#### Step 1.5 — Resume vs start (cognitive-debt check)
|
|
245
|
+
|
|
246
|
+
**Skip the `list_explorations` call when the workspace is provably empty.** Two signals count as proof:
|
|
247
|
+
|
|
248
|
+
1. You just created the workspace in Step 1 (in-session creation — there are no explorations possible yet).
|
|
249
|
+
2. The bound workspace's `_count.explorations === 0` (server-side, read from the `list_workspaces` call in Step 1). This is authoritative against any source of mutation — web UI, other agents, out-of-band API calls.
|
|
250
|
+
|
|
251
|
+
If either fires, emit a single line and proceed straight to Step 2. **This skip covers ALL of Step 1.5 — including step 8 (the `check_exploration_overlap` call). No `list_explorations`, no `check_exploration_overlap`, no resume picker. There is nothing to compare against in an empty workspace; running either tool is pure overhead that resolves to "nothing here" after a wasted MCP roundtrip + LLM cost + an interactive permission prompt the user has to approve.**
|
|
252
|
+
|
|
253
|
+
> No prior work in this workspace — starting fresh.
|
|
254
|
+
|
|
255
|
+
Otherwise: before generating new sub-problems, check whether the user's intent might already be covered — partially or fully — by an existing exploration in this workspace.
|
|
256
|
+
|
|
257
|
+
The cost of skipping this step inappropriately is high: an engineer mid-loop on a feature ends up with two parallel explorations on the same problem, the build brief grounds on the wrong one, and the knowledge graph gets diluted with near-duplicate decisions. That's why the skip is gated on a positive server-side empty signal (in-session creation OR `_count.explorations === 0`), never on a client-side cache or heuristic.
|
|
258
|
+
|
|
259
|
+
Steps:
|
|
260
|
+
|
|
261
|
+
1. **Fetch the workspace's exploration list.** Call `mcp__ritual__list_explorations(workspace_id)`. Default returns each exploration with an `implementationStatus` block — the state badge tells you where each one stands without needing per-exploration follow-ups.
|
|
262
|
+
|
|
263
|
+
2. **Filter to recent + relevant.** Sort by most recently updated. Drop archived. Cap at 5 in the user-facing summary (the rest stay available if asked).
|
|
264
|
+
|
|
265
|
+
3. **Group by state badge** and surface to the user with a single message. Do not mention `Step 1.5` in the CLI.
|
|
266
|
+
|
|
267
|
+
If `raw_input` is present, frame this as an overlap/continuation check before starting fresh:
|
|
268
|
+
|
|
269
|
+
> I see {N} exploration{s} already in this workspace:
|
|
270
|
+
>
|
|
271
|
+
> **{state_glyph} {state_label}** ({count})
|
|
272
|
+
>
|
|
273
|
+
> 1. **{name}** — {short scope summary, first 80 chars of problemStatement}
|
|
274
|
+
> {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}.
|
|
275
|
+
> Next: {state-specific call-to-action — see table below}.
|
|
276
|
+
>
|
|
277
|
+
> Recommended: resume one if it matches this work.
|
|
278
|
+
> Reply with a number/name to resume, `suggest` to find high-leverage candidates from repo + workspace history, `delete N` to remove a duplicate/misfire, or `proceed` to start fresh.
|
|
279
|
+
|
|
280
|
+
If `raw_input = null`, frame this as the user's no-arg start screen:
|
|
281
|
+
|
|
282
|
+
> I can help you continue existing work or find the next high-leverage thing.
|
|
283
|
+
>
|
|
284
|
+
> **{state_glyph} {state_label}** ({count})
|
|
285
|
+
>
|
|
286
|
+
> 1. **{name}** — {short scope summary, first 80 chars of problemStatement}
|
|
287
|
+
> {recommendationCount} rec{s} ({accepted}/{total} approved{implementationSegment}), {openDeferralsCount} open deferral{s}.
|
|
288
|
+
> Next: {state-specific call-to-action — see table below}.
|
|
289
|
+
>
|
|
290
|
+
> Reply with:
|
|
291
|
+
> - a number/name to resume
|
|
292
|
+
> - `suggest` to have me look for high-leverage candidates from repo + workspace history
|
|
293
|
+
> - `delete N` to remove a duplicate/misfire from this list (soft-delete; recoverable)
|
|
294
|
+
> - a feature/problem description to start fresh
|
|
295
|
+
> - `none` to exit
|
|
296
|
+
|
|
297
|
+
**Picker rendering anti-pattern (load-bearing) — observed 2026-05-15 in `/ritual resume`, same shape applies here:** each exploration gets ONE picker number `{N}.` on its title line. The summary, recommendation count, and Next-line are indented continuation prose under that number, NEVER their own numbered or bulleted list items. Picker numbering is **flat across all state buckets** (1, 2, 3, … regardless of which `{state_glyph}` header they sit under), so a single number unambiguously picks one exploration. The `({count})` in parens after each state-bucket header is informational and is NEVER a picker number. See `references/resume-flow.md` § R2 for the full anti-pattern with a worked example.
|
|
298
|
+
|
|
299
|
+
**`{implementationSegment}` resolution rule** — derive from `implementationStatus.implementationRecord` on the listing response:
|
|
300
|
+
|
|
301
|
+
| Condition | Render |
|
|
302
|
+
|---|---|
|
|
303
|
+
| No `ImplementationRecord` | `` (empty — drop the segment) |
|
|
304
|
+
| Has record but `prUrl` is null | ` · synced (no PR linked)` |
|
|
305
|
+
| `prStatus = merged` | ` · implemented in PR #{prNumber}` |
|
|
306
|
+
| `prStatus = open` or `draft` | ` · implementing in PR #{prNumber} [{prStatus}]` |
|
|
307
|
+
| `prStatus = closed` (not merged) | ` · abandoned (PR #{prNumber} closed)` |
|
|
308
|
+
|
|
309
|
+
In markdown-rendering agents, hyperlink `PR #{prNumber}` to `prUrl` so users can click through. In plaintext agents, append `prUrl` on the next line.
|
|
310
|
+
|
|
311
|
+
**Rationale** — promotes recommendations to the visible noun and folds the previously-separate "decisions logged" count into the recommendation lifecycle. `Implemented` means "this exploration's approved recs shipped as code, here's the PR" — a stronger user-facing signal than a raw decision count. Decisions still exist as the underlying KG primitive (and are still surfaced explicitly by `/ritual lineage`), but they're no longer a headline concept in the build/resume status line.
|
|
312
|
+
|
|
313
|
+
State badge → user-facing label + call-to-action:
|
|
314
|
+
|
|
315
|
+
| Glyph | State | User-facing label | Suggested next action |
|
|
316
|
+
|---|---|---|---|
|
|
317
|
+
| 📍 | `in_progress` | "still in discovery" | "Continue discovery" |
|
|
318
|
+
| 💬 | `awaiting_admin` | "waiting on admin to accept recommendations" | "Show recommendations for admin review" |
|
|
319
|
+
| ✅ | `ready` | "ready for build brief" | "Generate the build brief and continue to implementation" |
|
|
320
|
+
| 🛠 | `in_flight` | "implementation in progress" | "Resume — generate or refresh the build brief on remaining work" |
|
|
321
|
+
| ✓ | `done` | "shipped with follow-ups" if open deferrals exist; otherwise "shipped context" | "Address follow-ups or use `/ritual lineage` if relevant. Hide fully complete shipped work by default." |
|
|
322
|
+
| ⚠ | `implemented_ahead` | "code shipped before admin acceptance" | "Surface to user — ask admin to review the implementation against the un-accepted recs, or update the recs to match what shipped" |
|
|
323
|
+
|
|
324
|
+
The `implemented_ahead` callout is load-bearing: it means a collaborator implemented a recommendation while it was still in `draft` or `pending_review`, and the snapshot column froze that timeline. The user (typically an admin) should know about this BEFORE you do anything else.
|
|
325
|
+
|
|
326
|
+
4. **[LITE AUTO — no pause; auto-pick the recommended default]** — wait for the user to pick resume / suggest / fresh / abort, or to provide a new feature/problem description.
|
|
327
|
+
|
|
328
|
+
5. **If the user picks "resume":**
|
|
329
|
+
- Set `exploration_id` to the picked exploration.
|
|
330
|
+
- Use the state badge to decide which step to jump to (see "Suggested next action" column above).
|
|
331
|
+
- Skip ahead in this skill — don't re-run Steps 2-9 for an exploration that already has them done.
|
|
332
|
+
- For `ready` or `in_flight` states, jump directly to Step 10 (build brief generation).
|
|
333
|
+
- For `awaiting_admin`, jump to Step 9 (review + `proceed`). Only an admin can move it forward; collaborators see the recs and proceed only if they're explicitly authorized to implement ahead.
|
|
334
|
+
- For `implemented_ahead`, surface the situation to the user and ask what to do — typically the admin reconciles by either approving the recs post-hoc (no code change needed) or updating the recs to match shipped reality.
|
|
335
|
+
- **For `done` or `in_flight` — branch-existence sanity check FIRST.** *(CLI Tenet #9 — sanity-check the world before trusting the database.)* The state badge is computed from `ImplementationRecord` rows in the KG. If the KG was seeded from synthetic/bootstrap data (a common state in early pilot deployments), the record can assert a PR/branch that doesn't exist in this repo. Before treating the exploration as ✓ shipped, verify:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# If implementationRecord.branch is set:
|
|
339
|
+
git rev-parse --verify "origin/${implementationRecord.branch}" 2>/dev/null \
|
|
340
|
+
|| git rev-parse --verify "${implementationRecord.branch}" 2>/dev/null
|
|
341
|
+
|
|
342
|
+
# If implementationRecord.prNumber is set (and `gh` is available):
|
|
343
|
+
gh pr view "${implementationRecord.prNumber}" --json state 2>/dev/null
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
If neither resolves, surface this to the user as a single-action proposal (CLI Tenet #2):
|
|
347
|
+
|
|
348
|
+
> Note: per the KG this is shipped on `{branch}` (PR #{num}), but I don't see that branch in this repo or remote. The implementation record may be bootstrap/synthetic data.
|
|
349
|
+
>
|
|
350
|
+
> Treat as ready-to-implement-for-real? **(y/N, or tell me what's actually shipped)**
|
|
351
|
+
|
|
352
|
+
Don't paint 3-4 options ("treat as done / treat as fresh / inspect the KG row / something else") — one decisive proposal with a yes/no/correct-me escape hatch. If yes: jump to Step 10 (build brief). If no/correct-me: take the user's input as ground truth and update the next move accordingly.
|
|
353
|
+
|
|
354
|
+
- **For `ready` or `in_flight` — implementation footprint check FIRST.** *(Same shape as `/ritual resume` Step R3.5.)* The KG can't distinguish "brief generated, no code yet" from "mid-implementation, unsynced" from "implementation was started and then dropped" — all three look like `ready` because no `ImplementationRecord` exists until `sync_implementation` is called. Run the footprint probes using the `Ritual-Exploration: <id>` commit trailer mandated by Tenet #14:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
git log --all --grep="Ritual-Exploration: ${exploration_id}" --oneline 2>/dev/null
|
|
358
|
+
git rev-parse --verify "feat/${exploration_slug}" 2>/dev/null
|
|
359
|
+
gh pr list --search "Ritual-Exploration: ${exploration_id}" --state all --json number,state,headRefName 2>/dev/null
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
The **dropped-work case** is the load-bearing one: `git log --all` finds attributed commits, but the branch is gone AND no PR exists. Without this check, the agent silently regenerates the brief and the user loses a day of work that was still recoverable from the reflog. Surface as:
|
|
363
|
+
|
|
364
|
+
> ⚠ I see {N} commits attributed to this exploration in your git history from {N} days ago, but the branch is gone and no PR was opened. Looks like the implementation was started and dropped. Want me to: **(a)** show you the orphan commits so you can recover them (`git cherry-pick`), OR **(b)** start fresh implementation from the brief?
|
|
365
|
+
|
|
366
|
+
Full decision table for all footprint shapes (mid-implementation, open PR, merged-but-unsynced, orphan-only, etc.) is in `/ritual resume` Step R3.5. Apply that table here verbatim when resuming via this path.
|
|
367
|
+
|
|
368
|
+
6. **If the user picks "start fresh":** continue to Step 2 normally. The new exploration will sit alongside the existing ones; they're independent rows in the workspace.
|
|
369
|
+
|
|
370
|
+
6a. **If the user picks `delete N` / "remove this from the list":**
|
|
371
|
+
|
|
372
|
+
This path handles duplicates and misfires that pollute the resume picker. Common shape: user accidentally created a near-duplicate exploration (started fresh thinking the original was unrecoverable), or a NOT_STARTED row from a typo / wrong-scope misfire that never converged. Eiman hit this in `nebula` on 2026-05-14 — two `Nerve-center /home dashboard` rows, no way to clear the unwanted one. This option fixes that.
|
|
373
|
+
|
|
374
|
+
Steps:
|
|
375
|
+
|
|
376
|
+
a. **Resolve `N` to an exploration_id.** The user replied `delete 2` referencing the numbered list rendered in step 3. Pick the exploration at that index. If they typed a name instead (`delete "Nerve-center duplicate"`), match by `name` (case-insensitive, exact or prefix).
|
|
377
|
+
|
|
378
|
+
b. **Show the target + ask for explicit confirmation** *(CLI Tenet #2 — single decisive proposal, not a 4-option menu)*:
|
|
379
|
+
|
|
380
|
+
> About to archive: **{name}** ({recommendationCount} rec{s}, {openDeferralsCount} open deferral{s}, last updated {relative time}).
|
|
381
|
+
>
|
|
382
|
+
> This soft-deletes the row — the full record (matters, questions, recs, attestations, decisions) is preserved for audit. The exploration disappears from this and future resume pickers. Restore is admin-only and not exposed in the CLI today.
|
|
383
|
+
>
|
|
384
|
+
> **(y/N)** — y to archive, anything else to cancel.
|
|
385
|
+
|
|
386
|
+
c. **[LITE AUTO — no pause; auto-pick the recommended default]** — wait for `y` / `yes` (case-insensitive). Anything else = cancel back to the picker without calling the tool. Don't lecture; just say "Cancelled. Here's the picker again:" and re-render the menu.
|
|
387
|
+
|
|
388
|
+
d. **Call `mcp__ritual__archive_exploration(exploration_id)`.** On error (404 / 403 / 5xx), surface the failure and re-render the menu — don't silently swallow.
|
|
389
|
+
|
|
390
|
+
e. **Re-render the menu.** After successful archive, refresh the list (call `mcp__ritual__list_explorations` again) and show the updated picker. Lead with: "Archived **{name}**. Updated workspace:" — don't make the user re-derive what happened. Then return to step 4 (**[LITE AUTO — no pause; auto-pick the recommended default]**) — the user can pick resume / suggest / fresh / `delete M` again.
|
|
391
|
+
|
|
392
|
+
f. **Anti-pattern**: do NOT auto-pick "start fresh" or "resume the survivor" after a delete. The user chose to clean up, not to commit to a next step.
|
|
393
|
+
|
|
394
|
+
6b. **If the user picks `suggest` / "help me find the highest-leverage thing":**
|
|
395
|
+
|
|
396
|
+
This path is for the "I have context but no concrete problem yet" case. The agent does a light workspace scan FIRST so suggestions land on real codebase and prior-deferral signals, not generic advice. This is **not** focused feature recon because no problem has been selected yet; focused recon still happens after the user picks a candidate.
|
|
397
|
+
|
|
398
|
+
Steps:
|
|
399
|
+
|
|
400
|
+
a. **Run a light workspace scan** (15-30 seconds of work, faster than Step 3's focused recon):
|
|
401
|
+
- Glob top-level structure (README, package.json/setup.py, top dirs)
|
|
402
|
+
- Skim 3-5 most-load-bearing files
|
|
403
|
+
- Build a 5-10 line workspace scan summary: architecture shape, active modules, obvious seams, open deferral hotspots, and files tied to recent Ritual implementations
|
|
404
|
+
- Collect a sources[] array — the file paths you actually read, 5-10 entries
|
|
405
|
+
|
|
406
|
+
b. **Tell the user** what you found and that you're sourcing suggestions:
|
|
407
|
+
|
|
408
|
+
> Reading the codebase: {recon summary, ≤ 8 lines}
|
|
409
|
+
>
|
|
410
|
+
> Now asking the workspace for high-leverage problem candidates…
|
|
411
|
+
|
|
412
|
+
c. **Call `mcp__ritual__suggest_high_leverage_problems`:**
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
{
|
|
416
|
+
workspace_id,
|
|
417
|
+
codebase_recon_summary: <the workspace scan summary from step a>,
|
|
418
|
+
sources: <the file paths from step a>
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
One LLM call (~3-5 seconds). Returns up to 4 candidates with title, summary, rationale citing a specific signal (deferral, prior decision, etc.), and referencesPriorWork.
|
|
423
|
+
|
|
424
|
+
d. **Surface the candidates** as a numbered list, with the rationale prominent — that's what makes the suggestion auditable. Use the readability-first dense-list shape from the Developer-facing output contract, not compact wrapped paragraphs. Each candidate should have a blank line before the next candidate and labeled blocks for `Why high-leverage:` and `Touches:`:
|
|
425
|
+
|
|
426
|
+
```text
|
|
427
|
+
Based on this workspace's state, here are {N} candidates ranked by leverage:
|
|
428
|
+
|
|
429
|
+
1. {candidate.title}
|
|
430
|
+
|
|
431
|
+
{candidate.summary}
|
|
432
|
+
|
|
433
|
+
Why high-leverage:
|
|
434
|
+
{candidate.rationale — cite the specific RB, deferral, prior decision, shipped PR, or file-level signal.}
|
|
435
|
+
|
|
436
|
+
Touches:
|
|
437
|
+
{referencesPriorWork — list exploration names/ids, PRs, RB ids, or deferrals. Wrap if long.}
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
2. {candidate.title}
|
|
441
|
+
|
|
442
|
+
{candidate.summary}
|
|
443
|
+
|
|
444
|
+
Why high-leverage:
|
|
445
|
+
{candidate.rationale}
|
|
446
|
+
|
|
447
|
+
Touches:
|
|
448
|
+
{referencesPriorWork}
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
Reply with a number to lock that scope, `suggest` to regenerate candidates, or describe a different problem to start fresh.
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
If one candidate would resume an existing in-flight exploration rather than create a duplicate, add a short note after the picker:
|
|
455
|
+
|
|
456
|
+
```text
|
|
457
|
+
Note on #{N}:
|
|
458
|
+
There's already an in-flight exploration for {RB/problem}. If you pick it, route into
|
|
459
|
+
`/ritual resume` on that exploration rather than creating a duplicate.
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
e. **[LITE AUTO — no pause; auto-pick the recommended default]** — wait for the pick.
|
|
463
|
+
|
|
464
|
+
f. **If the user picks one (1-N):**
|
|
465
|
+
- Set the chosen candidate's `summary` as the `raw_input` for the rest of the flow.
|
|
466
|
+
- **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.
|
|
467
|
+
- Continue to Step 2 (template selection).
|
|
468
|
+
|
|
469
|
+
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).
|
|
470
|
+
|
|
471
|
+
h. **If `suggestions` came back empty** (LLM produced nothing or workspace was too sparse): tell the user "I couldn't find anything to suggest — let's start with something you describe" and continue to Step 2.
|
|
472
|
+
|
|
473
|
+
7. **If there are zero existing explorations** in the workspace:
|
|
474
|
+
|
|
475
|
+
- If `raw_input` is present: skip the user pause entirely. Say one line ("No existing explorations in this workspace — starting fresh.") and move to Step 2.
|
|
476
|
+
- If `raw_input = null`: pause and ask what they want to build/explore before moving to Step 2. Use the no-arg copy from Step 1.1.
|
|
477
|
+
|
|
478
|
+
Don't run the suggester from an empty workspace — there's no priors signal yet, and the user opening Ritual for the first time has stronger user-driven intent than the suggester could offer.
|
|
479
|
+
|
|
480
|
+
8. **Before the user commits to "start fresh"** — if they DID say "start fresh" AND the workspace has existing explorations to compare against — run a **semantic overlap check** against the workspace. This catches the case where what the user is describing is a near-duplicate of something that already exists, BEFORE they burn LLM cost on Steps 4-5:
|
|
481
|
+
|
|
482
|
+
**Skip this overlap check entirely when the workspace has zero explorations.** Two signals count as proof the workspace is empty: (a) you just created the workspace in Step 1 (in-session creation), or (b) `list_workspaces._count.explorations === 0` for the bound workspace (server-side count from the Step 1 call). With zero existing explorations, there's literally nothing to overlap with — the call would return `candidates: []` after a wasted MCP roundtrip + LLM cost + (in interactive permission modes) a needless user approval prompt. This was an oversight in cli 0.9.3's empty-workspace skip path: the top of Step 1.5 correctly said "proceed straight to Step 2", but this step 8 instruction still ran the overlap check when there was nothing to overlap with. Fixed in cli 0.9.5.
|
|
483
|
+
|
|
484
|
+
Call `mcp__ritual__check_exploration_overlap(workspace_id, raw_input)`. Pass the user's full natural-language description of what they want to explore as `raw_input` — the SAME text you'd later pass to `generate_considerations`.
|
|
485
|
+
|
|
486
|
+
The response:
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
{
|
|
490
|
+
candidates: [{
|
|
491
|
+
explorationId, name, problemStatement,
|
|
492
|
+
jaccardScore, llmConfidence, llmRationale
|
|
493
|
+
}],
|
|
494
|
+
totalCandidatesScanned: number
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
- **If `candidates.length === 0`**: silently proceed to Step 2. Don't mention the overlap check happened. The whole point of the two-tier filter is silence in the common case.
|
|
499
|
+
|
|
500
|
+
- **If `candidates.length > 0`**: surface a callout BEFORE moving to Step 2:
|
|
501
|
+
|
|
502
|
+
> ⚠ **What you're describing may overlap with existing explorations in this workspace:**
|
|
503
|
+
>
|
|
504
|
+
> {for each candidate (in order, strongest first):}
|
|
505
|
+
> **{candidate.name}** *(LLM confidence: {Math.round(candidate.llmConfidence * 100)}%)*
|
|
506
|
+
> - *"{candidate.problemStatement first 120 chars, no ellipsis padding}..."*
|
|
507
|
+
> - Why I think it overlaps: {candidate.llmRationale}
|
|
508
|
+
> - URL: `https://app.ritualapp.cloud/e/{candidate.explorationId}`
|
|
509
|
+
> {endfor}
|
|
510
|
+
>
|
|
511
|
+
> **Choose:**
|
|
512
|
+
> 1. **Resume one of these instead** — give me the number, I'll jump to the right step based on its state.
|
|
513
|
+
> 2. **Proceed anyway** — I'll create a new exploration. The relationship to these {N} won't be lost — when `related_exploration_ids` is supported it'll be captured automatically.
|
|
514
|
+
> 3. **Show me one in detail first** — give me the number, I'll fetch its full state before you decide.
|
|
515
|
+
|
|
516
|
+
- If the user picks (1): treat the chosen one as the resumed exploration (same as Step 1.5 step 5 above — jump to the right downstream step based on the state badge).
|
|
517
|
+
- If the user picks (2): continue to Step 2. Future PR will populate `related_exploration_ids` on the new exploration so the linkage is preserved.
|
|
518
|
+
- If the user picks (3): show the full exploration via `mcp__ritual__get_exploration` + `get_recommendations` if any exist, then loop back to the choose prompt.
|
|
519
|
+
|
|
520
|
+
**Calibration:** the threshold for surfacing is conservative — the agent is biased toward "miss not false-flag" (you'd rather silently skip a real overlap than noisily prompt the user when there isn't one). If you DO see this prompt, take it seriously — it's likely there's real overlap.
|
|
521
|
+
|
|
522
|
+
#### Step 2 — Template selection (server-side, silent)
|
|
523
|
+
|
|
524
|
+
> **Rewritten 2026-05-21 (CLI 0.9.0+).** Previously this section had three branches (persona-pinned / legacy-pinned / list-and-pick) that the SKILL had to navigate, and could optionally call `mcp__ritual__list_templates`. That tool is gone from the agent-facing MCP surface as of CLI 0.9.0. Template selection is now entirely server-side: when `create_exploration` is called without an explicit `template_id`, the server resolves the right SYSTEM template from `user.persona` (set by `ritual init` FTUE) → `workspace.defaultTemplateId` (team override) → system default, then forks it into a per-exploration Template atomically inside the same `create_exploration` request.
|
|
525
|
+
|
|
526
|
+
**For the agent: there is no template-selection step. Skip this Step entirely and go to Step 3.** Don't read `.ritual/config.json` for persona, don't try to call `list_templates` (it's not registered), don't render a "Using persona X" confirmation.
|
|
527
|
+
|
|
528
|
+
Why no user-visible confirmation: a "do you want to continue with your persona?" prompt without a real way to customize sections is theatre. If the user wants to change persona, they re-run `ritual init`. If they want to customize the template's section structure for one exploration, that's a separate not-yet-shipped capability (tracked on the FTUE backlog as "agent-side template customization via `template_schema` parameter on `create_exploration`"). Until that ships, no per-build confirmation has anything actionable to offer.
|
|
529
|
+
|
|
530
|
+
**What still happens inside `create_exploration`** (server-side, agent doesn't see it):
|
|
531
|
+
|
|
532
|
+
```
|
|
533
|
+
1. Resolve PARENT template from the chain:
|
|
534
|
+
explicit dto.templateId
|
|
535
|
+
→ workspace.defaultTemplateId
|
|
536
|
+
→ user.persona via schema.id-matching SYSTEM template
|
|
537
|
+
→ first SYSTEM template by createdAt
|
|
538
|
+
2. FORK the parent into a per-exploration Template row
|
|
539
|
+
(type='EXPLORATION', parentTemplateId set, schema copied)
|
|
540
|
+
3. CREATE the Exploration pointing at the forked template
|
|
541
|
+
4. Return { id, ... } to the agent
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
All atomic in one HTTP request. See `apps/api/src/modules/explorations/explorations.service.ts#create` for the exact code path.
|
|
545
|
+
|
|
546
|
+
**Role inference (still applicable):** the resolved template's primary ICP / role still drives recommendation tone, sibling exploration cap, and Step 8 run-mode default. The agent doesn't need to compute or display role — server-side resolution does the right thing per the persona's mapped ICP (e.g., `frontend-web` → ENGINEER → engineering-flavored recs). Only surface role when the user explicitly asks how the flow is being biased:
|
|
547
|
+
|
|
548
|
+
> Using **{role}** defaults. Override with `role: product` if needed.
|
|
549
|
+
|
|
550
|
+
Recognized roles (use the role keyword the API returns, not a paraphrase): `engineering`, `product`, `design`, `marketing`, `delivery`, `operations`.
|
|
551
|
+
|
|
552
|
+
If the user corrects the role mid-flow ("actually I'm building a PRD"), update internal role tracking. **Do not** re-pick the template — that requires re-creating the exploration, which is bigger than a mid-flow correction warrants. If the user genuinely wants a different template for this exploration, ask them to start over: `/ritual build` again, or `ritual init --persona <slug>` to change their default first.
|
|
553
|
+
|
|
554
|
+
Proceed to Step 3.
|
|
555
|
+
|
|
556
|
+
#### Step 3 — Code reconnaissance
|
|
557
|
+
|
|
558
|
+
**Skip only if the user explicitly asks ("just generate, don't read the code") OR if you're operating outside a codebase context.**
|
|
559
|
+
|
|
560
|
+
Before generating considerations, gather codebase context so the sub-problems land specific to *this* code, not generic. The goal is not to show the user every fact you found; the goal is to ground downstream MCP calls and expose only decision-relevant findings in the CLI.
|
|
561
|
+
|
|
562
|
+
**Capability Boundary Check (load-bearing):** If recon detects a mismatch between the user's ask and what THIS repo can actually implement — typically because the feature spans systems (backend service, mobile app, billing provider, email worker, schema migrations) that aren't present in the current checkout — DO NOT invent the missing systems and DO NOT continue as if the repo is complete. Run the boundary-check pause described in § 3.2 below before proceeding to scope. Frame the missing half as a normal architecture boundary, not a failure: *"This repo looks like the frontend side of a larger feature,"* not *"I could not find backend dependencies."* The user has not done anything wrong; the agent is asking how to scope the work.
|
|
563
|
+
|
|
564
|
+
Common boundary mismatches to detect:
|
|
565
|
+
|
|
566
|
+
- Full-stack feature ask + frontend-only repo (UI present, no API/service code)
|
|
567
|
+
- Mobile feature ask + no API client contract or backend
|
|
568
|
+
- Billing/payments feature + no payment service / subscription code
|
|
569
|
+
- Email/notification feature + no worker / job / email-provider integration
|
|
570
|
+
- Auth/session feature + no user mutation / session backend
|
|
571
|
+
- Data/analytics feature + no schema, migration, or storage layer
|
|
572
|
+
|
|
573
|
+
##### 3.0 — Check for a pre-build context seed
|
|
574
|
+
|
|
575
|
+
Before doing fresh recon, check whether the user already seeded one via `/ritual context-pulse`. Glob for `CONTEXT-*.md` at the repo root.
|
|
576
|
+
|
|
577
|
+
If a `CONTEXT-<slug>.md` is found AND its `## The ask` section close-matches the current `raw_input`:
|
|
578
|
+
|
|
579
|
+
- **Use it to seed `codebase_context_packet`.** Parse the file's `## Candidate files` list — those become the seed for `sources[]`. Parse `## Prior KG context` as evidence inside the packet, not as final prioritization.
|
|
580
|
+
- **Skip fresh recon** unless the seed is stale or obviously incomplete. If you skip fresh recon, still normalize the seed into the packet structure below before calling MCP tools.
|
|
581
|
+
- **Surface a compact note**:
|
|
582
|
+
> Code recon
|
|
583
|
+
> Found `CONTEXT-<slug>.md` from `/ritual context-pulse`.
|
|
584
|
+
> Using {N} candidate files + {M} related prior exploration{s} as the recon base. Override with `recon: refresh`.
|
|
585
|
+
- Proceed directly to 3.2.
|
|
586
|
+
|
|
587
|
+
If no seed file is found, OR the seed's `## The ask` doesn't match the current `raw_input`, do fresh recon. For mismatch, mention the ignored seed in one line and do not delete it.
|
|
588
|
+
|
|
589
|
+
##### 3.1 — Fresh recon
|
|
590
|
+
|
|
591
|
+
1. **Read the README + top-level project structure.** Use `ls` / Glob to see top-level files. Identify the language, framework, key directories, and likely entry points.
|
|
592
|
+
|
|
593
|
+
2. **Glob for relevance.** Derive patterns from the user's problem. Examples:
|
|
594
|
+
- User says "auth flow" → `**/auth/**`, `**/login*`, `**/user*`, `**/session*`
|
|
595
|
+
- User says "checkout" → `**/checkout/**`, `**/cart/**`, `**/order/**`, `**/payment*`
|
|
596
|
+
- User says "notifications" → `**/notif*`, `**/email/**`, `**/sms/**`, `**/push/**`
|
|
597
|
+
Cap at ~15 hits per pattern.
|
|
598
|
+
|
|
599
|
+
3. **Skim 3–5 most-relevant files.** For each, read the first ~100 lines + scan for class/function names. Triangulate whether the behavior lives there or calls into another area.
|
|
600
|
+
|
|
601
|
+
4. **Build three recon artifacts.**
|
|
602
|
+
|
|
603
|
+
A. `raw_recon_notes` — internal evidence only
|
|
604
|
+
- files read and why they were selected
|
|
605
|
+
- symbols/classes/functions inspected
|
|
606
|
+
- relevant comments, schema details, tests, migrations, and config
|
|
607
|
+
- KG hits, prior deferrals, and prior implementation references
|
|
608
|
+
- uncertain observations, false leads, and things not found
|
|
609
|
+
- do **not** show this by default and do **not** pass it as the main MCP planning input
|
|
610
|
+
|
|
611
|
+
B. `codebase_context_packet` — downstream planning input
|
|
612
|
+
- this is the synthesized artifact passed into `raw_input`, context pulses, and any MCP field named `recon_context`
|
|
613
|
+
- it helps MCP understand what the coding agent observed locally without deciding the final considerations itself
|
|
614
|
+
- separate factual observations from agent hypotheses
|
|
615
|
+
- include confidence levels for hypotheses
|
|
616
|
+
- use neutral labels like `agent_observed_scope_pressure` or `candidate_scope_pressure`, not `priority_considerations`
|
|
617
|
+
- never present the packet as authoritative; MCP/tooling decides final sub-problems, recommendations, and scope
|
|
618
|
+
|
|
619
|
+
C. `recon_digest` — user-visible, compact
|
|
620
|
+
- 3–6 bullets max
|
|
621
|
+
- key surfaces, hard constraints, scope corrections, and next action
|
|
622
|
+
- avoid quoting code comments unless they are load-bearing
|
|
623
|
+
- avoid listing every file read
|
|
624
|
+
|
|
625
|
+
`codebase_context_packet` structure:
|
|
626
|
+
|
|
627
|
+
```markdown
|
|
628
|
+
--- Codebase context packet ---
|
|
629
|
+
|
|
630
|
+
## User intent
|
|
631
|
+
{verbatim or lightly normalized ask}
|
|
632
|
+
|
|
633
|
+
## Observed relevant surfaces
|
|
634
|
+
- `path` — observed role in this feature or constraint
|
|
635
|
+
- `path` — observed extension point, lifecycle, model, or integration seam
|
|
636
|
+
|
|
637
|
+
## Evidence
|
|
638
|
+
- `path:symbol` — factual observation from code
|
|
639
|
+
- Prior Ritual signal: {exploration / PR / RB / deferral}, if available
|
|
640
|
+
- Missing or not-found evidence when it corrects the user's framing
|
|
641
|
+
|
|
642
|
+
## Agent hypotheses
|
|
643
|
+
- This may make {candidate area} important because {evidence-backed reason}
|
|
644
|
+
Confidence: low / medium / high
|
|
645
|
+
|
|
646
|
+
## Agent-observed scope pressure
|
|
647
|
+
- Privacy / lifecycle / migration / compatibility / async / ownership / testing risk
|
|
648
|
+
- Only include pressure that intersects with the feature intent and code evidence
|
|
649
|
+
|
|
650
|
+
## Scope corrections
|
|
651
|
+
- The ask says X, but the code suggests Y
|
|
652
|
+
- Missing fields, renamed concepts, or assumptions the code contradicts
|
|
653
|
+
|
|
654
|
+
## Open questions for discovery
|
|
655
|
+
- Questions the code cannot answer and the user/Ritual exploration should resolve
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
Example `codebase_context_packet` excerpt:
|
|
659
|
+
|
|
660
|
+
```markdown
|
|
661
|
+
## Observed relevant surfaces
|
|
662
|
+
- `apps/conversions/abstract_models.py` — append-only conversion event model; lifecycle changes are modeled as follow-up rows.
|
|
663
|
+
- `apps/conversions/outbox.py` — async publish/retry surface; payload shape may affect erasure semantics.
|
|
664
|
+
- `apps/order/models.py` — raw guest email appears to live on the order side, not in conversion events.
|
|
665
|
+
|
|
666
|
+
## Agent hypotheses
|
|
667
|
+
- Erasure semantics may need to cover both mutable raw PII and append-only pseudonymous digests.
|
|
668
|
+
Confidence: high; supported by model fields and schema comments.
|
|
669
|
+
- Outbox purge/replay behavior may be a scope pressure because retries can outlive the original conversion write.
|
|
670
|
+
Confidence: medium; verify worker idempotency before scoping implementation.
|
|
671
|
+
|
|
672
|
+
## Scope corrections
|
|
673
|
+
- No `guest_session_id` column was found in the inspected conversion models; scope may need to use the actual guest attribution identifiers.
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
Example `recon_digest` — single-path case (low ambiguity):
|
|
677
|
+
|
|
678
|
+
```text
|
|
679
|
+
Code recon
|
|
680
|
+
|
|
681
|
+
Repo signals:
|
|
682
|
+
- `apps/conversions/abstract_models.py` — append-only conversion events.
|
|
683
|
+
- `apps/conversions/outbox.py` — async publish/retry lifecycle.
|
|
684
|
+
- `apps/order/models.py` — raw guest email surface.
|
|
685
|
+
|
|
686
|
+
Constraint:
|
|
687
|
+
- Erasure likely needs to handle mutable raw PII separately from pseudonymous conversion digests.
|
|
688
|
+
|
|
689
|
+
Scope correction:
|
|
690
|
+
- I did not find `guest_session_id` in the inspected models.
|
|
691
|
+
|
|
692
|
+
Pulse: Reasoning Readiness ~55% · Context Debt 45% (initial ask + code recon)
|
|
693
|
+
|
|
694
|
+
Next: attach PRDs/tickets if they should shape scope, or `proceed` to continue.
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Example `recon_digest` — ambiguity case (multiple plausible interpretations):
|
|
698
|
+
|
|
699
|
+
When recon surfaces two materially different product/implementation paths for the same ask, name them both, **mark one as recommended with a one-line reason**, and pause with a concrete reply syntax. Do not expose raw tier labels (use the translations from `references/cli-output-contract.md`).
|
|
700
|
+
|
|
701
|
+
```text
|
|
702
|
+
Code recon
|
|
703
|
+
|
|
704
|
+
Repo signals:
|
|
705
|
+
- `GatewayForm` already supports "create account before checkout," but
|
|
706
|
+
redirects away from checkout to `customer:register`. There is no inline
|
|
707
|
+
or post-order account path today.
|
|
708
|
+
- Guest checkout is already wired through order placement:
|
|
709
|
+
`CheckoutSessionData.set_guest_email()`, `AbstractOrder.guest_email`, and
|
|
710
|
+
`build_submission()` preserve guest identity.
|
|
711
|
+
- `RegisterUserMixin` is the reusable account-creation surface:
|
|
712
|
+
user creation, `user_registered`, login, and registration email.
|
|
713
|
+
- `OrderPlacementMixin` and `post_checkout` are the clean hooks for
|
|
714
|
+
creating or claiming an account at order placement.
|
|
715
|
+
|
|
716
|
+
Constraint:
|
|
717
|
+
- Oscar's dynamic class loading via `get_class()` is the extension
|
|
718
|
+
pattern here. Implement with subclass-overridable views/mixins, not
|
|
719
|
+
monkey-patches.
|
|
720
|
+
|
|
721
|
+
Ambiguity to resolve:
|
|
722
|
+
"Join while booking" maps to two plausible features.
|
|
723
|
+
|
|
724
|
+
1. Inline registration at checkout
|
|
725
|
+
Let new customers register on the checkout page itself instead of
|
|
726
|
+
being redirected to `/accounts/register/`.
|
|
727
|
+
|
|
728
|
+
2. Post-order account creation — recommended
|
|
729
|
+
Let guests place the order as today, then claim the order by
|
|
730
|
+
setting a password on the thank-you page. Preserves guest checkout
|
|
731
|
+
and fits Oscar's `OrderPlacementMixin` / `post_checkout` hooks.
|
|
732
|
+
|
|
733
|
+
Pulse: Reasoning Readiness ~35% · Context Debt 65% (scope not locked yet)
|
|
734
|
+
|
|
735
|
+
Next: reply `2` for the recommended post-order path, `1` for inline
|
|
736
|
+
registration, or describe a different intent. Reply `pause` to stop here.
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
Notes on the ambiguity-case shape:
|
|
740
|
+
- **"Repo signals"** (not "Found" or "Key surfaces") signals these are the evidence behind the recommendation.
|
|
741
|
+
- **Recommendation goes after the option name on the SAME line**, with a single concise reason on the line below. This keeps the options scannable in a decision moment.
|
|
742
|
+
- **`Next:` is a single line** ending in a concrete reply syntax (`reply N`), not an open-ended question. Lead with the recommended default; the escape hatch comes last.
|
|
743
|
+
- **The pulse line uses the user-facing label**, never the raw tier identifier.
|
|
744
|
+
|
|
745
|
+
Example `recon_digest` — Capability Boundary Check (feature spans systems not in this repo):
|
|
746
|
+
|
|
747
|
+
When the user's ask requires capabilities that aren't present in this repo (frontend-only repo asked for full-stack feature, mobile repo with no API contract, etc.), surface the boundary as a normal architecture fact and name the three scoping options as **informational** context. **Do not pause on this.** The boundary information is folded into the `codebase_context_packet` so the downstream `generate_considerations` call produces boundary-aware sub-problems against the repo's actual capability surface. The user's first real gate is the problem statement in Step 5 — they can reshape scope there if the default narrowing was wrong. NEVER continue as if the repo can implement the missing half; NEVER invent the missing systems.
|
|
748
|
+
|
|
749
|
+
```text
|
|
750
|
+
Code recon
|
|
751
|
+
|
|
752
|
+
Action needed
|
|
753
|
+
|
|
754
|
+
This feature likely spans another repo or service.
|
|
755
|
+
Add the backend/API context, or choose a narrower scope.
|
|
756
|
+
|
|
757
|
+
Repo boundary:
|
|
758
|
+
- This repo contains the checkout UI and guest checkout flow.
|
|
759
|
+
- I found no backend account-creation endpoint, user/order linking
|
|
760
|
+
mutation, email job, or migration layer.
|
|
761
|
+
- So the full "join while booking" feature likely spans this repo plus
|
|
762
|
+
an API/backend service.
|
|
763
|
+
|
|
764
|
+
Can build here:
|
|
765
|
+
- Checkout/thank-you page UI
|
|
766
|
+
- Password capture or account-claim form
|
|
767
|
+
- API client integration point
|
|
768
|
+
- Mocked frontend tests
|
|
769
|
+
- Empty/error/success states
|
|
770
|
+
|
|
771
|
+
Needs outside context:
|
|
772
|
+
- Endpoint that creates or claims the account
|
|
773
|
+
- Contract for linking a guest order to a user
|
|
774
|
+
- Auth/session behavior after claim
|
|
775
|
+
- Email/verification behavior, if required
|
|
776
|
+
|
|
777
|
+
Scoping inferred: contract-first (default for unsettled API)
|
|
778
|
+
|
|
779
|
+
This repo can build: UI integration, API client surface, mocked tests
|
|
780
|
+
This repo cannot build: account-creation endpoint, order-linking, email job
|
|
781
|
+
Considerations will be scoped to what this repo can ship.
|
|
782
|
+
|
|
783
|
+
Pulse: Reasoning Readiness ~30% · Context Debt 70% (repo boundary unresolved)
|
|
784
|
+
|
|
785
|
+
Continuing to problem statement. You can reshape scope there in plain
|
|
786
|
+
English (e.g. "frontend-only", "add the backend service contract",
|
|
787
|
+
or paste API docs to widen the recon).
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
Notes on the boundary-check shape:
|
|
791
|
+
- **No pause.** Surface the boundary as compact info inside the recon digest, then proceed to `generate_considerations`. The user's first gate is the problem statement (Step 5) where they can reshape scope in plain English. Pausing here was load-bearing in the old SKILL, but it gated FTUE users behind a 1/2/3 menu before they'd seen any product output. The boundary information is preserved — both in user-facing recon (the "Scoping inferred:" block) and in the `codebase_context_packet` that feeds downstream MCP calls.
|
|
792
|
+
- **"Scoping inferred:" not "How should I scope this?"** — the agent makes the default narrowing (contract-first when API unsettled; repo-side-only when the missing half is clearly out-of-tree) and names what it picked. The user corrects at Step 5 if it was wrong.
|
|
793
|
+
- **"This repo can build:" + "This repo cannot build:"** are paired one-liners — they document the IN/OUT split so the inferred scoping is auditable. Keep them compact (one line each); the full lists live in `codebase_context_packet`.
|
|
794
|
+
- **Default narrowing logic:** if the user's ask names a backend/API endpoint, choose **contract-first**. If the user's ask is clearly UI/UX-shaped or the missing systems are obviously out-of-tree (mobile app, separate billing service), choose **repo-side only**. If ambiguous, default to **contract-first** — it preserves more of the user's intent in the downstream artifacts than narrowing to repo-side does.
|
|
795
|
+
- **The pulse line stays parenthetical** with a user-facing reason (`repo boundary unresolved`), per the Pulse tier labels rule in `references/cli-output-contract.md`.
|
|
796
|
+
- **Internal classification (not user-facing):** track each candidate piece against the boundary as `in_repo_buildable`, `external_dependency_known`, `external_dependency_unknown`, `needs_additional_repo`, or `contract_first_candidate`. These shape how downstream scoring + build-brief generation handle the missing half. Stamp the inferred default scope as `inferred_scope` in the packet so `generate_considerations` / `generate_problem_statement` see it. None of these labels should appear in user-facing copy.
|
|
797
|
+
|
|
798
|
+
##### 3.2 — Surface the digest and continue
|
|
799
|
+
|
|
800
|
+
Surface only `recon_digest` by default. Do **not** dump `raw_recon_notes` or the full `codebase_context_packet` to the CLI unless the user asks for detail.
|
|
801
|
+
|
|
802
|
+
Pause only if:
|
|
803
|
+
- recon contradicts the user's stated scope,
|
|
804
|
+
- there are multiple plausible implementation areas and choosing wrong would waste work (use the ambiguity-case `recon_digest` shape above),
|
|
805
|
+
- a legal/product/business constraint is required before generation,
|
|
806
|
+
- the user explicitly asked to review recon before continuing.
|
|
807
|
+
|
|
808
|
+
**Capability boundary detection does NOT pause.** When recon shows the feature spans systems not in this repo, render the Capability Boundary Check digest from § 3.1 (it's informational), pick the default scope per the "Default narrowing logic" rule, and proceed to Step 3.5. The user reshapes scope at Step 5 (problem-statement gate) if the default narrowing was wrong.
|
|
809
|
+
|
|
810
|
+
If no pause is needed, proceed to Step 3.5. The user still has a cheap escape hatch: `recon: detail`, `recon: refresh`, or a correction in plain English.
|
|
811
|
+
|
|
812
|
+
**Pulse (Step 3 done):** Emit a pulse line — repo grounding just moved meaningfully (sources collected, agent inspected files, possibly KG hits). Compute per `/ritual context-pulse` § Step CP3 and render compact unless this is the FIRST pulse of the build flow, in which case use full.
|
|
813
|
+
|
|
814
|
+
##### 3.3 — Compose augmented `raw_input`
|
|
815
|
+
|
|
816
|
+
Compose the augmented `raw_input` for Step 4 from:
|
|
817
|
+
- the user's original problem (verbatim, top)
|
|
818
|
+
- the full `codebase_context_packet`, under `--- Codebase context packet ---`
|
|
819
|
+
- any user correction or added constraint from code recon
|
|
820
|
+
|
|
821
|
+
Do not pass unsynthesized `raw_recon_notes` as the primary planning input. Step 3 is the difference between generic considerations and considerations grounded in actual code, patterns, risks, and open questions. Keep `raw_recon_notes` internally for auditability; pass the packet downstream for planning.
|
|
822
|
+
|
|
823
|
+
##### 3.4 — Collect the `sources` array
|
|
824
|
+
|
|
825
|
+
Collect the file paths you actually read and consider load-bearing for this problem — exactly as they appear in the repo (e.g. `"apps/checkout/views.py"`, not `"./apps/checkout/views.py"` or absolute paths). This list is passed alongside `raw_input` to `generate_considerations`, `generate_problem_statement`, `query_knowledge_graph`, context pulses, and `generate_build_brief` so the API can anchor priorContext consistently.
|
|
826
|
+
|
|
827
|
+
Keep the list focused. 5–10 is the sweet spot; >20 dilutes the KG signal.
|
|
828
|
+
|
|
829
|
+
#### Step 3.5 — Stage knowledge sources (PRDs / tickets / transcripts / etc.)
|
|
830
|
+
|
|
831
|
+
The codebase recon you just did handles the *code* grounding. Most real features ALSO have non-code context — PRDs, Jira/Linear tickets, design specs, meeting transcripts, Slack threads, customer-research notes — that get paraphrased into the problem statement and lose detail. Step 3.5 ingests those as first-class **knowledge sources** attached to the exploration BEFORE generating sub-problems, so the priorContext you'll see in Step 4 (`generate_considerations`) and downstream is grounded in what the user actually brought, not the paraphrase.
|
|
832
|
+
|
|
833
|
+
##### 3.5.1 — Prompt the user only when useful
|
|
834
|
+
|
|
835
|
+
Knowledge sources are a feature multiplier, not a mandatory gate. Ask for PRDs/tickets/designs/transcripts only when at least one of these is true:
|
|
836
|
+
|
|
837
|
+
- the ask is ambiguous or cross-functional,
|
|
838
|
+
- context-pulse / Reference Grounding is low,
|
|
839
|
+
- the user mentioned a PRD, ticket, design, chat, customer request, or meeting,
|
|
840
|
+
- the feature has legal, privacy, billing, permissions, enterprise, analytics, migration, or compliance constraints,
|
|
841
|
+
- code recon found implementation surfaces but not product intent.
|
|
842
|
+
|
|
843
|
+
When triggered, frame references as an optional booster, not a mandatory phase. The happy path is to continue. Keep the prompt tight — the user's decision here is simply "attach context or continue":
|
|
844
|
+
|
|
845
|
+
```text
|
|
846
|
+
Optional: add non-code context before scope generation.
|
|
847
|
+
|
|
848
|
+
Because this touches {constraint}, PRDs, tickets, designs, incidents, or
|
|
849
|
+
customer requests may change what we prioritize.
|
|
850
|
+
|
|
851
|
+
Reply `go` to continue with code context only.
|
|
852
|
+
Or paste files/text/URLs to attach context first.
|
|
853
|
+
Reply `pause` to stop here.
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
Accept (alias) `go`, `g`, `generate`, `continue`, `skip`, `next`, or `none` as proceed. Per `references/cli-output-contract.md` § Surface-aware continuation prompts, do NOT treat empty input as proceed inside agent chat — chat surfaces can't reliably observe an empty message. Wait only if the user provides refs, asks a question, or types `pause` / `stop`.
|
|
857
|
+
|
|
858
|
+
Process language like *"Next: we'll generate a list of suggested problems to pick from"* used to live here — removed because the decision at this moment is "attach context or continue," not a preview of what comes next. The follow-up step's framing belongs in the follow-up step, not stacked on this prompt.
|
|
859
|
+
|
|
860
|
+
If none of the triggers apply, do **not** block. Print a non-blocking line and proceed:
|
|
861
|
+
|
|
862
|
+
> Proceeding with codebase context only. Paste a PRD/ticket anytime before discovery if it should shape the scope.
|
|
863
|
+
|
|
864
|
+
##### 3.5.2 — Read the content
|
|
865
|
+
|
|
866
|
+
For each item the user provided, use the agent's local tools to obtain the text content. Different routes by what the user supplied:
|
|
867
|
+
|
|
868
|
+
| What the user provided | What to do |
|
|
869
|
+
|---|---|
|
|
870
|
+
| Local file path (PDF, markdown, txt, png, pptx, docx) | `Read` the file. For binary files (PDF/image/pptx) the agent's Read tool returns extracted text or visual description; for text files just read the bytes. |
|
|
871
|
+
| URL (Confluence / Notion / Jira / Linear / public web) | `WebFetch` the URL to get the text content. |
|
|
872
|
+
| Pasted text | Use the pasted text directly. |
|
|
873
|
+
| Local directory | `Glob` for likely docs (`*.md`, `*.pdf`, `*.docx`), then Read each. Cap at 5 files unless user says otherwise. |
|
|
874
|
+
|
|
875
|
+
Detect each item's **`source_content_type`** from format + content cues:
|
|
876
|
+
|
|
877
|
+
- Filename + content shape: `prd.md` with "Problem statement" → `PRD`; `*.pdf` with "Slide 1" markers → could be `PRD` or `SPEC` depending on body; user research notes with multiple speakers + timestamps → `TRANSCRIPT`.
|
|
878
|
+
- URL host: `*.atlassian.net` / `linear.app` / GitHub issue URL → `TICKET`; generic blog/docs URL → `URL`; Slack/Discord export → `CHAT`.
|
|
879
|
+
- Content signal: presence of `endpoints` / `paths:` / `openapi:` → `SPEC`; image binary → `IMAGE`; multi-speaker + timestamps → `TRANSCRIPT`.
|
|
880
|
+
- If ambiguous: prefer the broader category (`DOC` over `OTHER`; ask user when in doubt for high-leverage items).
|
|
881
|
+
|
|
882
|
+
##### 3.5.3 — Stage each source for registration after exploration creation
|
|
883
|
+
|
|
884
|
+
For each item, create a staged source record in working memory. Do **not** call `mcp__ritual__add_knowledge_source` yet because no `exploration_id` exists until exploration creation.
|
|
885
|
+
|
|
886
|
+
Staged record shape:
|
|
887
|
+
|
|
888
|
+
```json
|
|
889
|
+
{
|
|
890
|
+
"source_content_type": "PRD | TICKET | URL | CHAT | TRANSCRIPT | SPEC | DOC | IMAGE | OTHER",
|
|
891
|
+
"content": "<full text content the agent obtained>",
|
|
892
|
+
"title": "<explicit title | first H1 | filename | TYPE from date>",
|
|
893
|
+
"source_url": "<original URL if applicable>",
|
|
894
|
+
"source_path": "<original local path if applicable>",
|
|
895
|
+
"origin_feature": "DISCOVERY"
|
|
896
|
+
}
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
Surface only a staging summary:
|
|
900
|
+
|
|
901
|
+
> Staged **{title}** ({source_content_type}) for this exploration. I'll register it after the exploration is created; the content is already in my context for planning.
|
|
902
|
+
|
|
903
|
+
##### 3.5.4 — Update the augmented `raw_input` + score impact
|
|
904
|
+
|
|
905
|
+
The content the agent collected in Step 3.5.2 also gets folded into the augmented `raw_input` for Step 4's `generate_considerations` so the LLM sees the references inline:
|
|
906
|
+
|
|
907
|
+
```
|
|
908
|
+
{original user problem}
|
|
909
|
+
|
|
910
|
+
--- Codebase context ---
|
|
911
|
+
{codebase_context_packet from Step 3}
|
|
912
|
+
|
|
913
|
+
--- Reference context (provided by user) ---
|
|
914
|
+
[PRD — billing-export.md]
|
|
915
|
+
{first ~2000 chars of content, marked with type + title}
|
|
916
|
+
|
|
917
|
+
[TRANSCRIPT — billing planning sync 2026-05-09]
|
|
918
|
+
{...}
|
|
919
|
+
|
|
920
|
+
[TICKET — LINEAR-1234]
|
|
921
|
+
{...}
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
Cap the inline reference context at ~10000 chars total (priority: PRD/SPEC > TRANSCRIPT/TICKET > CHAT/DOC > URL > IMAGE). Longer refs stay accessible via `get_knowledge_source` after extraction completes, but for THIS build the inline summary keeps the LLM call bounded.
|
|
925
|
+
|
|
926
|
+
##### 3.5.5 — Pulse impact
|
|
927
|
+
|
|
928
|
+
Each registered knowledge source contributes to **Repo Grounding** (which, despite the name, covers BOTH code grounding from Step 3 AND reference grounding from Step 3.5 — the dimension will be split in MVP-2). For MVP-1 scoring (per `/ritual context-pulse` § CP3):
|
|
929
|
+
|
|
930
|
+
- Repo Grounding gets +5 points per registered knowledge source, capped at +15 total (so 3+ refs is the cap).
|
|
931
|
+
- Combined with code-recon signals already in the dimension, Repo Grounding stays in the 0-100 range.
|
|
932
|
+
- After Step 3.5 completes, fire the standard Step 3 pulse — the user will see Repo Grounding jump if they attached refs.
|
|
933
|
+
|
|
934
|
+
##### 3.5.6 — Skip path
|
|
935
|
+
|
|
936
|
+
If the user says "skip" / "none" / "later", proceed silently to Step 4. Do NOT pressure for more — refs are a feature multiplier, not a requirement.
|
|
937
|
+
|
|
938
|
+
The user can always come back later with `/ritual context-pulse <exploration>` to see the current Reference Grounding score, OR drag refs in mid-flow (e.g. at Step 8 if the agentic run surfaces a question that a PRD would have answered).
|
|
939
|
+
|
|
940
|
+
#### Step 3.9 — Classify the work item + pick the lead persona
|
|
941
|
+
|
|
942
|
+
Before generating sub-problems, settle **what job this is** and **whose lens leads it** — both shape
|
|
943
|
+
everything downstream, so they come first. **You** classify the job (you have the repo open — you're the
|
|
944
|
+
best-informed classifier, and doing it here saves a backend LLM call); the server returns the lenses.
|
|
945
|
+
|
|
946
|
+
1. **Classify the request** into ONE development work-item slug, using the user's raw ask + your code
|
|
947
|
+
recon:
|
|
948
|
+
|
|
949
|
+
```text
|
|
950
|
+
understand-codebase-area · design-technical-approach · create-implementation-plan ·
|
|
951
|
+
build-frontend-feature · build-backend-service · integrate-api · create-docs-site ·
|
|
952
|
+
refactor-code · debug-production-issue · improve-performance · add-tests · prepare-release
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
(Use `build-feature` only when the ask is a generic build that none of the specific jobs fit.) Pick the
|
|
956
|
+
single best match — e.g. "add OAuth to the dashboard" → `build-backend-service`; "the checkout page is
|
|
957
|
+
slow" → `improve-performance`; "clean up the payments module" → `refactor-code`.
|
|
958
|
+
|
|
959
|
+
2. **Call `mcp__ritual__work_item`** with that `jtbd` (and `entry_use_case` if known). It returns
|
|
960
|
+
`{ workItemLabel, deliverableTemplate, recommended, options: [{ persona, label, whenToChoose }] }` —
|
|
961
|
+
deterministic, no LLM, already biased by the user's `ritual init` persona.
|
|
962
|
+
|
|
963
|
+
3. **Present the work item + lens options** as a `(label + description)` bottom-drawer choice picker
|
|
964
|
+
(same shape as discovery picks, per `references/cli-output-contract.md`), recommended lens first and
|
|
965
|
+
marked:
|
|
966
|
+
|
|
967
|
+
```text
|
|
968
|
+
This looks like: Build backend service / API → Service Build Brief
|
|
969
|
+
Who's leading it? (recommended: Backend Developer)
|
|
970
|
+
|
|
971
|
+
1. Backend Developer — Best when you care about API contracts, data, transactions, scaling. ← recommended
|
|
972
|
+
2. Developer — Best when you care about feasibility, implementation correctness, shippability.
|
|
973
|
+
3. Eng Lead — Best when you care about technical approach, risk, sequencing, review.
|
|
974
|
+
|
|
975
|
+
Reply `use` to lead as Backend Developer, a number to switch, or name a lens.
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
4. **Default = the recommended lens.** An ambiguous reply (`use`/`ok`/`go`) accepts it. If the user says
|
|
979
|
+
the *work item* is wrong ("no, this is a refactor"), re-classify and call `work_item` again. If they
|
|
980
|
+
switch the *lens*, that's a change → run the change pre-flight (`references/change-preflight.md`) to
|
|
981
|
+
confirm before adopting it.
|
|
982
|
+
|
|
983
|
+
5. **Remember the chosen `persona` slug** — you pass it through to `create_exploration` as `lead_persona`
|
|
984
|
+
at Step 6. (It also carries into the generation prompts once persona-aware generation ships; for now
|
|
985
|
+
it's persisted + surfaced.)
|
|
986
|
+
|
|
987
|
+
Keep this light — one drawer, recommended pre-selected; most users accept. Don't belabour it.
|
|
988
|
+
|
|
989
|
+
#### Step 4 — Generate sub-problems
|
|
990
|
+
|
|
991
|
+
##### 4.1 First draft
|
|
992
|
+
|
|
993
|
+
Call `mcp__ritual__generate_considerations` with:
|
|
994
|
+
- `workspace_id`
|
|
995
|
+
- `raw_input` (the user's problem + the Step 3 `codebase_context_packet` + any reference context, concatenated as described above)
|
|
996
|
+
- `template_id` — **OPTIONAL.** Per Step 2 (server-side template resolution), the agent does NOT pick a template_id. Omit this field unless the user explicitly passed `--template-id` on the CLI; the server resolves the right template from `user.persona` → `workspace.defaultTemplateId` → system default and uses the same resolution chain `create_exploration` will use at Step 6. Passing it explicitly only matters when overriding the default.
|
|
997
|
+
- `sources` (the file path list from Step 3 step 7 — file-path strings only, e.g. `["apps/checkout/views.py", ...]`)
|
|
998
|
+
|
|
999
|
+
LLM call, ~5–10s. Returns 5–6 sub-problems — different framing axes the system should investigate. Track each one as `{ text, version: 1 }` in your working memory.
|
|
1000
|
+
|
|
1001
|
+
The coding agent's packet is context, not authority. Do not pre-rank or collapse the generated sub-problems based only on the agent hypotheses. Let MCP/template/KG output determine the candidate considerations; use the packet to make them specific, evidenced, and grounded.
|
|
1002
|
+
|
|
1003
|
+
**If the response includes `kg_context_used` with `implementationCount > 0`:** surface this to the user BEFORE presenting the considerations. It's the visible signal that prior shipped work shaped this draft.
|
|
1004
|
+
|
|
1005
|
+
> Reading the codebase I overlapped with 3 prior Ritual explorations on these files:
|
|
1006
|
+
> - **"Anonymous checkout opt-in"** (shipped 2026-04-12) · 1 open deferral
|
|
1007
|
+
> - **"Payment-method routing"** (shipped 2026-03-22)
|
|
1008
|
+
> - **"Session-data persistence"** (shipped 2026-02-08)
|
|
1009
|
+
>
|
|
1010
|
+
> I factored those into the sub-problems below.
|
|
1011
|
+
|
|
1012
|
+
(Drop the per-exploration decision count from this listing — recommendations + ship status are the user-facing signals, not decision counts. Keep `· N open deferral{s}` when `deferrals > 0` since open deferrals are scope-warning notes the user cares about. If `deferrals === 0`, just show `(shipped {date})` with no trailing segment.)
|
|
1013
|
+
|
|
1014
|
+
If `implementationCount === 0`: don't mention the KG check (silent — would just be noise on a cold KG).
|
|
1015
|
+
|
|
1016
|
+
**No pause — auto-accept all generated sub-problems** as `considerations[]` and proceed to Step 5. Render them as compact info so the user sees the framing the system will optimize for, but do NOT prompt for input:
|
|
1017
|
+
|
|
1018
|
+
```text
|
|
1019
|
+
Ritual build
|
|
1020
|
+
✓ Context ● Scope ○ Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1021
|
+
|
|
1022
|
+
Solving for these sub-problems
|
|
1023
|
+
|
|
1024
|
+
1. {Title}
|
|
1025
|
+
{Short explanation, wrapped for terminal width.}
|
|
1026
|
+
|
|
1027
|
+
2. {Title}
|
|
1028
|
+
{Short explanation, wrapped for terminal width.}
|
|
1029
|
+
|
|
1030
|
+
(Refine scope at the problem-frame step — say "drop {N}", "add {angle}",
|
|
1031
|
+
or "focus on {N},{M}" when you see the problem statement.)
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
Only the title line gets the number. Put a blank line between candidates. Do not show version labels like `(v1)` in CLI output. Do NOT include a "Reply with…" prompt or a `**[LITE AUTO — no pause; auto-pick the recommended default]**` here — the next user-facing gate is the problem statement (Step 5).
|
|
1035
|
+
|
|
1036
|
+
**Rationale for auto-accept:** sub-problem selection is a SCOPE-LOCKING decision, and per the SKILL's own rule "`all` is a legitimate declarative choice — often the right one when the agent has surfaced a tight 3-5 sub-problem set." Asking the user to pick before they've seen the problem frame is theater — the problem statement is the assembled artifact where scope is meaningfully visible, and the refine_problem_statement loop at Step 5 accepts arbitrary change prompts ("drop the observability angle", "make this contract-first") that round-trip through the same sub-problem refinement under the hood. Surfacing the sub-problems as info preserves visibility; dropping the pause preserves FTUE flow.
|
|
1037
|
+
|
|
1038
|
+
##### 4.2 Sub-problem refinement (only when user explicitly asks)
|
|
1039
|
+
|
|
1040
|
+
The user may, at the Step 5 problem-statement gate, say something like "rethink the sub-problems" or "the framing is off — show me other angles." When that happens, call `mcp__ritual__refine_considerations` and re-render the sub-problem set + a fresh problem statement. In the default flow this path is unreachable; it exists for the explicit "rethink scope" escape hatch.
|
|
1041
|
+
|
|
1042
|
+
**Pre-flight (mandatory):** before calling `refine_considerations`, run the change pre-flight in `references/change-preflight.md` — restate the change in the user's terms, show the exact `change_prompt` you're about to send, and wait for `yes`. This is a hard pause (even in auto-mode) and fires on every such request, including one-word ones. Do not call the tool until the user confirms.
|
|
1043
|
+
|
|
1044
|
+
Call `mcp__ritual__refine_considerations` with:
|
|
1045
|
+
- `workspace_id`, `raw_input`, `sources` — unchanged from the generate call. Critical: pass the SAME `sources` array each iteration so the KG-injected priorContext stays consistent.
|
|
1046
|
+
- `template_id` — same rule as Step 4: omit unless the user explicitly overrode it. If you passed `template_id` to the original `generate_considerations` call, pass the same value here for symmetry; otherwise leave it off and let server-side resolution stay consistent across iterations.
|
|
1047
|
+
- `change_prompt`: the user's request verbatim
|
|
1048
|
+
- `selected`: items from prior versions the user kept (track `{ text, from_version }`, send just `text`)
|
|
1049
|
+
- `dismissed`: items the user explicitly rejected
|
|
1050
|
+
- `session_id`: omitted on the first refinement; pass the `session_id` from the previous refine response on subsequent ones to chain context
|
|
1051
|
+
|
|
1052
|
+
Track the new items as `{ text, version: N+1 }`. After the refinement, regenerate the problem statement and present it. The user's next pause is again the problem-statement gate.
|
|
1053
|
+
|
|
1054
|
+
**Critical**: never re-call `generate_considerations` for a refinement. That endpoint is stateless and re-rolls a fresh seed; you'll lose what the user just told you. The whole point of `refine_*` is the LLM sees the iteration context.
|
|
1055
|
+
|
|
1056
|
+
Store the final sub-problems for Step 5 — they go into `considerations[]`.
|
|
1057
|
+
|
|
1058
|
+
#### Step 5 — Generate problem frame
|
|
1059
|
+
|
|
1060
|
+
##### 5.1 First draft
|
|
1061
|
+
|
|
1062
|
+
Call `mcp__ritual__generate_problem_statement` with:
|
|
1063
|
+
- `workspace_id`
|
|
1064
|
+
- `raw_input` (same augmented version from Step 4)
|
|
1065
|
+
- `considerations` (the picks from Step 4)
|
|
1066
|
+
- `template_id` — OPTIONAL, same rule as Step 4. Omit unless the user explicitly overrode; server resolution stays consistent across `generate_considerations` → `generate_problem_statement` → `create_exploration`.
|
|
1067
|
+
- `sources` (the same file-path list passed to generate_considerations — keeps the KG anchor consistent)
|
|
1068
|
+
|
|
1069
|
+
Returns a candidate problem statement plus optional follow-up questions and quality scores. For engineering / agentic-coding templates, translate the returned statement into a developer-oriented **problem frame** before showing it. Do not default to "How might we…" unless the selected template is product/design oriented or the user asks for HMW phrasing.
|
|
1070
|
+
|
|
1071
|
+
Engineering style:
|
|
1072
|
+
- `Problem frame: {verb/outcome} while preserving {constraints}.`
|
|
1073
|
+
- `Build/enable {capability} without {key failure modes}.`
|
|
1074
|
+
- `Scope: {implementation objective} across {surfaces}.`
|
|
1075
|
+
|
|
1076
|
+
Keep RB IDs, recommendation IDs, prior exploration IDs, and source links out of the main frame sentence. Put provenance underneath in `References:`.
|
|
1077
|
+
|
|
1078
|
+
If the response includes `kg_context_used` with `implementationCount > 0`, include that signal in the `References:` block rather than as a parenthetical in the frame.
|
|
1079
|
+
|
|
1080
|
+
**[LITE AUTO — no pause; auto-pick the recommended default]** Present like this:
|
|
1081
|
+
|
|
1082
|
+
```text
|
|
1083
|
+
Problem frame
|
|
1084
|
+
|
|
1085
|
+
{developer-oriented problem frame}
|
|
1086
|
+
|
|
1087
|
+
Optimize for:
|
|
1088
|
+
- {load-bearing constraint}
|
|
1089
|
+
- {load-bearing constraint}
|
|
1090
|
+
- {load-bearing constraint}
|
|
1091
|
+
|
|
1092
|
+
References:
|
|
1093
|
+
- {RB/decision/exploration label} — {one-line meaning}
|
|
1094
|
+
Source: {exploration title or id}{ optional ': https://app.ritualapp.cloud/e/{exploration_id}' if available}
|
|
1095
|
+
- {reference}
|
|
1096
|
+
|
|
1097
|
+
Reply `use` to use this frame and review discovery questions.
|
|
1098
|
+
Or reply with edits, e.g. `tighten`, `broaden`, `focus on outbox`, `drop dashboard`, or `pause`.
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
Rules:
|
|
1102
|
+
- Do not show the old versioned scope heading.
|
|
1103
|
+
- Do not show `Engineering problem:` as the heading; use `Problem frame`.
|
|
1104
|
+
- Do not say `ship it` unless the user used that language first.
|
|
1105
|
+
- Visible CTA is `use`. Accept `lock`, `l`, `go`, `continue`, or `next` as aliases for backwards-compat — do NOT display them. Per `references/cli-output-contract.md` § Surface-aware continuation prompts, do NOT treat empty input as proceed inside agent chat.
|
|
1106
|
+
- `lock` is demoted to alias only: "lock" sounded final/irrevocable for a frame that's very much iterable; `use` carries the right tone.
|
|
1107
|
+
|
|
1108
|
+
##### 5.2 Iteration loop
|
|
1109
|
+
|
|
1110
|
+
If the user asks for a refinement:
|
|
1111
|
+
|
|
1112
|
+
**Pre-flight (mandatory):** before calling `refine_problem_statement`, run the change pre-flight in `references/change-preflight.md` — restate the change in the user's terms, show the exact `change_prompt` you're about to send, and wait for `yes`. This is a hard pause (even in auto-mode) and fires on every refinement request, including a one-word `tighten`/`broaden`. Do not call the tool until the user confirms.
|
|
1113
|
+
|
|
1114
|
+
Call `mcp__ritual__refine_problem_statement` with:
|
|
1115
|
+
- `workspace_id`, `raw_input`, `considerations`, `sources` — unchanged. (Same `sources` as the original generate call — keeps the KG anchor stable.)
|
|
1116
|
+
- `template_id` — same rule as Step 4 / Step 5.1: omit unless the user explicitly overrode; if you passed it to the original `generate_problem_statement` call, pass the same value here for symmetry.
|
|
1117
|
+
- `previous_problem_statement`: the FULL TEXT of the current best draft
|
|
1118
|
+
- `change_prompt`: the user's request verbatim
|
|
1119
|
+
- `version`: optional telemetry only; do not show version labels to the user
|
|
1120
|
+
- `session_id`: omitted on the first refinement; chain on subsequent ones
|
|
1121
|
+
|
|
1122
|
+
The returned text becomes the new current draft. Show it using the same `Problem frame` format above, still without version labels.
|
|
1123
|
+
|
|
1124
|
+
**Critical**: each refinement's `previous_problem_statement` is the LATEST draft, not the original. Otherwise the LLM keeps refining the same starting point and the user can't compose multiple refinements.
|
|
1125
|
+
|
|
1126
|
+
When the user locks the frame, store the final text as `problem_statement` for Step 6.
|
|
1127
|
+
|
|
1128
|
+
**Pulse (Step 5 done):** Emit a pulse — feature clarity just jumped. Compute per `/ritual context-pulse` § Step CP3. Render full if this crosses Raw ask → Under-specified, else compact. Translate raw tier labels into user-facing copy per `references/cli-output-contract.md` § Pulse tier labels — never expose `RAW_ASK` / `UNDER_SPECIFIED` / etc. directly.
|
|
1129
|
+
|
|
1130
|
+
#### Step 6 — Create the exploration
|
|
1131
|
+
|
|
1132
|
+
Generate a short name (≤60 chars) from the scope — typically the noun phrase, not the full HMW. E.g. "Reduce T2 customer churn in Q3" → name `T2 churn reduction (Q3)`.
|
|
1133
|
+
|
|
1134
|
+
Create the exploration immediately once the frame is locked — the work item + lead persona were already settled at Step 3.9, so do not add a *further* confirmation here. If a name is ambiguous, **choose the shortest clear noun phrase and continue without pausing** — the name is editable later and shouldn't become a decision gate. Do NOT rely on "proceed on Enter" or empty input in agent chat (see `references/cli-output-contract.md` § Surface-aware continuation prompts).
|
|
1135
|
+
|
|
1136
|
+
User-visible before the call, if needed:
|
|
1137
|
+
|
|
1138
|
+
```text
|
|
1139
|
+
Creating exploration: **T2 churn reduction (Q3)**
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
Call `mcp__ritual__create_exploration` with:
|
|
1143
|
+
- `workspace_id`
|
|
1144
|
+
- `name`
|
|
1145
|
+
- `problem_statement` (the scope from Step 5)
|
|
1146
|
+
- `template_id` — **OPTIONAL.** Per Step 2, omit by default. The server resolves from `explicit dto.templateId → workspace.defaultTemplateId → user.persona → first SYSTEM template`, then forks the resolved template into a per-exploration Template row atomically inside this same `create_exploration` request. Pass `template_id` ONLY when the user explicitly overrides on the CLI (`/ritual build --template-id <id>`). If you passed `template_id` to Step 4's `generate_considerations`, pass the same value here so the LLM prompt context the considerations were generated under matches the exploration's stamped template. Do NOT read `.ritual/config.json` or invent a `template_id` from persona — the server does the resolution.
|
|
1147
|
+
- `agentic: false` — **do NOT** pass `agentic: true`. We want explicit per-step control so the user gets to pick discovery questions in Step 7. Auto-agentic skips that.
|
|
1148
|
+
- `jtbd` — **REQUIRED for `/ritual build`.** The work-item slug you classified at **Step 3.9** (e.g. `'build-backend-service'`, `'refactor-code'`, or `'build-feature'` for a generic build). Tags the exploration's job-to-be-done so the workflow surfaces the build-brief → code-plan → implement → PR deliverable phase across every surface (the Spark panel, etc.), not the generic produce-deliverable flow. Omit only if this is a non-build exploration (defaults to `produce-deliverable`).
|
|
1149
|
+
- `lead_persona` — the lens slug the user chose at **Step 3.9** (e.g. `'backend-developer'`). Pass the chosen `persona` from `work_item`. Omit only if Step 3.9 was skipped — the server then resolves the jtbd's canonical lens. Unknown slugs are ignored server-side.
|
|
1150
|
+
|
|
1151
|
+
Store `exploration_id`. Move the progress header from Scope to Discovery:
|
|
1152
|
+
|
|
1153
|
+
```text
|
|
1154
|
+
Ritual build
|
|
1155
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1156
|
+
|
|
1157
|
+
Exploration created. Track progress at https://app.ritualapp.cloud/e/{exploration_id}
|
|
1158
|
+
|
|
1159
|
+
Next: generate discovery questions to resolve the implementation trade-offs.
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
##### 6.1 — Promote the pre-build seed (if one was consumed in Step 3.0)
|
|
1163
|
+
|
|
1164
|
+
If Step 3.0 consumed a `CONTEXT-<slug>.md` seed file, promote it into the exploration's artifact trail now that an exploration id exists. Move + rename the file from `CONTEXT-<slug>.md` to `.ritual/exploration-notes/<exploration-id>.md` using the Bash tool:
|
|
1165
|
+
|
|
1166
|
+
```bash
|
|
1167
|
+
mkdir -p .ritual/exploration-notes
|
|
1168
|
+
git mv CONTEXT-<slug>.md .ritual/exploration-notes/<exploration-id>.md 2>/dev/null \
|
|
1169
|
+
|| mv CONTEXT-<slug>.md .ritual/exploration-notes/<exploration-id>.md
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
Surface to the user as a one-line note:
|
|
1173
|
+
|
|
1174
|
+
> Promoted `CONTEXT-<slug>.md` → `.ritual/exploration-notes/<exploration-id>.md` so it stays tied to this exploration.
|
|
1175
|
+
|
|
1176
|
+
This keeps the repo root clean (CLI Tenet #1 — files for reference, not clutter) and preserves the seed's content for future `/ritual lineage` or audit lookups. The file remains git-tracked at the new path.
|
|
1177
|
+
|
|
1178
|
+
If `git mv` fails (file wasn't tracked yet): use plain `mv` instead — same outcome, the user just commits the move whenever they next commit.
|
|
1179
|
+
|
|
1180
|
+
##### 6.2 — Register staged knowledge sources (load-bearing)
|
|
1181
|
+
|
|
1182
|
+
If Step 3.5 staged any knowledge sources in working memory (PRDs / tickets / transcripts / etc.), register them NOW that `exploration_id` exists. The staging step deliberately deferred the MCP call because `add_knowledge_source` requires an exploration to attach to — this is where the deferral resolves.
|
|
1183
|
+
|
|
1184
|
+
For each staged record from § 3.5.3, call `mcp__ritual__add_knowledge_source` with:
|
|
1185
|
+
|
|
1186
|
+
- `exploration_id` (from Step 6)
|
|
1187
|
+
- `source_content_type` (from the staged record)
|
|
1188
|
+
- `content` (the full text the agent obtained)
|
|
1189
|
+
- `title` (from the staged record)
|
|
1190
|
+
- `source_url` / `source_path` (whichever applies, optional)
|
|
1191
|
+
- `origin_feature: 'DISCOVERY'`
|
|
1192
|
+
|
|
1193
|
+
Fire these in parallel — they're independent inserts + async extraction kickoffs. Cap concurrency at 5 if the user staged more than that (rare).
|
|
1194
|
+
|
|
1195
|
+
Surface a single compact summary after all registrations resolve:
|
|
1196
|
+
|
|
1197
|
+
> Attached {N} knowledge source{s} to the exploration: {comma-separated titles, truncated to 80 chars total}. Extraction running in the background.
|
|
1198
|
+
|
|
1199
|
+
**Failure handling:** if any `add_knowledge_source` call fails (network / 4xx / 5xx), retry once. On a second failure, surface a one-line note and continue — do NOT block the build flow on a knowledge-source registration failure:
|
|
1200
|
+
|
|
1201
|
+
> ⚠ Couldn't register `{title}` ({error in 1 sentence}). The exploration is still usable; you can re-add the ref later with `/ritual context-pulse <exploration> --add-ref {path}`.
|
|
1202
|
+
|
|
1203
|
+
**Skip path:** if Step 3.5 was skipped (user said "skip" / "none" / "later"), there are no staged records and this step is a silent no-op. Do NOT prompt the user again — they already declined at Step 3.5.
|
|
1204
|
+
|
|
1205
|
+
**Why this lives at 6.2, not inside `create_exploration`:** sources are deliberately decoupled from the exploration row so a partial source-registration failure doesn't block exploration creation. Step 6 must always succeed if the underlying validation passes; Step 6.2 is best-effort on top.
|
|
1206
|
+
|
|
1207
|
+
#### Step 7 — Discovery questions
|
|
1208
|
+
|
|
1209
|
+
Longest phase because generation is async + the user picks per-Area. (Internally the API field is `matter_id`; user-facing copy always says Area.)
|
|
1210
|
+
|
|
1211
|
+
**Step 6 → Step 7 transition anti-pattern (load-bearing):** after `create_exploration` succeeds in Step 6, you MUST NOT render Step 8's *"Reply `run` to continue"* CTA. Required next actions, in order, before Step 8 is allowed:
|
|
1212
|
+
|
|
1213
|
+
1. Call `mcp__ritual__suggest_discovery_questions(exploration_id)` (Step 7.1) — no user input needed; just kick it off.
|
|
1214
|
+
2. Poll `mcp__ritual__get_discovery_state(exploration_id)` until `ready: true` (Step 7.2).
|
|
1215
|
+
3. Render the **Area rail + Area 1's questions together** and walk Area-by-Area per § 7.3.1 (the rail orients; a rail with NO questions under it — a bare index — is the failure mode).
|
|
1216
|
+
4. `**[LITE AUTO — no pause; auto-pick the recommended default]**` — the user picks questions across Areas (**floor: 6 to run; aim for 15–20; no cap**), or types `accept shortlist`.
|
|
1217
|
+
5. Commit all picked Areas in ONE `mcp__ritual__accept_discovery_questions_batch` call (Step 7.4) — never one parallel call per Area.
|
|
1218
|
+
6. Optionally capture anti-goals (Step 7.5), then proceed to Step 8 and render the *"Reply `run` to continue"* CTA.
|
|
1219
|
+
|
|
1220
|
+
**Picking is a deliberate step-through, not a bulk action (load-bearing):** the user going Area by Area and choosing the questions that matter IS the value of discovery — that per-question judgment shapes the whole downstream chain. So **nudge the user to step through and pick**; don't lead with bulk shortcuts.
|
|
1221
|
+
- **Nudge to step through.** Walk the user Area-by-Area (drop into Area 1, `next`/`prev`) and invite deliberate picks per Area, with `show more` to expand an Area. The framing is "which of these should we dig into?", not "want all of them?".
|
|
1222
|
+
- **Floor (HARD): at least 6 questions** across any Areas — below this, do NOT commit or proceed (tell them how many more to pick and keep them in the picker). There is NO "skip discovery" path — the agentic run needs a real question set to develop answers against. **Good coverage (SOFT): 15–20 questions** — nudge toward it on the Summary, but never block once ≥6. **No upper cap** — picking many (or all) is a legitimate explicit choice, never a default or fallback. (Uncovered scope is handled downstream when recommendations + requirements are generated and audited, so a thin set is the failure mode to prevent.)
|
|
1223
|
+
- **The default is the shortlist, never "all."** For a user who doesn't want to step through every Area, **`accept shortlist` (the 6–10 highest-leverage questions)** is the convenience default. An ambiguous reply (`proceed`, `go`, `ok`) at this gate means **accept the shortlist** — never silently accept everything.
|
|
1224
|
+
- **Taking all IS allowed — but only as an explicit user choice, never the default or a fallback.** If the user genuinely says "take all" / "all of them", honor it and commit them; that's a legitimate choice, not an error. Just never *offer* "I'll take all" as the default, and never auto-fall-back to it. (Worth mentioning once, not as a gate: every accepted question is answered individually in the agentic run, so accepting all of them across every Area means many more questions to answer and a much longer run — but it's the user's call.)
|
|
1225
|
+
|
|
1226
|
+
**Forbidden behaviors:**
|
|
1227
|
+
|
|
1228
|
+
- Calling `start_agentic_run` before at least 6 discovery picks have been committed for this exploration (via `accept_discovery_questions_batch`, or `accept_discovery_questions`). There is no skip-discovery exception.
|
|
1229
|
+
- Silently auto-picking all generated questions and proceeding to Step 8 — observed in agent output 2026-05-15 as "the engineering-mode default is to run, which skips the per-question picker." There is no such default; the picker is mandatory.
|
|
1230
|
+
- **Offering "or I'll default to taking all of them" (or any accept-all fallback), then committing the full set on an ambiguous reply** — observed 2026-06-05 (a `proceed` at this gate → `accept_discovery_questions_batch` with all 68 questions → a ~25-min run the user never chose). Accept-all is a legitimate choice **only when the user explicitly asks for it** — it is NEVER the default you offer, and NEVER the fallback. The default you offer + fall back to is always **`accept shortlist`** (6–10). An ambiguous reply (`proceed`/`go`/`ok`) at the pick gate means **accept the shortlist**, not the full set. Lead by nudging the user to step through Areas and pick deliberately.
|
|
1231
|
+
- Rendering "Next: run discovery through recommendations / Reply `run` to continue" anywhere in the chat before Step 7.4 has completed.
|
|
1232
|
+
|
|
1233
|
+
The picker is **not** a UI suggestion — it's the load-bearing decision gate where the user expresses what to investigate. Skipping it converts the agentic run into an automated "answer everything" pass and erases the user's judgment.
|
|
1234
|
+
|
|
1235
|
+
##### 7.1 — Kick off
|
|
1236
|
+
|
|
1237
|
+
Call `mcp__ritual__suggest_discovery_questions(exploration_id)`. Returns immediately with `task_id`. Tell the user with the full rail (we just entered the Discovery phase):
|
|
1238
|
+
|
|
1239
|
+
```text
|
|
1240
|
+
Ritual build
|
|
1241
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1242
|
+
|
|
1243
|
+
Generating discovery questions for each area…
|
|
1244
|
+
```
|
|
1245
|
+
|
|
1246
|
+
##### 7.2 — Poll until ready
|
|
1247
|
+
|
|
1248
|
+
Loop:
|
|
1249
|
+
- Call `mcp__ritual__get_discovery_state(exploration_id)`
|
|
1250
|
+
- If `ready: false`, wait 10 seconds, poll again
|
|
1251
|
+
- If `ready: true`, exit loop
|
|
1252
|
+
|
|
1253
|
+
Don't poll faster than every 10 seconds (matches the Spark UI's 10s discovery cadence). Follow the global polling rule above: single `Bash sleep 10` per iteration and a one-line update every ~2 polls (~20s). Polling heartbeats are exempt from the Build rail rule per `references/cli-output-contract.md` § Build progress anchor — does NOT apply to.
|
|
1254
|
+
|
|
1255
|
+
##### 7.3 — Matter-walk picker (Area rail + selected Area's questions → walk with `next`/`prev` → Summary)
|
|
1256
|
+
|
|
1257
|
+
The state contains `matters[]`, each with `id`, `name`, and `questions[]`. Internally these are `matter`s; user-facing copy ALWAYS calls them **Areas**.
|
|
1258
|
+
|
|
1259
|
+
This MIRRORS the Spark `/discover` picker exactly: Spark shows a **tab bar of all Areas with one tab selected AND that tab's questions already rendered below it**. The CLI does the same in text — every render shows a compact **Area rail** (all Areas, the current one marked, with running picked counts) **and, directly beneath it, the current Area's questions**. The user picks questions, then moves between Areas with `next`/`prev`, and finally lands on a **Summary** grouped by Area before committing. Seeing each Area's questions and choosing deliberately IS the value of discovery.
|
|
1260
|
+
|
|
1261
|
+
The two failure modes this contract prevents:
|
|
1262
|
+
- **A bare Area index** — the rail (or a "pick an Area" menu) with **no questions under it**. The rail without its current Area's questions is exactly the removed model; always render the questions inline. (This is the failure d3 caught on 2026-06-07: the agent rendered the Area list alone.)
|
|
1263
|
+
- **A full dump** — every Area's questions in one message. Only the **current** Area's questions render per turn.
|
|
1264
|
+
|
|
1265
|
+
**Turn boundaries (load-bearing — this is a multi-turn walk, not a one-shot render).** Render the rail + **exactly ONE Area's questions per turn**. After rendering, **STOP and end your turn** — wait for the user's reply (`numbers` / `next` / `prev` / `skip` / `done`). Each of `next` / `prev` / `done` produces the **next render in a NEW turn**, never appended to the current message. You already hold every Area's questions from `get_discovery_state` — that is NOT license to render the whole walk or multiple Areas' questions in a single message. The rail lists Area *names + counts* (cheap orientation); only the current Area's *questions* render. One Area → STOP → reply → next Area. The Summary (§ 7.3.3) is likewise its own turn.
|
|
1266
|
+
|
|
1267
|
+
###### 7.3.0 — Compute per-Area recommendations + the global shortlist (internal, not user-facing)
|
|
1268
|
+
|
|
1269
|
+
Three things surface, **none auto-applied**:
|
|
1270
|
+
- **(a) The Area rail** — every Area's name + its running picked count. Cheap orientation (names + counts, NOT their questions), shown above the current Area's questions from the very first render. This is the legitimate, always-visible "tab bar" — it is NOT the forbidden bare index, *because the current Area's questions always render beneath it*.
|
|
1271
|
+
- **(b) The per-Area ★ recommended set** (3–4 questions) — computed for the Area you are currently showing.
|
|
1272
|
+
- **(c) The global shortlist** (6–10 across all Areas) — computed only when the user types `accept shortlist`.
|
|
1273
|
+
|
|
1274
|
+
The user always picks; nothing is auto-committed.
|
|
1275
|
+
|
|
1276
|
+
**Per-Area recommended set** (the ★ set, for the Area currently shown):
|
|
1277
|
+
|
|
1278
|
+
- Pick the top 3–4 questions per Area most likely to shape the recommendations, based on the problem statement, locked sub-problems from Step 4, and the codebase recon context from Step 3. Bias toward questions whose absence would force later stages to invent consequential facts.
|
|
1279
|
+
- Area has **< 4 questions**: all are recommended.
|
|
1280
|
+
- Area has **4–7 questions**: top 3 are recommended.
|
|
1281
|
+
- Area has **8+ questions**: top 4 are recommended.
|
|
1282
|
+
|
|
1283
|
+
**Global shortlist** (what `accept shortlist` accepts — available from any Area or the Summary):
|
|
1284
|
+
|
|
1285
|
+
- Pick **6–10 questions TOTAL across all Areas**, biased toward questions most likely to change recommendations.
|
|
1286
|
+
- Preserve Area diversity by default — at least one question from each Area where the per-Area recommended set was non-empty, unless the scope is clearly concentrated (e.g. one Area dominates the recon evidence).
|
|
1287
|
+
- Cap at 10 even when the per-Area recommended sets sum to more. The point of the shortlist is to give the user a clean "the highest-signal triage set across the whole space" — picking 24–32 questions because 8 Areas each have 3–4 recommended brings back the "no triage signal" problem under a new name.
|
|
1288
|
+
- If the per-Area recommended sets sum to ≤10, the shortlist IS just the union (no further trimming).
|
|
1289
|
+
|
|
1290
|
+
Neither set is auto-applied. The user still picks per Area, or uses `accept shortlist` as a power path that bypasses the area-by-area drill.
|
|
1291
|
+
|
|
1292
|
+
###### 7.3.1 — First render: Area rail + Area 1's questions (the walk begins)
|
|
1293
|
+
|
|
1294
|
+
Open ON Area 1 with the **rail above and Area 1's questions below it** — never the rail alone. The rail lists every Area (current one marked, picked count per Area); the questions are Area 1's ★ recommended set. Full phase rail on this first message (we just entered Discovery); subsequent Area messages use the in-phase chip.
|
|
1295
|
+
|
|
1296
|
+
```text
|
|
1297
|
+
Ritual build
|
|
1298
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1299
|
+
|
|
1300
|
+
Question picking · Area 1 of {N} · {Area name} picked so far: 0
|
|
1301
|
+
|
|
1302
|
+
Areas ● {Area name 1} ○ {Area name 2} ○ {Area name 3} ○ {Area name 4} ○ {Area name 5}
|
|
1303
|
+
● current · ✓N after a name = picked in that Area · move with `next` / `prev`
|
|
1304
|
+
|
|
1305
|
+
Ritual generated questions across {N} areas for {M} locked sub-problems.
|
|
1306
|
+
I'll walk you through each — aim for 15–20 total (6 minimum to run, no cap).
|
|
1307
|
+
|
|
1308
|
+
Showing the {k} most likely to change the plan ({total} in this Area):
|
|
1309
|
+
|
|
1310
|
+
1. {recommended question 1, wrapped readably}
|
|
1311
|
+
2. {recommended question 2, wrapped readably}
|
|
1312
|
+
3. {recommended question 3, wrapped readably}
|
|
1313
|
+
|
|
1314
|
+
pick numbers (e.g. `1,3`) · `suggested` (these ★) · `add <your question>` · `show more` ({total−k} more)
|
|
1315
|
+
walk `next` · `prev` · `skip` · `done` (≥6) · `accept shortlist`
|
|
1316
|
+
```
|
|
1317
|
+
|
|
1318
|
+
**Single numbering stream — number the QUESTIONS only; the rail Areas are NOT numbered.** The 2026-05-15 failure numbered Areas AND question previews in one view, so a reply of `5` was ambiguous. Here the rail uses `●`/`○` markers + names (no numbers) and you move it with `next`/`prev` — the only numbered list is the current Area's questions, so a bare number is never ambiguous. Wrap long question text readably. The `picked so far` count, the rail markers/`✓N` counts, and the `Area i of N` breadcrumb all update on every render of the walk.
|
|
1319
|
+
|
|
1320
|
+
**Why `accept shortlist`, not `accept recommended`:** "recommended" is ambiguous (per-Area? global?). The picker uses **shortlist** for the global 6–10 power path (§ 7.3.0), keeping a clean vocabulary split: **discovery = `accept shortlist`** (questions), **recommendation review = `proceed`** (Step 9). The ★ marks the per-Area recommended set; `suggested` picks it.
|
|
1321
|
+
|
|
1322
|
+
###### 7.3.2 — Within an Area (pick, then move)
|
|
1323
|
+
|
|
1324
|
+
**Every render in this section keeps the `Areas …` rail line on top** (current Area marked, `✓N` counts updated) — it's omitted from the snippets below only for brevity. Never re-render an Area's questions without the rail above them.
|
|
1325
|
+
|
|
1326
|
+
- **`numbers`** (e.g. `1,3` or `1,2,5`): add those questions to the picked set, re-render this Area (rail + questions) with `✓` on the picked rows + the updated `picked so far`, then prompt `next` / `prev` / `done`.
|
|
1327
|
+
- **`suggested`**: pick this Area's recommended (★) set in one go.
|
|
1328
|
+
- **`show more`**: reveal the rest, grouped Recommended / More (lazy per-Area expansion — never a global dump):
|
|
1329
|
+
|
|
1330
|
+
```text
|
|
1331
|
+
Question picking · {Area name} picked so far: {T}
|
|
1332
|
+
|
|
1333
|
+
Recommended:
|
|
1334
|
+
1. {recommended question 1} ✓
|
|
1335
|
+
2. {recommended question 2}
|
|
1336
|
+
3. {recommended question 3}
|
|
1337
|
+
|
|
1338
|
+
More questions:
|
|
1339
|
+
4. {non-recommended question 1}
|
|
1340
|
+
5. {non-recommended question 2}
|
|
1341
|
+
...
|
|
1342
|
+
|
|
1343
|
+
Reply numbers (e.g. `1,4`), `next`, `prev`, or `skip`.
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
- **`next` / `prev`**: move to the next / previous Area (picks preserved). At the last Area, `next` goes to the Summary (§ 7.3.3).
|
|
1347
|
+
- **`skip`**: leave this Area with no picks, advance to `next`.
|
|
1348
|
+
- **`done`**: jump straight to the Summary (allowed from any Area).
|
|
1349
|
+
- **`pause`**: stop here — state is saved, nothing committed.
|
|
1350
|
+
- **`show all`**: accepted as a reply (expands every Area's questions into one long list) but NOT advertised on the CTA line — per-Area `show more` is the default, not a global wall.
|
|
1351
|
+
- **`add <your question>`** (e.g. `add How should we handle partial refunds?`): add a USER-AUTHORED question to THIS Area. **Pre-flight format-validate it locally first:** it must read as a single, clear question (non-empty, interrogative or ends with `?`, ≤ ~200 chars). If it's malformed (a statement, a fragment, multiple questions, too long), say what's off and ask them to rephrase — do NOT hold a malformed one. When valid, **hold it locally** for this Area and re-render the Area (rail + questions) with it shown as `+ (your) {text}` beneath the questions, `picked so far` incremented. It counts toward the floor/target like any pick. It is NOT written to the server yet — every custom question is persisted in ONE batch at `commit` (§ 7.4).
|
|
1352
|
+
|
|
1353
|
+
###### 7.3.3 — Summary (after the last Area, or on `done`) — the review-before-commit gate
|
|
1354
|
+
|
|
1355
|
+
Render all picks grouped by Area. This MIRRORS Spark's Summary tab and is the gate where the user confirms before the run. Use `✓` picked / `—` none / `□` untouched. NEVER strikethrough (renders inconsistently across terminals).
|
|
1356
|
+
|
|
1357
|
+
```text
|
|
1358
|
+
Question picking · Summary {T} picked
|
|
1359
|
+
|
|
1360
|
+
✓ 1. {Area name 1} {n} picked
|
|
1361
|
+
– {picked question}
|
|
1362
|
+
– {picked question}
|
|
1363
|
+
— 2. {Area name 2} none picked
|
|
1364
|
+
✓ 3. {Area name 3} {n} picked
|
|
1365
|
+
– {picked question}
|
|
1366
|
+
...
|
|
1367
|
+
|
|
1368
|
+
{if T < 15} A good set is usually 15–20 — you've picked {T}. Reply an Area
|
|
1369
|
+
number to add more, `more` to suggest new Areas, or `commit`.
|
|
1370
|
+
{if T ≥ 15} Reply `commit` to run discovery on these {T} questions, an Area
|
|
1371
|
+
number to adjust, `more` for new Areas, or `pause` to stop.
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
**The minimum model — floor 6 HARD, good 15–20 SOFT, no cap:**
|
|
1375
|
+
|
|
1376
|
+
- **`commit` with T < 6** → REFUSE (hard floor). *"Pick at least 6 to run discovery — you have {T}, choose {6−T} more,"* then return to the Summary (or the Area they were on). No skip path; do NOT call `accept_discovery_questions_batch` or `start_agentic_run`.
|
|
1377
|
+
- **`commit` with 6 ≤ T < 15** → allowed. Proceed to § 7.4 after the one-line "good is 15–20" nudge — do NOT re-nag or block.
|
|
1378
|
+
- **`commit` with T ≥ 15** → proceed to § 7.4.
|
|
1379
|
+
- **An Area number** at the Summary → re-open that Area's questions (picks preserved), then return here.
|
|
1380
|
+
|
|
1381
|
+
**Held custom questions + pending new Areas render in the Summary** so the user reviews everything before `commit`: a held custom question shows under its Area as `+ (your) {text}`; a pending agent-suggested new Area shows at the bottom as `+ (new) {name} {n} questions`. They count toward `{T}`. All are persisted at `commit` (§ 7.4).
|
|
1382
|
+
|
|
1383
|
+
- **`more`** at the Summary → the user wants broader coverage. **Suggest 2–3 NEW candidate Areas inline yourself** — each a short name + 3–4 questions — authored from the problem statement, the locked scope, and the Areas already shown, chosen to fill **gaps** the current Areas miss. Label the candidates with **LETTERS (`A`, `B`, `C`) — not numbers** — to avoid colliding with the question-number stream, and ask which to add (`letters`, e.g. `A` or `A,C`, or `none`). Picked candidates become **pending new Areas held locally** (persisted at `commit`). Do NOT call a server "generate-more" endpoint — you have the context, so propose directly (it's faster). **Never auto-add — the user picks.**
|
|
1384
|
+
|
|
1385
|
+
###### 7.3.4 — Power paths (available from any Area or the Summary)
|
|
1386
|
+
|
|
1387
|
+
- **`accept shortlist`**: accept the 6–10-question global shortlist computed in § 7.3.0 — the fast path for a user who doesn't want to walk every Area. Group those by their owning Area, commit them in ONE `accept_discovery_questions_batch` call (§ 7.4 — one entry per Area), and proceed to Step 7.5. Intentionally NOT "top 3–4 of every Area" (which would scale to 24–32 picks and reintroduce the "no triage signal" problem). The shortlist is the quick minimal set; the walk is how a user reaches the 15–20 good-coverage range.
|
|
1388
|
+
- **`show all`**: accepted as a reply but NOT advertised on the CTA line. Expands every Area's questions into one long list. Use only when the user explicitly asks — the per-Area `show more` is the default.
|
|
1389
|
+
- **`done`**: jump to the Summary from any Area to review + `commit`.
|
|
1390
|
+
- **Below the floor** (fewer than 6 picked on `commit`): do NOT proceed. Reply with how many more are needed and return to the Summary — e.g. *"Pick at least 6 to run discovery — you've picked 3, choose 3 more."* There is no skip path. (6–14 is allowed with the soft nudge; ≥15 is the good-coverage target — see § 7.3.3.)
|
|
1391
|
+
|
|
1392
|
+
###### 7.3.5 — What NOT to say
|
|
1393
|
+
|
|
1394
|
+
- DO NOT add machinery copy like *"The answer engine will then investigate them via codebase recon and surface clarifying questions for you to review."* The user only needs to know that picking them triggers investigation.
|
|
1395
|
+
- DO NOT use `Press Enter` anywhere in this picker (see § Surface-aware continuation prompts).
|
|
1396
|
+
- DO NOT say `lock` for the picking confirmation; use `done` (to the Summary) then `commit`.
|
|
1397
|
+
- DO NOT number Areas and questions in the same view — one numbering stream (the current Area's questions). The breadcrumb `Area i of N` carries position; it is not a pickable number.
|
|
1398
|
+
|
|
1399
|
+
###### Legacy alias notes
|
|
1400
|
+
|
|
1401
|
+
- `suggest` (legacy per-Area shortcut) is now spelled **`suggested`** — picks the current Area's recommended (★) set. If a user types `suggest` inside an Area, treat it the same.
|
|
1402
|
+
- `accept recommended` (legacy global shortcut): at the DISCOVERY stage, if a user types this, treat it as `accept shortlist` and surface a one-line note that the discovery-stage token is `accept shortlist` (questions). (At Step 9 the recommendation-review CTA is `proceed`, not `accept recommended`.)
|
|
1403
|
+
- `all` (legacy fourth option) remains removed (see § Removed below).
|
|
1404
|
+
|
|
1405
|
+
###### Removed: `all` (the old fourth option)
|
|
1406
|
+
|
|
1407
|
+
The legacy `all` shortcut was removed because in practice it produced low-signal selections — picking everything is indistinguishable from not discriminating, which makes Reasoning Readiness scoring less meaningful at the boundary and pushes recommendation generation against a noisy answer set. Users who really did mean "everything" can still type the full number list (e.g. `1,2,3,4,5`) — but that requires conscious intent rather than a one-keystroke default. If you see a SKILL or external reference still mentioning `all`, it's stale.
|
|
1408
|
+
|
|
1409
|
+
##### 7.4 — Commit picks (ONE batch call across all Areas)
|
|
1410
|
+
|
|
1411
|
+
**load-bearing — forbidden behavior:** do NOT fan out one
|
|
1412
|
+
`accept_discovery_questions` call per Area in parallel. Each per-Area call
|
|
1413
|
+
does several DB round-trips; firing them concurrently exhausts the server's
|
|
1414
|
+
connection pool and returns 503s on the later Areas (observed in prod). The
|
|
1415
|
+
batch endpoint exists precisely to avoid this — use it.
|
|
1416
|
+
|
|
1417
|
+
Call `mcp__ritual__accept_discovery_questions_batch` **once** with every
|
|
1418
|
+
Area's picks in a single atomic request:
|
|
1419
|
+
- `state_id` (from the discovery state)
|
|
1420
|
+
- `picks[]` — one entry per Area the user picked in, each `{ matter_id, question_ids[] }`
|
|
1421
|
+
|
|
1422
|
+
```ts
|
|
1423
|
+
// ONE call. All Areas, one atomic transaction, one successor state.
|
|
1424
|
+
await accept_discovery_questions_batch(state_id, [
|
|
1425
|
+
{ matter_id: areaA.matter_id, question_ids: areaA.question_ids },
|
|
1426
|
+
{ matter_id: areaB.matter_id, question_ids: areaB.question_ids },
|
|
1427
|
+
// …one entry per Area with at least one pick
|
|
1428
|
+
]);
|
|
1429
|
+
```
|
|
1430
|
+
|
|
1431
|
+
Use the single-Area `accept_discovery_questions` ONLY when the user picked in
|
|
1432
|
+
exactly one Area. If for some reason you must use it across several Areas
|
|
1433
|
+
(e.g. the batch tool is unavailable), call it **sequentially** (`await` each
|
|
1434
|
+
in turn) — never in parallel.
|
|
1435
|
+
|
|
1436
|
+
User-facing: emit ONE status line for the whole commit, not one per Area:
|
|
1437
|
+
|
|
1438
|
+
```text
|
|
1439
|
+
Saving picks across {N} Areas…
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
The batch call is all-or-nothing — validation fails the whole request if any
|
|
1443
|
+
pick is malformed, so there's no partial-success state to reconcile. Areas the
|
|
1444
|
+
user chose not to pick from are simply left unpicked.
|
|
1445
|
+
|
|
1446
|
+
**If there are NO held custom questions or pending new Areas, proceed to anti-goals.**
|
|
1447
|
+
|
|
1448
|
+
###### 7.4.1 — Persist held custom questions + new Areas (only if any were held)
|
|
1449
|
+
|
|
1450
|
+
Custom questions (`add`, § 7.3.2) and pending new Areas (`more`, § 7.3.3) were held
|
|
1451
|
+
LOCALLY during the walk because `add_discovery_question` needs a **workspace** matter id,
|
|
1452
|
+
which only exists after the batch above materialized the picked Areas. Persist them now,
|
|
1453
|
+
AFTER the batch call:
|
|
1454
|
+
|
|
1455
|
+
1. **Resolve workspace matter ids.** Call `mcp__ritual__get_exploration(exploration_id)` and
|
|
1456
|
+
map each Area **name** → its workspace `matters[i].id`. (The batch only materialized Areas
|
|
1457
|
+
the user picked AI questions in.)
|
|
1458
|
+
2. **For each Area that has held custom questions:**
|
|
1459
|
+
- if a workspace matter for that name exists → use its id;
|
|
1460
|
+
- if not (a custom-only Area, or a pending new Area) → `mcp__ritual__create_discovery_matter(exploration_id, name)` first, use the returned id.
|
|
1461
|
+
- then call `mcp__ritual__add_discovery_question(exploration_id, matter_id, text)` for each held question — **SEQUENTIALLY** (`await` each), never in parallel (same connection-pool caution as the batch).
|
|
1462
|
+
3. **For each pending new Area** (from `more`): `create_discovery_matter(...)` then `add_discovery_question(...)` per its questions, sequentially.
|
|
1463
|
+
|
|
1464
|
+
One status line for the whole persist step (not one per question):
|
|
1465
|
+
|
|
1466
|
+
```text
|
|
1467
|
+
Adding your {M} question(s) across {K} Area(s)…
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
Only after all holds are persisted, proceed to anti-goals. The floor (≥6) counts
|
|
1471
|
+
custom + AI questions together — never `start_agentic_run` before the held questions are
|
|
1472
|
+
written.
|
|
1473
|
+
|
|
1474
|
+
##### 7.5 — Optional: capture out-of-scope items
|
|
1475
|
+
|
|
1476
|
+
If the user mentioned things they DON'T want investigated ("don't touch enterprise SSO", "skip pricing"), capture them as anti-goals.
|
|
1477
|
+
|
|
1478
|
+
**Pre-flight (mandatory):** before calling `set_anti_goals`, run the change pre-flight in `references/change-preflight.md` — restate the out-of-scope items you heard and show the exact anti-goal `text` array you're about to send, then wait for `yes`. A misread anti-goal poisons rec-gen and the R4 audit downstream, so this hard pause (even in auto-mode) applies even when the user's phrasing seemed clear. Do not call the tool until the user confirms.
|
|
1479
|
+
|
|
1480
|
+
Call `mcp__ritual__set_anti_goals(exploration_id, [{ text, reason? }, ...])`.
|
|
1481
|
+
|
|
1482
|
+
Skip silently if no anti-goals were mentioned. (No mention = nothing to confirm; the pre-flight only runs when the user actually states out-of-scope items.)
|
|
1483
|
+
|
|
1484
|
+
**Pulse (Step 7.4 done — and again after 7.5 if anti-goals were set):** Emit a pulse — decision resolution and (if 7.5 ran) assumption safety just moved. Compact format unless this crosses Under-specified → Exploration-safe.
|
|
1485
|
+
|
|
1486
|
+
#### Step 8 — Run discovery through recommendations
|
|
1487
|
+
|
|
1488
|
+
The agentic pipeline runs sourcing → answers → recommendations. For engineering / agentic-coding flows, do **not** offer an answers-only mode; the happy path is to run through recommendations.
|
|
1489
|
+
|
|
1490
|
+
For `engineering`, `delivery`, and `operations` roles, show:
|
|
1491
|
+
|
|
1492
|
+
```text
|
|
1493
|
+
Ritual build
|
|
1494
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1495
|
+
|
|
1496
|
+
Run discovery
|
|
1497
|
+
|
|
1498
|
+
Ritual will source answers for the picked questions, then generate
|
|
1499
|
+
recommendations. This usually takes a few minutes.
|
|
1500
|
+
|
|
1501
|
+
Reply `run` to continue.
|
|
1502
|
+
Reply `pause` to stop here.
|
|
1503
|
+
```
|
|
1504
|
+
|
|
1505
|
+
Visible CTA is `run`. Accept `r`, `go`, `continue`, or `next` as aliases. Per `references/cli-output-contract.md` § Surface-aware continuation prompts, do NOT treat empty input as proceed inside agent chat.
|
|
1506
|
+
|
|
1507
|
+
Call `mcp__ritual__start_agentic_run` with:
|
|
1508
|
+
- `scope_type: 'exploration'`
|
|
1509
|
+
- `exploration_id`
|
|
1510
|
+
|
|
1511
|
+
For `product`, `design`, or explicitly PRD-style flows, answer review may be useful. Offer two choices without time estimates:
|
|
1512
|
+
|
|
1513
|
+
```text
|
|
1514
|
+
Ritual build
|
|
1515
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1516
|
+
|
|
1517
|
+
Run discovery
|
|
1518
|
+
|
|
1519
|
+
How do you want to run discovery?
|
|
1520
|
+
|
|
1521
|
+
1. Stop after answers — review and refine the generated answers
|
|
1522
|
+
before recommendations.
|
|
1523
|
+
2. Run through recommendations — fastest path to a recommendation set.
|
|
1524
|
+
|
|
1525
|
+
Reply `1` or `2`. Reply `pause` to stop here.
|
|
1526
|
+
```
|
|
1527
|
+
|
|
1528
|
+
If they pick 1, call `start_agentic_run` with `stop_after: 'answers'` and continue to Step 8.5 when it pauses. If they pick 2, call without `stop_after` and continue to Step 9 when complete.
|
|
1529
|
+
|
|
1530
|
+
##### 8.0 — "You're unblocked" pre-roll (right after `start_agentic_run` returns the run_id)
|
|
1531
|
+
|
|
1532
|
+
**Lock the product promise BEFORE you enter the polling loop.** The run continues server-side; the user is free to step away. The polling loop becomes the agent's job, not the user's obligation.
|
|
1533
|
+
|
|
1534
|
+
Tier the pre-roll by projected duration. Latency baseline: ~15s/question (V5.2 + KG injection, calibrate quarterly against `recs-pipeline.ts` eval results). Multiply the picked-question count by 15s, divide by 60 to get minutes.
|
|
1535
|
+
|
|
1536
|
+
**Projected ≤ 2 min** — skip the pre-roll entirely. The polling micro-copy below covers the framing.
|
|
1537
|
+
|
|
1538
|
+
**Projected 2–20 min** — warm framing:
|
|
1539
|
+
|
|
1540
|
+
```text
|
|
1541
|
+
Deep reasoning run started — this may take ~{minutes} minutes.
|
|
1542
|
+
|
|
1543
|
+
You're unblocked: the run continues server-side while you do other work.
|
|
1544
|
+
Grab coffee, switch tasks, or close the terminal safely.
|
|
1545
|
+
|
|
1546
|
+
For live progress, open a NEW terminal and run:
|
|
1547
|
+
ritual status --watch # terminal command, not a slash-command
|
|
1548
|
+
|
|
1549
|
+
Or check inside this session:
|
|
1550
|
+
/ritual status # SKILL subcommand (in-chat)
|
|
1551
|
+
|
|
1552
|
+
Come back later:
|
|
1553
|
+
/ritual resume
|
|
1554
|
+
```
|
|
1555
|
+
|
|
1556
|
+
**Projected 20+ min** — longer framing:
|
|
1557
|
+
|
|
1558
|
+
```text
|
|
1559
|
+
Long reasoning run started — this one may take 20+ minutes.
|
|
1560
|
+
|
|
1561
|
+
You can safely step away; the run continues server-side even if this terminal
|
|
1562
|
+
closes. For live progress:
|
|
1563
|
+
|
|
1564
|
+
ritual status --watch # in a separate terminal (not /ritual status)
|
|
1565
|
+
|
|
1566
|
+
Or check inside this session:
|
|
1567
|
+
/ritual status # SKILL subcommand for in-chat status
|
|
1568
|
+
|
|
1569
|
+
To come back later:
|
|
1570
|
+
/ritual resume
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
**Two surfaces, two contexts:**
|
|
1574
|
+
|
|
1575
|
+
- `ritual status [--watch]` — **terminal command** (CLI 0.7.14+). Run from a separate shell. Survives this session closing; supports `--watch` for live tail.
|
|
1576
|
+
- `/ritual status` — **SKILL subcommand** inside Claude Code / Cursor / your agent. Read-only mirror; useful when the user wants a quick check without context-switching to a terminal. Defined in `references/status-flow.md`.
|
|
1577
|
+
|
|
1578
|
+
Pick whichever fits the user's flow — they're equivalent in content. Do not introduce a `reply watch` mode in this SKILL; the CLI command IS the live-tail affordance.
|
|
1579
|
+
|
|
1580
|
+
##### 8.1 — Polling loop
|
|
1581
|
+
|
|
1582
|
+
Poll `mcp__ritual__get_agentic_run(run_id)` using `references/async-polling.md`: **`Bash sleep 20` (constant 20 — matches Spark's 20s agentic cadence; never escalate)** per iteration, then a fresh status call. Even if the run takes 2+ minutes, the sleep value stays a constant 20; the harness blocks chained-shorter-sleeps-at-increasing-N just like it blocks `sleep ≥ 30`, but a fixed `20` is non-escalating and under 30 → guard-safe. Agentic runs CAN exceed 5 min for large explorations — if you see status still running past ~5 min of polling, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
|
|
1583
|
+
|
|
1584
|
+
**On the FIRST poll only** (not every poll), prepend one line that locks the "background execution is default" mental model:
|
|
1585
|
+
|
|
1586
|
+
> I'll keep working in the background. For a live tail, run `ritual status --watch` in a separate terminal — or type `/ritual status` here for an in-chat snapshot.
|
|
1587
|
+
|
|
1588
|
+
Then print progress only when `progress_pct` or `current_step` changes, or every ~3 polls if unchanged:
|
|
1589
|
+
|
|
1590
|
+
> Agentic run: {progress_pct}% — {current_step}
|
|
1591
|
+
|
|
1592
|
+
When `status` is `COMPLETED`: continue to Step 9.
|
|
1593
|
+
When `status` is `COMPLETED_WITH_ERRORS`: tell the user, but proceed — partial recommendations may still be useful.
|
|
1594
|
+
When `status` is `FAILED`: surface the error message, ask if they want to retry (`start_agentic_run` again with same exploration_id) or stop.
|
|
1595
|
+
When `status` is `PAUSED_FOR_REVIEW` (product/design answer-review mode only): continue to Step 8.5.
|
|
1596
|
+
|
|
1597
|
+
If user wants to abort mid-flight: `mcp__ritual__cancel_agentic_run(run_id)`.
|
|
1598
|
+
|
|
1599
|
+
#### Step 8.5 — Run Agentic Exploration (product/design answer-review mode only)
|
|
1600
|
+
|
|
1601
|
+
When the pipeline pauses at `PAUSED_FOR_REVIEW`, the exploration is at step `REVIEWING_ANSWERS`. Every Area's questions have v1 answers + at least one clarifying question per consideration, but nothing has been committed for recommendation generation yet.
|
|
1602
|
+
|
|
1603
|
+
**The agent walks the user through each question one at a time as part of the running agentic exploration.** Render the full rail at the **landing** (the first answer-review message), then use the in-phase chip on subsequent per-question views.
|
|
1604
|
+
|
|
1605
|
+
**On naming:** this step is **Run Agentic Exploration** in user-facing copy and section headings — NOT "Per-answer iteration" (the old internal label). The phase the user is in is "the agentic exploration is running and pausing for your input on each answer before recommendations generate." That's what the heading should say.
|
|
1606
|
+
|
|
1607
|
+
Landing (first question, full rail + intro):
|
|
1608
|
+
|
|
1609
|
+
```text
|
|
1610
|
+
Ritual build
|
|
1611
|
+
✓ Context ✓ Scope ● Discovery ○ Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1612
|
+
|
|
1613
|
+
Run Agentic Exploration
|
|
1614
|
+
|
|
1615
|
+
Ritual drafted answers for {totalQuestions} questions across {N} Areas.
|
|
1616
|
+
For each question, you can submit the v1 answer or iterate with a
|
|
1617
|
+
follow-up. When all questions are submitted, Ritual generates
|
|
1618
|
+
recommendations.
|
|
1619
|
+
|
|
1620
|
+
────────────────────────────────────────────────────────────────────
|
|
1621
|
+
|
|
1622
|
+
Discovery — question 1 of {total}: {Area name}
|
|
1623
|
+
|
|
1624
|
+
Q: {question.text}
|
|
1625
|
+
|
|
1626
|
+
v1 answer:
|
|
1627
|
+
{currentDraft, first 400 chars …}
|
|
1628
|
+
|
|
1629
|
+
My follow-up: {first consideration's latest assistant message}
|
|
1630
|
+
|
|
1631
|
+
Reply `submit` to lock in v1, or reply with text to iterate.
|
|
1632
|
+
Reply `pause` to stop here.
|
|
1633
|
+
```
|
|
1634
|
+
|
|
1635
|
+
Each subsequent per-question view uses the in-phase chip only (no full rail):
|
|
1636
|
+
|
|
1637
|
+
```text
|
|
1638
|
+
Discovery — question 2 of {total}: {Area name}
|
|
1639
|
+
|
|
1640
|
+
Q: {question.text}
|
|
1641
|
+
|
|
1642
|
+
v1 answer:
|
|
1643
|
+
{...}
|
|
1644
|
+
|
|
1645
|
+
My follow-up: {...}
|
|
1646
|
+
|
|
1647
|
+
Reply `submit` or reply with text to iterate.
|
|
1648
|
+
```
|
|
1649
|
+
|
|
1650
|
+
For each question's loop:
|
|
1651
|
+
|
|
1652
|
+
1. **Fetch the state.** Call `mcp__ritual__get_answer_state({ question_id })`. Returns:
|
|
1653
|
+
- The question text
|
|
1654
|
+
- The current draft answer (v1)
|
|
1655
|
+
- The considerations (sub-aspects) with their chat sessions
|
|
1656
|
+
- The latest assistant message per consideration — this is the **first clarifying question** the answer engine already generated during Phase 3
|
|
1657
|
+
|
|
1658
|
+
2. **Present using the landing-or-chip shape above.** Two choices, that's it (no "skip"):
|
|
1659
|
+
|
|
1660
|
+
- **submit** — happy with v1; lock it in and move to the next question
|
|
1661
|
+
- **iterate** (any free-text reply) — answers the follow-up OR explains what's wrong with v1; the answer engine regenerates
|
|
1662
|
+
|
|
1663
|
+
3. **Branch on user's choice:**
|
|
1664
|
+
|
|
1665
|
+
- **If "submit":** call `mcp__ritual__submit_answer({ question_id })`. The question advances to COMPLETED. Move to the next question's Step 8.5 loop iteration.
|
|
1666
|
+
|
|
1667
|
+
- **If "iterate" (any free-text reply):** call `mcp__ritual__iterate_answer({ consideration_id, message: user_text })`. The answer engine:
|
|
1668
|
+
- Persists the user message in the consideration's chat
|
|
1669
|
+
- Generates a new AI response (which is either the next clarifying question OR a recognition that the answer is now complete)
|
|
1670
|
+
- The new response is **automatically KG-aware** as of PR 5: the answer engine reads the exploration's persisted `sources` and pulls in relevant prior decisions + open deferrals when forming the next question
|
|
1671
|
+
|
|
1672
|
+
**Loop back to step 2 with the updated state.** Fetch fresh state via `get_answer_state` (the considerations array now reflects the new chat message + AI response), show v_N+1, prompt again. Cap at ~5 iterations per consideration before suggesting "let's submit and move on" — keeps cost bounded.
|
|
1673
|
+
|
|
1674
|
+
4. **When ALL questions are submitted:** call `mcp__ritual__resume_agentic_run({ run_id })`. Pipeline runs Phase 4 (submit all answers — the per-question submits above already advanced individual questions, but submit_all_answers is the canonical batch checkpoint) + Phase 5 (recommendations). Poll as in Step 8. When `status` becomes `COMPLETED`, continue to Step 9.
|
|
1675
|
+
|
|
1676
|
+
**Skip-the-iteration escape hatch:** the user can say "just resume" at any point. Call `resume_agentic_run` immediately. Recs generate from whatever state the answers are in (whether v1 or partially iterated). Equivalent to having picked Mode A from the start, just with the option to iterate later via the web UI.
|
|
1677
|
+
|
|
1678
|
+
**Abandon:** `cancel_agentic_run(run_id)`. The exploration stays at `REVIEWING_ANSWERS` — the user can come back later and either resume or start fresh.
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
**Pulse (Step 8 done):** Emit a pulse — decision resolution moved significantly (answers complete, draft recommendations now exist). Render full if this crosses Under-specified → Exploration-safe, else compact.
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
#### Step 9 — Review recommendations (category walk)
|
|
1686
|
+
|
|
1687
|
+
This is the most-read screen in the build flow, and — as of 2026-06-08 — a **non-blocking review**. Recommendations are **auto-accepted at generation** (created `approved`); the artifacts that depend on them (requirements, the deliverable doc, and — for developer-function jobs — the build brief) are **already being generated** the moment rec-gen completes. Step 9 is the user's chance to **read and refine** the set, not an accept-or-reject gate. Replying `proceed` records that a human reviewed it (stamps `reviewedAt` / `reviewedBy`) and continues to the build brief — it never blocks, and there is **no reject path here**.
|
|
1688
|
+
|
|
1689
|
+
The review is a **category walk**, mirroring Spark's recommendation drawer: the user moves through one **category** at a time, sees each recommendation in that category in full (title, description, and the "Why this" reasoning), and can refine any one of them in place before continuing.
|
|
1690
|
+
|
|
1691
|
+
**Data source.** Use `mcp__ritual__get_recommendations(exploration_id)` (the raw array) — the walk shows full per-rec content, so you need the fields a titles-only preview omits:
|
|
1692
|
+
|
|
1693
|
+
- top-level: `id`, `title`, `content` (the description / summary), `status`, `priority`, `points`, `confidence`
|
|
1694
|
+
- `metadata.category.name` — **the load-bearing grouping key** (one rec → one category)
|
|
1695
|
+
- `metadata.explainability` — `rationale` (chained `→` arrow string), `faq_references[]`, `problem_alignment`, `inferred_elements`
|
|
1696
|
+
- `metadata.acceptance_criteria[]` — concrete pass conditions (optional to surface; see § 9.1)
|
|
1697
|
+
|
|
1698
|
+
Assign stable `R1..RN` IDs **globally across all categories** in page order (NOT restarting per-category), and remember the `R{N}` → `id` map so you can resolve `edit R{N}` to the rec UUID for the MCP calls.
|
|
1699
|
+
|
|
1700
|
+
**Vocabulary — load-bearing:**
|
|
1701
|
+
|
|
1702
|
+
- Recommendations are grouped by **category** (`metadata.category.name`). They are **NEVER** grouped by `matter` or by `Area` — those are discovery-phase concepts. `matter_id` must never appear in user-facing copy. Anti-pattern observed in agent output: *"44 recs grouped by matter"* — the right framing is *"44 recs across K categories."*
|
|
1703
|
+
- Do NOT use "Reasoning chain" / "reasoning_chain" in user-facing copy. The user-visible label is **"Why this"** — a short Problem / Discovery / Tradeoff distillation derived from the `rationale` field, NOT the literal `→` arrow chain (that's the model's internal scratchpad shape).
|
|
1704
|
+
|
|
1705
|
+
**Action set — load-bearing (exactly three, no freelancing):**
|
|
1706
|
+
|
|
1707
|
+
- `edit R{N} <your change>` — refine one recommendation: regenerate its title / description / reasoning from a plain-language ask, **preview** the change, then **apply** it. (§ 9.2)
|
|
1708
|
+
- `next` — move to the next category. (§ 9.3)
|
|
1709
|
+
- `proceed` — mark the set reviewed and continue to the build brief, from any category. (§ 9.3)
|
|
1710
|
+
|
|
1711
|
+
**Do NOT freelance other actions.** There is **no `drop` / reject** (recs are auto-accepted and the review is non-blocking — a rec the user dislikes is refined with `edit`, or simply left as-is), **no `comment`**, and **no separate `drill` / `detail`** (full content is already on screen). Reject none of these by inventing compounds either (`dedupe`, `accept the survivors`, `merge similar`, `open the admin UI` — all forbidden). If the rec set itself looks wrong (e.g. apparent duplicates), surface the anomaly explicitly and consult `mcp__ritual__get_recommendation_attestation` (`duplicateTitlePrefixes`) — don't paper over it with an invented action.
|
|
1712
|
+
|
|
1713
|
+
##### 9.1 — The walk: one category per turn
|
|
1714
|
+
|
|
1715
|
+
**[USER PAUSE]** Render the **current category only**, then stop and wait for the user's reply. One category per turn — never dump every category's full content in a single message (that's the wall-of-text failure mode; the walk is what keeps a 13-rec set readable). The first render opens with the full rail; subsequent categories use the in-phase chip.
|
|
1716
|
+
|
|
1717
|
+
First category (rail shown):
|
|
1718
|
+
|
|
1719
|
+
```text
|
|
1720
|
+
Ritual build
|
|
1721
|
+
✓ Context ✓ Scope ✓ Discovery ● Recommendations ○ Build brief ○ Implementation (Your agent)
|
|
1722
|
+
|
|
1723
|
+
Scope:
|
|
1724
|
+
{one-line compressed scope — ~80-120 chars; truncate at a clause boundary, no ellipsis}
|
|
1725
|
+
|
|
1726
|
+
{N} recommendations across {K} categories. They're accepted by default —
|
|
1727
|
+
review and refine any, or proceed anytime.
|
|
1728
|
+
|
|
1729
|
+
Category 1/{K} — {category name}
|
|
1730
|
+
|
|
1731
|
+
R1 {title}
|
|
1732
|
+
{content — the description, wrapped at terminal width, 1-3 lines}
|
|
1733
|
+
Why this: {one-line Problem→Discovery→Tradeoff distillation, plain prose}
|
|
1734
|
+
|
|
1735
|
+
R2 {title}
|
|
1736
|
+
{description}
|
|
1737
|
+
Why this: {...}
|
|
1738
|
+
|
|
1739
|
+
Pulse: Reasoning Readiness ~88% · Context Debt 12% (implementation-ready)
|
|
1740
|
+
|
|
1741
|
+
Reply edit R{N} <your change> · next (Category 2/{K}) · proceed (build brief)
|
|
1742
|
+
```
|
|
1743
|
+
|
|
1744
|
+
Subsequent categories (in-phase chip, no full rail):
|
|
1745
|
+
|
|
1746
|
+
```text
|
|
1747
|
+
Recommendations · Category 2/{K} — {category name}
|
|
1748
|
+
|
|
1749
|
+
R3 {title}
|
|
1750
|
+
{description}
|
|
1751
|
+
Why this: {...}
|
|
1752
|
+
|
|
1753
|
+
...
|
|
1754
|
+
|
|
1755
|
+
Reply edit R{N} <your change> · next (Category 3/{K}) · proceed (build brief)
|
|
1756
|
+
```
|
|
1757
|
+
|
|
1758
|
+
Notes:
|
|
1759
|
+
|
|
1760
|
+
- **Global `R{N}` IDs** continue across categories (Category 2 starts at R3 if Category 1 held R1–R2). The R-ID is how the user references a rec in `edit R{N}`; never restart numbering per category.
|
|
1761
|
+
- **`content` (the description) and "Why this" ARE shown** at the walk — unlike the old titles-only landing. That's deliberate: the user reads and refines in place. Keep each rec to title + 1–3 description lines + one "Why this" line. If a rec's `acceptance_criteria` are short and genuinely useful you may add a single `Pass: {...}` line, but don't pad — the walk must stay scannable.
|
|
1762
|
+
- **One blank line between recs**; indent rec bodies under their `R{N}` so the eye lands on the title first.
|
|
1763
|
+
- **`proceed` is the primary CTA** and is offered on every category — the user never has to walk all categories to continue.
|
|
1764
|
+
- **On the last category**, the action line drops `next`; if the user types `next` there, reply: "That was the last category — reply `proceed` to continue, or `edit R{N}` to refine one."
|
|
1765
|
+
|
|
1766
|
+
##### 9.2 — `edit R{N} <ask>`: preview, then apply
|
|
1767
|
+
|
|
1768
|
+
This mirrors Spark's "Revise → Preview Revision → Apply revision" exactly: the change is **previewed before anything persists**.
|
|
1769
|
+
|
|
1770
|
+
1. Resolve `R{N}` → rec UUID from the walk's ID map.
|
|
1771
|
+
2. Call `mcp__ritual__suggest_recommendation_edit({ recommendation_id, instruction: "<the user's ask, verbatim>" })`. This runs an LLM and returns a **transient proposal** — nothing is mutated yet. It carries `id` (the proposal id), `summary` ("what changed"), and `diff[]` of `{ field, before, after }` where `field` is `title`, `description`, or `chain.<idx>`.
|
|
1772
|
+
3. **[USER PAUSE]** Render the preview and wait:
|
|
1773
|
+
|
|
1774
|
+
```text
|
|
1775
|
+
Recommendations · R{N} — proposed revision
|
|
1776
|
+
|
|
1777
|
+
What changed: {proposal.summary}
|
|
1778
|
+
|
|
1779
|
+
Title
|
|
1780
|
+
- {before}
|
|
1781
|
+
+ {after}
|
|
1782
|
+
|
|
1783
|
+
Description
|
|
1784
|
+
- {before}
|
|
1785
|
+
+ {after}
|
|
1786
|
+
|
|
1787
|
+
Why this — step {i}
|
|
1788
|
+
- {before}
|
|
1789
|
+
+ {after}
|
|
1790
|
+
|
|
1791
|
+
Reply apply (save this revision) · discard (keep the original)
|
|
1792
|
+
```
|
|
1793
|
+
|
|
1794
|
+
- Render ONLY the `diff` fields that are present. Map `field: "title"` → `Title`, `"description"` → `Description`, `"chain.<idx>"` → `Why this — step {idx+1}`.
|
|
1795
|
+
- If the proposal's `diff` is empty (the LLM found no meaningful change), say so plainly and return to the category view unchanged — don't fabricate a diff.
|
|
1796
|
+
|
|
1797
|
+
4. On `apply`: call `mcp__ritual__apply_recommendation_proposal({ recommendation_id, proposal_id })`. It persists a new version, replays the reasoning chain, and returns the applied proposal. Re-fetch the rec (`get_recommendations`) and **re-render the current category with R{N} updated in place**, then continue the walk (action line `edit R{N} <change> · next · proceed`).
|
|
1798
|
+
On `discard`: return to the current category unchanged — nothing was persisted.
|
|
1799
|
+
|
|
1800
|
+
Editing is non-destructive and does not advance the flow — the user can `edit` several recs, across categories, before `proceed`.
|
|
1801
|
+
|
|
1802
|
+
##### 9.3 — `next` and `proceed`
|
|
1803
|
+
|
|
1804
|
+
- **`next`** → render the next category per § 9.1 (in-phase chip). After the last category, prompt `proceed`.
|
|
1805
|
+
- **`proceed`** (from any category) → call `mcp__ritual__accept_recommendations({ exploration_id })`. Under the non-blocking model this **records the human review** (stamps `reviewedAt` / `reviewedBy`) and advances; it is NOT a draft→approved promotion (the recs are already `approved`). The downstream artifacts were queued at rec-gen time, so this returns fast. Then show the completion rail and continue to Step 9.5:
|
|
1806
|
+
|
|
1807
|
+
```text
|
|
1808
|
+
Ritual build
|
|
1809
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ● Build brief ○ Implementation (Your agent)
|
|
1810
|
+
|
|
1811
|
+
Reviewed {N} recommendations.
|
|
1812
|
+
|
|
1813
|
+
View: https://app.ritualapp.cloud/e/{exploration_id}
|
|
1814
|
+
|
|
1815
|
+
Next: preparing the build brief…
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
**Pulse (recommendations reviewed):** emit a pulse — this is almost always a state-tier crossing into **Recommendation-ready**. Render full.
|
|
1819
|
+
|
|
1820
|
+
Continue to Step 9.5 (`Wait for requirements`).
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
#### Step 9.5 — Wait for requirements (auto-triggered by Step 9)
|
|
1825
|
+
|
|
1826
|
+
`accept_recommendations` fires requirement generation **fire-and-forget** the moment it succeeds. By the time you reach this step, generation is already in flight (or done, for fast LLM calls). The brief in Step 10 needs requirements ready, so wait here.
|
|
1827
|
+
|
|
1828
|
+
Steps:
|
|
1829
|
+
|
|
1830
|
+
1. **Tell the user once** that requirements are being generated:
|
|
1831
|
+
|
|
1832
|
+
> Generating requirements for the build brief…
|
|
1833
|
+
|
|
1834
|
+
2. **Poll `mcp__ritual__get_requirement_set_status(exploration_id)` every ~5s.** The response shape:
|
|
1835
|
+
|
|
1836
|
+
```
|
|
1837
|
+
{
|
|
1838
|
+
exists: boolean,
|
|
1839
|
+
status: 'GENERATING' | 'READY' | 'FAILED' | null,
|
|
1840
|
+
icp, startedAt, completedAt, errorMessage
|
|
1841
|
+
}
|
|
1842
|
+
```
|
|
1843
|
+
|
|
1844
|
+
Polling rules in this harness:
|
|
1845
|
+
- **`Bash sleep 5` per poll. Always 5. Never escalate to 15/20/25.** The harness blocks chained sleeps, `sleep ≥ 30`, AND successive `sleep N` calls across turns at increasing N. One short sleep per turn dodges all three guards AND keeps the user-facing progress feel live.
|
|
1846
|
+
- **Update the user every ~3 polls** with a "still generating…" line so they know you haven't stalled.
|
|
1847
|
+
- If polling crosses ~5 minutes, switch to the `Monitor` + `until <check>; do sleep 2; done` pattern from `references/async-polling.md` § Long waits.
|
|
1848
|
+
|
|
1849
|
+
3. **Exit conditions:**
|
|
1850
|
+
|
|
1851
|
+
| Response | Action |
|
|
1852
|
+
|---|---|
|
|
1853
|
+
| `status === 'READY'` | Proceed to Step 10 |
|
|
1854
|
+
| `exists === false` (still null) for 3+ polls | The fire-and-forget hasn't reached the DB yet, OR `proceed` (accept_recommendations) hasn't run yet (no LLM call yet). After several polls either keep polling OR proceed to Step 10 — the API auto-triggers generation inline if the set is still missing when the brief is requested (adds ~30s to the brief call but never hard-fails). |
|
|
1855
|
+
| `status === 'GENERATING'` | Keep polling |
|
|
1856
|
+
| `status === 'FAILED'` | Surface `errorMessage` to the user; offer to retry by calling `generate_build_brief` directly (which will auto-trigger a fresh generation), OR by hitting `POST /requirements?force=true` via the web UI |
|
|
1857
|
+
|
|
1858
|
+
4. **Special case — `proceed` not yet called (accept_recommendations hasn't run):** if the user jumped ahead without the rec-review `proceed`, there's no fire-and-forget auto-trigger from that path. Skip the polling entirely and let Step 10's auto-trigger handle requirement generation inline. The brief call will take ~30s longer than it otherwise would. (Note: auto-finalize at rec-gen completion usually already queued requirements, so this case is rare.)
|
|
1859
|
+
|
|
1860
|
+
5. When `status === 'READY'`, tell the user one line ("Requirements ready…") and continue to Step 9.6 (if anti-goals exist) OR directly to Step 10 (if no anti-goals, audit step is skipped silently).
|
|
1861
|
+
|
|
1862
|
+
#### Step 9.6 — Audit the recommendations + requirements against declared anti-goals (load-bearing — audit-repair loop)
|
|
1863
|
+
|
|
1864
|
+
Run a constraint-survival audit on the typed Recommendation + Requirement substrate BEFORE brief generation. The audit answers the question: *"Did the anti-goal directives the user declared actually constrain the recs+reqs, or are they decorative?"* — the R4 operator (constraint-perturbation) applied to the (anti-goals, recs+reqs, R4) triple per the audit-triple-framing rule.
|
|
1865
|
+
|
|
1866
|
+
**Why this is load-bearing**: an inert anti-goal — declared but not actually constraining anything in the recs+reqs — propagates downstream as an unconstrained brief. By Step 11 (implementation) it's too late; the agent codes against a substrate whose forbidden states were never enforced. The audit catches inert directives at the upstream typed substrate where the fix is cheap (rec content edit), not at the brief markdown where the fix is expensive (full regen).
|
|
1867
|
+
|
|
1868
|
+
**Skip condition**: if the exploration has zero anti-goals (`set_anti_goals` was never called OR all anti-goals are `confidence < 0.4`) OR no APPROVED recommendations exist OR the latest RequirementSet isn't READY, skip this step silently and continue to Step 10. The audit tool returns 404 in any of those cases; check the substrate state first if unsure.
|
|
1869
|
+
|
|
1870
|
+
**Build modes** (per `documents/architecture/audit-suite.md` § 7a) — the gate prompt below renders differently depending on which mode flag the user invoked:
|
|
1871
|
+
|
|
1872
|
+
| Mode | Prompt behavior | Default on enter |
|
|
1873
|
+
|---|---|---|
|
|
1874
|
+
| bare `/ritual build` | Compact opt-in: "Reply `audit` or `proceed`" | `proceed` |
|
|
1875
|
+
| `/ritual build --audited` | Elevated: "Recommended: run constraint-survival audit. Reply `audit`, `proceed`, or `always audit for this build`" | Awaits user input (no implicit default) |
|
|
1876
|
+
| `/ritual build --audit=strict` | Audit auto-runs; user sees results + repair menu, not the gate prompt | N/A (no gate prompt rendered) |
|
|
1877
|
+
|
|
1878
|
+
`auditMode` is read from working memory (set at Step 0 from the user's invocation flags). Mid-flow, `always audit for this build` upgrades the session to `--audit=strict` behavior for any remaining audit gates (Audit 2 at Step 10b.5, Audit 3 at Step 11.1 — both PR B/C).
|
|
1879
|
+
|
|
1880
|
+
**Strict mode time budget**: each audit chain runs up to 3 iterations of verifier calls (~5-15s per iteration × 3 = ~15-45s typical). Hard wall-clock cap of 90s per chain — on timeout, the gate degrades to `--audited` behavior (surface findings, let user decide rather than block the build).
|
|
1881
|
+
|
|
1882
|
+
### Step 9.6.1 — Render the gate prompt (mode-aware)
|
|
1883
|
+
|
|
1884
|
+
**For `bare` mode:**
|
|
1885
|
+
|
|
1886
|
+
```text
|
|
1887
|
+
Recommendations + requirements are ready. Optional constraint-survival audit available.
|
|
1888
|
+
|
|
1889
|
+
Reply `audit` to run, or `proceed` to skip to brief generation.
|
|
1890
|
+
```
|
|
1891
|
+
|
|
1892
|
+
**For `--audited` mode:**
|
|
1893
|
+
|
|
1894
|
+
```text
|
|
1895
|
+
Recommendations + requirements are ready.
|
|
1896
|
+
|
|
1897
|
+
Recommended: run constraint-survival audit before brief generation.
|
|
1898
|
+
This checks whether anti-goals survived into the recs + requirements.
|
|
1899
|
+
|
|
1900
|
+
Reply `audit`, `proceed`, or `always audit for this build`.
|
|
1901
|
+
```
|
|
1902
|
+
|
|
1903
|
+
**For `--audit=strict` mode:** SKIP the prompt; jump directly to Step 9.6.2 (run the audit).
|
|
1904
|
+
|
|
1905
|
+
### Step 9.6.2 — Run the audit (when chosen or in strict mode)
|
|
1906
|
+
|
|
1907
|
+
Render:
|
|
1908
|
+
|
|
1909
|
+
```text
|
|
1910
|
+
Auditing recs + requirements against {N} declared anti-goal{s}…
|
|
1911
|
+
```
|
|
1912
|
+
|
|
1913
|
+
Call `mcp__ritual__audit_recommendations({ exploration_id })` with the default config (threshold mode, 80% acceptance threshold, max 3 iterations). The response shape:
|
|
1914
|
+
|
|
1915
|
+
```json
|
|
1916
|
+
{
|
|
1917
|
+
"chain_id": "ac-...",
|
|
1918
|
+
"audit_status": "ok" | "needs_attention" | "blocked",
|
|
1919
|
+
"iteration": 1,
|
|
1920
|
+
"findings": [
|
|
1921
|
+
{
|
|
1922
|
+
"repair_id": "ri-...",
|
|
1923
|
+
"after_audit_id": "...",
|
|
1924
|
+
"severity": "blocker" | "high" | "medium" | "low",
|
|
1925
|
+
"directive_text": "Audit log must be append-only.",
|
|
1926
|
+
"status": "inert" | "omitted" | "weakened" | "contradicted",
|
|
1927
|
+
"gap_kind": "global_inert" | "local_gap" | "weak_coupling" | "contradiction",
|
|
1928
|
+
"affected_entities": [{"entity_type": "recommendation", "entity_id": "..."}],
|
|
1929
|
+
"message": "Anti-goal #2 is referenced but not by the entity it most-applies-to — ...",
|
|
1930
|
+
"auto_dispatchable": true | false
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
"summary": {
|
|
1934
|
+
"total_constraints": 7,
|
|
1935
|
+
"survival_rate_percent": 57,
|
|
1936
|
+
"by_severity": { "blocker": 1, "high": 0, "medium": 2, "low": 0 },
|
|
1937
|
+
"by_gap_kind": { "global_inert": 1, "local_gap": 2, "weak_coupling": 0, "contradiction": 0 }
|
|
1938
|
+
},
|
|
1939
|
+
"decision_reason": "...",
|
|
1940
|
+
"attestation_digest": "sha256:...",
|
|
1941
|
+
"next_step_hint": "..."
|
|
1942
|
+
}
|
|
1943
|
+
```
|
|
1944
|
+
|
|
1945
|
+
### Step 9.6.3 — Render the findings + repair-action menu
|
|
1946
|
+
|
|
1947
|
+
Render based on `audit_status`:
|
|
1948
|
+
|
|
1949
|
+
**`audit_status: "ok"`** — survival rate met threshold AND no blockers. Render one line and proceed silently to Step 10:
|
|
1950
|
+
|
|
1951
|
+
```text
|
|
1952
|
+
✓ Audit passed: {survival_rate_percent}% of {total_constraints} anti-goals preserved. Chain accepted.
|
|
1953
|
+
```
|
|
1954
|
+
|
|
1955
|
+
**`audit_status: "needs_attention"` or `"blocked"`** — surface the findings inline so the user sees them before deciding:
|
|
1956
|
+
|
|
1957
|
+
```text
|
|
1958
|
+
⚠ Audit — {iteration} of {max_iterations} — {audit_status}
|
|
1959
|
+
|
|
1960
|
+
{survival_rate_percent}% of {total_constraints} anti-goals preserved.
|
|
1961
|
+
Findings ({findings.length} total):
|
|
1962
|
+
{for each finding, severity-prefixed (⛔ blocker / ⚠ high / · medium / · low):}
|
|
1963
|
+
{severity_glyph} {repair_id} — {directive_text}
|
|
1964
|
+
status: {status} · gap: {gap_kind} · affects: {affected_entities.length} entit{ies/y}
|
|
1965
|
+
{message[:120]}…
|
|
1966
|
+
|
|
1967
|
+
Reply:
|
|
1968
|
+
· `resolve all` — apply all auto-dispatchable repairs, re-audit
|
|
1969
|
+
(recommended — your config has blocker findings
|
|
1970
|
+
set to always_resolve)
|
|
1971
|
+
· `resolve {repair_id}` — apply a single repair (good for inspection)
|
|
1972
|
+
· `waive {repair_id}: <reason>`
|
|
1973
|
+
— record explicit acceptance of one finding;
|
|
1974
|
+
document the gap and continue
|
|
1975
|
+
· `accept` — accept current substrate, document all remaining
|
|
1976
|
+
findings as gaps (BLOCKED while any
|
|
1977
|
+
blocker-severity finding remains; the chain
|
|
1978
|
+
config enforces this)
|
|
1979
|
+
· `show chain` — render the full audit chain trail
|
|
1980
|
+
(calls get_audit_chain)
|
|
1981
|
+
· `pause` — stop here; resume via /ritual resume
|
|
1982
|
+
```
|
|
1983
|
+
|
|
1984
|
+
**On `resolve all`** — for each `auto_dispatchable: true` finding, call `mcp__ritual__apply_repair({ repair_id, chain_id, after_audit_id })`. Each call returns:
|
|
1985
|
+
|
|
1986
|
+
```json
|
|
1987
|
+
{
|
|
1988
|
+
"action_id": "ra-...",
|
|
1989
|
+
"action": "apply",
|
|
1990
|
+
"status": "applied",
|
|
1991
|
+
"next_iteration_id": "...",
|
|
1992
|
+
"hint": "Re-audit ran (SurvivalReport ...). Call get_audit_chain with chain_id=... to see the updated trail and whether the chain accepted."
|
|
1993
|
+
}
|
|
1994
|
+
```
|
|
1995
|
+
|
|
1996
|
+
Apply-repair is sequential per finding; the server runs the next audit iteration inline after each successful apply, so just call them in order. After the last `auto_dispatchable: true` finding, call `mcp__ritual__get_audit_chain({ chain_id })` to fetch the final state and re-render the loop UX with the new survival rate. If `chain_status === 'accepted'` after this round, proceed to Step 10; otherwise re-render the findings (the chain may have iterated and produced new findings the next iteration surfaces).
|
|
1997
|
+
|
|
1998
|
+
**On `resolve {repair_id}`** — single-finding apply. Same dispatch shape; render the next iteration's findings on completion.
|
|
1999
|
+
|
|
2000
|
+
**On `waive {repair_id}: <reason>`** — `apply_repair({ repair_id, chain_id, after_audit_id, action: 'waive', waive_reason: '<reason>' })`. No re-audit; render confirmation + return to the loop UX.
|
|
2001
|
+
|
|
2002
|
+
**On `accept`** — only allowed when no `blocker`-severity findings remain (the L1 tool returns `audit_status: "blocked"` while they do). Surface a single confirm: *"Accepting substrate with {findings.length} documented gap(s). Proceed?"* On yes, proceed to Step 10. The audit chain's final state is recorded; future `/ritual lineage` on this exploration surfaces the chain trail + the gaps the user explicitly accepted.
|
|
2003
|
+
|
|
2004
|
+
**On `show chain`** — render the full trail (iterations + repairs + status) from `get_audit_chain`. Keep it compact: one line per iteration + one line per repair. Then re-render the loop UX so the user can pick their next action.
|
|
2005
|
+
|
|
2006
|
+
**On `pause`** — stop here. Chain stays `in_progress`; resume via `/ritual resume`.
|
|
2007
|
+
|
|
2008
|
+
**On `halt_unresolvable`** (chain reached `max_iterations` with unresolved must-resolve findings) — the L1 tool returns `audit_status: "blocked"` and the chain is terminated. Surface:
|
|
2009
|
+
|
|
2010
|
+
```text
|
|
2011
|
+
⛔ Audit halted after {max_iterations} iterations — {n_blockers} blocker(s) unresolved.
|
|
2012
|
+
|
|
2013
|
+
The repair loop didn't converge. Options:
|
|
2014
|
+
· `extend max-iterations <N>` — re-run the audit with a higher cap (creates a new chain)
|
|
2015
|
+
· `force accept` — proceed to Step 10 with the substrate as-is; remaining
|
|
2016
|
+
blockers are recorded on the chain trail but no longer
|
|
2017
|
+
gate the build flow
|
|
2018
|
+
· `pause` — stop here for human review
|
|
2019
|
+
```
|
|
2020
|
+
|
|
2021
|
+
**Special: contradiction-class findings** — when a finding has `gap_kind: "contradiction"`, it surfaces as `auto_dispatchable: false`. The repair (`replace_recommendation`) IS implemented and CAN be applied via `apply_repair {repair_id}`, but `resolve all` skips it because replacing a rec is a structural change worth explicit user consent. The SKILL should render contradiction findings with an explicit "needs review" prefix:
|
|
2022
|
+
|
|
2023
|
+
```text
|
|
2024
|
+
⛔ {repair_id} — CONTRADICTION — {directive_text}
|
|
2025
|
+
A rec actively violates this directive. `replace_recommendation` will regenerate the rec
|
|
2026
|
+
under the constraint. Confirm by replying `resolve {repair_id}` explicitly.
|
|
2027
|
+
```
|
|
2028
|
+
|
|
2029
|
+
**Verifier-generator separation**: the audit's verifier model is automatically resolved by the server to a different family than whichever model generated the recs — agents don't need to manage this; it's enforced at the API. The audit's attestation digest records both model ids for post-hoc auditability.
|
|
2030
|
+
|
|
2031
|
+
#### Step 10 — Generate the build brief
|
|
2032
|
+
|
|
2033
|
+
The Build Brief is the markdown document the engineer reads RIGHT BEFORE writing code. It bridges accepted recommendations + synthesized requirements with the implementation. Sections:
|
|
2034
|
+
|
|
2035
|
+
- **READ THIS FIRST — These Will Block Review If Missing** (RB-numbered table of must-haves)
|
|
2036
|
+
- **Goal** (1-2 sentences, restated for code-time clarity)
|
|
2037
|
+
- **Required Outcomes** (specific, testable)
|
|
2038
|
+
- **Suggested Implementation** (high-level approach + the trade-offs the agent considered)
|
|
2039
|
+
- **Codebase Anchors** (file paths + existing patterns to extend, grounded in Step 3's recon)
|
|
2040
|
+
- **Previously Deferred — Worth Addressing?** (only present when `sources` overlap prior implementations with open deferrals)
|
|
2041
|
+
- **Phase Candidates / Deferrable Items** (what to intentionally punt for v2)
|
|
2042
|
+
|
|
2043
|
+
##### 10a — Call `generate_build_brief`
|
|
2044
|
+
|
|
2045
|
+
Call `mcp__ritual__generate_build_brief` with:
|
|
2046
|
+
|
|
2047
|
+
- `exploration_id`
|
|
2048
|
+
- `icp` (optional — defaults to the exploration template's primary ICP, then PM; pass `TECH_PM` for engineering-flavored explorations)
|
|
2049
|
+
- `recon_context` — the Step 3 `codebase_context_packet` plus any explicit phase/later candidates from discovery. Do not pass raw recon notes. This grounds "Codebase Anchors" in real file paths while keeping agent hypotheses auditable and non-authoritative.
|
|
2050
|
+
- `sources` — the **same** file-path array passed to `generate_considerations` and `generate_problem_statement` in Steps 4–5. Critical for KG consistency: the brief's "Previously Deferred" section only populates when overlapping prior implementations exist on these files.
|
|
2051
|
+
|
|
2052
|
+
Returns **immediately** with `status: 'GENERATING'` (synthesis runs in the background — poll per Step 10b) UNLESS it's a cache hit, which returns `status: 'READY'` with the brief markdown directly. The brief is **idempotent on (exploration, icp)** — same recommendation+requirement hashes return the cached READY row. Pass `force: true` only when a prompt-version update requires re-generation (also returns `GENERATING` → poll).
|
|
2053
|
+
|
|
2054
|
+
##### 10b — Status polling (CLI Tenet #8)
|
|
2055
|
+
|
|
2056
|
+
`generate_build_brief` is **fire-and-poll**: it returns almost immediately with `status: 'GENERATING'` (the synthesis runs server-side in the background) — NOT the finished brief. A cache hit returns `status: 'READY'` directly; treat that as done. So you no longer wait on a local timeout — you poll the status from the start.
|
|
2057
|
+
|
|
2058
|
+
**Don't treat the GENERATING response as the brief, and don't re-call generate to "check".** Poll the status:
|
|
2059
|
+
|
|
2060
|
+
1. After `generate_build_brief` returns `GENERATING` (or on the rare local timeout), call `mcp__ritual__get_build_brief_status(exploration_id, icp)`.
|
|
2061
|
+
2. Poll using the standard async polling rule: one `Bash sleep 5` per poll iteration, then a fresh status call. Print a brief "still generating…" update every ~3 polls when the status is unchanged.
|
|
2062
|
+
3. Exit conditions:
|
|
2063
|
+
|
|
2064
|
+
| Response | Action |
|
|
2065
|
+
|---|---|
|
|
2066
|
+
| `exists === false` for 3+ polls | The fire-and-forget never landed — try calling `generate_build_brief` once more (it will likely succeed now that requirements are ready). |
|
|
2067
|
+
| `status === 'GENERATING'` | Keep polling. |
|
|
2068
|
+
| `status === 'READY'` | Read `content` field — proceed to Step 10c as if generate had completed. |
|
|
2069
|
+
| `status === 'FAILED'` | Surface `errorMessage` to the user. Propose a single action (CLI Tenet #2): *"The brief failed: {errorMessage}. Retry with a fresh generation? (y/N)"*. On yes: call `generate_build_brief` again with `force: true`. |
|
|
2070
|
+
|
|
2071
|
+
You can ALSO call `get_build_brief_status` **proactively** before `generate_build_brief` — if `exists === true && status === 'READY'` and the hashes haven't changed, you've saved a write-tool roundtrip. Tradeoff: tiny read cost for skipping a maybe-slow write.
|
|
2072
|
+
|
|
2073
|
+
##### 10b.5 — Verify brief assertions against the actual code
|
|
2074
|
+
|
|
2075
|
+
**This step is mandatory, not opt-in.** The brief generator runs server-side and does NOT have repo access — it writes assertions about cited files / functions / classes based on the agent's earlier recon summary (which is text, not code). Brief assertions that contradict the actual code are invisible to the brief generator AND to the user reading the brief. Step 10b.5 closes that gap before the user is asked to approve the brief at Step 10d.
|
|
2076
|
+
|
|
2077
|
+
This step is **SKILL-only — no MCP tool, no LLM cost on Ritual's API.** The verification happens locally in the calling agent because the agent is the one with repo access. The canonical instruction set is at `references/brief-verification-checklist.md` (methodology + output schema + worked example). This Step 10b.5 prose is the thin orchestration layer.
|
|
2078
|
+
|
|
2079
|
+
Steps:
|
|
2080
|
+
|
|
2081
|
+
1. **Tell the user what's about to happen** (one line, not a multi-line pre-roll):
|
|
2082
|
+
|
|
2083
|
+
> Verifying brief assertions against the actual codebase. Reading cited functions / classes / files, comparing against the brief's claims — about 20–60 seconds.
|
|
2084
|
+
|
|
2085
|
+
2. **Read `references/brief-verification-checklist.md`** for the methodology, output schema, and verdict definitions. **Walk the methodology in order — do NOT skip to the output schema.**
|
|
2086
|
+
|
|
2087
|
+
3. **Read `BUILD-BRIEF.md`** (the version just generated in Step 10a/10b but NOT YET written to disk — keep it in-memory; you'll write to disk AFTER verification at Step 10c). Extract every specific code citation: symbol + file + assertion. Cap at 15 citations (highest-leverage first).
|
|
2088
|
+
|
|
2089
|
+
4. **For each citation, read the actual code** via Grep / Glob / Read. Assign a verdict per citation:
|
|
2090
|
+
- `verified` — brief claim matches the code.
|
|
2091
|
+
- `contradicted` — brief claim is wrong; the code does something different.
|
|
2092
|
+
- `not_found` — symbol couldn't be located.
|
|
2093
|
+
|
|
2094
|
+
5. **Write `BUILD-BRIEF-VERIFICATION.md`** to disk alongside `BUILD-BRIEF.md` using the schema in `references/brief-verification-checklist.md`. Cite file + line range + actual code snippet on every contradiction. Do not fabricate evidence.
|
|
2095
|
+
|
|
2096
|
+
6. **Sync the verification to Ritual's KG** — call `mcp__ritual__sync_brief_review` with:
|
|
2097
|
+
|
|
2098
|
+
```
|
|
2099
|
+
{
|
|
2100
|
+
exploration_id,
|
|
2101
|
+
review_type: 'BRIEF_VERIFICATION',
|
|
2102
|
+
content: <full BUILD-BRIEF-VERIFICATION.md markdown>,
|
|
2103
|
+
cited_files: <union of every file path cited across the verification>,
|
|
2104
|
+
}
|
|
2105
|
+
```
|
|
2106
|
+
|
|
2107
|
+
This persists the verification as a durable `BriefReview` row attached to the exploration. Future briefs on overlapping files will inherit the verified facts via `priorContext`; `/ritual lineage` on any cited file will surface this verification.
|
|
2108
|
+
|
|
2109
|
+
7. **Print a compact CLI summary** (≤ 8 lines, CLI Tenet #1, #6):
|
|
2110
|
+
|
|
2111
|
+
```text
|
|
2112
|
+
✓ Verification complete — `BUILD-BRIEF-VERIFICATION.md` on disk; synced to KG.
|
|
2113
|
+
|
|
2114
|
+
Verified: {N} · Contradicted: {M} · Not found: {K}
|
|
2115
|
+
|
|
2116
|
+
{If M > 0:}
|
|
2117
|
+
Top contradictions:
|
|
2118
|
+
⚠ {cited_symbol} — brief says "{brief_assertion[0:60]}…"
|
|
2119
|
+
actual: "{code_reality[0:60]}…"
|
|
2120
|
+
⚠ {next contradiction, if M > 1}
|
|
2121
|
+
```
|
|
2122
|
+
|
|
2123
|
+
Rules:
|
|
2124
|
+
- **If M = 0 AND K = 0:** print one line, *"✓ Verification complete — N citations checked, all verified. `BUILD-BRIEF-VERIFICATION.md` synced."*
|
|
2125
|
+
- **If M > 0:** print up to 3 top contradictions inline; rest are in the file. At the Step 10d gate, surface the contradictions count + note that plan mode will read them via KG priorContext.
|
|
2126
|
+
- **If brief made zero citations:** print *"✓ Verification skipped — the brief makes no specific code citations to verify."* Skip the sync call (nothing to persist). Proceed to Step 10c.
|
|
2127
|
+
|
|
2128
|
+
8. **Continue to Step 10c** with `BUILD-BRIEF.md` + `BUILD-BRIEF-VERIFICATION.md` both ready to write to disk and the verification synced to KG.
|
|
2129
|
+
|
|
2130
|
+
**Step 10d integration:** when contradictions exist, Step 10d's gate prepends an inline summary so the user sees *what the agent learned about the brief* before they decide whether to proceed. The brief itself is NOT rewritten — it stays the historical artifact Ritual generated. The KG carries the truth via the synced `BriefReview` row, and **plan mode (Step 11.1) reads the brief + KG-persisted reviews via `priorContext`** so the implementation incorporates the corrections without the brief content needing to change.
|
|
2131
|
+
|
|
2132
|
+
**Anti-patterns:**
|
|
2133
|
+
|
|
2134
|
+
- ❌ Skipping Step 10b.5 because "the brief looks fine." Brief-quality is invisible from reading the brief alone — the verification compares against the code.
|
|
2135
|
+
- ❌ Treating the brief's hedge ("*may deviate if codebase has a stronger pattern*") as license to skip. The hedge means *"go verify"* — exactly what this step does.
|
|
2136
|
+
- ❌ Padding the `verified` list. Only enumerate citations the brief actually made.
|
|
2137
|
+
- ❌ Re-writing the brief at Step 10b.5. The verification produces findings; the brief stays as-is. Plan mode reconciles via KG priorContext.
|
|
2138
|
+
- ❌ Skipping the `sync_brief_review` call. The local `BUILD-BRIEF-VERIFICATION.md` alone benefits this session only; the KG sync is what lets future briefs on overlapping files inherit the verified facts.
|
|
2139
|
+
|
|
2140
|
+
##### 10c — Write to `BUILD-BRIEF.md` + CLI summary (CLI Tenet #1, #5)
|
|
2141
|
+
|
|
2142
|
+
When the brief content is in hand (from generate OR polling), **don't dump 300 lines of markdown into the terminal**. The brief belongs in a file the user can open, search, share, and revisit; the CLI surface is for the decision.
|
|
2143
|
+
|
|
2144
|
+
1. **Write the markdown to `BUILD-BRIEF.md`** in the repo root (or `.ritual/BUILD-BRIEF.md` if the repo prefers tooling artifacts out of the top level — check `.gitignore` first). Prepend a Ritual attribution header before writing:
|
|
2145
|
+
|
|
2146
|
+
```markdown
|
|
2147
|
+
<!--
|
|
2148
|
+
Generated by Ritual
|
|
2149
|
+
Exploration: https://app.ritualapp.cloud/e/{exploration_id}
|
|
2150
|
+
Build brief id: {brief_id}
|
|
2151
|
+
Do not remove this header; it preserves implementation lineage.
|
|
2152
|
+
-->
|
|
2153
|
+
```
|
|
2154
|
+
|
|
2155
|
+
If a `BUILD-BRIEF.md` already exists:
|
|
2156
|
+
- **Same exploration** (recommendationsHash matches the cached row): silent overwrite + one-line note in the summary that you refreshed it.
|
|
2157
|
+
- **Different exploration**: surface a confirm: *"A `BUILD-BRIEF.md` already exists from exploration `{previous_exploration_name}`. Overwrite with brief for `{this_exploration_name}`? (y/N, or save-to-`BUILD-BRIEF-{slug}.md`)"*. (CLI Tenet #11 — confirm before destructive.)
|
|
2158
|
+
|
|
2159
|
+
2. **Print a compact CLI summary** — the top-of-mind information, the verification result, plus a single line pointing at the file:
|
|
2160
|
+
|
|
2161
|
+
```
|
|
2162
|
+
✓ Build brief ready — discovery has become an implementation path.
|
|
2163
|
+
|
|
2164
|
+
Signal: {N} accepted recommendations were converted into {M} code-time requirements.
|
|
2165
|
+
File: BUILD-BRIEF.md ({line_count} lines, {file_kb_size} KB)
|
|
2166
|
+
Verification: {V} verified · {C} contradicted · {NF} not found (from Step 10b.5; see BUILD-BRIEF-VERIFICATION.md)
|
|
2167
|
+
|
|
2168
|
+
Goal: {first line of Goal section, ≤ 100 chars}
|
|
2169
|
+
|
|
2170
|
+
Top review-blockers (must address):
|
|
2171
|
+
RB-001 — {RB-001 title} → {one-line "what's required"}
|
|
2172
|
+
RB-002 — {RB-002 title} → {one-line "what's required"}
|
|
2173
|
+
RB-003 — {RB-003 title} → {one-line "what's required"}
|
|
2174
|
+
|
|
2175
|
+
Top codebase anchors:
|
|
2176
|
+
{path1} — {pattern to extend, ≤ 60 chars}
|
|
2177
|
+
{path2} — {pattern to extend, ≤ 60 chars}
|
|
2178
|
+
{path3} — {pattern to extend, ≤ 60 chars}
|
|
2179
|
+
|
|
2180
|
+
{ONLY IF Previously Deferred section is non-empty:}
|
|
2181
|
+
⚠ {N} previously-deferred item{s} overlap this scope — see "Previously Deferred" section in BUILD-BRIEF.md
|
|
2182
|
+
```
|
|
2183
|
+
|
|
2184
|
+
Rules for the summary (CLI Tenets #3, #6):
|
|
2185
|
+
- **The `Verification:` line is mandatory** — render the actual numbers from Step 10b.5. If 10b.5 was legitimately skipped (brief made zero specific code citations), render `Verification: n/a — brief made no code citations to verify` instead of omitting the line. The line existing-but-zero is fine; the line being MISSING is a structural signal that 10b.5 was skipped without justification. Reviewing this summary should let the user (and a future SKILL self-check) catch a skipped-verification regression by spotting the missing line. The 2026-05-21 demo regression was Step 10b.5 silently skipped on a brief that cited `AbstractCommunicationEventType`, `utils.py Dispatcher`, `notify_user()`, and `oscar_send_alerts.py` — exactly the case 10b.5 is supposed to verify.
|
|
2186
|
+
- **Cap RBs and anchors at top 3 each.** Engineers don't read 12-row tables in terminals.
|
|
2187
|
+
- **Omit any section that's empty.** No "Previously Deferred: none" lines — just don't render that line. (The `Verification:` line is exempt — it's always rendered, see above.)
|
|
2188
|
+
- If `kgContextUsed.implementationCount > 0`, append one line above the goal: *"Grounded in {N} prior implementation{s}: {top match name}, …"* (CLI Tenet #4 — cite the specific signal).
|
|
2189
|
+
|
|
2190
|
+
3. **Offer to open the file** (CLI Tenet #10 — OS-aware affordances, available not mandatory):
|
|
2191
|
+
|
|
2192
|
+
```bash
|
|
2193
|
+
# Detect, in order: VS Code on PATH, JetBrains `idea` on PATH, $EDITOR set, macOS `open` available.
|
|
2194
|
+
command -v code >/dev/null && code BUILD-BRIEF.md
|
|
2195
|
+
command -v idea >/dev/null && idea BUILD-BRIEF.md
|
|
2196
|
+
[ -n "$EDITOR" ] && "$EDITOR" BUILD-BRIEF.md
|
|
2197
|
+
command -v open >/dev/null && open BUILD-BRIEF.md # macOS
|
|
2198
|
+
```
|
|
2199
|
+
|
|
2200
|
+
If any of these are detectable, offer: *"Open `BUILD-BRIEF.md` in your editor? (y/N)"* — single yes/no, never a 4-way picker. If none are detectable, omit the offer entirely; the path is still clickable in most terminals.
|
|
2201
|
+
|
|
2202
|
+
##### 10d — Confirm and proceed (CLI Tenet #2, #12)
|
|
2203
|
+
|
|
2204
|
+
End Step 10 with a single recommended action plus a cheap escape hatch — never a 3-way option bloom.
|
|
2205
|
+
|
|
2206
|
+
**Rendering contract (load-bearing — see SKILL.md § Contract strength):** the user-facing block below is **verbatim**. Render the text inside the fenced block exactly as written — same option names (`go`, `drill {N}`, `ux-review`, `pause`), same one-line descriptions, same order, same connector word ("Before `go`, you can run `ux-review`…"). Do NOT paraphrase to "implement", "sync", "hold", "ship", or any other reworded synonyms. Do NOT collapse the option list. Do NOT add or omit options. The 2026-05-21 demo regression was an agent rendering `Reply implement / sync / hold` instead of this block — three different options, two with different semantics than the SKILL intends (`sync` ≠ `pause`). The contract-strength rule in SKILL.md is the backstop; this notice is the local reminder.
|
|
2207
|
+
|
|
2208
|
+
```text
|
|
2209
|
+
Ritual build
|
|
2210
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ● Build brief ○ Implementation (Your agent)
|
|
2211
|
+
|
|
2212
|
+
Build brief ready
|
|
2213
|
+
|
|
2214
|
+
`BUILD-BRIEF.md` is on disk. Skim the RBs + anchors, then decide:
|
|
2215
|
+
|
|
2216
|
+
· `go` — ready to implement; move to coding
|
|
2217
|
+
· `drill {N}` — drill into RB-{N} before deciding
|
|
2218
|
+
|
|
2219
|
+
Before `go`, you can run `ux-review` for a design-quality pass on the brief (recommended for UI/UX features — produces `UX-REVIEW.md` and a tailored plan-mode prompt so plan mode stops asking you the same UX questions it always does). Reply `pause` to stop here.
|
|
2220
|
+
```
|
|
2221
|
+
|
|
2222
|
+
Branch by user response. The CTA on screen is `go`, but accept these as synonyms so a user typing the obvious intent doesn't get penalized for word choice:
|
|
2223
|
+
|
|
2224
|
+
- **`go` / `y` / `yes` / `proceed` / `continue` / `next` / `implement` / `ship`**: continue to Step 11. Plan mode will read `BUILD-BRIEF.md` + any synced reviews (verify-brief from Step 10b.5; UX review from Step 10.5 if it ran) via KG `priorContext`. If verify-brief produced contradictions, plan mode picks them up there — the brief content itself stays as Ritual's historical artifact. (Synonyms accepted because the agent's drift to "Reply `implement`" trained users to type that word; until the verbatim rendering enforcement is fully reliable, treat user input charitably.)
|
|
2225
|
+
- **`ux-review` / `review` / `ux`**: continue to Step 10.5 (writes `UX-REVIEW.md`, syncs it to KG via `sync_brief_review`, then continues to Step 11 with the tailored plan-mode prompt). Opt-in; absence is the existing path.
|
|
2226
|
+
- **`drill {N}`**: open RB-{N} in the markdown, discuss inline, then loop back to the gate above.
|
|
2227
|
+
- **`pause`** / `hold` / `stop`: stop here. The brief is on disk; the user can resume with `/ritual resume`.
|
|
2228
|
+
|
|
2229
|
+
**No `refine` action at Step 10d.** The brief is read-only after generation. Two reasons:
|
|
2230
|
+
|
|
2231
|
+
1. **Verification findings reach plan mode via KG, not via brief rewrites.** Step 10b.5 syncs `BriefReview` rows via `sync_brief_review`; plan mode reads them via `priorContext`. Re-rewriting the brief content adds LLM cost for zero implementation-correctness gain — the implementation is governed by plan mode + KG, not by the brief text itself.
|
|
2232
|
+
2. **The brief stays as the historical record** of what Ritual generated. If the user wants new content (because underlying recs / requirements actually changed), call `generate_build_brief` with `force: true` — that's full regen with new source data. Don't conflate that with editing existing brief content.
|
|
2233
|
+
|
|
2234
|
+
**Pulse (Step 10 done):** Emit a pulse — this often crosses into **Implementation-ready** (90%+). Render full when that crossing happens. Use the build-brief celebration line: `✓ Build brief ready — discovery has become an implementation path.` If still below 90% (e.g. brief flagged residual debt), surface that in the pulse line itself and propose addressing it before coding.
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
#### Step 11 — Implement
|
|
2238
|
+
|
|
2239
|
+
This step happens **inside** the same `/ritual build` chat if the agent is also the coding agent (Claude Code / Cursor / etc.), or hand-off if the user is implementing themselves.
|
|
2240
|
+
|
|
2241
|
+
The Implementation phase landing — full rail (the rail moves to Implementation for the first time):
|
|
2242
|
+
|
|
2243
|
+
```text
|
|
2244
|
+
Ritual build
|
|
2245
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ✓ Build brief ● Implementation (Your agent)
|
|
2246
|
+
|
|
2247
|
+
Implementation (Your agent)
|
|
2248
|
+
|
|
2249
|
+
The build brief is on disk. From here, your agent codes against the
|
|
2250
|
+
RB list. Ritual will track commits via the `Ritual-Exploration:` trailer
|
|
2251
|
+
so they link back to this exploration when you sync.
|
|
2252
|
+
|
|
2253
|
+
Next: I'll do a quick branch / dirty-worktree safety check, then hand
|
|
2254
|
+
off to your agent's plan mode so the first pass is a plan grounded
|
|
2255
|
+
in BUILD-BRIEF.md — not file edits.
|
|
2256
|
+
```
|
|
2257
|
+
|
|
2258
|
+
##### 11.0 — Branch strategy (CLI Tenet #13)
|
|
2259
|
+
|
|
2260
|
+
**Never commit to `main` / `master` from an agent workflow.** Before writing a single line of code:
|
|
2261
|
+
|
|
2262
|
+
1. Check for uncommitted user work:
|
|
2263
|
+
```bash
|
|
2264
|
+
git status --porcelain
|
|
2265
|
+
```
|
|
2266
|
+
If there are unrelated user changes, pause before editing and ask whether to keep working on this branch, stash, or abort. Do not overwrite or mix with user work silently.
|
|
2267
|
+
|
|
2268
|
+
2. Check the current branch:
|
|
2269
|
+
```bash
|
|
2270
|
+
git branch --show-current
|
|
2271
|
+
```
|
|
2272
|
+
|
|
2273
|
+
3. If on `main` / `master` / `trunk` / `develop` (or any branch named in the repo's default-branch protections): **create a feature branch FIRST.** Do not ask whether to commit to trunk. Branch creation is free and reversible. Naming heuristic:
|
|
2274
|
+
- `feat/<exploration-slug>` when the slug is short (≤ 4 words)
|
|
2275
|
+
- `ritual/<exploration-short-id>` as a fallback (e.g. `ritual/exp-7a2b9c`)
|
|
2276
|
+
- If the user already named one in chat ("call it `feat/conversions-tracking`"), use that.
|
|
2277
|
+
|
|
2278
|
+
User-visible:
|
|
2279
|
+
|
|
2280
|
+
> Created branch `{branch}` for this Ritual implementation.
|
|
2281
|
+
> Override with `branch: <name>` before implementation begins.
|
|
2282
|
+
|
|
2283
|
+
4. If already on a feature branch and the working tree is clean or only contains this flow's changes: stay there. Don't switch.
|
|
2284
|
+
|
|
2285
|
+
**Never offer "commit to `main` directly" as an option in any user prompt.**
|
|
2286
|
+
|
|
2287
|
+
##### 11.0.5 — Plan-mode handoff (load-bearing — [USER PAUSE])
|
|
2288
|
+
|
|
2289
|
+
**Branch is created, working tree is safe — now hand off to plan mode.** Plan mode is user-invoked (the agent can't toggle it programmatically in Claude Code / Cursor / etc.), so without an explicit prompt the implementation phase starts with the agent improvising file edits instead of producing a reviewable plan grounded in `BUILD-BRIEF.md`. This step happens AFTER branch creation (Step 11.0) because plan mode in Claude Code blocks Bash, so branch creation has to happen first.
|
|
2290
|
+
|
|
2291
|
+
**Rendering contract — verbatim:**
|
|
2292
|
+
|
|
2293
|
+
```text
|
|
2294
|
+
Branch ready. Switch your agent into plan mode so the first pass is
|
|
2295
|
+
a plan grounded in BUILD-BRIEF.md, not file edits.
|
|
2296
|
+
|
|
2297
|
+
· Claude Code: press Shift+Tab to cycle to "plan mode" (footer shows
|
|
2298
|
+
"plan mode" instead of "default" or "auto-accept edits")
|
|
2299
|
+
· Cursor: open Composer → toggle to "Plan" mode
|
|
2300
|
+
· Other agents: equivalent "plan / propose-only" mode if available;
|
|
2301
|
+
otherwise reply `skip` and I'll continue without
|
|
2302
|
+
|
|
2303
|
+
Reply `ready` once you're in plan mode (or `skip` if your agent has no
|
|
2304
|
+
plan-mode equivalent). I'll load BUILD-BRIEF.md (and BUILD-BRIEF-
|
|
2305
|
+
VERIFICATION.md / UX-REVIEW.md if present) as the FIRST inputs and
|
|
2306
|
+
produce a numbered plan you can review before any file is edited.
|
|
2307
|
+
```
|
|
2308
|
+
|
|
2309
|
+
[USER PAUSE] Branch on response:
|
|
2310
|
+
|
|
2311
|
+
- **`ready`**: continue to Step 11.1 (plan generation).
|
|
2312
|
+
- **`skip`**: log a one-line note ("Plan mode skipped — agent has no plan-mode equivalent or user opted out. Proceeding directly to implement; risk: less reviewable first pass.") and skip Step 11.1 + 11.1.5, jumping straight to Step 11.2 (implement). This is an escape hatch, not the default.
|
|
2313
|
+
- Any other response: re-render the prompt once. If still not `ready` / `skip` after two tries, default to `skip` with the warning line.
|
|
2314
|
+
|
|
2315
|
+
**Why this is load-bearing:**
|
|
2316
|
+
|
|
2317
|
+
1. Plan mode is the only mechanism that produces a reviewable plan BEFORE file edits. Skipping it means the user is reviewing a diff, not a plan — a more expensive correction loop.
|
|
2318
|
+
2. `BUILD-BRIEF-VERIFICATION.md` contradictions are most valuable when they become explicit plan constraints, not when they're discovered during implementation.
|
|
2319
|
+
3. Without an explicit prompt, the agent typically goes straight from "build brief ready" to file edits — observed regression during 2026-05-21 demo testing.
|
|
2320
|
+
|
|
2321
|
+
##### 11.1 — Plan mode generates the implementation plan
|
|
2322
|
+
|
|
2323
|
+
The user is now in plan mode (from Step 11.0.5). The agent must:
|
|
2324
|
+
|
|
2325
|
+
1. **Load `BUILD-BRIEF.md`** as the first input. If `BUILD-BRIEF-VERIFICATION.md` exists, load it too — every `contradicted` and `not_found` entry becomes an explicit constraint in the plan ("the brief claimed X but the code does Y; the plan must reconcile / not assume X"). If `UX-REVIEW.md` exists alongside `BUILD-BRIEF.md` (the user opted into Step 10.5), use the "Plan Mode Prompt" block at its bottom as the FIRST input — its numbered list of mismatches / gaps / new-work surfaces is the tailored agenda. The generic plan-mode template is the fallback for when only the brief exists.
|
|
2326
|
+
|
|
2327
|
+
2. **Load the SCOPE CONTRACT as hard constraints (the load-bearing step — prevention, not just detection).** The brief read (`get_build_brief_status` → `scopeContractResolved`, or the `generate_build_brief` response) carries the SAME typed contract Ritual will audit your plan against at Step 11.1.6. Treat it as binding and put it at the TOP of the plan-mode prompt verbatim:
|
|
2328
|
+
|
|
2329
|
+
> **Scope contract — your plan must honour this (it will be audited):**
|
|
2330
|
+
> - **MUST cover** (one or more plan steps each, and cite the requirement): {each `scopeContractResolved.inScope[].text`}
|
|
2331
|
+
> - **Do NOT implement — deferred to a LATER PR** (out of scope for this change): {each `deferred[].text`}
|
|
2332
|
+
> - **Do NOT cross — non-goals**: {each `antiGoals[].text`}
|
|
2333
|
+
> - **Open questions — do NOT silently implement; flag if you must touch**: {each `discoveryGates[].text`}
|
|
2334
|
+
|
|
2335
|
+
This is what makes plan mode deliver on the promise of the brief (which delivers on the recs). Feeding the contract in UP FRONT prevents the divergences Step 11.1.6 would otherwise have to catch and send back.
|
|
2336
|
+
|
|
2337
|
+
3. **Produce a numbered implementation plan** that:
|
|
2338
|
+
- has **one or more steps covering EVERY in-scope requirement** above (map each step to the requirement id it implements — this is the coverage the audit checks),
|
|
2339
|
+
- implements **none** of the deferred items and crosses **none** of the non-goals,
|
|
2340
|
+
- puts the RBs, any verification contradictions, and any UX "new work" surfaces at the top,
|
|
2341
|
+
- names the specific files / functions / new modules each step touches — concrete enough that the user can spot a mistake before any edit.
|
|
2342
|
+
|
|
2343
|
+
4. **Stay in plan mode until the user accepts the plan.** Do NOT switch to edit/auto-accept mode until the user explicitly approves the plan in plan mode (Claude Code's "accept plan" affordance, or the user typing `accept` / `looks good` / `go`).
|
|
2344
|
+
|
|
2345
|
+
##### 11.1.5 — Optional: save the implementation plan as a markdown artifact
|
|
2346
|
+
|
|
2347
|
+
After plan mode produces the implementation plan, **but before any code edits**, ask whether to save it.
|
|
2348
|
+
|
|
2349
|
+
**Rendering contract — verbatim:**
|
|
2350
|
+
|
|
2351
|
+
```text
|
|
2352
|
+
Plan ready
|
|
2353
|
+
|
|
2354
|
+
Your agent generated an implementation plan from BUILD-BRIEF.md
|
|
2355
|
+
{and BUILD-BRIEF-VERIFICATION.md / UX-REVIEW.md if those exist}.
|
|
2356
|
+
|
|
2357
|
+
Save this plan to `IMPLEMENTATION-PLAN.md` before coding? (y/N)
|
|
2358
|
+
```
|
|
2359
|
+
|
|
2360
|
+
[USER PAUSE] Branch on response (default is no — not every plan is worth committing):
|
|
2361
|
+
|
|
2362
|
+
- **`y` / `yes` / `save`**: write `IMPLEMENTATION-PLAN.md` alongside `BUILD-BRIEF.md` in the repo root (or `.ritual/IMPLEMENTATION-PLAN.md` if the repo prefers tooling artifacts out of the top level — check `.gitignore` first). Prepend the Ritual attribution header:
|
|
2363
|
+
|
|
2364
|
+
```markdown
|
|
2365
|
+
<!--
|
|
2366
|
+
Generated by Ritual via plan mode
|
|
2367
|
+
Exploration: https://app.ritualapp.cloud/e/{exploration_id}
|
|
2368
|
+
Build brief: BUILD-BRIEF.md (Ritual requirements)
|
|
2369
|
+
This file: agent's concrete execution strategy
|
|
2370
|
+
Do not remove this header; it preserves implementation lineage.
|
|
2371
|
+
-->
|
|
2372
|
+
```
|
|
2373
|
+
|
|
2374
|
+
Then continue to Step 11.2.
|
|
2375
|
+
- anything else (`n` / `no` / empty / any other text): continue to Step 11.2 without writing the file. Do not re-prompt.
|
|
2376
|
+
|
|
2377
|
+
**Rules:**
|
|
2378
|
+
|
|
2379
|
+
- **Do not ask this before plan mode has produced the plan.** The question is for the assembled plan, not "do you want me to write a plan in advance."
|
|
2380
|
+
- **Do not dump the full plan into the chat when saving.** The plan markdown belongs in the file the user can open, search, share, and revisit — same pattern as `BUILD-BRIEF.md` and `BUILD-BRIEF-VERIFICATION.md` (CLI Tenet #1 — files for detail, CLI for decisions).
|
|
2381
|
+
- **Default is `no`** — explicit `y` is required. Most quick implementations don't need a committed plan; saving by default would clutter the repo.
|
|
2382
|
+
- If the user later opens the PR (Step 11.5), include `IMPLEMENTATION-PLAN.md` in the PR body's Exploration section if it was saved (see Step 11.5 template).
|
|
2383
|
+
|
|
2384
|
+
**Why this matters:** `BUILD-BRIEF.md` is the Ritual requirements artifact (what + why). `IMPLEMENTATION-PLAN.md` is the agent's concrete execution strategy (how). For non-trivial implementations, saving both gives reviewers a useful bridge from requirement to code — and gives `/ritual lineage` queries a richer trail to surface on future builds touching the same files.
|
|
2385
|
+
|
|
2386
|
+
##### 11.2 — Implement
|
|
2387
|
+
|
|
2388
|
+
1. Use the standard coding-loop tools (Edit/Write/Bash/etc.) to execute the accepted plan.
|
|
2389
|
+
2. Run tests, lint, build per the repo's conventions.
|
|
2390
|
+
3. Track each architectural decision as you go — the input to Step 12's `sync_implementation` call. Per decision, write down: `area`, `choice`, `alternatives_considered`, `rationale`, `source_recommendation_id` (the RB-N or recommendation id the decision implements). This is what makes lineage queryable later — don't skip it.
|
|
2391
|
+
|
|
2392
|
+
##### 11.3 — Commit (CLI Tenet #14 — Ritual attribution)
|
|
2393
|
+
|
|
2394
|
+
Commit on the feature branch from Step 11.0. One-or-many commits is fine; conventional-commit prefixes preferred (`feat:`, `fix:`, `test:`, etc.). Include a Ritual footer on the FINAL commit of the implementation so the trace from code → exploration is visible in `git log`:
|
|
2395
|
+
|
|
2396
|
+
```
|
|
2397
|
+
feat(<area>): <one-line headline>
|
|
2398
|
+
|
|
2399
|
+
<short body — what changed, why, key trade-off>
|
|
2400
|
+
|
|
2401
|
+
Ritual-Exploration: <exploration_id>
|
|
2402
|
+
Ritual-Exploration-Url: https://app.ritualapp.cloud/e/<exploration_id>
|
|
2403
|
+
Ritual-RBs-Satisfied: RB-1, RB-2, RB-7
|
|
2404
|
+
```
|
|
2405
|
+
|
|
2406
|
+
Intermediate commits can skip the footer. The final commit IS the linkage anchor.
|
|
2407
|
+
|
|
2408
|
+
##### 11.4 — Post-implementation summary (CLI Tenet #1 — files for detail, CLI for decisions)
|
|
2409
|
+
|
|
2410
|
+
**Don't dump a per-file changelog into the chat.** The full diff lives in `git diff <branch>..HEAD` and the eventual PR body. The CLI summary should be **≤ 8 lines** and surface only what's load-bearing for the user's next decision:
|
|
2411
|
+
|
|
2412
|
+
```
|
|
2413
|
+
✓ Implementation done (your agent) — {exploration name}
|
|
2414
|
+
Branch: {branch}, {N} commits, {M} files changed
|
|
2415
|
+
Tests: {tests_added} added, all passing
|
|
2416
|
+
RBs satisfied: {comma-joined list of RB-N from the brief, ALL or a count}
|
|
2417
|
+
Open deferrals logged for Step 12: {count}
|
|
2418
|
+
|
|
2419
|
+
Next: push + open PR? (y / show me what changed / abort)
|
|
2420
|
+
```
|
|
2421
|
+
|
|
2422
|
+
If the user picks "show me what changed", THEN run `git diff --stat HEAD~N..HEAD` or open per-file diffs interactively — on request, not by default.
|
|
2423
|
+
|
|
2424
|
+
##### 11.5 — Push + PR (single recommended action)
|
|
2425
|
+
|
|
2426
|
+
If the user says "y" / "push" / "open PR":
|
|
2427
|
+
|
|
2428
|
+
1. `git push -u origin <branch>` (single command, no `--force` ever in this flow).
|
|
2429
|
+
2. Build the PR body from the template below (CLI Tenet #14).
|
|
2430
|
+
3. `gh pr create --base <default-branch> --title <…> --body <…>`.
|
|
2431
|
+
4. Surface the PR URL to the user.
|
|
2432
|
+
|
|
2433
|
+
**Write the PR body for a maintainer who has never heard of Ritual.** Lead with what changed, *where to look* (in review order), *why*, and *how to verify* — so a reviewer can move fast and trust the change. Ritual lineage goes at the bottom, not the top. Fill every section from real artifacts (brief decisions, the diff, the test files); never leave a `<placeholder>` in the posted body.
|
|
2434
|
+
|
|
2435
|
+
**PR body template:**
|
|
2436
|
+
|
|
2437
|
+
```markdown
|
|
2438
|
+
## What this PR does
|
|
2439
|
+
|
|
2440
|
+
<2-3 plain sentences: the change + the problem it solves, derived from the build brief's Goal>
|
|
2441
|
+
|
|
2442
|
+
## Where to look (review order)
|
|
2443
|
+
|
|
2444
|
+
1. `<path>` — <the load-bearing change; start here>
|
|
2445
|
+
2. `<path>` — <how it integrates>
|
|
2446
|
+
3. `<path>` — <schema/data changes, if any>
|
|
2447
|
+
<ordered load-bearing → plumbing, so review time goes where it matters>
|
|
2448
|
+
|
|
2449
|
+
## Why / key decisions
|
|
2450
|
+
|
|
2451
|
+
- <decision + the trade-off / alternative rejected — the 1-3 calls a reviewer might second-guess, taken from the brief's decisions>
|
|
2452
|
+
|
|
2453
|
+
## How to verify
|
|
2454
|
+
|
|
2455
|
+
- Automated: <test files + how to run them>
|
|
2456
|
+
- Manual: <steps a reviewer runs locally to see it work>
|
|
2457
|
+
|
|
2458
|
+
## Scope & follow-ups
|
|
2459
|
+
|
|
2460
|
+
- In scope: <what this PR delivers>
|
|
2461
|
+
- Out of scope / deferred: <intentional punts, one line each — so reviewers don't flag them as gaps>
|
|
2462
|
+
|
|
2463
|
+
## Risk / blast radius
|
|
2464
|
+
|
|
2465
|
+
- <backward-compat, migration ordering, perf — what could break in prod>
|
|
2466
|
+
|
|
2467
|
+
## Ritual lineage
|
|
2468
|
+
|
|
2469
|
+
- Exploration: [<exploration name>](<EXPLORATION_URL>) · Build brief: `BUILD-BRIEF.md` (committed for reviewer reference) · Requirements satisfied: <N/M>
|
|
2470
|
+
- Implementation plan: see `IMPLEMENTATION-PLAN.md` *(only if Step 11.1.5 wrote it)*
|
|
2471
|
+
|
|
2472
|
+
Ritual-Exploration: <exploration_id>
|
|
2473
|
+
|
|
2474
|
+
🪷 Generated via [Ritual](https://ritual.work) — closing the loop with `sync_implementation` after merge.
|
|
2475
|
+
```
|
|
2476
|
+
|
|
2477
|
+
> **`<EXPLORATION_URL>` MUST be environment-correct — never hardcode `app.ritualapp.cloud`.** Use the server-resolved exploration URL the MCP returns (built from the server's `WEB_URL`). Hardcoding production breaks the link for **dev** builds (the exploration lives in the dev DB) and for **self-hosted / single-tenant enterprise** deployments (the exploration lives on the customer's own Ritual instance, not Ritual's SaaS). If the MCP response does not carry a URL, derive the base from your Ritual auth issuer rather than assuming production. Same rule for the `Ritual-Exploration-Url` commit trailer.
|
|
2478
|
+
|
|
2479
|
+
If the user is implementing manually: hand off the brief + the branch-strategy note ("create a feature branch off `main` — don't commit to trunk"), tell them you'll be ready to run `sync_implementation` when they're done.
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
#### Step 12 — Close the loop with `sync_implementation`
|
|
2483
|
+
|
|
2484
|
+
##### 12.0 — What this step does (in product terms)
|
|
2485
|
+
|
|
2486
|
+
Before asking for permission, frame the call in language the user can act on. `sync_implementation` is not just an API call — it's the moment the workspace's knowledge graph absorbs what you just shipped. Full rail (this is a top-level decision gate that ends the build flow):
|
|
2487
|
+
|
|
2488
|
+
```text
|
|
2489
|
+
Ritual build
|
|
2490
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ✓ Build brief ● Implementation (Your agent)
|
|
2491
|
+
|
|
2492
|
+
Log implementation
|
|
2493
|
+
|
|
2494
|
+
I'm about to log this implementation into the workspace's knowledge graph. After this:
|
|
2495
|
+
|
|
2496
|
+
· The exploration's state flips to ✓ done (or ⚠ implemented-ahead if
|
|
2497
|
+
any recs weren't approved when shipped).
|
|
2498
|
+
· The implementation gets linked back to the recommendations it
|
|
2499
|
+
implements — so future `/ritual build` calls touching
|
|
2500
|
+
`{first 2 of filesChanged}` will see this implementation as priorContext.
|
|
2501
|
+
· The {M} open deferrals you intentionally punted get logged with
|
|
2502
|
+
their reasons — peers can see them in `/ritual lineage` on these
|
|
2503
|
+
files later.
|
|
2504
|
+
|
|
2505
|
+
Reply `log` to confirm, `hold off`, or `adjust` to edit the list first.
|
|
2506
|
+
```
|
|
2507
|
+
|
|
2508
|
+
This framing replaces "I need to call sync_implementation, OK?" — which is jargon. The user should know what they're approving in product terms (CLI Tenet #4 — cite the specific signal). Note the vocabulary rule in `cli-output-contract.md` — do not surface "decisions" / "{N} decisions" as a user-facing label here; frame the moment as logging the **implementation** itself.
|
|
2509
|
+
|
|
2510
|
+
##### 12.1 — Make the call
|
|
2511
|
+
|
|
2512
|
+
Call `mcp__ritual__sync_implementation` with:
|
|
2513
|
+
- `workspace_id`, `exploration_id`
|
|
2514
|
+
- `repo`, `branch`, `pr_url`, `pr_number`, `pr_status`
|
|
2515
|
+
- `commits[]` — each with `sha`, `message`, `timestamp`, `files_changed`
|
|
2516
|
+
- `decisions[]` — each with `area`, `choice`, `alternatives_considered[]`, `rationale`, optionally `source_recommendation_id` (anchor each decision to the rec it implements when possible — this is what enables future "shipped X to satisfy rec Y" queries)
|
|
2517
|
+
- `deferrals[]` — for things you intentionally punted (`rb_id`, `description`, `reason`, `severity`, `related_files[]`, `related_modules[]`)
|
|
2518
|
+
- `gate_verdict`, `adherence_rate` — your own self-reported quality signals
|
|
2519
|
+
|
|
2520
|
+
The A1.5 snapshot column auto-captures each linked recommendation's status at the moment of sync — so if you implemented before the rec review's `proceed` (while the rec was still un-reviewed), the timeline is preserved automatically.
|
|
2521
|
+
|
|
2522
|
+
When sync_implementation succeeds, the response includes:
|
|
2523
|
+
|
|
2524
|
+
- `decisions: [{ decisionId, area, choice, recommendationStatusAtImplementation }, ...]` — IDs of every architectural decision logged + the rec-status snapshot (A1.5)
|
|
2525
|
+
- `deferrals: [{ deferralId, rbId, severity }, ...]` — IDs of every deferral
|
|
2526
|
+
- `decisionsCount`, `deferralsCount` — totals for the summary line
|
|
2527
|
+
- `webUrl` — clickable link to the exploration's implementation record in the web UI
|
|
2528
|
+
|
|
2529
|
+
**Surface ALL of this to the user**, not just "ok logged." This is the visible signal that the loop closed. Full rail (this is the completion state for the whole `/ritual build` flow):
|
|
2530
|
+
|
|
2531
|
+
```text
|
|
2532
|
+
Ritual build
|
|
2533
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ✓ Build brief ✓ Implementation (Your agent)
|
|
2534
|
+
|
|
2535
|
+
✓ Logged implementation for {exploration name}
|
|
2536
|
+
|
|
2537
|
+
· Implemented: {first 2 area:choice pairs from decisions[],
|
|
2538
|
+
e.g. "auth: OAuth not SAML; data-model: tenant-scoped indexes"}
|
|
2539
|
+
· {deferralsCount} deferral{s} registered: {first 1, e.g. "[major]
|
|
2540
|
+
Rate-limit per-tenant — out of scope for v1"}
|
|
2541
|
+
· View: {webUrl}
|
|
2542
|
+
|
|
2543
|
+
Future `/ritual build` calls touching `{first 2 of filesChanged}` will
|
|
2544
|
+
now see this implementation in their priorContext block.
|
|
2545
|
+
|
|
2546
|
+
Next: nothing required — the loop is closed. Run `/ritual lineage` on
|
|
2547
|
+
any touched file to trace this back later.
|
|
2548
|
+
```
|
|
2549
|
+
|
|
2550
|
+
The `Implemented:` line surfaces a representative slice of WHAT got implemented (concrete area:choice pairs from the underlying `decisions[]` payload) rather than a labeled count. Per the vocabulary rule in `cli-output-contract.md`: the word "decisions" is not surfaced as a user-facing label; the artifacts ARE the signal.
|
|
2551
|
+
|
|
2552
|
+
If any anchor's `recommendationStatusAtImplementation` is NOT `approved` (i.e. implemented before the rec review's `proceed`), add a callout — still frame in implementation/recommendation terms. Append this block BELOW the completion message (no separate rail; the rail is already rendered at the top):
|
|
2553
|
+
|
|
2554
|
+
```text
|
|
2555
|
+
⚠ {M} of the recommendations were implemented while still in {status}
|
|
2556
|
+
state — the exploration now shows `implemented_ahead`. An admin should
|
|
2557
|
+
review + accept the recs to close the gap.
|
|
2558
|
+
```
|
|
2559
|
+
|
|
2560
|
+
The closing sentence is the most important one: it tells the user **what just happened in the system** in product-level terms. Without it, sync_implementation feels like a write-only black hole. With it, the user understands they just contributed to the workspace's memory.
|
|
2561
|
+
|
|
2562
|
+
**If `sync_implementation` fails:** do not drop the structured implementation data. Write the intended payload to `.ritual/pending-sync/<exploration-id>.json` and tell the user exactly what was not logged.
|
|
2563
|
+
|
|
2564
|
+
User-visible (full rail — sync failure is a top-level state):
|
|
2565
|
+
|
|
2566
|
+
```text
|
|
2567
|
+
Ritual build
|
|
2568
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ✓ Build brief ● Implementation (Your agent)
|
|
2569
|
+
|
|
2570
|
+
Sync failed (recoverable)
|
|
2571
|
+
|
|
2572
|
+
`sync_implementation` failed: {error summary}
|
|
2573
|
+
|
|
2574
|
+
Saved the intended sync payload to `.ritual/pending-sync/<exploration-id>.json`.
|
|
2575
|
+
Nothing about your implementation was lost — the failure is on the
|
|
2576
|
+
logging side, not the code side.
|
|
2577
|
+
|
|
2578
|
+
Next: run `/ritual resume` later to see + retry pending syncs, or
|
|
2579
|
+
re-run `sync_implementation` now if the cause was transient.
|
|
2580
|
+
```
|
|
2581
|
+
|
|
2582
|
+
Create `.ritual/pending-sync/` if needed. **Ensure the directory is gitignored** — the saved payload contains `decisions[].rationale` text the user typed and commit-level data that shouldn't end up in shared repo history. On the first failed sync, also write `.ritual/pending-sync/.gitignore` with `*` so the directory itself is committed but its contents aren't (gives teammates the breadcrumb that pending syncs exist without leaking contents):
|
|
2583
|
+
|
|
2584
|
+
```bash
|
|
2585
|
+
mkdir -p .ritual/pending-sync
|
|
2586
|
+
[ -f .ritual/pending-sync/.gitignore ] || echo '*' > .ritual/pending-sync/.gitignore
|
|
2587
|
+
[ -f .ritual/pending-sync/.gitignore ] && ! grep -q '^!\.gitignore$' .ritual/pending-sync/.gitignore && echo '!.gitignore' >> .ritual/pending-sync/.gitignore
|
|
2588
|
+
```
|
|
2589
|
+
|
|
2590
|
+
That two-line `.gitignore` (`*` then `!.gitignore`) follows the standard pattern: ignore everything in this directory EXCEPT the gitignore file itself. Most teams already use this idiom for `.cache/`, `node_modules/`, etc.
|
|
2591
|
+
|
|
2592
|
+
##### 12.2 — Staleness check before retry
|
|
2593
|
+
|
|
2594
|
+
When retrying a pending sync from `.ritual/pending-sync/<id>.json`, the user may have committed more code since the failure. The saved payload's `commits[]` is a frozen snapshot — re-uploading it after additional commits land would mis-attribute the new work as "not part of this exploration."
|
|
2595
|
+
|
|
2596
|
+
Before re-invoking `sync_implementation` on a saved payload:
|
|
2597
|
+
|
|
2598
|
+
1. Read the payload's `commits[]` (each has a `sha`).
|
|
2599
|
+
2. Run `git log --pretty=format:%H` against the payload's `branch`.
|
|
2600
|
+
3. Compare: if there are commit SHAs in `git log` that AREN'T in the payload's `commits[]`, the payload is stale.
|
|
2601
|
+
|
|
2602
|
+
If stale, surface to the user with the full rail (top-level decision gate):
|
|
2603
|
+
|
|
2604
|
+
```text
|
|
2605
|
+
Ritual build
|
|
2606
|
+
✓ Context ✓ Scope ✓ Discovery ✓ Recommendations ✓ Build brief ● Implementation (Your agent)
|
|
2607
|
+
|
|
2608
|
+
Pending sync is stale
|
|
2609
|
+
|
|
2610
|
+
This pending sync was saved {N} day(s) ago. Since then you've added
|
|
2611
|
+
{M} more commit(s) to `{branch}` that aren't in the saved payload.
|
|
2612
|
+
Retrying as-is would log a partial picture — the work done since the
|
|
2613
|
+
failure would NOT be attributed to this exploration.
|
|
2614
|
+
|
|
2615
|
+
Options:
|
|
2616
|
+
|
|
2617
|
+
1. Retry as-is — log what was saved; you can sync the new commits later.
|
|
2618
|
+
2. Regenerate — re-run from scratch with the current state. This is
|
|
2619
|
+
usually right when there's been substantive work since the failure.
|
|
2620
|
+
3. Show me — print the {M} new commits so I can decide.
|
|
2621
|
+
|
|
2622
|
+
Reply `1`, `2`, or `3`. Reply `pause` to stop here.
|
|
2623
|
+
```
|
|
2624
|
+
|
|
2625
|
+
**[LITE AUTO — no pause; auto-pick the recommended default]** Wait for response. Option 2 is usually right when there's been substantive work; option 1 is fine for small follow-up commits the user wants attributed to the next sync.
|
|
2626
|
+
|
|
2627
|
+
If the saved payload's `commits[]` matches current git state, proceed silently to the retry.
|
|
2628
|
+
|
|
2629
|
+
|
|
2630
|
+
#### Step 13 — Suggest the next job to be done
|
|
2631
|
+
|
|
2632
|
+
The loop just closed (Step 12). Rather than stop cold and make the user
|
|
2633
|
+
re-bootstrap context for whatever they do next, offer the **next best job to be
|
|
2634
|
+
done** — a NEW discovery exploration in THIS workspace, so the knowledge graph,
|
|
2635
|
+
deferrals, and prior explorations you just built keep compounding. This is
|
|
2636
|
+
forward motion, never required work.
|
|
2637
|
+
|
|
2638
|
+
##### 13.1 — Generate the suggestion set
|
|
2639
|
+
|
|
2640
|
+
Call `mcp__ritual__suggest_next_job` with `{ exploration_id }` (the
|
|
2641
|
+
just-finished exploration). It returns 1 primary + up to 2 alternatives. Each is
|
|
2642
|
+
a NEW exploration that runs its own discovery — it is **never** "go implement the
|
|
2643
|
+
recommendations you already have" (that's the coding agent's job — `/ritual
|
|
2644
|
+
resume` on this same exploration). Each suggestion carries:
|
|
2645
|
+
|
|
2646
|
+
- `jtbd` + `label` — the job, already picked
|
|
2647
|
+
- `reasoning` — the concrete signal it cites (a deferral, an unaddressed recommendation, or the natural lifecycle continuation)
|
|
2648
|
+
- `descriptionSeed` — a first-person "what to explore" framing to pre-fill the next exploration's problem box
|
|
2649
|
+
- `recommendedPersona`, `sourceRecommendationId`, `id`
|
|
2650
|
+
|
|
2651
|
+
Also returned: `recommendationsAddressed` (false ⇒ this exploration still has
|
|
2652
|
+
clear-to-implement work that ships via `resume`, not a next job).
|
|
2653
|
+
|
|
2654
|
+
- **If `suggestions` is empty** (or the call errors) → say nothing about next jobs; drop straight to 13.3. Never block the closed-loop completion on this.
|
|
2655
|
+
|
|
2656
|
+
##### 13.2 — Present the picker
|
|
2657
|
+
|
|
2658
|
+
**[USER PAUSE]** Render the standard list-picker (primary first, marked ★):
|
|
2659
|
+
|
|
2660
|
+
```text
|
|
2661
|
+
Next job to be done
|
|
2662
|
+
|
|
2663
|
+
{exploration name} is shipped and logged. To keep building on what this
|
|
2664
|
+
workspace now knows, here's the next discovery worth running:
|
|
2665
|
+
|
|
2666
|
+
★ 1. {primary label}
|
|
2667
|
+
{primary reasoning}
|
|
2668
|
+
|
|
2669
|
+
2. {alt1 label}
|
|
2670
|
+
{alt1 reasoning}
|
|
2671
|
+
|
|
2672
|
+
3. {alt2 label}
|
|
2673
|
+
{alt2 reasoning}
|
|
2674
|
+
|
|
2675
|
+
Reply `1`, `2`, or `3` to start it — the job's already picked, so you'll go
|
|
2676
|
+
straight to framing what to explore. Reply `skip` to stop here.
|
|
2677
|
+
```
|
|
2678
|
+
|
|
2679
|
+
Only render lines for the suggestions actually returned (there may be just a
|
|
2680
|
+
primary, or a primary + 1). If `recommendationsAddressed` is `false`, add ONE
|
|
2681
|
+
line below the picker — lean on the coding agent, don't turn Ritual into a
|
|
2682
|
+
backlog manager:
|
|
2683
|
+
|
|
2684
|
+
```text
|
|
2685
|
+
({N} item{s} from this exploration are clear to implement — say `resume` to continue shipping them here.)
|
|
2686
|
+
```
|
|
2687
|
+
|
|
2688
|
+
**[USER PAUSE — required, do not auto-answer]** Wait for the user's reply.
|
|
2689
|
+
|
|
2690
|
+
##### 13.2.1 — On pick (`1` / `2` / `3`)
|
|
2691
|
+
|
|
2692
|
+
The picked suggestion is a NEW exploration in the SAME workspace with the job
|
|
2693
|
+
already chosen — so **advance, don't re-bootstrap**:
|
|
2694
|
+
|
|
2695
|
+
1. Skip the work-item / job pick entirely (Steps 0–4) — `jtbd` is already set by the suggestion.
|
|
2696
|
+
2. Go to **Step 5 (problem frame)** using the suggestion's `descriptionSeed` as the DRAFT "what are you trying to explore?" — present it as an editable starting point, not a blank box. Let the user refine it.
|
|
2697
|
+
3. At **Step 6 (`create_exploration`)**, pass `from_next_job_suggestion_id` = the picked suggestion's `id`. The server links the new exploration to its parent + source recommendation, defaults the `jtbd` from the suggestion, and marks the suggestion started (it stops showing as an open next job, and the originating recommendation now reads as handed off).
|
|
2698
|
+
- If `create_exploration` returns **409** (this next job was already started), don't create a duplicate — tell the user it's already in progress and offer to open that exploration instead.
|
|
2699
|
+
4. Continue the normal flow from **Step 7 (discovery)**.
|
|
2700
|
+
|
|
2701
|
+
##### 13.2.2 — On `skip`
|
|
2702
|
+
|
|
2703
|
+
Acknowledge and drop to 13.3. The suggestion set is persisted — a later `ritual
|
|
2704
|
+
graph status` or re-run of `/ritual build` in this workspace can surface it
|
|
2705
|
+
again; nothing is lost.
|
|
2706
|
+
|
|
2707
|
+
##### 13.3 — Follow-up pointer
|
|
2708
|
+
|
|
2709
|
+
If they want to check the state at any time, point them at:
|
|
2710
|
+
|
|
2711
|
+
> `ritual graph status` (in their CLI) — shows the workspace's current KG counts + recent implementations.
|
|
2712
|
+
|
|
2713
|
+
Or: re-run `/ritual build` in this workspace later — the existing-work check will surface this exploration with its new `done` state badge, and any future build whose `sources` overlap will pull in the decisions + deferrals you just logged as priorContext.
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
### Failure modes & recovery
|
|
2717
|
+
|
|
2718
|
+
**Discovery generation hangs (>5 min polling without `ready: true`)**: ask the user — wait longer, or retry (`suggest_discovery_questions` again, new task)? Discovery questions are required (the user must pick at least 6 to run), so there is no skip-and-proceed option; if generation can't produce questions, surface the failure rather than running with none.
|
|
2719
|
+
|
|
2720
|
+
**Agentic run fails or stalls**: surface the error, offer retry or stop.
|
|
2721
|
+
|
|
2722
|
+
**Discovery state ready=true with zero matters**: rare but possible if the LLM produced a malformed state. Retry by calling `suggest_discovery_questions` again.
|
|
2723
|
+
|
|
2724
|
+
**LLM-cost / quota errors (HTTP 429)**: tell the user explicitly. Do NOT auto-retry — quota issues need a human decision (different model tier, wait, top up).
|
|
2725
|
+
|
|
2726
|
+
### Tools used
|
|
2727
|
+
|
|
2728
|
+
This subcommand exclusively uses Ritual MCP tools, in the order they appear:
|
|
2729
|
+
|
|
2730
|
+
1. `mcp__ritual__list_workspaces` (Step 1)
|
|
2731
|
+
2. `mcp__ritual__create_workspace` (Step 1, only if no workspace exists)
|
|
2732
|
+
3. `mcp__ritual__list_explorations` (Step 1.5 — resume vs start, with state badges)
|
|
2733
|
+
4. `mcp__ritual__suggest_high_leverage_problems` (Step 1.5 step 6b — option 3, "help me find the highest-leverage thing")
|
|
2734
|
+
5. `mcp__ritual__check_exploration_overlap` (Step 1.5 step 8 — pre-creation overlap detection before "start fresh")
|
|
2735
|
+
5a. `mcp__ritual__archive_exploration` (Step 1.5 step 6a — soft-delete a duplicate/misfire when user picks `delete N` from the resume menu)
|
|
2736
|
+
6. ~~`mcp__ritual__list_templates`~~ — **REMOVED 2026-05-21 (CLI 0.9.0+).** Step 2 is now server-side template resolution; the tool is no longer registered on the MCP surface. Do not call it. See Step 2 § "Rewritten 2026-05-21" for the rationale.
|
|
2737
|
+
7. `mcp__ritual__generate_considerations` (Step 4)
|
|
2738
|
+
8. `mcp__ritual__refine_considerations` (Step 4.2, iteration only)
|
|
2739
|
+
9. `mcp__ritual__generate_problem_statement` (Step 5)
|
|
2740
|
+
10. `mcp__ritual__refine_problem_statement` (Step 5.2, iteration only)
|
|
2741
|
+
11. `mcp__ritual__create_exploration` (Step 6)
|
|
2742
|
+
12. `mcp__ritual__fork_sibling_explorations` (Step 6.5 — optional only when the user explicitly asks to save separate sibling tracks)
|
|
2743
|
+
13. `mcp__ritual__suggest_discovery_questions` (Step 7.1)
|
|
2744
|
+
14. `mcp__ritual__get_discovery_state` (Step 7.2)
|
|
2745
|
+
15. `mcp__ritual__accept_discovery_questions` (Step 7.4)
|
|
2746
|
+
16. `mcp__ritual__set_anti_goals` (Step 7.5, optional)
|
|
2747
|
+
17. `mcp__ritual__start_agentic_run` (Step 8 — engineering runs through recommendations; product/design may use `stop_after='answers'`)
|
|
2748
|
+
18. `mcp__ritual__get_agentic_run` (Step 8 / Step 8.5 polling)
|
|
2749
|
+
19. `mcp__ritual__cancel_agentic_run` (Step 8, only on user abort)
|
|
2750
|
+
20. `mcp__ritual__resume_agentic_run` (Step 8.5, only when product/design answer-review mode was used)
|
|
2751
|
+
20a. `mcp__ritual__get_answer_state` (Step 8.5 per-question read)
|
|
2752
|
+
20b. `mcp__ritual__iterate_answer` (Step 8.5 — user picked "iterate")
|
|
2753
|
+
20c. `mcp__ritual__submit_answer` (Step 8.5 — user picked "submit")
|
|
2754
|
+
21. `mcp__ritual__get_recommendations` (Step 9)
|
|
2755
|
+
22. `mcp__ritual__accept_recommendations` (Step 9, admin branch only — fires requirement gen fire-and-forget)
|
|
2756
|
+
23. `mcp__ritual__get_requirement_set_status` (Step 9.5 polling)
|
|
2757
|
+
24. `mcp__ritual__generate_build_brief` (Step 10a)
|
|
2758
|
+
24a. `mcp__ritual__get_build_brief_status` (Step 10b — timeout-recovery polling, OR proactive cache-hit check before 10a)
|
|
2759
|
+
24d. `mcp__ritual__sync_brief_review` (Step 10b.5 — sync `BUILD-BRIEF-VERIFICATION.md` to KG; AND Step 10.5 — sync `UX-REVIEW.md` to KG)
|
|
2760
|
+
24b. `mcp__ritual__add_knowledge_source` (Step 6.2 — register staged knowledge sources after `create_exploration` returns `exploration_id`; staging happens at Step 3.5)
|
|
2761
|
+
24c. `mcp__ritual__list_knowledge_sources` (used inline by Step 3.5 to show already-attached refs on resume; also called by `/ritual context-pulse` CP2 for Reference Grounding count)
|
|
2762
|
+
24e. `mcp__ritual__audit_recommendations` (Step 9.6 — start an audit chain on the (anti-goals, typed recs+reqs, R4) triple; cli 0.10.0+)
|
|
2763
|
+
24f. `mcp__ritual__apply_repair` (Step 9.6 — apply or waive a structured repair instruction returned by an audit iteration; cli 0.10.0+)
|
|
2764
|
+
24g. `mcp__ritual__get_audit_chain` (Step 9.6 — fetch the full chain trail for review/lineage; cli 0.10.0+)
|
|
2765
|
+
25. `mcp__ritual__sync_implementation` (Step 12)
|
|
2766
|
+
26. `mcp__ritual__suggest_next_job` (Step 13.1 — propose the next discovery job after the loop closes; `create_exploration` at Step 13.2.1 takes `from_next_job_suggestion_id` to record the handoff)
|
|
2767
|
+
|
|
2768
|
+
36 of the 48 Ritual MCP tools (cli 0.10.0+: the 3 audit tools — `audit_recommendations`, `apply_repair`, `get_audit_chain` — joined the linear flow at Step 9.6 (audit-suite.md § Audit 1); cli 0.22.0+: `suggest_next_job` joined at Step 13 to close-then-continue the loop). The other 12 (`ping`, `get_exploration`, `list_agentic_runs`, `add_collaborator`, `check_anti_goals`, `query_knowledge_graph`, `get_workspace_overview`, `get_knowledge_source`, `remove_knowledge_source`, `get_recommendation_attestation`, `score_context_pulse`, `get_next_job`) are situational, not part of the linear build flow (`get_next_job` re-reads a persisted next-job set; the flow itself only needs `suggest_next_job`).
|
|
2769
|
+
|
|
2770
|
+
**Note on `check_anti_goals` vs `audit_recommendations`:** these are distinct tools. `check_anti_goals` is the older, single-shot validation tool (read-tier; one LLM call, no chain rows) used ad-hoc to validate a proposal against an exploration's current anti-goal set. `audit_recommendations` (cli 0.10.0+, write-tier) starts a stateful `AuditChain` that runs R4 (constraint-perturbation) against a brief, produces structured `SurvivalReport` + `RepairInstruction` rows, and supports the apply/waive repair loop. Use `check_anti_goals` for one-shot proposal validation; use `audit_recommendations` for chain-tracked constraint-survival audits of a brief.
|
|
2771
|
+
|
|
2772
|
+
### After this subcommand
|
|
2773
|
+
|
|
2774
|
+
When `/ritual build` completes, the exploration is in COMPLETE state with accepted recommendations AND a build brief has been generated AND (if the agent implemented in-chat) `sync_implementation` has been called. The full close-the-loop cycle now lives inside this skill — there's no separate downstream `/ritual-builder-spec` step required.
|
|
2775
|
+
|
|
2776
|
+
Variants:
|
|
2777
|
+
- One person runs the whole flow: Steps 1 → 13, no handoff. Step 9 is a uniform non-blocking review (recs are auto-accepted; `proceed` records the review and continues).
|
|
2778
|
+
- Implementation lands before the rec review/`proceed`: the `sync_implementation` snapshot freezes that timeline and the exploration shows `⚠ implemented_ahead` until reconciled (see Step 12).
|
|
2779
|
+
- Resume mid-flow: the existing-work check surfaces explorations with state badges and jumps directly to the right phase. (Or, for the "I just want to pick up" intent, see `/ritual resume` below.)
|
|
2780
|
+
|
|
2781
|
+
---
|