@orchestrator-claude/definitions 3.31.2 → 3.32.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/agents/docs-guardian.md +13 -73
- package/hooks/post-implement.ts +88 -0
- package/manifest.json +11 -3
- package/package.json +1 -1
package/agents/docs-guardian.md
CHANGED
|
@@ -137,7 +137,7 @@ The Documentation Guardian is a specialized agent responsible for maintaining do
|
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
**When to Use**:
|
|
140
|
-
- As post-IMPLEMENT
|
|
140
|
+
- As the post-IMPLEMENT step (orchestrator-dispatched on the System-A post-implement signal — RFC-034)
|
|
141
141
|
- For immediate execution when changes are trusted
|
|
142
142
|
- In CI/CD pipelines for automatic documentation updates
|
|
143
143
|
|
|
@@ -248,82 +248,21 @@ The agent uses the `DocsGuardianSkill` which orchestrates:
|
|
|
248
248
|
- **MisplacedDocsChecker**: Finds docs in wrong locations
|
|
249
249
|
- **ArchiveCandidatesChecker**: Identifies docs to archive
|
|
250
250
|
|
|
251
|
-
### Post-IMPLEMENT Hook Integration
|
|
251
|
+
### Post-IMPLEMENT Hook Integration (System A — RFC-034)
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
docs-guardian is dispatched by the **orchestrator** after the IMPLEMENT phase completes, via the System-A hook-signal mechanism — **not** an application-internal executor.
|
|
254
254
|
|
|
255
|
-
**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"agent": "docs-guardian",
|
|
261
|
-
"mode": "auto",
|
|
262
|
-
"blocking": false,
|
|
263
|
-
"enabled": true,
|
|
264
|
-
"scope": "all"
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
**Hook Execution Flow**:
|
|
271
|
-
1. IMPLEMENT phase completes
|
|
272
|
-
2. `WorkflowStateService.advancePhase()` detects transition from "implement"
|
|
273
|
-
3. `HookExecutor.executePostImplementHook()` invoked
|
|
274
|
-
4. Hook configuration loaded from index
|
|
275
|
-
5. Skip conditions evaluated
|
|
276
|
-
6. If enabled and not skipped:
|
|
277
|
-
- SDKAgentExecutor invokes docs-guardian in auto mode
|
|
278
|
-
- Checkpoint created
|
|
279
|
-
- Actions executed
|
|
280
|
-
- Execution tracked in index
|
|
281
|
-
7. Workflow continues (non-blocking)
|
|
282
|
-
|
|
283
|
-
**Hook Execution Tracking**:
|
|
284
|
-
```json
|
|
285
|
-
{
|
|
286
|
-
"hookExecutions": [
|
|
287
|
-
{
|
|
288
|
-
"hookType": "postImplement",
|
|
289
|
-
"workflowId": "wf_123",
|
|
290
|
-
"timestamp": "2026-01-17T10:00:00Z",
|
|
291
|
-
"duration": 3500,
|
|
292
|
-
"status": "success",
|
|
293
|
-
"result": {
|
|
294
|
-
"actionsExecuted": 5,
|
|
295
|
-
"actionsSucceeded": 5,
|
|
296
|
-
"actionsFailed": 0
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
|
-
}
|
|
301
|
-
```
|
|
255
|
+
**Mechanism (RFC-034 / TD-102):**
|
|
256
|
+
1. IMPLEMENT phase completes; the orchestrator calls `advancePhase` and the workflow enters `review`.
|
|
257
|
+
2. The OS-level hook `.claude/hooks/post-implement.ts` fires on `PostToolUse[mcp__orchestrator-tools__advancePhase]`, reads the live workflow state, and — when the post-advance `currentPhase === 'review'` (reached only by leaving `implement`) — emits the orchestrator signal:
|
|
258
|
+
`[ORCHESTRATOR] IMPLEMENT completed for <workflowId> — dispatch the docs-guardian sub-agent…`
|
|
259
|
+
3. The **orchestrator** (main-as-orchestrator) reads the signal and dispatches docs-guardian as part of the review phase, before closing the workflow.
|
|
302
260
|
|
|
303
|
-
**
|
|
261
|
+
**Why the orchestrator dispatches, not the hook:** a hook (a node/bash script) cannot spawn a Claude sub-agent in the main-as-orchestrator model (RFC-022). `post-implement.ts` is a *deterministic trigger* that emits the signal; the orchestrator owns sub-agent dispatch. The dispatch rule lives in the orchestrator Skin (`.claude/agents/orchestrator.md`, MUST rule #5) and the `/orchestrator` SKILL (§2d.1).
|
|
304
262
|
|
|
305
|
-
|
|
306
|
-
```json
|
|
307
|
-
{
|
|
308
|
-
"workflows": [{
|
|
309
|
-
"id": "wf_123",
|
|
310
|
-
"hooks": {
|
|
311
|
-
"postImplement": { "enabled": false }
|
|
312
|
-
}
|
|
313
|
-
}]
|
|
314
|
-
}
|
|
315
|
-
```
|
|
263
|
+
**Fail-open:** if the API is unavailable or env is unset, the hook emits nothing and never blocks the advance. The orchestrator dispatches docs-guardian during review regardless, so coverage does not depend on the signal firing.
|
|
316
264
|
|
|
317
|
-
|
|
318
|
-
```json
|
|
319
|
-
{
|
|
320
|
-
"workflows": [{
|
|
321
|
-
"id": "wf_123",
|
|
322
|
-
"metadata": { "docsImpact": false }
|
|
323
|
-
}]
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
(Hook will be skipped if `skipConditions: ["no-docs-impact"]` is configured)
|
|
265
|
+
> **Historical note (S306, RFC-034 Decision 2):** prior versions documented an application-internal auto-invoke flow — `WorkflowStateService.advancePhase()` → `HookExecutor.executePostImplementHook()` → `SDKAgentExecutor invokes docs-guardian`. That "System B" subsystem was dead code (registered-but-never-resolved, stub-backed: `getHookConfig:()=>null` + a mock agent executor) and was removed completely in S306. The live mechanism is System A as described above.
|
|
327
266
|
|
|
328
267
|
## Error Handling
|
|
329
268
|
|
|
@@ -484,9 +423,10 @@ Archive specs/plans/RFCs promptly after implementation
|
|
|
484
423
|
- **v1.2.1** (RFC-003 Phase 2): Added sync mode with action plan generation
|
|
485
424
|
- **v1.2.2** (RFC-003 Phase 3): Added auto mode and post-IMPLEMENT hook integration
|
|
486
425
|
- **v1.3.0**: Added AGENT-PROMPT-STANDARDS compliance (RFC 2119, severity classification)
|
|
426
|
+
- **v1.4.0** (RFC-034 / TD-102, S307): Post-IMPLEMENT integration migrated from the removed System-B auto-invoke (`HookExecutor`/`WorkflowStateService`) to the System-A hook-signal + orchestrator-dispatch mechanism.
|
|
487
427
|
|
|
488
428
|
---
|
|
489
429
|
|
|
490
430
|
**Generated by**: RFC-003 Phase 3 Implementation
|
|
491
431
|
**Standards Compliance**: AGENT-PROMPT-STANDARDS v1.0
|
|
492
|
-
**Last Updated**: 2026-
|
|
432
|
+
**Last Updated**: 2026-06-25
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* post-implement.ts — PostToolUse[mcp__orchestrator-tools__advancePhase] hook
|
|
3
|
+
* (RFC-034 §5 / TD-102, System-A vehicle)
|
|
4
|
+
*
|
|
5
|
+
* Purpose: emit a deterministic orchestrator signal the moment the IMPLEMENT phase
|
|
6
|
+
* has been completed, so the main-as-orchestrator dispatches the docs-guardian
|
|
7
|
+
* sub-agent before proceeding past the IMPLEMENT gate. A hook cannot itself spawn a
|
|
8
|
+
* Claude sub-agent in the main-as-orchestrator model (RFC-022) — it can only signal;
|
|
9
|
+
* the orchestrator owns the dispatch (see the orchestrator Skin / SKILL dispatch rule).
|
|
10
|
+
*
|
|
11
|
+
* Detection rationale (verify-before-assert, S307):
|
|
12
|
+
* The MCP advancePhase tool RESPONSE is only `{ success, workflowId }`
|
|
13
|
+
* (AdvancePhaseHandler.ts) — it discards the REST controller's `currentPhase` and
|
|
14
|
+
* carries NO from/previous phase. At PostToolUse time the advance has already
|
|
15
|
+
* committed, so the live workflow's currentPhase is the NEW phase. In the standard
|
|
16
|
+
* dev workflow sequence (… -> implement -> review -> complete), 'review' is reached
|
|
17
|
+
* ONLY by leaving 'implement'. So post-advance currentPhase === 'review' is the
|
|
18
|
+
* available, deterministic proxy for "IMPLEMENT just completed". It fires exactly
|
|
19
|
+
* once (a later review -> complete advance lands on 'complete', not 'review').
|
|
20
|
+
*
|
|
21
|
+
* Fail-open: any missing env / API error / parse failure -> emit nothing, never throw.
|
|
22
|
+
* PostToolUse cannot block the tool; emitting no context is the safe no-op.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
readStdin,
|
|
27
|
+
getField,
|
|
28
|
+
getActiveWorkflow,
|
|
29
|
+
getWorkflowStatus,
|
|
30
|
+
outputContext,
|
|
31
|
+
log,
|
|
32
|
+
} from './lib/api-client.js';
|
|
33
|
+
|
|
34
|
+
const HOOK = 'POST-IMPLEMENT';
|
|
35
|
+
|
|
36
|
+
/** The phase entered upon completing IMPLEMENT in the standard dev workflow sequence. */
|
|
37
|
+
const POST_IMPLEMENT_PHASE = 'review';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* True when the post-advance phase indicates IMPLEMENT was just completed.
|
|
41
|
+
* Case-insensitive; empty/unknown phases return false (fail-safe — no signal).
|
|
42
|
+
*/
|
|
43
|
+
function isImplementCompleted(currentPhase: string | null | undefined): boolean {
|
|
44
|
+
return (currentPhase ?? '').toLowerCase() === POST_IMPLEMENT_PHASE;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Builds the orchestrator dispatch signal for a completed IMPLEMENT phase. */
|
|
48
|
+
function buildPostImplementSignal(workflowId: string): string {
|
|
49
|
+
return [
|
|
50
|
+
`[ORCHESTRATOR] IMPLEMENT completed for ${workflowId} — dispatch the docs-guardian sub-agent before proceeding past the IMPLEMENT gate.`,
|
|
51
|
+
`(RFC-034 System-A post-implement signal: docs-guardian checks documentation compliance against the DOCS-CONSTITUTION after implementation.)`,
|
|
52
|
+
].join('\n');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function main(): Promise<void> {
|
|
56
|
+
const stdin = await readStdin();
|
|
57
|
+
|
|
58
|
+
// Defensive: only act on advancePhase (the settings.json matcher already scopes this).
|
|
59
|
+
const toolName = getField(stdin, 'tool_name') || getField(stdin, 'tool');
|
|
60
|
+
if (toolName && !toolName.includes('advancePhase')) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Resolve the workflow id: prefer the tool input, else the active workflow.
|
|
65
|
+
const wfId = getField(stdin, 'tool_input.workflowId') || (await getActiveWorkflow())?.id || '';
|
|
66
|
+
if (!wfId) {
|
|
67
|
+
log(HOOK, 'no workflow id resolvable — skip (fail-open)');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const status = await getWorkflowStatus(wfId);
|
|
72
|
+
if (!status) {
|
|
73
|
+
log(HOOK, `no status for workflow ${wfId} — skip (fail-open)`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const phase = (status.currentPhase || '').toLowerCase();
|
|
78
|
+
log(HOOK, `workflow=${wfId} post-advance currentPhase=${phase}`);
|
|
79
|
+
|
|
80
|
+
if (!isImplementCompleted(phase)) {
|
|
81
|
+
return; // not the implement -> review transition
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
log(HOOK, `IMPLEMENT completed for ${wfId} — emitting docs-guardian dispatch signal`);
|
|
85
|
+
outputContext('PostToolUse', buildPostImplementSignal(wfId));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
main().catch(() => process.exit(0));
|
package/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "orchestrator-definitions/v1",
|
|
3
3
|
"namespace": "orchestrator",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"generatedAt": "2026-06-
|
|
4
|
+
"version": "3.32.0",
|
|
5
|
+
"generatedAt": "2026-06-25T19:16:00.614Z",
|
|
6
6
|
"definitions": {
|
|
7
7
|
"agents": [
|
|
8
8
|
{
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"slug": "docs-guardian",
|
|
66
66
|
"file": "agents/docs-guardian.md",
|
|
67
67
|
"version": "1.0.0",
|
|
68
|
-
"checksum": "sha256:
|
|
68
|
+
"checksum": "sha256:b9d5b1a102a56f7927d43ccf3cb64332789c61a8c53ad1395bf1d6211d617c01",
|
|
69
69
|
"supersedes": null,
|
|
70
70
|
"metadata": {}
|
|
71
71
|
},
|
|
@@ -497,6 +497,14 @@
|
|
|
497
497
|
"supersedes": null,
|
|
498
498
|
"metadata": {}
|
|
499
499
|
},
|
|
500
|
+
{
|
|
501
|
+
"slug": "post-implement",
|
|
502
|
+
"file": "hooks/post-implement.ts",
|
|
503
|
+
"version": "1.0.0",
|
|
504
|
+
"checksum": "sha256:132c474d4e31ff76abaff10032b4389e015b6fe6e44d03becbe98a87bb89bbbd",
|
|
505
|
+
"supersedes": null,
|
|
506
|
+
"metadata": {}
|
|
507
|
+
},
|
|
500
508
|
{
|
|
501
509
|
"slug": "session-start",
|
|
502
510
|
"file": "hooks/session-start.ts",
|
package/package.json
CHANGED