# Backstory Resume Generation Architecture Overview

The system follows a carefully designed pipeline with isolated stages to prevent fabrication:

## System Architecture Overview

The system uses a pipeline of isolated analysis and generation steps:

1. **Stage 1: Isolated Analysis** (three sub-stages)
   - **1A: Job Analysis** - Extracts requirements from job description only
   - **1B: Candidate Analysis** - Catalogs qualifications from resume/context only
   - **1C: Mapping Analysis** - Identifies legitimate matches between requirements and qualifications

2. **Stage 2: Resume Generation**
   - Uses mapping output to create a tailored resume with evidence-based content

3. **Stage 3: Verification**
   - Performs fact-checking to catch any remaining fabrications

## Stage 1: Isolated Analysis (three separate sub-stages)

1. **Job Analysis**: Extracts requirements from just the job description
2. **Candidate Analysis**: Catalogs qualifications from just the resume/context
3. **Mapping Analysis**: Identifies legitimate matches between requirements and qualifications

## Stage 2: Resume Generation

Creates a tailored resume using only verified information from the mapping

## Stage 3: Verification

1. Performs fact-checking to catch any remaining fabrications
2. Corrects issues if needed and re-verifies

### Key Anti-Fabrication Mechanisms

The system uses several techniques to prevent fabrication:

* **Isolation of Analysis Stages**: By analyzing the job and candidate separately, the system prevents the LLM from prematurely creating connections that might lead to fabrication.
* **Evidence Requirements**: Each qualification included must have explicit evidence from the original materials.
* **Conservative Transferability**: The system is instructed to be conservative when claiming skills are transferable.
* **Verification Layer**: A dedicated verification step acts as a safety check to catch any remaining fabrications.
* **Strict JSON Structures**: Using structured JSON formats ensures information flows properly between stages.

## Implementation Details

* **Prompt Engineering**: Each stage has carefully designed prompts with clear instructions and output formats.
* **Error Handling**: Comprehensive validation and error handling throughout the pipeline.
* **Correction Loop**: If verification fails, the system attempts to correct issues and re-verify.
* **Traceability**: Information in the final resume can be traced back to specific evidence in the original materials.