@agentic-coding-framework/orchestrator-core 0.1.2 → 0.3.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/dist/rules.js CHANGED
@@ -19,7 +19,7 @@ exports.getStepSequence = getStepSequence;
19
19
  /** Complexity-to-dispatch-mode mapping */
20
20
  exports.DISPATCH_MODES = {
21
21
  S: "single",
22
- M: "auto", // check [P] count, enable team only if 2
22
+ M: "auto", // check [P] count, enable team only if >= 2
23
23
  L: "team",
24
24
  };
25
25
  // ─── Step Rules Table ────────────────────────────────────────────────────────
@@ -201,70 +201,6 @@ exports.STEP_RULES = {
201
201
  "If the task is unclear, fill reason with needs_clarification.",
202
202
  },
203
203
  };
204
- // ─── Custom Task Use Cases ──────────────────────────────────────────────────
205
- //
206
- // The "custom" step is a generic passthrough that lets OpenClaw forward ANY
207
- // instruction to Claude Code with full project context. Common use cases:
208
- //
209
- // ── Refactoring ──
210
- // "Extract authentication logic into a separate auth module"
211
- // "Rename all UserDTO references to UserResponse"
212
- // "Convert class components to functional components with hooks"
213
- // "Split monolithic service.ts into domain-specific modules"
214
- //
215
- // ── Code Review ──
216
- // "Review src/api/ for security vulnerabilities"
217
- // "Review PR #42 changes and list potential issues"
218
- // "Check all error handling paths in the payment flow"
219
- // "Audit dependencies for known CVEs"
220
- //
221
- // ── Bug Fix (hotfix, not full story) ──
222
- // "Fix the race condition in WebSocket reconnection"
223
- // "Debug why /api/users returns 500 on empty query"
224
- // "Fix memory leak in event listener cleanup"
225
- //
226
- // ── DevOps / Infrastructure ──
227
- // "Add GitHub Actions CI pipeline for lint + test + build"
228
- // "Create Dockerfile and docker-compose.yml for local dev"
229
- // "Set up pre-commit hooks for linting and formatting"
230
- // "Configure Renovate for automated dependency updates"
231
- //
232
- // ── Documentation ──
233
- // "Add JSDoc comments to all exported functions in src/api/"
234
- // "Update README with current API endpoints and examples"
235
- // "Generate OpenAPI spec from existing route handlers"
236
- // "Write architecture decision record for database choice"
237
- //
238
- // ── Testing ──
239
- // "Add unit tests for utils/validation.ts (target 90% coverage)"
240
- // "Write integration tests for the checkout flow"
241
- // "Add snapshot tests for all React components in src/ui/"
242
- // "Set up E2E tests with Playwright for critical user paths"
243
- //
244
- // ── Dependency / Migration ──
245
- // "Upgrade React from v17 to v18, fix breaking changes"
246
- // "Migrate from Express to Fastify"
247
- // "Replace moment.js with date-fns"
248
- // "Migrate database schema: add soft delete to all entities"
249
- //
250
- // ── Performance ──
251
- // "Profile and optimize the dashboard query (currently 3s)"
252
- // "Add Redis caching for /api/products endpoint"
253
- // "Implement virtual scrolling for the transaction list"
254
- // "Lazy-load all route components with React.lazy"
255
- //
256
- // ── Security ──
257
- // "Add rate limiting to all authentication endpoints"
258
- // "Implement CSRF protection for form submissions"
259
- // "Sanitize all user inputs in the search endpoint"
260
- // "Add Content-Security-Policy headers"
261
- //
262
- // ── Cleanup ──
263
- // "Remove all unused imports and dead code"
264
- // "Standardize error response format across all endpoints"
265
- // "Replace console.log with structured logger"
266
- // "Fix all TypeScript strict mode errors"
267
- //
268
204
  // ─── Bootstrap Rule (special: one-time, not in the micro-waterfall loop) ─────
