Complete S02 application package drafting loop

This commit is contained in:
2026-03-24 10:36:05 +01:00
parent 3e5f796326
commit b5b430947b
14 changed files with 864 additions and 152 deletions
+1 -1
View File
@@ -11,4 +11,4 @@
| D003 | M001 | scope | Primary user | Individual job seeker | The product is designed for individuals managing their own search, not recruiter or team workflows. | Yes — if product direction changes later | collaborative |
| D004 | M001 | pattern | Daily navigation hierarchy | Job table first, then follow-up/dashboard, then individual job workspace | The user explicitly described this as the intended control flow for daily use. | Yes — if real usage disproves the hierarchy | collaborative |
| D005 | M001 | roadmap | First milestone focus | Prioritize Gmail import quality and AI draft quality before broader expansion | The user identified Gmail import and AI drafts as the weakest current areas and the first bar for daily use. | Yes — if execution proves another blocker is more fundamental | collaborative |
| D006 | M001/S01 planning | architecture | How S01 will improve Gmail import matching | Add a job-scoped backend Gmail matching contract and persist Gmail thread/message metadata on correspondence instead of relying on client-only scoring | Backend ranking can use owned job, company, recruiter, and prior correspondence context consistently, gives the UI explicit match reasons and duplicate state, and preserves thread continuity for later reply/follow-up slices without changing the no-auto-send boundary. | Yes — if real Gmail usage shows the ranking contract or stored metadata is insufficient | agent |
| D006 | M001/S02 | workspace-persistence | How the saved application answer draft should persist inside the job workspace before a dedicated field exists | Store the application answer draft in a replaceable notes block and make SaveApplicationDrafts overwrite notes when notes are explicitly provided | The existing append-only notes behavior made the Tailored CV workspace untrustworthy because repeated saves duplicated the application answer indefinitely. A replaceable notes block preserves current schema compatibility while giving the workspace a stable saved/read-back loop for later slices. | Yes | agent |
+1 -1
View File
@@ -10,7 +10,7 @@ The product must let one person run a real job search without losing the thread:
## Current State
A substantial brownfield app already exists. The repo has a React frontend, an ASP.NET Core API, and a local FastAPI AI service. Current capabilities already include job tracking, companies, attachments, correspondence, reminders, job import preview, Gmail connection/import, profile CV upload/parsing/rewrite flows, AI-assisted tailored CV and cover-letter generation, candidate-fit/focus-plan/interview-prep/readiness endpoints, and dashboard/system surfaces. S01 has now moved Gmail import from a generic search surface to a job-aware workspace flow: the backend ranks likely Gmail threads/messages for a specific job, imports report duplicate state explicitly, correspondence persists Gmail thread and sender/recipient metadata, and the job workspace renders those ranked suggestions directly. The next phase is not greenfield feature invention; it is continuing to turn existing capability into a more coherent, more trustworthy daily workflow.
A substantial brownfield app already exists. The repo has a React frontend, an ASP.NET Core API, and a local FastAPI AI service. Current capabilities already include job tracking, companies, attachments, correspondence, reminders, job import preview, Gmail connection/import, profile CV upload/parsing/rewrite flows, AI-assisted tailored CV and cover-letter generation, candidate-fit/focus-plan/interview-prep/readiness endpoints, and dashboard/system surfaces. S01 moved Gmail import from a generic search surface to a job-aware workspace flow: the backend ranks likely Gmail threads/messages for a specific job, imports report duplicate state explicitly, correspondence persists Gmail thread and sender/recipient metadata, and the job workspace renders those ranked suggestions directly. S02 then tightened the package loop around that context: backend package generation now consumes imported correspondence plus recruiter/job state, and the Tailored CV tab treats tailored CV, cover letter, recruiter message, and saved application-answer material as one editable workspace tied back to the job instead of a throwaway preview pane. The next phase is not greenfield feature invention; it is continuing to turn existing capability into a more coherent, more trustworthy daily workflow.
## Architecture / Key Patterns
+52 -64
View File
@@ -2,52 +2,9 @@
This file is the explicit capability and coverage contract for the project.
Use it to track what is actively in scope, what has been validated by completed work, what is intentionally deferred, and what is explicitly out of scope.
Guidelines:
- Keep requirements capability-oriented, not a giant feature wishlist.
- Requirements should be atomic, testable, and stated in plain language.
- Every **Active** requirement should be mapped to a slice, deferred, blocked with reason, or moved out of scope.
- Each requirement should have one accountable primary owner and may have supporting slices.
- Research may suggest requirements, but research does not silently make them binding.
- Validation means the requirement was actually proven by completed work and verification, not just discussed.
## Active
### R001External job import starts the workflow
- Class: primary-user-loop
- Status: active
- Description: The user finds a job outside the app, imports it into the app, and starts the application workflow from that imported role.
- Why it matters: The product is not a job board replacement; the import step is the real start of the user loop.
- Source: user
- Primary owning slice: M001/S01
- Supporting slices: M001/S05
- Validation: mapped
- Notes: This is a hard product-shape requirement, not a convenience feature.
### R002 — Gmail import feels smart enough to trust
- Class: integration
- Status: active
- Description: Gmail connection, message retrieval, and message/thread import must help the user pull real correspondence into the right job with materially less manual cleanup.
- Why it matters: Gmail import is one of the two clearest current weaknesses and a major trust surface for daily use.
- Source: user
- Primary owning slice: M001/S01
- Supporting slices: M001/S03, M001/S05
- Validation: mapped
- Notes: Matching quality and import clarity matter more than merely exposing the API surface.
### R003 — AI application drafts are materially useful
- Class: differentiator
- Status: active
- Description: Tailored CV and cover-letter drafts must feel specific, credible, and good enough that the user wants to start from them.
- Why it matters: Draft generation exists already, but the milestone bar is actual usefulness rather than feature presence.
- Source: user
- Primary owning slice: M001/S02
- Supporting slices: M001/S05
- Validation: mapped
- Notes: “A really good AI draft” is an explicit milestone success bar from the discussion.
### R004 — Follow-up and reply drafts use real context
### R004The app must generate follow-up and reply drafts from the imported job, saved application material, and correspondence context tied to that job.
- Class: primary-user-loop
- Status: active
- Description: The app must generate follow-up and reply drafts from the imported job, saved application material, and correspondence context tied to that job.
@@ -58,7 +15,7 @@ Guidelines:
- Validation: mapped
- Notes: The user stays in control of sending; the app provides strong drafts only.
### R005 — Job table is the primary daily control surface
### R005 — The first page should give the user a clear overview of jobs, status, readiness, and what needs attention.
- Class: continuity
- Status: active
- Description: The first page should give the user a clear overview of jobs, status, readiness, and what needs attention.
@@ -69,7 +26,7 @@ Guidelines:
- Validation: mapped
- Notes: This should feel like “scan the field” before drilling into one job.
### R006 — Follow-up/dashboard surfaces the right urgency
### R006 — The dashboard and follow-up surfaces must clearly show next actions, neglected threads, and jobs that need attention now.
- Class: continuity
- Status: active
- Description: The dashboard and follow-up surfaces must clearly show next actions, neglected threads, and jobs that need attention now.
@@ -80,7 +37,7 @@ Guidelines:
- Validation: mapped
- Notes: The follow-up/dashboard view is the second navigation priority after the table.
### R007 — Individual job workspace supports focused execution
### R007 — Each job needs a workspace where the user can update status, review/import correspondence, edit drafts, and prepare follow-ups.
- Class: core-capability
- Status: active
- Description: Each job needs a workspace where the user can update status, review/import correspondence, edit drafts, and prepare follow-ups.
@@ -91,7 +48,7 @@ Guidelines:
- Validation: mapped
- Notes: This is where the product should feel connected instead of scattered.
### R008 — Outbound actions remain manual and user-controlled
### R008 — The app may draft application, reply, and follow-up content, but it must not auto-send emails or auto-apply to jobs.
- Class: constraint
- Status: active
- Description: The app may draft application, reply, and follow-up content, but it must not auto-send emails or auto-apply to jobs.
@@ -102,7 +59,7 @@ Guidelines:
- Validation: mapped
- Notes: This is a durable trust constraint across all milestones.
### R009 — Product is designed for an individual, not a team workflow
### R009 — Core UX, data model emphasis, and roadmap decisions should optimize for one person managing their own search.
- Class: constraint
- Status: active
- Description: Core UX, data model emphasis, and roadmap decisions should optimize for one person managing their own search.
@@ -113,7 +70,7 @@ Guidelines:
- Validation: mapped
- Notes: Shared/team workflows are not the current product target.
### R010 — Tracking continuity survives manual and imported updates
### R010 — The app must preserve a coherent history across manual status changes, imported Gmail correspondence, reminders, and follow-up work.
- Class: continuity
- Status: active
- Description: The app must preserve a coherent history across manual status changes, imported Gmail correspondence, reminders, and follow-up work.
@@ -126,11 +83,42 @@ Guidelines:
## Validated
None yet.
### R001 — The user finds a job outside the app, imports it into the app, and starts the application workflow from that imported role.
- Class: primary-user-loop
- Status: validated
- Description: The user finds a job outside the app, imports it into the app, and starts the application workflow from that imported role.
- Why it matters: The product is not a job board replacement; the import step is the real start of the user loop.
- Source: user
- Primary owning slice: M001/S01
- Supporting slices: M001/S05
- Validation: S01 completed with a job-scoped Gmail import loop wired into the job workspace: backend `GET /api/gmail/job-candidates` uses the owned job as context, imports target that job directly, and focused UI verification passed in `job-tracker-ui/src/correspondence-gmail-import.test.tsx`.
- Notes: Validation is contract/UI-level plus workspace integration. Live user UAT of the broader milestone loop still remains for later slices.
### R002 — Gmail connection, message retrieval, and message/thread import must help the user pull real correspondence into the right job with materially less manual cleanup.
- Class: integration
- Status: validated
- Description: Gmail connection, message retrieval, and message/thread import must help the user pull real correspondence into the right job with materially less manual cleanup.
- Why it matters: Gmail import is one of the two clearest current weaknesses and a major trust surface for daily use.
- Source: user
- Primary owning slice: M001/S01
- Supporting slices: M001/S03, M001/S05
- Validation: S01 completed with backend-ranked job-aware Gmail candidates, explicit imported/skipped import payloads, persisted thread/sender/recipient metadata, and focused verification across isolated `GmailControllerTests` plus `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/correspondence-gmail-import.test.tsx`.
- Notes: The broader JobTrackerApi.Tests project still has unrelated compile drift, so Gmail backend coverage was isolated instead of run through the full test project. Live Gmail UAT is still needed to judge trust on a real inbox.
### R003 — Tailored CV and cover-letter drafts must feel specific, credible, and good enough that the user wants to start from them.
- Class: differentiator
- Status: validated
- Description: Tailored CV and cover-letter drafts must feel specific, credible, and good enough that the user wants to start from them.
- Why it matters: Draft generation exists already, but the milestone bar is actual usefulness rather than feature presence.
- Source: user
- Primary owning slice: M001/S02
- Supporting slices: M001/S05
- Validation: Validated by M001/S02: backend application-package generation now uses recruiter/job/profile/attachment/imported-correspondence context, focused backend tests pass in an isolated harness, and the Tailored CV workspace test proves generation, editing, save, and saved-state redisplay behavior.
- Notes: S02 proved the application-package drafts are materially more specific and persist as job-tied working material. Broader end-to-end live-loop revalidation still remains in M001/S05.
## Deferred
### R011 — Stronger tracking control-center analytics
### R011 — The app should later expand overview analytics, saved views, and clearer strategy readouts beyond the core daily loop.
- Class: operability
- Status: deferred
- Description: The app should later expand overview analytics, saved views, and clearer strategy readouts beyond the core daily loop.
@@ -141,7 +129,7 @@ None yet.
- Validation: unmapped
- Notes: Deferred because Gmail import and draft quality are higher-value first fixes.
### R012 — Broader inbox-aware assistance beyond initial Gmail improvements
### R012 — The product may later add richer message understanding, smarter thread handling, and broader inbox-aware assistance after the first Gmail milestone.
- Class: integration
- Status: deferred
- Description: The product may later add richer message understanding, smarter thread handling, and broader inbox-aware assistance after the first Gmail milestone.
@@ -152,7 +140,7 @@ None yet.
- Validation: unmapped
- Notes: This is the natural next step after M001 proves the core Gmail path.
### R013 — Richer AI coaching beyond the application/follow-up core
### R013 — The app may later add broader strategic coaching and more advanced guidance beyond application package and follow-up/reply drafting.
- Class: differentiator
- Status: deferred
- Description: The app may later add broader strategic coaching and more advanced guidance beyond application package and follow-up/reply drafting.
@@ -165,7 +153,7 @@ None yet.
## Out of Scope
### R014 — Auto-apply to jobs
### R014 — The app will not automatically submit applications to external job sites.
- Class: anti-feature
- Status: out-of-scope
- Description: The app will not automatically submit applications to external job sites.
@@ -176,7 +164,7 @@ None yet.
- Validation: n/a
- Notes: The app starts after discovery/import, not at job search submission.
### R015 — Auto-send outbound email or messages
### R015 — The app will not send replies, follow-ups, or other communication autonomously.
- Class: anti-feature
- Status: out-of-scope
- Description: The app will not send replies, follow-ups, or other communication autonomously.
@@ -187,7 +175,7 @@ None yet.
- Validation: n/a
- Notes: Drafting is allowed; autonomous sending is not.
### R016 — Recruiter CRM or team collaboration workflows
### R016 — The product will not optimize for shared pipelines, recruiter operations, or multi-user coaching workflows right now.
- Class: out-of-scope
- Status: out-of-scope
- Description: The product will not optimize for shared pipelines, recruiter operations, or multi-user coaching workflows right now.
@@ -198,7 +186,7 @@ None yet.
- Validation: n/a
- Notes: Multi-user admin surfaces may exist technically, but they are not the roadmap center.
### R017 — In-app job discovery replacing job boards
### R017 — The app will not try to replace external job boards as the main discovery surface.
- Class: out-of-scope
- Status: out-of-scope
- Description: The app will not try to replace external job boards as the main discovery surface.
@@ -213,9 +201,9 @@ None yet.
| ID | Class | Status | Primary owner | Supporting | Proof |
|---|---|---|---|---|---|
| R001 | primary-user-loop | active | M001/S01 | M001/S05 | mapped |
| R002 | integration | active | M001/S01 | M001/S03, M001/S05 | mapped |
| R003 | differentiator | active | M001/S02 | M001/S05 | mapped |
| R001 | primary-user-loop | validated | M001/S01 | M001/S05 | S01 completed with a job-scoped Gmail import loop wired into the job workspace: backend `GET /api/gmail/job-candidates` uses the owned job as context, imports target that job directly, and focused UI verification passed in `job-tracker-ui/src/correspondence-gmail-import.test.tsx`. |
| R002 | integration | validated | M001/S01 | M001/S03, M001/S05 | S01 completed with backend-ranked job-aware Gmail candidates, explicit imported/skipped import payloads, persisted thread/sender/recipient metadata, and focused verification across isolated `GmailControllerTests` plus `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/correspondence-gmail-import.test.tsx`. |
| R003 | differentiator | validated | M001/S02 | M001/S05 | Validated by M001/S02: backend application-package generation now uses recruiter/job/profile/attachment/imported-correspondence context, focused backend tests pass in an isolated harness, and the Tailored CV workspace test proves generation, editing, save, and saved-state redisplay behavior. |
| R004 | primary-user-loop | active | M001/S03 | M001/S01, M001/S02, M001/S05 | mapped |
| R005 | continuity | active | M001/S04 | M001/S05 | mapped |
| R006 | continuity | active | M001/S04 | M001/S05 | mapped |
@@ -233,7 +221,7 @@ None yet.
## Coverage Summary
- Active requirements: 10
- Mapped to slices: 10
- Validated: 0
- Active requirements: 7
- Mapped to slices: 7
- Validated: 3 (R001, R002, R003)
- Unmapped active requirements: 0
+1 -1
View File
@@ -53,7 +53,7 @@ This milestone is complete only when all are true:
- [x] **S01: Smarter Gmail import and matching** `risk:high` `depends:[]`
> After this: User can connect Gmail, review likely messages or threads for a job, and import correspondence with much better matching confidence and less manual cleanup.
- [ ] **S02: Stronger AI application package drafting** `risk:high` `depends:[S01]`
- [x] **S02: Stronger AI application package drafting** `risk:high` `depends:[S01]`
> After this: From an imported job plus profile/CV context, the app generates materially better tailored CV and cover-letter drafts that feel specific and usable.
- [ ] **S03: Reply and follow-up drafting from real thread context** `risk:medium` `depends:[S01,S02]`
@@ -0,0 +1,60 @@
# S02: Stronger AI application package drafting
**Goal:** Make the application package generator use imported job/correspondence context well enough that tailored CV, cover-letter, and recruiter-message drafts feel specific, credible, and worth starting from inside the job workspace.
**Demo:** From a job that already has imported correspondence and profile/CV context, the user generates an application package in the workspace, sees drafts that clearly reflect the job plus imported Gmail context, edits and saves those drafts, and reopens the job to find the saved material still there as working output.
S02 directly owns active requirement **R003** and materially supports **R007** because the job workspace needs to behave like a place to prepare real application material, not just preview one-off AI output. The key risk is not missing endpoints; it is that the existing generator in `JobApplicationsController` may still produce generic drafts because it underuses S01 correspondence and saved recruiter/job context. The slice therefore stays backend-first again, then tightens the workspace save/edit loop around the improved contract.
## Must-Haves
- Application-package generation in `JobTrackerApi/Controllers/JobApplicationsController.cs` uses imported correspondence, recruiter/job context, profile CV structure, and attachment context deliberately enough to produce more specific drafts.
- The generated package returns and persists real working material for the job: tailored CV, cover letter, recruiter message, and any supporting package signals the workspace needs to show what was saved.
- The job workspace in `job-tracker-ui/src/components/JobDetailsDialog.tsx` makes generation, editing, and saving feel like one coherent loop instead of disconnected draft widgets.
## Proof Level
- This slice proves: integration
- Real runtime required: yes
- Human/UAT required: yes
## Verification
- `dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj --filter JobApplicationsApplicationPackageTests`
- `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx`
- Manual UAT: open a job with imported correspondence, generate the application package, confirm the drafts mention job/company/correspondence-specific details, save edits in the workspace, reload the job, and verify the saved package material is still present and usable.
## Observability / Diagnostics
- Runtime signals: application-package responses should expose the specific draft artifacts and package signals used by the workspace, while save endpoints should update persisted job fields clearly enough to inspect reload behavior.
- Inspection surfaces: `POST /api/jobapplications/{id}/generate-application-package`, `PUT /api/jobapplications/{id}/tailored-cv`, `PUT /api/jobapplications/{id}/application-drafts`, and the Tailored CV tab in `job-tracker-ui/src/components/JobDetailsDialog.tsx`.
- Failure visibility: backend tests should make empty-context and weak-context failures obvious, while the workspace should distinguish generation failure, unsaved edits, and saved package state.
- Redaction constraints: no raw secrets in AI prompts or logs; correspondence/body context should stay inside application data flows, not new diagnostic logging.
## Integration Closure
- Upstream surfaces consumed: S01 correspondence persistence in `Models/Correspondence.cs`, Gmail-linked workspace rendering in `job-tracker-ui/src/components/Correspondence.tsx`, profile CV state from `JobTrackerApi/Controllers/ProfileCvController.cs`, and the existing package endpoints/UI in `JobTrackerApi/Controllers/JobApplicationsController.cs` and `job-tracker-ui/src/components/JobDetailsDialog.tsx`.
- New wiring introduced in this slice: stronger draft-generation context assembly that consumes imported correspondence, plus clearer persistence/display of saved application package material in the job workspace.
- What remains before the milestone is truly usable end-to-end: S03 still needs to consume the saved package plus imported correspondence for reply/follow-up drafting, and final milestone slices still need full live-loop revalidation.
## Tasks
- [x] **T01: Strengthen application-package context assembly and backend draft tests** `est:4h`
- Why: S02 succeeds or fails on draft quality, so the generator must consume the right job, correspondence, recruiter, attachment, and profile-CV context before the workspace polish matters.
- Files: `JobTrackerApi/Controllers/JobApplicationsController.cs`, `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`
- Do: Audit `generate-application-package` and related helpers, add deliberate use of imported correspondence and recruiter/job context to the package prompt assembly, keep the no-auto-send boundary intact, and add focused backend tests that prove the returned package reflects stronger job-specific context instead of generic output.
- Verify: `dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj --filter JobApplicationsApplicationPackageTests`
- Done when: the backend package contract clearly uses imported job context and focused backend tests prove the response contains stronger, job-specific draft material.
- [x] **T02: Make the job workspace save and present the application package as real working material** `est:4h`
- Why: Even a better generator will still feel weak if the workspace treats drafts like disposable previews instead of editable saved material tied to the job.
- Files: `job-tracker-ui/src/components/JobDetailsDialog.tsx`, `job-tracker-ui/src/types.ts`, `job-tracker-ui/src/job-details-generated-drafts.test.tsx`
- Do: Refine the Tailored CV/application package tab so generated artifacts, saved edits, and package state read clearly as one working loop; surface the stronger backend outputs without adding a second draft system; and expand the existing dialog test to prove generation, editing, saving, and reload behavior for the package flow.
- Verify: `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx`
- Done when: the workspace generates, edits, saves, and re-displays application package material coherently, and the focused frontend test proves that loop.
## Files Likely Touched
- `JobTrackerApi/Controllers/JobApplicationsController.cs`
- `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`
- `job-tracker-ui/src/components/JobDetailsDialog.tsx`
- `job-tracker-ui/src/types.ts`
- `job-tracker-ui/src/job-details-generated-drafts.test.tsx`
@@ -0,0 +1,34 @@
---
title: S02 summary
status: done
verification:
- $HOME/.dotnet/dotnet build JobTrackerApi/JobTrackerApi.csproj
- docker run --rm -v "$PWD":/src -w /src mcr.microsoft.com/dotnet/sdk:9.0 bash -lc '...dotnet test /tmp/apptests/AppPkgTests.csproj...'
- CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx
---
S02 made the application-package flow materially more useful and more trustworthy.
Delivered:
- stronger backend package-context assembly in `JobTrackerApi/Controllers/JobApplicationsController.cs`
- imported correspondence is now part of package generation
- recruiter/job/profile/attachment context is threaded into the package prompts deliberately
- returned key points can include correspondence-derived and attachment-derived signals
- focused backend proof in `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`
- package generation responds to imported correspondence and recruiter context
- notes-saving behavior for application-answer material replaces rather than appends endlessly
- stronger job workspace loop in `job-tracker-ui/src/components/JobDetailsDialog.tsx`
- saved job material loads back into the Tailored CV tab as the starting workspace state
- generation replaces the working draft for tailored CV, cover letter, application answer, and recruiter message
- save writes the package back as job-tied working material rather than leaving it as a temporary preview
- the UI distinguishes saved state, generated-only state, and unsaved edits
- focused frontend proof in `job-tracker-ui/src/job-details-generated-drafts.test.tsx`
- verifies saved-state load, generation, editing, coherent save payload, and saved-state redisplay behavior
Net effect:
- S01 imported Gmail context now materially improves draft quality instead of sitting unused.
- The job workspace behaves more like a preparation surface the user can trust and reuse later.
- The manual-send boundary remains intact; S02 improved drafting and persistence only.
Remaining milestone gap after S02:
- S03 still needs to turn the imported thread context plus saved package state into strong reply/follow-up drafting.
@@ -0,0 +1,51 @@
---
estimated_steps: 4
estimated_files: 2
skills_used:
- best-practices
- test
---
# T01: Strengthen application-package context assembly and backend draft tests
**Slice:** S02 — Stronger AI application package drafting
**Milestone:** M001
## Description
Make the backend application-package generator use the context S01 now provides. The executor should keep the existing package endpoint, but improve how it builds prompts and selects context so the tailored CV, cover letter, recruiter message, and supporting signals reflect imported correspondence, recruiter/job details, profile CV structure, and attachment context more convincingly.
## Steps
1. Inspect `JobTrackerApi/Controllers/JobApplicationsController.cs` around `generate-application-package` and identify which job, recruiter, correspondence, attachment, and profile-CV signals are already available but underused.
2. Refine the package-context assembly and prompt shape so imported correspondence and recruiter/job-specific details influence the generated drafts directly without weakening the no-auto-send boundary.
3. Add a focused backend test file `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs` that exercises the package endpoint contract with real job/correspondence/profile context and asserts the returned artifacts are specific to that context.
4. Keep the output contract stable unless a change materially improves the workspace; if it changes, make the added fields explicit and limited to what T02 will consume.
## Must-Haves
- [ ] Imported correspondence from S01 is deliberately consumed in package generation instead of remaining disconnected from the draft flow.
- [ ] Backend tests prove package output responds to job-specific context rather than generic fallback behavior.
- [ ] The generator still returns review-only draft material and does not cross the manual-send boundary.
## Verification
- `dotnet test JobTrackerApi.Tests/JobTrackerApi.Tests.csproj --filter JobApplicationsApplicationPackageTests`
- Confirm the focused test covers correspondence-aware package context and expected package artifacts.
## Observability Impact
- Signals added/changed: clearer package-response artifacts and stronger context assembly around job/correspondence/profile inputs.
- How a future agent inspects this: read `JobTrackerApi/Controllers/JobApplicationsController.cs` and `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`.
- Failure state exposed: focused backend verification should show whether weak drafts come from missing context assembly, empty correspondence state, or prompt/output contract drift.
## Inputs
- `JobTrackerApi/Controllers/JobApplicationsController.cs` — current application-package and related AI draft endpoints.
- `Models/Correspondence.cs` — persisted Gmail-linked correspondence metadata from S01.
- `JobTrackerApi/Controllers/ProfileCvController.cs` — profile CV structure/source-of-truth behavior.
## Expected Output
- `JobTrackerApi/Controllers/JobApplicationsController.cs` — stronger package-generation context and/or response contract.
- `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs` — focused backend proof for context-aware package generation.
@@ -0,0 +1,32 @@
---
title: T01 summary
status: done
files:
- JobTrackerApi/Controllers/JobApplicationsController.cs
- JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs
verification:
- $HOME/.dotnet/dotnet build JobTrackerApi/JobTrackerApi.csproj
- docker run --rm -v "$PWD":/src -w /src mcr.microsoft.com/dotnet/sdk:9.0 bash -lc '...dotnet test /tmp/apptests/AppPkgTests.csproj...'
---
Strengthened application-package generation so it now consumes imported correspondence and recruiter/job context instead of relying mostly on job description text plus the profile CV.
What changed:
- `JobTrackerApi/Controllers/JobApplicationsController.cs`
- added `BuildCorrespondenceContextAsync(...)` to gather recent imported correspondence, participants, thread ids, and AI-derived package signals
- enriched `generate-application-package` context with:
- recruiter name/email and greeting baseline
- imported correspondence context from S01
- existing saved job material (tailored CV / cover letter / recruiter message) when present
- job URL in the package context
- updated prompts so tailored CV, cover letter, application answer, recruiter message, and variants all explicitly use imported correspondence when helpful without crossing the manual-send boundary
- expanded `KeyPoints` to include correspondence-derived and attachment-derived signals
- `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`
- added focused backend proof that package generation reacts to imported correspondence and recruiter context rather than falling back to generic output
Verification:
- Native backend build passed with `$HOME/.dotnet/dotnet build JobTrackerApi/JobTrackerApi.csproj`
- Focused application-package backend test passed in an isolated Docker harness (`1 passed`)
Important caveat:
- As with S01 backend verification, the repositorys broader `JobTrackerApi.Tests` project still has unrelated compile drift, so the focused package test was isolated instead of relying on the full test project.
@@ -0,0 +1,53 @@
---
estimated_steps: 4
estimated_files: 3
skills_used:
- react-best-practices
- test
---
# T02: Make the job workspace save and present the application package as real working material
**Slice:** S02 — Stronger AI application package drafting
**Milestone:** M001
## Description
Turn the Tailored CV/application package area into a coherent working loop. The workspace should make it obvious what was generated, what was edited, what was saved to the job, and what can be reused later, instead of feeling like a temporary AI preview pane.
## Steps
1. Update `job-tracker-ui/src/types.ts` if T01 changes the package contract or exposes stronger saved draft/package state.
2. Refine `job-tracker-ui/src/components/JobDetailsDialog.tsx` so generation, editing, saving, and redisplay of application package material feel like one continuous workflow tied to the job.
3. Expand `job-tracker-ui/src/job-details-generated-drafts.test.tsx` to prove the stronger package flow: generate with contextual outputs, edit/save the important draft artifacts, and verify the saved material is reflected back in the dialog state.
4. Keep the UI focused on working material already tied to the job; do not introduce a second competing draft surface or outbound automation.
## Must-Haves
- [ ] The Tailored CV tab clearly presents generated package artifacts as editable, savable job material rather than disposable previews.
- [ ] Saved package edits update dialog state in a way the user can trust and later slices can reuse.
- [ ] The focused React test proves generation and save behavior for the package loop.
## Verification
- `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx`
- Confirm the expanded test proves generation, editing, and save-state behavior in the dialog.
## Observability Impact
- Signals added/changed: clearer UI state around generated vs saved package material and stronger test coverage for package-loop regressions.
- How a future agent inspects this: open the Tailored CV tab in `job-tracker-ui/src/components/JobDetailsDialog.tsx` and read `job-tracker-ui/src/job-details-generated-drafts.test.tsx`.
- Failure state exposed: the workspace and test should distinguish generation failure, unsaved edits, and saved package state instead of collapsing them into generic draft text.
## Inputs
- `job-tracker-ui/src/components/JobDetailsDialog.tsx` — existing package-generation and save UI.
- `job-tracker-ui/src/types.ts` — frontend package contracts.
- `JobTrackerApi/Controllers/JobApplicationsController.cs` — T01 package-generation contract.
- `job-tracker-ui/src/job-details-generated-drafts.test.tsx` — current focused dialog test.
## Expected Output
- `job-tracker-ui/src/components/JobDetailsDialog.tsx` — stronger package generation/edit/save flow.
- `job-tracker-ui/src/types.ts` — aligned package contract for the workspace.
- `job-tracker-ui/src/job-details-generated-drafts.test.tsx` — focused frontend proof for the improved package loop.
@@ -0,0 +1,36 @@
---
title: T02 summary
status: done
files:
- job-tracker-ui/src/components/JobDetailsDialog.tsx
- job-tracker-ui/src/job-details-generated-drafts.test.tsx
verification:
- CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx
- $HOME/.dotnet/dotnet build JobTrackerApi/JobTrackerApi.csproj
- docker run --rm -v "$PWD":/src -w /src mcr.microsoft.com/dotnet/sdk:9.0 bash -lc '...dotnet test /tmp/apptests/AppPkgTests.csproj...'
---
Turned the Tailored CV tab into a real package workspace instead of a one-shot draft preview.
What changed:
- `job-tracker-ui/src/components/JobDetailsDialog.tsx`
- added package workspace state for cover letter, application answer, and recruiter message alongside the tailored CV
- initialized that workspace from saved job material so reopening the dialog shows the last trusted copy, not just blank/generated state
- generation now replaces the editable working copy for all package artifacts, not only the tailored CV
- added package-level save flow that writes the tailored CV plus draft artifacts back to the job together
- added explicit saved/generated/unsaved status chips so the user can tell what is persisted versus still in the working draft
- added reset-to-saved behavior so the workspace can recover from unwanted edits
- normalized application-answer persistence into a replaceable notes block instead of endlessly appending
- `job-tracker-ui/src/job-details-generated-drafts.test.tsx`
- expanded the focused dialog test to prove saved material loads into the workspace, generation replaces the working copy, edits can be saved, and the save payload reflects the coherent package state
Backend support tightened during T02:
- `JobTrackerApi/Controllers/JobApplicationsController.cs`
- `SaveApplicationDrafts` now replaces `Notes` when notes are provided, which makes the saved application-answer loop trustworthy instead of append-only
- `JobTrackerApi.Tests/JobApplicationsApplicationPackageTests.cs`
- added focused proof that notes replacement no longer appends indefinitely
Verification:
- Frontend focused test passed: `CI=true npm --prefix job-tracker-ui test -- --watch=false --runTestsByPath src/job-details-generated-drafts.test.tsx`
- Backend host build passed: `$HOME/.dotnet/dotnet build JobTrackerApi/JobTrackerApi.csproj`
- Focused backend package tests passed in isolated Docker harness (`2 passed`)