Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ $ quest --root examples/export unblocked
1 quest/m0/export.md

$ quest --root examples/export unblocked --json --limit 1
[{"path":"quest/m0/export.md","dependents":1}]
[{"path":"quest/m0/export.md","dependents":1,"models":[{"harness":"claude","model":"claude-opus-5-5","effort":"low"},{"harness":"codex","model":"gpt-6.1-sol","effort":"medium"}]}]
```

Each plain output line contains the count, a tab, and the path. On a terminal,
a heading explains the count. `--json` prints an ordered array, including `[]`
when no quests are ready; `--limit <count>` requires a positive integer.
when no quests are ready, and gives each quest the ranked `models` that write
it, as [Route work by size](#route-work-by-size) describes; `--limit <count>`
requires a positive integer.
Invalid trees fail with diagnostics and no ranking.
`quest-spawn` uses the ranking unless you explicitly select work in another order.

Expand Down Expand Up @@ -1096,6 +1098,50 @@ arrive together, it takes a third; a repeated Ctrl-C, which Just does not
forward, kills at the second. There is no fairness guarantee, and no timeout except
`--quick`'s: any other command waits as long as the host stays busy.

## Route work by size

`quest` ranks the harnesses, models, and efforts that write work of each size,
the same for every repository unless its `AGENTS.md` names others:

| Size | Writer | Fallback |
|---|---|---|
| XS | Claude Code `claude-haiku-5-5` high | Codex `gpt-6.1-sol` low |
| S | Claude Code `claude-opus-5-5` low | Codex `gpt-6.1-sol` medium |
| M | Claude Code `claude-opus-5-5` medium | Codex `gpt-6.1-sol` high |
| L | Claude Code `claude-opus-5-5` high | Codex `gpt-6.1-sol` xhigh |
| XL | Claude Code `claude-opus-5-5` xhigh | none |

`quest unblocked --json` lists each ready quest's ranked `models`: its size's
list, or the next size's while a `Maintainer:` item under its `## Waiting`
leaves a decision open, since settling it is part of the work; an XL stays
XL. `/quest-spawn` starts a quest on the first entry that can run, and falls
to the next only while nothing is written: when the CLI is missing or logged
out, or the agent stops at its usage limit with nothing beyond the claim
commit. Once a model writes, the PR is its own.

A `/quest-iterate` stays on the PR's writer, the model its `## Models`
record's first `Implementer:` line names, so the other model can always
review it. The coordinator dispatching it sizes the work left on the PR, not
the quest's original size, so a merge-and-record iterate on an L quest runs at
XS, and `quest models` prints the entry to run:

```console
$ quest models XS
claude claude-haiku-5-5 high
codex gpt-6.1-sol low

$ quest models XS --writer claude-opus-5-5
claude claude-opus-5-5 low
```

`--writer` prints the size's entry for that model, or else its entry at the
nearest size that lists it, the larger on a tie; a model no list names is an
error. `--json` prints an array of `{harness, model, effort}` objects. The
iterate records the size it was given in its `Implementer:` line, as
`Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS)`, so
the model check can audit the routing. `quest review` still reviews the
whole branch at the PR's size.

## Review locally

`quest review` has a model that wrote none of the code review the checkout's
Expand All @@ -1108,7 +1154,7 @@ size. Each size ranks its reviewers, the same for every repository:
| S | Codex `gpt-6.1-sol` medium | Claude Code `claude-opus-5-5` low |
| M, or none | Codex `gpt-6.1-sol` medium | Claude Code `claude-opus-5-5` medium |
| L | Codex `gpt-6.1-sol` high | Claude Code `claude-opus-5-5` high |
| XL | Codex `gpt-6.1-sol` xhigh | Claude Code `claude-opus-5-5` high |
| XL | Codex `gpt-6.1-sol` xhigh | Claude Code `claude-opus-5-5` xhigh |

A quest branch takes its quest's size, read from the base branch's tip so a
change cannot lower its own review; any other PR, such as a skill's own, takes
Expand Down
11 changes: 11 additions & 0 deletions assets/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ Run no more sub-agents at once than the harness allows; queue the rest and start
Relay no interim report: resume a sub-agent that ended its turn on one, telling it to block until its work finishes.
A long-running coordinator lets compaction bound its context: it keeps what must outlast compaction in the forge and the quest tree, and reads a PR's state afresh before acting on it rather than trusting earlier turns.

