@ritualai/cli 0.11.0 → 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.
Files changed (81) hide show
  1. package/dist/commands/doctor.js +59 -23
  2. package/dist/commands/doctor.js.map +1 -1
  3. package/dist/commands/init.js +33 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/uninstall.js +114 -0
  6. package/dist/commands/uninstall.js.map +1 -0
  7. package/dist/index.js +10 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/agents/providers.js +44 -4
  10. package/dist/lib/agents/providers.js.map +1 -1
  11. package/dist/lib/memory-update.js +158 -0
  12. package/dist/lib/memory-update.js.map +1 -0
  13. package/dist/lib/uninstall-plan.js +102 -0
  14. package/dist/lib/uninstall-plan.js.map +1 -0
  15. package/package.json +1 -1
  16. package/skills/claude-code/ritual/.ritual-bundle.json +2 -2
  17. package/skills/claude-code/ritual/SKILL.md +14 -11
  18. package/skills/claude-code/ritual/manifest.json +0 -5
  19. package/skills/claude-code/ritual/references/async-polling.md +5 -5
  20. package/skills/claude-code/ritual/references/build-flow.md +513 -494
  21. package/skills/claude-code/ritual/references/change-preflight.md +81 -0
  22. package/skills/claude-code/ritual/references/cli-output-contract.md +2 -2
  23. package/skills/claude-code/ritual/references/context-pulse-flow.md +0 -1
  24. package/skills/claude-code/ritual/references/lite-flow.md +2781 -0
  25. package/skills/claude-code/ritual/references/scoring-fallback.md +1 -1
  26. package/skills/codex/ritual/.ritual-bundle.json +2 -2
  27. package/skills/codex/ritual/SKILL.md +14 -11
  28. package/skills/codex/ritual/manifest.json +0 -5
  29. package/skills/codex/ritual/references/async-polling.md +5 -5
  30. package/skills/codex/ritual/references/build-flow.md +513 -494
  31. package/skills/codex/ritual/references/change-preflight.md +81 -0
  32. package/skills/codex/ritual/references/cli-output-contract.md +2 -2
  33. package/skills/codex/ritual/references/context-pulse-flow.md +0 -1
  34. package/skills/codex/ritual/references/lite-flow.md +2781 -0
  35. package/skills/codex/ritual/references/scoring-fallback.md +1 -1
  36. package/skills/cursor/ritual/.ritual-bundle.json +2 -2
  37. package/skills/cursor/ritual/SKILL.md +14 -11
  38. package/skills/cursor/ritual/manifest.json +0 -5
  39. package/skills/cursor/ritual/references/async-polling.md +5 -5
  40. package/skills/cursor/ritual/references/build-flow.md +513 -494
  41. package/skills/cursor/ritual/references/change-preflight.md +81 -0
  42. package/skills/cursor/ritual/references/cli-output-contract.md +2 -2
  43. package/skills/cursor/ritual/references/context-pulse-flow.md +0 -1
  44. package/skills/cursor/ritual/references/lite-flow.md +2781 -0
  45. package/skills/cursor/ritual/references/scoring-fallback.md +1 -1
  46. package/skills/gemini/ritual/.ritual-bundle.json +2 -2
  47. package/skills/gemini/ritual/SKILL.md +14 -11
  48. package/skills/gemini/ritual/manifest.json +0 -5
  49. package/skills/gemini/ritual/references/async-polling.md +5 -5
  50. package/skills/gemini/ritual/references/build-flow.md +513 -494
  51. package/skills/gemini/ritual/references/change-preflight.md +81 -0
  52. package/skills/gemini/ritual/references/cli-output-contract.md +2 -2
  53. package/skills/gemini/ritual/references/context-pulse-flow.md +0 -1
  54. package/skills/gemini/ritual/references/lite-flow.md +2781 -0
  55. package/skills/gemini/ritual/references/scoring-fallback.md +1 -1
  56. package/skills/kiro/ritual/.ritual-bundle.json +2 -2
  57. package/skills/kiro/ritual/SKILL.md +14 -11
  58. package/skills/kiro/ritual/manifest.json +0 -5
  59. package/skills/kiro/ritual/references/async-polling.md +5 -5
  60. package/skills/kiro/ritual/references/build-flow.md +513 -494
  61. package/skills/kiro/ritual/references/change-preflight.md +81 -0
  62. package/skills/kiro/ritual/references/cli-output-contract.md +2 -2
  63. package/skills/kiro/ritual/references/context-pulse-flow.md +0 -1
  64. package/skills/kiro/ritual/references/lite-flow.md +2781 -0
  65. package/skills/kiro/ritual/references/scoring-fallback.md +1 -1
  66. package/skills/vscode/ritual/.ritual-bundle.json +2 -2
  67. package/skills/vscode/ritual/SKILL.md +14 -11
  68. package/skills/vscode/ritual/manifest.json +0 -5
  69. package/skills/vscode/ritual/references/async-polling.md +5 -5
  70. package/skills/vscode/ritual/references/build-flow.md +513 -494
  71. package/skills/vscode/ritual/references/change-preflight.md +81 -0
  72. package/skills/vscode/ritual/references/cli-output-contract.md +2 -2
  73. package/skills/vscode/ritual/references/context-pulse-flow.md +0 -1
  74. package/skills/vscode/ritual/references/lite-flow.md +2781 -0
  75. package/skills/vscode/ritual/references/scoring-fallback.md +1 -1
  76. package/skills/claude-code/ritual/references/discovery-classification.md +0 -175
  77. package/skills/codex/ritual/references/discovery-classification.md +0 -175
  78. package/skills/cursor/ritual/references/discovery-classification.md +0 -175
  79. package/skills/gemini/ritual/references/discovery-classification.md +0 -175
  80. package/skills/kiro/ritual/references/discovery-classification.md +0 -175
  81. package/skills/vscode/ritual/references/discovery-classification.md +0 -175
