Skip to content

feat(candidate-db): add Roles and Role profiles that cite Facts by id - #15

Merged
codeotter0201 merged 1 commit into
mainfrom
feat/issue-9-role-profiles
Nov 8, 2026
Merged

codeotter0201 merged 1 commit into
mainfrom
feat/issue-9-role-profiles

Conversation

@codeotter0201

Copy link
Copy Markdown
Owner

Summary

Implements Role profiles from #9: a Candidate can pursue several Roles, and each Role profile links the Candidate's Facts to the Role's requirements, with reasons and gaps.

  • skills/headhunter/scripts/hh.py: role new, role update, role list, role match, role build, role stale; Role checks in validate; Roles in candidate show; Role tables in the Index; search candidates --role / --requirement-tag / --no-must-gaps
  • skills/headhunter/SKILL.md: layout, role.yml and profile.md formats, gap kinds, staleness, the Roles workflow, search options, and a rule that Role profiles cite Facts and never change them
  • CONTEXT.md: defines Role and Role profile; Strategy now names Roles
  • README.md / README.zh-TW.md: the Role profiles feature

Related Issues

Closes #9

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Data layout change (existing data folders need migration)
  • Documentation update
  • Refactoring (no functional changes)

Decisions

Item Decision Rejected alternatives
How <role-slug> is formed The Role's title with the same rules as Candidate slugs (lowercased, spaces to hyphens, punctuation removed, Chinese kept); unique within the Candidate; a different title means a new Role Numbered ids such as role-1: unreadable folders. Letting titles change in place: the folder name would drift from the title
How a stale Role profile is detected profile.md records a hash of the Role definition, a hash of every Fact it cites, and the newest Fact id at build time. Stale when role.yml changed, a cited Fact changed or was removed, or a newer active Fact shares a Tag with the requirements File modification times: copying or touching files gives false results. Rebuilding on every change: loses the reasons and rewrites the agent's judgment without asking
Role profile format profile.md: a YAML block (the same subset as other files) the script validates and indexes, then a readable body the script renders from it Free Markdown: the Index could not read evidence and gaps. A separate YAML file: two files per profile
Gap kinds Worked out by the script: missing (no Fact), to-confirm (only inferred Facts), weak-evidence (only self-reported Facts); every requirement needs documented or third-party evidence or a gap entry Letting the agent label gaps: inconsistent and unchecked
"No must-have gaps" Counts missing and to-confirm on must-haves; weak-evidence is reported but does not count, since most resumes are self-reported Counting weak-evidence: almost every Candidate would match nothing
Role titles Must be a title in the Candidate's Glossary, so both languages are known; search candidates --role matches either language Free titles: English and Chinese searches and resumes would diverge
Priority and state Stored in role.yml; the script rewrites a Roles section in strategy.md, leaving the rest of the file to the agent Parsing priorities out of free text in strategy.md
Positioning Must list the Facts it is built from; each must be active and sourced Unchecked positioning text

Migration

Data folders created by #1 have no roles/; the script creates it with the first Role and adds the Roles section to strategy.md then. No other files change, so no migration is needed.

Validation

All runs used a copy of the fictional Candidates from #1 (王小明 c-001, 林小華 c-002) in a scratch HEADHUNTER_DATA_DIR outside any repository, with one Job snapshot from #12, on Python 3.9 unless noted. I acted as the agent following SKILL.md.

Roles

  • role new c-1 with title "Tech Lead" before it was in the Glossary → add the title 'Tech Lead' to glossary.yml as a title with both languages, nothing written
  • role new c-1 → senior-backend-engineer (4 must / 2 nice) and tech-lead (3 must / 1 nice); requirement ids r-001… assigned; strategy.md Roles table written
  • role new c-2 with a Job requirement citing j-yourator-99999 → Job j-yourator-99999 has no snapshot in jobs/; with j-yourator-25039 → data-engineer created
  • role match lists Facts per requirement by shared Tag, strongest evidence first, and flags requirements with none

Role profiles

  • A faulty build (superseded f-004 as evidence, a gap on a requirement with documented evidence, five gaps missing) → all seven problems listed, nothing written
  • Citing inferred f-012 as evidence → f-012 is inferred; list it under the requirement's gap to confirm
  • Built three profiles; the c-001 Roles share f-005 and f-013. data-engineer shows all three gap kinds: weak-evidence (r-001–r-004), to-confirm (r-005, f-012), missing (r-006)
  • Rebuilt one profile after noticing its headline used wording ("high-traffic") no Fact supports

Staleness and rebuild

  • New interview Source s-007, new Fact f-015 (tool/kubernetes), and an extra citation on f-005 → role stale: senior-backend-engineer: f-005 changed; new f-015 matches its requirements, tech-lead: f-005 changed; search candidates shows stale
  • Rebuilt both → Every Role profile is current.
  • role update adding requirement r-007 → profile: role.yml changed; rebuilt → current
  • A title change through role update → refused

Facts, Sources and Taxonomy are never changed by Roles

  • shasum of every facts.yml, sources.yml and taxonomy.yml before and after the rebuilds, and before and after role update and the drop → identical

Drop

  • role update c-1 tech-lead with {"state": "dropped"} → folder and profile kept, strategy.md shows dropped, search candidates --role "tech lead" → no match, role stale skips it

Index and search

  • search candidates --role "data engineer" --no-must-gaps → c-002 (0 must-have gaps); --role 資料工程師 (Chinese title through the Glossary) → c-002; --role engineer → both; --no-must-gaps → c-002 only; --requirement-tag kubernetes → c-001; --role "tech lead" --tag leadership → c-001 with matched Facts
  • Two query calls on role_gaps and role_evidence
  • Deleted index.sqlite, ran index (2 Candidates, 26 Facts, 3 Roles), repeated all 8 commands → diff is empty

Checks

Not run

Checklist

  • No real candidate data in code, examples, fixtures, screenshots or this PR
  • skills/headhunter/SKILL.md, README.md and README.zh-TW.md updated when behavior or data layout changed
  • Migration for existing data folders described (data layout changes only)
  • Self-review completed
  • Documentation updated (if needed)

🤖 Generated with Claude Code

A Candidate can pursue several Roles. Each Role keeps its definition in
roles/<role-slug>/role.yml (title from the Glossary, level, industries,
priority, state, and must/nice requirements with their origin) and its
Role profile in profile.md: positioning, evidence per requirement as Fact
ids with reasons, and gaps whose kind the script works out.

hh.py gains role new, update, list, match, build and stale. Profiles record
what they were built from, so a changed or removed Fact, a newer matching
Fact, or a changed role.yml marks them stale. strategy.md gets a Roles
section kept by the script, the Index gains Role tables, and search
candidates takes --role, --requirement-tag and --no-must-gaps.

Closes #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area/agent-instructions AGENTS.md, CLAUDE.md, CONTEXT.md and skill instructions area/docs README and contributor documentation type/feature New functionality labels Nov 8, 2026
@codeotter0201
codeotter0201 merged commit 0cf50e3 into main Nov 8, 2026
1 check passed
@codeotter0201
codeotter0201 deleted the feat/issue-9-role-profiles branch November 8, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent-instructions AGENTS.md, CLAUDE.md, CONTEXT.md and skill instructions area/docs README and contributor documentation type/feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Role profiles: link a Candidate's Facts to each target Role

1 participant