cclaw-cli 0.1.0 → 0.2.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 +28 -0
- package/dist/artifact-linter.d.ts +20 -0
- package/dist/artifact-linter.js +368 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +22 -5
- package/dist/config.d.ts +4 -4
- package/dist/config.js +55 -3
- package/dist/constants.d.ts +4 -4
- package/dist/constants.js +6 -3
- package/dist/content/autoplan.js +51 -4
- package/dist/content/contexts.d.ts +9 -0
- package/dist/content/contexts.js +65 -0
- package/dist/content/hooks.d.ts +6 -2
- package/dist/content/hooks.js +448 -16
- package/dist/content/meta-skill.js +26 -0
- package/dist/content/next-command.d.ts +9 -0
- package/dist/content/next-command.js +138 -0
- package/dist/content/observe.d.ts +5 -1
- package/dist/content/observe.js +506 -24
- package/dist/content/skills.js +126 -0
- package/dist/content/stage-schema.d.ts +7 -0
- package/dist/content/stage-schema.js +70 -12
- package/dist/content/subagents.js +33 -0
- package/dist/content/templates.d.ts +1 -0
- package/dist/content/templates.js +182 -77
- package/dist/content/utility-skills.d.ts +5 -1
- package/dist/content/utility-skills.js +208 -2
- package/dist/delegation.d.ts +21 -0
- package/dist/delegation.js +94 -0
- package/dist/doctor.d.ts +5 -1
- package/dist/doctor.js +274 -29
- package/dist/fs-utils.d.ts +10 -0
- package/dist/fs-utils.js +47 -0
- package/dist/gate-evidence.d.ts +26 -0
- package/dist/gate-evidence.js +157 -0
- package/dist/harness-adapters.js +10 -26
- package/dist/hook-schema.d.ts +6 -0
- package/dist/hook-schema.js +45 -0
- package/dist/hook-schemas/claude-hooks.v1.json +12 -0
- package/dist/hook-schemas/codex-hooks.v1.json +12 -0
- package/dist/hook-schemas/cursor-hooks.v1.json +15 -0
- package/dist/install.js +395 -15
- package/dist/policy.d.ts +5 -1
- package/dist/policy.js +52 -1
- package/dist/runs.js +8 -3
- package/dist/trace-matrix.d.ts +13 -0
- package/dist/trace-matrix.js +182 -0
- package/dist/types.d.ts +11 -1
- package/package.json +2 -1
package/dist/content/autoplan.js
CHANGED
|
@@ -68,10 +68,17 @@ This skill describes **what the agent must do when invoked as \`/cc-autoplan\`**
|
|
|
68
68
|
### Phase 2 — Scope (always runs)
|
|
69
69
|
|
|
70
70
|
- Follow \`.cclaw/skills/scope-shaping/SKILL.md\` at **full depth**.
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
73
|
-
- **
|
|
71
|
+
- **Run scope-mode heuristics** (see dedicated section below), then select exactly one:
|
|
72
|
+
- **SCOPE_EXPANSION** (dream big)
|
|
73
|
+
- **SELECTIVE_EXPANSION** (hold core scope, cherry-pick high-value expansions)
|
|
74
|
+
- **HOLD** (maximum rigor on requested scope)
|
|
75
|
+
- **SCOPE_REDUCTION** (strip to essentials)
|
|
76
|
+
- **Default recommendation (before scoring):**
|
|
77
|
+
- Greenfield/product-bet starts at **SELECTIVE_EXPANSION**.
|
|
78
|
+
- Enhancement/bugfix starts at **HOLD**.
|
|
79
|
+
- If predicted blast radius is **>15 files** or introduces new infra under tight constraints, bias toward **SCOPE_REDUCTION**.
|
|
74
80
|
- **Auto-answer** scope boundary questions when they are **mechanical** or **taste** (never user challenges).
|
|
81
|
+
- **Surface requirement:** write a **Scope Mode Heuristics** table and final selected mode rationale in \`02-scope.md\`.
|
|
75
82
|
- **Artifact:** \`.cclaw/artifacts/02-scope.md\`
|
|
76
83
|
|
|
77
84
|
### Phase 3 — Design (always runs)
|
|
@@ -151,6 +158,34 @@ Present a **structured summary** to the user and **do not proceed** to implement
|
|
|
151
158
|
- cost if the agent is wrong
|
|
152
159
|
- **Gate:** Wait for explicit user resolution before treating that thread as decided.
|
|
153
160
|
|
|
161
|
+
## Scope Mode Heuristics (Phase 2)
|
|
162
|
+
|
|
163
|
+
Score each signal as **+1** (expansion bias), **0** (neutral), or **-1** (contraction bias), then total.
|
|
164
|
+
Record the scoring table in \`.cclaw/artifacts/02-scope.md\`.
|
|
165
|
+
|
|
166
|
+
| Signal | +1 Expansion Bias | 0 Neutral | -1 Contraction Bias |
|
|
167
|
+
|---|---|---|---|
|
|
168
|
+
| Product novelty | Net-new workflow/subsystem | Moderate feature extension | Bugfix or narrow patch |
|
|
169
|
+
| User value upside | Material step-function in UX/DX/business value | Incremental improvement | Marginal gain only |
|
|
170
|
+
| Blast radius | Limited, coherent module set | Mixed | Wide cross-cutting changes |
|
|
171
|
+
| Delivery risk | Low dependency and integration risk | Moderate | High regression or unknown coupling |
|
|
172
|
+
| Time/constraint pressure | Flexible timeline | Manageable | Tight deadline or strict compliance window |
|
|
173
|
+
| Operability burden | Existing observability/release path supports growth | Partial readiness | Missing guardrails; expansion would outpace controls |
|
|
174
|
+
|
|
175
|
+
**Mode recommendation by score:**
|
|
176
|
+
- **+3 or higher:** recommend **SCOPE_EXPANSION**
|
|
177
|
+
- **+1 to +2:** recommend **SELECTIVE_EXPANSION**
|
|
178
|
+
- **0 to -2:** recommend **HOLD**
|
|
179
|
+
- **-3 or lower:** recommend **SCOPE_REDUCTION**
|
|
180
|
+
|
|
181
|
+
**Override heuristics (higher priority):**
|
|
182
|
+
- If user asks for immediate bugfix/hotfix with reliability urgency, floor mode at **HOLD**.
|
|
183
|
+
- If expansion requires new infra/service boundaries without prior operational readiness, prefer **SCOPE_REDUCTION** or **HOLD**.
|
|
184
|
+
- If user explicitly requests an ambitious bet and constraints are flexible, allow **SCOPE_EXPANSION** even when score is borderline (must log risk assumptions).
|
|
185
|
+
|
|
186
|
+
**Surfacing rule:**
|
|
187
|
+
- Final Approval Gate must include: selected mode, score summary, and top 2 signals that drove the choice.
|
|
188
|
+
|
|
154
189
|
## Decision Audit Trail (running table)
|
|
155
190
|
|
|
156
191
|
After **each** auto-decision (mechanical or taste), append a row to the running table stored in \`.cclaw/artifacts/05-plan.md\` (create the table if missing):
|
|
@@ -235,7 +270,7 @@ Run **brainstorm → scope → design → spec → plan** as a single orchestrat
|
|
|
235
270
|
|
|
236
271
|
1. **Phase 0 — Intake:** restore point + context scan + UI/DX scope flags + read all five stage skills.
|
|
237
272
|
2. **Phase 1 — Brainstorm:** full \`brainstorming\` skill depth → \`.cclaw/artifacts/01-brainstorm.md\`.
|
|
238
|
-
3. **Phase 2 — Scope:** full \`scope-shaping\` skill depth (
|
|
273
|
+
3. **Phase 2 — Scope:** full \`scope-shaping\` skill depth + scope-mode heuristic scoring (EXPANSION / SELECTIVE / HOLD / REDUCTION) → \`02-scope.md\`.
|
|
239
274
|
4. **Phase 3 — Design:** full \`engineering-design-lock\` skill depth; all review sections evaluated → \`03-design.md\`.
|
|
240
275
|
5. **Phase 4 — Spec:** full \`specification-authoring\` skill depth → \`04-spec.md\`.
|
|
241
276
|
6. **Phase 5 — Plan:** full \`planning-and-task-breakdown\` skill depth; maintain audit trail table → \`05-plan.md\`.
|
|
@@ -258,6 +293,17 @@ Run **brainstorm → scope → design → spec → plan** as a single orchestrat
|
|
|
258
293
|
- **Taste:** reasonable disagreement → auto-decide with recommendation + **audit log row** + **surface at gate** with **one-line rejected-alternative impact**.
|
|
259
294
|
- **User Challenge:** agent recommends changing user direction → **never** auto-decide; present evidence + costs; await user.
|
|
260
295
|
|
|
296
|
+
## Scope Mode Heuristics (Phase 2)
|
|
297
|
+
|
|
298
|
+
- Score six scope signals (+1 / 0 / -1): novelty, value upside, blast radius, delivery risk, time pressure, operability burden.
|
|
299
|
+
- Map total score to recommendation:
|
|
300
|
+
- **+3+** → **SCOPE_EXPANSION**
|
|
301
|
+
- **+1..+2** → **SELECTIVE_EXPANSION**
|
|
302
|
+
- **0..-2** → **HOLD**
|
|
303
|
+
- **-3-** → **SCOPE_REDUCTION**
|
|
304
|
+
- Apply overrides: urgent bugfixes floor at **HOLD**; high-risk infra expansion biases **HOLD/REDUCTION**.
|
|
305
|
+
- Persist scoring + selected mode in \`02-scope.md\`, then surface it again in the Final Approval Gate summary.
|
|
306
|
+
|
|
261
307
|
## Final Approval Gate (options A-E)
|
|
262
308
|
|
|
263
309
|
- **(A) Approve as-is**
|
|
@@ -288,6 +334,7 @@ export function autoplanAgentsMdBlock() {
|
|
|
288
334
|
|
|
289
335
|
Use \`/cc-autoplan\` to run brainstorm→scope→design→spec→plan in one shot with auto-decisions.
|
|
290
336
|
- Mechanical questions are auto-answered using 6 principles
|
|
337
|
+
- Scope mode (EXPANSION / SELECTIVE / HOLD / REDUCTION) is selected via explicit heuristic scoring in Phase 2
|
|
291
338
|
- Taste decisions are auto-answered but surfaced at a single final approval gate
|
|
292
339
|
- User challenges are NEVER auto-answered
|
|
293
340
|
- Restore point is created before any work begins
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DEFAULT_CONTEXT_MODE = "default";
|
|
2
|
+
export declare const CONTEXT_MODES: Record<string, string>;
|
|
3
|
+
export declare function contextModeFiles(): Record<string, string>;
|
|
4
|
+
export interface ContextModeState {
|
|
5
|
+
activeMode: string;
|
|
6
|
+
updatedAt: string;
|
|
7
|
+
availableModes: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function createInitialContextModeState(nowIso?: string): ContextModeState;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const DEFAULT_CONTEXT_MODE = "default";
|
|
2
|
+
export const CONTEXT_MODES = {
|
|
3
|
+
default: `# Context Mode: default
|
|
4
|
+
|
|
5
|
+
Use for most day-to-day feature work.
|
|
6
|
+
|
|
7
|
+
## Focus
|
|
8
|
+
- Follow the active cclaw stage strictly.
|
|
9
|
+
- Keep changes within the current task blast radius.
|
|
10
|
+
- Prefer incremental progress with frequent verification.
|
|
11
|
+
|
|
12
|
+
## Decision posture
|
|
13
|
+
- Escalate only meaningful trade-offs.
|
|
14
|
+
- Ask for user confirmation only at explicit stage gates.
|
|
15
|
+
`,
|
|
16
|
+
execution: `# Context Mode: execution
|
|
17
|
+
|
|
18
|
+
Use when plan/spec are approved and the goal is high-throughput delivery.
|
|
19
|
+
|
|
20
|
+
## Focus
|
|
21
|
+
- Prioritize deterministic implementation flow (RED -> GREEN -> REFACTOR).
|
|
22
|
+
- Minimize conversational overhead; keep updates concise and evidence-first.
|
|
23
|
+
- Batch machine-only checks through subagent dispatch where supported.
|
|
24
|
+
|
|
25
|
+
## Decision posture
|
|
26
|
+
- Avoid reopening settled design debates unless a blocker appears.
|
|
27
|
+
- Stop immediately on failing quality gates or unresolved critical findings.
|
|
28
|
+
`,
|
|
29
|
+
review: `# Context Mode: review
|
|
30
|
+
|
|
31
|
+
Use for deep validation, risk discovery, and merge readiness.
|
|
32
|
+
|
|
33
|
+
## Focus
|
|
34
|
+
- Bias toward finding concrete defects, regressions, and evidence gaps.
|
|
35
|
+
- Cross-check spec, plan, tests, and implementation alignment.
|
|
36
|
+
- Treat unsupported claims as unverified until backed by command output.
|
|
37
|
+
|
|
38
|
+
## Decision posture
|
|
39
|
+
- Classify findings by severity and expected blast radius.
|
|
40
|
+
- Block ship decisions when critical issues remain unresolved.
|
|
41
|
+
`,
|
|
42
|
+
incident: `# Context Mode: incident
|
|
43
|
+
|
|
44
|
+
Use for production failures, emergency regressions, or urgent stabilization.
|
|
45
|
+
|
|
46
|
+
## Focus
|
|
47
|
+
- Reproduce first, then isolate, then fix.
|
|
48
|
+
- Favor smallest safe change with rollback clarity.
|
|
49
|
+
- Preserve timeline and evidence for post-incident learning.
|
|
50
|
+
|
|
51
|
+
## Decision posture
|
|
52
|
+
- Prefer containment over optimization.
|
|
53
|
+
- Require explicit evidence for declaring recovery complete.
|
|
54
|
+
`
|
|
55
|
+
};
|
|
56
|
+
export function contextModeFiles() {
|
|
57
|
+
return { ...CONTEXT_MODES };
|
|
58
|
+
}
|
|
59
|
+
export function createInitialContextModeState(nowIso = new Date().toISOString()) {
|
|
60
|
+
return {
|
|
61
|
+
activeMode: DEFAULT_CONTEXT_MODE,
|
|
62
|
+
updatedAt: nowIso,
|
|
63
|
+
availableModes: Object.keys(CONTEXT_MODES)
|
|
64
|
+
};
|
|
65
|
+
}
|
package/dist/content/hooks.d.ts
CHANGED
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
* Stop: writes checkpoint.json and reminds about flow consistency.
|
|
6
6
|
* PreToolUse/PostToolUse and summarize chain are generated in observe.ts.
|
|
7
7
|
*/
|
|
8
|
+
export interface HookRuntimeOptions {
|
|
9
|
+
globalLearningsEnabled?: boolean;
|
|
10
|
+
globalLearningsPath?: string;
|
|
11
|
+
}
|
|
8
12
|
/** Shared bash preamble for generated hook scripts. */
|
|
9
13
|
export declare const RUNTIME_SHELL_DETECT_ROOT = "HARNESS=\"codex\"\nif [ -n \"${CLAUDE_PROJECT_DIR:-}\" ]; then\n HARNESS=\"claude\"\nelif [ -n \"${CURSOR_PROJECT_DIR:-}\" ] || [ -n \"${CURSOR_PROJECT_ROOT:-}\" ]; then\n HARNESS=\"cursor\"\nelif [ -n \"${OPENCODE_PROJECT_DIR:-}\" ] || [ -n \"${OPENCODE_PROJECT_ROOT:-}\" ]; then\n HARNESS=\"opencode\"\nfi\n\nROOT=\"\"\nfor candidate in \"${CCLAW_PROJECT_ROOT:-}\" \"${CLAUDE_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_ROOT:-}\" \"${OPENCODE_PROJECT_DIR:-}\" \"${OPENCODE_PROJECT_ROOT:-}\" \"${PWD:-}\"; do\n if [ -n \"$candidate\" ] && [ -d \"$candidate/.cclaw\" ]; then\n ROOT=\"$candidate\"\n break\n fi\ndone\nif [ -z \"$ROOT\" ]; then\n ROOT=\"${CCLAW_PROJECT_ROOT:-${CLAUDE_PROJECT_DIR:-${CURSOR_PROJECT_DIR:-${CURSOR_PROJECT_ROOT:-${OPENCODE_PROJECT_DIR:-${OPENCODE_PROJECT_ROOT:-${PWD}}}}}}}\"\nfi";
|
|
10
|
-
export declare function sessionStartScript(): string;
|
|
14
|
+
export declare function sessionStartScript(options?: HookRuntimeOptions): string;
|
|
11
15
|
export declare function stopCheckpointScript(): string;
|
|
12
16
|
export { claudeHooksJsonWithObservation as claudeHooksJson } from "./observe.js";
|
|
13
17
|
export { cursorHooksJsonWithObservation as cursorHooksJson } from "./observe.js";
|
|
14
18
|
export { codexHooksJsonWithObservation as codexHooksJson } from "./observe.js";
|
|
15
|
-
export declare function opencodePluginJs(): string;
|
|
19
|
+
export declare function opencodePluginJs(options?: HookRuntimeOptions): string;
|
|
16
20
|
export declare function hooksAgentsMdBlock(): string;
|