issue-triage: size issues/MRs against a reviewable-line budget via the Jev decision model
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
---
|
||||
name: issue-triage
|
||||
description: Judge whether an issue is too large to ship as one reviewable MR — uses the Jev decision model via OpenRouter's Decisions API plus a deterministic MR-size gate, anchored to a 30-minute senior-review budget (200 comfort / 400 ceiling reviewable lines). Use whenever the user asks whether an issue or feature should be split, wants an issue triaged/sized/scoped, wonders if something is "too big", asks for how to break work into reviewable chunks, or wants a branch/MR/PR checked for reviewable size — even when they just say "is this too large?" without naming this skill.
|
||||
---
|
||||
|
||||
# Issue triage
|
||||
|
||||
Two gates keep merge requests reviewable:
|
||||
|
||||
1. **Triage (before code)** — a decision model judges the *issue* and returns calibrated
|
||||
answers, not prose. Cheap (~$0.00003/call), input-token billing only.
|
||||
2. **Size gate (after code, deterministic)** — counts *reviewable* changed lines of a
|
||||
branch against the review budget. No model, no cost, always honest.
|
||||
|
||||
The anchor everywhere is review effort, not implementation effort: an MR a competent
|
||||
senior developer can review in about 30 minutes. Where the numbers come from:
|
||||
read `references/rubric.md` once when thresholds or the rubric are questioned.
|
||||
|
||||
## Triage an issue
|
||||
|
||||
```bash
|
||||
bash ~/.config/opencode/skill/issue-triage/scripts/issue-triage.sh "issue text ..."
|
||||
cat issue.txt | bash ~/.config/opencode/skill/issue-triage/scripts/issue-triage.sh
|
||||
bash .../issue-triage.sh --json "issue text" # machine-readable verdict
|
||||
```
|
||||
|
||||
Interpretation of the answers:
|
||||
|
||||
- `size_band` — estimated **reviewable** lines (handwritten logic only; renames,
|
||||
generated code, lockfiles excluded). This is a prediction; verify with the gate.
|
||||
- `review_too_big` — probability the MR exceeds the ~30-minute budget. Above ~0.7,
|
||||
treat the issue as too large even if `action` says ship, and say so.
|
||||
- `one_idea` — low value means the issue bundles separable ideas (the title would
|
||||
need an "and"); each idea becomes its own issue/MR.
|
||||
- `risk` (1–4) — high risk (auth, migrations, concurrency, data loss) lowers the
|
||||
line budget and suggests expand–migrate–contract.
|
||||
- `action` — `ship`, `split_before_coding`, or `needs_human`.
|
||||
|
||||
The script prints templated, deterministic advice derived from these answers.
|
||||
**Advice only** — never create issues, sub-issues, or MRs from the verdict unless
|
||||
the user explicitly asks. Do not invent extra "analysis" beyond the printed output.
|
||||
|
||||
## Check MR size
|
||||
|
||||
```bash
|
||||
bash ~/.config/opencode/skill/issue-triage/scripts/mr-size-gate.sh # auto base
|
||||
bash ~/.config/opencode/skill/issue-triage/scripts/mr-size-gate.sh origin/main
|
||||
bash ~/.config/opencode/skill/issue-triage/scripts/mr-size-gate.sh --strict # warn fails too
|
||||
bash ~/.config/opencode/skill/issue-triage/scripts/mr-size-gate.sh --json
|
||||
```
|
||||
|
||||
Exits 1 above the fail threshold, so it can run in CI or pre-push. It excludes
|
||||
lockfiles, generated files, assets, binaries and pure renames from the count;
|
||||
add repo-specific noise with `--exclude 'patterns/**'` or `MRGATE_EXCLUDE`.
|
||||
Suggest adding repeatable exclusions to the repo rather than retyping them.
|
||||
|
||||
## Security and credentials
|
||||
|
||||
- The OpenRouter key lives in `~/.config/openrouter/scripts.env` (mode 600). The
|
||||
scripts source it themselves; if it is missing, run `openrouter-env-sync`.
|
||||
- Never print, echo, or log the key; never pass it as a CLI argument — the scripts
|
||||
already hand it to curl via config-on-stdin. Do not read OpenCode's database
|
||||
for keys in scripts.
|
||||
- Do not copy issue text plus key into chat output; show verdicts, not payloads.
|
||||
|
||||
## Configuration
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `JEV_MODEL` | `~typesafe/jev-latest` | pin a version, e.g. `typesafe/jev-1.13` |
|
||||
| `MRGATE_WARN` / `MRGATE_FAIL` | 200 / 400 | reviewable-line thresholds |
|
||||
| `MRGATE_EXCLUDE` | — | extra exclude globs, comma/space separated |
|
||||
|
||||
## Limits to keep in mind
|
||||
|
||||
- The Decisions endpoint is OpenRouter **alpha**: request shape may change; if the
|
||||
script reports a 400 with schema complaints, re-check the API reference before
|
||||
"fixing" the script blindly.
|
||||
- Triage estimates are predictions about code that does not exist yet. The size
|
||||
gate is the ground truth; when they disagree, trust the gate and mention the gap.
|
||||
Reference in New Issue
Block a user