Where Are Cached GitHub Data Results Stored in the Hiring Agent Repository?
Cached GitHub API responses in the Hiring Agent repository are stored as JSON files in a top-level cache/ directory, with filenames prefixed by gh_githubcache_ and constructed by the _create_cache_filename helper in github.py.
The interviewstreet/hiring-agent project caches GitHub API results to speed up development and reduce rate-limit hits. Understanding exactly where these cached GitHub data results are stored helps you debug stale data, clear outdated responses, or manually seed specific API outputs for testing.
Cache Directory Location and Naming Convention
All cached GitHub data lives under the cache/ directory at the repository root. Files follow a strict naming pattern:
cache/gh_githubcache_<url_parts>[_<param_str>].json
The components break down as follows:
<url_parts>– A sanitized version of the API endpoint path (e.g.,users_octocatfor the/users/octocatendpoint).<param_str>– An optional, URL-encoded query string appended only whenparamsare supplied to the request.
For example, a request to https://api.github.com/users/octocat creates cache/gh_githubcache_users_octocat.json, while parameterized requests include the encoded query in the filename.
How Cache Filenames Are Generated
The helper function _create_cache_filename (defined in [github.py](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) lines 18–35) builds these paths dynamically. It sanitizes the endpoint URL and appends encoded parameters to ensure unique cache keys per distinct API call.
During runtime, this function returns an absolute or relative path string pointing to the specific JSON file inside cache/. If the directory does not exist, it is created on demand during the write phase.
Cache Read and Write Mechanics
Loading Cached Data
The main GitHub-fetch routine (lines 35–44 of [github.py](https://github.com/interviewstreet/hiring-agent/blob/main/github.py)) checks for cached results before making a network request:
if DEVELOPMENT_MODE and os.path.exists(cache_filename):
print(f"Loading cached GitHub data from {cache_filename}")
cached_data = json.loads(Path(cache_filename).read_text(encoding="utf-8"))
return 200, cached_data
When the file exists and DEVELOPMENT_MODE is True, the function returns the stored JSON payload immediately, bypassing the live API.
Writing Cache Files
When fetching fresh data, the response is persisted to disk (lines 106–111 of [github.py](https://github.com/interviewstreet/hiring-agent/blob/main/github.py)):
os.makedirs("cache", exist_ok=True)
Path(cache_filename).write_text(json.dumps(resp_json, ensure_ascii=False))
This ensures the cache/ directory exists and writes the normalized JSON response for future requests.
Practical Cache Management
Manually Clearing the GitHub Cache
To remove stale GitHub data and force fresh API calls, delete files matching the gh_githubcache_ prefix:
import os
cache_dir = "cache"
if os.path.isdir(cache_dir):
for filename in os.listdir(cache_dir):
if filename.startswith("gh_githubcache_"):
os.remove(os.path.join(cache_dir, filename))
Inspecting Cache Contents
You can read and debug cached responses directly:
import json
from pathlib import Path
cache_file = Path("cache/gh_githubcache_repo_issues.json")
if cache_file.is_file():
cached_json = json.loads(cache_file.read_text())
print(json.dumps(cached_json, indent=2))
Disabling Caching for One-Off Runs
Set DEVELOPMENT_MODE to False before invoking fetch functions to bypass the cache entirely:
from config import DEVELOPMENT_MODE
DEVELOPMENT_MODE = False
# This call will always hit the live GitHub API
status, data = fetch_github_data(api_url, params)
Related Caching Patterns
The same repository uses analogous caching elsewhere. For example, resume-scoring logic in [score.py](https://github.com/interviewstreet/hiring-agent/blob/main/score.py) (lines 215–220) writes to cache/resumecache_*.json. While this uses a different prefix, the underlying mechanism—timestamped JSON files in the cache/ directory—remains consistent.
Summary
- Location: All cached GitHub data results are stored in the
cache/directory at the repository root. - Filename Pattern: Files use the format
cache/gh_githubcache_<url_parts>[_<param_str>].json, generated by_create_cache_filenameingithub.py. - Activation: Caching only operates when
DEVELOPMENT_MODEis enabled; production runs bypass the cache. - Persistence: Cache files are plain JSON and can be edited, deleted, or version-controlled for testing scenarios.
Frequently Asked Questions
Where exactly are cached GitHub results stored in the Hiring Agent project?
Cached GitHub results are stored as individual JSON files inside a cache/ folder at the repository root. Each file is named gh_githubcache_<sanitized_endpoint>[_<params>].json according to the specific API call that generated it.
How do I clear the GitHub cache to fetch fresh data?
Delete files starting with gh_githubcache_ from the cache/ directory. You can do this manually or programmatically by iterating over the directory contents and removing matching filenames. The next API call will then fetch fresh data from GitHub and repopulate the cache.
Why is my Hiring Agent not loading cached GitHub data?
The cache is only checked when DEVELOPMENT_MODE is set to True. If this flag is disabled, the application ignores existing cache files and always makes live API requests. Verify your configuration settings and ensure the cache files actually exist in the cache/ directory.
Can I disable caching entirely for production deployments?
Yes. Caching is gated by the DEVELOPMENT_MODE environment variable or configuration flag. Setting this to False disables all cache reads and writes, forcing every request to hit the live GitHub API. This is the recommended configuration for production environments to avoid serving stale data.
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 →