|
| 1 | +# AGENTS.md — mhctools |
| 2 | + |
| 3 | +Guide for coding agents working in this repo. Read this before touching code. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Golden Rules |
| 8 | + |
| 9 | +1. **Never commit to `main`.** Always `git checkout -b <feature-branch>` before editing. Land via PR. |
| 10 | +2. **Every PR bumps the version.** Even doc-only PRs — at minimum a patch bump. `deploy.sh <version>` handles the bump + commit + push. |
| 11 | +3. **"Done" means merged AND deployed to PyPI** — never stop at merge. After a PR merges, run `./deploy.sh` from a clean main. Skipping deploy = task not done. |
| 12 | +4. **File problems as issues, don't silently work around them.** If you hit a bug here or in a sibling openvax/pirl-unc repo, open a GitHub issue on the correct repo and link it from the PR. |
| 13 | +5. **After a PR ships, look for the next block of work.** Read open issues across the relevant openvax repos, group by dependency + urgency. Prefer *foundational* changes that unblock multiple downstream improvements; otherwise chain the smallest independent improvements. |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Before Completing Any Task |
| 18 | + |
| 19 | +Before telling the user a change is "complete": |
| 20 | + |
| 21 | +1. **`./lint.sh`** — must pass |
| 22 | +2. **`./test.sh`** — must pass |
| 23 | +3. For a PR: **CI must be green on GitHub**, then merge, then **`./deploy.sh`**. |
| 24 | + |
| 25 | +`deploy.sh` gates on lint + test, refuses to run off `main`/`master`, and refuses a dirty tree — don't work around these. If deploy fails, fix the root cause. |
| 26 | + |
| 27 | +## Scripts |
| 28 | + |
| 29 | +- `./develop.sh` — editable install (dev mode) |
| 30 | +- `./lint.sh` — ruff check |
| 31 | +- `./test.sh` — pytest (with coverage where configured) |
| 32 | +- `./deploy.sh [version]` — lint → test → optional version bump → build → twine upload → tag → push |
| 33 | + |
| 34 | +## Code Style |
| 35 | + |
| 36 | +- Python 3.9+ |
| 37 | +- Lint: ruff (config in `pyproject.toml`) |
| 38 | +- Docstrings: numpy style |
| 39 | +- Bugfixes include a regression test where feasible |
| 40 | +- mhctools wraps external predictors (mhcflurry, netMHCpan, etc.) — keep predictor adapters thin; push generic logic upstream into topiary when possible. |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Workflow Orchestration |
| 45 | + |
| 46 | +### 1. Upfront Planning |
| 47 | +- For any non-trivial task (3+ steps or architectural): write a short spec first. If something goes sideways, STOP and re-plan — don't keep pushing. |
| 48 | + |
| 49 | +### 2. Verification Before Done |
| 50 | +- Never claim complete without proof: tests green, CI green, PyPI version live. |
| 51 | + |
| 52 | +### 3. Autonomous Bug Fixing |
| 53 | +- Given a bug report: just fix it. Point at logs/errors/failing tests and resolve them without hand-holding. |
| 54 | + |
| 55 | +### 4. Demand Elegance (Balanced) |
| 56 | +- For non-trivial changes pause and ask "is there a more elegant way?" — skip for trivial fixes. |
| 57 | +- Treat workarounds as bugs, not new abstractions. Rip out legacy paths decisively rather than accumulating special cases. |
| 58 | + |
| 59 | +### 5. Issue Triage After Each Ship |
| 60 | +- Close superseded/outdated issues as you notice them. |
| 61 | +- New problems mid-task → file as issues (on the right repo, even if it's not this one), don't bury. |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Core Principles |
| 66 | + |
| 67 | +- **Simplicity first.** Minimal diffs, minimal abstractions. |
| 68 | +- **No laziness.** Find root causes; no temporary fixes, no empty-category fudges. |
| 69 | +- **Minimal blast radius.** Touch only what the task requires. |
| 70 | + |
| 71 | +## Scientific Domain Knowledge |
| 72 | + |
| 73 | +- If a change touches immunology/genomics semantics, check primary sources (papers, UniProt, GenBank) before edits. |
| 74 | +- If the code expresses a scientific model at odds with your understanding, flag it — don't silently "fix" it into something wrong. |
| 75 | +- Use `mhcgnomes` for MHC allele parsing. Never `startswith("HLA-")` or other string hacks — alleles aren't always human. |
0 commit comments