cclaw-cli 0.48.26 → 0.48.27

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.
@@ -1,6 +1,6 @@
1
1
  import type { FlowStage, FlowTrack, TransitionRule } from "../types.js";
2
- import type { StageAutoSubagentDispatch, StageSchema } from "./stages/schema-types.js";
3
- export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageAutoSubagentDispatch, StageGate, StageSchema, StageSchemaInput } from "./stages/schema-types.js";
2
+ import type { StageComplexityTier, StageAutoSubagentDispatch, StageSchema } from "./stages/schema-types.js";
3
+ export type { ArtifactValidation, CrossStageTrace, ReviewSection, StageComplexityTier, StageExecutionModel, StagePhilosophy, StageArtifactRules, StageReviewLens, StageAutoSubagentDispatch, StageGate, StageSchema, StageSchemaInput } from "./stages/schema-types.js";
4
4
  export declare const SKILL_ENVELOPE_KINDS: readonly ["stage-output", "gate-result", "delegation-record"];
5
5
  export type SkillEnvelopeKind = (typeof SKILL_ENVELOPE_KINDS)[number];
6
6
  export interface SkillEnvelope {
@@ -18,7 +18,7 @@ export interface SkillEnvelopeValidation {
18
18
  export declare function validateSkillEnvelope(value: unknown): SkillEnvelopeValidation;
19
19
  export declare function parseSkillEnvelope(raw: string): SkillEnvelope | null;
20
20
  /** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
21
- export declare function mandatoryDelegationsForStage(stage: FlowStage): string[];
21
+ export declare function mandatoryDelegationsForStage(stage: FlowStage, complexityTier?: StageComplexityTier): string[];
22
22
  export declare function stageSchema(stage: FlowStage, track?: FlowTrack): StageSchema;
23
23
  export declare function orderedStageSchemas(track?: FlowTrack): StageSchema[];
24
24
  export declare function stageGateIds(stage: FlowStage, track?: FlowTrack): string[];
@@ -15,6 +15,11 @@ export const SKILL_ENVELOPE_KINDS = [
15
15
  ];
16
16
  const FLOW_STAGE_SET = new Set(FLOW_STAGES);
17
17
  const SKILL_ENVELOPE_KIND_SET = new Set(SKILL_ENVELOPE_KINDS);
18
+ const COMPLEXITY_TIER_ORDER = {
19
+ lightweight: 0,
20
+ standard: 1,
21
+ deep: 2
22
+ };
18
23
  function asRecord(value) {
19
24
  if (!value || typeof value !== "object" || Array.isArray(value)) {
20
25
  return null;
@@ -200,6 +205,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
200
205
  {
201
206
  agent: "planner",
202
207
  mode: "mandatory",
208
+ requiredAtTier: "standard",
203
209
  when: "Always during scope shaping.",
204
210
  purpose: "Challenge premise, map alternatives, and produce explicit in/out contract.",
205
211
  requiresUserGate: false
@@ -209,6 +215,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
209
215
  {
210
216
  agent: "planner",
211
217
  mode: "mandatory",
218
+ requiredAtTier: "standard",
212
219
  when: "Always during design lock.",
213
220
  purpose: "Stress architecture boundaries and dependency graph.",
214
221
  requiresUserGate: false
@@ -241,6 +248,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
241
248
  {
242
249
  agent: "planner",
243
250
  mode: "mandatory",
251
+ requiredAtTier: "standard",
244
252
  when: "Always when producing execution slices.",
245
253
  purpose: "Create dependency-aware task graph with verification steps.",
246
254
  requiresUserGate: false
@@ -250,6 +258,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
250
258
  {
251
259
  agent: "test-author",
252
260
  mode: "mandatory",
261
+ requiredAtTier: "lightweight",
253
262
  when: "Always during TDD cycle (RED phase).",
254
263
  purpose: "Produce failing RED tests only; no production writes.",
255
264
  requiresUserGate: false,
@@ -258,6 +267,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
258
267
  {
259
268
  agent: "test-author",
260
269
  mode: "mandatory",
270
+ requiredAtTier: "lightweight",
261
271
  when: "Always during TDD cycle (GREEN phase).",
262
272
  purpose: "Implement minimum production changes to satisfy RED and prove full-suite GREEN.",
263
273
  requiresUserGate: false,
@@ -266,6 +276,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
266
276
  {
267
277
  agent: "test-author",
268
278
  mode: "mandatory",
279
+ requiredAtTier: "lightweight",
269
280
  when: "Always during TDD cycle (REFACTOR phase).",
270
281
  purpose: "Refactor only after GREEN proof, preserving behavior and test pass state.",
271
282
  requiresUserGate: false,
@@ -283,6 +294,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
283
294
  {
284
295
  agent: "reviewer",
285
296
  mode: "mandatory",
297
+ requiredAtTier: "lightweight",
286
298
  when: "Always in review stage.",
287
299
  purpose: "Layer 1 spec compliance pass plus coordination of parallel Layer 2 fan-out (correctness, performance, architecture, external-safety) with source-tagged findings.",
288
300
  requiresUserGate: false,
@@ -291,6 +303,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
291
303
  {
292
304
  agent: "security-reviewer",
293
305
  mode: "mandatory",
306
+ requiredAtTier: "lightweight",
294
307
  when: "Always in review stage. Even when no trust boundaries changed, produce an explicit 'no-change' security attestation.",
295
308
  purpose: "Guarantee a dedicated security pass on every diff: auth, input validation, secrets, injection, privilege, and blast-radius review are never opt-in. MUST load the `security-audit` skill and run a pattern-based sweep across the diff scope and touched modules in addition to the per-diff Layer 2 security checklist.",
296
309
  requiresUserGate: false,
@@ -299,6 +312,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
299
312
  {
300
313
  agent: "reviewer",
301
314
  mode: "mandatory",
315
+ requiredAtTier: "lightweight",
302
316
  when: "Mandatory when the diff exceeds 100 changed lines, touches more than 10 files, or modifies trust boundaries — dispatch a SECOND, independent reviewer with the adversarial-review skill loaded so the review army has at least two voices on a high-blast-radius change.",
303
317
  purpose: "Adversarial second-opinion review on large or trust-sensitive diffs. The second reviewer treats the implementation as hostile and tries to break it (hostile-user, future-maintainer, competitor lenses) instead of sympathetically explaining it.",
304
318
  requiresUserGate: false,
@@ -317,6 +331,7 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
317
331
  {
318
332
  agent: "doc-updater",
319
333
  mode: "mandatory",
334
+ requiredAtTier: "lightweight",
320
335
  when: "Always in ship stage.",
321
336
  purpose: "Ensure release notes and docs reflect actual shipped behavior.",
322
337
  requiresUserGate: false
@@ -331,9 +346,14 @@ const STAGE_AUTO_SUBAGENT_DISPATCH = {
331
346
  ]
332
347
  };
333
348
  /** Transition guard: agents with `mode: "mandatory"` in auto-subagent dispatch for this stage. */
334
- export function mandatoryDelegationsForStage(stage) {
349
+ export function mandatoryDelegationsForStage(stage, complexityTier = "standard") {
350
+ const currentTierRank = COMPLEXITY_TIER_ORDER[complexityTier];
335
351
  return [...new Set(STAGE_AUTO_SUBAGENT_DISPATCH[stage]
336
352
  .filter((d) => d.mode === "mandatory")
353
+ .filter((d) => {
354
+ const requiredAt = d.requiredAtTier ?? "standard";
355
+ return currentTierRank >= COMPLEXITY_TIER_ORDER[requiredAt];
356
+ })
337
357
  .map((d) => d.agent))];
338
358
  }
339
359
  export function stageSchema(stage, track = "standard") {
@@ -344,13 +364,54 @@ export function stageSchema(stage, track = "standard") {
344
364
  ...base.crossStageTrace,
345
365
  readsFrom: readsFromForTrack(base.crossStageTrace.readsFrom, track)
346
366
  };
367
+ const complexityTier = base.complexityTier ?? "standard";
368
+ const mandatoryDelegations = mandatoryDelegationsForStage(stage, complexityTier);
369
+ const philosophy = {
370
+ hardGate: base.hardGate,
371
+ ironLaw: base.ironLaw,
372
+ purpose: base.purpose,
373
+ whenToUse: base.whenToUse,
374
+ whenNotToUse: base.whenNotToUse,
375
+ commonRationalizations: base.commonRationalizations
376
+ };
377
+ const executionModel = {
378
+ interactionProtocol: base.interactionProtocol,
379
+ process: base.process,
380
+ checklist: base.checklist,
381
+ requiredGates: tieredGates,
382
+ requiredEvidence: base.requiredEvidence,
383
+ inputs: base.inputs,
384
+ requiredContext: base.requiredContext,
385
+ researchPlaybooks: base.researchPlaybooks,
386
+ blockers: base.blockers,
387
+ exitCriteria: base.exitCriteria
388
+ };
389
+ const artifactRules = {
390
+ artifactFile: base.artifactFile,
391
+ completionStatus: base.completionStatus,
392
+ crossStageTrace,
393
+ artifactValidation: tieredValidation,
394
+ trivialOverrideSections: base.trivialOverrideSections
395
+ };
396
+ const reviewLens = {
397
+ outputs: base.outputs,
398
+ reviewSections: base.reviewSections,
399
+ mandatoryDelegations,
400
+ policyNeedles: base.policyNeedles
401
+ };
347
402
  return {
348
403
  ...base,
404
+ schemaShape: "v2",
405
+ complexityTier,
406
+ philosophy,
407
+ executionModel,
408
+ artifactRules,
409
+ reviewLens,
349
410
  skillFolder: STAGE_TO_SKILL_FOLDER[stage],
350
411
  crossStageTrace,
351
412
  requiredGates: tieredGates,
352
413
  artifactValidation: tieredValidation,
353
- mandatoryDelegations: mandatoryDelegationsForStage(stage)
414
+ mandatoryDelegations
354
415
  };
355
416
  }
356
417
  export function orderedStageSchemas(track = "standard") {
@@ -3,6 +3,7 @@
3
3
  // ---------------------------------------------------------------------------
4
4
  export const BRAINSTORM = {
5
5
  stage: "brainstorm",
6
+ complexityTier: "standard",
6
7
  skillFolder: "brainstorming",
7
8
  skillName: "brainstorming",
8
9
  skillDescription: "Design-first stage. Explore context, understand intent through collaborative dialogue, propose distinct approaches, and lock an approved direction before scope/design work.",
@@ -3,6 +3,7 @@
3
3
  // ---------------------------------------------------------------------------
4
4
  export const DESIGN = {
5
5
  stage: "design",
6
+ complexityTier: "deep",
6
7
  skillFolder: "engineering-design-lock",
7
8
  skillName: "engineering-design-lock",
8
9
  skillDescription: "Engineering lock-in stage. Build a concrete technical spine before spec and planning, with section-by-section interactive review.",
@@ -27,17 +27,62 @@ export interface StageAutoSubagentDispatch {
27
27
  * - `proactive` — should be dispatched automatically when context matches `when`.
28
28
  */
29
29
  mode: "mandatory" | "proactive";
30
+ /**
31
+ * Minimum complexity tier where this dispatch policy applies.
32
+ * Defaults to `standard` for mandatory dispatches when omitted.
33
+ */
34
+ requiredAtTier?: StageComplexityTier;
30
35
  when: string;
31
36
  purpose: string;
32
37
  requiresUserGate: boolean;
33
38
  /** Optional skill folder the dispatched agent should load as additional context. */
34
39
  skill?: string;
35
40
  }
41
+ export type StageComplexityTier = "lightweight" | "standard" | "deep";
42
+ export interface StagePhilosophy {
43
+ hardGate: string;
44
+ ironLaw: string;
45
+ purpose: string;
46
+ whenToUse: string[];
47
+ whenNotToUse: string[];
48
+ commonRationalizations: string[];
49
+ }
50
+ export interface StageExecutionModel {
51
+ interactionProtocol: string[];
52
+ process: string[];
53
+ checklist: string[];
54
+ requiredGates: StageGate[];
55
+ requiredEvidence: string[];
56
+ inputs: string[];
57
+ requiredContext: string[];
58
+ researchPlaybooks?: string[];
59
+ blockers: string[];
60
+ exitCriteria: string[];
61
+ }
62
+ export interface StageArtifactRules {
63
+ artifactFile: string;
64
+ completionStatus: string[];
65
+ crossStageTrace: CrossStageTrace;
66
+ artifactValidation: ArtifactValidation[];
67
+ trivialOverrideSections?: string[];
68
+ }
69
+ export interface StageReviewLens {
70
+ outputs: string[];
71
+ reviewSections: ReviewSection[];
72
+ mandatoryDelegations: string[];
73
+ policyNeedles: string[];
74
+ }
36
75
  export interface StageSchema {
76
+ schemaShape: "v2";
37
77
  stage: FlowStage;
38
78
  skillFolder: string;
39
79
  skillName: string;
40
80
  skillDescription: string;
81
+ complexityTier: StageComplexityTier;
82
+ philosophy: StagePhilosophy;
83
+ executionModel: StageExecutionModel;
84
+ artifactRules: StageArtifactRules;
85
+ reviewLens: StageReviewLens;
41
86
  hardGate: string;
42
87
  /**
43
88
  * One-line "Iron Law" punchcard — the single rule that, if broken,
@@ -84,4 +129,6 @@ export interface StageSchema {
84
129
  /** Agent names that MUST be dispatched (or waived) before stage transition — derived from mandatory auto-subagent rows. */
85
130
  mandatoryDelegations: string[];
86
131
  }
87
- export type StageSchemaInput = Omit<StageSchema, "mandatoryDelegations">;
132
+ export type StageSchemaInput = Omit<StageSchema, "schemaShape" | "philosophy" | "executionModel" | "artifactRules" | "reviewLens" | "mandatoryDelegations" | "complexityTier"> & {
133
+ complexityTier?: StageComplexityTier;
134
+ };
@@ -3,6 +3,7 @@
3
3
  // ---------------------------------------------------------------------------
4
4
  export const SCOPE = {
5
5
  stage: "scope",
6
+ complexityTier: "standard",
6
7
  skillFolder: "scope-shaping",
7
8
  skillName: "scope-shaping",
8
9
  skillDescription: "Strategic scope stage. Challenge premise and lock explicit in-scope/out-of-scope boundaries using CEO-level thinking.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cclaw-cli",
3
- "version": "0.48.26",
3
+ "version": "0.48.27",
4
4
  "description": "Installer-first flow toolkit for coding agents",
5
5
  "type": "module",
6
6
  "bin": {