agentleFS
gcontinigcontini/resumix/.github/copilot-instructions.md

resumix

Copilot instructions5 starsChanged 2 months agoMITView on GitHub

resumix turns a job description into a tailored, two-page LaTeX CV and an optional cover letter. It is a uv workspace of three packages, split so each can be deployed and tested independently: Dependency direction is one-way — client → contracts ← server, never client ↔ server — and enforced by tests/test_architecture.py (AST-based: it fails the build if either side imports the other, or if contracts pulls in anything heavier than pydantic). Read AGENTS.md first for the principles this design…

  • Reads credentials
  • Commits and pushes

The file

We split this copilot-instructions.md into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No usage/token fields here: each model call logs its own spend as one line.

    line 34
  2. Distinctive:

    Keep the code simple; this is a personal tool wearing production-shaped seams (SOLID, tests, sandboxing) because it is a portfolio piece — …

    line 221
  3. Distinctive:

    No test may need an API key, a network socket, or a terminal.

    line 255
  4. Distinctive:

    If a design decision was not addressed or clarified in the prompt and implementing it one way forecloses another, stop and ask.

    line 267
  5. Distinctive:

    Keep decisions as simple as possible — this is not over-engineered production code.

    line 274
  6. Distinctive:

    If a decision introduces a lot of complexity for a small improvement, stop and ask before implementing it.

    line 278
  7. Distinctive:

    Prefer clear contracts with mandatory parameters over defaults scattered across a method signature.

    line 280
  8. Distinctive:

    Never commit or push — git commit/git push are strictly forbidden.

    line 282

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions — resumix

resumix turns a job description into a tailored, two-page LaTeX CV and an optional cover letter. It is a uv workspace of three packages, split so each can be deployed and tested independently:

contracts/   resumix_contracts  — pydantic models + envelope + the free JD guess
server/      resumix_server     — stateless FastAPI service: LLM calls + pdflatex
client/      resumix_client     — the thing you run: clipboard/watch/submit/render

Dependency direction is one-way — client → contracts ← server, never client ↔ server — and enforced by tests/test_architecture.py (AST-based: it fails the build if either side imports the other, or if contracts pulls in anything heavier than pydantic). Read AGENTS.md first for the principles this design follows (SOLID, one job per class, no hidden global state); this file is the file map and the day-to-day commands.

Components (file map)

