@yeison.restrepo.r/code-conductor 1.38.0 → 1.39.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.
- package/README.md +17 -10
- package/bin/code-conductor.mjs +4 -2
- package/global/CLAUDE.md +5 -3
- package/global/commands/cc-stack.md +8 -2
- package/lib/installer/deploy.mjs +29 -0
- package/package.json +1 -1
- package/project-template/.claude/agents/define-review.md +24 -0
- package/project-template/.claude/commands/cc-orchestrate.md +64 -3
- package/project-template/.claude/commands/cc-plan.md +12 -0
- package/project-template/.claude/commands/cc-resume.md +9 -3
- package/project-template/.claude/hooks/pre-tool-use.mjs +23 -10
- package/project-template/.claude/review-loop.settings.json +1 -0
- package/scripts/orchestrate.mjs +37 -1
- package/skills/memory-first/SKILL.md +5 -4
package/README.md
CHANGED
|
@@ -98,13 +98,6 @@ Four checks live in `tools/` as tracked repository infrastructure. Three of them
|
|
|
98
98
|
|
|
99
99
|
## Known limits
|
|
100
100
|
|
|
101
|
-
- **`[BUG-045]`, open:** the Guard 3 allowlist cannot cover a quoted path, because the boundary sets it interpolates contain no quote character, so an entry `docs/` does not cover `cat "docs/x.md" *.md`. Filed with its ritual priced, untouched pending its own change.
|
|
102
|
-
- **`[BUG-032]`, open:** global memory preferences sit outside the documented lookup chain. Nothing in the chain points at `~/.claude/memory/personal.md`, and the installer never deploys `global/memory/`, so a preference filed there is never read by the agent it was written for.
|
|
103
|
-
- **`[BUG-050]`, open:** the release instruments are silent on sub-shaped ids. `tools/record-parity.mjs` and `tools/id-ceiling.mjs` neither read nor reject an id like `[ARCH-008-S1]`, so a release claiming one would pass record parity having read nothing. No shipped release does; releases claim top-level ids until the item's spec chooses its repair.
|
|
104
|
-
- **`[BUG-051]`, open:** two shipped commands run `scripts/detect-stack.mjs`, but the installer deploys the detector to `.claude/scripts/`. In an installed project, `/cc-stack` fails loud (`MODULE_NOT_FOUND`, "no stack"), and `/cc-resume`'s blank-command auto-fill silently skips. Until it is fixed, `/cc-init`, which already uses the deployed path, records the stack and commands.
|
|
105
|
-
- **`[BUG-052]`, open:** the installer has no self-install guard. Its sweep of the 1.23.2 legacy root `scripts/` matches by exact file list, which the development repository satisfies by identity, so running `--project` inside this repository deletes tracked source. Do not run the installer against a clone of code-conductor itself.
|
|
106
|
-
- **`[BUG-053]`, open:** the pre-commit test gate that the retired `install.sh` appended runs `npm test` with git's hook environment. From a linked worktree, git hands hooks an absolute `GIT_DIR` and `GIT_INDEX_FILE`, so the suite's fixture `git` commands write into the real repository's refs, config and index. Do not run the gate from a linked worktree.
|
|
107
|
-
- **`[BUG-054]`, open:** `/cc-plan` generates staging steps that leave out the plan file itself, so a task's ticked checkboxes have no commit to ride. Until it is fixed, add the plan path to each task's `git add -u` list when you review a generated plan.
|
|
108
101
|
- **The orchestrator (`1.36.0`) assumes cooperative agents.**
|
|
109
102
|
- Guard 6 does not cover `Bash` writes, `claude -p` children included.
|
|
110
103
|
- Inside a live run, a non-role agent the main session dispatched may write the orchestrator's write surface, the band envelope included.
|
|
@@ -126,8 +119,9 @@ Four checks live in `tools/` as tracked repository infrastructure. Three of them
|
|
|
126
119
|
- **The role agents (`1.37.0`) are bounded by their tool masks, and Guard 7 bounds one thing beneath them: the shell.**
|
|
127
120
|
- `qa`'s test command is enforcement: Guard 5 keeps qa from writing, so qa only ever runs files it did not write. `code`'s identical allowance is process discipline, not a security boundary, because code writes the tests that command runs.
|
|
128
121
|
- The profiles are live in this repository, because the mirror convention puts them in `.claude/agents/`. The standing rule forbids starting an orchestrator run here; it does not forbid the files being present. A role dispatched by hand through `/agents` or `Agent` creates no band envelope, so Guard 5 allows every write its mask holds, which is `[ARCH-010]`'s no-envelope rule. Guard 7 still denies it the shell. This is named, not fixed.
|
|
129
|
-
- Installing or updating copies `.claude/agents/{spec,plan,code,audit,qa}.md` over the host project's files of the same names, as it does every shipped `.claude/` asset.
|
|
122
|
+
- Installing or updating copies `.claude/agents/{spec,plan,code,audit,qa,define-review}.md` over the host project's files of the same names, as it does every shipped `.claude/` asset.
|
|
130
123
|
- A gate certifies protocol position and the claim its role states, never the truth of the work beyond that claim.
|
|
124
|
+
- **The review loop (`1.39.0`) is process discipline.** The spec or plan envelope stays installed after its hand-back, so the role can revise. Outside a round, its writes are bounded by its tool mask, Guard 5's scope, the re-hash before `approve`, and your review. Gating Guard 5 on an open round is a follow-up candidate.
|
|
131
125
|
- **The `P7` false positive above**, still live.
|
|
132
126
|
- **A re-run against an untouched `project.md` prints a recovery hint it cannot prove is needed.** If you install, never write anything into `.claude/memory/project.md`, and install again, you get a line suggesting the file may have been overwritten by a pre-`1.30.0` re-run. It was not; it equals the stub because it was seeded and never edited. The check compares content and **cannot distinguish "seeded and untouched" from "clobbered"**, which is why the wording is hedged to "may have been" rather than "was". This residual is named and accepted in [`BUG-039`'s spec at `:129`](docs/superpowers/specs/2026-09-27-bug039-installer-host-owned-state-design.md), where the alternative (restoring from the host's own git history) was rejected as writing host files out of the host's history with new failure modes. A **fresh** install is silent, which the Quickstart shows.
|
|
133
127
|
- **Four open dossiers**, which are the evidence-collection pipeline working rather than a backlog: a session denial tally, one for interleaved-artifact reports, an intermittent commit-hook hang in the `snap-build` suite, and detect-stack failing whole on a non-string `package.json` script. A dossier holds specimens until a mechanism is characterized by probe; an id is minted only when the written condition is met. `[BUG-047]` is what that pipeline produces when it completes: an out-of-scope note, then a dossier, then four specimens across four sessions, then a mint, then a release.
|
|
@@ -234,7 +228,7 @@ All commands are tagged `(Conductor)` in the Claude Code command palette so they
|
|
|
234
228
|
| `/cc-plan` | Require an approved spec, map the codebase, and generate an ordered implementation plan with exact file paths, a test list, a commit order, and identified risks. Every generated task line carries a unique `[T-NNN]` ID (min 3 digits, unlimited suffix depth) using plain ASCII checkboxes — enforced at generation time. |
|
|
235
229
|
| `/cc-compact` | Phase-boundary command. Serializes the current phase's essential state (decisions, pending steps, files touched, constraints) into a single-line SNAP JSON snapshot at `.claude/memory/session-snapshot.json` — and, when Node `>= 22.5` is available, a git-hash-keyed row in the local `.conductor/cache.db` — then prompts you to run `/compact` to clear conversation history. Run at the end of every phase to prevent context overflow. |
|
|
236
230
|
| `/cc-implement` | Execute implementation tasks from an approved plan using a surgical 5-step ritual: Grep-locate pending tasks → single-line Read verify → pre-flip `[ ]` to `[>]` → execute → post-flip to `[X]` or `[!]`. Never reads or rewrites the full plan file. Includes dependency evaluation, drift detection, and a Step 6 hook that records each task's final state to a local SQLite cache (see below). |
|
|
237
|
-
| `/cc-orchestrate <ITEM> [--auto] [--ticket <N\|issue URL>]` | Route one backlog item through Define, Build and Verify. For each role it builds, validates (`snap-validate --to`) and installs a SNAP v3 band envelope, dispatches the agent named after the role, waits for its completion notice, and checks the one `SNAP_HANDBACK` line of its delivered hand-back before the next. It pauses before every dispatch unless `--auto`; the spec and plan approvals always pause. A failed validation halts the run, terminally in this version (recover with `end`, then `start`). It needs agent definitions named `spec`, `plan`, `code`, `audit` and `qa` in `.claude/agents/` or `~/.claude/agents/`, which ship from `1.37.0`; a root `package.json` with a `test` script, or a stack whose test command detect-stack names, since `start` records the one command `code` and `qa` may run and halts when none resolves; and plans in the writing-plans format (`### Task N` with a `**Files:**` block). Release stays human. `--ticket` binds the run to a GitHub issue: `start` fetches it once through `gh`, halts on a pull request, a closed issue, or an empty or over-65536-byte body, and writes the body into a fenced, hashed snapshot at `.conductor/ticket/<ITEM>.md`, which only the spec role reads, as untrusted requirement input. After release, the owner runs `node .claude/scripts/ticket.mjs writeback <ITEM> --version <v> --pr <N\|url> [--changelog <file>] [--close]`, which posts one outcome comment to the bound issue, never twice for the same version, and closes it only with `--close`. |
|
|
231
|
+
| `/cc-orchestrate <ITEM> [--auto] [--ticket <N\|issue URL>]` | Route one backlog item through Define, Build and Verify. For each role it builds, validates (`snap-validate --to`) and installs a SNAP v3 band envelope, dispatches the agent named after the role, waits for its completion notice, and checks the one `SNAP_HANDBACK` line of its delivered hand-back before the next. It pauses before every dispatch unless `--auto`; the spec and plan approvals always pause. Before each, a review loop checks the document with a fresh read-only `define-review` agent and sends open rows back to its author, at most three passes; it is advisory and fails open (see Review loop configurations). A failed validation halts the run, terminally in this version (recover with `end`, then `start`). It needs agent definitions named `spec`, `plan`, `code`, `audit` and `qa` in `.claude/agents/` or `~/.claude/agents/`, which ship from `1.37.0`; a root `package.json` with a `test` script, or a stack whose test command detect-stack names, since `start` records the one command `code` and `qa` may run and halts when none resolves; and plans in the writing-plans format (`### Task N` with a `**Files:**` block). Release stays human. `--ticket` binds the run to a GitHub issue: `start` fetches it once through `gh`, halts on a pull request, a closed issue, or an empty or over-65536-byte body, and writes the body into a fenced, hashed snapshot at `.conductor/ticket/<ITEM>.md`, which only the spec role reads, as untrusted requirement input. After release, the owner runs `node .claude/scripts/ticket.mjs writeback <ITEM> --version <v> --pr <N\|url> [--changelog <file>] [--close]`, which posts one outcome comment to the bound issue, never twice for the same version, and closes it only with `--close`. |
|
|
238
232
|
|
|
239
233
|
Each of `/cc-spec`, `/cc-plan`, and `/cc-implement` opens its phase with a **resume read** (`scripts/resume-read.mjs`): it restores any context stored for the current git commit, so work survives branch switches and rollbacks (see [Local State Cache & Session Persistence](#local-state-cache--session-persistence--v1220)).
|
|
240
234
|
| `/cc-review [file\|dir]` | Review code in three layers - Critical / Important / Suggestion - then deliver a verdict and offer to auto-fix. |
|
|
@@ -245,6 +239,18 @@ Each of `/cc-spec`, `/cc-plan`, and `/cc-implement` opens its phase with a **res
|
|
|
245
239
|
|
|
246
240
|
---
|
|
247
241
|
|
|
242
|
+
### Review loop configurations
|
|
243
|
+
|
|
244
|
+
Before each define approval, `/cc-orchestrate` runs a review loop (`[FEAT-041]`): a fresh read-only `define-review` agent checks the spec or plan against a declared checklist, and while rows stay open the orchestrator sends them back to the role that wrote the document, up to three reviewer passes and two revisions. It is advisory: it never gates, never halts the run, and never replaces your approval, which only a message you send gives. What a round costs depends on how you launched Claude Code, measured on `claude` 2.1.292:
|
|
245
|
+
|
|
246
|
+
| Configuration | Per round |
|
|
247
|
+
|---|---|
|
|
248
|
+
| Auto mode with the shipped exception: `claude --permission-mode auto --settings .claude/review-loop.settings.json` | 0 owner wakes, 0 prompts |
|
|
249
|
+
| Default (ask) permission mode | 0 wakes; one approval per revision write, plus the orchestrator's `review` calls and report writes |
|
|
250
|
+
| Plain auto mode | the auto mode classifier denies the first revision request; the loop closes `skipped:denied`, and you get round 1's findings, unrevised |
|
|
251
|
+
|
|
252
|
+
`.claude/review-loop.settings.json` holds one auto mode allow rule that names this protocol. The installer never writes `autoMode` into `~/.claude/settings.json`, and Claude Code ignores `autoMode` in project settings, so the rule applies only when you pass the file yourself. Read it before you pass it: a cloned repository could ship a different file under the same name.
|
|
253
|
+
|
|
248
254
|
## Skills
|
|
249
255
|
|
|
250
256
|
Skills extend agent behavior for cross-cutting concerns that apply regardless of stack.
|
|
@@ -426,7 +432,8 @@ code-conductor/
|
|
|
426
432
|
│ ├── gitignore Merged into the host project's .gitignore
|
|
427
433
|
│ └── .claude/
|
|
428
434
|
│ ├── settings.json Hooks wiring (pre-tool-use, post-compact)
|
|
429
|
-
│ ├──
|
|
435
|
+
│ ├── review-loop.settings.json Auto mode exception for the review loop (FEAT-041)
|
|
436
|
+
│ ├── agents/ Band roles: spec, plan, code, audit, qa (FEAT-012); define-review (FEAT-041)
|
|
430
437
|
│ ├── commands/
|
|
431
438
|
│ │ ├── cc-init.md /cc-init — session initialization
|
|
432
439
|
│ │ ├── cc-resume.md /cc-resume — session context restore
|
package/bin/code-conductor.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { readFileSync, realpathSync } from 'node:fs';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { resolveAssetRoot, resolveHome, nodeMajorAtLeast } from '../lib/installer/env.mjs';
|
|
6
|
-
import { assertAssets, assertMergeTargets, deployGlobal, deployProject, chmodHooks } from '../lib/installer/deploy.mjs';
|
|
6
|
+
import { assertAssets, assertMergeTargets, assertNotSelfInstall, deployGlobal, deployProject, chmodHooks } from '../lib/installer/deploy.mjs';
|
|
7
7
|
import { verbosityHookCommand, mergeVerbosityHook } from '../lib/installer/settings.mjs';
|
|
8
8
|
import { healGraphifyHook } from '../lib/installer/heal.mjs';
|
|
9
9
|
import { writeVerbosity, writeVersionFile } from '../lib/installer/config.mjs';
|
|
@@ -90,6 +90,7 @@ export function run(argv, env = process.env, { cwd = process.cwd(), log } = {})
|
|
|
90
90
|
try {
|
|
91
91
|
assertAssets(assetRoot, ['global', 'skills', 'scripts', 'project-template']); // pre-flight
|
|
92
92
|
assertMergeTargets(home, cwd, opts.project); // pre-flight
|
|
93
|
+
if (opts.project) assertNotSelfInstall(assetRoot, cwd); // pre-flight, BUG-052
|
|
93
94
|
writing = true; // copy phase begins
|
|
94
95
|
const claudeDir = deployGlobal(assetRoot, home, { warn: (m) => emit('stderr', m), report: (m) => emit('stdout', m) });
|
|
95
96
|
chmodHooks(claudeDir);
|
|
@@ -113,7 +114,8 @@ export function run(argv, env = process.env, { cwd = process.cwd(), log } = {})
|
|
|
113
114
|
}
|
|
114
115
|
// Precondition conflict (--project target is a non-directory) → exit 1, not 2:
|
|
115
116
|
// nothing was partially written for the project, the path is simply unusable.
|
|
116
|
-
|
|
117
|
+
// SELF_INSTALL is caught in pre-flight; this mapping is the backstop should that ordering ever change.
|
|
118
|
+
if (err.code === 'PROJECT_TARGET_NOT_DIR' || err.code === 'SELF_INSTALL') { emit('stderr', `code-conductor: ${err.message}`); return 1; }
|
|
117
119
|
// Environment errors that surface on the very first write are still exit 1.
|
|
118
120
|
if (err.code === 'EROFS') { emit('stderr', `code-conductor: cannot write to ${err.path} (read-only file system) — remount writable or adjust permissions`); return 1; }
|
|
119
121
|
if (err.code === 'EACCES' || err.code === 'EPERM') { emit('stderr', `code-conductor: permission denied writing ${err.path} — fix with chmod/chown`); return 1; }
|
package/global/CLAUDE.md
CHANGED
|
@@ -23,7 +23,7 @@ Never write code without an approved spec. Never start implementing without an a
|
|
|
23
23
|
|
|
24
24
|
Before reading any file or spawning any search, classify the task and walk this chain. Stop at the first step that answers the question.
|
|
25
25
|
|
|
26
|
-
1. **Memory**: check `.claude/memory/project.md
|
|
26
|
+
1. **Memory**: check `.claude/memory/project.md` (project) and `~/.claude/memory/personal.md` (global preferences). If the answer is there, stop.
|
|
27
27
|
2. **Grep / Glob** — pattern search? Use `Grep` or `Glob` inline. Stop.
|
|
28
28
|
3. **Explore sub-agent** — need 3+ files to answer one question? Spawn an `Explore` sub-agent. It returns a ≤200-word summary. Main context receives only the summary. Stop.
|
|
29
29
|
4. **Parallel agents** — 2+ independent implementation tasks? Spawn parallel agents in worktrees. Each returns a ≤200-word summary.
|
|
@@ -61,8 +61,10 @@ Auto-run `/cc-stack` at the start of every session. It runs the dynamic detector
|
|
|
61
61
|
|
|
62
62
|
## Memory
|
|
63
63
|
|
|
64
|
-
- `project.md` — in git, shared with the team. Decisions, conventions, debt, workarounds.
|
|
65
|
-
- `personal.md` — local only, never committed. Developer preferences, personal shortcuts.
|
|
64
|
+
- `project.md` — at `.claude/memory/project.md`, in git, shared with the team. Decisions, conventions, debt, workarounds.
|
|
65
|
+
- `personal.md` — local only, never committed. Developer preferences, personal shortcuts. Two files carry this name:
|
|
66
|
+
- `~/.claude/memory/personal.md` is the cross-project default. Read it at session start alongside project memory.
|
|
67
|
+
- `.claude/memory/personal.md` is this project's copy, written by `/cc-checkpoint` and read by `/cc-resume`. It wins on any clash, because the most specific layer wins, as in settings.
|
|
66
68
|
- Run `/cc-checkpoint` before `/compact`, after feature completion, after key architectural decisions.
|
|
67
69
|
|
|
68
70
|
## Delegation
|
|
@@ -6,7 +6,7 @@ Detect the project stack dynamically and record it in the project's root `CLAUDE
|
|
|
6
6
|
|
|
7
7
|
## 1. Resolve the repository root
|
|
8
8
|
|
|
9
|
-
Run `git rev-parse --show-toplevel`. If it fails (not a git repo), fall back to the directory that contains `scripts/detect-stack.mjs`. Run every command below from that root, and treat the root-level `CLAUDE.md` as the only write target regardless of the user's current subdirectory.
|
|
9
|
+
Run `git rev-parse --show-toplevel`. If it fails (not a git repo), fall back to the project root: the directory that contains `.claude/scripts/detect-stack.mjs` or, failing that, `scripts/detect-stack.mjs`. The root is the directory holding that relative path, never the scripts directory itself, so nothing runs from or writes into it. Run every command below from that root, and treat the root-level `CLAUDE.md` as the only write target regardless of the user's current subdirectory.
|
|
10
10
|
|
|
11
11
|
## 2. Verify Node is available
|
|
12
12
|
|
|
@@ -14,7 +14,13 @@ Probe with `node --version`. If it exits non-zero or reports "not found", stop t
|
|
|
14
14
|
|
|
15
15
|
## 3. Run the detector
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Resolve the detector by presence, the deployed copy first:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
D=.claude/scripts/detect-stack.mjs; [ -f "$D" ] || D=scripts/detect-stack.mjs
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Run `node "$D"` from the repo root, capture stdout, and parse it as JSON. Nothing executes the JSON; consume it as data.
|
|
18
24
|
|
|
19
25
|
Treat all of the following identically as "no stack detected" - announce it in one line and leave `CLAUDE.md` unmodified (surface stderr if any, but it is non-fatal):
|
|
20
26
|
- non-zero exit code,
|
package/lib/installer/deploy.mjs
CHANGED
|
@@ -168,8 +168,37 @@ function warnIfProjectMemoryIsStub(templateClaude, target, emit) {
|
|
|
168
168
|
return true;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
// [BUG-052] Self-install guard: refuse to deploy into the package's own source tree.
|
|
172
|
+
// The sweep heuristic matches by exact file list, which the dev repo satisfies by
|
|
173
|
+
// identity, so --project there would delete tracked source files.
|
|
174
|
+
export function assertNotSelfInstall(assetRoot, cwd) {
|
|
175
|
+
const selfName = packageName(join(assetRoot, 'package.json'));
|
|
176
|
+
if (!selfName || selfName !== packageName(join(cwd, 'package.json'))) return;
|
|
177
|
+
const err = new Error(
|
|
178
|
+
`cannot deploy --project into code-conductor's own source tree (${cwd}). ` +
|
|
179
|
+
`The sweep heuristic would delete tracked scripts/.`
|
|
180
|
+
);
|
|
181
|
+
err.code = 'SELF_INSTALL';
|
|
182
|
+
throw err;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Absent or unparseable means "not this package". Any other read failure is suspect
|
|
186
|
+
// state, never a green light to sweep, so it is rethrown naming the path.
|
|
187
|
+
function packageName(path) {
|
|
188
|
+
let text;
|
|
189
|
+
try {
|
|
190
|
+
text = readFileSync(path, 'utf8');
|
|
191
|
+
} catch (e) {
|
|
192
|
+
if (e.code === 'ENOENT') return null;
|
|
193
|
+
throw new Error(`cannot read ${path} to rule out a self-install: ${e.message}`, { cause: e });
|
|
194
|
+
}
|
|
195
|
+
try { return JSON.parse(text).name ?? null; } catch { return null; }
|
|
196
|
+
}
|
|
197
|
+
|
|
171
198
|
export function deployProject(assetRoot, cwd, { warn = toStderr, report = toStdout } = {}) {
|
|
172
199
|
const emit = warn;
|
|
200
|
+
// Also run by the CLI's pre-flight; kept here for direct callers.
|
|
201
|
+
assertNotSelfInstall(assetRoot, cwd);
|
|
173
202
|
const target = join(cwd, '.claude');
|
|
174
203
|
const templateRoot = join(assetRoot, 'project-template');
|
|
175
204
|
// If something already occupies ./.claude and it is NOT a directory, this is a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yeison.restrepo.r/code-conductor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.1",
|
|
4
4
|
"description": "A governance layer for Claude Code sessions: hooks that check an agent's commands before they run, a spec-first workflow, and project memory the next session reads.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-development",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: define-review
|
|
3
|
+
description: Reviewer in the Define band's review loop of a /cc-orchestrate run (FEAT-041). Checks a spec or plan against the checklist rows in its brief, read-only, and reports open rows in a fixed format. Not a band role. No shell. Dispatched only by /cc-orchestrate during a run; never use it for ad-hoc work.
|
|
4
|
+
tools: Read, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the `define-review` reviewer of a code-conductor orchestrated run. The orchestrator dispatched you, fresh for this round, with a brief naming the item, the round, the document under review, its source, and the checklist rows.
|
|
8
|
+
|
|
9
|
+
## Your job
|
|
10
|
+
|
|
11
|
+
Read `~/.claude/skills/critical-review/SKILL.md` and apply its Phase 1 and Phase 2 to the checklist rows in your brief. Read the document and its source as they stand now, in slices of 150 lines or fewer. Judge the document against those rows only. You are not told what earlier rounds found, by design.
|
|
12
|
+
|
|
13
|
+
## Report format
|
|
14
|
+
|
|
15
|
+
- One line per unmet row: `- [<row>] <what is missing> (lines <a-b> | absent)`.
|
|
16
|
+
- Anything else you noticed goes under a `Notes:` block. A note never counts as a row.
|
|
17
|
+
- Your last line is exactly one of `REVIEW <role> round <n>: CLEAN`, when no row is open, or `REVIEW <role> round <n>: OPEN <k>`, where `<k>` is the number of row lines you wrote.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- You have no shell and no write tools. Write nothing.
|
|
22
|
+
- A hook or owner denial is an instruction to stop and report, never an obstacle to route around.
|
|
23
|
+
- Never dispatch or message another agent.
|
|
24
|
+
- You are not a band role: write no hand-back line and claim no gate. Your report is advice; the owner decides.
|
|
@@ -42,6 +42,7 @@ A halt is terminal in v1 (D12). Recovery is `node "$S/orchestrate.mjs" end`, the
|
|
|
42
42
|
- With `--ticket`, stdout also names the ticket, its title, the snapshot `.conductor/ticket/<ITEM>.md` and its sha256. The run is bound.
|
|
43
43
|
|
|
44
44
|
Print the run header: the item, the mode (`step` unless `--auto` was given), the test command, the ticket and snapshot for a bound run, and the first role, `spec`.
|
|
45
|
+
Add one line: `Review loop: zero owner wakes only when launched with claude --permission-mode auto --settings .claude/review-loop.settings.json; README "Review loop configurations" names the costs of every other launch.`
|
|
45
46
|
2. **Each dispatch.** Take the roles in band order: `spec`, `plan`, then `code` once per plan task, then `audit`, then `qa`. For each one:
|
|
46
47
|
1. **Check.** Run `node "$S/orchestrate.mjs" install <role> --check`. Print the role and the envelope it prints, and state that `--to <role>` passed.
|
|
47
48
|
2. **Pause.** In step mode, ask the owner for a go. On a decline, stop: the run stays at its position, and nothing is installed. Under `--auto`, skip this pause.
|
|
@@ -52,8 +53,11 @@ A halt is terminal in v1 (D12). Recovery is `node "$S/orchestrate.mjs" end`, the
|
|
|
52
53
|
1. Write the agent's **delivered `SubagentHandback` report** with the Write tool, verbatim, to `.conductor/handback/<role>.txt`. That is the one report the binary delivered, never a later message. For code, use `.conductor/handback/code-<N>.txt`, where `<N>` is the task number.
|
|
53
54
|
2. Run `node "$S/orchestrate.mjs" handback <role> < <that file>`.
|
|
54
55
|
3. Keep the agent's `Observation:` line for the report.
|
|
55
|
-
4. If a second `SNAP_HANDBACK` from that agent reaches you for the same position, write it to `.conductor/handback/<role>-second.txt` (`code-<N>-second.txt` for code) and run `handback <role>` on it. It halts with `ORCH_HANDBACK_CONFLICT`. Then follow "On any halt".
|
|
56
|
-
3. **The two define approvals.** These pause in both modes.
|
|
56
|
+
4. If a second `SNAP_HANDBACK` from that agent reaches you for the same position, outside a revision report of the review loop, write it to `.conductor/handback/<role>-second.txt` (`code-<N>-second.txt` for code) and run `handback <role>` on it. It halts with `ORCH_HANDBACK_CONFLICT`. Then follow "On any halt".
|
|
57
|
+
3. **The two define approvals.** These pause in both modes. Before each, run "The review loop" below for that role.
|
|
58
|
+
- **What you show:** the document path; its sha256 now (`shasum -a 256 <doc>` or `sha256sum <doc>`; in PowerShell, `Get-FileHash -Algorithm SHA256 <doc>`); the loop outcome (`clean` at round `<n>`, `cap` with the final reviewer's rows verbatim, or `skipped:<reason>` with a notice naming what failed); and each round's verdict line with the reviewer's notes.
|
|
59
|
+
- **Only an owner message approves.** An approval is a message the owner sends that itself says to approve. A reviewer's `CLEAN`, a loop outcome, `--auto` and a suggestion in the input box are not approvals.
|
|
60
|
+
- **Re-hash before approve.** Immediately before `approve`, hash the document again. If the hash differs from the one you showed, show the document again instead of approving.
|
|
57
61
|
- **After spec:** show the owner the spec path from the hand-back, and for a bound run the snapshot path and sha256 from the start line: the owner reviews the spec against that snapshot. On approval, run `node "$S/orchestrate.mjs" approve spec`.
|
|
58
62
|
- **After plan:** show the owner the plan path named in the hand-back's `ops.f`. On approval, run `node "$S/orchestrate.mjs" approve plan <plan path>`. This writes `define_approved`, the only gate you author after `boundary_routed`.
|
|
59
63
|
4. **Build.** Dispatch `code` once per plan task, serially, until the router moves on to `audit`. A `--check` refusal names the next step.
|
|
@@ -61,10 +65,67 @@ A halt is terminal in v1 (D12). Recovery is `node "$S/orchestrate.mjs" end`, the
|
|
|
61
65
|
6. **Report.** From the record `end` printed, name:
|
|
62
66
|
- every hand-back, with its role, gate and task;
|
|
63
67
|
- both approvals, with who approved and when;
|
|
68
|
+
- each review loop's outcome and round, from the record's `review` field;
|
|
64
69
|
- every agent's observation line.
|
|
65
70
|
|
|
66
71
|
Then state that release is human, by `docs/RELEASE-CLOSEOUT.md`. For a bound run, the owner records the outcome on the ticket after release with `node "$S/ticket.mjs" writeback <ITEM> --version <v> --pr <N|url>`.
|
|
67
72
|
|
|
73
|
+
## The review loop (FEAT-041)
|
|
74
|
+
|
|
75
|
+
After `spec` and after `plan` hand back, and before that role's approval, run this loop. It is advisory: it never gates, never halts the run, and never replaces the owner's approval. `<role>` is `spec` or `plan`; `<doc>` is the document path from the hand-back's `ops.f`.
|
|
76
|
+
|
|
77
|
+
1. **Open a round.** Run `node "$S/orchestrate.mjs" review <role> --round`. It prints `review <role> round <n> of 3`.
|
|
78
|
+
2. **Review.** Dispatch a fresh `define-review` agent with the `Agent` tool and the reviewer brief below. Never revive an earlier reviewer, and never pass it an earlier round's findings. Wait for its completion notice.
|
|
79
|
+
3. **Record.** Write its report verbatim with the Write tool to `.conductor/review/<role>-<n>-review.txt`. Its last line is `REVIEW <role> round <n>: CLEAN` or `REVIEW <role> round <n>: OPEN <k>`.
|
|
80
|
+
4. **Clean.** On `CLEAN`, run `review <role> --close clean` and go to the approval.
|
|
81
|
+
5. **Open, a pass remaining.** On `OPEN <k>` below round 3, use `SendMessage` to the `<role>` agent you dispatched, by its agent id, with the revision brief below and the open rows verbatim. Wait for the first delivery on any channel (a message, a hand-back frame or a completion notice) whose last line is `REVISION <role> round <n>: done` or `REVISION <role> round <n>: blocked <reason>`. Ignore later copies of the same round's report. Write it verbatim to `.conductor/review/<role>-<n>-revision.txt`. On `done`, go back to 1.
|
|
82
|
+
6. **Open at the cap.** On `OPEN <k>` at round 3, run `review <role> --close cap`. No revision follows the third pass, so the document at the approval is always the one the last reviewer read.
|
|
83
|
+
|
|
84
|
+
A revision report is never passed to `handback`. If one carries a `SNAP_HANDBACK` line, run `review <role> --close skipped:snap-in-revision` and flag the report at the approval.
|
|
85
|
+
|
|
86
|
+
**Fail-open.** On any loop error, run `review <role> --close skipped:<reason>`, and carry on if that also fails. Do not retry, take no other route, and go to the approval with a notice naming what failed. The reasons:
|
|
87
|
+
- `dispatch`: the reviewer dispatch fails;
|
|
88
|
+
- `unparsed`: the reviewer's last line does not parse;
|
|
89
|
+
- `denied`: the `SendMessage` is denied (plain auto mode);
|
|
90
|
+
- `blocked`: a revision ends `blocked`;
|
|
91
|
+
- `snap-in-revision`: a revision report carries a `SNAP_HANDBACK` line;
|
|
92
|
+
- `verb`: the `review` verb refuses or errors.
|
|
93
|
+
|
|
94
|
+
A loop error never halts the run. If the owner sends any message during the loop, close it with `skipped:owner` and handle the message as the owner's word. You wait only on notifications the loop caused.
|
|
95
|
+
|
|
96
|
+
### The checklist
|
|
97
|
+
|
|
98
|
+
Only these rows keep the loop going. Anything else a reviewer reports goes in its `Notes:` and never triggers a revision.
|
|
99
|
+
|
|
100
|
+
| Row | Spec document | Plan document |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| AC | Every acceptance criterion in the source is addressed, citing the spec lines that address it. | Every acceptance criterion of the approved spec maps to at least one task, citing plan lines. |
|
|
103
|
+
| FMT | The `/cc-spec` sections are present: Problem, Solution, Behavior (Main path, Alternative paths, Error cases), Acceptance Criteria, Out of Scope, System Impact, Complexity Estimate. | Every task is a `### Task N` heading with a `**Files:**` block (`approve plan` halts with `ORCH_EMPTY_SCOPE` without them). |
|
|
104
|
+
| CR | critical-review Phase 1: the happy path, the failure points and the boundary conditions are each addressed in Behavior. | critical-review Phase 1 per task: its failure point and its verification step are named. |
|
|
105
|
+
|
|
106
|
+
### The reviewer brief
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
You are the define-review reviewer for <ITEM>, round <n> of 3, reviewing the <role> document.
|
|
110
|
+
Document: <doc>
|
|
111
|
+
Source: <spec: the ticket snapshot .conductor/ticket/<ITEM>.md for a bound run, otherwise the backlog entry for <ITEM>, found with Grep; plan: the approved spec>
|
|
112
|
+
Read ~/.claude/skills/critical-review/SKILL.md and apply its Phases 1 and 2 to these rows only:
|
|
113
|
+
<the role's AC, FMT and CR rows from the checklist, verbatim>
|
|
114
|
+
Report each unmet row as one line: - [<row>] <what is missing> (lines <a-b> | absent)
|
|
115
|
+
Put anything else under Notes:. Write nothing. Do not dispatch or message other agents.
|
|
116
|
+
End with exactly one line: REVIEW <role> round <n>: CLEAN, or REVIEW <role> round <n>: OPEN <k>, where <k> is the number of row lines.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### The revision brief
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
Revision round <n> for <ITEM>. A reviewer found these open rows in your document <doc>:
|
|
123
|
+
<the reviewer's row lines, verbatim>
|
|
124
|
+
Revise <doc> with the Edit tool to address them. Guard 5 still holds your envelope's scope.
|
|
125
|
+
Report the revision as prose. Do not emit any SNAP_HANDBACK line: your hand-back is already recorded.
|
|
126
|
+
End with exactly one line: REVISION <role> round <n>: done, or REVISION <role> round <n>: blocked <reason>.
|
|
127
|
+
```
|
|
128
|
+
|
|
68
129
|
## The dispatch brief
|
|
69
130
|
|
|
70
131
|
Fill in each `<...>` from the run and the role.
|
|
@@ -75,7 +136,7 @@ Your band envelope is installed at .claude/memory/band-envelope.json: tk <tk>, s
|
|
|
75
136
|
Guard 5 denies any write outside that scope. Do not get around a denial or a missing tool, for
|
|
76
137
|
example with shell redirection. Report it instead.
|
|
77
138
|
Task: <the role's task, below>
|
|
78
|
-
Verify your work before you hand back
|
|
139
|
+
Verify your work before you hand back. Your hand-back is the run's only record. After it, the orchestrator may send you revision requests; answer them as prose, without a `SNAP_HANDBACK` line.
|
|
79
140
|
Do not dispatch or message other agents; Guard 6 denies it during a run.
|
|
80
141
|
Copy ops.scope verbatim from your envelope into the hand-back; if your envelope has no scope, leave the key out.
|
|
81
142
|
End your hand-back report with exactly these two lines, each on its own line:
|
|
@@ -105,6 +105,18 @@ Each step must include:
|
|
|
105
105
|
plain `git add <path>` otherwise. Always generate an explicit path: bare `git add -u`
|
|
106
106
|
stages every modified tracked file in the repository. The branch is on tracked-ness, never
|
|
107
107
|
on habit, because `-u` exits 128 on an untracked path whether or not an ignore rule exists.
|
|
108
|
+
- **Plan file in staging steps.** Every commit group that ticks checkboxes in the plan file must
|
|
109
|
+
include a `git add -u <plan-file-path>` step after the checkbox edits so the ticked state
|
|
110
|
+
rides the commit. Ticks from a task's final commit ride the next task's first commit, and
|
|
111
|
+
the last task's ride the closeout commit. A tick made after a group's `git commit` step has
|
|
112
|
+
run, including the tick on that step itself, cannot ride that commit, so it belongs to the
|
|
113
|
+
next commit group that stages the plan file. Without this step, `cc-implement` marks
|
|
114
|
+
checkboxes `[X]` but the committed file still shows the previous state.
|
|
115
|
+
- **Filtered red-step predictions.** When a red step runs the suite through a runner filter
|
|
116
|
+
(`-t`, a file path or a name pattern), a filtered red-step prediction lists the filter's full
|
|
117
|
+
match set: every test the filter selects with its expected state, not only the new tests.
|
|
118
|
+
A filter that also matches already-green tests reads more passes than the new tests alone
|
|
119
|
+
predict, and the mismatch halts a run that is otherwise correct.
|
|
108
120
|
|
|
109
121
|
## Test List
|
|
110
122
|
- [ ] Unit tests for [unit]
|
|
@@ -19,12 +19,18 @@ Read `CLAUDE.md`. Extract:
|
|
|
19
19
|
|
|
20
20
|
Use `—` for any missing fields.
|
|
21
21
|
|
|
22
|
-
**Auto-fill blank command fields (BUG-015):** After reading the identity fields, check if any of `Build`, `Test`, `Lint`, `Format`, `Setup` in CLAUDE.md are still `<command>` (any case) or blank after the colon. If at least one is blank
|
|
22
|
+
**Auto-fill blank command fields (BUG-015):** After reading the identity fields, check if any of `Build`, `Test`, `Lint`, `Format`, `Setup` in CLAUDE.md are still `<command>` (any case) or blank after the colon. If at least one is blank, resolve the detector by presence, the deployed copy first:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
```bash
|
|
25
|
+
D=.claude/scripts/detect-stack.mjs; [ -f "$D" ] || D=scripts/detect-stack.mjs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If neither file exists, skip this step silently.
|
|
29
|
+
|
|
30
|
+
1. Run `node "$D" "$PWD"` and capture the JSON output.
|
|
25
31
|
2. For each blank/placeholder command field, if the JSON contains a matching key (`build`, `test`, `lint`, `format`, `setup`), replace the placeholder with the detected value using a single `Edit` call.
|
|
26
32
|
3. Never overwrite a field that already contains a non-placeholder value.
|
|
27
|
-
4. If all five fields are already populated,
|
|
33
|
+
4. If all five fields are already populated, skip this step silently.
|
|
28
34
|
5. If the JSON is `{}` or node exits non-zero, skip silently.
|
|
29
35
|
|
|
30
36
|
Re-read the updated CLAUDE.md fields after this step so the session resume report reflects the filled values.
|
|
@@ -642,20 +642,33 @@ function g3ReadAllowlist() {
|
|
|
642
642
|
const g3EscapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
643
643
|
const G3_BD = '(^|[ \\t\\n\\r\\f\\v|;()])';
|
|
644
644
|
const G3_AD = '([ \\t\\n\\r\\f\\v|;()]|$)';
|
|
645
|
+
// The suffix a directory entry may cover: bare, and inside quotes the same class plus a
|
|
646
|
+
// space, because a space inside quotes is part of the path. Nothing wider: inside double
|
|
647
|
+
// quotes $( ) still executes, and the BUG-043 mask hides quoted text from every pattern
|
|
648
|
+
// check, so a quoted suffix admitting $ would let the allowlist cover a substitution
|
|
649
|
+
// alone. [BUG-045]
|
|
650
|
+
const G3_SUFFIX = '([A-Za-z0-9_./@%*?-]*)';
|
|
651
|
+
const G3_QSUFFIX = '([A-Za-z0-9_./@%*? -]*)';
|
|
652
|
+
|
|
653
|
+
// A path is covered bare or as ONE whole quoted token, opened right after a boundary and
|
|
654
|
+
// closed right before one. A quote mid-word is never a boundary, so a quote that splits a
|
|
655
|
+
// path cannot end the match before a ../ the traversal check must see. [BUG-045]
|
|
656
|
+
function g3EntryForms(e, dir) {
|
|
657
|
+
if (!dir) return [e, `"${e}"`, `'${e}'`];
|
|
658
|
+
return [e + G3_SUFFIX, `"${e}${G3_QSUFFIX}"`, `'${e}${G3_QSUFFIX}'`];
|
|
659
|
+
}
|
|
645
660
|
|
|
646
661
|
function g3AllowlistCovers(s, entries) {
|
|
647
662
|
if (entries.length === 0) return false;
|
|
648
663
|
for (const entry of entries) {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
} else if (new RegExp(G3_BD + g3EscapeRe(entry) + G3_AD).test(s)) {
|
|
664
|
+
const dir = entry.endsWith('/');
|
|
665
|
+
for (const form of g3EntryForms(g3EscapeRe(entry), dir)) {
|
|
666
|
+
const m = new RegExp(G3_BD + form + G3_AD).exec(s);
|
|
667
|
+
if (!m) continue;
|
|
668
|
+
// G3_BD contributes group 1, so the suffix is group 2, matching the
|
|
669
|
+
// authority's BASH_REMATCH[2]. A suffix that walks up the tree is not
|
|
670
|
+
// covered: an allowlist entry must not become a path-traversal gift.
|
|
671
|
+
if (dir && /(^|\/)\.\.(\/|$)/.test(m[2])) break;
|
|
659
672
|
return true;
|
|
660
673
|
}
|
|
661
674
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"autoMode":{"allow":["$defaults","Orchestrator revision rounds (code-conductor FEAT-041): during a live /cc-orchestrate run, the main session may use SendMessage to a spec or plan band agent that has already handed back, asking it to revise its own document under docs/superpowers/specs/ or docs/superpowers/plans/ and to report the revision as prose without a SNAP_HANDBACK line. This is the project's reviewer-in-loop protocol, not an evasion of oversight: the agent's edits remain subject to the project's PreToolUse guards, and the owner's boundary approval still follows."]}}
|
package/scripts/orchestrate.mjs
CHANGED
|
@@ -21,6 +21,12 @@ export const WRITE_SURFACE = [RUN_FILE, ENVELOPE_FILE, '.claude/memory/session-s
|
|
|
21
21
|
// Where /cc-orchestrate writes each agent's final message for `handback` to read: inside
|
|
22
22
|
// the surface, and cleared with the run so file names never collide across runs.
|
|
23
23
|
export const HANDBACK_DIR = '.conductor/handback';
|
|
24
|
+
// FEAT-041: the Define review loop's reports, cleared with the run like the hand-backs.
|
|
25
|
+
export const REVIEW_DIR = '.conductor/review';
|
|
26
|
+
// Three reviewer passes, so at most two revisions, each re-reviewed (FEAT-041 (d)).
|
|
27
|
+
export const REVIEW_CAP = 3;
|
|
28
|
+
const REVIEW_OUTCOME = /^(clean|cap|skipped:[a-z][a-z0-9-]{0,39})$/;
|
|
29
|
+
const REVIEW_USAGE = 'usage: orchestrate.mjs review <spec|plan> --round | --close <clean|cap|skipped:<reason>>';
|
|
24
30
|
|
|
25
31
|
// D5: the reviewed role-artifact table. Code's scope comes from its plan task instead.
|
|
26
32
|
export const ROLE_ARTIFACTS = {
|
|
@@ -327,6 +333,34 @@ function approve(root, sessionId, what, planRel) {
|
|
|
327
333
|
return `plan approved: define_approved, ${tasks.length} task(s)`;
|
|
328
334
|
}
|
|
329
335
|
|
|
336
|
+
// FEAT-041 (e): the review loop's round counter. Advisory: approve never reads it, and the
|
|
337
|
+
// cap is a refusal, never a halt, so the loop can never freeze the run.
|
|
338
|
+
function review(root, sessionId, [role, flag, outcome, extra]) {
|
|
339
|
+
const run = liveRun(root, sessionId);
|
|
340
|
+
const wellFormed = extra === undefined && (flag === '--round' ? outcome === undefined : flag === '--close' && outcome !== undefined);
|
|
341
|
+
if (!wellFormed) throw new Refusal(REVIEW_USAGE);
|
|
342
|
+
const step = nextStep(run);
|
|
343
|
+
if (step.await !== role) throw new Refusal(`review ${role}: the next step is ${describeStep(step)}`);
|
|
344
|
+
const loops = isPlainObject(run.review) ? run.review : {};
|
|
345
|
+
const loop = isPlainObject(loops[role]) && Number.isInteger(loops[role].round) ? loops[role] : { round: 0, outcome: null };
|
|
346
|
+
if (loop.outcome) throw new Refusal(`review ${role}: the loop closed ${loop.outcome}; a closed loop does not reopen`);
|
|
347
|
+
const next = flag === '--round' ? openRound(role, loop) : closeLoop(role, loop, outcome);
|
|
348
|
+
saveRun(root, { ...run, review: { ...loops, [role]: next } });
|
|
349
|
+
return flag === '--round' ? `review ${role} round ${next.round} of ${REVIEW_CAP}` : `review ${role} closed ${next.outcome} at round ${next.round}`;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function openRound(role, loop) {
|
|
353
|
+
if (loop.round >= REVIEW_CAP) throw new Refusal(`ORCH_REVIEW_CAP: review ${role} has run ${REVIEW_CAP} rounds; close it with --close cap`);
|
|
354
|
+
return { round: loop.round + 1, outcome: null };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function closeLoop(role, loop, outcome) {
|
|
358
|
+
if (!REVIEW_OUTCOME.test(outcome)) throw new Refusal(REVIEW_USAGE);
|
|
359
|
+
if (outcome === 'clean' && loop.round === 0) throw new Refusal(`review ${role}: clean needs a reviewer pass; none has run`);
|
|
360
|
+
if (outcome === 'cap' && loop.round < REVIEW_CAP) throw new Refusal(`review ${role}: cap needs round ${REVIEW_CAP}; the loop is at round ${loop.round}`);
|
|
361
|
+
return { round: loop.round, outcome };
|
|
362
|
+
}
|
|
363
|
+
|
|
330
364
|
const START_USAGE = 'usage: orchestrate.mjs start <ITEM> [--auto] [--ticket <N|issue URL>]';
|
|
331
365
|
|
|
332
366
|
// The item first, then --auto and --ticket <ref> in either order, each at most once. A
|
|
@@ -376,6 +410,7 @@ function start(root, sessionId, args) {
|
|
|
376
410
|
function clearRunFiles(root) {
|
|
377
411
|
rmSync(join(root, ENVELOPE_FILE), { force: true });
|
|
378
412
|
rmSync(join(root, HANDBACK_DIR), { recursive: true, force: true });
|
|
413
|
+
rmSync(join(root, REVIEW_DIR), { recursive: true, force: true });
|
|
379
414
|
}
|
|
380
415
|
|
|
381
416
|
// Prints the run it removes, so the closing report reads the record rather than memory.
|
|
@@ -403,10 +438,11 @@ export function cli(argv, env, cwd = process.cwd()) {
|
|
|
403
438
|
install: () => install(root, sid, a, b === '--check'),
|
|
404
439
|
handback: () => handback(root, sid, a, readFileSync(0, 'utf8')),
|
|
405
440
|
approve: () => approve(root, sid, a, b),
|
|
441
|
+
review: () => review(root, sid, argv.slice(1)),
|
|
406
442
|
end: () => end(root),
|
|
407
443
|
};
|
|
408
444
|
try {
|
|
409
|
-
if (!verbs[verb]) throw new Refusal('usage: orchestrate.mjs start|install|handback|approve|end');
|
|
445
|
+
if (!verbs[verb]) throw new Refusal('usage: orchestrate.mjs start|install|handback|approve|review|end');
|
|
410
446
|
process.stdout.write(verbs[verb]() + '\n');
|
|
411
447
|
return 0;
|
|
412
448
|
} catch (e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory-first
|
|
3
|
-
description: "Lookup chain enforced before any file read or search: project memory, grep/glob, targeted read — stop at the first step that answers"
|
|
3
|
+
description: "Lookup chain enforced before any file read or search: project and global memory, grep/glob, targeted read — stop at the first step that answers"
|
|
4
4
|
type: skill
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -10,13 +10,14 @@ Follow this lookup chain in strict order before reading any file, running any se
|
|
|
10
10
|
|
|
11
11
|
## Chain
|
|
12
12
|
|
|
13
|
-
### 1.
|
|
14
|
-
Check `.claude/memory/project.md
|
|
13
|
+
### 1. Memory
|
|
14
|
+
Check `.claude/memory/project.md` (project) and `~/.claude/memory/personal.md` (global preferences).
|
|
15
15
|
|
|
16
|
-
Use the Grep tool
|
|
16
|
+
Use the Grep tool on both files:
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
Grep pattern="<keyword>" path=".claude/memory/project.md"
|
|
20
|
+
Grep pattern="<keyword>" path="~/.claude/memory/personal.md"
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
If Grep returns matches, use that information and stop. If no matches, proceed to step 2.
|