How the AI Job Search Framework Performs a Factual Grounding Audit for Drafted Documents
The AI Job Search Framework executes a factual grounding audit during the /apply command workflow by cross-referencing every date, employer, job title, and metric in drafted CVs and cover letters against a union of three authoritative source files, flagging discrepancies as structured JSON edits with reason code "grounding".
The MadsLorentzen/ai-job-search repository implements a rigorous validation layer to prevent hallucinations in AI-generated job application materials. This factual grounding audit is embedded directly into the /apply command workflow as Step 3, ensuring that every claim in your CV and cover letter traces back to verified candidate data before any file touches the disk.
The Three-Source Authority Union
The framework defines a union of three canonical sources against which all drafted claims are verified. According to the command specification in .claude/commands/apply.md (lines 92-95), a fact is considered grounded if it appears in any of these files:
.claude/skills/job-application-assistant/01-candidate-profile.md– The primary canonical candidate profile containing verified employment history and metrics.cv/main_example.tex– The master CV template that serves as a baseline factual reference.CLAUDE.md– Specifically the candidate profile section within this file, acting as an additional authoritative source.
This multi-source approach ensures redundancy; if one file omits a detail present in another, the claim still passes validation.
Step 3 Execution and Inline Review
The audit triggers automatically at Step 3 of the /apply command sequence, as specified in .claude/commands/apply.md (lines 443-445). Before the drafter writes any output to disk, the reviewer agent receives the CV and cover letter drafts inline rather than through file system reads.
The reviewer inspects every quantitative metric, date range, job title, and employer name against the three-source union. When the LLM detects a factual deviation, it generates a structured JSON object rather than raw text instructions.
Structured Edit Format
The reviewer returns Part A edits—factual corrections distinct from stylistic improvements—using a strict JSON schema:
{
"file": "cv/main_ExampleCo_SeniorDataScientist.tex",
"old_string": "Led a team of 5 data scientists (2022‑2023)",
"new_string": "Led a team of 4 data scientists (2021‑2022)",
"reason": "grounding"
}
The "reason": "grounding" field is mandatory for audit-related changes, allowing the system to distinguish factual corrections from Part B style edits.
Profile Consistency vs. Draft Drift
When the three authoritative sources disagree on a specific fact, the framework raises a profile-consistency warning rather than flagging the issue as draft drift. This distinction is critical: internal source conflicts indicate the candidate needs to reconcile their master files, whereas deviations between the draft and all three sources indicate ungrounded AI generation.
Only mismatches that affect factual accuracy receive the "grounding" reason code. The drafter then applies these corrections using the Edit tool, ensuring the final document contains no fabricated information.
Implementation Workflow
To invoke the grounding audit, users trigger the /apply command with a job posting URL:
$ ai-job-search /apply --posting "https://example.com/job/12345"
The framework automatically sequences through drafting, audit, and correction phases. After the reviewer returns JSON edits, the drafter executes:
ai-job-search edit \
--file cv/main_ExampleCo_SeniorDataScientist.tex \
--old "Led a team of 5 data scientists (2022‑2023)" \
--new "Led a team of 4 data scientists (2021‑2022)"
This loop guarantees that every element in the final application package is traceable to the trusted source files.
Summary
- The factual grounding audit runs automatically at Step 3 of the
/applycommand before any disk writes occur. - Verification draws from a union of three sources:
01-candidate-profile.md,main_example.tex, and the candidate profile section ofCLAUDE.md. - Discrepancies generate Part A edits with the explicit reason code
"grounding"to separate factual fixes from style changes. - Internal inconsistencies between source files trigger profile-consistency warnings rather than grounding failures.
- All changes are applied through structured JSON edits using the
Edittool, ensuring no hallucinated data persists in the final CV or cover letter.
Frequently Asked Questions
What triggers the factual grounding audit in the AI Job Search Framework?
The audit triggers automatically during Step 3 of the /apply command workflow, immediately after the drafter generates the initial CV and cover letter drafts but before writing them to disk, as implemented in .claude/commands/apply.md (lines 443-445).
Which source files does the framework check against during the audit?
The framework verifies claims against three authoritative sources: .claude/skills/job-application-assistant/01-candidate-profile.md, cv/main_example.tex, and the candidate profile section within CLAUDE.md. A claim is grounded if it appears in any of these files.
How does the framework distinguish between factual errors and style suggestions?
Factual mismatches are flagged as Part A edits with the reason field set to "grounding", while stylistic improvements are categorized separately. This allows the drafter to prioritize accuracy corrections over formatting changes.
What happens if the three source files contain conflicting information?
When the authoritative sources disagree, the system raises a profile-consistency warning indicating the candidate needs to reconcile their master files, rather than treating the conflict as ungrounded draft content.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →