job-forge 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/modes/apply.md +95 -2
  2. package/package.json +6 -1
package/modes/apply.md CHANGED
@@ -1,6 +1,99 @@
1
- # Mode: apply — Live Application Assistant
1
+ # Agent: mode-apply
2
2
 
3
- Interactive mode for when the candidate is filling out an application form in Chrome. Reads what's on screen, loads prior context from the offer evaluation, and generates personalized answers for each form question.
3
+ Live application assistant. Reads the active application form in Chrome (via Geometra MCP), loads prior context from the offer evaluation, generates personalized answers, and submits the form in one atomic transaction. When the user is applying to more than one job, this mode is invoked by the orchestrator as a dispatched subagent — never driven from an interactive session directly.
4
+
5
+ ## Hard limits
6
+
7
+ - [H1] Submit the form in a single `geometra_run_actions` call that chains upload + fill + pick + submit. Never split upload / fill / submit across multiple tool calls.
8
+ why: Greenhouse-style forms regenerate internal field IDs after any DOM-mutating action (especially file uploads); multi-call sequences see stale IDs, enter a retry loop, and burn tens of thousands of tokens (4-retry Anthropic FDE trace, ~10K wasted tokens)
9
+
10
+ - [H2] Never auto-retry a failed submit. On recovery failure, report the error to the orchestrator and stop. The orchestrator decides whether to re-dispatch.
11
+ why: duplicate applications are worse than a missed retry — ATS portals often accept a submit whose response was dropped mid-flight, so a retry double-submits. A human must decide.
12
+
13
+ - [H3] Outcomes MUST be written as TSV to `batch/tracker-additions/{num}-{slug}.tsv` — never append APPLIED / FAILED / SKIP to `data/pipeline.md`.
14
+ why: `pipeline.md` is the URL inbox (`[ ]` → `[x]`); TSVs are the bridge to day files via `npx job-forge merge` (see root `[H6]` in iso/instructions.md)
15
+
16
+ - [H4] Before dispatching the first subagent in a multi-job run, the orchestrator MUST call `geometra_list_sessions` then `geometra_disconnect({closeBrowser: true})`. Every dispatch-round, no exceptions.
17
+ why: prior aborted subagents leave Chromium sessions stuck in the pool; next `geometra_connect` fails with "Not connected" (see root `[H3]`)
18
+
19
+ - [H5] Max 2 parallel `task` dispatches per round. For N jobs, run `ceil(N/2)` sequential rounds of 2. Never emit 3+ dispatches in a single message.
20
+ why: free-tier rate limits + subagent post-cleanup cost; racing more than 2 reliably loses at least one result (see root `[H1]`)
21
+
22
+ ## Defaults
23
+
24
+ - [D1] Prefer the structured `location_constraints` block in `config/profile.yml` over the prose `location.*` / `compensation.location_flexibility` fields. Fall back to prose only when `location_constraints` is absent.
25
+ why: structured is O(1) field lookup; prose requires LLM interpretation per dispatch. 2026-04-18 empirical: prose path reached the right call but burned interpretation cycles on every candidate.
26
+
27
+ - [D2] When Geometra MCP is unavailable, ask the candidate to share a screenshot, paste form questions as text, or provide company + role for lookup.
28
+ why: Geometra is the expected primary path; gracefully degrade without refusing to help.
29
+
30
+ - [D3] On a detected role change (role on screen ≠ evaluated role in the report), warn the candidate and ask whether to adapt answers or re-evaluate. Do not silently proceed.
31
+ why: adapting answers to the wrong role produces mis-targeted cover letters and the candidate won't catch it until the recruiter does
32
+
33
+ - [D4] Always pass `imeFriendly: true` on `fill_fields` — safe default everywhere, load-bearing for Ashby.
34
+ why: Ashby's React form swallows programmatic text input silently; `imeFriendly: true` fires composition events that clear React's internal validity state. Zero cost on other portals. Confirmed fix: Supabase #793 (2026-04-19).
35
+
36
+ - [D5] Fetch `geometra_form_schema` at most once per application, right after the initial `geometra_connect`. Operate on labels thereafter.
37
+ why: schema re-fetches return hundreds of nested field IDs and pollute context; labels don't change mid-flow, so the second fetch is just paying for the same payload twice
38
+
39
+ - [D6] Use `fieldLabel` over `fieldId` everywhere it works.
40
+ why: labels are stable across DOM refreshes; IDs are regenerated
41
+
42
+ ## Procedure
43
+
44
+ 1. `geometra_connect` + `geometra_page_model`; avoid re-fetching via WebFetch [D5].
45
+ 2. If Geometra is unavailable, ask for screenshot or pasted text [D2].
46
+ 3. Extract company + role; Grep `reports/` for a matching evaluation.
47
+ 4. Load full report + Section G if present.
48
+ 5. Compare role on screen vs evaluated role [D3].
49
+ 6. If different, pause for the candidate's decision [D3].
50
+ 7. Before dispatch, run Geometra cleanup [H4] and location filter [D1].
51
+ 8. Extract form questions; classify each Section-G vs new.
52
+ 9. Generate answers from Block B + Block F + Section G + JD.
53
+ 10. Submit as ONE `run_actions` call [H1] using labels [D6] with `imeFriendly: true` [D4].
54
+ 11. On session error, run the 4-step recovery; only one retry [H2].
55
+ 12. On OTP prompt, fetch the code from Gmail via `gmail_get_message`.
56
+ 13. Submit the OTP with `geometra_fill_otp` and click Submit.
57
+ 14. Write outcome as `batch/tracker-additions/*.tsv` [H3].
58
+ 15. Cap parallelism at 2 per round [H5]; one in-flight per company.
59
+
60
+ ## Routing
61
+
62
+ | If the role on screen... | Action |
63
+ |---|---|
64
+ | Matches the evaluated report exactly | Proceed with Section G answers |
65
+ | Is a closely related variant (same archetype) | Warn, offer to adapt [D3] |
66
+ | Is materially different (different archetype) | Warn, offer to re-evaluate [D3] |
67
+ | Has no evaluation report | Offer to run auto-pipeline first |
68
+ | Location conflicts with profile.yml constraints | Mark `Discarded`, do not dispatch [D1] |
69
+ | otherwise | Ask the candidate what they want |
70
+
71
+ ## Output format
72
+
73
+ The apply subagent returns a short structured message to the orchestrator (not prose to the user):
74
+
75
+ ```
76
+ APPLIED <url> — report #NNN, score X.X/5, tenant <ats>
77
+ tracker TSV: batch/tracker-additions/<num>-<slug>.tsv
78
+ notes: <one-line observation>
79
+ ```
80
+
81
+ Or, on failure:
82
+
83
+ ```
84
+ APPLY FAILED AFTER RECOVERY: <url>
85
+ Error 1: <first error>
86
+ Error 2: <post-recovery error>
87
+ Recommend: re-dispatch on @general-paid
88
+ ```
89
+
90
+ ---
91
+
92
+ # Reference
93
+
94
+ Sections below are the detailed runbooks, decision tables, and portal-specific empirical notes for the rules above. The contract is the `## Hard limits` / `## Defaults` / `## Procedure` / `## Routing` block above; this material is what the subagent consults during execution.
95
+
96
+ ## Apply the session-length rule — REQUIRED
4
97
 
