# ajay1812/applyforge architecture

> Architecture diagram of the GitHub repository ajay1812/applyforge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ajay1812/applyforge
- Repository: https://github.com/ajay1812/applyforge

## Overview

#### Purpose and entry points
ApplyForge is a Python 3.11+ daily job-hunt automation for one candidate. It discovers public listings, filters and permanently deduplicates them, tailors and renders resumes, creates optional outreach drafts, and records outcomes for review. The primary entry point is `run.sh`, which invokes `scripts/run_pipeline.py`; scheduled execution is driven externally by Hermes using `daily_run_prompt.md`.

#### Pipeline orchestration
`scripts/run_pipeline.py` owns the daily control flow and coordinates stages rather than exposing a service/API. It applies the shared auto-draft experience policy from `scripts/common.py`, processes eligible jobs, and emits a run summary. `scripts/reprocess_job.py` supports rerunning a selected job after failures, while `scripts/add_manual_lead.py` injects manually supplied recruiter leads into the same downstream flow.

#### Job ingestion, eligibility, and deduplication
`scripts/fetch_jobs.py` retrieves listings from public sources, including Greenhouse/Lever boards configured in `companies.yaml`. It filters jobs for candidate eligibility and deduplicates against the persistent `tracker.csv` log, which is the source of truth for whether a listing has been seen. This is a durable boundary: removing tracker rows is required to intentionally reprocess jobs.

#### Candidate-document generation
`scripts/tailor_resume.py` transforms the private runtime resume input derived from `resume/base_cv.yaml` (template: `resume/base_cv.example.yaml`) using deterministic keyword reordering; it must not invent candidate experience. It produces a job-specific rendered resume artifact. `scripts/ats_score.py` evaluates heuristic job/resume keyword coverage, supporting prioritization or quality checks without an external model.

#### Outreach and Gmail boundary
Outreach content is generated by `scripts/compose_email_groq.py`, with template fallback behavior in `scripts/compose_email.py`. Groq is optional for generation but configured through `GROQ_API_KEY`. `scripts/gmail_draft.py` is intentionally constrained to creating Gmail drafts, never sending messages; it only acts when a listing has a public contact email. Gmail access uses Google OAuth and the compose/readonly scopes, with common authentication handling in `scripts/gmail_auth_common.py`.

#### Tracking and knowledge management
The system records pipeline outcomes in the local tracker and Obsidian. `scripts/obsidian_sync.py` maintains the job tracker representation, and `scripts/daily_obsidian_note.py` creates daily notes. Obsidian integration can use its Local REST API plugin or write to the configured vault path. `scripts/archive_old_jobs.py` is an opt-in lifecycle operation for moving historical job folders into an archive.

#### Runtime and operational boundaries
The application runs as local Python scripts in a virtual environment using `requirements.txt`; `requirements-dev.txt` supports development/test dependencies. Runtime secrets and personal data are environment/local-file based: `.env.example` documents configuration, while Gmail OAuth files, `.env`, the real base CV, and `tracker.csv` remain uncommitted. Execution must avoid an inherited `PYTHONPATH`, because an external Hermes environment can conflict with RenderCV/Pydantic dependencies.

