# How the AI Job Search Framework Implements Token-Efficiency Rules in Multi-Agent Workflows

> Learn how the AI Job Search framework optimizes LLM token usage in multi-agent workflows. Discover efficient techniques like inline drafts and placeholder templates.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: internals
- Published: 2026-08-29

---

**The AI Job Search framework minimizes LLM token consumption by passing drafts inline between agents, executing verification steps once, using placeholder-based templates, and mandating environment-variable-only API token access.**

The `MadsLorentzen/ai-job-search` repository orchestrates complex job application workflows through specialized agents. By implementing strict token-efficiency rules across its multi-agent architecture, the framework ensures that collaborative pipelines—spanning drafting, reviewing, and verification—remain cost-effective without sacrificing output quality.

## Core Token-Efficiency Rules in Multi-Agent Workflows

The framework splits job-application runs into distinct agents, such as a **drafter** that generates CVs and cover letters, and a **reviewer** that researches companies and critiques drafts. To prevent token bloat across these handoffs, the codebase enforces four specific efficiency rules.

### Inline Draft Passing to Reviewer Agents

Instead of forcing the reviewer agent to re-read the original job posting, the framework passes the already-generated drafts inline. This design eliminates the need for a second full-length prompt containing the same content, dramatically reducing token consumption in the second LLM call.

According to the source documentation in [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md) (lines 258-259), the reviewer receives the drafter's output directly, avoiding redundant re-presentation of the job description or user profile data.

```python

# Token-efficient handoff: Draft passed inline to reviewer

draft = drafter.generate_cv_and_cover()          # First LLM call (full prompt)

review_prompt = f"""You are the reviewer agent.
Here is the draft to evaluate:\n{draft}
Please research the company and provide feedback."""
review = reviewer.run(review_prompt)              # Second LLM call, no repost of posting

```

### Single Verification Checklist Execution

Rather than duplicating validation logic across multiple agents, the framework runs the verification checklist **once** at the end of the workflow. This consolidation prevents both the drafter and reviewer from independently consuming tokens to perform identical validation checks.

As documented in [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md) (lines 258-259), the verification step executes only after the reviewer has completed feedback, ensuring redundant token usage is cut from the pipeline.

```bash

# Execute verification once after reviewer feedback

apply --run-verification-checklist   # Runs once at workflow end

```

### Placeholder-Based Template System

All template files store personal data as `[PLACEHOLDER]` tokens. When a user runs `/setup`, the framework replaces these placeholders with actual values. This approach preserves a token-light, shareable baseline that never leaks personal data while keeping template files lightweight.

The [`templates/README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/templates/README.md) (lines 26-27) specifies this convention, ensuring that raw templates remain portable and human-readable without containing token-heavy personal information.

```markdown

# Example template excerpt

Experience: [PLACEHOLDER_COMPANY] - [PLACEHOLDER_ROLE]

```

### Secure API Token Handling for Portal Skills

Generated portal-specific skills read required API tokens **only** from environment variables (formatted as `<SERVICE>_API_TOKEN`). Tokens are never hard-coded, passed as CLI flags, or stored in the repository. This prevents accidental token exposure and ensures that token-related costs are accounted for before the skill is generated.

The [`.claude/commands/add-portal.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-portal.md) file mandates this behavior in lines 85-90 and 160-162, explicitly rejecting inline credential storage to prevent both security vulnerabilities and unintended token consumption during skill generation.

```yaml

# Secure token configuration in generated skills

environment:
  LINKEDIN_API_TOKEN: "${{ secrets.LINKEDIN_API_TOKEN }}"   # Read from env only

```

## Supporting Token Conservation Infrastructure

Beyond the core workflow rules, the framework implements additional infrastructure to minimize unnecessary token expenditure.

### Research Caching Mechanisms

The test suite validates that the reviewer agent checks the cache before re-researching a company. The [`tests/test_company_research_cache.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tests/test_company_research_cache.py) file (lines 3-12) enforces this behavior, ensuring that repeated lookups of identical company data do not trigger redundant LLM calls or API requests.

### Upstream Triage Filtering

The [`tools/upstream_triage.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/upstream_triage.py) script (lines 17-26) implements logic that filters out already-applied commits and irrelevant changes before they enter the agent workflow. This triage step prevents token-heavy operations from processing data that has already been handled, extending the token-efficiency mindset to the broader tool chain.

## Summary

- **Inline draft passing** eliminates duplicate job posting prompts by sending drafter output directly to the reviewer, as specified in [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md).
- **Single verification execution** runs the checklist once at workflow completion rather than duplicating it across agents.
- **Placeholder templates** use `[PLACEHOLDER]` tokens to maintain lightweight, shareable files that only expand during the `/setup` command.
- **Environment-variable-only API tokens** prevent credential leakage and ensure cost accountability, as enforced in [`.claude/commands/add-portal.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-portal.md).
- **Caching and triage** mechanisms in [`tests/test_company_research_cache.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tests/test_company_research_cache.py) and [`tools/upstream_triage.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/upstream_triage.py) prevent redundant operations.

## Frequently Asked Questions

### How does the AI Job Search framework prevent the reviewer agent from re-reading the job posting?

The framework passes the drafter's generated content inline to the reviewer agent. According to [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md) (lines 258-259), the reviewer receives the draft directly rather than a second full copy of the job posting, cutting token consumption by eliminating redundant prompt content.

### Why does the framework use placeholders instead of hard-coding personal data in templates?

The `[PLACEHOLDER]` system documented in [`templates/README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/templates/README.md) (lines 26-27) keeps template files token-light and portable. Personal data is injected only during the `/setup` run, ensuring templates remain shareable without exposing private information or bloating file sizes with variable content.

### Where does the framework require API tokens to be stored, and why?

The framework mandates that all portal-specific API tokens be read exclusively from environment variables (formatted as `<SERVICE>_API_TOKEN`). As specified in [`.claude/commands/add-portal.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-portal.md) (lines 85-90 and 160-162), hard-coding tokens or passing them via CLI flags is prohibited to prevent accidental exposure and ensure cost visibility before generation.

### What mechanism prevents the reviewer from researching the same company multiple times?

The framework implements a caching layer validated by [`tests/test_company_research_cache.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tests/test_company_research_cache.py) (lines 3-12). The reviewer agent checks this cache before initiating new research, ensuring that previously retrieved company data does not trigger redundant LLM calls or API requests.