Run each agent at an entry of `quest`'s ranked lists unless the repository's `AGENTS.md` names other models: as a native sub-agent on this session's harness, else through `quest agent`.
Size each `/quest-iterate` you dispatch as a quest, by the work left on its PR, and name that size in its brief.
Start it on the PR's writer, the model of its first `Implementer:` line, at the entry `quest models <size> --writer <model>` prints, waiting out its usage limit so the other model can review; a PR with no known writer takes its size's first entry that can run.

`quest agent start --harness <claude|codex> --model <model> --effort <level> --permission-mode <mode> <worktree> <prompt>` runs a headless agent on that CLI's own login; start it as a background command in its own isolated worktree, so the harness reports its exit as it would a sub-agent's.
`--permission-mode` is Claude Code's permission mode, or Codex's sandbox mode.
It prints the session id, then the outcome and the agent's final reply, and exits 3 at the account's usage limit, or 4 when the CLI is logged out, printing the login command.
Tell the agent that it cannot prompt, so it ends with its decisions and recommendations in its final reply, and that ending its turn kills its background commands, so it waits in the foreground.
Answer it in the background with `quest agent resume`, passing the same options, the worktree, the session id, and the answer.
Stop one with `quest agent stop <worktree>`, and each you started that still runs before you finish; `--all` would stop other sessions' agents too.

## Questions

Open each prompt with the context to answer it without opening the quest or PR: what the work is, the problem it hit, and what each option would change.
Expand Down
2 changes: 1 addition & 1 deletion assets/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Run the repository's checks locally while the PR is a draft; CI may run only on
Before a PR is marked ready for review, and before each push to one that is, a model that wrote none of its code reviews the committed branch locally, as `/quest-review` describes.

The PR body's `## Models` section records its size as `Size: M` (its quest's, or for a skill's own PR, as a quest is sized) and one `Implementer: Codex, gpt-6.1-sol, high effort` line per implementing session, added when it first pushes.
Read your model and effort rather than guess, writing `unknown` for any you cannot find: Claude Code knows its model and exports `CLAUDE_EFFORT`; Codex records `model` and `effort` in the last `turn_context` of `~/.codex/sessions/*/*/*/rollout-*-$CODEX_THREAD_ID.jsonl`; Grok records `model_id` and `reasoning_effort` in `~/.grok/sessions/*/$GROK_SESSION_ID/chat_history.jsonl`.
Read your model and effort rather than guess, writing `unknown` for any you cannot find: Claude Code knows its model and exports `CLAUDE_EFFORT`, and Codex records `model` and `effort` in the last `turn_context` of `~/.codex/sessions/*/*/*/rollout-*-$CODEX_THREAD_ID.jsonl`.

GitHub gives secrets to workflows on branches pushed to the repository, as quest branches usually are, so keep pull request CI, which runs unreviewed code, read-only: a read-only `GITHUB_TOKEN`, and write credentials only in environments limited to protected branches.
Flag any workflow that breaks this to the user, and never add one.
Expand Down
1 change: 1 addition & 0 deletions assets/skills/iterate.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Parse the arguments to determine the PR number. Any other text is the user's fee
Take it with `quest iterate <pr>` before acting, passing a token you already hold for it to keep that hold, and keep the hold token it prints; `quest iterate --help` explains holds.
If it refuses because another session holds the PR, stop and report what it printed; taking over a stale hold is the user's choice.
If you cannot push to the PR's branch, stop and report.
Your `Implementer:` line ends with the size your brief gives the work, as `Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS)`.

Read the PR, its linked issues and quest, the reviews and comments posted on it, and the surrounding code.
`quest status <pr>` reports its checks, reviews by head, and unresolved threads in one call.
Expand Down
23 changes: 6 additions & 17 deletions assets/skills/spawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,9 @@ Resume that agent by messaging it, or with `quest agent resume` for a headless a
If it cannot be resumed, start a new agent with the same brief plus its claim PR, its checkout, and the token of any hold it took on the PR, which `quest status <pr>` shows, so the new one continues that work and keeps that hold rather than claiming again.
While the error persists, such as a rate limit before its reset, resume and start nothing until it clears, and report it once rather than per agent.

## Other harnesses

A sub-agent runs only this session's harness.
To start a quest on another, such as Codex from Claude Code when the user asks for it, run it as a headless agent through `quest agent`, which uses that CLI's own login.
Stop and report if it says the agent CLI is not installed.

