@open-agent-toolkit/cli 0.3.37 → 0.3.38

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.
Files changed (29) hide show
  1. package/assets/bundle-metadata.json +1 -1
  2. package/assets/docs/reference/cli-reference.md +3 -3
  3. package/assets/docs/reference/project-artifacts.md +12 -3
  4. package/assets/docs/skills/repo-improve.md +23 -19
  5. package/assets/docs/workflows/advanced/workflow-gates.md +7 -1
  6. package/assets/docs/workflows/projects/closeout/closeout-skills.md +3 -1
  7. package/assets/docs/workflows/projects/lifecycle.md +3 -1
  8. package/assets/public-package-versions.json +4 -4
  9. package/assets/skills/oat-project-brief/SKILL.md +1 -1
  10. package/assets/skills/oat-project-brief/references/brief-contract.md +32 -9
  11. package/assets/skills/oat-project-implement/SKILL.md +1 -1
  12. package/assets/skills/oat-project-implement/references/completion-and-closeout.md +14 -4
  13. package/assets/skills/oat-project-pr-progress/SKILL.md +23 -12
  14. package/assets/skills/oat-repo-knowledge-index/SKILL.md +226 -131
  15. package/dist/commands/project/closeout-check/index.d.ts.map +1 -1
  16. package/dist/commands/project/closeout-check/index.js +4 -8
  17. package/dist/commands/project/delivery/check.d.ts.map +1 -1
  18. package/dist/commands/project/delivery/check.js +32 -14
  19. package/dist/commands/project/delivery/evidence.d.ts +39 -0
  20. package/dist/commands/project/delivery/evidence.d.ts.map +1 -1
  21. package/dist/commands/project/delivery/evidence.js +163 -17
  22. package/dist/commands/project/delivery/refresh.d.ts.map +1 -1
  23. package/dist/commands/project/delivery/refresh.js +13 -16
  24. package/dist/commands/project/journal-check/index.d.ts +2 -0
  25. package/dist/commands/project/journal-check/index.d.ts.map +1 -1
  26. package/dist/commands/project/journal-check/index.js +78 -1
  27. package/dist/commands/project/journal-check/types.d.ts +1 -1
  28. package/dist/commands/project/journal-check/types.d.ts.map +1 -1
  29. package/package.json +3 -3
@@ -5,7 +5,7 @@ disable-model-invocation: true
5
5
  user-invocable: true
6
6
  allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion, Task
7
7
  metadata:
8
- version: 1.3.3
8
+ version: 1.4.0
9
9
  ---
10
10
 
11
11
  # Knowledge Base Generation