269
205
  exports.BOOTSTRAP_RULE = {
270
206
  display_name: "Bootstrap",
@@ -331,9 +267,22 @@ function getRule(step) {
331
267
  throw new Error('No rule for "done" — story is complete');
332
268
  return exports.STEP_RULES[step];
333
269
  }
334
- /** Resolve {story} placeholders in file paths */
270
+ /**
271
+ * Resolve {story} placeholders in file paths.
272
+ *
273
+ * [FIX P0] Handles double-prefix prevention:
274
+ * Templates use "US-{story}" but storyId may already be "US-013".
275
+ * If template has "US-{story}" and storyId starts with "US-",
276
+ * replace "US-{story}" as a whole unit → "US-013" (not "US-US-013").
277
+ */
335
278
  function resolvePaths(paths, storyId) {
336
- return paths.map((p) => p.replace(/\{story\}/g, storyId));
279
+ return paths.map((p) => {
280
+ // [FIX P0] Prevent double-prefix: "US-{story}" + "US-013" → "US-013" not "US-US-013"
281
+ if (p.includes("US-{story}") && storyId.startsWith("US-")) {
282
+ return p.replace(/US-\{story\}/g, storyId);
283
+ }
284
+ return p.replace(/\{story\}/g, storyId);
285
+ });
337
286
  }
338
287
  /** Determine dispatch mode from complexity marker */
339
288
  function getDispatchMode(complexity, parallelCount = 0) {
@@ -364,3 +313,4 @@ function getStepSequence() {
364
313
  "update-memory",
365
314
  ];
366
315
  }
316
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAyRH,0BAKC;AAUD,oCAQC;AAGD,0CASC;AAGD,sCAMC;AAGD,0CAWC;AAlUD,0CAA0C;AAC7B,QAAA,cAAc,GAA2B;IACpD,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,MAAM,EAAE,4CAA4C;IACvD,CAAC,EAAE,MAAM;CACV,CAAC;AAEF,gFAAgF;AAEnE,QAAA,UAAU,GAA6B;IAClD,GAAG,EAAE;QACH,YAAY,EAAE,sBAAsB;QACpC,YAAY,EAAE,WAAW;QACzB,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE;YACZ,oBAAoB;YACpB,mBAAmB;YACnB,gBAAgB;SACjB;QACD,aAAa,EAAE,CAAC,wBAAwB,CAAC;QACzC,UAAU,EAAE,IAAI;QAChB,gBAAgB,EACd,kEAAkE;YAClE,6FAA6F;YAC7F,4CAA4C;YAC5C,4BAA4B;KAC/B;IACD,WAAW,EAAE;QACX,YAAY,EAAE,gBAAgB;QAC9B,YAAY,EAAE,UAAU;QACxB,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;QACjC,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE;YACZ,oBAAoB;YACpB,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,GAAG,sBAAc,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC;IACpD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oEAAoE;AACpE,SAAgB,aAAa,CAAC,IAAY,EAAE,MAAqB;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,6DAA6D;AAC7D,SAAgB,eAAe;IAC7B,OAAO;QACL,KAAK;QACL,WAAW;QACX,UAAU;QACV,QAAQ;QACR,UAAU;QACV,MAAM;QACN,QAAQ;QACR,eAAe;KAChB,CAAC;AACJ,CAAC"}
package/dist/state.d.ts CHANGED
@@ -4,58 +4,29 @@
4
4
  * Maps directly to the Agentic Coding Protocol's STATE.json field specifications.
5
5
  * All operations are synchronous file I/O — zero LLM tokens.
6
6
  */
7
- /** Micro-waterfall steps, matching Protocol's valid step values */
8
- export type Step = "bootstrap" | "bdd" | "sdd-delta" | "contract" | "review" | "scaffold" | "impl" | "verify" | "update-memory" | "custom" | "done";
9
- /** Task type determines which pipeline to follow */
10
- export type TaskType = "story" | "custom";
11
- /** STATE.json status state machine:
12
- * pending → running → pass | failing | timeout | needs_human */
13
- export type Status = "pending" | "running" | "pass" | "failing" | "needs_human" | "timeout";
14
- /** Reason codes extracted from HANDOFF.md, driving reason-based routing */
15
- export type Reason = "constitution_violation" | "needs_clarification" | "nfr_missing" | "scope_warning" | "test_timeout";
16
- /** Test result summary */
17
- export interface TestResult {
7
+ export interface TestResults {
18
8
  pass: number;
19
9
  fail: number;
20
10
  skip: number;
21
11
  }
22
- /** Complete STATE.json schema — every field from the Protocol spec */
23
12
  export interface State {
24
- /** Project identifier */
25
13
  project: string;
26
- /** Current User Story ID (e.g., "US-005") */
27
14
  story: string | null;
28
- /** Current micro-waterfall step */
29
- step: Step;
30
- /** Attempt count for current step (1-indexed) */
15
+ step: string;
31
16
  attempt: number;
32
- /** Maximum attempts allowed (from rules table) */
33
17
  max_attempts: number;
34
- /** Current status */
35
- status: Status;
36
- /** Failure reason code (null = general failure/success) */
37
- reason: Reason | null;
38
- /** ISO 8601 timestamp when executor was dispatched */
18
+ status: string;
19
+ reason: string | null;
39
20
  dispatched_at: string | null;
40
- /** ISO 8601 timestamp when executor completed */
41
21
  completed_at: string | null;
42
- /** Timeout in minutes (from rules table) */
43
22
  timeout_min: number;
44
- /** Test result summary */
45
- tests: TestResult | null;
46
- /** Names of failing tests */
23
+ tests: TestResults | null;
47
24
  failing_tests: string[];
48
- /** Whether linting passed */
49
25
  lint_pass: boolean | null;
50
- /** Files modified in this run */
51
26
  files_changed: string[];
52
- /** Story IDs that block this story */
53
27
  blocked_by: string[];
54
- /** Human instruction transcribed from communication channel */
55
28
  human_note: string | null;
56
- /** Task type: "story" for micro-waterfall, "custom" for ad-hoc tasks */
57
- task_type: TaskType;
58
- /** Whether CC is allowed to spawn agent-teams for this task */
29
+ task_type: string;
59
30
  agent_teams: boolean;
60
31
  }
61
32
  /** Create a blank STATE.json for a new project */
@@ -71,6 +42,19 @@ export declare function initState(projectRoot: string, project: string): {
71
42
  created: boolean;
72
43
  state: State;
73
44
  };
45
+ /** Path to CLAUDE.md in project root */
46
+ export declare function claudeMdPath(projectRoot: string): string;
47
+ /**
48
+ * Generate CLAUDE.md content for ACF-enabled projects.
49
+ * CC reads this file automatically on every session start,
50
+ * ensuring it follows the ACF workflow even without dispatch.
51
+ */
52
+ export declare function generateClaudeMd(project: string): string;
53
+ /**
54
+ * Write CLAUDE.md to project root.
55
+ * Returns true if created, false if already exists (no overwrite).
56
+ */
57
+ export declare function writeClaudeMd(projectRoot: string, project: string, force?: boolean): boolean;
74
58
  /** Validate a State object. Throws on invalid fields. */
75
59
  export declare function validate(state: State): void;
76
60
  /** Check if a step has exceeded its timeout */
@@ -80,4 +64,5 @@ export declare function isMaxedOut(state: State): boolean;
80
64
  /** Mark state as running with dispatch timestamp */
81
65
  export declare function markRunning(state: State): State;
82
66
  /** Mark state as completed (pass or failing) with timestamp */
83
- export declare function markCompleted(state: State, status: "pass" | "failing" | "needs_human", reason?: Reason | null): State;
67
+ export declare function markCompleted(state: State, status: string, reason?: string | null): State;
68
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE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KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,GAAG,IAAW,GAC3B,KAAK,CAOP"}
package/dist/state.js CHANGED
@@ -11,6 +11,9 @@ exports.statePath = statePath;
11
11
  exports.readState = readState;
12
12
  exports.writeState = writeState;
13
13
  exports.initState = initState;
14
+ exports.claudeMdPath = claudeMdPath;
15
+ exports.generateClaudeMd = generateClaudeMd;
16
+ exports.writeClaudeMd = writeClaudeMd;
14
17
  exports.validate = validate;
15
18
  exports.isTimedOut = isTimedOut;
16
19
  exports.isMaxedOut = isMaxedOut;
@@ -78,6 +81,71 @@ function initState(projectRoot, project) {
78
81
  writeState(projectRoot, state);
79
82
  return { created: true, state };
80
83
  }
84
+ // ─── CLAUDE.md Generation ─────────────────────────────────────────────────
85
+ /** Path to CLAUDE.md in project root */
86
+ function claudeMdPath(projectRoot) {
87
+ return (0, path_1.join)(projectRoot, "CLAUDE.md");
88
+ }
89
+ /**
90
+ * Generate CLAUDE.md content for ACF-enabled projects.
91
+ * CC reads this file automatically on every session start,
92
+ * ensuring it follows the ACF workflow even without dispatch.
93
+ */
94
+ function generateClaudeMd(project) {
95
+ return `# ${project} — Agentic Coding Framework
96
+
97
+ This project uses the **Agentic Coding Framework (ACF)** with an orchestrator-driven
98
+ micro-waterfall pipeline. You MUST follow the ACF workflow — do NOT work freestyle.
99
+
100
+ ## How to Work in This Project
101
+
102
+ 1. **Check current state first:**
103
+ Read \`.ai/STATE.json\` to understand which step and status the project is in.
104
+
105
+ 2. **Follow the orchestrator — never skip steps:**
106
+ The pipeline is: bootstrap → bdd → sdd-delta → contract → review → scaffold → impl → verify → update-memory → done.
107
+ Each step has specific inputs, outputs, and acceptance criteria.
108
+
109
+ 3. **Use the orchestrator CLI** (preferred):
110
+ \`\`\`bash
111
+ orchestrator dispatch . # Get your current task prompt
112
+ orchestrator status . # Check pipeline status
113
+ \`\`\`
114
+
115
+ 4. **Always update .ai/HANDOFF.md when done:**
116
+ After completing your work, write a YAML front-matter summary to \`.ai/HANDOFF.md\`
117
+ with: story, step, attempt, status (pass/failing), reason, files_changed, and tests.
118
+ The orchestrator hook reads this to advance the pipeline.
119
+
120
+ ## Key Rules
121
+
122
+ - **Do NOT modify .ai/STATE.json directly** — the orchestrator manages it.
123
+ - **Do NOT skip to a different step** — always complete the current step first.
124
+ - If requirements are unclear, set status: \`failing\` and reason: \`needs_clarification\` in HANDOFF.md.
125
+ - If you find a Constitution violation, set reason: \`constitution_violation\`.
126
+ - Read \`.ai/PROJECT_MEMORY.md\` for cross-session context and architectural decisions.
127
+
128
+ ## Files
129
+
130
+ | File | Purpose | Who writes |
131
+ |------|---------|-----------|
132
+ | \`.ai/STATE.json\` | Pipeline state machine | Orchestrator only |
133
+ | \`.ai/HANDOFF.md\` | Executor ↔ Orchestrator bridge | You (CC) |
134
+ | \`.ai/PROJECT_MEMORY.md\` | Cross-session knowledge | You (at update-memory step) |
135
+ `;
136
+ }
137
+ /**
138
+ * Write CLAUDE.md to project root.
139
+ * Returns true if created, false if already exists (no overwrite).
140
+ */
141
+ function writeClaudeMd(projectRoot, project, force = false) {
142
+ const path = claudeMdPath(projectRoot);
143
+ if ((0, fs_1.existsSync)(path) && !force) {
144
+ return false;
145
+ }
146
+ (0, fs_1.writeFileSync)(path, generateClaudeMd(project), "utf-8");
147
+ return true;
148
+ }
81
149
  // ─── Validation ──────────────────────────────────────────────────────────────
82
150
  const VALID_STEPS = new Set([
83
151
  "bootstrap",
@@ -159,3 +227,4 @@ function markCompleted(state, status, reason = null) {
159
227
  completed_at: new Date().toISOString(),
160
228
  };
161
229
  }
230
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqCH,gDAqBC;AAKD,8BAEC;AAGD,8BASC;AAGD,gCAQC;AAGD,8BAWC;AAKD,oCAEC;AAOD,4CA0CC;AAMD,sCAWC;AAoCD,4BAyBC;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tC,OAAO;QACL,GAAG,KAAK;QACR,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACvC,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,SAAgB,aAAa,CAC3B,KAAY,EACZ,MAAc,EACd,SAAwB,IAAI;IAE5B,OAAO;QACL,GAAG,KAAK;QACR,MAAM;QACN,MAAM;QACN,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACvC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-coding-framework/orchestrator-core",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Zero-token orchestrator for the Agentic Coding Protocol — state machine, rules table, dispatch logic, CC integration",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -17,25 +17,5 @@
17
17
  "files": [
18
18
  "dist",
19
19
  "README.md"
20
- ],
21
- "keywords": [
22
- "agentic-coding",
23
- "orchestrator",
24
- "claude-code",
25
- "ai-coding",
26
- "state-machine",
27
- "micro-waterfall"
28
- ],
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/MaWeiChi/agentic-coding-orchestrator.git",
32
- "directory": "agentic-coding-orchestrator"
33
- },
34
- "author": "MaWeiChi",
35
- "license": "MIT",
36
- "devDependencies": {
37
- "@types/node": "^20.0.0",
38
- "typescript": "^5.4.0",
39
- "vitest": "^2.0.0"
40
- }
20
+ ]
41
21
  }