Start each agent as a background command, in its own isolated worktree, so the harness reports its exit as it would a sub-agent's:
`quest agent start --harness <claude|codex> --model <model> --effort <level> --permission-mode <mode> <worktree> <prompt>`.
Pass the model and effort the user named; `--permission-mode` is Claude Code's permission mode, or Codex's sandbox mode.
It prints the session id first, then the outcome and the agent's final reply.
Tell the agent that it cannot prompt, so it ends with any decisions and its recommendations in its final reply, and that ending its turn ends the process and kills its background commands, so it waits in the foreground.
Ask the user, then resume that session in the background with the answer, as you would message a sub-agent: `quest agent resume` with the same options, the worktree, the session id, and the answer.
Stop one agent with `quest agent stop <worktree>`.
When the spawn ends, run `quest agent stop --all`, which stops any agent still running.

Exit status 3 means the harness's account hit its usage limit, and 4 that its CLI is logged out, printing the login command.
Start nothing more on that harness, report its outage once, and list each interrupted quest with its worktree and session id so the user can resume it later.
## Models

Start each quest on the first entry of its `models` that can run.
Fall to the next when `quest agent` reports its CLI missing or logged out, or the agent stops on a usage limit with nothing written beyond the claim commit, continuing in that checkout and claim PR.
Once a model has written anything, the PR is its: list the quest with its worktree and session id to resume after the reset.
Skip a quest whose list runs out, and report each harness's outage once.
2 changes: 1 addition & 1 deletion assets/skills/unblock.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: Walk the maintainer through every quest and draft PR waiting on them, and clear waits that have resolved.
guide: Format, Creation, Deletion, Summaries
guide: Format, Creation, Deletion, Coordination, Summaries
skills: grill, plan
---

Expand Down
18 changes: 9 additions & 9 deletions quest/m0/model-routing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
`/quest-spawn` starts each ready quest, and each coordinator its
`/quest-iterate` dispatches, on the first harness and model that can run from
a ranked list `quest` builds in for the work's size, the same for every
repository unless its `AGENTS.md` overrides it: Opus writes at every size,
with Sol as the fallback through M, and a usage limit falls through to the
next entry. An iterate is sized by the work left on its PR, not its quest's
repository unless its `AGENTS.md` overrides it: Haiku writes XS and Opus
the rest, with Sol as the fallback through L, and a usage limit falls through
to the next entry. An iterate is sized by the work left on its PR, not its quest's
original size, and runs on the model that first wrote the PR, so the other
can always review it. Sol reviews, at an effort set by the PR's size, and Opus
reviews whatever Sol wrote, so no model reviews its own code. Every PR
records the models and efforts behind it, and fixes link the PR that
caused them, so the rankings can be audited and retuned. This epic's own
work is one live spawn in moq-dev/quest from Claude Code that starts an XS
and an S quest on Opus, each recorded and reviewed by Sol.
quest on Haiku and an S quest on Opus, each recorded and reviewed by Sol.

Non-goals: routing kix.quest's runner jobs, which pick their own accounts
and models (their PRs still record their models); billing agents to API
Expand Down Expand Up @@ -81,19 +81,19 @@ are mostly judgment.
- Revised 2026-11-05 (user, /quest-plan): Grok leaves routing and the
council, so XS starts on Opus low; Sol reviews at the effort it would
write at (XS medium, S high, M xhigh, L and XL xhigh); and coordinators
size each `/quest-iterate` by its remaining work. The tables and the
iterate decisions are in [Route by size](/quest/m0/model-routing/models.md).
size each `/quest-iterate` by its remaining work, starting it on the PR's
first writer, which waits out its own usage limit rather than fall back.
- Revised again 2026-11-05 evening (user, /quest-plan): xhigh is XL's
alone. Haiku high writes XS; Opus writes S low, M medium, L high, XL
xhigh; Sol falls back one rung lower, now through L; Sol reviews follow
[Single-pass review](https://github.com/moq-dev/quest/pull/514)'s
table. The tables and the benchmark evidence are in
[Route by size](/quest/m0/model-routing/models.md).
table. The lists live in `src/cli/models.ts` (`quest models`), and the
benchmark evidence in
[moq-dev/quest#555](https://github.com/moq-dev/quest/pull/555).
- Which milestone? ✅ m0 (rejected: m1). It ranks first among m0's work
after Kix, by the 2026-11-01 order: land work, then Kix, then the rest.

## Required

- [Route by size](/quest/m0/model-routing/models.md) - `/quest-spawn` and iterate dispatches start on the first entry of the size's ranked list that can run, an iterate sized by its remaining work
- [kix records its follow-up sessions](/quest/m0/model-routing/kix-sessions.md) - kix `iterate` and `merge` jobs that change an existing PR record their `Implementer:` line in a PR comment
- [moq-dev pins](/quest/m0/model-routing/pins.md) - moq-dev/moq and moq-dev/moq.pro bump their `quest` pin to pick up the routing
Loading
Loading