hired.candidate.knowledge_base#
The candidate knowledge base: a facade over the user-level store.
CandidateKnowledgeBase is the domain-driven entry point for accumulating
and querying knowledge about one candidate — what is true about them, reusable
across every job application. It wraps the UserStore
with validated, intention-revealing methods (add_fact, facts, record_qa,
save_upload, …) and keeps a regenerated, human-readable synopsis()
projection of the fact store for fast context loading.
Work tied to a specific company’s role(s) — alignment reports, company research,
interview prep — does not live here; it lives in a per-engagement
JDWorkspace, reached via jd().
Classes
|
Accumulated, open-world knowledge about a single candidate (user-level). |
- class hired.candidate.knowledge_base.CandidateKnowledgeBase(user='me', *, store=None)[source]#
Bases:
objectAccumulated, open-world knowledge about a single candidate (user-level).
>>> import tempfile, os >>> os.environ['HIRED_DATA_DIR'] = tempfile.mkdtemp() >>> kb = CandidateKnowledgeBase() # default candidate "me" >>> from hired.candidate.base import Fact, FactCategory >>> _ = kb.add_fact(Fact(statement='Built ML pipelines in Python', ... category=FactCategory.SKILL, tags=['python', 'ml'])) >>> [f.statement for f in kb.facts(category=FactCategory.SKILL)] ['Built ML pipelines in Python'] >>> [f.statement for f in kb.facts(tags=['ml'])] ['Built ML pipelines in Python']
- add_note(subject, text=None, *, files=None)[source]#
Record volunteered info about a subject into its dossier.
textis appended to the dossier’soverview.md;files(a{name: bytes}mapping) are attached as detail/media. Returns the dossier. This is the “by the way, I also did X” entry point — a single sentence or a whole folder both land here.- Return type:
- add_source(src, *, name=None)[source]#
Store a raw source (file path or bytes) and record its content digest.
Returns the source key (its name in the raw store). The digest (in
state.json) lets a later refresh detect new/changed sources without re-reading everything. Facts extracted from a source cite it by this key.- Return type:
- facts(*, category=None, tags=None, status=FactStatus.ASSERTED, include_negations=True)[source]#
Iterate facts, optionally filtered by category/tags/status.
By default only
ASSERTEDfacts are returned (superseded ones are hidden).tagsmatches facts containing any of the given tags.
- jd(jd_id, *, company=None, label=None)[source]#
Get-or-create the workspace for an engagement (1+ JDs of one company).
company/labelare recorded in the engagement’smetawhen given.- Return type:
- needs_refresh()[source]#
True when uningested source/Q&A material exists (refresh warranted).
- Return type:
- record_qa(entry, *, derived_facts=None)[source]#
Append a clarifying Q&A exchange; optionally distill it into facts.
When
derived_facts(atomic fact records extracted from the answer) are given, they are ingested withSourceKind.QAprovenance (source_id= the Q&A id, quotes verified against the answer) and back-linked via the entry’sderived_fact_ids— so a Q&A answer becomes reusable, discoverable knowledge rather than being buried in the history.- Return type:
- refresh(mode='soft', *, ingest_fn=None, apply=True)[source]#
Refresh
infofrom changed sources + undistilled Q&A.ingest_fn(item)supplies extraction (intelligence is external); withapply=Falsethe result is a non-destructive preview. Seehired.candidate.refresh.- Return type:
- regenerate_synopsis()[source]#
Rebuild and persist a human-readable synopsis from current facts.
This is a projection — always derived from the fact store, never hand-edited — so it can be regenerated at any time without loss.
- Return type:
- save_upload(name, data)[source]#
Store a raw uploaded document by filename (see
add_source()).- Return type:
- supersede(old_fact_id, new_fact)[source]#
Replace
old_fact_idwithnew_fact(invalidate, don’t delete).- Return type: