Skip to content
Draft
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
58 changes: 43 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1807,33 +1807,61 @@ The [getting started guide](docs/getting-started.md) covers what happens next.
quest format and workflow they read before working on a quest outside a skill;
`quest guide prompting` prints one section.

### Configure Claude Code
### Configure your agent

`quest setup` configures your own Claude Code settings for quest work, in every
repository:
`quest setup` configures your own Claude Code and Codex settings for quest
work, in every repository:

```sh
quest setup
```

It sets `env.BASH_MAX_TIMEOUT_MS` to 3300000, so a foreground command such as
`quest wait` can block for 55 minutes, just under the 1h prompt-cache TTL,
instead of the 10-minute default.
It sets Claude Code's `env.BASH_MAX_TIMEOUT_MS` to 3300000, so a foreground
command such as `quest wait` can block for 55 minutes, just under the 1h
prompt-cache TTL, instead of the 10-minute default.

It also loads the rules once. The repository's `Quests: ` line has agents run
`quest context` before any work, which costs a turn and is summarized away
when the session compacts. Instead, `quest setup` installs a `SessionStart`
hook (startup, resume, clear, and compact) and a `SubagentStart` hook, each
running `quest hook`, which adds `quest context` to the session in a
repository whose root `AGENTS.md` or `CLAUDE.md` has the `Quests: ` line, and
nothing elsewhere. `quest` must be on the `PATH` Claude Code starts with.
`quest setup --worktrees` also installs the
hook (startup, resume, clear, and compact), and for Claude Code a
`SubagentStart` hook, each running `quest hook`, which adds `quest context` to
the session in a repository whose root `AGENTS.md` or `CLAUDE.md` has the
`Quests: ` line, and nothing elsewhere. Codex holds the rules in full, rather
than spilling them to a file, through the hook's `additionalContextLimit`.
`quest setup --worktrees` also installs Claude Code's
[worktree hooks](#claude-code-checkouts).

It edits `$CLAUDE_CONFIG_DIR/settings.json`, or `~/.claude/settings.json`,
keeps your other settings, refuses a malformed file unchanged, writes once,
and prints each change. Rerun it after upgrading. `quest setup --remove` takes
the hooks out, and the timeout while it still holds Quest's value.
The rules a program can check are enforced instead of read. A `PreToolUse`
hook on shell commands and file edits denies, with the rule as the reason:

- an edit, commit message, or new GitHub post that adds an em dash outside a
`>` quote line;
- a `git push` whose refspecs lack a `:`;
- a force-push, `git rebase`, or `git pull --rebase`, unless the command
starts with `QUEST_USER_ASKED=1` because the user asked for it;
- a new GitHub post (`gh pr create`, `comment`, or `review`, `gh issue create`
or `comment`, or `gh api` with a `body` field) without a `(Written by ...)`
line;
- a scratch file written under `/tmp`, outside the checkout.

It checks only a body on the command line itself: `--body`, a `body=` field,
`git commit -m`, or `--body-file -` with a here-document. A body file, or one
piped into `gh`, passes unread, since the file may hold something else by the
time the command runs; `quest context` keeps the footer and em-dash rules in
prose for that case. `quest context` still prints these rules,
under a last `Checked` section that the hook leaves out, for agents without
it.

`quest` must be on the `PATH` the agent starts with, as for the worktree
hooks. Codex asks you to trust the hooks once, and after each upgrade that
changes them, through `/hooks`; `quest review` runs Codex without your
config, so its reviewers run none of them.

It edits `$CLAUDE_CONFIG_DIR/settings.json`, or `~/.claude/settings.json`, and
`$CODEX_HOME/hooks.json`, or `~/.codex/hooks.json`, when that directory exists.
It keeps your other settings, refuses a malformed file unchanged, writes each
once, and prints each change. Rerun it after upgrading. `quest setup --remove`
takes the hooks out, and the timeout while it still holds Quest's value.

## Where this is going

Expand Down
24 changes: 14 additions & 10 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@ to proceed; never delete or rename their files to get past it.

## Configure the user's agent

`quest setup` configures the user's own Claude Code settings, not the
repository's, in `$CLAUDE_CONFIG_DIR/settings.json` (or
`~/.claude/settings.json`). It sets `env.BASH_MAX_TIMEOUT_MS` to 55 minutes, so
agents can block on a long wait in one call instead of polling. It also adds
the rules the `Quests: ` line points at to every session and subagent, and
again after compaction, which would otherwise summarize them away, through
hooks that need `quest` on the `PATH` Claude Code runs hooks with. Offer it,
explaining that it applies in every repository the user opens in Claude Code
(the hooks only in those with the `Quests: ` line), and run it with consent. It
keeps the file's other settings and prints what it changed.
`quest setup` configures the user's own agent settings, not the repository's:
Claude Code's in `$CLAUDE_CONFIG_DIR/settings.json` (or
`~/.claude/settings.json`), and Codex's in `$CODEX_HOME/hooks.json` (or
`~/.codex/hooks.json`) when that directory exists. It sets Claude Code's
`env.BASH_MAX_TIMEOUT_MS` to 55 minutes, so agents can block on a long wait in
one call instead of polling. It also adds the rules the `Quests: ` line points
at to every session, and again after compaction, which would otherwise
summarize them away, and blocks tool calls that break the rules a program can
check, such as a `git push` without an explicit refspec, through hooks that
need `quest` on the `PATH` the agent runs hooks with. Offer it, explaining that
it applies in every repository the user opens (the hooks act only in those with
the `Quests: ` line), and run it with consent. Codex then asks the user to
trust the hooks once through `/hooks`. It keeps the files' other settings and
prints what it changed.

