job-forge 2.14.28 → 2.14.29

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.
@@ -86,18 +86,21 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
86
86
  - [D16] Treat `templates/preflight.json` as the source of truth for multi-apply dispatch safety. After candidate facts and gates are materialized from authoritative files, run `npx job-forge preflight:plan --candidates <file>` or `npx job-forge preflight:check --candidates <file>` before task dispatch; follow the emitted rounds and pre/post steps. This does not replace H2 four-source grep until those facts are materialized into the candidate JSON.
87
87
  why: `iso-preflight` is not an MCP and adds no prompt/tool-schema tokens; it turns file-backed facts, duplicate/location gates, max-two rounds, and cleanup/merge/verify steps into an executable local plan instead of repeated prose
88
88
 
89
+ - [D17] Treat `templates/postflight.json` as the source of truth for multi-apply dispatch settlement. Save the JSON preflight plan and per-round observed dispatch/outcome/artifact records, then run `npx job-forge postflight:status --plan <plan.json> --outcomes <outcomes.json>` after each round and `npx job-forge postflight:check ...` after merge/verify. Follow its next action instead of inferring completion from subagent prose.
90
+ why: `iso-postflight` is not an MCP and adds no prompt/tool-schema tokens; it makes "round complete", missing TSVs, failed candidates, replacements, merge, and verify an executable local gate instead of repeated orchestration prose
91
+
89
92
  ## Procedure
90
93
 
91
94
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
92
95
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
93
96
  3. Read the active mode file [D3]. Use context bundle checks when changing context loads [D11]. Check cached artifacts before URL/JD refetches [D12]. Use artifact index lookups before broad file reads when they can answer the question [D13]. Use canonical identity keys for duplicate checks [D15]. Use migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
94
97
  4. Prepare Geometra dispatches: cleanup [H3], canon/index/ledger prefilter when useful [D8, D13, D15], dedupe [H2], location filter [D5], materialize candidate facts/gates and run preflight plan/check [D16], routing [D2, D10], proxy prompt hygiene [H8].
95
- 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
98
+ 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b], then settle the round with postflight status [D17].
96
99
  6. Keep multi-job form-filling out of the orchestrator [H4].
97
100
  7. Cross-check subagent facts against authoritative files [H7].
98
101
  8. Apply score gate [D4].
99
102
  9. Merge contract-validated TSV outcomes [H6, D9].
100
- 10. Verify tracker before ending [H6].
103
+ 10. Verify tracker and run postflight check before ending [H6, D17].
101
104
 
102
105
  ## Routing
103
106
 
@@ -86,6 +86,10 @@ Preflight dispatch plans (terminal, outside opencode):
86
86
  npx job-forge preflight:plan --candidates batch/preflight-candidates.json
87
87
  npx job-forge preflight:check --candidates batch/preflight-candidates.json
88
88
 
89
+ Postflight dispatch settlement (terminal, outside opencode):
90
+ npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
91
+ npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
92
+
89
93
  Consumer migrations (terminal, outside opencode):
90
94
  npx job-forge migrate:plan # preview package.json/.gitignore drift
91
95
  npx job-forge migrate:apply # apply safe harness upgrade migrations
@@ -205,7 +209,7 @@ Step 4 — Materialize and check the dispatch plan
205
209
  decision.
206
210
  - Run npx job-forge preflight:check --candidates <file> to fail on missing
207
211
  sources or blocked gates, then npx job-forge preflight:plan --candidates
208
- <file> to get the bounded round list.
212
+ <file> --json > batch/preflight-plan.json to get the bounded round list.
209
213
  - Follow the emitted rounds. Do not dispatch blocked candidates, and do not
210
214
  replace H2's four-source grep with preflight unless those grep results are
211
215
  present in the candidate JSON.
