@worca/app 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +403 -0
  2. package/agents/clarify.meta.json +19 -0
  3. package/agents/decomposer.meta.json +21 -0
  4. package/agents/implementer.meta.json +20 -0
  5. package/agents/manualTestsChecklist.meta.json +18 -0
  6. package/agents/manualWebUiTesting.meta.json +18 -0
  7. package/agents/planReviewer.meta.json +19 -0
  8. package/agents/planner.meta.json +20 -0
  9. package/agents/refiner.meta.json +19 -0
  10. package/agents/reviewer.meta.json +19 -0
  11. package/agents/worca-cc-clarify.md +67 -0
  12. package/agents/worca-cc-code-reviewer.md +66 -0
  13. package/agents/worca-cc-decomposer.md +84 -0
  14. package/agents/worca-cc-implementer.md +69 -0
  15. package/agents/worca-cc-manual-tests-checklist.md +63 -0
  16. package/agents/worca-cc-manual-web-ui-testing.md +64 -0
  17. package/agents/worca-cc-plan-refiner.md +69 -0
  18. package/agents/worca-cc-plan-reviewer.md +70 -0
  19. package/agents/worca-cc-planner.md +70 -0
  20. package/agents/worca-cc-workspace-reviewer.md +56 -0
  21. package/agents/worca-cc-workspace-scanner.md +55 -0
  22. package/agents/workspaceReviewer.meta.json +20 -0
  23. package/agents/workspaceScanner.meta.json +18 -0
  24. package/package.json +61 -0
  25. package/scripts/install.mjs +209 -0
  26. package/skills/worca/SKILL.md +66 -0
  27. package/src/cli/worca-cc.mjs +1520 -0
  28. package/src/core/agent-gen.mjs +206 -0
  29. package/src/core/agent-registry.mjs +417 -0
  30. package/src/core/agent-store.mjs +143 -0
  31. package/src/core/artifacts.mjs +2019 -0
  32. package/src/core/channels.mjs +302 -0
  33. package/src/core/chat/allowlist.mjs +27 -0
  34. package/src/core/chat/channel-host.mjs +562 -0
  35. package/src/core/chat/channel-protocol.mjs +117 -0
  36. package/src/core/chat/channel-worker-child.mjs +211 -0
  37. package/src/core/chat/chat-context.mjs +66 -0
  38. package/src/core/chat/command-router.mjs +343 -0
  39. package/src/core/chat/notifier.mjs +120 -0
  40. package/src/core/chat/parser.mjs +30 -0
  41. package/src/core/chat/rate-limiter.mjs +133 -0
  42. package/src/core/chat/redact.mjs +27 -0
  43. package/src/core/chat/renderers.mjs +136 -0
  44. package/src/core/claude-runner.mjs +1356 -0
  45. package/src/core/config.mjs +882 -0
  46. package/src/core/cost-budget.mjs +103 -0
  47. package/src/core/db.mjs +864 -0
  48. package/src/core/fanout.mjs +48 -0
  49. package/src/core/folder-dialog.mjs +138 -0
  50. package/src/core/fs-browse.mjs +49 -0
  51. package/src/core/git-info.mjs +200 -0
  52. package/src/core/guardrail-store.mjs +204 -0
  53. package/src/core/guardrails.mjs +302 -0
  54. package/src/core/marketplaces.mjs +267 -0
  55. package/src/core/migrate-fs-to-db.mjs +612 -0
  56. package/src/core/model-env.mjs +74 -0
  57. package/src/core/orchestrator.mjs +4279 -0
  58. package/src/core/overview-agent.mjs +124 -0
  59. package/src/core/phases.mjs +1279 -0
  60. package/src/core/pipeline-delete.mjs +428 -0
  61. package/src/core/plugin-api.mjs +13 -0
  62. package/src/core/plugin-config.mjs +100 -0
  63. package/src/core/plugin-inventory.mjs +50 -0
  64. package/src/core/plugin-manifest.mjs +447 -0
  65. package/src/core/plugin-models.mjs +130 -0
  66. package/src/core/plugin-repo.mjs +303 -0
  67. package/src/core/plugin-shim-child.mjs +76 -0
  68. package/src/core/plugin-shim.mjs +197 -0
  69. package/src/core/plugin-store.mjs +485 -0
  70. package/src/core/plugin-workflows.mjs +179 -0
  71. package/src/core/plugins-lock.mjs +49 -0
  72. package/src/core/preflight-node.mjs +122 -0
  73. package/src/core/preflight.mjs +341 -0
  74. package/src/core/projects.mjs +157 -0
  75. package/src/core/protocol.mjs +257 -0
  76. package/src/core/recoverable-error.mjs +51 -0
  77. package/src/core/results.mjs +188 -0
  78. package/src/core/run-context.mjs +1375 -0
  79. package/src/core/run-log.mjs +64 -0
  80. package/src/core/run-manifest.mjs +317 -0
  81. package/src/core/runners.mjs +167 -0
  82. package/src/core/settings.mjs +682 -0
  83. package/src/core/skills.mjs +210 -0
  84. package/src/core/sources.mjs +232 -0
  85. package/src/core/stats.mjs +182 -0
  86. package/src/core/store.mjs +67 -0
  87. package/src/core/title.mjs +64 -0
  88. package/src/core/workflow-validator.mjs +185 -0
  89. package/src/core/workflows.mjs +568 -0
  90. package/src/core/workspace-scan.mjs +420 -0
  91. package/src/core/workspaces.mjs +353 -0
  92. package/src/core/worktree.mjs +708 -0
  93. package/src/feature.mjs +9 -0
  94. package/ui/public/app.js +10647 -0
  95. package/ui/public/assets/worca-favicon.png +0 -0
  96. package/ui/public/assets/worca-logo.png +0 -0
  97. package/ui/public/chat-settings-view.mjs +89 -0
  98. package/ui/public/composer-core.mjs +211 -0
  99. package/ui/public/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
  100. package/ui/public/fonts/poppins-latin-400-normal.woff2 +0 -0
  101. package/ui/public/fonts/poppins-latin-500-normal.woff2 +0 -0
  102. package/ui/public/fonts/poppins-latin-600-normal.woff2 +0 -0
  103. package/ui/public/fonts/poppins-latin-700-normal.woff2 +0 -0
  104. package/ui/public/guardrails-view.mjs +244 -0
  105. package/ui/public/index.html +1145 -0
  106. package/ui/public/log-filter.mjs +81 -0
  107. package/ui/public/log-line.mjs +86 -0
  108. package/ui/public/models-view.mjs +433 -0
  109. package/ui/public/plugins-view.mjs +430 -0
  110. package/ui/public/results-view.mjs +121 -0
  111. package/ui/public/source-pane.mjs +156 -0
  112. package/ui/public/stats-view.mjs +523 -0
  113. package/ui/public/style.css +1557 -0
  114. package/ui/server.mjs +3573 -0