@@ -43,15 +43,133 @@ EXISTING_MD=$(find .oat/repo/knowledge -name "*.md" -type f 2>/dev/null | head -
43
43
 
44
44
  - List current files: `ls -la .oat/repo/knowledge/*.md 2>/dev/null`
45
45
  - Ask: "Refresh generated knowledge or Skip? Hand-written files will be kept; unmarked output-name collisions stop refresh."
46
- - If Refresh: Continue to the owned-output preflight in Step 2; do not delete files by a wildcard.
46
+ - If Refresh: Continue to the dispatch-route preflight, then Step 2's
47
+ owned-output preflight; do not delete files by a wildcard.
47
48
  - If Skip: Exit
48
49
 
49
50
  **If `$EXISTING_MD` is empty (no content or only .gitkeep):**
50
51
 
51
- - Continue to Step 2
52
+ - Continue to the dispatch-route preflight
53
+
54
+ ### Dispatch-Route Preflight: Resolve Before Mutation
55
+
56
+ Resolve and authorize a usable mapper route before Step 2 deletes or writes
57
+ anything. Set `SKILL_DIR` to the absolute directory containing this loaded
58
+ `SKILL.md`. Independently probe each required `<name>/SKILL.md` in order:
59
+ `${SKILL_DIR}/..`, `${HOME}/.agents/skills`, then
60
+ `<repo-root>/.agents/skills`. Bind each first match to its own root:
61
+ `${DISPATCH_SKILLS_ROOT}` for `oat-dispatch-subagents` and
62
+ `${ORCHESTRATION_SKILLS_ROOT}` for `subagent-orchestration`; never use ambient
63
+ discovery.
64
+
65
+ On a miss, name the missing skill and stop before Step 2. Leave generated and
66
+ manual knowledge unchanged and give both intended-scope recovery commands:
67
+
68
+ ```text
69
+ oat tools install utility --scope <user|project>
70
+ oat tools update --pack utility --scope <user|project>
71
+ ```
72
+
73
+ Read `${DISPATCH_SKILLS_ROOT}/oat-dispatch-subagents/SKILL.md`, then
74
+ `${ORCHESTRATION_SKILLS_ROOT}/subagent-orchestration/references/model-selection-principles.md`.
75
+ Resolve the active provider and read exactly one matching selection reference
76
+ from `${ORCHESTRATION_SKILLS_ROOT}/subagent-orchestration/references/`, followed
77
+ by the matching mechanics reference from
78
+ `${DISPATCH_SKILLS_ROOT}/oat-dispatch-subagents/references/`.
79
+
80
+ Verify that the active provider exposes the installed
81
+ `oat-codebase-mapper` projection. If the projection is missing, stop before
82
+ Step 2 and name that missing role. Recover the workflows pack with
83
+ `oat tools install workflows --scope <user|project>` or
84
+ `oat tools update --pack workflows --scope <user|project>`, or refresh
85
+ provider projections with `oat sync --scope all`. Do not prescribe the utility
86
+ pack for a missing mapper projection.
87
+
88
+ Classify mapper dispatch capability as `available`,
89
+ `authorization-required`, or `unresolved-or-unsupported`. If authorization is
90
+ required, ask once for all five mapper launches in this run (one write probe
91
+ and four mapper lanes), then re-probe and lock that decision. Continue only
92
+ with an available, authorized route. Declined authorization stops before Step
93
+ 2 and reports the declined scope without install advice. An unresolved or
94
+ unsupported host stops before Step 2 with the provider and missing capability,
95
+ also without install advice. Do not delete generated output, create the thin
96
+ index, or launch a write probe.
97
+
98
+ Every request names role `oat-codebase-mapper`, a bounded focus and output
99
+ list, exact authority, verification evidence, deadline, retry limit, and no
100
+ post-acceptance fallback. The write probe and direct-write mapper lanes use
101
+ class `generator`; read-only response lanes use class `recon`. Launch the
102
+ installed provider projection; portable role text is instructions, not a
103
+ registered native role. Build the complete dispatch record before launch,
104
+ launch once, and retain every accepted handle through collection. A launch
105
+ surface that did not launch a child is a route failure: record the pre-start
106
+ rejection and stop before Step 2. Do not reinterpret it as read-only mode.
107
+
108
+ #### Claude route
109
+
110
+ Launch the installed Claude provider projection of `oat-codebase-mapper`
111
+ through the native Task surface. The exact Claude controls are:
112
+
113
+ ```yaml
114
+ subagent_type: 'oat-codebase-mapper'
115
+ model: 'haiku'
116
+ run_in_background: true
117
+ ```
118
+
119
+ Do not substitute the native `Explore` role for the installed mapper
120
+ projection in read-only mode. Preserve the accepted handle; background is
121
+ awaited, never fire-and-forget.
122
+
123
+ #### Codex route
124
+
125
+ Launch the installed Codex provider projection of `oat-codebase-mapper` as the
126
+ exact registered `agent_type` shown by the live native catalog, following the
127
+ Codex mechanics reference for launch controls. Narrow writable roots to
128
+ `.oat/repo/knowledge/` when the surface exposes that control; otherwise use the
129
+ projection's `workspace-write` sandbox and write only declared outputs. Use a
130
+ read-only sandbox for read-only response lanes. A native role-selection
131
+ rejection before child start is a route failure.
132
+
133
+ #### Cursor route
134
+
135
+ Launch the installed Cursor provider projection of `oat-codebase-mapper` as
136
+ the exact agent type advertised by the current native Task/Subagent schema.
137
+ Treat that catalog as specific to this dispatcher invocation. Preserve the
138
+ exact agent type, model selector when exposed, service tier, authority, and
139
+ accepted handle. A CLI or SDK catalog does not establish native role
140
+ availability, and no alternate route may be improvised after acceptance.
141
+
142
+ #### Write-Permission Probe (all providers)
143
+
144
+ With the route resolved, run a non-mutating `lstat` check of `.oat`,
145
+ `.oat/repo`, `.oat/repo/knowledge`, and
146
+ `.oat/repo/knowledge/.preflight` before creating anything. Stop and name the
147
+ path if any existing component is a symlink or a non-directory. If
148
+ `.preflight` already exists as any file type, stop and name it; do not let
149
+ stale bytes satisfy the probe. Only after proving `.preflight` is absent,
150
+ create it fresh, then launch the bounded write-permission probe with class
151
+ `generator` before Step 2. Its only write authority is
152
+ `.oat/repo/knowledge/.preflight/test.txt`, with content `test`; it returns
153
+ `WRITE_OK` or `WRITE_BLOCKED`. Before removing `.preflight`, require
154
+ `WRITE_OK` to coincide with `.preflight/test.txt` existing with exact content
155
+ `test`, and require `WRITE_BLOCKED` to coincide with that file being absent.
156
+ Any disagreement is a malformed result and route failure; stop before Step 2.
157
+ A verified `WRITE_OK` selects direct-write mode. The read-only fallback is
158
+ allowed only when the launched probe has a verified `WRITE_BLOCKED` and the
159
+ same resolved route can launch independently usable read-only response lanes.
160
+ Remove the exact `.preflight` directory on every probe exit path—success,
161
+ blocked write, malformed result, launch failure, or stop—before continuing or
162
+ reporting. Refuse cleanup if that exact path was replaced by a symlink. Any
163
+ missing handle, malformed result, or launch failure stops before Step 2 and
164
+ leaves existing knowledge unchanged. Retain the resolved route, authorization,
165
+ mode, and accepted probe result for the four mapper requests.
52
166
 
53
167
  ### Step 2: Prepare Only Owned Generated Outputs
54
168
 
169
+ Run this step only with the accepted, file-verified probe result and
170
+ `WRITE_MODE` retained by the dispatch-route preflight. Otherwise stop before
171
+ deleting anything.
172
+
55
173
  Set `SKILL_DIR` to the absolute directory containing this loaded `SKILL.md`.
56
174
  Resolve the repository root, then run the deterministic ownership preflight
57
175
  before thin-index generation or mapper writes. It checks every expected
@@ -107,47 +225,13 @@ This script:
107
225
  - Mappers can run in parallel without blocking on index generation
108
226
  - Index gets enriched with full details after mappers complete
109
227
 
110
- ### Step 4b: Pre-flight Check - Test Background Write Permission
111
-
112
- Test if the runtime allows Write tool in background agents.
113
-
114
- ```bash
115
- # Create test directory
116
- mkdir -p .oat/repo/knowledge/.preflight
117
- ```
118
-
119
- Spawn a test agent to check Write permission (must use the same subagent type as the mapper agents):
120
-
121
- ```
122
- subagent_type: "oat-codebase-mapper"
123
- model: "haiku"
124
- run_in_background: true
125
- description: "Test write permissions"
126
- prompt: |
127
- Test if Write tool works in background mode.
128
-
129
- Try to write a test file:
130
- - File: .oat/repo/knowledge/.preflight/test.txt
131
- - Content: "test"
132
-
133
- If Write succeeds, return: "WRITE_OK"
134
- If Write fails or is blocked, return: "WRITE_BLOCKED"
135
- ```
136
-
137
- **Check result:**
228
+ ### Step 4b: Reuse the Accepted Preflight Result
138
229
 
139
- ```bash
140
- if [ -f .oat/repo/knowledge/.preflight/test.txt ]; then
141
- echo "✓ Write works in background agents - using direct-write approach"
142
- WRITE_MODE="direct"
143
- rm -rf .oat/repo/knowledge/.preflight
144
- else
145
- echo "⚠ Write blocked in background agents - using read-only fallback"
146
- WRITE_MODE="readonly"
147
- fi
148
- ```
149
-
150
- Store `$WRITE_MODE` for use in Step 5.
230
+ Do not launch another permission probe here. Reuse the resolved route,
231
+ authorization, and `WRITE_OK` or `WRITE_BLOCKED` result retained by the
232
+ dispatch-route preflight. Store the corresponding `WRITE_MODE` (`direct` or
233
+ `readonly`) for Step 5. A missing accepted probe handle or result is a route
234
+ failure, not evidence for read-only mode; stop without launching mapper lanes.
151
235
 
152
236
  ### Step 5: Spawn Parallel Mapper Agents
153
237
 
@@ -165,21 +249,23 @@ Use the approach determined by Step 4b pre-flight check.
165
249
 
166
250
  ### Step 5a: Direct Write Approach
167
251
 
168
- Use Task tool with `subagent_type="oat-codebase-mapper"` and `run_in_background=true`.
252
+ Dispatch each provider-neutral mapper request through the resolved route and
253
+ launch the installed provider projection of `oat-codebase-mapper`.
169
254
 
170
255
  **Approach:**
171
256
 
172
- - Mapper agents write documents directly to `.oat/repo/knowledge/` using the Write tool
257
+ - Mapper agents write only their declared outputs with the host's file-write capability
173
258
  - Each agent returns only a brief confirmation (not document contents)
174
259
  - This reduces context transfer and improves performance
175
260
 
176
261
  **Agent 1: Tech Focus**
177
262
 
178
- ```
179
- subagent_type: "oat-codebase-mapper"
180
- model: "haiku"
181
- run_in_background: true
182
- description: "Map codebase tech stack"
263
+ ```yaml
264
+ role: oat-codebase-mapper
265
+ class: generator
266
+ focus: tech
267
+ outputs: [stack.md, integrations.md]
268
+ authority: write-declared-outputs
183
269
  ```
184
270
 
185
271
  Prompt:
@@ -205,7 +291,8 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
205
291
  ---
206
292
 
207
293
  Instructions:
208
- - Write documents directly to `.oat/repo/knowledge/` using the Write tool
294
+ - Write only the declared documents under `.oat/repo/knowledge/` with your
295
+ host's file-write capability
209
296
  - Follow the oat-codebase-mapper agent instructions for exploration and writing
210
297
  - Use templates from .agents/skills/oat-repo-knowledge-index/references/templates/
211
298
  - Include frontmatter with both SHA fields in every document
@@ -214,11 +301,12 @@ Instructions:
214
301
 
215
302
  **Agent 2: Architecture Focus**
216
303
 
217
- ```
218
- subagent_type: "oat-codebase-mapper"
219
- model: "haiku"
220
- run_in_background: true
221
- description: "Map codebase architecture"
304
+ ```yaml
305
+ role: oat-codebase-mapper
306
+ class: generator
307
+ focus: arch
308
+ outputs: [architecture.md, structure.md]
309
+ authority: write-declared-outputs
222
310
  ```
223
311
 
224
312
  Prompt:
@@ -244,7 +332,8 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
244
332
  ---
245
333
 
246
334
  Instructions:
247
- - Write documents directly to `.oat/repo/knowledge/` using the Write tool
335
+ - Write only the declared documents under `.oat/repo/knowledge/` with your
336
+ host's file-write capability
248
337
  - Follow the oat-codebase-mapper agent instructions for exploration and writing
249
338
  - Use templates from .agents/skills/oat-repo-knowledge-index/references/templates/
250
339
  - Include frontmatter with both SHA fields in every document
@@ -253,11 +342,12 @@ Instructions:
253
342
 
254
343
  **Agent 3: Quality Focus**
255
344
 
256
- ```
257
- subagent_type: "oat-codebase-mapper"
258
- model: "haiku"
259
- run_in_background: true
260
- description: "Map codebase conventions"
345
+ ```yaml
346
+ role: oat-codebase-mapper
347
+ class: generator
348
+ focus: quality
349
+ outputs: [conventions.md, testing.md]
350
+ authority: write-declared-outputs
261
351
  ```
262
352
 
263
353
  Prompt:
@@ -283,7 +373,8 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
283
373
  ---
284
374
 
285
375
  Instructions:
286
- - Write documents directly to `.oat/repo/knowledge/` using the Write tool
376
+ - Write only the declared documents under `.oat/repo/knowledge/` with your
377
+ host's file-write capability
287
378
  - Follow the oat-codebase-mapper agent instructions for exploration and writing
288
379
  - Use templates from .agents/skills/oat-repo-knowledge-index/references/templates/
289
380
  - Include frontmatter with both SHA fields in every document
@@ -292,11 +383,12 @@ Instructions:
292
383
 
293
384
  **Agent 4: Concerns Focus**
294
385
 
295
- ```
296
- subagent_type: "oat-codebase-mapper"
297
- model: "haiku"
298
- run_in_background: true
299
- description: "Map codebase concerns"
386
+ ```yaml
387
+ role: oat-codebase-mapper
388
+ class: generator
389
+ focus: concerns
390
+ outputs: [concerns.md]
391
+ authority: write-declared-outputs
300
392
  ```
301
393
 
302
394
  Prompt:
@@ -321,7 +413,8 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
321
413
  ---
322
414
 
323
415
  Instructions:
324
- - Write documents directly to `.oat/repo/knowledge/` using the Write tool
416
+ - Write only the declared documents under `.oat/repo/knowledge/` with your
417
+ host's file-write capability
325
418
  - Follow the oat-codebase-mapper agent instructions for exploration and writing
326
419
  - Use templates from .agents/skills/oat-repo-knowledge-index/references/templates/
327
420
  - Include frontmatter with both SHA fields in every document
@@ -332,11 +425,14 @@ Instructions:
332
425
 
333
426
  ### Step 5b: Read-Only Fallback Approach
334
427
 
335
- Use Task tool with `subagent_type="Explore"` and `run_in_background=true`.
428
+ Dispatch the same four provider-neutral mapper requests through the resolved
429
+ route with read-only authority. Each request still launches the installed
430
+ provider projection of `oat-codebase-mapper`; the provider route decides its
431
+ native controls.
336
432
 
337
433
  **Approach:**
338
434
 
339
- - Agents do NOT use Write or Bash tools
435
+ - Agents do not modify files or run mutating commands
340
436
  - Agents return complete markdown contents in their response
341
437
  - Orchestrator extracts markdown and writes files
342
438
  - More compatible but larger context transfer
@@ -344,10 +440,11 @@ Use Task tool with `subagent_type="Explore"` and `run_in_background=true`.
344
440
  **Agent 1: Tech Focus**
345
441
 
346
442
  ````
347
- subagent_type: "Explore"
348
- model: "haiku"
349
- run_in_background: true
350
- description: "Map codebase tech stack"
443
+ role: oat-codebase-mapper
444
+ class: recon
445
+ focus: tech
446
+ outputs: [stack.md, integrations.md]
447
+ authority: read-only-response
351
448
 
352
449
  Prompt:
353
450
  Focus: tech
@@ -370,7 +467,7 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
370
467
  ---
371
468
 
372
469
  Constraints:
373
- - Do NOT use Write or Bash tools.
470
+ - Do not modify files or run mutating commands.
374
471
  - Return the complete markdown contents in your final response.
375
472
  - Format as:
376
473
 
@@ -391,10 +488,11 @@ Constraints:
391
488
 
392
489
  ````
393
490
 
394
- subagent_type: "Explore"
395
- model: "haiku"
396
- run_in_background: true
397
- description: "Map codebase architecture"
491
+ role: oat-codebase-mapper
492
+ class: recon
493
+ focus: arch
494
+ outputs: [architecture.md, structure.md]
495
+ authority: read-only-response
398
496
 
399
497
  Prompt:
400
498
  Focus: arch
@@ -420,7 +518,7 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
420
518
 
421
519
  Constraints:
422
520
 
423
- - Do NOT use Write or Bash tools.
521
+ - Do not modify files or run mutating commands.
424
522
  - Return the complete markdown contents in your final response.
425
523
  - Format as:
426
524
 
@@ -442,10 +540,11 @@ Constraints:
442
540
 
443
541
  ````
444
542
 
445
- subagent_type: "Explore"
446
- model: "haiku"
447
- run_in_background: true
448
- description: "Map codebase conventions"
543
+ role: oat-codebase-mapper
544
+ class: recon
545
+ focus: quality
546
+ outputs: [conventions.md, testing.md]
547
+ authority: read-only-response
449
548
 
450
549
  Prompt:
451
550
  Focus: quality
@@ -471,7 +570,7 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
471
570
 
472
571
  Constraints:
473
572
 
474
- - Do NOT use Write or Bash tools.
573
+ - Do not modify files or run mutating commands.
475
574
  - Return the complete markdown contents in your final response.
476
575
  - Format as:
477
576
 
@@ -493,10 +592,11 @@ Constraints:
493
592
 
494
593
  ````
495
594
 
496
- subagent_type: "Explore"
497
- model: "haiku"
498
- run_in_background: true
499
- description: "Map codebase concerns"
595
+ role: oat-codebase-mapper
596
+ class: recon
597
+ focus: concerns
598
+ outputs: [concerns.md]
599
+ authority: read-only-response
500
600
 
501
601
  Prompt:
502
602
  Focus: concerns
@@ -521,7 +621,7 @@ oat_warning: "GENERATED FILE - Do not edit manually. Regenerate with oat-repo-kn
521
621
 
522
622
  Constraints:
523
623
 
524
- - Do NOT use Write or Bash tools.
624
+ - Do not modify files or run mutating commands.
525
625
  - Return the complete markdown contents in your final response.
526
626
  - Format as:
527
627
 
@@ -552,55 +652,50 @@ Constraints:
552
652
 
553
653
  ### Step 6b: Extract and Write Files (Read-Only Mode Only)
554
654
 
555
- If using read-only mode, extract markdown from agent outputs and write to files.
655
+ If using read-only mode, collect each accepted handle through the dispatch
656
+ engine. Save each accepted handle's returned output text verbatim to a
657
+ distinct scratch file outside the repository, retaining the handle-to-path
658
+ mapping. Never guess a provider transcript path and never splice returned text
659
+ into source code.
556
660
 
557
- Use Python to extract markdown blocks:
661
+ Pass the four exact scratch paths as arguments, in lane order, to Python:
558
662
 
559
663
  ````python
560
- import json
561
664
  import re
665
+ import sys
666
+ from pathlib import Path
667
+
668
+ if len(sys.argv) != 5:
669
+ raise RuntimeError('expected four accepted-handle scratch paths')
562
670
 
563
- agents = [
564
- {'id': 'AGENT_ID_1', 'files': ['stack.md', 'integrations.md']},
565
- {'id': 'AGENT_ID_2', 'files': ['architecture.md', 'structure.md']},
566
- {'id': 'AGENT_ID_3', 'files': ['conventions.md', 'testing.md']},
567
- {'id': 'AGENT_ID_4', 'files': ['concerns.md']}
671
+ outputs = [
672
+ ['stack.md', 'integrations.md'],
673
+ ['architecture.md', 'structure.md'],
674
+ ['conventions.md', 'testing.md'],
675
+ ['concerns.md'],
568
676
  ]
569
677
 
570
- for agent in agents:
571
- output_path = f"/private/tmp/claude-502/-Users-thomas-stang-Code-open-agent-toolkit/tasks/{agent['id']}.output"
572
-
573
- with open(output_path, 'r') as f:
574
- lines = f.readlines()
575
-
576
- # Find the last JSON message with agent response
577
- for line in reversed(lines):
578
- if line.strip().startswith('{') and '"message"' in line:
579
- data = json.loads(line)
580
- if 'message' in data and 'content' in data['message']:
581
- content = data['message']['content']
582
- if isinstance(content, list) and len(content) > 0:
583
- text = content[0].get('text', '')
584
-
585
- # Extract markdown blocks - handle both formats
586
- # Standard: --- filename.md ---
587
- pattern = r'---\s+(\w+\.md)\s+---\s*\n\s*```markdown\n(.*?)\n```'
588
- matches = re.findall(pattern, text, re.DOTALL)
589
-
590
- # Alternative: ## filename.md (fallback)
591
- if not matches:
592
- alt_pattern = r'##\s+(\w+\.md)\s*\n\s*```markdown\n(.*?)\n```'
593
- matches = re.findall(alt_pattern, text, re.DOTALL)
594
-
595
- for filename, markdown in matches:
596
- with open(f'.oat/repo/knowledge/{filename}', 'w') as out:
597
- out.write(markdown)
598
- print(f"✓ Wrote {filename}")
599
-
600
- break
678
+ for output_path, files in zip(sys.argv[1:], outputs, strict=True):
679
+ text = Path(output_path).read_text(encoding='utf8')
680
+ pattern = r'---\s+(\w+\.md)\s+---\s*\n\s*```markdown\n(.*?)\n```'
681
+ matches = re.findall(pattern, text, re.DOTALL)
682
+ if not matches:
683
+ alt_pattern = r'##\s+(\w+\.md)\s*\n\s*```markdown\n(.*?)\n```'
684
+ matches = re.findall(alt_pattern, text, re.DOTALL)
685
+
686
+ expected = set(files)
687
+ actual = {filename for filename, _ in matches}
688
+ if actual != expected:
689
+ raise RuntimeError(f'accepted handle returned {actual}, expected {expected}')
690
+
691
+ for filename, markdown in matches:
692
+ with open(f'.oat/repo/knowledge/{filename}', 'w') as out:
693
+ out.write(markdown)
694
+ print(f"✓ Wrote {filename}")
601
695
  ````
602
696
 
603
- This extracts markdown and writes all 7 knowledge files.
697
+ This extracts markdown and writes all 7 knowledge files. Remove the four
698
+ scratch files after successful extraction or on any failure.
604
699
 
605
700
  ### Step 7: Verify All Documents Created
606
701
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/closeout-check/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAW,MAAM,kBAAkB,CAAC;AAGxE,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQhF,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE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B,EACvB,oBAAoB,GACpB,wBAAwB,GACxB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,iBAAiB,GACjB,iBAAiB,CACpB,CAAC;AA4EF;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,YAAY,EAAE,yBAAyB,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAuH7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,EAChC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,yBAAyB,GACtC,OAAO,CAAC,oBAAoB,CAAC,CAoC/B;AAmED,wBAAgB,iCAAiC,CAC/C,SAAS,GAAE,OAAO,CAAC,yBAAyB,CAAM,GACjD,OAAO,CA2BT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/closeout-check/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAW,MAAM,kBAAkB,CAAC;AAGxE,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQhF,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;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YAAY,GACZ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,iBAAiB,GACjB,iBAAiB,CACpB,CAAC;AA4EF;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,YAAY,EAAE,yBAAyB,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAqH7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,EAChC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,yBAAyB,GACtC,OAAO,CAAC,oBAAoB,CAAC,CAoC/B;AAmED,wBAAgB,iCAAiC,CAC/C,SAAS,GAAE,OAAO,CAAC,yBAAyB,CAAM,GACjD,OAAO,CA2BT"}
@@ -2,7 +2,7 @@ import { readFile as defaultReadFile, readdir } from 'node:fs/promises';
2
2
  import { basename, dirname, isAbsolute, join } from 'node:path';
3
3
  import { buildCommandContext } from '../../../app/command-context.js';
4
4
  import { loadGoalDeliveryProject } from '../../project/delivery/check.js';
5
- import { deliveryEvidenceScope, evaluateDeliveryReview, evaluateGateCarrier, } from '../../project/delivery/evidence.js';
5
+ import { deliveryEvidenceScope, evaluateDeliveryExitCarrier, evaluateDeliveryReview, } from '../../project/delivery/evidence.js';
6
6
  import { observeMember } from '../../project/delivery/refresh.js';
7
7
  import { defaultGhRunner, } from '../../project/links/refresh.js';
8
8
  import { defaultGitRunner } from '../../project/sync/git.js';
@@ -179,22 +179,18 @@ export async function loadGoalCloseoutInputs(repoRoot, targetProjectPath, depend
179
179
  const { delivery, effectiveScope } = terminal;
180
180
  if (delivery.status === 'registering')
181
181
  continue;
182
- const evidenceScope = deliveryEvidenceScope(project, observed, delivery);
182
+ const evidenceScope = deliveryEvidenceScope({ ...project, evidenceCarrier: delivery.exit_gate }, observed, delivery);
183
183
  const fact = {
184
184
  scope: effectiveScope,
185
185
  review: await evaluateDeliveryReview(dependencies.git, evidenceScope, delivery, effectiveScope),
186
186
  // The accepted exit-gate binding persisted with the delivery's evidence,
187
187
  // never the milestone's current working carrier.
188
- exit: await evaluateGateCarrier(delivery.exit_gate, {
188
+ exit: await evaluateDeliveryExitCarrier(delivery.exit_gate, {
189
189
  kind: 'code',
190
190
  scope: effectiveScope,
191
191
  match: 'covers',
192
192
  overrideDisabled: project.exitGateDisabled,
193
- }, {
194
- git: dependencies.git,
195
- scope: evidenceScope,
196
- publishedHeads: delivery.members.map((member) => member.observed_head),
197
- }),
193
+ }, { git: dependencies.git, scope: evidenceScope, delivery }),
198
194
  };
199
195
  inputs.evidence[delivery.delivery_id] = fact;
200
196
  }
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/delivery/check.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAS9E,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAML,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,C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