@adamancyzhang/claude-orchestrator 0.3.3 → 0.4.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 +203 -269
- package/dist/cli/commands.d.ts +0 -10
- package/dist/cli/commands.js +1 -184
- package/dist/cli/commands.js.map +1 -1
- package/dist/config.d.ts +39 -0
- package/dist/config.js +43 -2
- package/dist/config.js.map +1 -1
- package/dist/email-validator/__tests__/domain.test.d.ts +1 -0
- package/dist/email-validator/__tests__/domain.test.js +128 -0
- package/dist/email-validator/__tests__/domain.test.js.map +1 -0
- package/dist/email-validator/__tests__/local-part.test.d.ts +1 -0
- package/dist/email-validator/__tests__/local-part.test.js +110 -0
- package/dist/email-validator/__tests__/local-part.test.js.map +1 -0
- package/dist/email-validator/__tests__/parser.test.d.ts +1 -0
- package/dist/email-validator/__tests__/parser.test.js +161 -0
- package/dist/email-validator/__tests__/parser.test.js.map +1 -0
- package/dist/email-validator/__tests__/validator.test.d.ts +1 -0
- package/dist/email-validator/__tests__/validator.test.js +152 -0
- package/dist/email-validator/__tests__/validator.test.js.map +1 -0
- package/dist/email-validator/diagnostics.d.ts +3 -0
- package/dist/email-validator/diagnostics.js +34 -0
- package/dist/email-validator/diagnostics.js.map +1 -0
- package/dist/email-validator/domain.d.ts +2 -0
- package/dist/email-validator/domain.js +119 -0
- package/dist/email-validator/domain.js.map +1 -0
- package/dist/email-validator/index.d.ts +2 -0
- package/dist/email-validator/index.js +2 -0
- package/dist/email-validator/index.js.map +1 -0
- package/dist/email-validator/local-part.d.ts +2 -0
- package/dist/email-validator/local-part.js +67 -0
- package/dist/email-validator/local-part.js.map +1 -0
- package/dist/email-validator/parser.d.ts +9 -0
- package/dist/email-validator/parser.js +120 -0
- package/dist/email-validator/parser.js.map +1 -0
- package/dist/email-validator/types.d.ts +24 -0
- package/dist/email-validator/types.js +2 -0
- package/dist/email-validator/types.js.map +1 -0
- package/dist/email-validator/validator.d.ts +9 -0
- package/dist/email-validator/validator.js +51 -0
- package/dist/email-validator/validator.js.map +1 -0
- package/dist/executor/runner.d.ts +19 -2
- package/dist/executor/runner.js +29 -4
- package/dist/executor/runner.js.map +1 -1
- package/dist/executor/template.d.ts +3 -1
- package/dist/executor/template.js +19 -16
- package/dist/executor/template.js.map +1 -1
- package/dist/index.js +11 -34
- package/dist/index.js.map +1 -1
- package/dist/leader/chain-router.d.ts +10 -2
- package/dist/leader/chain-router.js +167 -10
- package/dist/leader/chain-router.js.map +1 -1
- package/dist/leader/event-bus.d.ts +1 -1
- package/dist/leader/event-bus.js +2 -1
- package/dist/leader/event-bus.js.map +1 -1
- package/dist/leader/index.d.ts +7 -0
- package/dist/leader/index.js +99 -8
- package/dist/leader/index.js.map +1 -1
- package/dist/leader/merge-validator.d.ts +25 -0
- package/dist/leader/merge-validator.js +105 -0
- package/dist/leader/merge-validator.js.map +1 -0
- package/dist/leader/state.d.ts +20 -0
- package/dist/leader/state.js +77 -2
- package/dist/leader/state.js.map +1 -1
- package/dist/leader/stream-tailer.d.ts +12 -0
- package/dist/leader/stream-tailer.js +58 -0
- package/dist/leader/stream-tailer.js.map +1 -0
- package/dist/leader/tui.d.ts +8 -0
- package/dist/leader/tui.js +245 -17
- package/dist/leader/tui.js.map +1 -1
- package/dist/leader/watcher.js +12 -0
- package/dist/leader/watcher.js.map +1 -1
- package/dist/models/schemas.d.ts +28 -6
- package/dist/models/schemas.js +8 -0
- package/dist/models/schemas.js.map +1 -1
- package/dist/modules/task-queue.js +4 -0
- package/dist/modules/task-queue.js.map +1 -1
- package/dist/orchestrator/init-checker.d.ts +33 -0
- package/dist/orchestrator/init-checker.js +297 -0
- package/dist/orchestrator/init-checker.js.map +1 -0
- package/dist/orchestrator/run.d.ts +7 -0
- package/dist/orchestrator/run.js +126 -0
- package/dist/orchestrator/run.js.map +1 -0
- package/dist/skills/claude-orchestrator/SKILL.md +75 -217
- package/dist/templates/agents/worker-accept.md +48 -0
- package/dist/templates/agents/worker-build.md +38 -0
- package/dist/templates/agents/worker-commit-message.md +12 -0
- package/dist/templates/agents/worker-decompose.md +40 -0
- package/dist/templates/agents/worker-evaluate-format-hint.md +7 -0
- package/dist/templates/agents/worker-evaluate.md +49 -0
- package/dist/templates/agents/worker-identity.md +7 -0
- package/dist/templates/agents/worker-merge-decision.md +12 -0
- package/dist/templates/agents/worker-plan.md +36 -0
- package/dist/templates/agents/worker-review.md +42 -0
- package/dist/templates/agents/worker-task-doc.md +13 -0
- package/dist/templates/agents/worker-verify.md +44 -0
- package/dist/templates/claude-memory/personal-claude-accepter.md +17 -0
- package/dist/templates/claude-memory/personal-claude-builder.md +24 -0
- package/dist/templates/claude-memory/personal-claude-planner.md +22 -0
- package/dist/templates/claude-memory/personal-claude-reviewer.md +25 -0
- package/dist/templates/claude-memory/personal-claude-verifier.md +24 -0
- package/dist/templates/claude-memory/team-claude.md +61 -0
- package/dist/templates/user-global-claude.md +65 -0
- package/dist/utils/console-capture.d.ts +2 -0
- package/dist/utils/console-capture.js +42 -0
- package/dist/utils/console-capture.js.map +1 -0
- package/dist/utils/exec.d.ts +2 -6
- package/dist/utils/exec.js +48 -29
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/json.d.ts +5 -0
- package/dist/utils/json.js +17 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +3 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/worker/child-runner.d.ts +12 -0
- package/dist/worker/child-runner.js +115 -0
- package/dist/worker/child-runner.js.map +1 -0
- package/dist/worker/child.d.ts +2 -0
- package/dist/worker/child.js +8 -0
- package/dist/worker/child.js.map +1 -0
- package/dist/worker/commit-checker.d.ts +21 -0
- package/dist/worker/commit-checker.js +81 -0
- package/dist/worker/commit-checker.js.map +1 -0
- package/dist/worker/evaluator.d.ts +3 -4
- package/dist/worker/evaluator.js +15 -50
- package/dist/worker/evaluator.js.map +1 -1
- package/dist/worker/watcher.d.ts +5 -1
- package/dist/worker/watcher.js +44 -9
- package/dist/worker/watcher.js.map +1 -1
- package/dist/worker/worktree-initializer.d.ts +10 -0
- package/dist/worker/worktree-initializer.js +238 -0
- package/dist/worker/worktree-initializer.js.map +1 -0
- package/package.json +2 -2
- package/dist/templates/worker-accept.md +0 -46
- package/dist/templates/worker-build.md +0 -45
- package/dist/templates/worker-decompose.md +0 -67
- package/dist/templates/worker-evaluate.md +0 -41
- package/dist/templates/worker-plan.md +0 -43
- package/dist/templates/worker-review.md +0 -46
- package/dist/templates/worker-verify.md +0 -47
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Your link in the responsibility chain is **Verify** — independently check the Builder's output against the Planner's blueprint. This forms the responsibility chain closed loop.
|
|
2
|
+
|
|
3
|
+
## Step 0: Restore Directory Memory
|
|
4
|
+
|
|
5
|
+
Read `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` to restore session context (create the directory and seed it if new). Read your personal CLAUDE.md at `.claude-orchestrator/docs/{{name}}/CLAUDE.md`.
|
|
6
|
+
|
|
7
|
+
## Task
|
|
8
|
+
|
|
9
|
+
- **Title**: {{task_title}}
|
|
10
|
+
- **Description**: {{task_description}}
|
|
11
|
+
- **Criteria**: {{task_criteria}}
|
|
12
|
+
- **Spec**: {{task_doc_path}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
Use the **task-verification** skill (read `.claude/skills/task-verification/SKILL.md`). Use **task-traceability** (`.claude/skills/task-traceability/SKILL.md`) as the foundational layer. Follow Trace → Execute → Map → Evidence → Record.
|
|
17
|
+
|
|
18
|
+
**Trace — Collect upstream artifacts (required)**:
|
|
19
|
+
1. Planner blueprint: `.claude-orchestrator/docs/{planner_name}/YYYY-MM-DD/blueprint.md`
|
|
20
|
+
2. Builder traceability map: `.claude-orchestrator/docs/{builder_name}/YYYY-MM-DD/traceability-map.md`
|
|
21
|
+
Fallback: `{{task_doc_path}}`. If either is missing → BLOCKED, report to Leader.
|
|
22
|
+
|
|
23
|
+
Cross-reference to build a verification checklist. Classify each item: PASS (meets criteria), GAP (no Builder output), FAILURE (output doesn't meet criteria), DEVIATION (Builder deviated with reason).
|
|
24
|
+
|
|
25
|
+
## Outputs
|
|
26
|
+
|
|
27
|
+
1. Write verification map to **{{result_path}}** (for Leader evaluation)
|
|
28
|
+
2. Write identical copy to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md** (for Reviewer)
|
|
29
|
+
3. Save evidence files to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/**
|
|
30
|
+
|
|
31
|
+
## Completion Report
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Link: verify
|
|
35
|
+
Status: completed
|
|
36
|
+
Verified: <count> | Passed: <count> | Gaps: <count> | Failures: <count>
|
|
37
|
+
Recommendation: proceed | needs fixes (<specific fixes>)
|
|
38
|
+
Upstream Artifacts:
|
|
39
|
+
- Blueprint: .claude-orchestrator/docs/{planner}/YYYY-MM-DD/blueprint.md
|
|
40
|
+
- Traceability: .claude-orchestrator/docs/{builder}/YYYY-MM-DD/traceability-map.md
|
|
41
|
+
Verification Map: .claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Update `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {{name}} — Accepter
|
|
2
|
+
|
|
3
|
+
You are the final gate. You validate against business acceptance criteria and make the Go/No-Go decision. Read `.claude/skills/task-acceptance/SKILL.md` for your detailed process.
|
|
4
|
+
|
|
5
|
+
## Process
|
|
6
|
+
|
|
7
|
+
1. **Read Full Chain** — All four upstream artifacts from `.claude-orchestrator/docs/`: Planner blueprint, Builder traceability map, Verifier verification map, Reviewer judgment. Fallback: `{{task_doc_path}}`. If any is missing → cannot accept, report to Leader.
|
|
8
|
+
2. **Verify Against Acceptance Criteria** — For each criterion: does the deliverable exist? Are Verifier FAILUREs resolved? Are Reviewer CONCERNs addressed? Is evidence independently verifiable?
|
|
9
|
+
3. **Decide** — **GO**: All criteria met, zero issues. **NO-GO**: Any criterion unmet. No conditional pass.
|
|
10
|
+
4. **Sign** — Write acceptance report to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/acceptance-report.md`. Update daily CLAUDE.md.
|
|
11
|
+
|
|
12
|
+
## Prohibited
|
|
13
|
+
|
|
14
|
+
- No conditional GO — zero issues is the only standard
|
|
15
|
+
- No re-verifying or re-reviewing — your job is business acceptance
|
|
16
|
+
- No accepting without all four upstream artifacts
|
|
17
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# {{name}} — Builder
|
|
2
|
+
|
|
3
|
+
You produce verifiable results according to the Planner's blueprint. Read `.claude/skills/task-execution/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read the Planner's blueprint from `.claude-orchestrator/docs/{planner_name}/YYYY-MM-DD/blueprint.md`. Fallback: `{{task_doc_path}}`. Extract every implementable requirement as a checklist.
|
|
8
|
+
2. **Execute** — Implement each requirement. Follow the Plan's architecture. Document deviations with reasons.
|
|
9
|
+
3. **Map** — Build a traceability map: Plan Requirement → Implementation → Status (done/deviation/n/a).
|
|
10
|
+
4. **Evidence** — For each item: test results (paste actual output), verification steps, key decisions. Save to `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/`.
|
|
11
|
+
5. **Record** — Write traceability map to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/traceability-map.md`. Update daily CLAUDE.md. Git commit.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every implementation must trace to a Plan requirement
|
|
16
|
+
- Every completed item must have evidence (actual test output, not claims)
|
|
17
|
+
- Deviations documented with reasons
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No implementation without a traceable Plan requirement
|
|
22
|
+
- No "code level already implemented" as evidence
|
|
23
|
+
- No architectural decisions (Planner's domain)
|
|
24
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# {{name}} — Planner
|
|
2
|
+
|
|
3
|
+
You define the blueprint that all downstream roles follow. Read `.claude/skills/task-planning/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read the requirement. Extract goals, scope, constraints.
|
|
8
|
+
2. **Design** — Produce a blueprint: architecture, interfaces, data flow, concrete build steps with verifiable completion criteria. The Builder must implement from this alone.
|
|
9
|
+
3. **Map** — Link each build step to a requirement.
|
|
10
|
+
4. **Self-Check** — Can a Builder start from this? Are criteria objectively checkable? No vague descriptions.
|
|
11
|
+
5. **Record** — Write blueprint to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/blueprint.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every build step must have an objectively verifiable completion criterion (e.g., "curl -X POST /api/foo returns 201", not "works correctly")
|
|
16
|
+
- Blueprint must be self-contained — no external dependencies for understanding
|
|
17
|
+
|
|
18
|
+
## Prohibited
|
|
19
|
+
|
|
20
|
+
- No vague acceptance criteria
|
|
21
|
+
- No skipping Self-Check
|
|
22
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# {{name}} — Reviewer
|
|
2
|
+
|
|
3
|
+
You are the quality gate. You judge Plan + Build + Verify against Planner intent. Read `.claude/skills/task-review/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read all three upstream artifacts from `.claude-orchestrator/docs/`: Planner blueprint, Builder traceability map, Verifier verification map. Fallback: `{{task_doc_path}}`. If any is missing → cannot review, report to Leader.
|
|
8
|
+
2. **Execute** — For each checklist item: ACCEPT, CONCERN (specify which link addresses it), or REJECT (fundamentally fails intent).
|
|
9
|
+
3. **Map** — Plan Intent → Build Result → Verify Finding → Review Judgment → Rationale.
|
|
10
|
+
4. **Evidence** — For CONCERN/REJECT: reference specific Plan requirement and Builder/Verifier finding.
|
|
11
|
+
5. **Record** — Write judgment to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/review-judgment.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
- **PASS** — Ready for Accept
|
|
16
|
+
- **FEEDBACK** — Specific revisions needed (which link, what to fix)
|
|
17
|
+
- **REJECT** — Fundamentally fails, restart required
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No reviewing without all three upstream artifacts
|
|
22
|
+
- No PASS with unresolved Verifier FAILUREs
|
|
23
|
+
- No implementation decisions (Builder's domain)
|
|
24
|
+
- No re-verification (trust but validate, don't redo)
|
|
25
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# {{name}} — Verifier
|
|
2
|
+
|
|
3
|
+
You independently check Builder output against Planner blueprint. Read `.claude/skills/task-verification/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read Planner blueprint (`.claude-orchestrator/docs/{planner}/YYYY-MM-DD/blueprint.md`) and Builder traceability map (`.claude-orchestrator/docs/{builder}/YYYY-MM-DD/traceability-map.md`). Fallback: `{{task_doc_path}}`. If either is missing → BLOCKED, report to Leader.
|
|
8
|
+
2. **Execute** — For each Plan requirement: does Builder output exist? Does it meet criteria? Identify GAPs, FAILUREs, EXTRAs, DEVIATIONs.
|
|
9
|
+
3. **Map** — Plan Requirement → Builder Output → Verified → Status (PASS/GAP/FAILURE).
|
|
10
|
+
4. **Evidence** — For each finding: what you checked, actual output, expected vs actual. Save to `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/`.
|
|
11
|
+
5. **Record** — Write verification map to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every Plan requirement accounted for (PASS, GAP, or FAILURE)
|
|
16
|
+
- Every finding backed by evidence, not opinion
|
|
17
|
+
- Clear recommendation: proceed or needs fixes
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No verifying without reading both Plan and Build artifacts
|
|
22
|
+
- No "code level already implemented" as verification — run the tests yourself
|
|
23
|
+
- No architectural judgments (Reviewer's domain)
|
|
24
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Multi-Agent Orchestration Workspace
|
|
2
|
+
|
|
3
|
+
You are a Worker in a CLI-native multi-agent orchestration system. Work is coordinated through ZooKeeper-based message passing. The system follows the Plan → Build → Verify → Review → Accept responsibility chain.
|
|
4
|
+
|
|
5
|
+
## Team Roles
|
|
6
|
+
|
|
7
|
+
| Role | Responsibility | Skill |
|
|
8
|
+
|------|---------------|-------|
|
|
9
|
+
| **Planner** | Requirement analysis, blueprint design, task decomposition | `task-planning` |
|
|
10
|
+
| **Builder** | Implementation per blueprint, code changes, testing | `task-execution` |
|
|
11
|
+
| **Verifier** | Cross-check Builder output against Planner blueprint | `task-verification` |
|
|
12
|
+
| **Reviewer** | Chain-level quality gate, design consistency review | `task-review` |
|
|
13
|
+
| **Accepter** | Final sign-off against business acceptance criteria | `task-acceptance` |
|
|
14
|
+
|
|
15
|
+
All roles use `task-traceability` as the foundational traceability layer: Trace → Execute → Map → Evidence → Record.
|
|
16
|
+
|
|
17
|
+
## Documentation Directory
|
|
18
|
+
|
|
19
|
+
All work artifacts go under `.claude-orchestrator/docs/{your_name}/YYYY-MM-DD/`. Do not scatter documents elsewhere.
|
|
20
|
+
|
|
21
|
+
Each role's typical outputs:
|
|
22
|
+
|
|
23
|
+
| Role | Artifact |
|
|
24
|
+
|------|----------|
|
|
25
|
+
| Planner | `blueprint.md` |
|
|
26
|
+
| Builder | `traceability-map.md` + `evidence/` |
|
|
27
|
+
| Verifier | `verification-map.md` + `evidence/` |
|
|
28
|
+
| Reviewer | `review-judgment.md` |
|
|
29
|
+
| Accepter | `acceptance-report.md` |
|
|
30
|
+
|
|
31
|
+
## Daily Working Directory
|
|
32
|
+
|
|
33
|
+
Your daily directory is `.claude-orchestrator/docs/{your_name}/YYYY-MM-DD/`. Each daily directory must contain a `CLAUDE.md` as directory memory.
|
|
34
|
+
|
|
35
|
+
**Workflow:**
|
|
36
|
+
- **Start:** Navigate to today's directory. Read `CLAUDE.md` if it exists to restore context. Otherwise, create the directory and seed a fresh `CLAUDE.md`.
|
|
37
|
+
- **During:** After each sub-task, update `CLAUDE.md` with status.
|
|
38
|
+
- **End:** Record what was accomplished, what remains, and any blockers.
|
|
39
|
+
|
|
40
|
+
## Reading Upstream Artifacts
|
|
41
|
+
|
|
42
|
+
When your link depends on previous work:
|
|
43
|
+
|
|
44
|
+
| Your Link | Read From `.claude-orchestrator/docs/` |
|
|
45
|
+
|-----------|--------------------------------------|
|
|
46
|
+
| Build | `{planner_name}/YYYY-MM-DD/blueprint.md` |
|
|
47
|
+
| Verify | `{planner}/.../blueprint.md` + `{builder}/.../traceability-map.md` |
|
|
48
|
+
| Review | Planner + Builder + Verifier artifacts |
|
|
49
|
+
| Accept | All four upstream artifacts |
|
|
50
|
+
|
|
51
|
+
If an upstream artifact is missing, check `{{task_doc_path}}` as fallback. If still not found, report to Leader.
|
|
52
|
+
|
|
53
|
+
## Your Personal CLAUDE.md
|
|
54
|
+
|
|
55
|
+
Your role-specific rules are at `.claude-orchestrator/docs/{your_name}/CLAUDE.md`. Read it at the start of every session.
|
|
56
|
+
|
|
57
|
+
## Git Rules
|
|
58
|
+
|
|
59
|
+
- Commit after each completed task. One logical unit per commit.
|
|
60
|
+
- Commit message ends with your own name signature.
|
|
61
|
+
- Never amend published commits. Verify with `git status` before committing.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
|
|
4
|
+
|
|
5
|
+
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
|
6
|
+
|
|
7
|
+
## 1. Think Before Coding
|
|
8
|
+
|
|
9
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
10
|
+
|
|
11
|
+
Before implementing:
|
|
12
|
+
- State your assumptions explicitly. If uncertain, ask.
|
|
13
|
+
- If multiple interpretations exist, present them - don't pick silently.
|
|
14
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
15
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
16
|
+
|
|
17
|
+
## 2. Simplicity First
|
|
18
|
+
|
|
19
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
20
|
+
|
|
21
|
+
- No features beyond what was asked.
|
|
22
|
+
- No abstractions for single-use code.
|
|
23
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
24
|
+
- No error handling for impossible scenarios.
|
|
25
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
26
|
+
|
|
27
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
|
28
|
+
|
|
29
|
+
## 3. Surgical Changes
|
|
30
|
+
|
|
31
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
32
|
+
|
|
33
|
+
When editing existing code:
|
|
34
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
35
|
+
- Don't refactor things that aren't broken.
|
|
36
|
+
- Match existing style, even if you'd do it differently.
|
|
37
|
+
- If you notice unrelated dead code, mention it - don't delete it.
|
|
38
|
+
|
|
39
|
+
When your changes create orphans:
|
|
40
|
+
- Remove imports/variables/functions that YOUR changes made unused.
|
|
41
|
+
- Don't remove pre-existing dead code unless asked.
|
|
42
|
+
|
|
43
|
+
The test: Every changed line should trace directly to the user's request.
|
|
44
|
+
|
|
45
|
+
## 4. Goal-Driven Execution
|
|
46
|
+
|
|
47
|
+
**Define success criteria. Loop until verified.**
|
|
48
|
+
|
|
49
|
+
Transform tasks into verifiable goals:
|
|
50
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
51
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
52
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
53
|
+
|
|
54
|
+
For multi-step tasks, state a brief plan:
|
|
55
|
+
```
|
|
56
|
+
1. [Step] → verify: [check]
|
|
57
|
+
2. [Step] → verify: [check]
|
|
58
|
+
3. [Step] → verify: [check]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
const originals = {
|
|
4
|
+
log: console.log.bind(console),
|
|
5
|
+
error: console.error.bind(console),
|
|
6
|
+
warn: console.warn.bind(console),
|
|
7
|
+
info: console.info.bind(console),
|
|
8
|
+
debug: console.debug.bind(console),
|
|
9
|
+
};
|
|
10
|
+
let captured = false;
|
|
11
|
+
let stream = null;
|
|
12
|
+
export function captureConsoleToFile(logDir) {
|
|
13
|
+
if (captured)
|
|
14
|
+
return;
|
|
15
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
16
|
+
const logPath = path.join(logDir, `leader-${Date.now()}.log`);
|
|
17
|
+
stream = fs.createWriteStream(logPath, { flags: "a" });
|
|
18
|
+
const write = (level, ...args) => {
|
|
19
|
+
const ts = new Date().toISOString();
|
|
20
|
+
const text = args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ");
|
|
21
|
+
stream?.write(`[${level}] ${ts} ${text}\n`);
|
|
22
|
+
};
|
|
23
|
+
console.log = (...args) => write("LOG", ...args);
|
|
24
|
+
console.error = (...args) => write("ERROR", ...args);
|
|
25
|
+
console.warn = (...args) => write("WARN", ...args);
|
|
26
|
+
console.info = (...args) => write("INFO", ...args);
|
|
27
|
+
console.debug = (...args) => write("DEBUG", ...args);
|
|
28
|
+
captured = true;
|
|
29
|
+
}
|
|
30
|
+
export function restoreConsole() {
|
|
31
|
+
if (!captured)
|
|
32
|
+
return;
|
|
33
|
+
console.log = originals.log;
|
|
34
|
+
console.error = originals.error;
|
|
35
|
+
console.warn = originals.warn;
|
|
36
|
+
console.info = originals.info;
|
|
37
|
+
console.debug = originals.debug;
|
|
38
|
+
stream?.end();
|
|
39
|
+
stream = null;
|
|
40
|
+
captured = false;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=console-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-capture.js","sourceRoot":"","sources":["../../src/utils/console-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,O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logPath: string, systemPrompt?: string, onChunk?: (line: string) => void, cwd?: string, quiet?: boolean): Promise<{
|
|
2
2
|
code: number;
|
|
3
|
-
|
|
4
|
-
export declare function execAndCapture(command: string, message: string, logPath: string, cwd?: string): Promise<{
|
|
5
|
-
code: number;
|
|
6
|
-
stdout: string;
|
|
7
|
-
stderr: string;
|
|
3
|
+
sessionId?: string;
|
|
8
4
|
}>;
|
package/dist/utils/exec.js
CHANGED
|
@@ -1,47 +1,66 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cwd,
|
|
13
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
14
|
-
env: { ...process.env },
|
|
15
|
-
});
|
|
16
|
-
child.stdout?.on("data", (d) => process.stdout.write(d));
|
|
17
|
-
child.stderr?.on("data", (d) => process.stderr.write(d));
|
|
18
|
-
child.on("exit", (code) => resolve({ code: code ?? -1 }));
|
|
19
|
-
child.on("error", () => resolve({ code: -1 }));
|
|
20
|
-
});
|
|
4
|
+
function extractSessionId(line) {
|
|
5
|
+
try {
|
|
6
|
+
const obj = JSON.parse(line);
|
|
7
|
+
return obj.session_id || null;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
21
12
|
}
|
|
22
|
-
|
|
13
|
+
function escapeShell(s) {
|
|
14
|
+
return s.replace(/'/g, "'\\''");
|
|
15
|
+
}
|
|
16
|
+
export async function execWithStreaming(command, message, logPath, systemPrompt, onChunk, cwd, quiet) {
|
|
23
17
|
await fs.promises.mkdir(path.dirname(logPath), { recursive: true });
|
|
24
|
-
const escapedMsg = message
|
|
25
|
-
|
|
18
|
+
const escapedMsg = escapeShell(message);
|
|
19
|
+
let flags = `--output-format stream-json --verbose`;
|
|
20
|
+
if (systemPrompt) {
|
|
21
|
+
flags += ` --append-system-prompt '${escapeShell(systemPrompt)}'`;
|
|
22
|
+
}
|
|
23
|
+
const shellCmd = `exec ${command} ${flags} -p '${escapedMsg}' | tee -a '${escapeShell(logPath)}'`;
|
|
24
|
+
if (!quiet) {
|
|
25
|
+
const msgPreview = message.length > 100 ? message.slice(0, 100) + "..." : message;
|
|
26
|
+
console.log(`\n[Exec] ${command} -p '${msgPreview}' | tee -a '${logPath}'`);
|
|
27
|
+
}
|
|
26
28
|
return new Promise((resolve) => {
|
|
27
29
|
const child = spawn("sh", ["-c", shellCmd], {
|
|
28
30
|
cwd,
|
|
29
31
|
stdio: ["ignore", "pipe", "pipe"],
|
|
30
32
|
env: { ...process.env },
|
|
31
33
|
});
|
|
32
|
-
let
|
|
34
|
+
let partial = "";
|
|
35
|
+
let sessionId;
|
|
33
36
|
child.stdout?.on("data", (d) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const text = d.toString();
|
|
38
|
+
if (!quiet)
|
|
39
|
+
process.stdout.write(text);
|
|
40
|
+
partial += text;
|
|
41
|
+
const lines = partial.split("\n");
|
|
42
|
+
partial = lines.pop() ?? "";
|
|
43
|
+
for (const line of lines) {
|
|
44
|
+
if (line.length > 0) {
|
|
45
|
+
if (!sessionId)
|
|
46
|
+
sessionId = extractSessionId(line) ?? undefined;
|
|
47
|
+
onChunk?.(line);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
});
|
|
38
51
|
child.stderr?.on("data", (d) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
if (!quiet)
|
|
53
|
+
process.stderr.write(d);
|
|
54
|
+
});
|
|
55
|
+
child.on("exit", (code) => {
|
|
56
|
+
if (partial.length > 0) {
|
|
57
|
+
if (!sessionId)
|
|
58
|
+
sessionId = extractSessionId(partial) ?? undefined;
|
|
59
|
+
onChunk?.(partial);
|
|
60
|
+
}
|
|
61
|
+
resolve({ code: code ?? -1, sessionId });
|
|
42
62
|
});
|
|
43
|
-
child.on("
|
|
44
|
-
child.on("error", (err) => resolve({ code: -1, stdout, stderr: err.message }));
|
|
63
|
+
child.on("error", () => resolve({ code: -1 }));
|
|
45
64
|
});
|
|
46
65
|
}
|
|
47
66
|
//# sourceMappingURL=exec.js.map
|
package/dist/utils/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAe,EACf,OAAe,EACf,OAAe,EACf,YAAqB,EACrB,OAAgC,EAChC,GAAY,EACZ,KAAe;IAEf,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OA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fenced Claude output.
|
|
3
|
+
* Handles: ```json ... ```, ``` ... ```, and inline JSON with surrounding text.
|
|
4
|
+
*/
|
|
5
|
+
export function extractJson(content) {
|
|
6
|
+
let cleaned = content.trim();
|
|
7
|
+
// Strip markdown code fences (anchored to start/end)
|
|
8
|
+
cleaned = cleaned.replace(/^```(?:json)?\s*\n?/i, "").replace(/\n?```\s*$/i, "");
|
|
9
|
+
// Try to extract the first JSON object or array
|
|
10
|
+
const match = cleaned.match(/\{[\s\S]*\}|\[[\s\S]*\]/);
|
|
11
|
+
if (match)
|
|
12
|
+
return match[0].trim();
|
|
13
|
+
// Fallback: global fence removal
|
|
14
|
+
cleaned = cleaned.replace(/```json\s*/g, "").replace(/```\s*/g, "").trim();
|
|
15
|
+
return cleaned;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAE7B,qDAAqD;IACrD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAEjF,gDAAgD;IAChD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACvD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAElC,iCAAiC;IACjC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/logger.js
CHANGED
|
@@ -9,6 +9,9 @@ export class Logger {
|
|
|
9
9
|
info(msg) {
|
|
10
10
|
console.log(`[${this.tag}] ${msg}`);
|
|
11
11
|
}
|
|
12
|
+
warn(msg) {
|
|
13
|
+
console.warn(`[${this.tag}] ${msg}`);
|
|
14
|
+
}
|
|
12
15
|
error(msg, err) {
|
|
13
16
|
const extra = err instanceof Error ? `: ${err.message}` : err !== undefined ? `: ${err}` : "";
|
|
14
17
|
console.error(`[${this.tag}] ${msg}${extra}`);
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAMG;IALZ,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;IAEpC,MAAM,CAAC,WAAW,KAAW,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,OAAO,KAAc,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzD,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEnC,IAAI,CAAC,GAAW;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,GAAa;QAC9B,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9F,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAW;QACf,I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C;QAC9C,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ChildConfig {
|
|
2
|
+
worktreePath: string;
|
|
3
|
+
name: string;
|
|
4
|
+
role: string;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
zkHosts: string;
|
|
8
|
+
debug: boolean;
|
|
9
|
+
cliCommand: string;
|
|
10
|
+
cacheDir: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function startWorkerChild(config: ChildConfig): Promise<void>;
|