contracts/src/resumix_contracts/ — the wire format, nothing else

  • payloads.py — CVStatus (status, detail: where a CV job is now and one line about the step before, no history), RenderedCV (tex, pdf_base64, document), CoverLetter, ServerStatus. The CV document is a raw flat dict with no schema — what the model wrote with your candidate_data merged over the top. The schema the CV model writes to is not here — see pipeline/cv_schema.py.
  • jd.py — JDAnalysis (the analysis endpoint's output), JDDetection (is_job_description: bool, nothing else — the reason lives in the log, not the reply).
  • envelope.py — Envelope[T] (request_id, ok, data, error — every endpoint returns this shape, success or failure), LogEntry, RequestLog. No usage/token fields here: each model call logs its own spend as one line.
  • guess.py — static_jd_guess(text) -> bool, the free structural check (length band, no binary) both sides can run before paying for anything.

server/src/resumix_server/ — personal data arrives per request and is dropped when it ends; a request's own directory is the only thing kept

  • api/app.py — create_app(), the ASGI middleware that mints the request id (filtered: it names a directory) and sets the log collector contextvar, and the startup sweep that fails jobs a dead process left running.
  • api/deps.py — AppState, envelope_for()/envelope_of(), claim_slot(), execute() (the blocking endpoints: semaphore + threadpool hop + scratch dir + the log on disk afterwards).
  • api/jobs.py — the CV worker thread: re-establishes the Run, reports each step by rewriting status.json, stores the result or the failure.
  • jobstore.py — one directory per request under RESUMIX_WORK_DIR (status.json, result.json, log.json, work/), atomic writes, pruned to the newest 200.
  • api/routers/{health,jd,cv,letter,logs}.py — one router per resource. logs.py is GET /logs/{request_id} against jobstore.py's directory per request under RESUMIX_WORK_DIR (newest 200 kept) — the one piece of state the server holds, and it is disposable.
  • api/errors.py — maps PipelineError/ValidationError/openai.APIError to a status and an ok:false envelope; never echoes the provider body.
  • pipeline/cv_generator.py — CVGenerator: write → validate → regenerate (up to max_attempts rounds) → keyword highlight → render for good. Returns (document, tex, pdf, summary). Pure library code — inputs in memory, outputs returned, nothing read from a configured path; progress leaves through an injected progress(status, detail) callback, not a file.
  • pipeline/cv_validator.py — CVValidator: what is wrong with one CV, as one list of violations — the content review against the master profile, then the render and the page count, whose condense instruction is appended as the last violation. Every attempt is rendered, rejected or not: a compile is cheap next to a model call. The review runs until it passes once.
  • pipeline/cv_renderer.py — CVRenderer: Jinja (\VAR{}/\BLOCK{} delimiters, DictLoader built fresh per request since the template can be client-supplied) → pdflatex, sandboxed (-no-shell-escape, openin_any=p/openout_any=p, no stdin, a timeout, its own scratch mkdtemp removed in a finally) → page count.
  • pipeline/jd_validator.py, pipeline/letter_generator.py — the other two LLM pipelines; same shape as cv_generator.py.
  • pipeline/cv_schema.py — TailoredCVData, the CV model's output schema and the response model of POST /v1/cv. Every Field(description=...) is restated in a prompt — editing one changes model behaviour. extra="allow", so an undeclared field survives validation and reaches the template; prompt_schema() is the closed variant that goes into the request, because strict json_schema endpoints refuse additionalProperties: true.
  • model_selector.py — ModelSelector, one OpenAI-compatible endpoint per role (detect/summary/cv/review/highlight) from resources/models.toml. Every LLM call ends with one logger.info line carrying model, duration and token counts — this is the entire token-accounting story; there is no per-request total anywhere.
  • bundle.py — ResourceBundle (impersonal: prompts, template, image assets keyed by file name — built once at startup, with_overrides() per request) vs. CandidateInputs (personal: profile and preferences — always per-request, never cached, never written to disk). No candidate data: no endpoint takes it, because no model reads it.
  • observability.py — Run/NullRun, current_run contextvar, stage() context manager, the logging handler that turns log records into LogEntrys for the run.

server/resources/ — the impersonal defaults baked into the image: four prompts, resume.tex.jinja, models.toml, a blank candidate_signature.png (the one image the stock template includes; a request's own images are merged over the defaults by file name). Packaged as resumix_server.resources (see server/pyproject.toml) so importlib.resources still finds it despite living outside src/.

client/src/resumix_client/ — your data, a bearer token, no Python required to run it (PyInstaller --onefile)

  • api.py — ResumixApi (Protocol) / HttpApi (httpx) — the only module that knows the server exists. ResumixError carries request_id so a caller can fetch what the server did.
  • config.py / discovery.py — settings resolution, highest precedence first: CLI flag → env var → resumix.toml → file found next to the executable → server default. CONFIG_KEYS maps short TOML keys to the filenames discovery.py looks for.
  • joblog.py — JobLog (per-job log.log, client steps + folded-in server log), format_entries() (same rendering, for resumix logs <id>).
  • workspace.py — Workspace: owns the working/error/discarded/cv folder tree, atomic moves, the daily subfolders. new_job() never replaces a folder of the same name (a CV may still be written in it). pending() and clean() serve clipboard's startup question about leftovers.
  • sources/clipboard.py — ClipboardSource, a JDSource: poll() returns the clipboard's text once each time it changes.
  • stages/ — the one pipeline every mode runs on (it imports nothing from modes or sources; tests/test_architecture.py checks). analysis.py (free check → detect → analyze, for every new posting), inbox.py (watch's --in, on a thread), approval.py (watch's question: y/d/s/n/q or a URL), intake.py (clipboard's and submit's question: URL/y, n/s, q — every posting is asked about, and waits as PENDING while you read), listener.py (clipboard's main thread: leftovers first, then the clipboard, q when idle), generation.py (the CV queue: on a thread for watch and clipboard, drained inline by submit), and working.py (WorkingProcessor: every move, the duplicate check and both queues, under one lock). A folder goes where jobfolder.route() says — the same pure table for new postings, dropped folders and leftovers in working/. watcher.py runs a foreground loop and the background stages: q finishes what is running, Ctrl-C stops at once.
  • modes/{clipboard,watch,submit,submit_raw,render,logs}.py — thin: build the stages and run them (clipboard asks r/c/q about leftovers first; submit writes its CV on the main thread and returns when it is filed), or (for submit-raw/render/logs) call the API directly.
  • tracking.py — XlsxTracker (openpyxl, applications.xlsx) / NullTracker.
  • ui.py — Confirmer protocol (PromptConfirmer, which reads the Keyboard, / AutoConfirmer for --yes), the analysis table, the recovery prompt.

Shared

  • examples/candidate/ — a fictional profile/data/preferences/image set, shipped so a fresh download has something to run against immediately.
  • tests/test_architecture.py — the one-way dependency rule, enforced.
  • tests/test_integration.py — client and server together in one process (httpx against the real ASGI app via starlette.testclient.TestClient, only the model call faked) — the one test that catches the two sides disagreeing about the wire format.

Key contracts & invariants

  • Every response is the same envelope, success or failure: {request_id, ok, data, error}, where error is one string. Nothing else rides on it — no logs, no usage — so the common case pays nothing for what it does not ask for.
  • GET /logs/{request_id} is the only way to see what a request did. Backed by that request's directory under RESUMIX_WORK_DIR (jobstore.py, newest 200 kept); an id that was pruned, that failed before any work started, or that landed on a different instance, is a 404. The client fetches it after every call with --debug, and always on failure.
  • Token spend is per model call, not per request. model_selector.py logs one line per call (model, duration, prompt/completion tokens); there is no aggregate anywhere in the envelope or the contracts.
  • The CV document is one flat dict with no schema — whatever your LaTeX template reads, put it in candidate_data.json and it flows through untouched. It is {**what the model wrote, **your candidate_data}, so your own data wins a collision and the model can never replace a real contact detail. The client stores it and posts it back to /v1/cv/render without parsing a field of it.
  • POST /v1/cv is accept-then-poll and takes candidate_data. It answers 202 with a job id; GET /v1/cv/{id}/status gives {status, detail} (the current step only, no history) and GET /v1/cv/{id} gives {document, tex, pdf_base64} once it says END. The job runs in a detached thread that reports by rewriting status.json. candidate_data is there because the loop compiles the CV to count its pages — no model is shown it.
  • The LaTeX subprocess is always sandboxed: shell escape off (-no-shell-escape, shell_escape=f), reads/writes confined to the per-request scratch dir (openin_any=p/openout_any=p), no stdin, a timeout. A client can supply the template and a whole .tex — treat both as hostile input. On a compile failure the TeX log tail goes to the server's own log, not into the error body (it is kilobytes; ask for it via /logs if you need it).
  • submit copies its input; watch deletes it once handed over. An inbox gets emptied; an argument you named does not disappear.
  • Concurrency: one BoundedSemaphore(RESUMIX_MAX_CONCURRENT_JOBS) (default 10) gates job handlers → 429 + Retry-After when full. No second gate for the LaTeX compile — it is fast enough not to need one.
  • Every model reply is re-validated. The schema is shown in the prompt and requested via response_format, and the reply is parsed by pydantic; a ValidationError is fed back to the model rather than trusted.

Conventions

  • Python 3.12, uv workspace (pyproject.toml at the root plus one per package); uv sync installs all three in editable mode. Console scripts: resumix-api (server), resumix (client).
  • LLM access via any OpenAI-compatible endpoint — one provider, one API key (MODEL_API_KEY/MODEL_BASE_URL; see .env.example), declared once in the [provider] table of server/resources/models.toml. A role with use_alternate_provider = N (N ≥ 2) calls provider N instead (MODEL_API_KEY<N>/MODEL_BASE_URL<N>). The five roles (detect/summary/cv/review/highlight) each declare only model name and generation settings, which can also be overridden per role via RESUMIX_<ROLE>_<FIELD> env vars (model/temperature/thinking/ reasoning_effort/thinking_budget/structured_output/use_alternate_provider; an empty thinking_budget unsets a budget declared in models.toml, which is how reasoning_effort wins back the request).
  • %-style lazy logging args, never f-strings inside logger.* — sanitized LaTeX can reach a log line and a literal % would break the formatter.
  • LaTeX templates use Jinja delimiters \VAR{}/\BLOCK{}; escaping is done by _sanitize_latex/_sanitize_obj in cv_renderer.py — keep {} guard groups intact.
  • Console prints in the client use flush=True (long-lived watch/clipboard processes).
  • Docker: classic builder only — no BuildKit features, no heredocs in a Dockerfile (Dockerfile, at the repo root, built with DOCKER_BUILDKIT=0).
  • PyInstaller (client/packaging/resumix.spec), not Cython — Cython still needs an interpreter and does not produce a standalone exe. Build on the target OS; it does not cross-compile.
  • Keep the code simple; this is a personal tool wearing production-shaped seams (SOLID, tests, sandboxing) because it is a portfolio piece — do not add speculative options beyond what is asked.

Commands

# setup (once, after cloning or when deps change)
uv sync

# run from source
uv run resumix-api                       # the server
uv run resumix clipboard --out ~/applications   # the client

# tests — all four suites, no API key, no network
uv run pytest
uv run pytest server/tests                 # one package only
uv run pytest -k architecture              # the dependency-direction rule

# the server image (classic builder only)
DOCKER_BUILDKIT=0 docker build -t resumix-server .
docker run --rm -p 8080:8080 --env-file .env resumix-server

# the client executable (build on the OS you are targeting)
uv run --with pyinstaller pyinstaller client/packaging/resumix.spec

pdflatex-dependent tests skip themselves when it is not on PATH. server/tests/server_helpers.py wires a real ModelSelector to a fake HTTP client, so request assembly and structured-output negotiation stay under test with no network call.

Testing guidance

  • No test may need an API key, a network socket, or a terminal.
  • Fake at the transport boundary, not above it — inside ModelSelector for the server, behind the ResumixApi protocol (FakeApi) for the client — so the code that assembles a request is what actually runs under test.
  • server/tests/golden/cv_golden.tex pins the whole render byte-for-byte; an escaping regression is otherwise invisible until someone reads a bad PDF.
  • tests/test_integration.py is the one place both packages run together; keep it passing before touching either side's contract usage.

Interaction with the user

  • The user is skilled: be concise.
  • If a design decision was not addressed or clarified in the prompt and implementing it one way forecloses another, stop and ask.

Code style

  • Clean up local variables that are only assigned or incremented with no effect on the logic.
  • Keep decisions as simple as possible — this is not over-engineered production code; it borrows production patterns (typed contracts, sandboxing, tests) only where the split into a server/client actually requires them.
  • If a decision introduces a lot of complexity for a small improvement, stop and ask before implementing it.
  • Prefer clear contracts with mandatory parameters over defaults scattered across a method signature.
  • Never commit or push — git commit/git push are strictly forbidden; the user reviews and commits every change.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.