job-forge 2.14.26 → 2.14.28

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.
@@ -12,7 +12,7 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
12
12
  - [H1] Max 2 parallel `task` dispatches per message. For N jobs, run `ceil(N/2)` sequential rounds of 2. A round is not complete until both subagents return a final outcome (`APPLIED`, `APPLY FAILED`, `SKIP`, `Discarded`, or a written TSV path). A `task` tool result that only gives a session id / title is a launch acknowledgement, not completion. Applies in all modes, for all user phrasings ("urgent", "apply to 10 jobs now").
13
13
  why: each subagent requires post-cleanup and racing more than 2 reliably loses at least one result. On 2026-04-25 the orchestrator launched round 2 while round 1 had only returned task ids, leaving four application subagents in flight and losing two provider recoveries
14
14
 
15
- - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
15
+ - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. Use `npx job-forge canon:key company-role --company "..." --role "..."` when deriving a stable duplicate key; do not invent slugs in prose. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
16
16
  why: 2026-04 same-day batch collision — when two batches target the same role, `npx job-forge merge` updates the existing day-file row rather than appending, so grepping day files alone misses earlier-batch applies; merged/*.tsv is the only place the breadcrumb remains
17
17
 
18
18
  - [H3] Before every batch of `task` dispatches that will use Geometra, call `geometra_list_sessions` then `geometra_disconnect({closeBrowser: true})`. Every round, no exceptions. Name this cleanup as an explicit "step 0" in your first-response plan for any multi-apply request — it is the most frequently skipped guardrail in practice, and skipping it produces cascade "Not connected" failures on the next dispatch.
@@ -80,12 +80,18 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
80
80
  - [D14] Treat `templates/migrations.json` as the source of truth for consumer-project upgrades. Use `npx job-forge migrate:plan` or `npx job-forge migrate:check` when diagnosing harness drift; `job-forge sync` applies safe migrations automatically unless `JOB_FORGE_SKIP_MIGRATIONS=1` is set.
81
81
  why: `iso-migrate` is not an MCP and adds no prompt/tool-schema tokens; it prevents stale consumer scripts and generated-artifact ignores without asking agents to hand-edit package.json
82
82
 
83
+ - [D15] Treat `templates/canon.json` as the source of truth for URL/company/role identity keys. Use `npx job-forge canon:key ...` or `npx job-forge canon:compare ...` before broad duplicate checks when a stable key or same/possible/different decision is useful.
84
+ why: `iso-canon` is not an MCP and adds no prompt/tool-schema tokens; it centralizes duplicate-key rules so agents do not repeatedly derive inconsistent slugs for aliases, suffixes, remote/location noise, or tracking URLs
85
+
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
+ 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
+
83
89
  ## Procedure
84
90
 
85
91
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
86
92
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
87
- 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 migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
88
- 4. Prepare Geometra dispatches: cleanup [H3], index/ledger prefilter when useful [D8, D13], dedupe [H2], location filter [D5], routing [D2, D10], proxy prompt hygiene [H8].
93
+ 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
+ 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].
89
95
  5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
90
96
  6. Keep multi-job form-filling out of the orchestrator [H4].
91
97
  7. Cross-check subagent facts against authoritative files [H7].
@@ -78,6 +78,14 @@ Local artifact index (terminal, outside opencode):
78
78
  npx job-forge index:has --key "company-role:acme:staff-engineer"
79
79
  npx job-forge index:query "acme"
80
80
 
81
+ Identity keys (terminal, outside opencode):
82
+ npx job-forge canon:key company-role --company "Acme" --role "Staff Engineer"
83
+ npx job-forge canon:compare company "OpenAI, Inc." "Open AI"
84
+
85
+ Preflight dispatch plans (terminal, outside opencode):
86
+ npx job-forge preflight:plan --candidates batch/preflight-candidates.json
87
+ npx job-forge preflight:check --candidates batch/preflight-candidates.json
88
+
81
89
  Consumer migrations (terminal, outside opencode):
82
90
  npx job-forge migrate:plan # preview package.json/.gitignore drift
83
91
  npx job-forge migrate:apply # apply safe harness upgrade migrations
@@ -168,11 +176,13 @@ Step 1 — Enumerate candidates
168
176
  - Build ordered list: candidates = [job_1, job_2, ..., job_N]
169
177
 
170
178
  Step 2 — Dedup against already-applied
171
- - Run npx job-forge index:has --key "company-role:<company-slug>:<role-slug>"
172
- as a fast local artifact prefilter when company+role is known. It rebuilds
173
- .jobforge-index.json on demand from templates/index.json. A hit means the
174
- role has already appeared in tracker files or tracker TSVs and can be
175
- dropped before dispatch.
179
+ - Derive the stable key with npx job-forge canon:key company-role --company
180
+ "<company>" --role "<role>" when company+role is known.
181
+ - Run npx job-forge index:has --key "<canon-key>" as a fast local artifact
182
+ prefilter. It rebuilds .jobforge-index.json on demand from
183
+ templates/index.json and canonicalizes indexed company/role records through
184
+ templates/canon.json. A hit means the role has already appeared in tracker
185
+ files or tracker TSVs and can be dropped before dispatch.
176
186
  - If .jobforge-ledger/events.jsonl exists, use npx job-forge ledger:has as a
177
187
  fast prefilter for obvious company+role Applied duplicates. A ledger match
178
188
  can be dropped before dispatch without loading tracker files into context.
@@ -188,7 +198,19 @@ Step 3 — Pre-flight cleanup (once, before the loop)
188
198
  - geometra_list_sessions()
189
199
  - geometra_disconnect({ closeBrowser: true })
190
200
 
191
- Step 4 — Loop in rounds of 2 (Hard Limit #1)
201
+ Step 4 — Materialize and check the dispatch plan
202
+ - Write file-backed candidate facts/gates to batch/preflight-candidates.json
203
+ (or another explicit JSON file). Include source paths for company, role,
204
+ companyRoleKey, URL, score, duplicate/location gates, and any skip/block
205
+ decision.
206
+ - Run npx job-forge preflight:check --candidates <file> to fail on missing
207
+ sources or blocked gates, then npx job-forge preflight:plan --candidates
208
+ <file> to get the bounded round list.
209
+ - Follow the emitted rounds. Do not dispatch blocked candidates, and do not
210
+ replace H2's four-source grep with preflight unless those grep results are
211
+ present in the candidate JSON.
212
+
213
+ Step 5 — Loop in rounds of 2 (Hard Limit #1)
192
214
  for round in ceil(len(candidates) / 2):
193
215
  pair = candidates[round*2 : round*2 + 2]
194
216
  # If proxy is configured, do not paste proxy values into prompts.
package/AGENTS.md CHANGED
@@ -7,7 +7,7 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
7
7
  - [H1] Max 2 parallel `task` dispatches per message. For N jobs, run `ceil(N/2)` sequential rounds of 2. A round is not complete until both subagents return a final outcome (`APPLIED`, `APPLY FAILED`, `SKIP`, `Discarded`, or a written TSV path). A `task` tool result that only gives a session id / title is a launch acknowledgement, not completion. Applies in all modes, for all user phrasings ("urgent", "apply to 10 jobs now").
8
8
  why: each subagent requires post-cleanup and racing more than 2 reliably loses at least one result. On 2026-04-25 the orchestrator launched round 2 while round 1 had only returned task ids, leaving four application subagents in flight and losing two provider recoveries
9
9
 
10
- - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
10
+ - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. Use `npx job-forge canon:key company-role --company "..." --role "..."` when deriving a stable duplicate key; do not invent slugs in prose. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
11
11
  why: 2026-04 same-day batch collision — when two batches target the same role, `npx job-forge merge` updates the existing day-file row rather than appending, so grepping day files alone misses earlier-batch applies; merged/*.tsv is the only place the breadcrumb remains
12
12
 
13
13
  - [H3] Before every batch of `task` dispatches that will use Geometra, call `geometra_list_sessions` then `geometra_disconnect({closeBrowser: true})`. Every round, no exceptions. Name this cleanup as an explicit "step 0" in your first-response plan for any multi-apply request — it is the most frequently skipped guardrail in practice, and skipping it produces cascade "Not connected" failures on the next dispatch.
@@ -75,12 +75,18 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
75
75
  - [D14] Treat `templates/migrations.json` as the source of truth for consumer-project upgrades. Use `npx job-forge migrate:plan` or `npx job-forge migrate:check` when diagnosing harness drift; `job-forge sync` applies safe migrations automatically unless `JOB_FORGE_SKIP_MIGRATIONS=1` is set.
76
76
  why: `iso-migrate` is not an MCP and adds no prompt/tool-schema tokens; it prevents stale consumer scripts and generated-artifact ignores without asking agents to hand-edit package.json
77
77
 
78
+ - [D15] Treat `templates/canon.json` as the source of truth for URL/company/role identity keys. Use `npx job-forge canon:key ...` or `npx job-forge canon:compare ...` before broad duplicate checks when a stable key or same/possible/different decision is useful.
79
+ why: `iso-canon` is not an MCP and adds no prompt/tool-schema tokens; it centralizes duplicate-key rules so agents do not repeatedly derive inconsistent slugs for aliases, suffixes, remote/location noise, or tracking URLs
80
+
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
+ 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
+
78
84
  ## Procedure
79
85
 
80
86
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
81
87
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
82
- 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 migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
83
- 4. Prepare Geometra dispatches: cleanup [H3], index/ledger prefilter when useful [D8, D13], dedupe [H2], location filter [D5], routing [D2, D10], proxy prompt hygiene [H8].
88
+ 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
+ 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].
84
90
  5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
85
91
  6. Keep multi-job form-filling out of the orchestrator [H4].
86
92
  7. Cross-check subagent facts against authoritative files [H7].
package/CLAUDE.md CHANGED
@@ -7,7 +7,7 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
7
7
  - [H1] Max 2 parallel `task` dispatches per message. For N jobs, run `ceil(N/2)` sequential rounds of 2. A round is not complete until both subagents return a final outcome (`APPLIED`, `APPLY FAILED`, `SKIP`, `Discarded`, or a written TSV path). A `task` tool result that only gives a session id / title is a launch acknowledgement, not completion. Applies in all modes, for all user phrasings ("urgent", "apply to 10 jobs now").
8
8
  why: each subagent requires post-cleanup and racing more than 2 reliably loses at least one result. On 2026-04-25 the orchestrator launched round 2 while round 1 had only returned task ids, leaving four application subagents in flight and losing two provider recoveries
9
9
 
10
- - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
10
+ - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. Use `npx job-forge canon:key company-role --company "..." --role "..."` when deriving a stable duplicate key; do not invent slugs in prose. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
11
11
  why: 2026-04 same-day batch collision — when two batches target the same role, `npx job-forge merge` updates the existing day-file row rather than appending, so grepping day files alone misses earlier-batch applies; merged/*.tsv is the only place the breadcrumb remains
12
12
 
13
13
  - [H3] Before every batch of `task` dispatches that will use Geometra, call `geometra_list_sessions` then `geometra_disconnect({closeBrowser: true})`. Every round, no exceptions. Name this cleanup as an explicit "step 0" in your first-response plan for any multi-apply request — it is the most frequently skipped guardrail in practice, and skipping it produces cascade "Not connected" failures on the next dispatch.
@@ -75,12 +75,18 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
75
75
  - [D14] Treat `templates/migrations.json` as the source of truth for consumer-project upgrades. Use `npx job-forge migrate:plan` or `npx job-forge migrate:check` when diagnosing harness drift; `job-forge sync` applies safe migrations automatically unless `JOB_FORGE_SKIP_MIGRATIONS=1` is set.
76
76
  why: `iso-migrate` is not an MCP and adds no prompt/tool-schema tokens; it prevents stale consumer scripts and generated-artifact ignores without asking agents to hand-edit package.json
77
77
 
78
+ - [D15] Treat `templates/canon.json` as the source of truth for URL/company/role identity keys. Use `npx job-forge canon:key ...` or `npx job-forge canon:compare ...` before broad duplicate checks when a stable key or same/possible/different decision is useful.
79
+ why: `iso-canon` is not an MCP and adds no prompt/tool-schema tokens; it centralizes duplicate-key rules so agents do not repeatedly derive inconsistent slugs for aliases, suffixes, remote/location noise, or tracking URLs
80
+
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
+ 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
+
78
84
  ## Procedure
79
85
 
80
86
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
81
87
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
82
- 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 migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
83
- 4. Prepare Geometra dispatches: cleanup [H3], index/ledger prefilter when useful [D8, D13], dedupe [H2], location filter [D5], routing [D2, D10], proxy prompt hygiene [H8].
88
+ 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
+ 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].
84
90
  5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
85
91
  6. Keep multi-job form-filling out of the orchestrator [H4].
86
92
  7. Cross-check subagent facts against authoritative files [H7].
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/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/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/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 + Ledger + Capabilities + Context + Cache + Index + 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 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, 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 + 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. |
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, capabilities.json, context.json, index.json, migrations.json
167
+ ├── templates/ # → states.yml, portals.example.yml, cv-template.html, canon.json, capabilities.json, context.json, index.json, preflight.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, capabilities.json, context.json, migrations.json
193
+ ├── templates/ # cv-template.html, portals.example.yml, states.yml, canon.json, capabilities.json, context.json, preflight.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/
@@ -201,6 +201,8 @@ JobForge/
201
201
  │ ├── context.mjs # iso-context-backed context bundle CLI
202
202
  │ ├── cache.mjs # iso-cache-backed local artifact cache CLI
203
203
  │ ├── index.mjs # iso-index-backed artifact lookup CLI
204
+ │ ├── canon.mjs # iso-canon-backed identity normalization CLI
205
+ │ ├── preflight.mjs # iso-preflight-backed dispatch planning CLI
204
206
  │ ├── migrate.mjs # iso-migrate-backed consumer-project migrations
205
207
  │ ├── token-usage-report.mjs # opencode cost analyzer
206
208
  │ └── release/check-source.mjs # version gate for npm publish
@@ -147,6 +147,13 @@ const consumerPkg = {
147
147
  'index:has': 'job-forge index:has',
148
148
  'index:query': 'job-forge index:query',
149
149
  'index:explain': 'job-forge index:explain',
150
+ 'canon:normalize': 'job-forge canon:normalize',
151
+ 'canon:key': 'job-forge canon:key',
152
+ 'canon:compare': 'job-forge canon:compare',
153
+ 'canon:explain': 'job-forge canon:explain',
154
+ 'preflight:plan': 'job-forge preflight:plan',
155
+ 'preflight:check': 'job-forge preflight:check',
156
+ 'preflight:explain': 'job-forge preflight:explain',
150
157
  'migrate:plan': 'job-forge migrate:plan',
151
158
  'migrate:apply': 'job-forge migrate:apply',
152
159
  'migrate:check': 'job-forge migrate:check',
@@ -252,6 +259,8 @@ Before doing any work, remember where things live in *this* project:
252
259
  | Scanner dedup history | \`data/scan-history.tsv\` | Only touch in \`/job-forge scan\` |
253
260
  | Local workflow ledger | \`.jobforge-ledger/events.jsonl\` | Deterministic append-only state; use \`job-forge ledger:*\` |
254
261
  | Local artifact index | \`.jobforge-index.json\` | Deterministic file/line lookup; use \`job-forge index:*\` |
262
+ | Identity canonicalization | \`templates/canon.json\` | Stable URL/company/role keys; use \`job-forge canon:*\` |
263
+ | Dispatch preflight policy | \`templates/preflight.json\` | Safe apply rounds/gates; use \`job-forge preflight:*\` |
255
264
  | Consumer migrations | \`templates/migrations.json\` | Safe script/gitignore upgrades; use \`job-forge migrate:*\` |
256
265
  | Scanner config | \`portals.yml\` (project root) | Company configs |
257
266
  | Profile / identity | \`config/profile.yml\` | Candidate name, email, target roles |
@@ -402,6 +411,8 @@ job-forge merge # merge batch/tracker-additions/*.tsv into the tracke
402
411
  job-forge verify # verify pipeline integrity
403
412
  job-forge ledger:status # local deterministic workflow ledger status
404
413
  job-forge index:status # local artifact index status
414
+ job-forge canon:key company-role --company "Acme, Inc." --role "Senior SWE"
415
+ job-forge preflight:plan --candidates batch/preflight-candidates.json
405
416
  job-forge migrate:check # verify consumer package scripts/gitignore are current
406
417
  job-forge pdf cv.md out.pdf
407
418
  job-forge tokens --days 1 # per-session opencode token usage
package/bin/job-forge.mjs CHANGED
@@ -25,6 +25,8 @@
25
25
  * context:* Query/render deterministic context bundles via iso-context
26
26
  * cache:* Reuse local deterministic artifacts via iso-cache
27
27
  * index:* Query local artifacts via iso-index
28
+ * canon:* Compute deterministic identity keys via iso-canon
29
+ * preflight:* Plan safe dispatch rounds via iso-preflight
28
30
  * migrate:* Apply deterministic consumer-project migrations via iso-migrate
29
31
  * sync Re-run the harness symlink sync (bin/sync.mjs)
30
32
  * help, --help Show this message
@@ -128,6 +130,21 @@ const indexAliases = {
128
130
  'index:path': 'path',
129
131
  };
130
132
 
133
+ const canonAliases = {
134
+ 'canon:normalize': 'normalize',
135
+ 'canon:key': 'key',
136
+ 'canon:compare': 'compare',
137
+ 'canon:explain': 'explain',
138
+ 'canon:path': 'path',
139
+ };
140
+
141
+ const preflightAliases = {
142
+ 'preflight:plan': 'plan',
143
+ 'preflight:check': 'check',
144
+ 'preflight:explain': 'explain',
145
+ 'preflight:path': 'path',
146
+ };
147
+
131
148
  const migrateAliases = {
132
149
  'migrate:plan': 'plan',
133
150
  'migrate:apply': 'apply',
@@ -186,6 +203,12 @@ Commands:
186
203
  index:has Check indexed URL/company-role/report facts without loading source files
187
204
  index:query Query indexed reports, tracker rows, TSVs, scan history, pipeline, and ledger
188
205
  index:verify Validate local artifact index integrity
206
+ canon:key Print stable URL/company/role/company-role keys
207
+ canon:compare Compare two identifiers as same/possible/different
208
+ canon:explain Show the active identity canonicalization policy
209
+ preflight:plan Build bounded dispatch plan from candidate JSON
210
+ preflight:check Fail if preflight candidates are blocked
211
+ preflight:explain Show the active preflight workflow policy
189
212
  migrate:plan Preview deterministic consumer-project migrations
190
213
  migrate:apply Apply deterministic consumer-project migrations
191
214
  migrate:check Fail if migrations are pending
@@ -228,6 +251,10 @@ Pass --help after a command to see its own flags, e.g.:
228
251
  job-forge cache:put --url https://example.test/jobs/123 --input @jds/example.md
229
252
  job-forge index:has --key "company-role:acme:staff-engineer"
230
253
  job-forge index:query "acme"
254
+ job-forge canon:key company-role --company "Acme, Inc." --role "Senior SWE - Remote US"
255
+ job-forge canon:compare company "OpenAI, Inc." "Open AI"
256
+ job-forge preflight:plan --candidates batch/preflight-candidates.json
257
+ job-forge preflight:check --candidates batch/preflight-candidates.json
231
258
  job-forge migrate:check
232
259
  job-forge migrate:apply
233
260
 
@@ -359,6 +386,36 @@ if (cmd === 'index' || indexAliases[cmd]) {
359
386
  process.exit(result.status ?? 1);
360
387
  }
361
388
 
389
+ if (cmd === 'canon' || canonAliases[cmd]) {
390
+ const canonArgs = cmd === 'canon'
391
+ ? (rest.length === 0 ? ['help'] : rest)
392
+ : [canonAliases[cmd], ...rest];
393
+
394
+ const scriptPath = join(PKG_ROOT, 'scripts/canon.mjs');
395
+ const result = spawnSync(process.execPath, [scriptPath, ...canonArgs], {
396
+ stdio: 'inherit',
397
+ cwd: PROJECT_DIR,
398
+ env: process.env,
399
+ });
400
+
401
+ process.exit(result.status ?? 1);
402
+ }
403
+
404
+ if (cmd === 'preflight' || preflightAliases[cmd]) {
405
+ const preflightArgs = cmd === 'preflight'
406
+ ? (rest.length === 0 ? ['help'] : rest)
407
+ : [preflightAliases[cmd], ...rest];
408
+
409
+ const scriptPath = join(PKG_ROOT, 'scripts/preflight.mjs');
410
+ const result = spawnSync(process.execPath, [scriptPath, ...preflightArgs], {
411
+ stdio: 'inherit',
412
+ cwd: PROJECT_DIR,
413
+ env: process.env,
414
+ });
415
+
416
+ process.exit(result.status ?? 1);
417
+ }
418
+
362
419
  if (cmd === 'migrate' || migrateAliases[cmd]) {
363
420
  const migrateArgs = cmd === 'migrate'
364
421
  ? (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
35
+ ├── templates/ # → states.yml, portals.example.yml, cv-template.html, preflight.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
@@ -164,7 +164,9 @@ data/pipeline.md → Pending URLs and `local:jds/...` inbox (see modes/p
164
164
  .jobforge-index.json → Deterministic artifact lookup index built from templates/index.json
165
165
  jds/*.md → Saved job descriptions referenced from the pipeline (`local:jds/{file}`)
166
166
  templates/states.yml → Canonical status values
167
+ templates/canon.json → Canonical URL/company/role identity keys
167
168
  templates/context.json → Deterministic mode/reference context bundle policy
169
+ templates/preflight.json → Safe apply dispatch rounds/gates policy
168
170
  templates/migrations.json → Safe consumer-project upgrade policy
169
171
  templates/cv-template.html → PDF generation template
170
172
  examples/*.md → Fictional layouts only (not read by scripts; see examples/README.md)
@@ -179,6 +181,8 @@ Create `data/pipeline.md` when you start using the URL inbox (`/job-forge pipeli
179
181
  - Tracker TSVs: `batch/tracker-additions/{num}-{company-slug}.tsv` (one file per evaluation; merged files move under `batch/tracker-additions/merged/`; shape enforced by `templates/contracts.json`)
180
182
  - Ledger: `.jobforge-ledger/events.jsonl` (created by `job-forge ledger:rebuild`, `tracker-line --write`, or `merge`; gitignored personal state)
181
183
  - Index: `.jobforge-index.json` (created on demand by `job-forge index:*`; gitignored local lookup state)
184
+ - Canon: `templates/canon.json` (identity rules inspected with `job-forge canon:*`)
185
+ - Preflight: `templates/preflight.json` (dispatch rounds/gates inspected with `job-forge preflight:*`)
182
186
  - Migrations: `templates/migrations.json` (applied by `job-forge sync` and inspectable with `job-forge migrate:*`)
183
187
  - Capabilities: `templates/capabilities.json` (role boundary policy inspected with `job-forge capabilities:*`)
184
188
  - Context: `templates/context.json` (mode/reference file bundles inspected with `job-forge context:*`)
@@ -225,7 +229,9 @@ Scripts maintain data consistency. In a consumer project they're invoked via the
225
229
  | `scripts/guard.mjs` | `npx job-forge guard:audit` / `guard:explain` | Deterministic `@razroo/iso-guard` policy audits over local OpenCode traces |
226
230
  | `scripts/ledger.mjs` | `npx job-forge ledger:status` / `ledger:has` / `ledger:rebuild` | Deterministic `@razroo/iso-ledger` state over tracker, TSV, and pipeline files |
227
231
  | `scripts/index.mjs` | `npx job-forge index:status` / `index:has` / `index:query` | Deterministic `@razroo/iso-index` lookup over reports, tracker rows, TSVs, pipeline, scan history, and ledger events |
232
+ | `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 |
228
233
  | `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
+ | `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 |
229
235
  | `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 |
230
236
  | `tracker-lib.mjs` | _(library)_ | Shared helpers for reading/writing day-based tracker files — imported by merge/dedup/verify/normalize |
231
237
  | `bin/sync.mjs` | `npx job-forge sync` | Creates the harness symlinks in a consumer project and applies safe migrations (also runs as `postinstall`) |
@@ -152,7 +152,15 @@ Mode/reference context bundles live in `templates/context.json` and are planned
152
152
 
153
153
  ## JobForge artifact index
154
154
 
155
- Artifact lookup policy lives in `templates/index.json` and is built locally by `@razroo/iso-index`. Use `job-forge index:has --key "company-role:acme:staff-engineer"` as a cheap duplicate/source prefilter, `job-forge index:query "acme"` to get compact source path/line pointers, and `job-forge index:verify` to validate `.jobforge-index.json`. Query, has, and verify rebuild the index on demand, so scaffolded projects need no setup. This is not an MCP and does not add tool-schema tokens.
155
+ Artifact lookup policy lives in `templates/index.json` and is built locally by `@razroo/iso-index`. Use `job-forge index:has --key "company-role:acme:staff-engineer"` as a cheap duplicate/source prefilter, `job-forge index:query "acme"` to get compact source path/line pointers, and `job-forge index:verify` to validate `.jobforge-index.json`. Query, has, and verify rebuild the index on demand, so scaffolded projects need no setup. JobForge canonicalizes company/role and URL records through `templates/canon.json` before writing the index. This is not an MCP and does not add tool-schema tokens.
156
+
157
+ ## JobForge identity canonicalization
158
+
159
+ URL, company, role, and company+role identity rules live in `templates/canon.json` and are enforced locally by `@razroo/iso-canon`. Use `job-forge canon:key company-role --company "OpenAI, Inc." --role "Senior SWE, AI Platform"` to derive the same duplicate key used by ledger/index helpers, and `job-forge canon:compare company "OpenAI, Inc." "Open AI"` to explain whether two values resolve to the same entity. Custom forks can extend aliases, suffixes, stop words, and match thresholds in `templates/canon.json`. This is not an MCP and does not add prompt or tool-schema tokens.
160
+
161
+ ## JobForge preflight plans
162
+
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.
156
164
 
157
165
  ## JobForge consumer migrations
158
166
 
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`, `context`, `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`, `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
@@ -126,10 +126,14 @@ From your project root, these commands maintain the tracker and pipeline checks.
126
126
  | Pipeline health check | `npx job-forge verify` | `npm run verify` |
127
127
  | Merge `batch/tracker-additions/*.tsv` into the tracker | `npx job-forge merge` | `npm run merge` |
128
128
  | Inspect tracker row contract | `npx iso-contract explain jobforge.tracker-row --contracts templates/contracts.json` | _(none)_ |
129
+ | Derive canonical company/role key | `npx job-forge canon:key company-role --company "Acme" --role "Staff Engineer"` | `npm run canon:key -- company-role --company ...` |
130
+ | Compare identity values | `npx job-forge canon:compare company "OpenAI, Inc." "Open AI"` | `npm run canon:compare -- company ...` |
129
131
  | Inspect role capabilities | `npx job-forge capabilities:explain general-free` | `npm run capabilities:explain -- general-free` |
130
132
  | Inspect context bundle budget | `npx job-forge context:plan apply` | `npm run context:plan -- apply` |
131
133
  | Inspect local JD/artifact cache | `npx job-forge cache:status` | `npm run cache:status` |
132
134
  | Inspect local artifact index | `npx job-forge index:status` | `npm run index:status` |
135
+ | Plan safe application dispatch rounds | `npx job-forge preflight:plan --candidates batch/preflight-candidates.json` | `npm run preflight:plan -- --candidates ...` |
136
+ | Fail on blocked preflight candidates | `npx job-forge preflight:check --candidates batch/preflight-candidates.json` | `npm run preflight:check -- --candidates ...` |
133
137
  | Inspect pending consumer migrations | `npx job-forge migrate:plan` | `npm run migrate:plan` |
134
138
  | Map status column to canonical labels | `npx job-forge normalize` | `npm run normalize` |
135
139
  | Merge duplicate company/role rows | `npx job-forge dedup` | `npm run dedup` |
@@ -81,6 +81,14 @@ Local artifact index (terminal, outside opencode):
81
81
  npx job-forge index:has --key "company-role:acme:staff-engineer"
82
82
  npx job-forge index:query "acme"
83
83
 
84
+ Identity keys (terminal, outside opencode):
85
+ npx job-forge canon:key company-role --company "Acme" --role "Staff Engineer"
86
+ npx job-forge canon:compare company "OpenAI, Inc." "Open AI"
87
+
88
+ Preflight dispatch plans (terminal, outside opencode):
89
+ npx job-forge preflight:plan --candidates batch/preflight-candidates.json
90
+ npx job-forge preflight:check --candidates batch/preflight-candidates.json
91
+
84
92
  Consumer migrations (terminal, outside opencode):
85
93
  npx job-forge migrate:plan # preview package.json/.gitignore drift
86
94
  npx job-forge migrate:apply # apply safe harness upgrade migrations
@@ -171,11 +179,13 @@ Step 1 — Enumerate candidates
171
179
  - Build ordered list: candidates = [job_1, job_2, ..., job_N]
172
180
 
173
181
  Step 2 — Dedup against already-applied
174
- - Run npx job-forge index:has --key "company-role:<company-slug>:<role-slug>"
175
- as a fast local artifact prefilter when company+role is known. It rebuilds
176
- .jobforge-index.json on demand from templates/index.json. A hit means the
177
- role has already appeared in tracker files or tracker TSVs and can be
178
- dropped before dispatch.
182
+ - Derive the stable key with npx job-forge canon:key company-role --company
183
+ "<company>" --role "<role>" when company+role is known.
184
+ - Run npx job-forge index:has --key "<canon-key>" as a fast local artifact
185
+ prefilter. It rebuilds .jobforge-index.json on demand from
186
+ templates/index.json and canonicalizes indexed company/role records through
187
+ templates/canon.json. A hit means the role has already appeared in tracker
188
+ files or tracker TSVs and can be dropped before dispatch.
179
189
  - If .jobforge-ledger/events.jsonl exists, use npx job-forge ledger:has as a
180
190
  fast prefilter for obvious company+role Applied duplicates. A ledger match
181
191
  can be dropped before dispatch without loading tracker files into context.
@@ -191,7 +201,19 @@ Step 3 — Pre-flight cleanup (once, before the loop)
191
201
  - geometra_list_sessions()
192
202
  - geometra_disconnect({ closeBrowser: true })
193
203
 
194
- Step 4 — Loop in rounds of 2 (Hard Limit #1)
204
+ Step 4 — Materialize and check the dispatch plan
205
+ - Write file-backed candidate facts/gates to batch/preflight-candidates.json
206
+ (or another explicit JSON file). Include source paths for company, role,
207
+ companyRoleKey, URL, score, duplicate/location gates, and any skip/block
208
+ decision.
209
+ - Run npx job-forge preflight:check --candidates <file> to fail on missing
210
+ sources or blocked gates, then npx job-forge preflight:plan --candidates
211
+ <file> to get the bounded round list.
212
+ - Follow the emitted rounds. Do not dispatch blocked candidates, and do not
213
+ replace H2's four-source grep with preflight unless those grep results are
214
+ present in the candidate JSON.
215
+
216
+ Step 5 — Loop in rounds of 2 (Hard Limit #1)
195
217
  for round in ceil(len(candidates) / 2):
196
218
  pair = candidates[round*2 : round*2 + 2]
197
219
  # If proxy is configured, do not paste proxy values into prompts.
@@ -7,7 +7,7 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
7
7
  - [H1] Max 2 parallel `task` dispatches per message. For N jobs, run `ceil(N/2)` sequential rounds of 2. A round is not complete until both subagents return a final outcome (`APPLIED`, `APPLY FAILED`, `SKIP`, `Discarded`, or a written TSV path). A `task` tool result that only gives a session id / title is a launch acknowledgement, not completion. Applies in all modes, for all user phrasings ("urgent", "apply to 10 jobs now").
8
8
  why: each subagent requires post-cleanup and racing more than 2 reliably loses at least one result. On 2026-04-25 the orchestrator launched round 2 while round 1 had only returned task ids, leaving four application subagents in flight and losing two provider recoveries
9
9
 
10
- - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
10
+ - [H2] Max 1 application per company+role. Before every `apply` dispatch, grep all four sources for the URL and for `company+role`: `data/pipeline.md`, all `data/applications/*.md` day files, `batch/tracker-additions/*.tsv`, `batch/tracker-additions/merged/*.tsv`. Use `npx job-forge canon:key company-role --company "..." --role "..."` when deriving a stable duplicate key; do not invent slugs in prose. `npx job-forge index:has --key "company-role:..."` may be used first as a fast local artifact prefilter; it rebuilds `.jobforge-index.json` on demand from `templates/index.json`, and a company+role hit is enough to drop an obvious duplicate before dispatch. If `.jobforge-ledger/events.jsonl` exists, `npx job-forge ledger:has --company "..." --role "..." --status Applied` may also be used as a fast prefilter; a match is enough to drop that duplicate before dispatch. For candidates not rejected by the index or ledger, the four-source grep is still mandatory. If any source shows APPLIED / Applied, skip the dispatch and pick a replacement from the remaining candidate list. Do not count duplicates toward a requested "apply to N jobs" total, and do not delegate obvious duplicates just so a subagent can return SKIP.
11
11
  why: 2026-04 same-day batch collision — when two batches target the same role, `npx job-forge merge` updates the existing day-file row rather than appending, so grepping day files alone misses earlier-batch applies; merged/*.tsv is the only place the breadcrumb remains
12
12
 
13
13
  - [H3] Before every batch of `task` dispatches that will use Geometra, call `geometra_list_sessions` then `geometra_disconnect({closeBrowser: true})`. Every round, no exceptions. Name this cleanup as an explicit "step 0" in your first-response plan for any multi-apply request — it is the most frequently skipped guardrail in practice, and skipping it produces cascade "Not connected" failures on the next dispatch.
@@ -75,12 +75,18 @@ AI-powered job search pipeline: scans portals, evaluates offers, generates CVs v
75
75
  - [D14] Treat `templates/migrations.json` as the source of truth for consumer-project upgrades. Use `npx job-forge migrate:plan` or `npx job-forge migrate:check` when diagnosing harness drift; `job-forge sync` applies safe migrations automatically unless `JOB_FORGE_SKIP_MIGRATIONS=1` is set.
76
76
  why: `iso-migrate` is not an MCP and adds no prompt/tool-schema tokens; it prevents stale consumer scripts and generated-artifact ignores without asking agents to hand-edit package.json
77
77
 
78
+ - [D15] Treat `templates/canon.json` as the source of truth for URL/company/role identity keys. Use `npx job-forge canon:key ...` or `npx job-forge canon:compare ...` before broad duplicate checks when a stable key or same/possible/different decision is useful.
79
+ why: `iso-canon` is not an MCP and adds no prompt/tool-schema tokens; it centralizes duplicate-key rules so agents do not repeatedly derive inconsistent slugs for aliases, suffixes, remote/location noise, or tracking URLs
80
+
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
+ 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
+
78
84
  ## Procedure
79
85
 
80
86
  1. Check `cv.md`, `profile.yml`, and `portals.yml`; onboard if any file is missing.
81
87
  2. Pick and name the mode from **Routing** [D6]. No match → ask; do not guess.
82
- 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 migration checks for harness drift [D14]. Decide inline vs delegated work [D1].
83
- 4. Prepare Geometra dispatches: cleanup [H3], index/ledger prefilter when useful [D8, D13], dedupe [H2], location filter [D5], routing [D2, D10], proxy prompt hygiene [H8].
88
+ 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
+ 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].
84
90
  5. Dispatch at most 2 tasks per round [H1]; wait for final outcomes, not just task ids [H5b].
85
91
  6. Keep multi-job form-filling out of the orchestrator [H4].
86
92
  7. Cross-check subagent facts against authoritative files [H7].
@@ -10,6 +10,7 @@ import {
10
10
  resolveCacheDir,
11
11
  verifyCache,
12
12
  } from '@razroo/iso-cache';
13
+ import { canonicalizeJobForgeUrl } from './jobforge-canon.mjs';
13
14
 
14
15
  export const CACHE_DIR = '.jobforge-cache';
15
16
  export const JD_CACHE_NAMESPACE = 'jobforge.jd';
@@ -96,10 +97,14 @@ export function normalizeJobUrl(url) {
96
97
  const text = String(url || '').trim();
97
98
  if (!text) throw new Error('url is required');
98
99
  try {
99
- const parsed = new URL(text);
100
- parsed.hash = '';
101
- return parsed.toString();
100
+ return canonicalizeJobForgeUrl(text).canonical;
102
101
  } catch {
103
- return text;
102
+ try {
103
+ const parsed = new URL(text);
104
+ parsed.hash = '';
105
+ return parsed.toString();
106
+ } catch {
107
+ return text;
108
+ }
104
109
  }
105
110
  }