This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
Epic 免费人 (Epic Awesome Gamer) is a Python automation tool that gracefully claims weekly free games from the Epic Games Store. It uses browser automation with Playwright and includes an AI-powered hCaptcha solver using the hcaptcha-challenger library.
# Install dependencies using uv (recommended)
uv sync
# Alternative: install dev dependencies
uv sync --group dev# Format code with Black
uv run black . -C -l 100
# Lint with Ruff
uv run ruff check --fixapp/models.py: Pydantic models for Epic Games data structures (OrderItem, Order, PromotionGame)app/settings.py: Configuration management using pydantic-settings, extends hcaptcha-challenger's AgentConfigapp/services/epic_games_service.py: Main game collection logic and Epic Store interactionapp/services/epic_authorization_service.py: Authentication and login handlingapp/jobs.py: Job orchestration functions for collecting and adding games to cartapp/deploy.py: Main deployment/execution entry point
- hcaptcha-challenger[camoufox]: AI-powered captcha solving with Camoufox browser
- playwright: Browser automation framework
- pydantic-settings: Configuration management with environment variable support
- apscheduler: Task scheduling for automated runs
app/logs/: Application logs (error.log, runtime.log, serialize.log)app/runtime/: Runtime data including screenshots, recordings, and hcaptcha cacheapp/user_data/: Browser profile and session datadocker/: Docker compose configuration and environment files
Environment variables are managed through EpicSettings class in settings.py:
EPIC_EMAIL: Epic Games account email (2FA must be disabled)EPIC_PASSWORD: Epic Games account passwordGEMINI_API_KEY: Google Gemini API key for captcha solvingCRON_SCHEDULE: Cron expression for scheduled runs (default: every 5 hours)
- Initialize Epic agent with Playwright page
- Handle authentication via
EpicAuthorization - Fetch promotions from Epic Games API
- Navigate to game pages and add free games to cart
- Handle any hCaptcha challenges using AI solver
- Complete checkout process
Test execution is not allowed.
- Any change that affects runtime behavior, bug handling, troubleshooting flow, user-facing guidance, or expected outcomes must be appended to
docs/maintenance-log.mdbefore finishing the task. - Each maintenance-log entry should include at least: date, symptom, root-cause judgment, changed files, and result.
- Append only. Do not rewrite or remove older records unless the user explicitly asks for cleanup.
These guidelines supplement the project instructions above and should be applied by Codex for non-trivial work in this repository.
- State assumptions explicitly when the codebase or request is ambiguous.
- If multiple interpretations are plausible, surface them instead of silently picking one.
- Prefer asking for clarification over guessing when a wrong guess could cause rework or risky edits.
- If a simpler approach exists, say so before implementing a more complex one.
- Implement the minimum change that solves the requested problem.
- Do not add speculative abstractions, configuration, or extensibility that was not requested.
- Match the repository's existing patterns unless the task explicitly requires a different design.
- If a smaller solution is clearly sufficient, prefer it.
- Touch only files and lines that are directly relevant to the request.
- Do not refactor adjacent code, rewrite comments, or clean unrelated dead code unless asked.
- Remove only the unused code or imports made obsolete by your own change.
- Every changed line should be traceable to the requested outcome.
- For multi-step work, define a brief success path before editing.
- Verify the result with the strongest safe check available in this repository.
- Because test execution is not allowed here, use static inspection, linting, or targeted non-test verification when possible, and clearly report any verification limits.