@@ -47,6 +47,11 @@ exports.PROVIDERS = [
47
47
  // closes the scope-mismatch FTUE bug where MCP was registered
48
48
  // user-global but the skill only loaded from the project dir.
49
49
  userSkillDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.claude', 'skills'),
50
+ // Claude Code loads `CLAUDE.md` (project + `~/.claude/CLAUDE.md` global)
51
+ // at the start of every session — the home for the always-on
52
+ // coding-discovery routing rule.
53
+ projectMemoryRule: { path: 'CLAUDE.md', mode: 'append' },
54
+ userMemoryRule: { path: (0, node_path_1.join)('.claude', 'CLAUDE.md'), mode: 'append' },
50
55
  // `claude mcp add-json` writes to ~/.claude.json itself; we
51
56
  // shell out so we don't fight its config-file format.
52
57
  mcpConfigMethod: 'cli-command',
@@ -64,10 +69,15 @@ exports.PROVIDERS = [
64
69
  (0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_os_1.homedir)(), '.cursor', 'mcp.json')),
65
70
  projectSkillDir: '.cursor/rules',
66
71
  packageSkillDir: 'skills/cursor',
67
- // Cursor's "User Rules" live in the app's settings DB (Cursor
68
- // Settings Rules), not in a filesystem path. A CLI cannot
69
- // populate them. Project-local install is the only option.
70
- // Doctor surfaces this asymmetry.
72
+ // Cursor reads project rules from `.cursor/rules/*.mdc` with YAML
73
+ // frontmatter; `alwaysApply: true` loads the rule every request.
74
+ // Dedicated file (we own it). User Rules live in the app's settings
75
+ // DB, not a file — no global variant a CLI can write.
76
+ projectMemoryRule: {
77
+ path: (0, node_path_1.join)('.cursor', 'rules', 'ritual-discovery.mdc'),
78
+ mode: 'dedicated',
79
+ frontmatter: '---\ndescription: Choose the right discovery tier before planning a coding task\nglobs:\nalwaysApply: true\n---',
80
+ },
71
81
  mcpConfigMethod: 'json-file',
72
82
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.cursor', 'mcp.json'),
73
83
  },
@@ -90,6 +100,16 @@ exports.PROVIDERS = [
90
100
  // integration ships MCP tools only — no `/ritual` skill install.
91
101
  // Doctor surfaces stale `.windsurf/rules/ritual/` from prior CLI
92
102
  // versions and tells the user it's safe to delete.
103
+ //
104
+ // The DISCOVERY RULE is different from the SKILL bundle: Windsurf's
105
+ // `.windsurf/rules/*.md` takes single rule files with a `trigger`
106
+ // frontmatter — `always_on` loads it every Cascade conversation. So
107
+ // the routing rule ships even though the multi-file SKILL bundle can't.
108
+ projectMemoryRule: {
109
+ path: (0, node_path_1.join)('.windsurf', 'rules', 'ritual-discovery.md'),
110
+ mode: 'dedicated',
111
+ frontmatter: '---\ntrigger: always_on\ndescription: Choose the right discovery tier before planning a coding task\n---',
112
+ },
93
113
  mcpConfigMethod: 'json-file',
94
114
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.codeium', 'windsurf', 'mcp_config.json'),
95
115
  },
@@ -100,6 +120,14 @@ exports.PROVIDERS = [
100
120
  projectSkillDir: '.kiro/skills',
101
121
  packageSkillDir: 'skills/kiro',
102
122
  userSkillDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.kiro', 'skills'),
123
+ // Kiro steering: `.kiro/steering/*.md` with `inclusion: always`
124
+ // frontmatter loads the file into context for every prompt. The
125
+ // frontmatter MUST be the first bytes (no leading blank line).
126
+ projectMemoryRule: {
127
+ path: (0, node_path_1.join)('.kiro', 'steering', 'ritual-discovery.md'),
128
+ mode: 'dedicated',
129
+ frontmatter: '---\ninclusion: always\n---',
130
+ },
103
131
  mcpConfigMethod: 'json-file',
104
132
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.kiro', 'mcp.json'),
105
133
  },
@@ -114,6 +142,10 @@ exports.PROVIDERS = [
114
142
  // `~/.gemini/skills/<name>/SKILL.md` — matches the Agent Skills
115
143
  // open standard.
116
144
  userSkillDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.gemini', 'skills'),
145
+ // Gemini CLI hierarchically loads `GEMINI.md` context files: project
146
+ // root + `~/.gemini/GEMINI.md` global, concatenated into every prompt.
147
+ projectMemoryRule: { path: 'GEMINI.md', mode: 'append' },
148
+ userMemoryRule: { path: (0, node_path_1.join)('.gemini', 'GEMINI.md'), mode: 'append' },
117
149
  mcpConfigMethod: 'json-file',
118
150
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.gemini', 'mcp.json'),
119
151
  },
