Cache Filename Pattern for Extracted Resume Text in the Hiring Agent

The hiring agent stores parsed résumé data in cache/resumecache_<PDF_BASENAME>.json, where <PDF_BASENAME> is the source PDF filename stripped of its .pdf extension.

The interviewstreet/hiring-agent repository automates résumé screening by caching extracted text to avoid re-processing PDFs. Understanding the cache filename pattern for extracted resume text is essential for debugging cache hits, manually inspecting stored data, or integrating with external pipelines.

How the Cache Filename is Constructed

The pattern follows a strict convention defined in the source code to ensure deterministic lookups.

The Naming Convention

In score.py (lines 215-218), the agent constructs the path using three sequential operations:

  1. Isolate the filename: os.path.basename(pdf_path) removes the directory path.
  2. Strip the extension: .replace('.pdf', '') removes the .pdf suffix.
  3. Format the path: The result is inserted into the template cache/resumecache_{base}.json.

This produces the final pattern:


cache/resumecache_<PDF_BASENAME>.json

For example, a PDF located at candidates/jane_doe.pdf generates the cache file cache/resumecache_jane_doe.json.

Implementation in score.py

The caching logic resides in the repository's score.py file, specifically where the agent prepares to read or write résumé data.

Development Mode Behavior

When DEVELOPMENT_MODE is enabled, the agent performs a filesystem check before extraction. If the calculated cache file exists, the agent loads the JSON content directly. If the file is absent, the agent extracts the résumé text and writes the result to cache/resumecache_<PDF_BASENAME>.json for future reuse.

Code Implementation

These practical examples demonstrate how to generate and interact with cache files according to the hiring agent's logic.

Generating the Cache Path

import os

def get_resume_cache_path(pdf_path: str) -> str:
    # Remove directory and .pdf extension, then prepend cache folder

    base = os.path.basename(pdf_path).replace('.pdf', '')
    return f"cache/resumecache_{base}.json"

# Example usage

pdf = "candidates/jane_doe.pdf"
cache_file = get_resume_cache_path(pdf)
print(cache_file)  # Output: cache/resumecache_jane_doe.json

Reading and Writing Cached Data

import json
from pathlib import Path

DEVELOPMENT_MODE = True

def load_or_extract_resume(pdf_path: str):
    cache_file = get_resume_cache_path(pdf_path)
    
    if DEVELOPMENT_MODE and Path(cache_file).exists():
        print(f"Loading cached data from {cache_file}")
        cached_data = json.loads(Path(cache_file).read_text(encoding="utf-8"))
        return cached_data
    
    # Placeholder for actual extraction logic

    extracted = {"candidate_name": "Jane Doe", "skills": ["Python", "Rust"]}
    
    # Write to cache for subsequent requests

    Path(cache_file).write_text(json.dumps(extracted), encoding="utf-8")
    return extracted

Summary

  • The cache filename pattern is cache/resumecache_<PDF_BASENAME>.json.
  • <PDF_BASENAME> derives from the source PDF filename with the .pdf extension removed using os.path.basename(pdf_path).replace('.pdf', '').
  • This logic is implemented in score.py at lines 215-218.
  • The cache is only utilized when DEVELOPMENT_MODE is active; production runs extract fresh data.

Frequently Asked Questions

Where does the hiring agent store cached résumé data?

Cached data is stored in the cache/ directory at the repository root. Each file follows the pattern resumecache_<filename>.json, where <filename> corresponds to the original PDF name without the extension.

How does the agent handle the PDF filename when creating the cache key?

The agent uses os.path.basename(pdf_path).replace('.pdf', '') to isolate the core filename. This removes both the directory path and the file extension, ensuring consistent cache keys regardless of where the PDF is stored on the filesystem.

Is the cache used in production mode?

No. According to the source code in score.py, the cache check only executes when DEVELOPMENT_MODE is enabled. In production environments, the agent processes the PDF fresh each time to ensure the most current data is analyzed.

Can I manually inspect cached résumé files?

Yes. The cached files are standard JSON format. You can open any cache/resumecache_<name>.json file in a text editor or JSON viewer to inspect the extracted résumé structure and debug parsing results.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →