JD Analysis & Build CV
Required Inputs
| Input | Description |
|---|---|
jd_url |
One or more URLs (or PDF paths) of job descriptions to process |
target_stage |
Which pipeline stage(s) to execute |
Input validation:
- If
jd_urlis missing, ask the user to provide it before proceeding. - If
target_stageis missing, default tostage_1_and_2.
Allowed target_stage Values
| Value | Behavior |
|---|---|
auto |
Decide which stage(s) to run based on record status |
stage_1_cv |
Run Stage 1 only (build CV) |
stage_2_analysis |
Run Stage 2 only (JD analysis) |
stage_1_and_2 |
Run Stage 1 first, then Stage 2 sequentially |
CRITICAL — Batch Processing Rules
When multiple JD URLs are provided in a single invocation:
Rule 0: No Pausing — Auto-Chunk at 20, Auto-Continue
NEVER stop partway through a chunk to ask the user "should I continue?" or require confirmation between individual jobs. Process continuously without interruption. NEVER ask the user to confirm between chunks.
- If the batch contains ≤ 20 URLs, process all of them in one continuous run.
- If the batch contains > 20 URLs, automatically split into chunks of 20. Process each chunk of 20 fully to completion, print a per-chunk summary table, then sleep 10 seconds and automatically start the next chunk. Repeat until all chunks are done. Do NOT pause for user confirmation between chunks.
Rule 1: Sequential, One-at-a-Time Execution
Each job MUST be processed as a complete, independent pipeline run. Do NOT batch multiple jobs into a single script, a single HTML generation pass, or a single PDF conversion batch.
Correct flow for N jobs:
For each job_url in [url_1, url_2, ..., url_N]:
1. Fetch JD content for this ONE job
2. Run duplicate check for this ONE job
3. Select CV template for this ONE job
4. Run JD analysis for this ONE job
5. Build CompTitle as lowercase "company|job title" (e.g. "sanofi|product owner, digital portfolio")
6. Create/update Notion record for this ONE job (include CompTitle)
7. Fetch the selected CV template from Notion (or use persistent HTML template)
8. Generate PDF CV from the REAL template for this ONE job
9. Generate PDF Cover Letter with REAL info for this ONE job
10. Update CV FileName for this ONE job
→ Then move to the next job
Rule 2: Never Generate CV Content — Always Use the Template
The CV PDF is a rendering of the Notion CV template page. The template contains Ray's real experience, education, contact info, and certifications.
FORBIDDEN:
- Writing a Python script that generates CV HTML content from scratch
- Creating a batch script that "writes" resume content for multiple jobs
- Generating any CV content that does not come directly from the Notion template page
REQUIRED:
- Use the persistent HTML template files for PDF generation:
PDF CVs/_template_ai_growth.html→ for AI GROWTH templatePDF CVs/_template_marketplace_payments.html→ for Marketplace & Payments template
- Copy the correct master template to the target filename
- Or render from the HTML template using headless Chrome
- The saved
Ray Liu Resume-*.pdfmust be a real duplicated file (regular file bytes on disk), not a symlink or Finder alias. Symlinks often show in Finder as Kind Alias (~tens of bytes), break Spotlight search in the folder, and behave inconsistently with Google Drive next to normal cover-letter PDFs. Never useln -sor any alias workaround for the resume. After copy, verify the output is not a symlink (e.g.test ! -L "path") and that file size is in the same ballpark as the master PDF.
Rule 3: Cover Letters Must Use Only Real Information
Every cover letter must reference ONLY Ray's actual background:
- Contact: (437) 556-8766 | liuhui66@gmail.com | Maple, ON
- Real companies: Woolf, PMI Durham, Snaplii, Philm, Qihoo 360
- Real education: MSc University of Sussex, Bachelor Beijing Institute of Technology
- Real certifications: PMP, CSPO, PSM, Azure Fundamentals, Stanford ML
Never fabricate work history, education, or achievements. Never reference companies Ray did not work at.
Rule 4: Allowed Parallelism
Only these specific steps may be parallelized across jobs:
- Fetching JD content (WebFetch for multiple URLs simultaneously)
- Notion duplicate checks (search queries can run in parallel)
Everything else — analysis, record creation, PDF generation — must be done per-job to prevent content hallucination.
Field Rules
Date Folder
Every date-based folder name, CV FileName path prefix, date:Date Saved:start, and cover letter date line MUST use today's date — the actual calendar date when the pipeline executes. Determine today's date from the system (e.g. date +%Y-%m-%d or the date in the user-info context). Never reuse a date from a previous run, a hardcoded date, or the date a JD was first ingested.
CompTitle
Always populate the CompTitle property when creating or updating a Job Applications DB record. Format: all lowercase "company|job title" — take the company name and job title parsed from the JD, join with a single pipe, and lowercase the entire string. Example: "sanofi|product owner, digital portfolio". This must be set before (or as part of) the Notion property update.
Execution
Step 1 — Load the Orchestration Framework
Fetch the orchestration framework from Notion before executing any stage:
- Job hunting: Stage orchestration + trigger system https://www.notion.so/Job-hunting-Stage-orchestration-trigger-system-3348d41a5cff804b9e8be94c4102917d
Read and follow the instructions in that page to understand the full stage definitions, trigger rules, and field mappings.
Step 2 — Run the Pipeline
Execute job_pipeline_orchestrator with:
jd_url: {jd_url}target_stage: {target_stage}
Route the workflow according to the orchestration framework loaded in Step 1.
If multiple URLs are provided, process them sequentially, one at a time, following the Batch Processing Rules above.
Stage Routing
stage_1_cv→ Run Stage 1 only.stage_2_analysis→ Run Stage 2 only.stage_1_and_2→ Run Stage 1 first, then Stage 2.auto→ Inspect the current record status and decide which stage(s) to run.
Expected Output
After execution, report:
- Execution summary — what was done (per job if batch)
- Record action taken — created / updated / skipped
- Stage executed — which stage(s) ran
- Fields updated — list of fields written or changed
- Blocked or incomplete steps — any stage that could not complete, with reason