## Opt into worktree hooks

Expand Down
10 changes: 3 additions & 7 deletions assets/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Engineering rules for every task, as `quest context` prints them. The repository
- Every test runs in CI. The merge gate holds only fast, high-signal tests; slow ones run nightly.
- Be adversarial: attack your own approach, reports, reviews, and other PRs as hard as anyone else's, and argue for the best approach over the first one that works.
- Never add or change a rule in an `AGENTS.md`, `CONTRIBUTING.md`, or skill without being prompted. When you do, follow `quest guide prompting`.
- No em dashes.
- End every GitHub post you author with `(Written by <model> with <effort>)`, naming the running model and its reasoning effort, or `(Written by <model>)` when the harness doesn't report the effort; never guess it. Commit messages with a `Co-Authored-By:` trailer are exempt.
- In a public repository, never mention customers, partners, or prospects, or link to private repositories. Justify work on its merits.

## Important
Expand Down Expand Up @@ -56,8 +54,8 @@ Work in your own worktree, reusing a suitable one you already own.
Read-only discovery needs no new checkout when your context or own checkout answers it.
Put PR bodies, review drafts, logs, patches, helper scripts, and temporary clones in its `.tmp/`, so they disappear with the worktree.
If the repository doesn't ignore `.tmp/`, add it to the file `git rev-parse --git-path info/exclude` names.
Never write them to `/tmp`, elsewhere in or beside the checkout, or in a directory other agents share, such as a session scratchpad.
Pass PR bodies to `gh` on stdin (`--body-file -`).
Never write them elsewhere in or beside the checkout, or in a directory other agents share.
Pass PR bodies to `gh` on stdin (`--body-file -`) with a here-document, where the hook checks them; one posted from a file goes unchecked, so it must still end with the `(Written by ...)` line and hold no em dashes.

Before ending a task, pausing for a decision, or handing off, commit a checkpoint and report what remains and which checks passed or did not run.
Finish with a clean checkout: intended changes committed and pushed, incidental generated changes restored, and pre-existing or unrelated changes preserved.
Expand Down Expand Up @@ -87,9 +85,7 @@ A decision about an open PR never authorizes closing it. Confirm a close as its

## Pull requests

Push with an explicit refspec: `git push <remote> refs/heads/<branch>:refs/heads/<branch>`.
A bare branch name can push to the base instead, as under `push.default=upstream` when the branch tracks it.
Never rebase or force-push, even a branch only you hold; merge the base instead, only when the branch conflicts with it or a landing step, such as `quest merge` or a merge queue, refuses the head, and resolve the conflicts in that merge; a branch only behind needs none, since landing tests it on the current base.
Merge the base only when the branch conflicts with it or a landing step, such as `quest merge` or a merge queue, refuses the head, and resolve the conflicts in that merge; a branch only behind needs none, since landing tests it on the current base.
A PR that another session pushed to in the last hour is theirs: report its events instead of pushing to it.
Before each push to a PR's branch, confirm the PR is still open, since a push after it merges restores the deleted branch.
Run the repository's checks locally while the PR is a draft; CI may run only on PRs ready for review.
Expand Down
3 changes: 2 additions & 1 deletion quest/m0/token-waste/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Decision prompts, chosen options marked ✅:
(Theo's tstack, jdx's jouet, Matt Pocock's skills, HumanLayer, Mitchell
Hashimoto), chosen ✅ and rejected listed:
- ✅ Mechanical rules become hooks or lint, so their prose leaves the
always-loaded rules ([rule checks](/quest/m0/token-waste/rule-checks.md)).
always-loaded rules, done in
[moq-dev/quest#553](https://github.com/moq-dev/quest/pull/553).
- ✅ A review round budget by severity, after Theo's `sol-loop`
([moq-dev/quest#514](https://github.com/moq-dev/quest/pull/514)).
- ✅ `quest usage` moves from m1 into this epic, so its closing
Expand Down
46 changes: 0 additions & 46 deletions quest/m0/token-waste/rule-checks.md

This file was deleted.

Loading
Loading