package/README.md ADDED
@@ -0,0 +1,403 @@
1
+ # Worca CC
2
+
3
+ A **deterministic multi-agent pipeline** that drives Claude Code (headless) through
4
+ **Plan -> Refine -> Implement -> Review** for a software task. It ships three ways to
5
+ run the same pipeline: a **CLI**, an installable **`/worca` skill**, and a **web
6
+ UI**.
7
+
8
+ Plain Node.js ESM (`.mjs`), **Node `>=22.13.0`** — required by the built-in
9
+ `node:sqlite` store (flag-free from Node v22.13 LTS / v23.4+). Minimal dependencies:
10
+ `express` + `ws` only. The frontend is vanilla HTML/CSS/JS — no framework, no build step.
11
+
12
+ > The full, binding contract for every module, event, and on-disk file lives in
13
+ > [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md). Read it before changing any signature.
14
+
15
+ ---
16
+
17
+ ## What it is
18
+
19
+ You give the orchestrator a **project folder** and a **prompt** (or a markdown brief).
20
+ A deterministic state machine then runs the agents of the selected workflow in sequence, looping until the work
21
+ clears quality gates:
22
+
23
+ 1. **Planner** writes an initial plan (with code snippets) and, instead of *assuming*
24
+ anything, asks you conceptual questions — each with **2–4 options plus a free-text
25
+ field**. The Q&A is appended to the plan so reviewers see it.
26
+ 2. **Plan Refiner** reviews the plan (including its code snippets), writes a refined
27
+ `-v2`, `-v3`, ... and re-runs until only minor/suggestion issues remain (or you
28
+ approve continuing past the cycle cap).
29
+ 3. **Implementer** follows the latest plan with no deviation, using TDD
30
+ (red-green-refactor).
31
+ 4. **Code Reviewer** reviews the git diff, writes a review, and hands back to the
32
+ implementer to fix — looping Implement -> Review until only minor/suggestion issues
33
+ remain (or you approve continuing past the cap).
34
+
35
+ Run state, history, and configuration are saved in a single **SQLite database**
36
+ (`~/.worca-cc/worca-cc.db`, via the built-in `node:sqlite`), while the agents' **markdown**
37
+ outputs (plans, reviews) and any attachments live alongside it in a **machine-wide
38
+ external store** (default `~/.worca-cc/store/<projectKey>/`). Both are keyed by repo
39
+ identity and kept **outside your project's working tree**, so nothing is ever committed to
40
+ your repo. See [Artifact layout](#artifact-layout) for details.
41
+
42
+ ### Preflight tooling
43
+
44
+ Before planning, the orchestrator probes for optional graph tools and, if present,
45
+ tells the agents to use them:
46
+
47
+ - [`graphify`](https://github.com/safishamsi/graphify)
48
+ - [`code-review-graph`](https://github.com/tirth8205/code-review-graph)
49
+
50
+ If **both** are installed, it **always uses graphify**. All probes fail safe — a
51
+ missing tool never breaks a run.
52
+
53
+ ---
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ npm install
59
+ ```
60
+
61
+ Requires **Node `>=22.13.0`** (for the built-in `node:sqlite` store — run `nvm use` to
62
+ pick up the bundled `.nvmrc`) and the `claude` CLI on your `PATH` for real (non-mock) runs.
63
+
64
+ ---
65
+
66
+ ## Quick start
67
+
68
+ ### CLI
69
+
70
+ Run a pipeline against a project folder:
71
+
72
+ ```bash
73
+ npm run cli -- --project /path/to/your/project --prompt "Add a /search endpoint"
74
+ ```
75
+
76
+ Or use a markdown brief as the prompt:
77
+
78
+ ```bash
79
+ npm run cli -- --project /path/to/your/project --file ./brief.md --title "Search feature"
80
+ ```
81
+
82
+ Useful flags: `--model <m>`,
83
+ `--permission-mode <m>`, `--yes`/`--non-interactive` (auto-answer clarify with the
84
+ first option and gates with "continue"). See `docs/ARCHITECTURE.md` §4.1 for the full
85
+ list.
86
+
87
+ ### Web UI
88
+
89
+ ```bash
90
+ npm start
91
+ ```
92
+
93
+ Then open the printed URL (default `http://localhost:4317`). The UI lets you:
94
+
95
+ - start a run from a **prompt or markdown document**, pointed at any **project folder**,
96
+ with optional extra files;
97
+ - watch a **steps tracker** (preflight / plan / refine #N / implement / review #N /
98
+ done);
99
+ - answer **clarify questions** (2–4 options + free text) and **loop gates** ("Don't have
100
+ another cycle and continue" / "I approve another cycle", with the open critical/major
101
+ issues shown);
102
+ - follow a **live streaming log**;
103
+ - **Pause** or **Stop** a run;
104
+ - browse **history** of past pipelines and read their saved markdown.
105
+
106
+ There's also an **"Install agents into this folder"** button that copies the agents +
107
+ skill into a target project so you can use `/worca` there.
108
+
109
+ ### Pause & resume
110
+
111
+ A running pipeline can be **paused** and continued later — even from a fresh process:
112
+
113
+ - **Web UI** — every run card has a **Pause** button next to Stop; a paused pipeline
114
+ shows an amber **Paused** badge in history, and its history card gets a **Resume**
115
+ button.
116
+ - **CLI** — the first `Ctrl+C` pauses gracefully (a second stops, a third hard-exits).
117
+ Continue later with:
118
+
119
+ ```bash
120
+ npm run cli -- resume <pipelineId>
121
+ # or, with the bin on your PATH: worca resume <pipelineId>
122
+ ```
123
+
124
+ Pause is graceful: in-flight Claude steps are terminated, the per-pipeline **worktree
125
+ is kept** (uncommitted agent work survives), and a **resume point** is persisted to the
126
+ database — so resume **survives server restarts** (it rehydrates entirely from the DB).
127
+ On resume, interrupted steps **re-attach their Claude session** via
128
+ `claude --resume <session_id>`; if the session is gone, the step re-runs fresh and the
129
+ fallback is noted in the run's audit log.
130
+
131
+ ### `/worca` skill (inside your own project)
132
+
133
+ Copy the agents and the skill into your project's `.claude/`:
134
+
135
+ ```bash
136
+ npm run install:agents -- /path/to/your/project
137
+ # or: node scripts/install.mjs /path/to/your/project [--force]
138
+ ```
139
+
140
+ Then open Claude Code in that project and run:
141
+
142
+ ```
143
+ /worca Add a /search endpoint with pagination
144
+ ```
145
+
146
+ The skill starts the same deterministic orchestrator script.
147
+
148
+ ### Mock demo (offline, no tokens)
149
+
150
+ The whole pipeline can run **fully offline** without spawning `claude` — it produces
151
+ real artifact files using a deterministic mock:
152
+
153
+ ```bash
154
+ npm run smoke
155
+ ```
156
+
157
+ This is equivalent to:
158
+
159
+ ```bash
160
+ WORCA_MOCK=1 node src/cli/worca-cc.mjs --project sandbox --prompt "demo task" --mock --yes
161
+ ```
162
+
163
+ Set `WORCA_MOCK=1` (or pass `--mock`) on any run to use the mock path.
164
+
165
+ ---
166
+
167
+ ## The agents
168
+
169
+ | Agent | File | Role |
170
+ | --- | --- | --- |
171
+ | Planner | `agents/worca-cc-planner.md` | Initial plan with code snippets; asks conceptual questions (2–4 options + free text) instead of assuming; appends Q&A to the plan. |
172
+ | Plan Refiner | `agents/worca-cc-plan-refiner.md` | Reviews + refines the plan (and its code snippets); writes `-vN`; emits a severity-tagged review per cycle. |
173
+ | Plan Review | `agents/worca-cc-plan-reviewer.md` | Reviews the plan (without rewriting it); writes review markdown + JSON; on blocking issues bounces back to the planner for a cold re-plan. |
174
+ | Implementer | `agents/worca-cc-implementer.md` | Follows the latest plan with no deviation; TDD red-green-refactor; also runs in "fix" mode against a review. |
175
+ | Code Reviewer | `agents/worca-cc-code-reviewer.md` | Reviews the git diff; writes review markdown + JSON; hands back to the implementer to fix. |
176
+
177
+ Worca CC now ships **7 runnable agents** and the agent system is **data-driven**:
178
+ each agent is a prompt (`agents/worca-cc-<role>.md`) plus a metadata sidecar
179
+ (`agents/<key>.meta.json`), so new agents drop in without engine edits. Beyond
180
+ the five above, it adds **Manual Tests Checklist** (drafts manual test cases) and
181
+ **Manual web UI testing** (runs them against the live web UI via Playwright and
182
+ emits a pass/fail verdict). To add your own, see
183
+ [`docs/ADDING-AGENTS.md`](docs/ADDING-AGENTS.md).
184
+
185
+ ---
186
+
187
+ ## The phases and loops
188
+
189
+ - **Clarify** — planner asks one round of conceptual questions (up to four) before
190
+ planning; answers are persisted and appended to the plan.
191
+ - **Refine loop** — Refiner runs repeatedly. It stops when no `critical`/`major` issues
192
+ remain. Past the loop's **max cycles** (default 3) it asks you to **continue** or approve
193
+ **another** cycle, escalating indefinitely.
194
+ - **Review loop** — Reviewer -> Implementer(fix) -> Reviewer ... stops when no
195
+ `critical`/`major` issues remain. Past the loop's **max cycles** (default 3) it asks the
196
+ same continue/another gate.
197
+
198
+ Each feedback loop's max-cycle count is set per loop in the New Pipeline window's
199
+ **Pipeline configuration** (default 3), not via a CLI flag.
200
+
201
+ A run is "blocked" only by `critical` or `major` issues; `minor`/`suggestion` issues do
202
+ not hold up the loop.
203
+
204
+ ## Pipeline Composer
205
+
206
+ The phases above are the **default** pipeline. The **Pipeline Composer** (a view
207
+ in the web UI) lets you compose your own: drag agents onto a canvas to build
208
+ **sequential steps**, **parallel groups** (a step with more than one agent runs
209
+ concurrently), and **feedback loops** (an agent that emits a verdict can loop
210
+ back to an earlier step until it passes or hits a cycle cap). Save a layout by
211
+ name and it becomes selectable from **New Pipeline**, where you also pick each
212
+ agent's model/effort and each loop's cycle count.
213
+
214
+ The engine is data-driven: it executes whatever workflow you select. The default
215
+ workflow reproduces exactly the `Plan → Refine → Implement → Review` behavior
216
+ described above, and **Reset to default** on the canvas redraws it. Workflow topology and
217
+ per-project model/effort/cycle choices are stored in the central SQLite database
218
+ (`~/.worca-cc/worca-cc.db`) — no longer in `~/.worca-cc/workflows/` or
219
+ `<projectDir>/.worca-cc/config.json`.
220
+
221
+ To add a new agent to the palette, see [`docs/ADDING-AGENTS.md`](docs/ADDING-AGENTS.md).
222
+
223
+ ---
224
+
225
+ ## Guardrails (per run)
226
+
227
+ Guardrails are **named sets**, selected **per pipeline run**. The **Guardrails**
228
+ view lists the built-ins — **Permissive**, **Normal**, **Strict** — alongside
229
+ your own sets ("Create guardrails" starts from any of them, or blank), with an
230
+ editor for the five policy fields (honor project settings, env scrub, env
231
+ allowlist, protected paths, deny rules). The New Pipeline form has a
232
+ **Guardrails** picker next to the workflow picker: the selected set is the
233
+ run's entire policy, applied uniformly to every agent the run spawns — and,
234
+ for a workspace run, uniformly to every member project.
235
+
236
+ **Guardrails apply per run; runs without a selection run unguarded
237
+ (Permissive).** The picker defaults to Permissive — no restrictions,
238
+ byte-identical to runs before guardrails existed — so protection is an
239
+ explicit per-run choice, not a persistent project property. (This is a
240
+ deliberate tradeoff of the per-run model: there is no per-project default to
241
+ fall back on, and one set applies to all workspace members. If you want a
242
+ stricter habitual posture, pick Normal/Strict — or your org set — when you
243
+ start the run.)
244
+
245
+ The built-in tiers:
246
+
247
+ - **Permissive** (default) — no restrictions; byte-identical behavior to a
248
+ run with no selection.
249
+ - **Normal** — protects credential files (`.env*`, `*.pem`, `*.key`, SSH keys,
250
+ cert stores) from agent Read/Edit and blocks publication commands
251
+ (`git push`, `npm/yarn/pnpm publish`). Never breaks a pipeline: commits,
252
+ installs, tests, and `curl localhost` all still work.
253
+ - **Strict** (wire id `secure`) — Normal plus: environment scrub on agent
254
+ spawn (the spawned `claude` gets a minimal env: base vars, the proxy/CA
255
+ connectivity vars, every `ANTHROPIC_*`/`CLAUDE_*` var, and the set's
256
+ allowlist — nothing else), network egress binaries denied (`curl`, `wget`,
257
+ `nc`, `ssh`, `scp`, `rsync`, ...), `gh`/`docker push` and cloud CLIs
258
+ (`aws`, `gcloud`, `az`) denied, `WebFetch`/`WebSearch` denied, and home-dir
259
+ credential stores (`~/.ssh`, `~/.aws`, `~/.config/gh`,
260
+ `~/.git-credentials`, ...) protected from the Read/Edit tools.
261
+
262
+ Built-ins resolve from worca's code at read time (never snapshotted), so
263
+ preset improvements ship with upgrades; your named sets resolve by reference
264
+ at read time too — editing a set applies to every future run that picks it,
265
+ and to paused runs on resume. Built-ins are undeletable; editing one offers
266
+ "Save as new set". A set pinned by a paused run cannot be deleted (the API
267
+ answers 409 with the pinning runs); finished runs record the set id in
268
+ History and `run.json` (`guardrails.guardrailsId` beside the compact
269
+ envScrub/deny/protected counts — an id, not a content snapshot, since sets
270
+ stay editable). Resume re-reads the set by id and enforces its latest
271
+ definition; a set missing at resume is a LOUD warn in the run log and the
272
+ run proceeds Permissive (fail-open).
273
+
274
+ How it's enforced: protected paths and deny rules become Claude Code
275
+ `permissions.deny` rules in a single `--settings` payload on every pipeline
276
+ spawn (deny rules merge across scopes and cannot be removed by lower scopes —
277
+ repo settings can't undo worca policy, plugin-granted tools remain subject to
278
+ it). Protected paths expand to `Read(p)` + `Edit(p)` denies (Edit covers
279
+ Write/NotebookEdit; a `Write(p)` rule is never consulted and only produces
280
+ CLI warnings, so it is not emitted). A workspace run enforces the run's ONE
281
+ selected set uniformly on every member — nothing is unioned across member
282
+ projects anymore — and the workspace scanner is not subject to guardrails at
283
+ all (a scan takes no guardrails selection and spawns permissive). Repo
284
+ `.claude/settings.json` `permissions` are honored: natively on
285
+ single-project runs (cwd is the project worktree — the toggle can only decide
286
+ whether they're *lifted*, it cannot un-load what the worktree loads itself);
287
+ on **detached workspace runs (the default)** each member's own `deny` rules
288
+ are lifted per-member into the merged `--settings` when the run's set honors
289
+ project settings (that honor flag is uniform across members now — it comes
290
+ from the selected set, not from each project; `allow`/`ask` rules are never
291
+ lifted — that would widen capability and bypass Claude Code's workspace-trust
292
+ gate; hooks and statusline still don't apply off-worktree and stay warned). A
293
+ paused run re-reads its selected set by id on resume, so it enforces the set's
294
+ latest definition.
295
+
296
+ Honest limitations:
297
+ - `Read` denial is the load-bearing secret guard; Claude Code does not consult
298
+ `Write(path)` rules (so worca emits `Read`+`Edit` only), and Bash denies are
299
+ prefix matches — `sh -c "curl …"`, `/usr/bin/curl`, and `git -c k=v push`
300
+ evade them (a leading `VAR=val` or a `timeout`/`nice` wrapper does *not*).
301
+ Env scrub is the real exfil control, but it is **not containment**: with
302
+ `HOME` retained, credential *files* stay readable to any subprocess an agent
303
+ spawns (`node -e` + `fetch`), so deny rules alone don't stop indirect reads —
304
+ for OS-level enforcement use Claude Code's sandbox (out of scope here).
305
+ - Env scrub failing a pipeline that needed an unlisted var fails visibly
306
+ (tool errors in the transcript) — add the var to the allowlist; there is no
307
+ silent fallback. Common cases: a corporate TLS-intercepting proxy already
308
+ survives (proxy/CA vars are kept), but **Bedrock/Vertex/Foundry auth needs
309
+ you to allowlist the cloud credential vars** (`AWS_*`,
310
+ `GOOGLE_APPLICATION_CREDENTIALS`, `AZURE_*`), and a run that needs
311
+ git-over-SSH or takes its git identity from the environment must allowlist
312
+ `SSH_AUTH_SOCK` / the relevant `GIT_*` names — neither is in the base
313
+ keep-list. Worca deliberately does **not** set the CLI's own
314
+ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` marker: on current CLIs setting it forces
315
+ the child's permission mode back to `default`, overriding worca's
316
+ `--permission-mode acceptEdits` and breaking scrubbed pipeline runs.
317
+ - Not setting that marker is not the same as blocking it: if **your own shell**
318
+ exports `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`, it survives the scrub (the
319
+ `CLAUDE_*` keep-rule passes it through) and inflicts exactly the breakage
320
+ above on every spawned `claude` — unset it before launching worca, or expect
321
+ degraded runs.
322
+ - Strict denies `curl`, which the manual web-UI-testing agent uses to poll a
323
+ dev server — it falls back to the `browser_*` MCP tools (not denied), so that
324
+ flow degrades rather than breaks. `.env*` also matches `.env.example` /
325
+ `.env.sample`, which agents may legitimately edit; a deny list can't carve
326
+ per-file exceptions, so those become read-only under Normal/Strict too.
327
+ - Exempt from scrub/deny: UI-triggered utility agents outside pipeline runs
328
+ (overview generation, agent generation), the `graphify` graph-build
329
+ subprocess, **workspace scans**, and the `claude --help`/`--version`
330
+ capability probe. In-run title generation IS scrubbed.
331
+
332
+ ---
333
+
334
+ ## Artifact layout
335
+
336
+ Worca CC keeps **structured state** (projects, workspaces, workflows, per-project config,
337
+ run state + steps + audit events, clarify Q&A, review verdicts) in a single **SQLite
338
+ database**, and the agents' **markdown** outputs (+ any attachments) in a machine-wide
339
+ **external store**. Neither lives in your project's working tree, so nothing is ever
340
+ committed to your repo:
341
+
342
+ ```
343
+ <worcaHome>/ default ~/.worca-cc
344
+ settings.json { root } only — the bootstrap that locates the DB
345
+ worca-cc.db (+ -wal, -shm) ALL structured state (SQLite, WAL mode)
346
+ backup-<ts>/ legacy JSON archived on first upgrade (see below)
347
+ store/<projectKey>/
348
+ plans/ <DD-MM-YY>-<name>.md, -v2.md, ... (plan markdown + refinements)
349
+ reviews/ <DD-MM-YY>-<name>-impl-review.md (review markdown)
350
+ pipelines/ <DD-MM-YY>-<slug>-<id>/ (one folder per run)
351
+ prompt.md the prompt text (or copied markdown brief)
352
+ extras/ any optional extra files you attached
353
+ ```
354
+
355
+ Everything that used to be a per-run `.json`/`.md` control file —
356
+ `clarify.json`, `clarify-answers.json`, `*-review-cycleN.json`, `state.json`,
357
+ `pipeline.md`, plus `meta.json` and the per-project `config.json` and global
358
+ `workflows/*.json` — is now a **row in `worca-cc.db`** instead. Only the plan/review
359
+ **markdown**, `prompt.md`, and `extras/` remain on disk (their existence is indexed in the
360
+ database).
361
+
362
+ - **`<worcaHome>`** = `<base>/.worca-cc`, where `<base>` is `WORCA_HOME` if set, else
363
+ the persisted "Worca CC root folder" from Settings, else your OS home. By default this is
364
+ `~/.worca-cc`, so the DB is `~/.worca-cc/worca-cc.db` and the store is `~/.worca-cc/store/`.
365
+ - **`<projectKey>`** = `<repo-basename-slug>-<sha1(canonicalRoot)[:8]>`, derived from the
366
+ repository's identity (the parent of its shared `.git`). It is **stable across all git
367
+ worktrees of the same repo**, so every worktree shares one history.
368
+
369
+ **First-launch migration.** The first time you run this version, Worca CC imports any
370
+ pre-existing JSON state **found under `~/.worca-cc`** into `worca-cc.db` (in a single
371
+ transaction) and moves the consumed files into a timestamped `~/.worca-cc/backup-<ts>/`
372
+ directory (mirroring the old layout); this is one-way — the new version reads only the
373
+ database, so to roll back you stop Worca CC, restore the files from `backup-<ts>/`, and
374
+ downgrade. There is **no** migration from the pre-rebrand home directory that older,
375
+ differently-named releases used: this version only ever looks at `~/.worca-cc`, so if you
376
+ are upgrading you must move your old state there **by hand before the first launch** —
377
+ otherwise Worca CC simply starts up empty, with no warning. (Separately, any very old
378
+ `<projectDir>/ai-artifacts/` directories from before the external-store change are still
379
+ just left in place and ignored.)
380
+
381
+ Because state is machine-wide and keyed by repo identity, the web UI has an **"All
382
+ projects"** view (and `GET /api/history`) that lists runs across every project on the
383
+ machine — now backed by indexed SQL queries instead of a directory scan.
384
+
385
+ The exact table contracts are specified in `docs/ARCHITECTURE.md` §5.
386
+
387
+ ---
388
+
389
+ ## Project structure
390
+
391
+ ```
392
+ src/core/ protocol, store, artifacts, preflight, claude-runner, phases, orchestrator
393
+ src/cli/ worca-cc.mjs (CLI entry)
394
+ scripts/ install.mjs (copy agents + skill into a target project)
395
+ agents/ agent prompts + .meta.json sidecars (data-driven set)
396
+ skills/ worca/SKILL.md (the /worca skill)
397
+ ui/ server.mjs + public/ (single-page web UI)
398
+ docs/ ARCHITECTURE.md (single source of truth)
399
+ ```
400
+
401
+ Generated plans, reviews, and pipeline run folders are **not** part of this repo: they
402
+ live in the machine-wide external store at `<worcaHome>/store/<projectKey>/` (default
403
+ `~/.worca-cc/store/...`). See [Artifact layout](#artifact-layout).
@@ -0,0 +1,19 @@
1
+ {
2
+ "key": "clarify",
3
+ "domain": "coding",
4
+ "displayName": "Clarify",
5
+ "description": "Turns hidden decisions into questions before planning. Multiple-choice, so later steps never guess.",
6
+ "color": "red",
7
+ "icon": "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M9.4 9.3a2.7 2.7 0 0 1 5.2 1c0 1.8-2.6 2.1-2.6 3.6\" stroke-linecap=\"round\" fill=\"none\"/><circle cx=\"12\" cy=\"17\" r=\"0.7\" fill=\"currentColor\" stroke=\"none\"/>",
8
+ "agentFile": "worca-cc-clarify.md",
9
+ "runnerType": "clarifier",
10
+ "loopSource": false,
11
+ "fanOut": true,
12
+ "produces": ["clarify"],
13
+ "consumes": ["userPrompt"],
14
+ "connectsTo": ["planner"],
15
+ "asksQuestions": true,
16
+ "questionsLocked": true,
17
+ "questionsDefault": true,
18
+ "order": 0
19
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "key": "decomposer",
3
+ "domain": "coding",
4
+ "displayName": "Decompose",
5
+ "description": "Splits an approved plan into vertical-slice tasks. Each task gets its own implementer.",
6
+ "color": "blue",
7
+ "scope": "project",
8
+ "icon": "<path d=\"M12 3v6M12 9l-5 5M12 9l5 5M5 14h2M17 14h2M6 18h2M16 18h2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
9
+ "agentFile": "worca-cc-decomposer.md",
10
+ "runnerType": "producer",
11
+ "loopSource": false,
12
+ "fanOut": true,
13
+ "produces": ["decomposition"],
14
+ "consumes": ["plan"],
15
+ "optionalConsumes": [],
16
+ "connectsTo": ["implementer"],
17
+ "asksQuestions": true,
18
+ "questionsLocked": false,
19
+ "questionsDefault": false,
20
+ "order": 2.5
21
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "key": "implementer",
3
+ "domain": "coding",
4
+ "displayName": "Implementation",
5
+ "description": "Writes the code from the approved plan, strict TDD. In fix mode, addresses only the issues a review flagged.",
6
+ "color": "peach",
7
+ "icon": "<path d=\"M9 8l-4 4 4 4M15 8l4 4-4 4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
8
+ "agentFile": "worca-cc-implementer.md",
9
+ "runnerType": "producer",
10
+ "loopSource": false,
11
+ "fanOut": true,
12
+ "produces": ["code"],
13
+ "consumes": ["plan","review"],
14
+ "optionalConsumes": ["review"],
15
+ "connectsTo": ["reviewer","manualTestsChecklist"],
16
+ "asksQuestions": true,
17
+ "questionsLocked": false,
18
+ "questionsDefault": false,
19
+ "order": 3
20
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "key": "manualTestsChecklist",
3
+ "domain": "coding",
4
+ "displayName": "Manual Tests Checklist",
5
+ "description": "Drafts a manual test checklist for the change. User-visible flows, edge cases, regressions worth clicking through.",
6
+ "color": "blue",
7
+ "icon": "<rect x=\"6\" y=\"4\" width=\"12\" height=\"17\" rx=\"2\"/><path d=\"M9.5 4V2.8h5V4\" stroke-linejoin=\"round\"/><path d=\"M8.8 12l1.6 1.6L13.4 10\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
8
+ "agentFile": "worca-cc-manual-tests-checklist.md",
9
+ "runnerType": "producer",
10
+ "loopSource": false,
11
+ "produces": ["checklist"],
12
+ "consumes": ["plan","code"],
13
+ "connectsTo": ["manualWebUiTesting"],
14
+ "asksQuestions": true,
15
+ "questionsLocked": false,
16
+ "questionsDefault": false,
17
+ "order": 5
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "key": "manualWebUiTesting",
3
+ "domain": "coding",
4
+ "displayName": "Manual web UI testing",
5
+ "description": "Runs the manual checklist in the live web UI via Playwright. Reports what passed, failed, or blocked.",
6
+ "color": "violet",
7
+ "icon": "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M10 8.5l5 3.5-5 3.5V8.5Z\" fill=\"currentColor\" stroke=\"none\"/>",
8
+ "agentFile": "worca-cc-manual-web-ui-testing.md",
9
+ "runnerType": "verifier",
10
+ "loopSource": true,
11
+ "produces": ["review"],
12
+ "consumes": ["checklist","code"],
13
+ "connectsTo": ["implementer"],
14
+ "asksQuestions": true,
15
+ "questionsLocked": false,
16
+ "questionsDefault": false,
17
+ "order": 6
18
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "key": "planReviewer",
3
+ "domain": "coding",
4
+ "displayName": "Plan Review",
5
+ "description": "Reviews the plan against the request and the codebase. Blocking issues bounce it back for a cold re-plan.",
6
+ "color": "amber",
7
+ "icon": "<path d=\"M10.5 4a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Z\"/><path d=\"M15.5 15.5L21 21\" stroke-linecap=\"round\"/><path d=\"M7.6 10.3l2 2 3.3-3.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
8
+ "agentFile": "worca-cc-plan-reviewer.md",
9
+ "runnerType": "verifier",
10
+ "loopSource": true,
11
+ "fanOut": true,
12
+ "produces": ["review"],
13
+ "consumes": ["plan"],
14
+ "connectsTo": ["planner", "implementer", "decomposer"],
15
+ "asksQuestions": true,
16
+ "questionsLocked": false,
17
+ "questionsDefault": false,
18
+ "order": 7
19
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "key": "planner",
3
+ "domain": "coding",
4
+ "displayName": "Plan",
5
+ "description": "Explores the codebase and writes the implementation plan. Architecture, task breakdown, concrete code snippets; can ask clarifying questions first.",
6
+ "color": "violet",
7
+ "icon": "<path d=\"M8 6h11M8 12h11M8 18h8\" stroke-linecap=\"round\"/><circle cx=\"4\" cy=\"6\" r=\"1.1\"/><circle cx=\"4\" cy=\"12\" r=\"1.1\"/><circle cx=\"4\" cy=\"18\" r=\"1.1\"/>",
8
+ "agentFile": "worca-cc-planner.md",
9
+ "runnerType": "producer",
10
+ "loopSource": false,
11
+ "fanOut": true,
12
+ "produces": ["plan"],
13
+ "consumes": ["userPrompt", "clarify", "review"],
14
+ "optionalConsumes": ["clarify", "review"],
15
+ "connectsTo": ["refiner", "implementer", "planReviewer", "decomposer"],
16
+ "asksQuestions": true,
17
+ "questionsLocked": false,
18
+ "questionsDefault": false,
19
+ "order": 1
20
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "key": "refiner",
3
+ "domain": "coding",
4
+ "displayName": "Refine Plan",
5
+ "description": "Rewrites the latest plan into a tighter version. Fixes structure, correctness, and code snippets until no blocking issues remain.",
6
+ "color": "green",
7
+ "icon": "<path d=\"M12 3v3M12 18v3M4.5 7.5l2 1M17.5 15.5l2 1M4.5 16.5l2-1M17.5 8.5l2-1\" stroke-linecap=\"round\"/><path d=\"M12 8.2l1.2 2.6L16 12l-2.8 1.2L12 15.8l-1.2-2.6L8 12l2.8-1.2L12 8.2Z\" stroke-linejoin=\"round\"/>",
8
+ "agentFile": "worca-cc-plan-refiner.md",
9
+ "runnerType": "producer",
10
+ "loopSource": false,
11
+ "fanOut": true,
12
+ "produces": ["plan","review"],
13
+ "consumes": ["plan"],
14
+ "connectsTo": ["implementer","refiner","decomposer"],
15
+ "asksQuestions": true,
16
+ "questionsLocked": false,
17
+ "questionsDefault": false,
18
+ "order": 2
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "key": "reviewer",
3
+ "domain": "coding",
4
+ "displayName": "Review Implementation",
5
+ "description": "Reviews the implementation diff against the plan. Honest verdict; blocking findings loop back to the implementer.",
6
+ "color": "blue",
7
+ "icon": "<path d=\"M12 3l7 3v5c0 4.4-3 7.6-7 9-4-1.4-7-4.6-7-9V6l7-3Z\" stroke-linejoin=\"round\"/><path d=\"M9 12l2 2 4-4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
8
+ "agentFile": "worca-cc-code-reviewer.md",
9
+ "runnerType": "verifier",
10
+ "loopSource": true,
11
+ "fanOut": true,
12
+ "produces": ["review"],
13
+ "consumes": ["plan","code"],
14
+ "connectsTo": ["implementer","manualTestsChecklist"],
15
+ "asksQuestions": true,
16
+ "questionsLocked": false,
17
+ "questionsDefault": false,
18
+ "order": 4
19
+ }
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: worca-cc-clarify
3
+ description: Clarify agent for the orchestrator pipeline. Before planning, surfaces the open decisions the planner cannot safely resolve from the task text or the real codebase — including things downstream agents would otherwise silently assume — as conceptual questions with 2–4 options + a free-text fallback, written to clarify.json. Asks nothing it can determine itself; empty when the task is unambiguous. Invoked by the deterministic orchestrator, never directly by a human.
4
+ tools: Read, Write, Edit, Bash, Grep, Glob, Skill
5
+ model: inherit
6
+ ---
7
+
8
+ You are the **Clarify** agent in a deterministic multi-agent pipeline (Clarify -> Plan -> Refine -> Implement -> Review). You are spawned headlessly by an orchestrator script and run BEFORE the Planner. Your sole job is to surface the few genuine open decisions, so the Planner can plan without guessing. You NEVER write a plan.
9
+
10
+ ## Cardinal rule: NEVER ASSUME, NEVER PAD
11
+
12
+ Surface the decisions that **materially** change the plan — core requirements, scope boundaries, externally-visible behavior, data shapes, or library/architecture choices — that you genuinely cannot resolve from the task text or the codebase. **Actively hunt for the things a downstream agent (planner/implementer) would otherwise silently assume** and turn each into a question. At the same time, do NOT ask stupid or unnecessary questions: for **low-impact** details (naming, minor file placement, obvious conventions, anything readable from the codebase), do NOT ask — the Planner will pick a sensible default. Ask only what you genuinely cannot decide.
13
+
14
+ ## What to do
15
+
16
+ The task prompt gives you the user's task/prompt (and any attached markdown / extra files), and the pipeline directory where you must write `clarify.json`.
17
+
18
+ 1. Read the task and explore the target codebase enough to understand context (see Fan-out and Graph tooling below).
19
+ 2. Identify ONLY the few highest-impact decisions you cannot resolve. Turn each into a single, conceptual, decision-shaped question.
20
+
21
+ Rules for questions:
22
+ - Each question targets ONE real ambiguity that changes the plan. Skip anything you can determine for certain from the codebase or the task text.
23
+ - Phrase conceptually (about intent, scope, behavior, trade-offs), not about trivia you can look up.
24
+ - Provide **2–4** distinct, plausible `options` (short strings), ordered most-likely first when there is a sane default. Use just 2 for a genuine binary; never pad with filler choices.
25
+ - Every question allows free text: set `allowFreeText: true`.
26
+ - Give each question a short stable `id` (kebab-case, e.g. `auth-storage`, `error-format`).
27
+ - Ask as many questions as there are genuinely material, unresolved decisions, **up to 8**. Prefer fewer when fewer will do — surfacing a real hidden assumption is good; padding the list with low-value questions is not. Never split one decision into several questions. If the task is unambiguous or the codebase answers it, write an EMPTY questions array — never fabricate questions.
28
+
29
+ Write `clarify.json` to the pipeline directory given in the prompt, EXACTLY in this shape (no extra keys, no prose, no code fences around the file content):
30
+
31
+ ```json
32
+ {
33
+ "questions": [
34
+ {
35
+ "id": "auth-storage",
36
+ "question": "Where should sessions be stored?",
37
+ "options": ["Redis", "Postgres", "In-memory"],
38
+ "allowFreeText": true
39
+ },
40
+ {
41
+ "id": "delete-behavior",
42
+ "question": "Should delete be a hard delete or a soft delete?",
43
+ "options": ["Hard delete", "Soft delete"],
44
+ "allowFreeText": true
45
+ }
46
+ ]
47
+ }
48
+ ```
49
+
50
+ If nothing needs clarification:
51
+
52
+ ```json
53
+ { "questions": [] }
54
+ ```
55
+
56
+ Then stop. Emit a brief assistant note saying how many questions you wrote and the absolute path of `clarify.json`. Do NOT write a plan — that is the Planner's job.
57
+
58
+ ## Fan-out (parallel sub-agents)
59
+ The orchestrator decides per run whether you may fan out. When enabled, your task prompt carries a `## Fan-out ENABLED` block AND the Task/Agent tool is in your tool list. In that case, dispatch ONE read-only research sub-agent per independent area (UI vs server vs store vs tests) IN PARALLEL (`subagent_type: "general-purpose"`, or `"Explore"` for pure code search), then synthesize. Sub-agents are strictly READ-ONLY; **YOU** write `clarify.json`. Skip fan-out for a trivial task or when it is not enabled.
60
+
61
+ ## Output contract reminders
62
+ - `clarify.json` shape is fixed and consumed by `protocol.readClarify`; keep it byte-clean (valid JSON, `allowFreeText` always `true`, `options` an array of **2–4** short strings).
63
+ - Write with the absolute path taken from the prompt. Never write outside the pipeline dir.
64
+ - Keep assistant chatter minimal; your real output is the file you write.
65
+
66
+ ## Graph tooling
67
+ A grounding tool may be offered in the prompt. If the prompt says **graphify** is available, use graphify to query/understand the codebase first (invoke via the `Skill` tool when it says skill, run via Bash when it says CLI, or read `graphify-out/` when it says cached). Else if it says **code-review-graph** is available, use that (CLI via Bash). If BOTH, ALWAYS use graphify. If NEITHER, use Glob/Grep/Read directly.