@@ -224,18 +228,24 @@ Step 5 — Loop in rounds of 2 (Hard Limit #1)
224
228
  # A returned task/session id is only a launch receipt, not completion.
225
229
  # Do not create a "check task status" task; inspect tracker files or
226
230
  # iso-trace if the user asks for status later.
227
- # Read their return values, log outcomes
231
+ # Read their return values, log outcomes in batch/postflight-outcomes.json
232
+ # with candidateId, status, and a tracker-tsv artifact path for every
233
+ # terminal outcome.
234
+ npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
235
+ # Follow the emitted next action before dispatching the next round.
228
236
 
229
- Step 5 — Between rounds: clean sessions again
237
+ Step 6 — Between rounds: clean sessions again
230
238
  - geometra_list_sessions()
231
239
  - geometra_disconnect({ closeBrowser: true })
232
240
 
233
- Step 6 — After all rounds: reconcile outcomes (Hard Limit #6)
241
+ Step 7 — After all rounds: reconcile outcomes (Hard Limit #6)
234
242
  - bash: npx job-forge merge # consumes batch/tracker-additions/*.tsv into the day file
235
243
  - bash: npx job-forge verify # validates URL/status consistency
244
+ - Add merge/verify step observations to batch/postflight-outcomes.json
245
+ - bash: npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
236
246
  - Review output; if verify-pipeline reports issues, fix them before ending.
237
247
 
238
- Step 7 — Aggregate and report
248
+ Step 8 — Aggregate and report
239
249
  - Summarize: applied, skipped, failed
240
250
  - Do NOT re-dispatch failed jobs automatically. Report them to the user.
241
251
  ```
package/AGENTS.md CHANGED
@@ -81,18 +81,21 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
81
81
  - [D16] Treat `templates/preflight.json` as the source of truth for multi-apply dispatch safety. After candidate facts and gates are materialized from authoritative files, run `npx job-forge preflight:plan --candidates <file>` or `npx job-forge preflight:check --candidates <file>` before task dispatch; follow the emitted rounds and pre/post steps. This does not replace H2 four-source grep until those facts are materialized into the candidate JSON.
82
82
  why: `iso-preflight` is not an MCP and adds no prompt/tool-schema tokens; it turns file-backed facts, duplicate/location gates, max-two rounds, and cleanup/merge/verify steps into an executable local plan instead of repeated prose
83
83
 
84
+ - [D17] Treat `templates/postflight.json` as the source of truth for multi-apply dispatch settlement. Save the JSON preflight plan and per-round observed dispatch/outcome/artifact records, then run `npx job-forge postflight:status --plan <plan.json> --outcomes <outcomes.json>` after each round and `npx job-forge postflight:check ...` after merge/verify. Follow its next action instead of inferring completion from subagent prose.
85
+ why: `iso-postflight` is not an MCP and adds no prompt/tool-schema tokens; it makes "round complete", missing TSVs, failed candidates, replacements, merge, and verify an executable local gate instead of repeated orchestration prose
86
+
84
87
  ## Procedure
85
88
 
86
89
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
87
90
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
88
91
  3. Read the active mode file [D3]. Use context bundle checks when changing context loads [D11]. Check cached artifacts before URL/JD refetches [D12]. Use artifact index lookups before broad file reads when they can answer the question [D13]. Use canonical identity keys for duplicate checks [D15]. Use migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
89
92
  4. Prepare Geometra dispatches: cleanup [H3], canon/index/ledger prefilter when useful [D8, D13, D15], dedupe [H2], location filter [D5], materialize candidate facts/gates and run preflight plan/check [D16], routing [D2, D10], proxy prompt hygiene [H8].
90
- 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
93
+ 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b], then settle the round with postflight status [D17].
91
94
  6. Keep multi-job form-filling out of the orchestrator [H4].
92
95
  7. Cross-check subagent facts against authoritative files [H7].
93
96
  8. Apply score gate [D4].
94
97
  9. Merge contract-validated TSV outcomes [H6, D9].
95
- 10. Verify tracker before ending [H6].
98
+ 10. Verify tracker and run postflight check before ending [H6, D17].
96
99
 
97
100
  ## Routing
98
101
 
package/CLAUDE.md CHANGED
@@ -81,18 +81,21 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
81
81
  - [D16] Treat `templates/preflight.json` as the source of truth for multi-apply dispatch safety. After candidate facts and gates are materialized from authoritative files, run `npx job-forge preflight:plan --candidates <file>` or `npx job-forge preflight:check --candidates <file>` before task dispatch; follow the emitted rounds and pre/post steps. This does not replace H2 four-source grep until those facts are materialized into the candidate JSON.
82
82
  why: `iso-preflight` is not an MCP and adds no prompt/tool-schema tokens; it turns file-backed facts, duplicate/location gates, max-two rounds, and cleanup/merge/verify steps into an executable local plan instead of repeated prose
83
83
 
84
+ - [D17] Treat `templates/postflight.json` as the source of truth for multi-apply dispatch settlement. Save the JSON preflight plan and per-round observed dispatch/outcome/artifact records, then run `npx job-forge postflight:status --plan <plan.json> --outcomes <outcomes.json>` after each round and `npx job-forge postflight:check ...` after merge/verify. Follow its next action instead of inferring completion from subagent prose.
85
+ why: `iso-postflight` is not an MCP and adds no prompt/tool-schema tokens; it makes "round complete", missing TSVs, failed candidates, replacements, merge, and verify an executable local gate instead of repeated orchestration prose
86
+
84
87
  ## Procedure
85
88
 
86
89
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
87
90
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
88
91
  3. Read the active mode file [D3]. Use context bundle checks when changing context loads [D11]. Check cached artifacts before URL/JD refetches [D12]. Use artifact index lookups before broad file reads when they can answer the question [D13]. Use canonical identity keys for duplicate checks [D15]. Use migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
89
92
  4. Prepare Geometra dispatches: cleanup [H3], canon/index/ledger prefilter when useful [D8, D13, D15], dedupe [H2], location filter [D5], materialize candidate facts/gates and run preflight plan/check [D16], routing [D2, D10], proxy prompt hygiene [H8].
90
- 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
93
+ 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b], then settle the round with postflight status [D17].
91
94
  6. Keep multi-job form-filling out of the orchestrator [H4].
92
95
  7. Cross-check subagent facts against authoritative files [H7].
93
96
  8. Apply score gate [D4].
94
97
  9. Merge contract-validated TSV outcomes [H6, D9].
95
- 10. Verify tracker before ending [H6].
98
+ 10. Verify tracker and run postflight check before ending [H6, D17].
96
99
 
97
100
  ## Routing
98
101
 
package/README.md CHANGED
@@ -31,7 +31,7 @@ The scaffolded `opencode.json` already has three MCPs wired up — they launch a
31
31
  - **Gmail** — reads replies from recruiters
32
32
  - **state-trace** — typed working memory for cross-session context (resumed batches, recent decisions, repeated portal quirks). Install once with `python3 -m pip install "state-trace[mcp]"`; the MCP command is `state-trace-mcp`.
33
33
 
34
- JobForge also keeps MCP-free local workflow state: `templates/canon.json` defines URL/company/role identity keys via `@razroo/iso-canon`, `templates/contracts.json` defines tracker/apply artifact shapes via `@razroo/iso-contract`, `templates/capabilities.json` defines role capability boundaries via `@razroo/iso-capabilities`, `templates/context.json` defines deterministic mode/reference bundles via `@razroo/iso-context`, `templates/preflight.json` defines safe dispatch rounds/gates via `@razroo/iso-preflight`, `templates/migrations.json` defines safe consumer-project upgrades via `@razroo/iso-migrate`, `.jobforge-ledger/events.jsonl` records duplicate/status events via `@razroo/iso-ledger`, `.jobforge-cache/` stores reusable JD/artifact content via `@razroo/iso-cache`, and `.jobforge-index.json` indexes artifact source pointers via `@razroo/iso-index`. None of these add always-on prompt or tool-schema tokens.
34
+ JobForge also keeps MCP-free local workflow state: `templates/canon.json` defines URL/company/role identity keys via `@razroo/iso-canon`, `templates/contracts.json` defines tracker/apply artifact shapes via `@razroo/iso-contract`, `templates/capabilities.json` defines role capability boundaries via `@razroo/iso-capabilities`, `templates/context.json` defines deterministic mode/reference bundles via `@razroo/iso-context`, `templates/preflight.json` defines safe dispatch rounds/gates via `@razroo/iso-preflight`, `templates/postflight.json` defines safe dispatch settlement via `@razroo/iso-postflight`, `templates/migrations.json` defines safe consumer-project upgrades via `@razroo/iso-migrate`, `.jobforge-ledger/events.jsonl` records duplicate/status events via `@razroo/iso-ledger`, `.jobforge-cache/` stores reusable JD/artifact content via `@razroo/iso-cache`, and `.jobforge-index.json` indexes artifact source pointers via `@razroo/iso-index`. None of these add always-on prompt or tool-schema tokens.
35
35
 
36
36
  `npm install` also materializes symlinks for every supported agent harness — OpenCode, Cursor, Claude Code, and Codex — so you can run `opencode`, `cursor`, `claude`, or `codex` in the same project and each picks up the shared MCP config and instructions.
37
37
 
@@ -78,7 +78,7 @@ JobForge turns opencode into a full job search command center. Instead of manual
78
78
  | **Durable Batch Orchestration** | `batch-runner.sh` uses `@razroo/iso-orchestrator` for resumable bundle execution, bounded fan-out, mutexed state writes, and workflow records in `.jobforge-runs/`. |
79
79
  | **Pipeline Integrity** | Automated merge, dedup, status normalization, health checks |
80
80
  | **Cost-Aware Agent Routing** | Three subagents (`@general-free`, `@general-paid`, `@glm-minimal`) with per-task tool surfaces. On OpenCode, JobForge pins all tiers to `opencode-go/deepseek-v4-flash` so application runs avoid overloaded free-model pools. See [Subagent Routing in AGENTS.md](AGENTS.md) for the task-to-agent mapping. |
81
- | **Trace + Telemetry + Guard + Contract + Canon + Ledger + Capabilities + Context + Cache + Index + Preflight + Migrate** | `job-forge trace:*` exposes local OpenCode transcripts, `job-forge telemetry:*` summarizes runs, `job-forge guard:*` audits deterministic policy rules, `templates/contracts.json` enforces artifact shape with `iso-contract`, `job-forge canon:*` derives stable URL/company/role identity keys, `job-forge ledger:*` queries append-only workflow state, `job-forge capabilities:*` checks role boundaries, `job-forge context:*` plans mode/reference context bundles, `job-forge cache:*` reuses fetched JD/artifact content, `job-forge index:*` queries compact source pointers, `job-forge preflight:*` plans bounded apply dispatch rounds from file-backed candidate facts, and `job-forge migrate:*` applies safe consumer-project upgrades without MCP/tool-schema overhead. |
81
+ | **Trace + Telemetry + Guard + Contract + Canon + Ledger + Capabilities + Context + Cache + Index + Preflight + Postflight + Migrate** | `job-forge trace:*` exposes local OpenCode transcripts, `job-forge telemetry:*` summarizes runs, `job-forge guard:*` audits deterministic policy rules, `templates/contracts.json` enforces artifact shape with `iso-contract`, `job-forge canon:*` derives stable URL/company/role identity keys, `job-forge ledger:*` queries append-only workflow state, `job-forge capabilities:*` checks role boundaries, `job-forge context:*` plans mode/reference context bundles, `job-forge cache:*` reuses fetched JD/artifact content, `job-forge index:*` queries compact source pointers, `job-forge preflight:*` plans bounded apply dispatch rounds from file-backed candidate facts, `job-forge postflight:*` settles dispatch outcomes/artifacts/post-steps, and `job-forge migrate:*` applies safe consumer-project upgrades without MCP/tool-schema overhead. |
82
82
  | **Token Cost Visibility** | `job-forge tokens --days 1` for per-session breakdown; `job-forge session-report --since-minutes 60 --log` to flag sessions over budget and append history to `data/token-usage.tsv`. Auto-logged after every batch run. |
83
83
 
84
84
  ## Usage
@@ -164,7 +164,7 @@ my-search/
164
164
  ├── .opencode/skills/job-forge.md # → skill router
165
165
  ├── .opencode/agents/ # → @general-free, @general-paid, @glm-minimal
166
166
  ├── modes/ # → _shared.md + skill modes
167
- ├── templates/ # → states.yml, portals.example.yml, cv-template.html, canon.json, capabilities.json, context.json, index.json, preflight.json, migrations.json
167
+ ├── templates/ # → states.yml, portals.example.yml, cv-template.html, canon.json, capabilities.json, context.json, index.json, preflight.json, postflight.json, migrations.json
168
168
  ├── batch/batch-prompt.md # → batch worker prompt
169
169
  ├── batch/batch-runner.sh # → parallel orchestrator
170
170
 
@@ -190,7 +190,7 @@ JobForge/
190
190
  │ ├── sync.mjs # postinstall: creates symlinks in consumer project
191
191
  │ └── create-job-forge.mjs # scaffolder
192
192
  ├── modes/ # _shared.md + 16 skill modes
193
- ├── templates/ # cv-template.html, portals.example.yml, states.yml, canon.json, capabilities.json, context.json, preflight.json, migrations.json
193
+ ├── templates/ # cv-template.html, portals.example.yml, states.yml, canon.json, capabilities.json, context.json, preflight.json, postflight.json, migrations.json
194
194
  ├── config/profile.example.yml # template for consumer's profile.yml
195
195
  ├── batch/{batch-prompt.md,batch-runner.sh} # batch orchestrator
196
196
  ├── scripts/
@@ -203,6 +203,7 @@ JobForge/
203
203
  │ ├── index.mjs # iso-index-backed artifact lookup CLI
204
204
  │ ├── canon.mjs # iso-canon-backed identity normalization CLI
205
205
  │ ├── preflight.mjs # iso-preflight-backed dispatch planning CLI
206
+ │ ├── postflight.mjs # iso-postflight-backed dispatch settlement CLI
206
207
  │ ├── migrate.mjs # iso-migrate-backed consumer-project migrations
207
208
  │ ├── token-usage-report.mjs # opencode cost analyzer
208
209
  │ └── release/check-source.mjs # version gate for npm publish
@@ -154,6 +154,9 @@ const consumerPkg = {
154
154
  'preflight:plan': 'job-forge preflight:plan',
155
155
  'preflight:check': 'job-forge preflight:check',
156
156
  'preflight:explain': 'job-forge preflight:explain',
157
+ 'postflight:status': 'job-forge postflight:status',
158
+ 'postflight:check': 'job-forge postflight:check',
159
+ 'postflight:explain': 'job-forge postflight:explain',
157
160
  'migrate:plan': 'job-forge migrate:plan',
158
161
  'migrate:apply': 'job-forge migrate:apply',
159
162
  'migrate:check': 'job-forge migrate:check',
@@ -261,6 +264,7 @@ Before doing any work, remember where things live in *this* project:
261
264
  | Local artifact index | \`.jobforge-index.json\` | Deterministic file/line lookup; use \`job-forge index:*\` |
262
265
  | Identity canonicalization | \`templates/canon.json\` | Stable URL/company/role keys; use \`job-forge canon:*\` |
263
266
  | Dispatch preflight policy | \`templates/preflight.json\` | Safe apply rounds/gates; use \`job-forge preflight:*\` |
267
+ | Dispatch postflight policy | \`templates/postflight.json\` | Safe apply settlement; use \`job-forge postflight:*\` |
264
268
  | Consumer migrations | \`templates/migrations.json\` | Safe script/gitignore upgrades; use \`job-forge migrate:*\` |
265
269
  | Scanner config | \`portals.yml\` (project root) | Company configs |
266
270
  | Profile / identity | \`config/profile.yml\` | Candidate name, email, target roles |
@@ -273,7 +277,7 @@ Before doing any work, remember where things live in *this* project:
273
277
  | Batch input / state | \`batch/batch-input.tsv\`, \`batch/batch-state.tsv\` | Personal data |
274
278
  | Generated reports | \`reports/{###}-{company-slug}-{YYYY-MM-DD}.md\` | Gitignored |
275
279
  | Generated PDFs | \`output/\` | Gitignored |
276
- | Templates | \`templates/\` (symlink) | \`cv-template.html\`, \`portals.example.yml\`, \`states.yml\` |
280
+ | Templates | \`templates/\` (symlink) | \`cv-template.html\`, \`portals.example.yml\`, \`states.yml\`, runtime policies |
277
281
  | Harness rules | \`AGENTS.harness.md\` (symlink) | Shared operational guide, loaded via \`opencode.json:instructions\` |
278
282
  | Harness source | \`node_modules/job-forge/\` | Read this for harness internals |
279
283
 
@@ -358,6 +362,9 @@ reports/
358
362
  batch/batch-state.tsv
359
363
  batch/batch-state.tsv.bak
360
364
  batch/batch-input.tsv
365
+ batch/preflight-candidates.json
366
+ batch/preflight-plan.json
367
+ batch/postflight-outcomes.json
361
368
  batch/tracker-additions/
362
369
  !batch/tracker-additions/.gitkeep
363
370
  batch/logs/
@@ -413,6 +420,7 @@ job-forge ledger:status # local deterministic workflow ledger status
413
420
  job-forge index:status # local artifact index status
414
421
  job-forge canon:key company-role --company "Acme, Inc." --role "Senior SWE"
415
422
  job-forge preflight:plan --candidates batch/preflight-candidates.json
423
+ job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
416
424
  job-forge migrate:check # verify consumer package scripts/gitignore are current
417
425
  job-forge pdf cv.md out.pdf
418
426
  job-forge tokens --days 1 # per-session opencode token usage
package/bin/job-forge.mjs CHANGED
@@ -27,6 +27,7 @@
27
27
  * index:* Query local artifacts via iso-index
28
28
  * canon:* Compute deterministic identity keys via iso-canon
29
29
  * preflight:* Plan safe dispatch rounds via iso-preflight
30
+ * postflight:* Settle dispatch outcomes via iso-postflight
30
31
  * migrate:* Apply deterministic consumer-project migrations via iso-migrate
31
32
  * sync Re-run the harness symlink sync (bin/sync.mjs)
32
33
  * help, --help Show this message
@@ -145,6 +146,13 @@ const preflightAliases = {
145
146
  'preflight:path': 'path',
146
147
  };
147
148
 
149
+ const postflightAliases = {
150
+ 'postflight:status': 'status',
151
+ 'postflight:check': 'check',
152
+ 'postflight:explain': 'explain',
153
+ 'postflight:path': 'path',
154
+ };
155
+
148
156
  const migrateAliases = {
149
157
  'migrate:plan': 'plan',
150
158
  'migrate:apply': 'apply',
@@ -209,6 +217,9 @@ Commands:
209
217
  preflight:plan Build bounded dispatch plan from candidate JSON
210
218
  preflight:check Fail if preflight candidates are blocked
211
219
  preflight:explain Show the active preflight workflow policy
220
+ postflight:status Reconcile dispatch plan, outcomes, artifacts, and post-steps
221
+ postflight:check Fail unless a dispatched workflow is fully settled
222
+ postflight:explain Show the active postflight workflow policy
212
223
  migrate:plan Preview deterministic consumer-project migrations
213
224
  migrate:apply Apply deterministic consumer-project migrations
214
225
  migrate:check Fail if migrations are pending
@@ -255,6 +266,8 @@ Pass --help after a command to see its own flags, e.g.:
255
266
  job-forge canon:compare company "OpenAI, Inc." "Open AI"
256
267
  job-forge preflight:plan --candidates batch/preflight-candidates.json
257
268
  job-forge preflight:check --candidates batch/preflight-candidates.json
269
+ job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
270
+ job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
258
271
  job-forge migrate:check
259
272
  job-forge migrate:apply
260
273
 
@@ -416,6 +429,21 @@ if (cmd === 'preflight' || preflightAliases[cmd]) {
416
429
  process.exit(result.status ?? 1);
417
430
  }
418
431
 
432
+ if (cmd === 'postflight' || postflightAliases[cmd]) {
433
+ const postflightArgs = cmd === 'postflight'
434
+ ? (rest.length === 0 ? ['help'] : rest)
435
+ : [postflightAliases[cmd], ...rest];
436
+
437
+ const scriptPath = join(PKG_ROOT, 'scripts/postflight.mjs');
438
+ const result = spawnSync(process.execPath, [scriptPath, ...postflightArgs], {
439
+ stdio: 'inherit',
440
+ cwd: PROJECT_DIR,
441
+ env: process.env,
442
+ });
443
+
444
+ process.exit(result.status ?? 1);
445
+ }
446
+
419
447
  if (cmd === 'migrate' || migrateAliases[cmd]) {
420
448
  const migrateArgs = cmd === 'migrate'
421
449
  ? (rest.length === 0 ? ['help'] : rest)
@@ -32,7 +32,7 @@ my-search/
32
32
  ├── .opencode/skills/job-forge.md # → skill router
33
33
  ├── .opencode/agents/ # → @general-free, @general-paid, @glm-minimal
34
34
  ├── modes/ # → mode files
35
- ├── templates/ # → states.yml, portals.example.yml, cv-template.html, preflight.json
35
+ ├── templates/ # → states.yml, portals.example.yml, cv-template.html, preflight.json, postflight.json
36
36
  ├── batch/batch-prompt.md # → batch worker prompt
37
37
  ├── batch/batch-runner.sh # → parallel orchestrator
38
38
  └── node_modules/job-forge/ # harness, installed from npm
@@ -167,6 +167,7 @@ templates/states.yml → Canonical status values
167
167
  templates/canon.json → Canonical URL/company/role identity keys
168
168
  templates/context.json → Deterministic mode/reference context bundle policy
169
169
  templates/preflight.json → Safe apply dispatch rounds/gates policy
170
+ templates/postflight.json → Safe apply dispatch settlement policy
170
171
  templates/migrations.json → Safe consumer-project upgrade policy
171
172
  templates/cv-template.html → PDF generation template
172
173
  examples/*.md → Fictional layouts only (not read by scripts; see examples/README.md)
@@ -183,6 +184,7 @@ Create `data/pipeline.md` when you start using the URL inbox (`/job-forge pipeli
183
184
  - Index: `.jobforge-index.json` (created on demand by `job-forge index:*`; gitignored local lookup state)
184
185
  - Canon: `templates/canon.json` (identity rules inspected with `job-forge canon:*`)
185
186
  - Preflight: `templates/preflight.json` (dispatch rounds/gates inspected with `job-forge preflight:*`)
187
+ - Postflight: `templates/postflight.json` (dispatch outcomes/artifacts/post-steps inspected with `job-forge postflight:*`)
186
188
  - Migrations: `templates/migrations.json` (applied by `job-forge sync` and inspectable with `job-forge migrate:*`)
187
189
  - Capabilities: `templates/capabilities.json` (role boundary policy inspected with `job-forge capabilities:*`)
188
190
  - Context: `templates/context.json` (mode/reference file bundles inspected with `job-forge context:*`)
@@ -232,6 +234,7 @@ Scripts maintain data consistency. In a consumer project they're invoked via the
232
234
  | `scripts/canon.mjs` | `npx job-forge canon:normalize` / `canon:key` / `canon:compare` | Deterministic `@razroo/iso-canon` identity normalization for URLs, companies, roles, and company+role pairs |
233
235
  | `scripts/context.mjs` | `npx job-forge context:list` / `context:plan` / `context:check` / `context:render` | Deterministic `@razroo/iso-context` mode/reference context bundle planning and rendering |
234
236
  | `scripts/preflight.mjs` | `npx job-forge preflight:plan` / `preflight:check` / `preflight:explain` | Deterministic `@razroo/iso-preflight` dispatch planning for file-backed candidate facts and gates |
237
+ | `scripts/postflight.mjs` | `npx job-forge postflight:status` / `postflight:check` / `postflight:explain` | Deterministic `@razroo/iso-postflight` settlement for dispatch outcomes, required tracker TSV artifacts, and merge/verify post-steps |
235
238
  | `scripts/migrate.mjs` | `npx job-forge migrate:plan` / `migrate:apply` / `migrate:check` | Deterministic `@razroo/iso-migrate` consumer-project upgrades for scripts and generated-artifact ignores |
236
239
  | `tracker-lib.mjs` | _(library)_ | Shared helpers for reading/writing day-based tracker files — imported by merge/dedup/verify/normalize |
237
240
  | `bin/sync.mjs` | `npx job-forge sync` | Creates the harness symlinks in a consumer project and applies safe migrations (also runs as `postinstall`) |
@@ -162,6 +162,10 @@ URL, company, role, and company+role identity rules live in `templates/canon.jso
162
162
 
163
163
  Application dispatch policy lives in `templates/preflight.json` and is planned locally by `@razroo/iso-preflight`. After candidate facts and gate results have been materialized into JSON, use `job-forge preflight:plan --candidates <file>` to get bounded rounds and required pre/post steps, or `job-forge preflight:check --candidates <file>` to fail on missing source facts or blocked gates. This is not an MCP and does not add prompt or tool-schema tokens; it consumes only the candidate JSON you deliberately pass to it.
164
164
 
165
+ ## JobForge postflight settlement
166
+
167
+ Application settlement policy lives in `templates/postflight.json` and is checked locally by `@razroo/iso-postflight`. After each dispatch round, record observed candidate outcomes and tracker TSV artifact paths in `batch/postflight-outcomes.json`, then run `job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json` to get the next safe action. After `merge` and `verify`, add post-step observations and run `job-forge postflight:check ...` to fail unless the workflow is complete. This is not an MCP and does not add prompt or tool-schema tokens.
168
+
165
169
  ## JobForge consumer migrations
166
170
 
167
171
  Consumer-project migrations live in `templates/migrations.json` and are applied locally by `@razroo/iso-migrate`. `job-forge sync` applies safe migrations automatically after refreshing symlinks; use `JOB_FORGE_SKIP_MIGRATIONS=1` to opt out. Use `job-forge migrate:plan`, `job-forge migrate:apply`, and `job-forge migrate:check` to inspect or enforce script/gitignore drift explicitly. This is not an MCP and does not add prompt or tool-schema tokens.
package/docs/README.md CHANGED
@@ -31,7 +31,7 @@ The harness exposes a single CLI (`job-forge`) installed as a `bin` entry. In a
31
31
 
32
32
  | What you need | Where to read |
33
33
  |---------------|---------------|
34
- | Full command list (`verify`, `merge`, `dedup`, `normalize`, `pdf`, `sync-check`, `tokens`, `trace`, `telemetry`, `guard`, `ledger`, `canon`, `context`, `preflight`, `sync`). | [SETUP.md — Tracker and scripts (terminal)](SETUP.md#tracker-and-scripts-terminal). |
34
+ | Full command list (`verify`, `merge`, `dedup`, `normalize`, `pdf`, `sync-check`, `tokens`, `trace`, `telemetry`, `guard`, `ledger`, `canon`, `context`, `preflight`, `postflight`, `sync`). | [SETUP.md — Tracker and scripts (terminal)](SETUP.md#tracker-and-scripts-terminal). |
35
35
  | What each harness `.mjs` script does. | [ARCHITECTURE.md — Pipeline integrity](ARCHITECTURE.md#pipeline-integrity) and the scripts table underneath. |
36
36
  | Batch runner, TSV layout, and `batch/tracker-additions/` merge flow. | [batch/README.md](../batch/README.md). |
37
37
  | PR gate for harness contributions (`npm run verify` + `npm run build:dashboard`). | [CONTRIBUTING.md — Development](../CONTRIBUTING.md#development). |
package/docs/SETUP.md CHANGED
@@ -134,6 +134,8 @@ From your project root, these commands maintain the tracker and pipeline checks.
134
134
  | Inspect local artifact index | `npx job-forge index:status` | `npm run index:status` |
135
135
  | Plan safe application dispatch rounds | `npx job-forge preflight:plan --candidates batch/preflight-candidates.json` | `npm run preflight:plan -- --candidates ...` |
136
136
  | Fail on blocked preflight candidates | `npx job-forge preflight:check --candidates batch/preflight-candidates.json` | `npm run preflight:check -- --candidates ...` |
137
+ | Settle dispatch outcomes after a round | `npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json` | `npm run postflight:status -- --plan ... --outcomes ...` |
138
+ | Fail unless dispatch outcomes and post-steps are complete | `npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json` | `npm run postflight:check -- --plan ... --outcomes ...` |
137
139
  | Inspect pending consumer migrations | `npx job-forge migrate:plan` | `npm run migrate:plan` |
138
140
  | Map status column to canonical labels | `npx job-forge normalize` | `npm run normalize` |
139
141
  | Merge duplicate company/role rows | `npx job-forge dedup` | `npm run dedup` |
@@ -89,6 +89,10 @@ Preflight dispatch plans (terminal, outside opencode):
89
89
  npx job-forge preflight:plan --candidates batch/preflight-candidates.json
90
90
  npx job-forge preflight:check --candidates batch/preflight-candidates.json
91
91
 
92
+ Postflight dispatch settlement (terminal, outside opencode):
93
+ npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
94
+ npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
95
+
92
96
  Consumer migrations (terminal, outside opencode):
93
97
  npx job-forge migrate:plan # preview package.json/.gitignore drift
94
98
  npx job-forge migrate:apply # apply safe harness upgrade migrations
@@ -208,7 +212,7 @@ Step 4 — Materialize and check the dispatch plan
208
212
  decision.
209
213
  - Run npx job-forge preflight:check --candidates <file> to fail on missing
210
214
  sources or blocked gates, then npx job-forge preflight:plan --candidates
211
- <file> to get the bounded round list.
215
+ <file> --json > batch/preflight-plan.json to get the bounded round list.
212
216
  - Follow the emitted rounds. Do not dispatch blocked candidates, and do not
213
217
  replace H2's four-source grep with preflight unless those grep results are
214
218
  present in the candidate JSON.
@@ -227,18 +231,24 @@ Step 5 — Loop in rounds of 2 (Hard Limit #1)
227
231
  # A returned task/session id is only a launch receipt, not completion.
228
232
  # Do not create a "check task status" task; inspect tracker files or
229
233
  # iso-trace if the user asks for status later.
230
- # Read their return values, log outcomes
234
+ # Read their return values, log outcomes in batch/postflight-outcomes.json
235
+ # with candidateId, status, and a tracker-tsv artifact path for every
236
+ # terminal outcome.
237
+ npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
238
+ # Follow the emitted next action before dispatching the next round.
231
239
 
232
- Step 5 — Between rounds: clean sessions again
240
+ Step 6 — Between rounds: clean sessions again
233
241
  - geometra_list_sessions()
234
242
  - geometra_disconnect({ closeBrowser: true })
235
243
 
236
- Step 6 — After all rounds: reconcile outcomes (Hard Limit #6)
244
+ Step 7 — After all rounds: reconcile outcomes (Hard Limit #6)
237
245
  - bash: npx job-forge merge # consumes batch/tracker-additions/*.tsv into the day file
238
246
  - bash: npx job-forge verify # validates URL/status consistency
247
+ - Add merge/verify step observations to batch/postflight-outcomes.json
248
+ - bash: npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
239
249
  - Review output; if verify-pipeline reports issues, fix them before ending.
240
250
 
241
- Step 7 — Aggregate and report
251
+ Step 8 — Aggregate and report
242
252
  - Summarize: applied, skipped, failed
243
253
  - Do NOT re-dispatch failed jobs automatically. Report them to the user.
244
254
  ```
@@ -81,18 +81,21 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
81
81
  - [D16] Treat `templates/preflight.json` as the source of truth for multi-apply dispatch safety. After candidate facts and gates are materialized from authoritative files, run `npx job-forge preflight:plan --candidates <file>` or `npx job-forge preflight:check --candidates <file>` before task dispatch; follow the emitted rounds and pre/post steps. This does not replace H2 four-source grep until those facts are materialized into the candidate JSON.
82
82
  why: `iso-preflight` is not an MCP and adds no prompt/tool-schema tokens; it turns file-backed facts, duplicate/location gates, max-two rounds, and cleanup/merge/verify steps into an executable local plan instead of repeated prose
83
83
 
84
+ - [D17] Treat `templates/postflight.json` as the source of truth for multi-apply dispatch settlement. Save the JSON preflight plan and per-round observed dispatch/outcome/artifact records, then run `npx job-forge postflight:status --plan <plan.json> --outcomes <outcomes.json>` after each round and `npx job-forge postflight:check ...` after merge/verify. Follow its next action instead of inferring completion from subagent prose.
85
+ why: `iso-postflight` is not an MCP and adds no prompt/tool-schema tokens; it makes "round complete", missing TSVs, failed candidates, replacements, merge, and verify an executable local gate instead of repeated orchestration prose
86
+
84
87
  ## Procedure
85
88
 
86
89
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
87
90
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
88
91
  3. Read the active mode file [D3]. Use context bundle checks when changing context loads [D11]. Check cached artifacts before URL/JD refetches [D12]. Use artifact index lookups before broad file reads when they can answer the question [D13]. Use canonical identity keys for duplicate checks [D15]. Use migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
89
92
  4. Prepare Geometra dispatches: cleanup [H3], canon/index/ledger prefilter when useful [D8, D13, D15], dedupe [H2], location filter [D5], materialize candidate facts/gates and run preflight plan/check [D16], routing [D2, D10], proxy prompt hygiene [H8].
90
- 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
93
+ 5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b], then settle the round with postflight status [D17].
91
94
  6. Keep multi-job form-filling out of the orchestrator [H4].
92
95
  7. Cross-check subagent facts against authoritative files [H7].
93
96
  8. Apply score gate [D4].
94
97
  9. Merge contract-validated TSV outcomes [H6, D9].
95
- 10. Verify tracker before ending [H6].
98
+ 10. Verify tracker and run postflight check before ending [H6, D17].
96
99
 
97
100
  ## Routing
98
101
 
@@ -0,0 +1,29 @@
1
+ import { readFileSync } from 'fs';
2
+ import { join } from 'path';
3
+ import {
4
+ loadPostflightConfig,
5
+ parseJson,
6
+ settlePostflight,
7
+ } from '@razroo/iso-postflight';
8
+
9
+ export const POSTFLIGHT_CONFIG_FILE = 'templates/postflight.json';
10
+ export const POSTFLIGHT_WORKFLOW = 'jobforge.apply';
11
+
12
+ export function resolveProjectDir(projectDir = process.env.JOB_FORGE_PROJECT || process.cwd()) {
13
+ return projectDir;
14
+ }
15
+
16
+ export function jobForgePostflightConfigPath(projectDir = resolveProjectDir()) {
17
+ return process.env.JOB_FORGE_POSTFLIGHT_CONFIG || join(projectDir, POSTFLIGHT_CONFIG_FILE);
18
+ }
19
+
20
+ export function readJobForgePostflightConfig(projectDir = resolveProjectDir()) {
21
+ const path = jobForgePostflightConfigPath(projectDir);
22
+ return loadPostflightConfig(parseJson(readFileSync(path, 'utf8'), path));
23
+ }
24
+
25
+ export function settleJobForgePostflight(planInput, observationsInput, options = {}, projectDir = resolveProjectDir()) {
26
+ return settlePostflight(readJobForgePostflightConfig(projectDir), planInput, observationsInput, {
27
+ workflow: options.workflow || POSTFLIGHT_WORKFLOW,
28
+ });
29
+ }
package/modes/apply.md CHANGED
@@ -188,11 +188,18 @@ Step 4 — For round in ceil(N/2):
188
188
  task(apply to pair[1]) # only if pair has 2
189
189
  # WAIT for both final outcomes. A session id is not completion.
190
190
  # Do not dispatch round N+1 while round N is still in flight.
191
- Step 5 — Between rounds: geometra_list_sessions() + geometra_disconnect({closeBrowser: true})
192
- Step 6 — Reconcile outcomes (Hard Limit #6):
191
+ Step 5 — After each round:
192
+ write/update batch/postflight-outcomes.json with candidateId, status,
193
+ and tracker-tsv artifact path for every terminal outcome.
194
+ bash: npx job-forge postflight:status --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
195
+ follow the emitted next action before the next dispatch.
196
+ Step 6 — Between rounds: geometra_list_sessions() + geometra_disconnect({closeBrowser: true})
197
+ Step 7 — Reconcile outcomes (Hard Limit #6):
193
198
  bash: npx job-forge merge # TSVs → day file
194
199
  bash: npx job-forge verify # validate
195
- Step 7 — Summarize outcomes; do NOT auto-retry failures.
200
+ add merge/verify step observations to batch/postflight-outcomes.json
201
+ bash: npx job-forge postflight:check --plan batch/preflight-plan.json --outcomes batch/postflight-outcomes.json
202
+ Step 8 — Summarize outcomes; do NOT auto-retry failures.
196
203
  ```
197
204
 
198
205
  If a subagent fails, report it in the summary and let the user decide whether to retry. Never auto-retry — re-running a submit step risks duplicate applications. If a subagent returns SKIP because it discovered a duplicate, treat that as a missed preflight check: finish the current round, then choose a replacement candidate only after re-running dedupe against all four sources.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "job-forge",
3
- "version": "2.14.28",
3
+ "version": "2.14.29",
4
4
  "description": "AI-powered job search pipeline built on opencode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -62,6 +62,9 @@
62
62
  "preflight:plan": "node bin/job-forge.mjs preflight:plan",
63
63
  "preflight:check": "node bin/job-forge.mjs preflight:check",
64
64
  "preflight:explain": "node bin/job-forge.mjs preflight:explain",
65
+ "postflight:status": "node bin/job-forge.mjs postflight:status",
66
+ "postflight:check": "node bin/job-forge.mjs postflight:check",
67
+ "postflight:explain": "node bin/job-forge.mjs postflight:explain",
65
68
  "migrate:plan": "node bin/job-forge.mjs migrate:plan",
66
69
  "migrate:apply": "node bin/job-forge.mjs migrate:apply",
67
70
  "migrate:check": "node bin/job-forge.mjs migrate:check",
@@ -132,9 +135,9 @@
132
135
  "node": ">=20.6.0"
133
136
  },
134
137
  "dependencies": {
135
- "@razroo/iso-capabilities": "^0.1.0",
136
138
  "@razroo/iso-cache": "^0.1.0",
137
139
  "@razroo/iso-canon": "^0.1.0",
140
+ "@razroo/iso-capabilities": "^0.1.0",
138
141
  "@razroo/iso-context": "^0.1.0",
139
142
  "@razroo/iso-contract": "^0.1.0",
140
143
  "@razroo/iso-guard": "^0.1.0",
@@ -142,6 +145,7 @@
142
145
  "@razroo/iso-ledger": "^0.1.0",
143
146
  "@razroo/iso-migrate": "^0.1.0",
144
147
  "@razroo/iso-orchestrator": "^0.1.0",
148
+ "@razroo/iso-postflight": "^0.1.0",
145
149
  "@razroo/iso-preflight": "^0.1.0",
146
150
  "@razroo/iso-trace": "^0.4.0",
147
151
  "playwright": "^1.58.1"
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync } from 'fs';
4
+ import { isAbsolute, relative, resolve } from 'path';
5
+ import {
6
+ formatConfigSummary,
7
+ formatPostflightResult,
8
+ loadPostflightConfig,
9
+ parseJson,
10
+ settlePostflight,
11
+ } from '@razroo/iso-postflight';
12
+ import { PROJECT_DIR } from '../tracker-lib.mjs';
13
+ import {
14
+ jobForgePostflightConfigPath,
15
+ readJobForgePostflightConfig,
16
+ settleJobForgePostflight,
17
+ } from '../lib/jobforge-postflight.mjs';
18
+
19
+ const USAGE = `job-forge postflight - deterministic dispatch settlement for JobForge
20
+
21
+ Usage:
22
+ job-forge postflight:status --plan <file> --outcomes <file> [--workflow jobforge.apply] [--json]
23
+ job-forge postflight:check --plan <file> --outcomes <file> [--workflow jobforge.apply] [--json]
24
+ job-forge postflight:explain [--json]
25
+ job-forge postflight:path
26
+
27
+ Plan files are JSON objects with rounds, such as the JSON output from
28
+ job-forge preflight:plan. Outcome files are JSON objects with dispatches,
29
+ outcomes, and post-step observations. The policy is templates/postflight.json.
30
+ This is local project state, not an MCP and not prompt context.`;
31
+
32
+ const [cmd = 'help', ...rawArgs] = process.argv.slice(2);
33
+ const opts = parseArgs(rawArgs);
34
+
35
+ if (opts.help || cmd === 'help' || cmd === '--help' || cmd === '-h') {
36
+ console.log(USAGE);
37
+ process.exit(0);
38
+ }
39
+
40
+ try {
41
+ if (cmd === 'path') {
42
+ console.log(configPath(opts));
43
+ } else if (cmd === 'status' || cmd === 'check') {
44
+ runSettlement(cmd, opts);
45
+ } else if (cmd === 'explain') {
46
+ explain(opts);
47
+ } else {
48
+ console.error(`unknown postflight command "${cmd}"\n`);
49
+ console.error(USAGE);
50
+ process.exit(2);
51
+ }
52
+ } catch (error) {
53
+ console.error(error instanceof Error ? error.message : String(error));
54
+ process.exit(1);
55
+ }
56
+
57
+ function parseArgs(args) {
58
+ const opts = {
59
+ json: false,
60
+ help: false,
61
+ };
62
+
63
+ for (let i = 0; i < args.length; i++) {
64
+ const arg = args[i];
65
+ if (arg === '--json') {
66
+ opts.json = true;
67
+ } else if (arg === '--plan' || arg === '-p') {
68
+ opts.plan = valueAfter(args, ++i, arg);
69
+ } else if (arg.startsWith('--plan=')) {
70
+ opts.plan = arg.slice('--plan='.length);
71
+ } else if (arg === '--outcomes' || arg === '--observations' || arg === '-o') {
72
+ opts.outcomes = valueAfter(args, ++i, arg);
73
+ } else if (arg.startsWith('--outcomes=')) {
74
+ opts.outcomes = arg.slice('--outcomes='.length);
75
+ } else if (arg.startsWith('--observations=')) {
76
+ opts.outcomes = arg.slice('--observations='.length);
77
+ } else if (arg === '--workflow') {
78
+ opts.workflow = valueAfter(args, ++i, '--workflow');
79
+ } else if (arg.startsWith('--workflow=')) {
80
+ opts.workflow = arg.slice('--workflow='.length);
81
+ } else if (arg === '--config') {
82
+ opts.config = valueAfter(args, ++i, '--config');
83
+ } else if (arg.startsWith('--config=')) {
84
+ opts.config = arg.slice('--config='.length);
85
+ } else if (arg === '--help' || arg === '-h') {
86
+ opts.help = true;
87
+ } else {
88
+ throw new Error(`unknown flag "${arg}"`);
89
+ }
90
+ }
91
+
92
+ return opts;
93
+ }
94
+
95
+ function runSettlement(mode, opts) {
96
+ if (!opts.plan) throw new Error(`${mode} requires --plan <file>`);
97
+ if (!opts.outcomes) throw new Error(`${mode} requires --outcomes <file>`);
98
+ const plan = readJsonFile(resolveInputPath(opts.plan));
99
+ const observations = readJsonFile(resolveInputPath(opts.outcomes));
100
+ const result = opts.config
101
+ ? settlePostflight(readConfig(opts), plan, observations, { workflow: opts.workflow })
102
+ : settleJobForgePostflight(plan, observations, { workflow: opts.workflow }, PROJECT_DIR);
103
+
104
+ if (opts.json) {
105
+ console.log(JSON.stringify(result, null, 2));
106
+ } else {
107
+ console.log(formatPostflightResult(result, mode));
108
+ }
109
+
110
+ if (mode === 'check' && !result.ok) process.exit(1);
111
+ }
112
+
113
+ function explain(opts) {
114
+ const config = readConfig(opts);
115
+ if (opts.json) {
116
+ console.log(JSON.stringify(config, null, 2));
117
+ return;
118
+ }
119
+ console.log(`config: ${relativePath(configPath(opts))}`);
120
+ console.log(formatConfigSummary(config));
121
+ }
122
+
123
+ function readConfig(opts) {
124
+ if (opts.config) {
125
+ const path = resolveInputPath(opts.config);
126
+ return loadPostflightConfig(readJsonFile(path));
127
+ }
128
+ return readJobForgePostflightConfig(PROJECT_DIR);
129
+ }
130
+
131
+ function configPath(opts) {
132
+ return opts.config ? resolveInputPath(opts.config) : jobForgePostflightConfigPath(PROJECT_DIR);
133
+ }
134
+
135
+ function readJsonFile(path) {
136
+ return parseJson(readFileSync(path, 'utf8'), path);
137
+ }
138
+
139
+ function valueAfter(values, index, flag) {
140
+ const value = values[index];
141
+ if (!value || value.startsWith('--')) throw new Error(`${flag} requires a value`);
142
+ return value;
143
+ }
144
+
145
+ function resolveInputPath(path) {
146
+ return isAbsolute(path) ? path : resolve(PROJECT_DIR, path);
147
+ }
148
+
149
+ function relativePath(path) {
150
+ return relative(PROJECT_DIR, path) || '.';
151
+ }
@@ -40,6 +40,9 @@
40
40
  "preflight:plan": "job-forge preflight:plan",
41
41
  "preflight:check": "job-forge preflight:check",
42
42
  "preflight:explain": "job-forge preflight:explain",
43
+ "postflight:status": "job-forge postflight:status",
44
+ "postflight:check": "job-forge postflight:check",
45
+ "postflight:explain": "job-forge postflight:explain",
43
46
  "migrate:plan": "job-forge migrate:plan",
44
47
  "migrate:apply": "job-forge migrate:apply",
45
48
  "migrate:check": "job-forge migrate:check",
@@ -61,7 +64,10 @@
61
64
  ".jobforge-runs/",
62
65
  ".jobforge-ledger/",
63
66
  ".jobforge-cache/",
64
- ".jobforge-index.json"
67
+ ".jobforge-index.json",
68
+ "batch/preflight-candidates.json",
69
+ "batch/preflight-plan.json",
70
+ "batch/postflight-outcomes.json"
65
71
  ]
66
72
  }
67
73
  ]
@@ -0,0 +1,79 @@
1
+ {
2
+ "version": 1,
3
+ "workflows": [
4
+ {
5
+ "name": "jobforge.apply",
6
+ "description": "Settle JobForge application dispatch rounds after subagents return outcomes.",
7
+ "terminalStatuses": [
8
+ "APPLIED",
9
+ "Applied",
10
+ "APPLY FAILED",
11
+ "Apply Failed",
12
+ "FAILED",
13
+ "Failed",
14
+ "SKIP",
15
+ "Skip",
16
+ "Skipped",
17
+ "Discarded"
18
+ ],
19
+ "successStatuses": [
20
+ "APPLIED",
21
+ "Applied"
22
+ ],
23
+ "failureStatuses": [
24
+ "APPLY FAILED",
25
+ "Apply Failed",
26
+ "FAILED",
27
+ "Failed"
28
+ ],
29
+ "skipStatuses": [
30
+ "SKIP",
31
+ "Skip",
32
+ "Skipped",
33
+ "Discarded"
34
+ ],
35
+ "inFlightStatuses": [
36
+ "running",
37
+ "in-flight",
38
+ "started",
39
+ "pending"
40
+ ],
41
+ "replacementStatuses": [
42
+ "APPLY FAILED",
43
+ "Apply Failed",
44
+ "FAILED",
45
+ "Failed"
46
+ ],
47
+ "requiredArtifacts": [
48
+ {
49
+ "id": "tracker-tsv",
50
+ "label": "Tracker TSV outcome",
51
+ "statuses": [
52
+ "APPLIED",
53
+ "Applied",
54
+ "APPLY FAILED",
55
+ "Apply Failed",
56
+ "FAILED",
57
+ "Failed",
58
+ "SKIP",
59
+ "Skip",
60
+ "Skipped",
61
+ "Discarded"
62
+ ]
63
+ }
64
+ ],
65
+ "postSteps": [
66
+ {
67
+ "id": "merge",
68
+ "label": "Merge tracker TSV outcomes",
69
+ "command": "npx job-forge merge"
70
+ },
71
+ {
72
+ "id": "verify",
73
+ "label": "Verify tracker integrity",
74
+ "command": "npx job-forge verify"
75
+ }
76
+ ]
77
+ }
78
+ ]
79
+ }