@@ -132,6 +164,10 @@ exports.PROVIDERS = [
132
164
  // User-global per the VS Code Agent Skills docs:
133
165
  // https://code.visualstudio.com/docs/copilot/customization/agent-skills
134
166
  userSkillDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.copilot', 'skills'),
167
+ // VS Code auto-applies `.github/copilot-instructions.md` (repo root) to
168
+ // every Copilot chat request. User-level instructions live in VS Code
169
+ // settings, not a portable file — no global variant here.
170
+ projectMemoryRule: { path: (0, node_path_1.join)('.github', 'copilot-instructions.md'), mode: 'append' },
135
171
  mcpConfigMethod: 'json-file',
136
172
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.vscode', 'mcp.json'),
137
173
  // VS Code's quirk: top-level key is `servers`, not `mcpServers`.
@@ -146,6 +182,10 @@ exports.PROVIDERS = [
146
182
  projectSkillDir: '.agents/skills',
147
183
  packageSkillDir: 'skills/codex',
148
184
  userSkillDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.agents', 'skills'),
185
+ // Codex reads `AGENTS.md` (the cross-agent open standard): repo root +
186
+ // `~/.codex/AGENTS.md` global, concatenated root-down each session.
187
+ projectMemoryRule: { path: 'AGENTS.md', mode: 'append' },
188
+ userMemoryRule: { path: (0, node_path_1.join)('.codex', 'AGENTS.md'), mode: 'append' },
149
189
  mcpConfigMethod: 'json-file',
150
190
  mcpConfigPath: (0, node_path_1.join)((0, node_os_1.homedir)(), '.codex', 'mcp.json'),
151
191
  },
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/lib/agents/providers.ts"],"names":[],"mappings":";;;AAkPA,4CAEC;AApPD,qCAAqC;AACrC,qCAAkC;AAClC,yCAAiC;AACjC,2DAA8C;AA4F9C;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,GAAW;IACjC,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAA,6BAAQ,EAAC,GAAG,KAAK,IAAI,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,SAAS,GAAoB;IACzC;QACC,IAAI,EAAE,aAAa;QACnB,EAAE,EAAE,aAAa;QACjB,iEAAiE;QACjE,4DAA4D;QAC5D,0DAA0D;QAC1D,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,SAAS,CAAC,CAAC;QAC/E,eAAe,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,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvF,eAAe,EAAE,WAAW;QAC5B,aAAa,EAAE,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,SAAS,EAAE,UAAU,CAAC;QACrD,iEAAiE;QACjE,YAAY,EAAE,SAAS;KACvB;IACD;QACC,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,OAAO;QACX,6DAA6D;QAC7D,2DAA2D;QAC3D,MAAM,EAAE,GAAG,EAAE,CAAC,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,QAAQ,CAAC,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC;QAC7E,eAAe,EAAE,gBAAgB;QACjC,eAAe,EAAE,cAAc;QAC/B,YAAY,EAAE,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,SAAS,EAAE,QAAQ,CAAC;QAClD,uEAAuE;QACvE,oEAAoE;QACpE,iBAAiB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxD,cAAc,EAAE,EAAE,IAAI,EAAE,IAAA,gBAAI,EAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrE,eAAe,EAAE,WAAW;QAC5B,aAAa,EAAE,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;KACpD;CACD,CAAC;AAEF,wEAAwE;AACxE,SAAgB,gBAAgB,CAAC,EAAU;IAC1C,OAAO,iBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.__MARKERS = exports.__ROUTER_BODY = void 0;
4
+ exports.updateMemoryRules = updateMemoryRules;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const node_os_1 = require("node:os");
8
+ /**
9
+ * Write the always-on "coding discovery before planning" routing rule into
10
+ * each detected agent's instructions surface, so the agent reliably picks the
11
+ * right discovery TIER (no / lightweight / full Ritual discovery) before plan
12
+ * mode instead of jumping to a speculative plan.
13
+ *
14
+ * Why this matters more for non-Claude agents: Anthropic-style skill
15
+ * auto-invocation (loading a SKILL by its `description`) is largely
16
+ * Claude-Code-specific. For Cursor/Kiro/Windsurf/etc. the rule in their
17
+ * always-on instructions file is the primary routing signal, not a backup.
18
+ *
19
+ * Two write shapes, per `MemoryRuleTarget.mode`:
20
+ * - `append` → marker-bracketed block into a SHARED instructions file the
21
+ * agent already loads (CLAUDE.md / GEMINI.md / AGENTS.md /
22
+ * .github/copilot-instructions.md). Preserves the user's own
23
+ * content; re-runs replace the block in place.
24
+ * - `dedicated` → a rule file we OWN (Cursor `.mdc`, Kiro steering, Windsurf
25
+ * rule), written wholesale as `frontmatter + body`. Like the
26
+ * scaffolded skill files, it's regenerated every init.
27
+ *
28
+ * Scopes: project (relative to the repo root) always; global (relative to
29
+ * $HOME) only when `ritual init --global-memory-rule` is passed.
30
+ *
31
+ * Mirrors `gitignore-update.ts`: byte-level string ops (preserve line endings),
32
+ * idempotent, fail-soft at the call site. Deliberately NOT gitignored — a
33
+ * routing rule is team-shareable guidance most repos want committed.
34
+ */
35
+ /**
36
+ * Marker comments delimiting the block we own in `append`-mode files. Matched
37
+ * by string.indexOf — do NOT change casually; older blocks use this text.
38
+ */
39
+ const BEGIN_MARKER = '<!-- Begin: ritual init — skill routing (regenerated on every init) -->';
40
+ const END_MARKER = '<!-- End: ritual init -->';
41
+ /**
42
+ * The routing rule body — three tiers, keyed off the same "ambiguous /
43
+ * cross-cutting / non-obvious constraints" language as the `/ritual` SKILL
44
+ * description so the two never drift. Tight scope is load-bearing: an
45
+ * over-eager rule that fires on every "build" word becomes noise. The rule is
46
+ * offer-not-auto and explicitly exempts trivial edits.
47
+ */
48
+ const ROUTER_BODY = `## Coding discovery before planning
49
+
50
+ Before entering plan mode for a coding task, decide how much repository
51
+ discovery it needs — and don't jump straight into a speculative plan. Pick one
52
+ of three tiers:
53
+
54
+ - **No discovery** — tiny, local, mechanical edits where the target file and the
55
+ change are obvious (typo, copy change, formatting, replacing a clearly
56
+ specified value). Just make the change.
57
+ - **Lightweight discovery** — bounded tasks where the user gave useful context
58
+ but repo conventions may still shape the plan (adding a DB column, renaming a
59
+ model, changing retry behavior, touching one known endpoint). Briefly inspect
60
+ the relevant files, symbols, tests, schemas, or similar implementations first.
61
+ Keep it inline — don't turn it into a separate process unless the task proves
62
+ broader or ambiguous. For a small but genuinely build-shaped dev task that
63
+ still benefits from Ritual's pipeline (recommendations → brief → implement →
64
+ PR) without the full discovery walk, offer \`/ritual lite "<their ask>"\` — the
65
+ same pipeline run fast/unattended, with only a job+persona front gate and a
66
+ non-blocking recommendation review.
67
+ - **Full Ritual discovery** — non-trivial, ambiguous, architectural,
68
+ cross-cutting, multi-file, integration-heavy, or product/workflow-context-heavy
69
+ work. Offer to run \`/ritual build "<their ask>"\` first: it runs a structured
70
+ exploration that surfaces intent, constraints, and prior decisions and returns
71
+ a validated build brief — grounded context to fold into plan mode rather than a
72
+ speculative plan. Proceed from the brief into planning/implementation.
73
+
74
+ When uncertain, prefer lightweight discovery over guessing. The user can always
75
+ decline.`;
76
+ /** The marker block (markers + body) for `append` mode. */
77
+ function buildBlock() {
78
+ return `${BEGIN_MARKER}\n${ROUTER_BODY}\n${END_MARKER}`;
79
+ }
80
+ /**
81
+ * Replace the marker-bracketed block in `body` with `newBlock`. If absent,
82
+ * append it (separated by a blank line when the file has content). Byte-level
83
+ * so the user's content and line-endings survive.
84
+ */
85
+ function replaceOrAppendBlock(body, newBlock) {
86
+ const beginIdx = body.indexOf(BEGIN_MARKER);
87
+ const endIdx = body.indexOf(END_MARKER);
88
+ if (beginIdx >= 0 && endIdx > beginIdx) {
89
+ const endLineEnd = endIdx + END_MARKER.length;
90
+ return body.slice(0, beginIdx) + newBlock + body.slice(endLineEnd);
91
+ }
92
+ const trimmed = body.replace(/\s+$/, '');
93
+ if (trimmed.length === 0)
94
+ return `${newBlock}\n`;
95
+ return `${trimmed}\n\n${newBlock}\n`;
96
+ }
97
+ /** The full contents of a `dedicated` rule file (frontmatter must be first). */
98
+ function dedicatedContents(target) {
99
+ const fm = target.frontmatter ? `${target.frontmatter.replace(/\s+$/, '')}\n\n` : '';
100
+ return `${fm}${ROUTER_BODY}\n`;
101
+ }
102
+ /** Write one rule target under `rootDir`. Creates parent dirs as needed. */
103
+ function writeRule(rootDir, target, scope) {
104
+ const abs = (0, node_path_1.join)(rootDir, target.path);
105
+ const preExisting = (0, node_fs_1.existsSync)(abs);
106
+ const current = preExisting ? (0, node_fs_1.readFileSync)(abs, 'utf8') : '';
107
+ const nextBody = target.mode === 'append'
108
+ ? replaceOrAppendBlock(current, buildBlock())
109
+ : dedicatedContents(target);
110
+ const base = {
111
+ path: abs,
112
+ relativePath: target.path,
113
+ scope,
114
+ mode: target.mode,
115
+ preExisting,
116
+ };
117
+ if (nextBody === current)
118
+ return { ...base, changed: false };
119
+ const dir = (0, node_path_1.dirname)(abs);
120
+ if (!(0, node_fs_1.existsSync)(dir))
121
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
122
+ (0, node_fs_1.writeFileSync)(abs, nextBody, 'utf8');
123
+ return { ...base, changed: true };
124
+ }
125
+ /**
126
+ * Write the routing rule for every provider's `projectMemoryRule` (always) and
127
+ * `userMemoryRule` (only when `opts.global`). De-dupes by absolute path so two
128
+ * agents that share a file (e.g. both write `AGENTS.md`) get one write.
129
+ * Providers without a rule target for the requested scope are skipped.
130
+ *
131
+ * `opts.homeDir` overrides `$HOME` for the global scope (tests).
132
+ */
133
+ function updateMemoryRules(projectRoot, providers, opts = {}) {
134
+ const home = opts.homeDir ?? (0, node_os_1.homedir)();
135
+ const seen = new Set();
136
+ const results = [];
137
+ for (const provider of providers) {
138
+ if (provider.projectMemoryRule) {
139
+ const abs = (0, node_path_1.join)(projectRoot, provider.projectMemoryRule.path);
140
+ if (!seen.has(abs)) {
141
+ seen.add(abs);
142
+ results.push(writeRule(projectRoot, provider.projectMemoryRule, 'project'));
143
+ }
144
+ }
145
+ if (opts.global && provider.userMemoryRule) {
146
+ const abs = (0, node_path_1.join)(home, provider.userMemoryRule.path);
147
+ if (!seen.has(abs)) {
148
+ seen.add(abs);
149
+ results.push(writeRule(home, provider.userMemoryRule, 'global'));
150
+ }
151
+ }
152
+ }
153
+ return results;
154
+ }
155
+ /** Exposed for tests + the skill-consistency guard. */
156
+ exports.__ROUTER_BODY = ROUTER_BODY;
157
+ exports.__MARKERS = { BEGIN_MARKER, END_MARKER };
158
+ //# sourceMappingURL=memory-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-update.js","sourceRoot":"","sources":["../../src/lib/memory-update.ts"],"names":[],"mappings":";;;AA4JA,8CA0BC;AAtLD,qCAA6E;AAC7E,yCAA0C;AAC1C,qCAAkC;AAIlC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;GAGG;AACH,MAAM,YAAY,GAAG,yEAAyE,CAAC;AAC/F,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;SA2BX,CAAC;AAeV,2DAA2D;AAC3D,SAAS,UAAU;IAClB,OAAO,GAAG,YAAY,KAAK,WAAW,KAAK,UAAU,EAAE,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,IAAY,EAAE,QAAgB;IAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,QAAQ,IAAI,CAAC,IAAI,MAAM,GAAG,QAAQ,E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AC7E,CAAC;QACF,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC5C,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACrD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;YAClE,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,uDAAuD;AAC1C,QAAA,aAAa,GAAG,WAAW,CAAC;AAC5B,QAAA,SAAS,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSafeRitualDir = assertSafeRitualDir;
4
+ exports.stripRouterBlock = stripRouterBlock;
5
+ exports.planUninstall = planUninstall;
6
+ const node_path_1 = require("node:path");
7
+ const memory_update_1 = require("./memory-update");
8
+ const providers_1 = require("./agents/providers");
9
+ /**
10
+ * Throw unless `target` is a Ritual-owned leaf directory strictly inside `cwd`.
11
+ * Defense-in-depth: the planner only ever constructs safe paths, but the
12
+ * executor re-checks every path immediately before `rm` so a future bug can't
13
+ * delete something it shouldn't.
14
+ */
15
+ function assertSafeRitualDir(cwd, target) {
16
+ const root = (0, node_path_1.resolve)(cwd);
17
+ const t = (0, node_path_1.resolve)(target);
18
+ if (t === root)
19
+ throw new Error(`refusing to remove the project root: ${target}`);
20
+ if (!t.startsWith(root + node_path_1.sep)) {
21
+ throw new Error(`refusing to remove a path outside the project: ${target}`);
22
+ }
23
+ const base = (0, node_path_1.basename)(t);
24
+ if (base !== 'ritual' && base !== '.ritual') {
25
+ throw new Error(`refusing to remove a non-Ritual directory: ${target}`);
26
+ }
27
+ }
28
+ /**
29
+ * Remove the marker-bracketed `ritual init` router block from a shared memory
30
+ * file, leaving every other line (the user's own content) intact. No-op +
31
+ * `changed: false` when the markers aren't present.
32
+ */
33
+ function stripRouterBlock(body) {
34
+ const { BEGIN_MARKER, END_MARKER } = memory_update_1.__MARKERS;
35
+ const begin = body.indexOf(BEGIN_MARKER);
36
+ const end = begin === -1 ? -1 : body.indexOf(END_MARKER, begin);
37
+ if (begin === -1 || end === -1)
38
+ return { body, changed: false };
39
+ const without = body.slice(0, begin) + body.slice(end + END_MARKER.length);
40
+ // Collapse the blank-line gap the block leaves behind; keep a single
41
+ // trailing newline. An otherwise-empty file collapses to "\n" (we never
42
+ // delete the user's memory file, only our block).
43
+ const cleaned = without.replace(/\n{3,}/g, '\n\n').replace(/[ \t\r\n]+$/, '') + '\n';
44
+ return { body: cleaned, changed: true };
45
+ }
46
+ /**
47
+ * Build the (side-effect-free) uninstall plan. `opts.project` adds the
48
+ * current repo's Ritual artifacts; without it, only the global, security-
49
+ * relevant items (credentials + MCP registrations) are planned.
50
+ */
51
+ function planUninstall(cwd, opts, deps) {
52
+ const actions = [];
53
+ // 1. Credentials (security) — the stored PAT/token must not survive an
54
+ // uninstall. Always first.
55
+ if (deps.exists(deps.credentialsPath)) {
56
+ actions.push({ kind: 'clear-credentials', path: deps.credentialsPath });
57
+ }
58
+ // 2. MCP registrations — surfaced as `claude mcp remove` commands (we don't
59
+ // edit the user's MCP config directly; the canonical removal is safest).
60
+ for (const e of deps.mcpEntries) {
61
+ actions.push({ kind: 'manual-mcp-remove', command: e.command, scope: e.scope });
62
+ }
63
+ // 3. Per-project artifacts (opt-in).
64
+ if (opts.project) {
65
+ const dotRitual = (0, node_path_1.join)(cwd, '.ritual');
66
+ if (deps.exists(dotRitual)) {
67
+ actions.push({
68
+ kind: 'remove-dir',
69
+ path: dotRitual,
70
+ label: '.ritual/ (workspace binding + persona)',
71
+ });
72
+ }
73
+ for (const p of providers_1.PROVIDERS) {
74
+ if (p.projectSkillDir) {
75
+ const skillDir = (0, node_path_1.join)(cwd, p.projectSkillDir, 'ritual');
76
+ if (deps.exists(skillDir)) {
77
+ actions.push({
78
+ kind: 'remove-dir',
79
+ path: skillDir,
80
+ label: `${p.projectSkillDir}/ritual (${p.name} skill bundle)`,
81
+ });
82
+ }
83
+ }
84
+ const memPath = p.projectMemoryRule?.path;
85
+ if (memPath) {
86
+ const mp = (0, node_path_1.join)(cwd, memPath);
87
+ if (deps.exists(mp) && deps.read(mp).includes(memory_update_1.__MARKERS.BEGIN_MARKER)) {
88
+ actions.push({
89
+ kind: 'strip-router',
90
+ path: mp,
91
+ label: `${memPath} (remove Ritual routing block, keep your content)`,
92
+ });
93
+ }
94
+ }
95
+ }
96
+ }
97
+ // 4. The CLI binary itself — printed guidance; we can't reliably uninstall
98
+ // the running process mid-run, and npm-global removal is the user's step.
99
+ actions.push({ kind: 'manual-npm-uninstall', command: 'npm uninstall -g @ritualai/cli' });
100
+ return actions;
101
+ }
102
+ //# sourceMappingURL=uninstall-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall-plan.js","sourceRoot":"","sources":["../../src/lib/uninstall-plan.ts"],"names":[],"mappings":";;AA6CA,kDAWC;AAOD,4CAWC;AAOD,sCA2DC;AA5ID,yCAAyD;AACzD,mDAA4C;AAC5C,kDAA+C;AAqC/C;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,GAAW,EAAE,MAAc;IAC9D,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,mBAAO,EAAC,MAAM,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,MAAM,EAAE,CAAC,CAAC;IAClF,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,GAA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,eAAe,YAAY,CAAC,CAAC,IAAI,gBAAgB;qBAC7D,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;YACD,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC;YAC1C,IAAI,OAAO,EAAE,CAAC;gBACb,MAAM,EAAE,GAAG,IAAA,gBAAI,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,yBAAS,CAAC,YAAY,CAAC,EAAE,CAAC;oBACvE,OAAO,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,EAAE;wBACR,KAAK,EAAE,GAAG,OAAO,mDAAmD;qBACpE,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,2EAA2E;IAC3E,6EAA6E;IAC7E,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC,CAAC;IAE1F,OAAO,OAAO,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ritualai/cli",
3
- "version": "0.11.0",
3
+ "version": "0.24.0",
4
4
  "description": "Ritual CLI — scaffold AI coding agent skills + register MCP servers. Connects Claude Code, Cursor, Windsurf, Kiro, Gemini CLI, VS Code/Copilot, and Codex to Ritual Cloud.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",
@@ -1,4 +1,4 @@
1
1
  {
2
- "cliVersion": "0.11.0",
3
- "builtAt": "2026-05-25T00:20:36.318Z"
2
+ "cliVersion": "0.24.0",
3
+ "builtAt": "2026-06-08T22:51:34.833Z"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ritual
3
- description: "Use when an engineer wants a coding agent to plan or build a feature, refactor, or implementation-heavy change that depends on context the agent can't infer on its own — strategic intent, constraints, prior decisions, and trade-offs that live in the user's head. Ritual runs a structured exploration to surface that context through targeted discovery questions, combines it with codebase signals and prior explorations, and delivers a validated build brief (sub-problems, recommendations, dependencies) before the agent writes code. Prefer this over jumping straight to implementation when the problem is ambiguous, cross-cutting, or has non-obvious constraints. Subcommands: build (full planning-to-sync cycle — default for new features), resume (continue an in-flight exploration), lineage (file-path KG history — what decisions shaped this code), context-pulse (readiness and context-debt scoring — is this safe to build yet?)."
3
+ description: "Use when an engineer wants a coding agent to plan or build a feature, refactor, or implementation-heavy change that depends on context the agent can't infer on its own — strategic intent, constraints, prior decisions, and trade-offs that live in the user's head. Ritual runs a structured exploration to surface that context through targeted discovery questions, combines it with codebase signals and prior explorations, and delivers a validated build brief (sub-problems, recommendations, dependencies) — additional context to fold into plan mode before the agent writes code. Prefer this over jumping straight to implementation or plan mode when the problem is ambiguous, cross-cutting, or has non-obvious constraints. Subcommands: build (full planning-to-sync cycle — default for new features), resume (continue an in-flight exploration), lineage (file-path KG history — what decisions shaped this code), context-pulse (readiness and context-debt scoring — is this safe to build yet?)."
4
4
  argument-hint: "[subcommand] <args> (e.g. 'build Reduce T2 churn in Q3', 'resume', 'lineage src/checkout/views.py', 'context-pulse Add billing export')"
5
5
  user-invocable: true
6
6
  ---
@@ -15,6 +15,7 @@ Before executing any subcommand, read and follow:
15
15
 
16
16
  - `references/cli-output-contract.md` — terminal output, vocabulary, readability, pause policy
17
17
  - `references/async-polling.md` — harness-safe polling and timeout recovery
18
+ - `references/change-preflight.md` — restate + confirm before any free-text change/add tool call (refine sub-problems, reframe scope, add anti-goal); hard pause, even in auto-mode
18
19
 
19
20
  Do not reintroduce `/ritual recon`. Use plain-language repo inspection, `/ritual resume`, or `/ritual lineage` depending on intent.
20
21
 
@@ -37,14 +38,15 @@ When two contract-strength rules genuinely conflict (rare): **stop, surface the
37
38
 
38
39
  This rule is the meta-pattern that closes the failure class we kept hitting before 2026-05-15: the SKILL named the right behavior in each step (Step 7 picker, Step 9 preview-verbatim, Step 9 action menu, picker numbering, etc.), but the agent treated the prose as advisory and freelanced anyway. Anti-patterns are **executable constraints, not taste guidance.** When an anti-pattern says "agent must NOT", read it as a hard error, not a preference.
39
40
 
40
- Examples of contract-strength rules currently in force (non-exhaustive):
41
+ **One gate per turn — never batch the flow (load-bearing).** Each user-facing gate (workspace pick, scope, the discovery Area-walk, recommendation review, the build-brief confirm, …) is a STOP. Render **exactly one** gate, then **end your turn and wait for the user's reply** — do NOT render the next gate, multiple gates, or "the full flow, gate by gate" in a single message. Collapsing gates into one narrated pass erases the user's decision points (the entire value of the flow) and is a hard violation **even when you already have all the data to render them**. A gate's options only mean something if the user can actually answer before the next gate renders. This applies inside a gate too: the discovery picker is a turn-by-turn **walk**, one Area per turn (see build-flow.md § 7.3). Each render shows the **Area rail AND the current Area's questions together** (mirroring Spark's selected-tab-with-content) — the rail alone, with no questions under it (a bare index), is the *removed* failure mode. Render the rail + exactly ONE Area's questions, then STOP. Never render a second Area's questions or the Summary in the same message.
41
42
 
42
- - `references/build-flow.md` Step 7 transition lockmust NOT skip the Areas picker, must call `accept_discovery_questions` before `start_agentic_run`.
43
- - `references/build-flow.md` Step 7.3.1 rendering contract — Areas index has NO question previews, single numbering stream.
44
- - `references/build-flow.md` Step 7.4.5 fire-on-trigger scope-classification gate is the contract, not a suggestion.
45
- - `references/build-flow.md` Step 9 action menu lock — blessed set is exactly `accept recommended` / `drop R{N}` / `drill R{N}` / `comment R{N}` / `pause` (+ `request admin review` for collaborators). NO freelance `dedupe` / `open the admin` / invented compound actions.
46
- - `references/build-flow.md` Step 9 renderinguse the server preview verbatim; no free-form summarization on top.
47
- - `references/resume-flow.md` § R2 picker renderingONE picker number per exploration; continuation prose indented; flat numbering across state buckets.
43
+ **Single source of truth — this list POINTS, it does not RESTATE.** The detail of every rule below lives ONLY in the referenced file. This list names the authoritative sections and marks them HARD; it deliberately does **not** reproduce their shapes, option tokens, or values, because a restated rule drifts out of sync with its source. (That exact bug shipped on 2026-06-07: SKILL.md restated the Step 7 picker shape, the reference was rewritten, and the stale restatement won the agent rendered the old picker.) So: **read the referenced section before executing that step, render it exactly as written, do not improvise or paraphrase it.** If you ever find the same rule stated in two places and they differ, the **referenced reference-file wins**, and the duplication is a bug to flag.
44
+
45
+ Contract-strength rule sections currently in force (non-exhaustive):
46
+
47
+ - `references/build-flow.md` **Step 7 transition lock + § 7.3 picker contract** HARD. Render the discovery picker exactly as § 7.3 specifies (its shape, option tokens, and minimums — do not improvise it); commit picks via `accept_discovery_questions_batch` (one call across all Areas, never parallel per-Area) before `start_agentic_run`.
48
+ - `references/build-flow.md` **Step 9 category-walk + action set** HARD. Review recommendations one category per turn, rendering each rec's full content exactly as § 9 specifies; use exactly the three actions § 9 defines (refine-one / next-category / continue) and no others — no reject path, no freelance or invented actions, no free-form summarization on top. The refine action is a preview-then-apply flow; never persist an edit without the user accepting the previewed diff.
49
+ - `references/resume-flow.md` **§ R2 picker rendering** — HARD. Render exactly as that section specifies.
48
50
 
49
51
  When you encounter a rule labeled with any of the marker words above, treat it the same way you'd treat a unit-test assertion: violating it is a regression, not a stylistic choice.
50
52
 
@@ -55,13 +57,14 @@ Parse the first token of the argument:
55
57
  | First token | Route to | One-liner |
56
58
  |---|---|---|
57
59
  | `build` | `references/build-flow.md` | Free-form problem → recommendations → build brief → code → sync. The full cycle. |
60
+ | `lite` | `references/lite-flow.md` | Same pipeline as `build`, run fast/unattended — smaller discovery surface, fewer pauses (only the job+persona front gate and a non-blocking rec review). Use for small/well-scoped dev work, or when the coding agent triages minimal discovery. |
58
61
  | `resume` | `references/resume-flow.md` | "Pick up where I left off." Lists in-flight explorations with state badges and jumps to the right step. |
59
62
  | `lineage` | `references/lineage-flow.md` | Paste a file path (or set of paths); see every prior exploration / decision / deferral that touched those files. |
60
63
  | `context-pulse` | `references/context-pulse-flow.md` | Score readiness / context debt for a feature ask or exploration. Can seed a `CONTEXT-<feature>.md` file with relevant codebase + KG context that `/ritual build` picks up automatically. Also surfaces inline during build so the user watches debt drop. |
61
64
  | `status` | `references/status-flow.md` | Read-only mirror of the `ritual status` terminal CLI command (CLI 0.7.14+) for users who want a quick run-progress check inside the agent session instead of in a separate terminal. Calls `mcp__ritual__get_agentic_run` + renders the same run-first layout the CLI uses. |
62
65
  | (anything else, OR no subcommand) | default to `build` and treat the entire argument as the problem statement | |
63
66
 
64
- The Ritual CLI surface is intentionally narrow: `build`, `resume`, `lineage`, `context-pulse`, plus the read-only `status` mirror. Legacy exposed `explore`, `run`, `brief`, `gate`, `spec`, `questions`, `gherkin`, `recs` — all of which mapped 1:1 to MCP tool calls and provided no agent-CLI value over plain English. We don't replicate them; the agent can call any MCP tool directly when the user asks for "the recs on exp-X" or "decisions on file Y". (`/ritual recon` shipped briefly in PR #174 as a fifth command — retired because its unique value duplicated `/ritual resume` (workspace history) + `/ritual lineage` (decisions on files), and its non-duplicate parts (map repo, trace flow, explain file) are exactly what the agent does fluently in plain English without needing a SKILL-defined menu.)
67
+ The Ritual CLI surface is intentionally narrow: `build`, `lite`, `resume`, `lineage`, `context-pulse`, plus the read-only `status` mirror. Legacy exposed `explore`, `run`, `brief`, `gate`, `spec`, `questions`, `gherkin`, `recs` — all of which mapped 1:1 to MCP tool calls and provided no agent-CLI value over plain English. We don't replicate them; the agent can call any MCP tool directly when the user asks for "the recs on exp-X" or "decisions on file Y". (`/ritual recon` shipped briefly in PR #174 as a fifth command — retired because its unique value duplicated `/ritual resume` (workspace history) + `/ritual lineage` (decisions on files), and its non-duplicate parts (map repo, trace flow, explain file) are exactly what the agent does fluently in plain English without needing a SKILL-defined menu.)
65
68
 
66
69
 
67
70
  ## Subcommand reference files
@@ -71,18 +74,18 @@ Load only the reference file needed for the selected subcommand:
71
74
  | Subcommand | Runtime file |
72
75
  |---|---|
73
76
  | `build` | `references/build-flow.md` |
77
+ | `lite` | `references/lite-flow.md` |
74
78
  | `resume` | `references/resume-flow.md` |
75
79
  | `lineage` | `references/lineage-flow.md` |
76
80
  | `context-pulse` | `references/context-pulse-flow.md` |
77
81
 
78
82
  Additional runtime references:
79
83
 
80
- - `references/discovery-classification.md` — only when build question picking triggers scope classification
81
84
  - `references/scoring-fallback.md` — only if `mcp__ritual__score_context_pulse` is unavailable or errors
82
85
 
83
86
  ## Routing behavior
84
87
 
85
- - If the first token is one of the four subcommands, load the matching runtime file and follow it.
88
+ - If the first token is one of the subcommands (`build`, `lite`, `resume`, `lineage`, `context-pulse`), load the matching runtime file and follow it.
86
89
  - If there is no subcommand or the token is unknown, default to `build` and treat the full argument as the problem statement.
87
90
  - If the user asks for retired or unsupported subcommands, answer in plain English and call the relevant MCP tool directly when appropriate; do not expand the slash-command surface.
88
91
 
@@ -39,11 +39,6 @@
39
39
  "lines": 357,
40
40
  "bytes": 25358
41
41
  },
42
- {
43
- "path": "references/discovery-classification.md",
44
- "lines": 176,
45
- "bytes": 10275
46
- },
47
42
  {
48
43
  "path": "references/lineage-flow.md",
49
44
  "lines": 154,
@@ -4,12 +4,12 @@ Use this for every long-running Ritual/MCP operation: discovery generation, agen
4
4
 
5
5
  ## Standard poll loop — single short sleep per turn, never escalate
6
6
 
7
- - **`Bash sleep 5` per poll iteration. Always 5. Never escalate.** Even if the operation has been running for minutes, the value stays `5`. The reason: the harness blocks "chained shorter sleeps" successive `sleep N` calls across turns at increasing N (e.g. `sleep 5` → `sleep 15` → `sleep 20` → `sleep 25`) trip the same guard as `sleep 30+`. Treat the sleep duration as a constant, NOT a backoff knob.
8
- - **One sleep per turn**, not multiple in sequence. After `sleep 5`, take a fresh turn → call the status tool → decide continue or exit.
7
+ - **A CONSTANT, non-escalating `Bash sleep` per poll iteration sized to the operation.** Match the Spark UI's cadence so both surfaces observe the same job at the same rate: **`sleep 10`** for discovery-question generation (Spark polls every 10s), **`sleep 20`** for agentic-run polling (Spark polls every 20s), and `sleep 10` by default for any other status poll (requirements, build brief). Keep the value CONSTANT for the whole loop — **never escalate it** (e.g. `5` → `15` → `20` → `25`), because the harness blocks chained-increasing sleeps the same way it blocks `sleep 30`. The duration is a fixed per-operation constant, NOT a backoff knob. (All values are < 30 and non-escalating → guard-safe.)
8
+ - **One sleep per turn**, not multiple in sequence. After the sleep, take a fresh turn → call the status tool → decide continue or exit.
9
9
  - **`sleep ≥ 30` is hard-blocked**, regardless of context.
10
- - **Do NOT use semicolons to chain** (`sleep 5; sleep 5`) — also blocked.
11
- - **The user sees progress every 5 seconds, total wall time is the same.** A slow operation taking 2 minutes is 24 turns of `sleep 5` + status, not 4 turns of `sleep 30`.
12
- - Print progress only when status/progress/current_step changes, or every ~3 polls (~15s) if unchanged.
10
+ - **Do NOT use semicolons to chain** (`sleep 10; sleep 10`) — also blocked.
11
+ - **Total wall time is the same** a slow op taking 2 minutes is 12 turns of `sleep 10` + status, not 4 turns of `sleep 30`.
12
+ - Print progress only when status/progress/current_step changes, or every ~2 polls (~20s) if unchanged.
13
13
  - Keep updates to one line unless an error occurs.
14
14
 
15
15
  ### Wrong vs right