Repository navigation
quest: plan dev shells from user settings instead of repo hooks #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ca65bba
quest: plan dev shells from user settings instead of repo hooks
kixelated 763704a
quest: name the dotfiles PR the repo-config wait depends on
kixelated 1635b55
quest: narrow the dev-shell hook's auto-allow and settle review findings
kixelated 7525141
quest: settle the dev-shell hook's allow rule with one guard
kixelated 06d08e4
quest: match only Quest's own hooks for removal, and skip kixtop's check
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Agents get the dev shell from user settings, not repository config | ||
|
|
||
| ## Goal | ||
|
|
||
| Agents in moq-dev's repositories run tools without caring about Nix: each | ||
| maintainer's own Claude Code and Codex settings load the repository's dev | ||
| shell into every session's commands, so no repository forces direnv, Nix, or | ||
| `quest` on its contributors through checked-in hooks. No repository carries a | ||
| dev-shell `SessionStart` hook, a Quest worktree hook, or AGENTS.md | ||
| instructions to wrap commands in `nix develop`, and `quest init` writes no | ||
| hook entries. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided 2026-11-03 (maintainer, /quest-unblock of | ||
| [moq-dev/quest#423](https://github.com/moq-dev/quest/pull/423)'s wait to | ||
| install `quest` on Claude's `PATH`): | ||
|
|
||
| - Install `quest` on the `PATH` Claude Code starts with? ✅ No (rejected: | ||
| `nix profile add github:moq-dev/quest` on every host). | ||
| - How should sessions reach a pinned `quest` and the rest of the dev shell? | ||
| ✅ A dev-shell hook in the maintainer's own Claude settings (rejected: hook | ||
| entries that `nix run` the repository's pinned input, as moq-dev/moq does; | ||
| dropping the hooks with no replacement). Reason: "We don't want to force | ||
| direnv+nix for other users"; repository config applies to every | ||
| contributor. | ||
| - Repository-level direnv `SessionStart` hooks in quest, moq, moq.pro, rind, | ||
| and rust2? ✅ Remove them from all five once the user-level hook loads the | ||
| dev shell (rejected: keep them). | ||
| - Quest's worktree hooks? ✅ Drop them from repositories, and `quest init` | ||
| stops writing hook entries; the hooks become an opt-in user-level setup | ||
| (rejected: this repository and moq only; this repository only; moving them | ||
| into the maintainer's settings). | ||
| [moq-dev/quest#423](https://github.com/moq-dev/quest/pull/423) is closed. | ||
| - Codex? ✅ A user-level Codex `SessionStart` hook does the same capture, and | ||
| the repositories' `.codex/` dev-shell hooks go (rejected: Claude only). | ||
| - A fresh worktree needs `direnv allow`: direnv keys each approval by the | ||
| SHA-256 of the `.envrc`'s absolute path and contents | ||
| (`~/.local/share/direnv/allow/`, 1,706 entries on the maintainer's host on | ||
| 2026-11-03), so nothing carries over from the main checkout. ✅ The | ||
| user-level hook allows a checkout itself when its `.envrc`, `flake.nix`, | ||
| and `flake.lock` match the remote's default branch (rejected: whitelisting | ||
| `~/work` and `~/worktrees` in `direnv.toml`, which would also evaluate a | ||
| fork PR's dev shell; keeping manual allows). A branch that changes them | ||
| still needs a manual allow. Amended 2026-11-03 (review of | ||
| [moq-dev/quest#458](https://github.com/moq-dev/quest/pull/458)): those | ||
| three files alone don't make a checkout reviewed. Any repository's fresh | ||
| clone matches its own default branch. A fork PR head can change another | ||
| file the dev shell runs, such as moq.pro's `dev/mbx-shim.sh`. Both were | ||
| auto-allowed in a reproduction against the merged hook. | ||
| Decided 2026-11-03 (maintainer, /quest-complete), after weighing the | ||
| risk as narrow: a session rooted at an outside contributor's fork head, | ||
| which the guide already says never to run, since agents check untrusted | ||
| heads out under `.tmp/` rather than as a session root, and an agent | ||
| session in any checkout runs its code anyway. ✅ One cheap guard: the | ||
| hook also requires `HEAD` to be on some `origin` branch | ||
| (`git for-each-ref --contains HEAD refs/remotes/origin/`), so a fork PR | ||
| head is never auto-allowed (rejected: an owner allowlist, a clean tree, | ||
| and a tracked `.envrc` on top; matching the whole tree to the merge base; | ||
| an owner allowlist alone; leaving it as is). Shipped in | ||
| [kixelated/dotfiles#35](https://github.com/kixelated/dotfiles/pull/35) | ||
| and live on `desktop` and `nixos2`, where a fresh worktree of moq-dev/moq | ||
| still loads and one on an unpushed commit is refused. | ||
| - AGENTS.md instructions to run tools through `nix develop`? ✅ Remove them in | ||
| all five repositories once the user-level hooks are on every host the | ||
| maintainer runs agents on (rejected: this repository only; keeping them as | ||
| a fallback). | ||
|
|
||
| The user-level hooks live in [kixelated/dotfiles](https://github.com/kixelated/dotfiles), | ||
| installed into each Claude profile's `settings.json` and Codex's user | ||
| config, and generalize this repository's `.claude/hooks/direnv.sh` and | ||
| moq-dev/moq's `.codex/hooks/direnv.sh`. | ||
|
|
||
| ## Required | ||
|
|
||
| - [quest init writes no hooks](/quest/m0/user-dev-shell/init-hooks.md) - `quest init` stops writing hook entries and removes the ones it or a wrapper wrote; the docs describe the hooks as user-level opt-in | ||
| - [Repositories drop dev-shell config](/quest/m0/user-dev-shell/repo-config.md) - quest, moq, moq.pro, rind, and rust2 drop their dev-shell hooks, Quest worktree hooks, and `nix develop` instructions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # [S] quest init writes no hook entries | ||
|
|
||
| ## Goal | ||
|
|
||
| `quest init` no longer writes Claude Code hook entries into a repository's | ||
| `.claude/settings.json`, and removes the `quest worktree hook` entries an | ||
| earlier version wrote, including ones a repository wrapped, such as | ||
| moq-dev/moq's `nix run "${CLAUDE_PROJECT_DIR}#quest" -- worktree hook`. | ||
| `quest uninstall` removes both forms too. The README and SETUP.md describe the | ||
| worktree hooks as an opt-in a user adds to their own Claude settings, with | ||
| the entries to add. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided 2026-11-03 (maintainer, /quest-unblock): repository config applies | ||
| to every contributor, so Quest's hooks become user-level opt-in; see the | ||
| [epic](/quest/m0/user-dev-shell/README.md). | ||
|
|
||
| - Replaces the wrapped-hooks quest (moq-dev/moq, 2026-11-03), which widened | ||
| `isQuestHook` (`src/core/init.ts`) so `init` would accept wrapped hooks. | ||
| For removal, a command hook is Quest's only when it runs Quest: the plain | ||
| `quest worktree hook`, or a wrapper whose command ends in `worktree hook` | ||
| and names the `quest` executable or package as a word or flake attribute, | ||
| such as moq's `nix run "${CLAUDE_PROJECT_DIR}#quest" -- worktree hook`. | ||
| Another tool's command that merely ends in `worktree hook` stays. | ||
| - `HOOK_EVENTS` and the hook plan in `src/core/init.ts` stop adding | ||
| entries; `init` reports each entry it removes. The enrollment setup PR | ||
| ([moq-dev/quest#431](https://github.com/moq-dev/quest/pull/431)) uses the | ||
| same plan, so it stops proposing hooks too. | ||
| - The `quest worktree hook` command stays, for users who opt in. | ||
| - Removing moq's four wrapped entries, whether `init` here or | ||
| [repo-config](/quest/m0/user-dev-shell/repo-config.md) does it first, ends | ||
| Quest's reclaim of Claude Code checkouts in moq. Nothing replaces it: the | ||
| maintainer's user-level setup (kixelated/dotfiles) loads only the dev | ||
| shell, and the epic's decision rejected moving Quest's hooks into the | ||
| maintainer's settings. So this quest doesn't wait on that setup, and the | ||
| same end state results in either order. A user who wants reclaim adds the | ||
| opt-in entries the docs describe. Any removal through the enrollment setup | ||
| PR shows in that PR's diff. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| - Test `init` and `uninstall` on a repository with plain and wrapped | ||
| entries, and with other hooks beside them, which stay, including another | ||
| tool's command that ends in `worktree hook`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # [S] Repositories drop their dev-shell config | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-dev/quest, moq, moq.pro, rind, and rust2 carry no dev-shell hooks and no | ||
| instructions to wrap commands in Nix: each drops its direnv `SessionStart` | ||
| hook from `.claude/settings.json` and `.codex/hooks.json` with the scripts | ||
| and tests behind them, moq drops its four Quest worktree hook entries, and | ||
| each AGENTS.md drops its `nix develop` instructions. Agents there still run | ||
| the pinned tools, through the maintainer's user-level hooks. One PR per | ||
| repository. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided 2026-11-03 (maintainer, /quest-unblock); see the | ||
| [epic](/quest/m0/user-dev-shell/README.md). | ||
|
|
||
| - Keep every other hook: moq.pro's `submodule.sh`, `worktree.sh` (its own | ||
| submodule-aware worktrees, not Quest's), and `tofu-secrets.py`. | ||
| - CONTRIBUTING.md's human setup (`nix develop` to match CI) stays; only the | ||
| agent-facing instructions go. In this repository, AGENTS.md's "`quest` | ||
| means `bun run --silent quest`" note stays, since it names which `quest` | ||
| to run, not how to load it. | ||
| - Check each repository from a fresh worktree on a host with the user-level | ||
| hooks: a new Claude Code session and a new Codex session both resolve the | ||
| dev shell's tools (`which just`, `quest --version` where pinned) with no | ||
| `nix develop` and no manual `direnv allow`. | ||
|
|
||
| ## Waiting | ||
|
|
||
| - Maintainer: pull kixelated/dotfiles and run `bin/install-dev-shell.py` (or the full `install`, with `codex` on `PATH`) on `nixos` (`kixtop` has neither direnv nor Nix, so the hook has nothing to load there; it got only the effort defaults on 2026-11-03); it changes the live agent config on each host, which an agent here doesn't touch unasked. The repositories' hooks must not go before the user-level ones arrive. [kixelated/dotfiles#33](https://github.com/kixelated/dotfiles/pull/33) is merged. On 2026-11-03, `desktop` and `nixos2` had the hook in `~/.claude-personal/settings.json`, but `nixos` and `kixtop` didn't. Check on each host with direnv and Nix (`desktop`, `nixos2`, `nixos`) that `~/.claude-personal/settings.json` has the dev-shell `SessionStart` hook and that a fresh worktree's session resolves `just`; on `kixtop` the hook is an expected no-op |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.