Draft a profile from a CV¶
profiler/cv_to_profile.py sends a CV to the Claude API once and writes a
draft profile, remarks on the CV, and clarifying questions. It's a local
prototype for Milestone 2: it runs on your computer, never in the daily
workflow. ADR 0010
explains the choice of model, the cost, and what happens to the CV.
Before you start¶
You need:
- Python 3.12 or later
- an Anthropic API key from the Claude Console, with credit on the account
-
the packages in
requirements-profiler.txt:python3 -m pip install -r requirements-profiler.txt
Then set up the private files once:
-
Turn on the pre-commit hook, which blocks CVs,
.env, and anything inprivate/from commits:git config core.hooksPath .githooks -
Create
.envin the repository root with one line, and paste your key after the=sign:ANTHROPIC_API_KEY=git ignores
.env. The script reads the key from it, or from anANTHROPIC_API_KEYenvironment variable, and never prints it. -
Put your CV in
private/, as a.pdf,.docx, or.txtfile. git ignores that folder, and every.pdf,.doc, and.docxfile in the repository.
Run it¶
python3 profiler/cv_to_profile.py private/cv.pdf --compare profiles/gergely.yaml
It makes one API call, which takes about a minute. Then it prints the token counts and the cost:
Wrote profile-draft.yaml, cv-review.md, comparison.md to private/.
Model: claude-sonnet-5-5. Tokens: 6344 in, 2165 out. Cost: about USD 0.034.
The CV's text wasn't saved. Delete the CV from private/ when you no longer need it.
| Option | Default | What it does |
|---|---|---|
--model |
claude-sonnet-5-5 |
The Claude model to use |
--out |
private/ |
Where to write the results. It must be inside private/. |
--compare |
none | A hand-made profile to compare the draft with |
What you get¶
All three files are in private/, so they never reach the repository.
-
profile-draft.yaml: a profile in the same layout asprofiles/gergely.yaml. Before saving it, the script checks it with the profile rules the ranker uses, plus three more:- weights within the ranges the profile uses: titles 1 to 10, skills and languages 1 to 5
- no target title that contains a word from
exclude_titlesorexclude_seniority, because that title could never match - experience between 0 and 60 years, leeway between 0 and 5
If the draft breaks a rule, nothing is saved, and the script lists the problems. Run it again: the answer varies from run to run. -
cv-review.md: remarks in the formYour CV shows X but not Y, and 3 to 5 questions whose answers would change the profile, such as which roles you want next and which seniority you're aiming for. It also records the token counts and the cost. -comparison.md: with--compare, how the draft differs from the hand-made profile, field by field: - Matches and Partly matches, with both weights when they differ. Phrases partly match when one contains the other, such asdocumentation specialistanddocumentation. - Missing: in the hand-made profile only. - Only in the draft. - Possibly wrong: draft entries that work against the hand-made profile, such as a target title the hand-made profile excludes.You can also compare two profile files without calling the API:
python3 profiler/compare_profiles.py private/profile-draft.yaml profiles/gergely.yaml
The draft leaves three fields for you, because a CV can't answer them:
can_work_from, min_salary_usd_per_year, and ai_training. To use the
draft, answer the questions, edit it, fill in those fields, and copy it to
profiles/. The repository is public, so read it once more for anything you
don't want to publish.
What's sent, and what's kept¶
- The CV goes to Anthropic once. A PDF is sent as a PDF, so Claude reads the
layout too. A
.docxfile is sent as its text. - The CV's text is held in memory only and never written to disk.
- Anthropic doesn't train models on API data by default, and keeps it for up to 30 days. ADR 0010 has the details and links.
- Delete your CV from
private/when you no longer need it. The script doesn't delete it for you.
When it fails¶
| Message | What to do |
|---|---|
ANTHROPIC_API_KEY is empty |
Paste your key into .env after the = sign. |
Put the CV in private/ first |
Move the CV into private/. |
HTTP 401: the key was rejected |
Check the key in .env, and that the Console account has credit. |
HTTP 429: rate limited |
Wait a minute and run it again. |
Claude declined to read this CV |
Make a .txt copy with only your work history and try that. |
The draft breaks the profile rules |
Run it again. If it keeps failing on the same rule, change the prompt in profiler/prompt.json. |
Run the tests¶
python3 -m unittest tests.test_cv_to_profile
The tests never call the API: a fake client stands in for it. They use the
fictional CV in samples/cv-sample.txt, and don't need the anthropic
package. They check, among other things, that the CV's text is never written
to an output file, and that the key is never printed.
Known limits¶
- The draft varies. Two runs on the same CV give different phrases and weights. Always review it.
- The CV only shows the past. Titles you want but haven't held, such as
help centerin the maintainer's profile, are often missing. The questions try to catch this. - Rules can't judge every choice. The first real run added
stafftoexclude_seniority, which would removeStaff Writerjobs. The prompt now says thatstaffsignals seniority only in engineering titles, such asStaff Engineer, but similar choices need your review. - The comparison isn't a score to maximize. A hand-made profile holds career choices a CV can't show. Change the prompt only for mistakes that would be wrong for anyone, not to match one person's profile.
- Old Word files (
.doc) aren't read. Save them as.docxor PDF.