cclaw-cli 7.7.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -134
- package/dist/artifact-frontmatter.d.ts +51 -0
- package/dist/artifact-frontmatter.js +131 -0
- package/dist/artifact-paths.d.ts +7 -27
- package/dist/artifact-paths.js +20 -249
- package/dist/cancel.d.ts +16 -0
- package/dist/cancel.js +66 -0
- package/dist/cli.d.ts +2 -27
- package/dist/cli.js +90 -508
- package/dist/compound.d.ts +26 -0
- package/dist/compound.js +96 -0
- package/dist/config.d.ts +14 -51
- package/dist/config.js +23 -359
- package/dist/constants.d.ts +11 -18
- package/dist/constants.js +19 -106
- package/dist/content/antipatterns.d.ts +1 -0
- package/dist/content/antipatterns.js +109 -0
- package/dist/content/artifact-templates.d.ts +10 -0
- package/dist/content/artifact-templates.js +550 -0
- package/dist/content/cancel-command.d.ts +2 -2
- package/dist/content/cancel-command.js +25 -17
- package/dist/content/core-agents.d.ts +9 -233
- package/dist/content/core-agents.js +39 -768
- package/dist/content/decision-protocol.d.ts +1 -12
- package/dist/content/decision-protocol.js +27 -20
- package/dist/content/examples.d.ts +8 -42
- package/dist/content/examples.js +293 -425
- package/dist/content/idea-command.d.ts +2 -0
- package/dist/content/idea-command.js +38 -0
- package/dist/content/iron-laws.d.ts +4 -138
- package/dist/content/iron-laws.js +18 -197
- package/dist/content/meta-skill.d.ts +1 -3
- package/dist/content/meta-skill.js +57 -134
- package/dist/content/node-hooks.d.ts +12 -8
- package/dist/content/node-hooks.js +188 -838
- package/dist/content/recovery.d.ts +8 -0
- package/dist/content/recovery.js +179 -0
- package/dist/content/reference-patterns.d.ts +4 -13
- package/dist/content/reference-patterns.js +260 -389
- package/dist/content/research-playbooks.d.ts +8 -8
- package/dist/content/research-playbooks.js +108 -121
- package/dist/content/review-loop.d.ts +6 -192
- package/dist/content/review-loop.js +29 -731
- package/dist/content/skills.d.ts +8 -38
- package/dist/content/skills.js +681 -732
- package/dist/content/specialist-prompts/architect.d.ts +1 -0
- package/dist/content/specialist-prompts/architect.js +225 -0
- package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
- package/dist/content/specialist-prompts/brainstormer.js +168 -0
- package/dist/content/specialist-prompts/index.d.ts +2 -0
- package/dist/content/specialist-prompts/index.js +14 -0
- package/dist/content/specialist-prompts/planner.d.ts +1 -0
- package/dist/content/specialist-prompts/planner.js +182 -0
- package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/reviewer.js +193 -0
- package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/security-reviewer.js +133 -0
- package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
- package/dist/content/specialist-prompts/slice-builder.js +232 -0
- package/dist/content/stage-playbooks.d.ts +8 -0
- package/dist/content/stage-playbooks.js +404 -0
- package/dist/content/start-command.d.ts +2 -12
- package/dist/content/start-command.js +221 -207
- package/dist/flow-state.d.ts +21 -178
- package/dist/flow-state.js +67 -170
- package/dist/fs-utils.d.ts +6 -26
- package/dist/fs-utils.js +29 -162
- package/dist/gitignore.d.ts +2 -1
- package/dist/gitignore.js +51 -34
- package/dist/harness-detect.d.ts +10 -0
- package/dist/harness-detect.js +29 -0
- package/dist/install.d.ts +27 -15
- package/dist/install.js +230 -1342
- package/dist/knowledge-store.d.ts +19 -163
- package/dist/knowledge-store.js +56 -590
- package/dist/logger.d.ts +8 -3
- package/dist/logger.js +13 -4
- package/dist/orchestrator-routing.d.ts +29 -0
- package/dist/orchestrator-routing.js +156 -0
- package/dist/run-persistence.d.ts +7 -118
- package/dist/run-persistence.js +29 -845
- package/dist/runtime/run-hook.entry.d.ts +1 -3
- package/dist/runtime/run-hook.entry.js +19 -4
- package/dist/runtime/run-hook.mjs +13 -1024
- package/dist/types.d.ts +25 -261
- package/dist/types.js +8 -36
- package/package.json +6 -3
- package/dist/artifact-linter/brainstorm.d.ts +0 -2
- package/dist/artifact-linter/brainstorm.js +0 -353
- package/dist/artifact-linter/design.d.ts +0 -18
- package/dist/artifact-linter/design.js +0 -444
- package/dist/artifact-linter/findings-dedup.d.ts +0 -56
- package/dist/artifact-linter/findings-dedup.js +0 -232
- package/dist/artifact-linter/plan.d.ts +0 -2
- package/dist/artifact-linter/plan.js +0 -826
- package/dist/artifact-linter/review-army.d.ts +0 -49
- package/dist/artifact-linter/review-army.js +0 -520
- package/dist/artifact-linter/review.d.ts +0 -2
- package/dist/artifact-linter/review.js +0 -113
- package/dist/artifact-linter/scope.d.ts +0 -2
- package/dist/artifact-linter/scope.js +0 -158
- package/dist/artifact-linter/shared.d.ts +0 -637
- package/dist/artifact-linter/shared.js +0 -2163
- package/dist/artifact-linter/ship.d.ts +0 -2
- package/dist/artifact-linter/ship.js +0 -250
- package/dist/artifact-linter/spec.d.ts +0 -2
- package/dist/artifact-linter/spec.js +0 -176
- package/dist/artifact-linter/tdd.d.ts +0 -118
- package/dist/artifact-linter/tdd.js +0 -1404
- package/dist/artifact-linter.d.ts +0 -15
- package/dist/artifact-linter.js +0 -517
- package/dist/codex-feature-flag.d.ts +0 -58
- package/dist/codex-feature-flag.js +0 -193
- package/dist/content/closeout-guidance.d.ts +0 -14
- package/dist/content/closeout-guidance.js +0 -44
- package/dist/content/diff-command.d.ts +0 -1
- package/dist/content/diff-command.js +0 -43
- package/dist/content/harness-doc.d.ts +0 -1
- package/dist/content/harness-doc.js +0 -65
- package/dist/content/hook-events.d.ts +0 -9
- package/dist/content/hook-events.js +0 -23
- package/dist/content/hook-manifest.d.ts +0 -81
- package/dist/content/hook-manifest.js +0 -156
- package/dist/content/hooks.d.ts +0 -11
- package/dist/content/hooks.js +0 -1972
- package/dist/content/idea.d.ts +0 -60
- package/dist/content/idea.js +0 -416
- package/dist/content/language-policy.d.ts +0 -2
- package/dist/content/language-policy.js +0 -13
- package/dist/content/learnings.d.ts +0 -6
- package/dist/content/learnings.js +0 -141
- package/dist/content/observe.d.ts +0 -19
- package/dist/content/observe.js +0 -86
- package/dist/content/opencode-plugin.d.ts +0 -1
- package/dist/content/opencode-plugin.js +0 -635
- package/dist/content/review-prompts.d.ts +0 -1
- package/dist/content/review-prompts.js +0 -104
- package/dist/content/runtime-shared-snippets.d.ts +0 -8
- package/dist/content/runtime-shared-snippets.js +0 -80
- package/dist/content/session-hooks.d.ts +0 -7
- package/dist/content/session-hooks.js +0 -107
- package/dist/content/skills-elicitation.d.ts +0 -1
- package/dist/content/skills-elicitation.js +0 -167
- package/dist/content/stage-command.d.ts +0 -2
- package/dist/content/stage-command.js +0 -17
- package/dist/content/stage-schema.d.ts +0 -117
- package/dist/content/stage-schema.js +0 -955
- package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
- package/dist/content/stages/_lint-metadata/index.js +0 -97
- package/dist/content/stages/brainstorm.d.ts +0 -2
- package/dist/content/stages/brainstorm.js +0 -184
- package/dist/content/stages/design.d.ts +0 -2
- package/dist/content/stages/design.js +0 -288
- package/dist/content/stages/index.d.ts +0 -8
- package/dist/content/stages/index.js +0 -11
- package/dist/content/stages/plan.d.ts +0 -2
- package/dist/content/stages/plan.js +0 -191
- package/dist/content/stages/review.d.ts +0 -2
- package/dist/content/stages/review.js +0 -240
- package/dist/content/stages/schema-types.d.ts +0 -203
- package/dist/content/stages/schema-types.js +0 -1
- package/dist/content/stages/scope.d.ts +0 -2
- package/dist/content/stages/scope.js +0 -254
- package/dist/content/stages/ship.d.ts +0 -2
- package/dist/content/stages/ship.js +0 -159
- package/dist/content/stages/spec.d.ts +0 -2
- package/dist/content/stages/spec.js +0 -170
- package/dist/content/stages/tdd.d.ts +0 -4
- package/dist/content/stages/tdd.js +0 -273
- package/dist/content/state-contracts.d.ts +0 -1
- package/dist/content/state-contracts.js +0 -63
- package/dist/content/status-command.d.ts +0 -4
- package/dist/content/status-command.js +0 -109
- package/dist/content/subagent-context-skills.d.ts +0 -4
- package/dist/content/subagent-context-skills.js +0 -279
- package/dist/content/subagents.d.ts +0 -3
- package/dist/content/subagents.js +0 -997
- package/dist/content/templates.d.ts +0 -26
- package/dist/content/templates.js +0 -1692
- package/dist/content/track-render-context.d.ts +0 -18
- package/dist/content/track-render-context.js +0 -53
- package/dist/content/tree-command.d.ts +0 -1
- package/dist/content/tree-command.js +0 -64
- package/dist/content/utility-skills.d.ts +0 -30
- package/dist/content/utility-skills.js +0 -160
- package/dist/content/view-command.d.ts +0 -2
- package/dist/content/view-command.js +0 -92
- package/dist/delegation.d.ts +0 -649
- package/dist/delegation.js +0 -1539
- package/dist/early-loop.d.ts +0 -70
- package/dist/early-loop.js +0 -302
- package/dist/execution-topology.d.ts +0 -44
- package/dist/execution-topology.js +0 -95
- package/dist/gate-evidence.d.ts +0 -85
- package/dist/gate-evidence.js +0 -631
- package/dist/harness-adapters.d.ts +0 -151
- package/dist/harness-adapters.js +0 -756
- package/dist/harness-selection.d.ts +0 -31
- package/dist/harness-selection.js +0 -214
- package/dist/hook-schema.d.ts +0 -6
- package/dist/hook-schema.js +0 -114
- package/dist/hook-schemas/claude-hooks.v1.json +0 -10
- package/dist/hook-schemas/codex-hooks.v1.json +0 -10
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
- package/dist/init-detect.d.ts +0 -2
- package/dist/init-detect.js +0 -50
- package/dist/internal/advance-stage/advance.d.ts +0 -89
- package/dist/internal/advance-stage/advance.js +0 -655
- package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
- package/dist/internal/advance-stage/cancel-run.js +0 -19
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
- package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
- package/dist/internal/advance-stage/helpers.d.ts +0 -14
- package/dist/internal/advance-stage/helpers.js +0 -145
- package/dist/internal/advance-stage/hook.d.ts +0 -8
- package/dist/internal/advance-stage/hook.js +0 -40
- package/dist/internal/advance-stage/parsers.d.ts +0 -72
- package/dist/internal/advance-stage/parsers.js +0 -357
- package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
- package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
- package/dist/internal/advance-stage/review-loop.d.ts +0 -16
- package/dist/internal/advance-stage/review-loop.js +0 -199
- package/dist/internal/advance-stage/rewind.d.ts +0 -14
- package/dist/internal/advance-stage/rewind.js +0 -108
- package/dist/internal/advance-stage/start-flow.d.ts +0 -13
- package/dist/internal/advance-stage/start-flow.js +0 -241
- package/dist/internal/advance-stage/verify.d.ts +0 -21
- package/dist/internal/advance-stage/verify.js +0 -185
- package/dist/internal/advance-stage.d.ts +0 -7
- package/dist/internal/advance-stage.js +0 -138
- package/dist/internal/cohesion-contract-stub.d.ts +0 -24
- package/dist/internal/cohesion-contract-stub.js +0 -148
- package/dist/internal/compound-readiness.d.ts +0 -23
- package/dist/internal/compound-readiness.js +0 -102
- package/dist/internal/detect-public-api-changes.d.ts +0 -5
- package/dist/internal/detect-public-api-changes.js +0 -45
- package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
- package/dist/internal/detect-supply-chain-changes.js +0 -138
- package/dist/internal/early-loop-status.d.ts +0 -7
- package/dist/internal/early-loop-status.js +0 -93
- package/dist/internal/envelope-validate.d.ts +0 -7
- package/dist/internal/envelope-validate.js +0 -66
- package/dist/internal/flow-state-repair.d.ts +0 -20
- package/dist/internal/flow-state-repair.js +0 -104
- package/dist/internal/plan-split-waves.d.ts +0 -190
- package/dist/internal/plan-split-waves.js +0 -764
- package/dist/internal/runtime-integrity.d.ts +0 -7
- package/dist/internal/runtime-integrity.js +0 -268
- package/dist/internal/slice-commit.d.ts +0 -7
- package/dist/internal/slice-commit.js +0 -619
- package/dist/internal/tdd-loop-status.d.ts +0 -14
- package/dist/internal/tdd-loop-status.js +0 -68
- package/dist/internal/tdd-red-evidence.d.ts +0 -7
- package/dist/internal/tdd-red-evidence.js +0 -153
- package/dist/internal/waiver-grant.d.ts +0 -62
- package/dist/internal/waiver-grant.js +0 -294
- package/dist/internal/wave-status.d.ts +0 -74
- package/dist/internal/wave-status.js +0 -506
- package/dist/managed-resources.d.ts +0 -53
- package/dist/managed-resources.js +0 -313
- package/dist/policy.d.ts +0 -10
- package/dist/policy.js +0 -167
- package/dist/retro-gate.d.ts +0 -9
- package/dist/retro-gate.js +0 -47
- package/dist/run-archive.d.ts +0 -61
- package/dist/run-archive.js +0 -391
- package/dist/runs.d.ts +0 -2
- package/dist/runs.js +0 -2
- package/dist/stack-detection.d.ts +0 -116
- package/dist/stack-detection.js +0 -489
- package/dist/streaming/event-stream.d.ts +0 -31
- package/dist/streaming/event-stream.js +0 -114
- package/dist/tdd-cycle.d.ts +0 -107
- package/dist/tdd-cycle.js +0 -289
- package/dist/tdd-verification-evidence.d.ts +0 -17
- package/dist/tdd-verification-evidence.js +0 -122
- package/dist/track-heuristics.d.ts +0 -27
- package/dist/track-heuristics.js +0 -154
- package/dist/util/slice-id.d.ts +0 -58
- package/dist/util/slice-id.js +0 -89
- package/dist/worktree-manager.d.ts +0 -20
- package/dist/worktree-manager.js +0 -108
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const RESEARCH_PLAYBOOKS:
|
|
8
|
-
export declare const
|
|
1
|
+
export interface ResearchPlaybook {
|
|
2
|
+
id: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
title: string;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const RESEARCH_PLAYBOOKS: ResearchPlaybook[];
|
|
8
|
+
export declare const RESEARCH_PLAYBOOKS_INDEX: string;
|
|
@@ -1,171 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
* In-thread research playbooks.
|
|
3
|
-
*
|
|
4
|
-
* These files intentionally have no YAML frontmatter and are not standalone
|
|
5
|
-
* delegated personas. The primary agent loads and executes them directly.
|
|
6
|
-
*/
|
|
7
|
-
export const RESEARCH_PLAYBOOKS = {
|
|
8
|
-
"repo-scan.md": `# Repo Scan Playbook
|
|
1
|
+
const READING_CODEBASE = `# Research — reading the codebase
|
|
9
2
|
|
|
10
|
-
|
|
3
|
+
Planner mode \`research\` exists because writing a plan against a codebase you have not read produces speculation. This playbook scopes "read enough" without becoming a stall. It covers three reading targets: implementation files, existing tests, and integration boundaries.
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
## 1. What you must read
|
|
13
6
|
|
|
14
|
-
|
|
7
|
+
| signal | read |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| AC mentions a file | the file (or the relevant function within it) |
|
|
10
|
+
| AC mentions a test | the test file |
|
|
11
|
+
| AC implies a public API change | the export site + at least one consumer |
|
|
12
|
+
| AC implies a schema change | the migration directory + the ORM model |
|
|
13
|
+
| AC implies a config change | the config file + every place it is read |
|
|
14
|
+
| AC implies a CI change | the workflow file + the policy doc, if any |
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
2. Search for likely modules with \`rg\` and \`Glob\` patterns.
|
|
18
|
-
3. List existing implementations or close analogs with file citations.
|
|
19
|
-
4. Flag duplication risk and obvious extension points.
|
|
16
|
+
## 2. What you may skim
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
| signal | skim |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| README mentions the area | the relevant README section |
|
|
21
|
+
| Prior shipped slug for the same area exists | \`.cclaw/flows/shipped/<slug>/manifest.md\` |
|
|
22
|
+
| Prior decisions in the area | \`.cclaw/flows/shipped/<slug>/decisions.md\` |
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
- Reuse candidates: \`file:line - why reusable\`
|
|
25
|
-
- Gaps: capabilities not currently present
|
|
24
|
+
## 3. What you may ignore
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
- The whole codebase. You are not writing a survey paper.
|
|
27
|
+
- Files outside the AC's declared file set.
|
|
28
|
+
- Library source unless the AC depends on a private library detail.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
- Never invent paths or ownership.
|
|
31
|
-
- If scope is too broad, return bounded partial coverage explicitly.
|
|
32
|
-
`,
|
|
33
|
-
"learnings-lookup.md": `# Learnings Lookup Playbook
|
|
30
|
+
## 4. Reading existing tests effectively
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
When the task is to add or modify behaviour, the existing test suite is the fastest way to understand the contract.
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
**Where to look first:**
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
1. The test file with the same name as the module (\`src/foo.ts\` → \`tests/unit/foo.test.ts\` or \`src/foo.test.ts\`). Read the highest-fidelity tests there: integration > unit, behavioural > snapshot.
|
|
37
|
+
2. The most recent test file in the same directory. It usually reflects the current style, fixture conventions, and mocking choices.
|
|
38
|
+
3. The shared fixtures (\`tests/helpers/\` or equivalent). They carry the project's idea of "a normal record"; reuse instead of inventing.
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
2. Read \`.cclaw/knowledge.jsonl\` only if the digest is missing or too thin.
|
|
43
|
-
3. Match by stage/domain keywords from the current task.
|
|
44
|
-
4. Rank matches by confidence and recency.
|
|
45
|
-
5. Return the top entries verbatim.
|
|
40
|
+
**What to extract:**
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
- The contract the module advertises. Tests are the contract.
|
|
43
|
+
- The runner conventions (\`describe\` / \`it\` / \`test\`, async style, mock library).
|
|
44
|
+
- The "doesn't crash on edge X" tests — these often map directly to AC verification lines.
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
- Matched patterns
|
|
51
|
-
- Matched lessons
|
|
52
|
-
- Matched compounds
|
|
53
|
-
- Explicit no-match note when empty
|
|
46
|
+
**What to ignore:**
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
- Snapshot tests for unrelated parts of the file.
|
|
49
|
+
- Coverage gaps in adjacent modules.
|
|
50
|
+
- Tests skipped with \`.skip\` / \`xit\` / \`@pytest.mark.skip\` — usually intentional or stale.
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
- Prefer exact quote over paraphrase.
|
|
59
|
-
`,
|
|
60
|
-
"framework-docs-lookup.md": `# Framework Docs Lookup Playbook
|
|
52
|
+
Findings flow back to the plan as either AC verification lines that reference an existing test ("AC-2 verified by \`tests/unit/foo.test.ts: handles empty input\`") or a new AC ("AC-3: pin the empty-input case in a test").
|
|
61
53
|
|
|
62
|
-
##
|
|
54
|
+
## 5. Reading integration boundaries
|
|
63
55
|
|
|
64
|
-
|
|
56
|
+
When the task crosses a module boundary or depends on a library upgrade, read both sides.
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
**Internal boundaries:**
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
- The exported surface (\`index.ts\` / \`__init__.py\` / \`mod.rs\`) and the consumers.
|
|
61
|
+
- Any DI registration or factory wiring.
|
|
62
|
+
- The integration test that covers the boundary, if it exists.
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
If no integration test exists, "add one" is often a valid AC.
|
|
73
65
|
|
|
74
|
-
|
|
75
|
-
- APIs/signatures touched
|
|
76
|
-
- Relevant breaking changes or gotchas
|
|
77
|
-
- Source links/references
|
|
66
|
+
**External boundaries (third-party libraries):**
|
|
78
67
|
|
|
79
|
-
|
|
68
|
+
- The library's documented API for the version pinned in the project (not the latest version).
|
|
69
|
+
- Any compatibility shims the project added (look for files with \`compat\` / \`shim\` / \`adapter\` in the name).
|
|
70
|
+
- The version constraint in \`package.json\` / \`pyproject.toml\` / \`Cargo.toml\` / equivalent.
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
- If docs conflict or are unclear, mark UNKNOWN and escalate.
|
|
83
|
-
`,
|
|
84
|
-
"best-practices-lookup.md": `# Best Practices Lookup Playbook
|
|
72
|
+
If the project uses a feature the pinned version does not have, escalate back to architect.
|
|
85
73
|
|
|
86
|
-
|
|
74
|
+
A boundary inventory then enters the Plan phases (e.g. "Phase 1 — extend boundary at \`src/server/api/index.ts\` to expose the new route"). If the boundary is across a trust boundary (network, IPC, eval), set \`security_flag: true\` in plan frontmatter.
|
|
87
75
|
|
|
88
|
-
|
|
76
|
+
## 6. Where the output lands
|
|
89
77
|
|
|
90
|
-
|
|
78
|
+
Research mode does not produce its own artifact. It feeds two sections of \`flows/<slug>/plan.md\`:
|
|
91
79
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
3. Produce short practice and anti-pattern lists tied to sources.
|
|
80
|
+
- the **Context** paragraph, citing what you read;
|
|
81
|
+
- the **Plan** phases, with file:line references.
|
|
95
82
|
|
|
96
|
-
##
|
|
83
|
+
## 7. Stop conditions
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
- Common traps (\`trap - why it fails - source\`)
|
|
100
|
-
- Decision hooks (1-3 questions to resolve before proceeding)
|
|
85
|
+
Stop reading when you can answer:
|
|
101
86
|
|
|
102
|
-
|
|
87
|
+
1. Where will the change land? (file:line)
|
|
88
|
+
2. Who calls / depends on the changed code?
|
|
89
|
+
3. What is the verification (test, command, manual step)?
|
|
90
|
+
4. What is the smallest commit that satisfies AC-1?
|
|
103
91
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"research-fleet.md": `# Parallel Research Fleet Playbook
|
|
92
|
+
If you can answer all four, stop reading and start authoring AC.
|
|
93
|
+
`;
|
|
94
|
+
const HOW_TO_TIME_BOX = `# Research — time-boxing
|
|
108
95
|
|
|
109
|
-
|
|
96
|
+
Research can dominate a slug if you let it. Time-box.
|
|
110
97
|
|
|
111
|
-
|
|
112
|
-
in current ecosystem data, not intuition.
|
|
98
|
+
## Default budget
|
|
113
99
|
|
|
114
|
-
|
|
100
|
+
- 5-10 minutes of reading per AC.
|
|
101
|
+
- 15-30 minutes total for medium tasks.
|
|
102
|
+
- Up to 60 minutes for large/risky tasks; if you exceed 60 minutes, the task is too large and should be split.
|
|
115
103
|
|
|
116
|
-
|
|
117
|
-
harness supports it and the lenses are independent:
|
|
104
|
+
## Signals that you are over-reading
|
|
118
105
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
106
|
+
- You re-read the same file twice without finding new information.
|
|
107
|
+
- You start reading "interesting" code outside the AC scope.
|
|
108
|
+
- You start drafting unrelated refactors mentally.
|
|
122
109
|
|
|
123
|
-
|
|
110
|
+
When any of these triggers, stop reading. Author the plan with what you have. The reviewer will catch holes; you do not need to be exhaustive at plan-stage.
|
|
124
111
|
|
|
125
|
-
|
|
112
|
+
## Signals that you are under-reading
|
|
126
113
|
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
- \`## Pitfalls & Risks\`
|
|
131
|
-
- \`## Synthesis\`
|
|
114
|
+
- You cannot cite a single \`file:path:line\` reference.
|
|
115
|
+
- You cannot name the verification step for an AC.
|
|
116
|
+
- You are speculating about library behaviour rather than reading the call site.
|
|
132
117
|
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
In all three cases, read more before authoring.
|
|
119
|
+
`;
|
|
120
|
+
const HOW_TO_USE_PRIOR_SLUGS = `# Research — using prior shipped slugs
|
|
135
121
|
|
|
136
|
-
|
|
122
|
+
Refinement is the cheapest path to a high-quality plan. Use it.
|
|
137
123
|
|
|
138
|
-
|
|
139
|
-
- Keep lenses independent during fan-out; merge only in synthesis.
|
|
140
|
-
- If any lens is incomplete, record it explicitly in \`## Synthesis\` as a blocker.
|
|
141
|
-
`,
|
|
142
|
-
"git-history.md": `# Git History Playbook
|
|
124
|
+
## When to look at prior slugs
|
|
143
125
|
|
|
144
|
-
|
|
126
|
+
- Existing-plan detection found a match (slug or body overlap).
|
|
127
|
+
- The user said "remember when we did X" / "like the previous one" / "fix the thing we shipped last week".
|
|
128
|
+
- The task touches an area that has been shipped within the past month.
|
|
145
129
|
|
|
146
|
-
|
|
130
|
+
## What to extract from a prior shipped slug
|
|
147
131
|
|
|
148
|
-
|
|
132
|
+
| from | extract |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| \`shipped/<slug>/manifest.md\` | AC ↔ commit map; ship_commit |
|
|
135
|
+
| \`shipped/<slug>/plan.md\` | Context, Frame, Out-of-scope items (still useful) |
|
|
136
|
+
| \`shipped/<slug>/decisions.md\` | architectural decisions and their consequences |
|
|
137
|
+
| \`shipped/<slug>/learnings.md\` | what we got wrong; what to keep doing |
|
|
138
|
+
| \`shipped/<slug>/review.md\` | findings from the last review (some may still apply) |
|
|
149
139
|
|
|
150
|
-
|
|
151
|
-
- \`git log --follow -n 20 -- <path>\`
|
|
152
|
-
2. Check ownership hotspots:
|
|
153
|
-
- \`git blame <path>\`
|
|
154
|
-
- \`git log --since="<window>" --format="%an" -- <path>\`
|
|
155
|
-
3. Search for regression signals:
|
|
156
|
-
- \`git log --since="<window>" --grep="revert|regression" -- <path>\`
|
|
140
|
+
## What not to do
|
|
157
141
|
|
|
158
|
-
|
|
142
|
+
- Do not copy AC verbatim into the new plan. AC restart at AC-1 in a refinement.
|
|
143
|
+
- Do not assume the architecture is unchanged. Re-validate; the refinement may invalidate prior assumptions.
|
|
144
|
+
- Do not treat the prior \`learnings.md\` as ground truth. It captures what we learned at the time; new evidence may overrule it.
|
|
145
|
+
`;
|
|
146
|
+
export const RESEARCH_PLAYBOOKS = [
|
|
147
|
+
{ id: "reading-codebase", fileName: "reading-codebase.md", title: "Research — reading the codebase", body: READING_CODEBASE },
|
|
148
|
+
{ id: "time-boxing", fileName: "time-boxing.md", title: "Research — time-boxing", body: HOW_TO_TIME_BOX },
|
|
149
|
+
{ id: "prior-slugs", fileName: "prior-slugs.md", title: "Research — using prior shipped slugs", body: HOW_TO_USE_PRIOR_SLUGS }
|
|
150
|
+
];
|
|
151
|
+
export const RESEARCH_PLAYBOOKS_INDEX = `# .cclaw/lib/research/
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
- Revert/regression signals (with SHAs)
|
|
162
|
-
- Ownership hints
|
|
163
|
-
- Collision risks with ongoing refactors
|
|
153
|
+
Research playbooks loaded by \`planner\` mode=\`research\`. Each playbook is a small, focused checklist; they compose with each other.
|
|
164
154
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
`
|
|
170
|
-
};
|
|
171
|
-
export const RESEARCH_PLAYBOOK_FILES = Object.keys(RESEARCH_PLAYBOOKS).sort();
|
|
155
|
+
| playbook | when |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
${RESEARCH_PLAYBOOKS.map((p) => `| [\`${p.fileName}\`](./${p.fileName}) | ${p.title.replace(/^Research — /u, "")} |`).join("\n")}
|
|
158
|
+
`;
|
|
@@ -1,194 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SkillEnvelope } from "./stage-schema.js";
|
|
3
|
-
export declare const REVIEW_LOOP_STAGES: readonly ["scope", "design"];
|
|
4
|
-
export type ReviewLoopStage = (typeof REVIEW_LOOP_STAGES)[number];
|
|
5
|
-
export declare const REVIEW_LOOP_DEFAULT_MAX_ITERATIONS = 3;
|
|
6
|
-
export declare const REVIEW_LOOP_DEFAULT_TARGET_SCORE = 0.8;
|
|
7
|
-
export type ReviewFindingSeverity = "critical" | "important" | "suggestion";
|
|
8
|
-
export type ReviewLoopStopReason = "quality_threshold_met" | "max_iterations_reached" | "user_opt_out";
|
|
9
|
-
export interface ReviewLoopDimension {
|
|
1
|
+
export interface FailureMode {
|
|
10
2
|
id: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
guidance: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
14
5
|
}
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
weight?: number;
|
|
19
|
-
rationale?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ReviewFinding {
|
|
22
|
-
id: string;
|
|
23
|
-
dimensionId: string;
|
|
24
|
-
severity: ReviewFindingSeverity;
|
|
25
|
-
summary: string;
|
|
26
|
-
evidence?: string;
|
|
27
|
-
recommendation?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ReviewLoopBudget {
|
|
30
|
-
maxIterations?: number;
|
|
31
|
-
targetScore?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface ReviewLoopIterationSummary {
|
|
34
|
-
iteration: number;
|
|
35
|
-
qualityScore: number;
|
|
36
|
-
findingsCount: number;
|
|
37
|
-
}
|
|
38
|
-
export interface ReviewLoopInput {
|
|
39
|
-
artifactPath: string;
|
|
40
|
-
stage: ReviewLoopStage;
|
|
41
|
-
checklist?: readonly ReviewLoopDimension[];
|
|
42
|
-
priorIterations?: ReadonlyArray<ReviewLoopIterationSummary>;
|
|
43
|
-
budget?: ReviewLoopBudget;
|
|
44
|
-
}
|
|
45
|
-
export interface ReviewLoopDispatchRequest {
|
|
46
|
-
stage: ReviewLoopStage;
|
|
47
|
-
artifactPath: string;
|
|
48
|
-
checklist: readonly ReviewLoopDimension[];
|
|
49
|
-
priorIterations: ReadonlyArray<ReviewLoopIterationSummary>;
|
|
50
|
-
iteration: number;
|
|
51
|
-
budget: Required<ReviewLoopBudget>;
|
|
52
|
-
}
|
|
53
|
-
export interface ReviewLoopIterationResult {
|
|
54
|
-
qualityScore: number;
|
|
55
|
-
findings: ReviewFinding[];
|
|
56
|
-
iteration: number;
|
|
57
|
-
shouldContinue: boolean;
|
|
58
|
-
dimensionScores: ReviewLoopDimensionScore[];
|
|
59
|
-
}
|
|
60
|
-
export interface ReviewLoopEnvelope {
|
|
61
|
-
type: "review-loop";
|
|
62
|
-
version: "1";
|
|
63
|
-
stage: ReviewLoopStage;
|
|
64
|
-
artifactPath: string;
|
|
65
|
-
targetScore: number;
|
|
66
|
-
maxIterations: number;
|
|
67
|
-
stopReason: ReviewLoopStopReason;
|
|
68
|
-
iterations: ReviewLoopIterationSummary[];
|
|
69
|
-
}
|
|
70
|
-
export interface ReviewLoopRunResult {
|
|
71
|
-
iterations: ReviewLoopIterationResult[];
|
|
72
|
-
qualityScore: number;
|
|
73
|
-
stopReason: ReviewLoopStopReason;
|
|
74
|
-
envelope: ReviewLoopEnvelope;
|
|
75
|
-
}
|
|
76
|
-
export type ReviewLoopDispatcher = (request: ReviewLoopDispatchRequest) => Promise<unknown>;
|
|
77
|
-
export interface ReviewLoopDispatchAdapterRequest {
|
|
78
|
-
request: ReviewLoopDispatchRequest;
|
|
79
|
-
prompt: string;
|
|
80
|
-
responseSchema: string;
|
|
81
|
-
}
|
|
82
|
-
export type ReviewLoopDispatchAdapter = (payload: ReviewLoopDispatchAdapterRequest) => Promise<unknown>;
|
|
83
|
-
export interface ReviewLoopSecondOpinionPolicy {
|
|
84
|
-
enabled?: boolean;
|
|
85
|
-
scoreDeltaThreshold?: number;
|
|
86
|
-
modelLabel?: string;
|
|
87
|
-
}
|
|
88
|
-
export interface ReviewLoopSecondOpinionMeta {
|
|
89
|
-
enabled: boolean;
|
|
90
|
-
modelLabel?: string;
|
|
91
|
-
primaryScore: number;
|
|
92
|
-
secondOpinionScore: number;
|
|
93
|
-
scoreDelta: number;
|
|
94
|
-
threshold: number;
|
|
95
|
-
}
|
|
96
|
-
export type ReviewLoopApplyFindings = (iteration: ReviewLoopIterationResult) => Promise<void> | void;
|
|
97
|
-
export interface RunReviewLoopOptions {
|
|
98
|
-
dispatcher: ReviewLoopDispatcher;
|
|
99
|
-
applyFindings: ReviewLoopApplyFindings;
|
|
100
|
-
shouldOptOut?: () => boolean;
|
|
101
|
-
emitEnvelope?: (envelope: ReviewLoopEnvelope) => void;
|
|
102
|
-
}
|
|
103
|
-
export declare function reviewLoopPolicySummary(stage: ReviewLoopStage): string;
|
|
104
|
-
export declare function reviewLoopSecondOpinionSummary(stage: ReviewLoopStage): string;
|
|
105
|
-
export declare const REVIEW_LOOP_CHECKLISTS: {
|
|
106
|
-
readonly scope: readonly [{
|
|
107
|
-
readonly id: "premise_fit";
|
|
108
|
-
readonly label: "Premise fit";
|
|
109
|
-
readonly weight: 1;
|
|
110
|
-
readonly guidance: "Does the scope contract solve the actual user/problem framing without drifting into adjacent asks?";
|
|
111
|
-
}, {
|
|
112
|
-
readonly id: "alternatives_coverage";
|
|
113
|
-
readonly label: "Alternatives coverage";
|
|
114
|
-
readonly weight: 1;
|
|
115
|
-
readonly guidance: "Are meaningful alternatives compared with explicit trade-offs and one clear recommendation?";
|
|
116
|
-
}, {
|
|
117
|
-
readonly id: "error_rescue_registry";
|
|
118
|
-
readonly label: "Error and rescue coverage";
|
|
119
|
-
readonly weight: 1;
|
|
120
|
-
readonly guidance: "Does each scoped capability define failure mode, detection signal, and fallback/rescue behavior?";
|
|
121
|
-
}, {
|
|
122
|
-
readonly id: "scope_creep_risk";
|
|
123
|
-
readonly label: "Scope-creep risk";
|
|
124
|
-
readonly weight: 1;
|
|
125
|
-
readonly guidance: "Are in/out boundaries explicit and protected against silent expansion/reduction language?";
|
|
126
|
-
}, {
|
|
127
|
-
readonly id: "completion_status_fidelity";
|
|
128
|
-
readonly label: "Completion status fidelity";
|
|
129
|
-
readonly weight: 1;
|
|
130
|
-
readonly guidance: "Does the completion dashboard honestly report unresolved risks, decision count, and stop reason?";
|
|
131
|
-
}];
|
|
132
|
-
readonly design: readonly [{
|
|
133
|
-
readonly id: "architecture_fit";
|
|
134
|
-
readonly label: "Architecture fit";
|
|
135
|
-
readonly weight: 1;
|
|
136
|
-
readonly guidance: "Do architecture boundaries and diagrams align with scope and real blast-radius code?";
|
|
137
|
-
}, {
|
|
138
|
-
readonly id: "failure_mode_coverage";
|
|
139
|
-
readonly label: "Failure-mode coverage";
|
|
140
|
-
readonly weight: 1;
|
|
141
|
-
readonly guidance: "Does the failure-mode table capture method/exception/rescue/user-visible impact for critical paths?";
|
|
142
|
-
}, {
|
|
143
|
-
readonly id: "test_coverage_realism";
|
|
144
|
-
readonly label: "Test coverage realism";
|
|
145
|
-
readonly weight: 1;
|
|
146
|
-
readonly guidance: "Is the proposed test split realistic (unit/integration/e2e) with explicit gap handling?";
|
|
147
|
-
}, {
|
|
148
|
-
readonly id: "performance_budget";
|
|
149
|
-
readonly label: "Performance budget";
|
|
150
|
-
readonly weight: 1;
|
|
151
|
-
readonly guidance: "Are critical metrics, thresholds, and measurement methods concrete and enforceable?";
|
|
152
|
-
}, {
|
|
153
|
-
readonly id: "observability_adequacy";
|
|
154
|
-
readonly label: "Observability adequacy";
|
|
155
|
-
readonly weight: 1;
|
|
156
|
-
readonly guidance: "Can on-call trace a failure from user symptom to root cause via logs/metrics/traces/alerts?";
|
|
157
|
-
}];
|
|
158
|
-
};
|
|
159
|
-
export declare function buildOutsideVoiceReviewPrompt(request: ReviewLoopDispatchRequest): string;
|
|
160
|
-
export declare function createOutsideVoiceDispatcher(adapter: ReviewLoopDispatchAdapter): ReviewLoopDispatcher;
|
|
161
|
-
export declare function parseReviewLoopDispatcherResult(raw: unknown, checklist: readonly ReviewLoopDimension[]): {
|
|
162
|
-
findings: ReviewFinding[];
|
|
163
|
-
dimensionScores: ReviewLoopDimensionScore[];
|
|
164
|
-
};
|
|
165
|
-
export declare function mergeSecondOpinionResults(primaryRaw: unknown, secondOpinionRaw: unknown, checklist: readonly ReviewLoopDimension[], policy?: ReviewLoopSecondOpinionPolicy): {
|
|
166
|
-
findings: ReviewFinding[];
|
|
167
|
-
dimensionScores: ReviewLoopDimensionScore[];
|
|
168
|
-
secondOpinion: ReviewLoopSecondOpinionMeta;
|
|
169
|
-
};
|
|
170
|
-
export declare function createSecondOpinionDispatcher(args: {
|
|
171
|
-
primary: ReviewLoopDispatcher;
|
|
172
|
-
secondOpinion?: ReviewLoopDispatcher;
|
|
173
|
-
policy?: ReviewLoopSecondOpinionPolicy;
|
|
174
|
-
}): ReviewLoopDispatcher;
|
|
175
|
-
export declare function aggregateQualityScore(scores: readonly ReviewLoopDimensionScore[], checklist: readonly ReviewLoopDimension[]): number;
|
|
176
|
-
export declare function runReviewLoopIteration(input: ReviewLoopInput & {
|
|
177
|
-
iteration: number;
|
|
178
|
-
}, dispatcher: ReviewLoopDispatcher): Promise<ReviewLoopIterationResult>;
|
|
179
|
-
export declare function buildReviewLoopEnvelope(args: {
|
|
180
|
-
stage: ReviewLoopStage;
|
|
181
|
-
artifactPath: string;
|
|
182
|
-
targetScore: number;
|
|
183
|
-
maxIterations: number;
|
|
184
|
-
stopReason: ReviewLoopStopReason;
|
|
185
|
-
iterations: ReadonlyArray<ReviewLoopIterationSummary>;
|
|
186
|
-
}): ReviewLoopEnvelope;
|
|
187
|
-
export declare function renderReviewLoopHeader(envelope: ReviewLoopEnvelope): string;
|
|
188
|
-
export declare function upsertReviewLoopHeader(markdown: string, envelope: ReviewLoopEnvelope): string;
|
|
189
|
-
export declare function renderReviewLoopSummarySection(envelope: ReviewLoopEnvelope): string;
|
|
190
|
-
export declare function upsertReviewLoopSummary(markdown: string, envelope: ReviewLoopEnvelope): string;
|
|
191
|
-
export declare function extractReviewLoopEnvelopeFromArtifact(markdown: string, stage: ReviewLoopStage, artifactPath: string): ReviewLoopEnvelope | null;
|
|
192
|
-
export declare function toSkillEnvelope(envelope: ReviewLoopEnvelope, emittedAt?: string, agent?: string): SkillEnvelope;
|
|
193
|
-
export declare function runReviewLoop(input: ReviewLoopInput, options: RunReviewLoopOptions): Promise<ReviewLoopRunResult>;
|
|
194
|
-
export declare function isReviewLoopStage(stage: FlowStage): stage is ReviewLoopStage;
|
|
6
|
+
export declare const FIVE_FAILURE_MODES: FailureMode[];
|
|
7
|
+
export declare const REVIEW_ITERATION_HARD_CAP = 5;
|
|
8
|
+
export declare function failureModesChecklist(): string;
|