Main entry points: [`scripts/run_pipeline.py`](https://github.com/ajay1812/applyforge/blob/main/scripts/run_pipeline.py) (Pipeline coordinator), [`scripts/fetch_jobs.py`](https://github.com/ajay1812/applyforge/blob/main/scripts/fetch_jobs.py) (Fetch, filter, deduplicate), [`scripts/tailor_resume.py`](https://github.com/ajay1812/applyforge/blob/main/scripts/tailor_resume.py) (Tailor and render resume), [`scripts/compose_email_groq.py`](https://github.com/ajay1812/applyforge/blob/main/scripts/compose_email_groq.py) (Compose outreach)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Execution"]
  node_hermes(("Hermes scheduler<br/>external scheduler"))
  node_run["Daily launcher<br/>shell entry point<br/>[run.sh]"]
  node_pipeline["Pipeline coordinator<br/>Python orchestration<br/>[run_pipeline.py]"]
  node_reprocess["Selected-job reprocess<br/>recovery command<br/>[reprocess_job.py]"]
end

subgraph group_jobs["Job intake"]
  node_manual_lead["Manual lead intake<br/>lead command<br/>[add_manual_lead.py]"]
  node_fetch["Fetch, filter, deduplicate<br/>job ingestion<br/>[fetch_jobs.py]"]
  node_sources(("Public job boards<br/>external sources<br/>[companies.yaml]"))
end

subgraph group_documents["Documents"]
  node_tailor["Tailor and render resume<br/>document generation<br/>[tailor_resume.py]"]
  node_base_cv["Private base CV<br/>runtime candidate input"]
  node_ats["ATS coverage score<br/>heuristic evaluation<br/>[ats_score.py]"]
  node_resume["Job-specific resume<br/>rendered artifact"]
end

subgraph group_outreach["Outreach"]
  node_compose["Compose outreach<br/>draft generation"]
  node_groq(("Groq API<br/>optional external AI"))
  node_gmail["Gmail draft creator<br/>Gmail integration<br/>[gmail_draft.py]"]
  node_google(("Google OAuth / Gmail<br/>external API"))
end

subgraph group_tracking["Tracking"]
  node_tracker[("Job tracker<br/>persistent CSV")]
  node_obsidian_sync["Obsidian job sync<br/>knowledge sync<br/>[obsidian_sync.py]"]
  node_daily_note["Daily Obsidian note<br/>knowledge note"]
  node_obsidian[("Obsidian vault<br/>local knowledge store")]
end

node_hermes -.->|"scheduled trigger"| node_run
node_run -->|"invokes"| node_pipeline
node_reprocess -.->|"reruns selected job"| node_pipeline
node_manual_lead -.->|"injects lead"| node_pipeline
node_pipeline -->|"discovers jobs"| node_fetch
node_sources -->|"listings"| node_fetch
node_fetch -->|"checks and records seen jobs"| node_tracker
node_fetch -->|"eligible unseen jobs"| node_tailor
node_base_cv -->|"candidate data"| node_tailor
node_tailor -->|"renders"| node_resume
node_resume -->|"coverage evaluation"| node_ats
node_pipeline -->|"eligible outreach"| node_compose
node_groq -.->|"optional generation"| node_compose
node_compose -->|"draft content"| node_gmail
node_gmail -->|"OAuth draft creation"| node_google
node_pipeline -->|"records outcomes"| node_tracker
node_pipeline -->|"syncs jobs"| node_obsidian_sync
node_pipeline -->|"creates daily note"| node_daily_note
node_obsidian_sync -->|"updates tracker view"| node_obsidian
node_daily_note -->|"writes note"| node_obsidian

click node_hermes "https://github.com/ajay1812/applyforge/blob/main/daily_run_prompt.md"
click node_run "https://github.com/ajay1812/applyforge/blob/main/run.sh"
click node_pipeline "https://github.com/ajay1812/applyforge/blob/main/scripts/run_pipeline.py"
click node_reprocess "https://github.com/ajay1812/applyforge/blob/main/scripts/reprocess_job.py"
click node_manual_lead "https://github.com/ajay1812/applyforge/blob/main/scripts/add_manual_lead.py"
click node_fetch "https://github.com/ajay1812/applyforge/blob/main/scripts/fetch_jobs.py"
click node_sources "https://github.com/ajay1812/applyforge/blob/main/companies.yaml"
click node_tailor "https://github.com/ajay1812/applyforge/blob/main/scripts/tailor_resume.py"
click node_ats "https://github.com/ajay1812/applyforge/blob/main/scripts/ats_score.py"
click node_compose "https://github.com/ajay1812/applyforge/blob/main/scripts/compose_email_groq.py"
click node_gmail "https://github.com/ajay1812/applyforge/blob/main/scripts/gmail_draft.py"
click node_obsidian_sync "https://github.com/ajay1812/applyforge/blob/main/scripts/obsidian_sync.py"
click node_daily_note "https://github.com/ajay1812/applyforge/blob/main/scripts/daily_obsidian_note.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hermes,node_run,node_pipeline,node_reprocess toneBlue
class node_manual_lead,node_fetch,node_sources toneAmber
class node_tailor,node_base_cv,node_ats,node_resume toneMint
class node_compose,node_groq,node_gmail,node_google toneRose
class node_tracker,node_obsidian_sync,node_daily_note,node_obsidian toneIndigo
```

## Components

### Execution

- [Hermes scheduler](https://github.com/ajay1812/applyforge/blob/main/daily_run_prompt.md): external scheduler · Triggers the daily run using the prompt. · `daily_run_prompt.md`
- [Daily launcher](https://github.com/ajay1812/applyforge/blob/main/run.sh): shell entry point · `run.sh`
- [Pipeline coordinator](https://github.com/ajay1812/applyforge/blob/main/scripts/run_pipeline.py): Python orchestration · Applies the shared auto-draft policy and emits a run summary. · `scripts/run_pipeline.py`
- [Selected-job reprocess](https://github.com/ajay1812/applyforge/blob/main/scripts/reprocess_job.py): recovery command · `scripts/reprocess_job.py`

### Job intake

- [Manual lead intake](https://github.com/ajay1812/applyforge/blob/main/scripts/add_manual_lead.py): lead command · `scripts/add_manual_lead.py`
- [Fetch, filter, deduplicate](https://github.com/ajay1812/applyforge/blob/main/scripts/fetch_jobs.py): job ingestion · `scripts/fetch_jobs.py`
- [Public job boards](https://github.com/ajay1812/applyforge/blob/main/companies.yaml): external sources · Includes configured Greenhouse and Lever boards. · `companies.yaml`

### Documents

- [Tailor and render resume](https://github.com/ajay1812/applyforge/blob/main/scripts/tailor_resume.py): document generation · Deterministically reorders keywords without inventing experience. · `scripts/tailor_resume.py`
- **Private base CV**: runtime candidate input · Derived from the documented CV template.
- [ATS coverage score](https://github.com/ajay1812/applyforge/blob/main/scripts/ats_score.py): heuristic evaluation · `scripts/ats_score.py`
- **Job-specific resume**: rendered artifact

### Outreach

- [Compose outreach](https://github.com/ajay1812/applyforge/blob/main/scripts/compose_email_groq.py): draft generation · Uses Groq when available and falls back to templates. · `scripts/compose_email_groq.py`
- **Groq API**: optional external AI · Enabled by GROQ_API_KEY.
- [Gmail draft creator](https://github.com/ajay1812/applyforge/blob/main/scripts/gmail_draft.py): Gmail integration · Creates drafts only when a public contact email exists; never sends. · `scripts/gmail_draft.py`
- **Google OAuth / Gmail**: external API · Uses compose and readonly scopes.

### Tracking

- **Job tracker**: persistent CSV · Source of truth for seen listings and pipeline outcomes.
- [Obsidian job sync](https://github.com/ajay1812/applyforge/blob/main/scripts/obsidian_sync.py): knowledge sync · Uses Local REST API or the configured vault path. · `scripts/obsidian_sync.py`
- [Daily Obsidian note](https://github.com/ajay1812/applyforge/blob/main/scripts/daily_obsidian_note.py): knowledge note · `scripts/daily_obsidian_note.py`
- **Obsidian vault**: local knowledge store

## Connections

- Hermes scheduler → Daily launcher: scheduled trigger
- Daily launcher → Pipeline coordinator: invokes
- Selected-job reprocess → Pipeline coordinator: reruns selected job
- Manual lead intake → Pipeline coordinator: injects lead
- Pipeline coordinator → Fetch, filter, deduplicate: discovers jobs
- Public job boards → Fetch, filter, deduplicate: listings
- Fetch, filter, deduplicate → Job tracker: checks and records seen jobs
- Fetch, filter, deduplicate → Tailor and render resume: eligible unseen jobs
- Private base CV → Tailor and render resume: candidate data
- Tailor and render resume → Job-specific resume: renders
- Job-specific resume → ATS coverage score: coverage evaluation
- Pipeline coordinator → Compose outreach: eligible outreach
- Groq API → Compose outreach: optional generation
- Compose outreach → Gmail draft creator: draft content
- Gmail draft creator → Google OAuth / Gmail: OAuth draft creation
- Pipeline coordinator → Job tracker: records outcomes
- Pipeline coordinator → Obsidian job sync: syncs jobs
- Pipeline coordinator → Daily Obsidian note: creates daily note
- Obsidian job sync → Obsidian vault: updates tracker view
- Daily Obsidian note → Obsidian vault: writes note