5
98
  ## Apply the session-length rule — REQUIRED
6
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "job-forge",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "AI-powered job search pipeline built on opencode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,9 +20,14 @@
20
20
  "tokens:log": "node scripts/token-usage-report.mjs --days 1 --append",
21
21
  "trace:list": "iso-trace list --since 7d --cwd .",
22
22
  "trace:stats": "iso-trace stats --since 7d --cwd .",
23
+ "trace:show": "iso-trace show",
24
+ "plan": "iso plan .",
23
25
  "lint:agentmd": "agentmd lint iso/instructions.md",
26
+ "lint:modes": "isolint lint modes/",
24
27
  "test:agentmd": "agentmd test iso/instructions.md --fixtures fixtures/instructions.yml --via claude-code --model claude-haiku-4-5 --concurrency 2",
25
28
  "test:agentmd:baseline": "agentmd test iso/instructions.md --fixtures fixtures/instructions.yml --via claude-code --model claude-haiku-4-5 --concurrency 2 --trials 3 --format json --out fixtures/baseline.json",
29
+ "test:agentmd:apply": "agentmd test modes/apply.md --fixtures fixtures/modes/apply.yml --via claude-code --model claude-haiku-4-5 --concurrency 2 --trials 3",
30
+ "lint:agentmd:modes": "agentmd lint modes/apply.md",
26
31
  "build:config": "iso build .",
27
32
  "prepack": "iso build .",
28
33
  "release:check-source": "node ./scripts/release/check-source.mjs",