feat(input): add codex automation stack

This commit is contained in:
2025-10-15 16:32:26 -05:00
parent e0816486cb
commit 8bf8784d52
10 changed files with 625 additions and 3 deletions

45
input/AGENTS.md Normal file
View File

@@ -0,0 +1,45 @@
# Input Agent Guide
## Mission
Automate the upstream resume customization workflow. Monitor the job-description inbox, combine the base resume and prompt template into a Codex-friendly request, invoke the Codex CLI, and deposit the generated Markdown in a timestamped outbox for human review.
## Directory Responsibilities
- `resume/` contains exactly one Markdown resume. Any other count is a fatal configuration error.
- `ForCustomizing/inbox/` drop one job-description Markdown at a time to trigger processing.
- `ForCustomizing/outbox/YYYY/MM/DD/HHMM/` timestamped folders containing Codex output Markdown (and a copy of the prompt used).
- `ForCustomizing/processed/YYYY/MM/DD/HHMM/` archives of job descriptions that Codex processed successfully.
- `ForCustomizing/failed/` captures job descriptions when Codex errors or a recoverable issue occurs. Fatal configuration errors still exit the container.
- `templates/ResumeCustomizerPrompt.md.example` default instruction block; copy to `ResumeCustomizerPrompt.md` (same folder) to override locally.
## Running the Input Processor
Launch the stack with the wrapper so files inherit your UID/GID and your local Codex credentials mount in:
```bash
cd input/Docker
./run-input-processor.sh up -d
```
Environment variables you can pass before the command:
- `CODEX_COMMAND_TEMPLATE` override the Codex CLI invocation (defaults to `codex prompt --input {prompt} --output {output} --format markdown`).
- `POLL_INTERVAL_SECONDS` watcher polling cadence (default `5`).
- `CODEX_TIMEOUT_SECONDS` hard timeout for Codex calls (default `600`).
- `CODEX_CONFIG_DIR` optional override for the host directory that should mount into `/home/codex/.codex`.
Stop or inspect the stack with:
```bash
cd input/Docker
./run-input-processor.sh down
./run-input-processor.sh logs -f
```
## Guardrails
- Ensure only one job description resides in `ForCustomizing/inbox/`. Multiple files cause the container to exit with a fatal error.
- Keep exactly one resume Markdown in `resume/`. Missing or multiple resumes also terminate the watcher.
- The container runs as a non-root user matching the callers UID/GID. Avoid changing permissions manually inside the mounted directories.
- Do not edit anything under `output/` from this agent session; treat the downstream pipeline as read-only reference material.
## Troubleshooting
- If Codex CLI fails, the job description moves to `ForCustomizing/failed/`. Check container logs, adjust the Markdown, then requeue it.
- Fatal errors (multiple resumes, multiple job descriptions, missing template, or missing Codex binary) stop the container. Resolve the issue and restart via the wrapper.
- To change the Codex command format, pass a quoted template (e.g., `CODEX_COMMAND_TEMPLATE='codex run --input {prompt} --output {output}' ./run-input-processor.sh up -d'`). The template must include `{prompt}` and `{output}` placeholders.