cclaw-cli 7.7.0 → 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 -766
- 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 -132
- 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 -36
- package/dist/execution-topology.js +0 -73
- 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 -63
- package/dist/internal/wave-status.js +0 -450
- 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,391 +1,262 @@
|
|
|
1
|
+
const API_ENDPOINT = `# Pattern — new HTTP API endpoint
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
The user asks for "an endpoint", "a route", "an API for X", or wants to expose data that today is only reachable through internal code.
|
|
6
|
+
|
|
7
|
+
## Pre-flight checklist
|
|
8
|
+
|
|
9
|
+
1. Read \`src/server/router.ts\` (or your project's equivalent) and the closest existing endpoint of the same shape.
|
|
10
|
+
2. Identify the AuthZ policy: who is allowed to call this? If the answer is "anyone", flag it back to the user explicitly. Anonymous endpoints are a deliberate decision.
|
|
11
|
+
3. Identify the request and response schema. If the project uses Zod / TypeBox / pydantic / etc., the AC is "schema parses + rejects bad payloads".
|
|
12
|
+
|
|
13
|
+
## AC shape
|
|
14
|
+
|
|
15
|
+
- AC-1: \`POST/GET <path>\` accepts <schema> and returns <schema>; verified by an integration test that hits the route.
|
|
16
|
+
- AC-2: AuthZ rejects unauthorized callers; verified by an integration test with no/forged credentials.
|
|
17
|
+
- AC-3 (optional): rate limit / quota where applicable; verified by a smoke test or by reading \`<rate limiter>\` config.
|
|
18
|
+
|
|
19
|
+
## Specialists to invoke
|
|
20
|
+
|
|
21
|
+
- \`architect\` — if the endpoint touches a new resource type or changes a response schema that other endpoints depend on.
|
|
22
|
+
- \`security-reviewer\` — always, when AuthZ is non-trivial or when the endpoint exposes user data.
|
|
23
|
+
- \`reviewer\` mode=\`code\` after build; \`integration\` after slice-builder if multiple files.
|
|
24
|
+
|
|
25
|
+
## Common pitfalls
|
|
26
|
+
|
|
27
|
+
- "Allow only authenticated users" without saying which roles → ask which roles.
|
|
28
|
+
- Adding the endpoint without updating the OpenAPI / TS client. Fold the regen into the same AC if the project has a generator.
|
|
29
|
+
- Forgetting structured logs / metrics. If logging is enforced project-wide, mention it as an AC.
|
|
30
|
+
`;
|
|
31
|
+
const AUTH_FLOW = `# Pattern — authentication flow change
|
|
32
|
+
|
|
33
|
+
## When to use
|
|
34
|
+
|
|
35
|
+
The user asks for "login", "OAuth", "passkeys", "MFA", "SSO", "session lifetime", or anything that touches \`req.user\` derivation.
|
|
36
|
+
|
|
37
|
+
## Pre-flight checklist
|
|
38
|
+
|
|
39
|
+
1. Read the existing auth entry points (route handlers, middleware, session store).
|
|
40
|
+
2. Identify which trust boundary changes (browser ↔ edge, edge ↔ service, service ↔ identity provider).
|
|
41
|
+
3. Identify whether the change is additive (new flow) or replacing (rewriting an existing flow). Replacement is always large/risky.
|
|
42
|
+
4. Pull threat-model assumptions from prior shipped slugs (\`grep refines: …\` on auth-related plans).
|
|
43
|
+
|
|
44
|
+
## AC shape
|
|
45
|
+
|
|
46
|
+
- AC-1: happy path — user successfully authenticates and \`req.user\` carries the expected claims.
|
|
47
|
+
- AC-2: rejection paths — invalid credentials / expired tokens / replay attempts each return the documented error and do not leak information.
|
|
48
|
+
- AC-3: session lifetime — sessions expire on the documented schedule and refresh tokens behave correctly.
|
|
49
|
+
- AC-4: telemetry — auth events emit the configured audit logs with the correct fields.
|
|
50
|
+
|
|
51
|
+
## Specialists to invoke
|
|
52
|
+
|
|
53
|
+
- \`architect\` — always, even if the change feels additive.
|
|
54
|
+
- \`security-reviewer\` mode=\`threat-model\` — always.
|
|
55
|
+
- \`security-reviewer\` mode=\`sensitive-change\` — at code-review time on the diff.
|
|
56
|
+
- \`reviewer\` mode=\`adversarial\` — at least once, looking for the case the author is biased to miss.
|
|
57
|
+
|
|
58
|
+
## Common pitfalls
|
|
59
|
+
|
|
60
|
+
- Implementing OAuth without state / PKCE.
|
|
61
|
+
- Letting the new flow coexist with an old one indefinitely. Either schedule the deprecation or document why both are required.
|
|
62
|
+
- Logging tokens or refresh tokens. Even partial prefixes are a security finding.
|
|
63
|
+
- Skipping the rejection-path AC because "it follows from the framework". Write it.
|
|
64
|
+
`;
|
|
65
|
+
const SCHEMA_MIGRATION = `# Pattern — database schema migration
|
|
66
|
+
|
|
67
|
+
## When to use
|
|
68
|
+
|
|
69
|
+
The user asks to add / drop / rename a column, change a type, add an index, partition a table, or otherwise alter persisted state.
|
|
70
|
+
|
|
71
|
+
## Pre-flight checklist
|
|
72
|
+
|
|
73
|
+
1. Read the migration directory (Prisma / Alembic / Knex / Atlas / SQL files) and look at the most recent migration of the same shape.
|
|
74
|
+
2. Decide forward-only vs. reversible. Production usually wants reversible until the rollout is locked.
|
|
75
|
+
3. Decide downtime: zero-downtime (write-both-read-old → backfill → write-new-read-new) vs. allowed downtime (single migration).
|
|
76
|
+
4. Identify whether ORMs / generated clients need to be regenerated. Add this to the AC if so.
|
|
77
|
+
|
|
78
|
+
## AC shape
|
|
79
|
+
|
|
80
|
+
- AC-1: migration applies to a fresh DB; verified by integration test booting against the new schema.
|
|
81
|
+
- AC-2: migration applies to a non-empty DB; verified by a backfill smoke test on a fixture.
|
|
82
|
+
- AC-3: rollback path; verified by re-running the down migration on the fixture and asserting equivalence.
|
|
83
|
+
- AC-4: ORM / client regenerated; verified by a typecheck on the consumers.
|
|
84
|
+
|
|
85
|
+
## Specialists to invoke
|
|
86
|
+
|
|
87
|
+
- \`architect\` — when the migration changes a relationship, partition strategy, or index that other features rely on.
|
|
88
|
+
- \`security-reviewer\` — when the migration touches columns holding user data, secrets, or audit history.
|
|
89
|
+
|
|
90
|
+
## Common pitfalls
|
|
91
|
+
|
|
92
|
+
- "Just add the column nullable" without the backfill plan. Always state when the column becomes \`NOT NULL\`.
|
|
93
|
+
- Adding an index that is going to take >5 minutes on prod without coordinating. Surface the ops impact in the plan.
|
|
94
|
+
- Forgetting downstream replicas / read replicas / DR replicas. Write a one-line note in ship notes.
|
|
95
|
+
`;
|
|
96
|
+
const UI_COMPONENT = `# Pattern — new or modified UI component
|
|
97
|
+
|
|
98
|
+
## When to use
|
|
99
|
+
|
|
100
|
+
The user asks for "a button", "a modal", "a chart", "a settings screen", or any visual surface change.
|
|
101
|
+
|
|
102
|
+
## Pre-flight checklist
|
|
103
|
+
|
|
104
|
+
1. Find the design source: Figma link, screenshot, prior component. If there is none, ask the user before authoring.
|
|
105
|
+
2. Inspect the existing design system (\`tokens.css\` or equivalent) for colours, spacing, typography. New tokens require a separate decision.
|
|
106
|
+
3. Identify state machines: hover, focus, disabled, error, loading, empty.
|
|
107
|
+
4. Identify accessibility requirements: keyboard navigation, screen-reader labels, focus order, prefers-reduced-motion.
|
|
108
|
+
|
|
109
|
+
## AC shape
|
|
110
|
+
|
|
111
|
+
- AC-1: component renders all documented states with snapshot tests for each.
|
|
112
|
+
- AC-2: keyboard navigation works (focus order verified by test).
|
|
113
|
+
- AC-3 (when applicable): screen-reader names; verified by axe / similar snapshot.
|
|
114
|
+
- AC-4: integration into the parent surface(s) named in the plan.
|
|
115
|
+
|
|
116
|
+
## Specialists to invoke
|
|
117
|
+
|
|
118
|
+
- \`reviewer\` mode=\`code\` always.
|
|
119
|
+
- \`reviewer\` mode=\`text-review\` if the component carries user-facing copy that wasn't previously approved.
|
|
120
|
+
|
|
121
|
+
## Common pitfalls
|
|
122
|
+
|
|
123
|
+
- Writing the component without states the design covers but the user didn't mention.
|
|
124
|
+
- Adding a new design token because the existing one is "almost right". Use the existing one or open a separate slug for token work.
|
|
125
|
+
- Skipping the empty / error / loading states because they "rarely happen". They are AC.
|
|
126
|
+
`;
|
|
127
|
+
const PERF_FIX = `# Pattern — performance fix
|
|
128
|
+
|
|
129
|
+
## When to use
|
|
130
|
+
|
|
131
|
+
The user reports "slow page", "high CPU", "high memory", "p99 latency", "timeouts", or asks to "make X faster".
|
|
132
|
+
|
|
133
|
+
## Pre-flight checklist
|
|
134
|
+
|
|
135
|
+
1. Reproduce or accept a measurement. Performance fixes without a measurement are speculation. If no measurement exists, the first AC is "measurement reproducible in CI".
|
|
136
|
+
2. Identify the slow path: which function, query, render, etc. Cite \`file:path:line\`.
|
|
137
|
+
3. Identify the budget: what number constitutes "fast enough"?
|
|
138
|
+
|
|
139
|
+
## AC shape
|
|
140
|
+
|
|
141
|
+
- AC-1: measurement reproducible (test, microbenchmark, or profiling artifact under \`docs/perf/\`).
|
|
142
|
+
- AC-2: budget achieved on the same measurement; verified by re-running the benchmark.
|
|
143
|
+
- AC-3: regression guard — a CI check or alert that fails when the budget is exceeded again.
|
|
144
|
+
|
|
145
|
+
## Specialists to invoke
|
|
146
|
+
|
|
147
|
+
- \`architect\` mode=\`feasibility\` — if the fix changes data structure, query plan, or cache topology.
|
|
148
|
+
- \`reviewer\` mode=\`adversarial\` — actively look for the case where the fix is faster on the benchmark but slower in production.
|
|
149
|
+
|
|
150
|
+
## Common pitfalls
|
|
151
|
+
|
|
152
|
+
- Optimising the wrong path. Always profile or trace before changing code.
|
|
153
|
+
- Caching without a clear invalidation story. The invalidation rule itself is an AC.
|
|
154
|
+
- Removing a guarded \`O(n)\` path because "it's never used" without a deprecation window.
|
|
155
|
+
`;
|
|
156
|
+
const REFACTOR = `# Pattern — pure refactor (no behaviour change)
|
|
157
|
+
|
|
158
|
+
## When to use
|
|
159
|
+
|
|
160
|
+
The user asks to "clean up", "simplify", "unify", "split", "extract", "rename", with no observable behaviour change.
|
|
161
|
+
|
|
162
|
+
## Pre-flight checklist
|
|
163
|
+
|
|
164
|
+
1. Confirm the refactor is truly behaviour-preserving. If any user-visible change sneaks in, the request is a refactor + behaviour change and must be split.
|
|
165
|
+
2. Identify a behavioural pin: a test that passes before and after, or a snapshot that should not change.
|
|
166
|
+
|
|
167
|
+
## AC shape
|
|
168
|
+
|
|
169
|
+
- AC-1: behaviour pinned — explicit set of tests / snapshots / fixtures that pass with the same expected output before and after.
|
|
170
|
+
- AC-2: refactor applied — file:line references for every renamed / moved / extracted symbol.
|
|
171
|
+
- AC-3 (optional): metrics — file count, average function length, cyclomatic complexity — improving as recorded in the build log.
|
|
172
|
+
|
|
173
|
+
## Specialists to invoke
|
|
174
|
+
|
|
175
|
+
- \`reviewer\` mode=\`code\` always.
|
|
176
|
+
- \`reviewer\` mode=\`text-review\` if the refactor renames public exports referenced in docs.
|
|
177
|
+
|
|
178
|
+
## Common pitfalls
|
|
179
|
+
|
|
180
|
+
- Slipping a fix into the refactor commit. Split it into a separate AC.
|
|
181
|
+
- Renaming public APIs without a deprecation alias. Surface this back as breaking.
|
|
182
|
+
- Refactoring across many directories at once. Slice by directory or by symbol family; one slug per slice.
|
|
183
|
+
`;
|
|
184
|
+
const SECURITY_HARDENING = `# Pattern — security hardening
|
|
185
|
+
|
|
186
|
+
## When to use
|
|
187
|
+
|
|
188
|
+
The user asks to "harden", "fix CVE", "rotate keys", "tighten CSP", "patch SSRF", "fix prototype pollution", or follows an incident.
|
|
189
|
+
|
|
190
|
+
## Pre-flight checklist
|
|
191
|
+
|
|
192
|
+
1. Identify the threat the hardening prevents. Citing the CVE / advisory / incident note is mandatory.
|
|
193
|
+
2. Identify whether the change is reactive (close an open finding) or proactive (defence in depth). Tag the plan accordingly.
|
|
194
|
+
3. Confirm the rollout cannot itself break the system: a hardening that fails closed in production is worse than a slower fix.
|
|
195
|
+
|
|
196
|
+
## AC shape
|
|
197
|
+
|
|
198
|
+
- AC-1: the threat path is blocked; verified by a regression test that exercises the threat.
|
|
199
|
+
- AC-2: the regression guard runs in CI on every push.
|
|
200
|
+
- AC-3: documentation / runbook updated to reflect the new posture.
|
|
201
|
+
|
|
202
|
+
## Specialists to invoke
|
|
203
|
+
|
|
204
|
+
- \`security-reviewer\` mode=\`threat-model\` always.
|
|
205
|
+
- \`security-reviewer\` mode=\`sensitive-change\` on the diff.
|
|
206
|
+
- \`reviewer\` mode=\`adversarial\` — second pair of eyes on the regression test (does it actually exercise the threat?).
|
|
207
|
+
|
|
208
|
+
## Common pitfalls
|
|
209
|
+
|
|
210
|
+
- Closing the finding without the regression guard. Without the guard, the next refactor reopens it.
|
|
211
|
+
- Adding a deny-list when an allow-list would do.
|
|
212
|
+
- Using a string-matching guard for a structural problem (e.g. blocking SSRF by checking the URL string instead of resolving DNS first).
|
|
213
|
+
`;
|
|
214
|
+
const DOC_REWRITE = `# Pattern — documentation rewrite
|
|
215
|
+
|
|
216
|
+
## When to use
|
|
217
|
+
|
|
218
|
+
The user asks to "rewrite the README", "update docs", "fix the quickstart", "polish the changelog".
|
|
219
|
+
|
|
220
|
+
## Pre-flight checklist
|
|
221
|
+
|
|
222
|
+
1. Identify the intended audience for the doc. The audience determines what stays and what is cut.
|
|
223
|
+
2. Identify the constraints: tone of voice, length, must-include sections, what to drop.
|
|
224
|
+
3. Pull the canonical source for any claim the doc will make. The doc must not invent flags / endpoints / commands.
|
|
225
|
+
|
|
226
|
+
## AC shape
|
|
227
|
+
|
|
228
|
+
- AC-1: doc passes a manual smoke read-through (a small checklist verified by the author).
|
|
229
|
+
- AC-2: every code snippet in the doc compiles / runs against the current code (verified by a snapshot test or runnable example).
|
|
230
|
+
- AC-3 (when applicable): cross-doc links remain valid.
|
|
231
|
+
|
|
232
|
+
## Specialists to invoke
|
|
233
|
+
|
|
234
|
+
- \`reviewer\` mode=\`text-review\` always.
|
|
235
|
+
- \`reviewer\` mode=\`release\` if the doc is the user-facing release notes.
|
|
236
|
+
|
|
237
|
+
## Common pitfalls
|
|
238
|
+
|
|
239
|
+
- Mixing a doc rewrite with a code change. They are separate slugs.
|
|
240
|
+
- Promoting the doc rewrite into a "while we're here" refactor. Refuse, surface as a follow-up.
|
|
241
|
+
- Forgetting the changelog. If the rewrite changes any quickstart command, add a release-notes line.
|
|
242
|
+
`;
|
|
1
243
|
export const REFERENCE_PATTERNS = [
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
stage: "brainstorm",
|
|
11
|
-
guidance: [
|
|
12
|
-
"Capture discovered project context before asking approval questions.",
|
|
13
|
-
"Separate observed facts from assumptions and open blockers."
|
|
14
|
-
],
|
|
15
|
-
artifactSections: ["Context", "Discovered context"]
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
stage: "scope",
|
|
19
|
-
guidance: [
|
|
20
|
-
"Name which brainstorm decisions are fresh enough to carry forward.",
|
|
21
|
-
"If upstream decisions are stale or missing, stop for re-scope instead of inventing boundaries."
|
|
22
|
-
],
|
|
23
|
-
artifactSections: ["Upstream Handoff", "Scope Contract"]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
stage: "design",
|
|
27
|
-
guidance: [
|
|
28
|
-
"Read blast-radius code before locking architecture.",
|
|
29
|
-
"Use reference patterns as examples to adapt, not authority to copy."
|
|
30
|
-
],
|
|
31
|
-
artifactSections: ["Codebase Investigation", "Reference-Grade Contracts"]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
stage: "tdd",
|
|
35
|
-
guidance: [
|
|
36
|
-
"Discover tests and affected contracts before opening a RED vertical slice.",
|
|
37
|
-
"Map the slice to the active source item before editing production code."
|
|
38
|
-
],
|
|
39
|
-
artifactSections: ["Test Discovery", "System-Wide Impact Check", "Acceptance & Failure Map"]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
stage: "review",
|
|
43
|
-
guidance: [
|
|
44
|
-
"Review only after current diff, test evidence, and source-item coverage are known.",
|
|
45
|
-
"A no-finding verdict still needs inspected-surface evidence."
|
|
46
|
-
],
|
|
47
|
-
artifactSections: ["Review Evidence Scope", "Completeness Snapshot"]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
stage: "ship",
|
|
51
|
-
guidance: [
|
|
52
|
-
"Ship only after fresh preflight, rollback trigger, and finalization mode are explicit.",
|
|
53
|
-
"Treat stale review or missing rollback evidence as a blocker, not a concern."
|
|
54
|
-
],
|
|
55
|
-
artifactSections: ["Preflight Results", "Rollback Plan", "Finalization"]
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: "addy_reference_grade_contracts",
|
|
61
|
-
title: "Reference-Grade Contracts",
|
|
62
|
-
intent: "Promote good examples into explicit contracts: source, invariant, adaptation, rejection boundary, and verification signal.",
|
|
63
|
-
useWhen: "Brainstorm, scope, and design need reusable patterns without copying unrelated behavior.",
|
|
64
|
-
policyNeedles: ["Reference Pattern Registry", "Reference-Grade Contracts", "accepted/rejected reference ideas"],
|
|
65
|
-
contracts: [
|
|
66
|
-
{
|
|
67
|
-
stage: "brainstorm",
|
|
68
|
-
guidance: [
|
|
69
|
-
"Record which reference patterns informed each option and which were rejected.",
|
|
70
|
-
"A challenger must name the reference idea that makes it meaningfully higher-upside."
|
|
71
|
-
],
|
|
72
|
-
artifactSections: ["Reference Pattern Candidates", "Approaches"]
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
stage: "scope",
|
|
76
|
-
guidance: [
|
|
77
|
-
"Lock accepted, rejected, and deferred reference ideas as scope boundaries.",
|
|
78
|
-
"Do not let a reference expand scope unless the user explicitly opts in."
|
|
79
|
-
],
|
|
80
|
-
artifactSections: ["Reference Pattern Registry", "Scope Contract"]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
stage: "design",
|
|
84
|
-
guidance: [
|
|
85
|
-
"For every mirrored pattern, name source, invariant, adaptation, and verification evidence.",
|
|
86
|
-
"If a reference conflicts with local architecture, reject it and document the revival signal."
|
|
87
|
-
],
|
|
88
|
-
artifactSections: ["Reference-Grade Contracts", "Patterns to Mirror", "Rejected Alternatives"]
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: "evanflow_coder_overseer",
|
|
94
|
-
title: "Coder / Overseer Split",
|
|
95
|
-
intent: "Keep implementation and validation context isolated: coders edit bounded slices, overseers read only, and integration overseers validate shared touchpoints.",
|
|
96
|
-
useWhen: "TDD, review, and parallel worker orchestration need safe independent implementation with fresh verification.",
|
|
97
|
-
policyNeedles: ["coder/overseer", "integration overseer", "non-overlap checks"],
|
|
98
|
-
contracts: [
|
|
99
|
-
{
|
|
100
|
-
stage: "plan",
|
|
101
|
-
guidance: [
|
|
102
|
-
"Executable packets name file ownership, shared interfaces, expected failing test, passing command, and stop conditions.",
|
|
103
|
-
"Parallel writers are allowed only after non-overlap checks for files, shared interfaces, migrations/config, and baseline cleanliness."
|
|
104
|
-
],
|
|
105
|
-
artifactSections: ["Task List", "Dependency Batches", "Execution Posture"]
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
stage: "tdd",
|
|
109
|
-
guidance: [
|
|
110
|
-
"Coder edits only the assigned slice after RED evidence; read-only overseer validates spec fit and assertion quality.",
|
|
111
|
-
"When 3+ independent packets run, use an integration overseer for named touchpoints and integration tests."
|
|
112
|
-
],
|
|
113
|
-
artifactSections: ["Execution Posture", "Per-Slice Review", "Verification Ladder"]
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
stage: "review",
|
|
117
|
-
guidance: [
|
|
118
|
-
"Layered reviewers reconcile findings by source tag, confidence, owner, and verification requirement.",
|
|
119
|
-
"Do not accept implementer self-review as overseer evidence."
|
|
120
|
-
],
|
|
121
|
-
artifactSections: ["Review Evidence Scope", "Review Findings Contract"]
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: "superpowers_executable_packet",
|
|
127
|
-
title: "Executable Packet",
|
|
128
|
-
intent: "Plan tasks as self-contained packets with acceptance mapping, expected RED failure, GREEN command, allowed files, and stop conditions.",
|
|
129
|
-
useWhen: "Plan and TDD need work items a fresh agent can execute without hidden parent context.",
|
|
130
|
-
policyNeedles: ["executable packet", "expected failing test", "stop condition"],
|
|
131
|
-
contracts: [
|
|
132
|
-
{
|
|
133
|
-
stage: "plan",
|
|
134
|
-
guidance: [
|
|
135
|
-
"Each task is copy-paste ready for a worker and includes acceptance criteria, file boundaries, expected failing test, passing command, and stop conditions.",
|
|
136
|
-
"Tasks that depend on shared interfaces or migration/config files are serialized unless an integration contract exists."
|
|
137
|
-
],
|
|
138
|
-
artifactSections: ["Task List", "Dependency Batches", "Execution Posture"]
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
stage: "tdd",
|
|
142
|
-
guidance: [
|
|
143
|
-
"Open one packet as one vertical slice; do not mix unrelated packet evidence.",
|
|
144
|
-
"Close packet only when RED, GREEN, REFACTOR, and verification evidence align."
|
|
145
|
-
],
|
|
146
|
-
artifactSections: ["Acceptance & Failure Map", "RED Evidence", "GREEN Evidence", "REFACTOR Notes"]
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: "gstack_question_tuning",
|
|
152
|
-
title: "Question Tuning",
|
|
153
|
-
intent: "Ask only decision-changing questions, auto-assume low-risk two-way doors, and stop on one-way-door decisions.",
|
|
154
|
-
useWhen: "Brainstorm/scope/spec interactions could drift into broad interrogation instead of useful approval gates.",
|
|
155
|
-
policyNeedles: ["one decision-changing question", "two-way door", "one-way door"],
|
|
156
|
-
contracts: [
|
|
157
|
-
{
|
|
158
|
-
stage: "brainstorm",
|
|
159
|
-
guidance: [
|
|
160
|
-
"Ask one decision-changing question at a time and record impact only when it changes direction or blocks progress.",
|
|
161
|
-
"Continue on low-risk defaults; stop on scope, architecture, security, data loss, public API, migration, auth/pricing, or approval uncertainty."
|
|
162
|
-
],
|
|
163
|
-
artifactSections: ["Sharpening Questions", "Selected Direction"]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
stage: "scope",
|
|
167
|
-
guidance: [
|
|
168
|
-
"Present labeled scope moves with one recommendation; wait for user opt-in before treating a mode as selected.",
|
|
169
|
-
"Record what signal would change the recommendation."
|
|
170
|
-
],
|
|
171
|
-
artifactSections: ["Scope Mode", "Scope Contract"]
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
stage: "spec",
|
|
175
|
-
guidance: [
|
|
176
|
-
"Chunk acceptance criteria for approval and stop on assumptions with irreversible impact.",
|
|
177
|
-
"Rewrite vague criteria before asking the user to approve."
|
|
178
|
-
],
|
|
179
|
-
artifactSections: ["Acceptance Criteria", "Assumptions Before Finalization", "Approval"]
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: "evanflow_vertical_slice_tdd",
|
|
185
|
-
title: "Vertical-Slice TDD",
|
|
186
|
-
intent: "Execute behavior end-to-end in one reviewable slice instead of collecting unrelated test or implementation fragments.",
|
|
187
|
-
useWhen: "TDD and review need to prove a source item moved from RED to GREEN with traceable behavior evidence.",
|
|
188
|
-
policyNeedles: ["vertical slice", "RED vertical slice", "slice victory detector"],
|
|
189
|
-
contracts: [
|
|
190
|
-
{
|
|
191
|
-
stage: "tdd",
|
|
192
|
-
guidance: [
|
|
193
|
-
"One vertical slice is one source item plus one or more ACs, tests, implementation, refactor notes, and verification evidence.",
|
|
194
|
-
"Do not open a second vertical slice while RED evidence or regression repair remains open for the current slice."
|
|
195
|
-
],
|
|
196
|
-
artifactSections: ["Execution Posture", "RED Evidence", "GREEN Evidence", "Verification Ladder"]
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
stage: "review",
|
|
200
|
-
guidance: [
|
|
201
|
-
"Review source-item coverage by vertical slice, not by file count alone.",
|
|
202
|
-
"A slice is review-ready only when RED, GREEN, REFACTOR, and verification evidence all line up."
|
|
203
|
-
],
|
|
204
|
-
artifactSections: ["Completeness Snapshot", "Coverage Check"]
|
|
205
|
-
}
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: "superclaude_confidence_gates",
|
|
210
|
-
title: "Confidence Gates",
|
|
211
|
-
intent: "Require source verification before execution and a fresh self-check before completion claims.",
|
|
212
|
-
useWhen: "Stage work could proceed from memory, duplicate an existing implementation, or close with stale evidence.",
|
|
213
|
-
policyNeedles: ["pre-execution confidence", "post-implementation self-check", "source verification"],
|
|
214
|
-
contracts: [
|
|
215
|
-
{
|
|
216
|
-
stage: "design",
|
|
217
|
-
guidance: [
|
|
218
|
-
"Before locking architecture, verify duplicate implementation risk, architecture fit, docs/source truth, and root-cause confidence.",
|
|
219
|
-
"If confidence is low, stop for investigation instead of adding fallback layers."
|
|
220
|
-
],
|
|
221
|
-
artifactSections: ["Codebase Investigation", "Architecture Confidence"]
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
stage: "review",
|
|
225
|
-
guidance: [
|
|
226
|
-
"Review requirements met, assumptions verified, tests passing, and evidence freshness before any PASS verdict.",
|
|
227
|
-
"Separate verified facts from implementer claims."
|
|
228
|
-
],
|
|
229
|
-
artifactSections: ["Review Readiness Snapshot", "Final Verdict"]
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
id: "oh_my_worker_lifecycle",
|
|
235
|
-
title: "Worker Lifecycle Evidence",
|
|
236
|
-
intent: "Make asynchronous or delegated work inspectable through state, dispatch, evidence refs, and stale-worker handling.",
|
|
237
|
-
useWhen: "Stages schedule subagents, role-switch work, or generic dispatch and need auditable completion evidence.",
|
|
238
|
-
policyNeedles: ["dispatch lifecycle", "stale worker", "strict worker JSON schema"],
|
|
239
|
-
contracts: [
|
|
240
|
-
{
|
|
241
|
-
stage: "plan",
|
|
242
|
-
guidance: [
|
|
243
|
-
"Plan only bounded worker packets with clear file ownership, stop conditions, and evidence expectations.",
|
|
244
|
-
"Name any dispatch or concurrency governor before workers start."
|
|
245
|
-
],
|
|
246
|
-
artifactSections: ["Task List", "Dependency Batches", "Execution Posture"]
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
stage: "tdd",
|
|
250
|
-
guidance: [
|
|
251
|
-
"Every scheduled worker needs a terminal return with evidence refs or an explicit blocker route.",
|
|
252
|
-
"A stale worker blocks completion until resolved, failed, or structurally waived."
|
|
253
|
-
],
|
|
254
|
-
artifactSections: ["Execution Posture", "Verification Ladder", "Per-Slice Review"]
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
stage: "review",
|
|
258
|
-
guidance: [
|
|
259
|
-
"Synthesize reviewer returns by status, source tag, evidence refs, and unresolved blockers.",
|
|
260
|
-
"Do not treat missing worker output as a clean review."
|
|
261
|
-
],
|
|
262
|
-
artifactSections: ["Review Evidence Scope", "Review Findings Contract"]
|
|
263
|
-
}
|
|
264
|
-
]
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
id: "gsd_hard_stop_routing",
|
|
268
|
-
title: "Hard-Stop Routing",
|
|
269
|
-
intent: "Advance only when unresolved checkpoints, stale handoffs, and verification debt are cleared or routed explicitly.",
|
|
270
|
-
useWhen: "A stage wants to continue despite missing gates, stale rewind markers, or uncertain next command state.",
|
|
271
|
-
policyNeedles: ["hard-stop next routing", "goal-backward verification", "operator line"],
|
|
272
|
-
contracts: [
|
|
273
|
-
{
|
|
274
|
-
stage: "tdd",
|
|
275
|
-
guidance: [
|
|
276
|
-
"Start from the outcome that must be true, then verify source, tests, artifact wiring, and gate evidence from that goal backward.",
|
|
277
|
-
"If source/test preflight blocks execution, route to the managed blocker taxonomy instead of fabricating RED evidence."
|
|
278
|
-
],
|
|
279
|
-
artifactSections: ["TDD Blocker Taxonomy", "Verification Ladder"]
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
stage: "ship",
|
|
283
|
-
guidance: [
|
|
284
|
-
"Block ship on unresolved checkpoints, stale handoffs, or verification debt.",
|
|
285
|
-
"Report the compact operator line: stage, scope, validation issues, recovery state, and next action."
|
|
286
|
-
],
|
|
287
|
-
artifactSections: ["Preflight Results", "Completion Status", "Handoff"]
|
|
288
|
-
}
|
|
289
|
-
]
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
id: "everyinc_delegation_preflight",
|
|
293
|
-
title: "Delegation Preflight",
|
|
294
|
-
intent: "Use delegation only when support, consent, baseline, non-overlap, batch size, and fallback mode are known.",
|
|
295
|
-
useWhen: "A controller is about to fan out implementation or review work across multiple specialists.",
|
|
296
|
-
policyNeedles: ["delegation preflight", "non-overlapping files", "layered review synthesis"],
|
|
297
|
-
contracts: [
|
|
298
|
-
{
|
|
299
|
-
stage: "plan",
|
|
300
|
-
guidance: [
|
|
301
|
-
"Before parallel writers, verify support, user consent when needed, baseline cleanliness, non-overlapping files, batch size, and fallback mode.",
|
|
302
|
-
"Shared interfaces, migrations, config, and generated surfaces need an integration contract or serial execution."
|
|
303
|
-
],
|
|
304
|
-
artifactSections: ["Dependency Batches", "Execution Posture"]
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
stage: "review",
|
|
308
|
-
guidance: [
|
|
309
|
-
"Dedupe layered reviewer findings with confidence, owner, and verification requirement.",
|
|
310
|
-
"Keep user-facing synthesis separate from raw worker returns."
|
|
311
|
-
],
|
|
312
|
-
artifactSections: ["Layered Review Synthesis", "Review Findings Contract"]
|
|
313
|
-
}
|
|
314
|
-
]
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
id: "ecc_worktree_control_plane",
|
|
318
|
-
title: "Worktree Control Plane",
|
|
319
|
-
intent: "Treat isolated worker state, handoff files, and orchestration snapshots as recoverable control-plane data rather than chat memory.",
|
|
320
|
-
useWhen: "Parallel or resumable work needs clear seed paths, state files, handoffs, and cleanup visibility.",
|
|
321
|
-
policyNeedles: ["worktree control plane", "handoff files", "orchestration snapshot"],
|
|
322
|
-
contracts: [
|
|
323
|
-
{
|
|
324
|
-
stage: "plan",
|
|
325
|
-
guidance: [
|
|
326
|
-
"Name seed paths, worker handoff expectations, and integration touchpoints before isolated work begins.",
|
|
327
|
-
"Cap ad-hoc teams and require agreement/conflict synthesis for any multi-agent result."
|
|
328
|
-
],
|
|
329
|
-
artifactSections: ["Task List", "Dependency Batches", "Execution Posture"]
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
stage: "ship",
|
|
333
|
-
guidance: [
|
|
334
|
-
"Confirm handoffs, cleanup, and orchestration state are captured before archive or closeout.",
|
|
335
|
-
"Do not rely on chat transcript alone for recoverability."
|
|
336
|
-
],
|
|
337
|
-
artifactSections: ["Handoff", "Completion Status"]
|
|
338
|
-
}
|
|
339
|
-
]
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
id: "walkinglabs_victory_detector",
|
|
343
|
-
title: "Iterate / Victory Detector",
|
|
344
|
-
intent: "Iterate while evidence is missing; stop only when the stage-specific victory detector is satisfied or a real blocker is named.",
|
|
345
|
-
useWhen: "Content-only closeout wording for review and ship readiness.",
|
|
346
|
-
policyNeedles: ["Victory Detector", "iterate until evidence", "fresh evidence"],
|
|
347
|
-
contracts: [
|
|
348
|
-
{
|
|
349
|
-
stage: "review",
|
|
350
|
-
guidance: [
|
|
351
|
-
"Victory Detector: Layer 1, Layer 2, security sweep, structured findings, and acceptance/reproduction coverage evidence are complete with no unresolved criticals unless verdict is BLOCKED.",
|
|
352
|
-
"If the detector fails, iterate findings or route back to TDD; do not say LGTM."
|
|
353
|
-
],
|
|
354
|
-
artifactSections: ["Review Readiness Snapshot", "Final Verdict"]
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
stage: "ship",
|
|
358
|
-
guidance: [
|
|
359
|
-
"Victory Detector: valid review verdict, fresh preflight, rollback trigger/steps, selected finalization enum, and execution result are present.",
|
|
360
|
-
"If any detector field is stale or missing, keep status BLOCKED."
|
|
361
|
-
],
|
|
362
|
-
artifactSections: ["Preflight Results", "Rollback Plan", "Finalization", "Completion Status"]
|
|
363
|
-
}
|
|
364
|
-
]
|
|
365
|
-
}
|
|
244
|
+
{ id: "api-endpoint", fileName: "api-endpoint.md", title: "API endpoint", triggers: ["new endpoint", "route", "API", "REST", "GraphQL"], body: API_ENDPOINT },
|
|
245
|
+
{ id: "auth-flow", fileName: "auth-flow.md", title: "Authentication flow", triggers: ["login", "OAuth", "SSO", "MFA", "passkey", "auth"], body: AUTH_FLOW },
|
|
246
|
+
{ id: "schema-migration", fileName: "schema-migration.md", title: "Schema migration", triggers: ["migration", "schema", "alter table", "column"], body: SCHEMA_MIGRATION },
|
|
247
|
+
{ id: "ui-component", fileName: "ui-component.md", title: "UI component", triggers: ["component", "button", "modal", "screen", "design"], body: UI_COMPONENT },
|
|
248
|
+
{ id: "perf-fix", fileName: "perf-fix.md", title: "Performance fix", triggers: ["slow", "perf", "latency", "p99", "memory"], body: PERF_FIX },
|
|
249
|
+
{ id: "refactor", fileName: "refactor.md", title: "Pure refactor", triggers: ["refactor", "cleanup", "rename", "extract"], body: REFACTOR },
|
|
250
|
+
{ id: "security-hardening", fileName: "security-hardening.md", title: "Security hardening", triggers: ["CVE", "security", "harden", "patch", "SSRF", "XSS"], body: SECURITY_HARDENING },
|
|
251
|
+
{ id: "doc-rewrite", fileName: "doc-rewrite.md", title: "Documentation rewrite", triggers: ["docs", "README", "quickstart", "changelog"], body: DOC_REWRITE }
|
|
366
252
|
];
|
|
367
|
-
export
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
})));
|
|
378
|
-
}
|
|
379
|
-
export function referencePatternPolicyNeedles(stage) {
|
|
380
|
-
const needles = [];
|
|
381
|
-
const seen = new Set();
|
|
382
|
-
for (const pattern of referencePatternsForStage(stage)) {
|
|
383
|
-
for (const needle of pattern.policyNeedles) {
|
|
384
|
-
if (seen.has(needle))
|
|
385
|
-
continue;
|
|
386
|
-
seen.add(needle);
|
|
387
|
-
needles.push(needle);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return needles;
|
|
391
|
-
}
|
|
253
|
+
export const REFERENCE_PATTERNS_INDEX = `# .cclaw/lib/patterns/
|
|
254
|
+
|
|
255
|
+
Eight reference patterns the orchestrator pulls from before authoring a plan. Each pattern declares its trigger keywords, the pre-flight checklist, the AC shape, the specialists to invoke, and the common pitfalls.
|
|
256
|
+
|
|
257
|
+
| pattern | triggers |
|
|
258
|
+
| --- | --- |
|
|
259
|
+
${REFERENCE_PATTERNS.map((p) => `| [\`${p.fileName}\`](./${p.fileName}) | ${p.triggers.join(", ")} |`).join("\n")}
|
|
260
|
+
|
|
261
|
+
When a task hits more than one pattern (e.g. an endpoint that is also security-sensitive), the orchestrator opens both files and merges their AC shape sections.
|
|
262
|
+
`;
|