Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,46 @@
}
]
}
],
"WorktreeCreate": [
{
"hooks": [
{
"type": "command",
"command": "nix run \"${CLAUDE_PROJECT_DIR}#quest\" -- worktree hook"
}
]
}
],
"WorktreeRemove": [
{
"hooks": [
{
"type": "command",
"command": "nix run \"${CLAUDE_PROJECT_DIR}#quest\" -- worktree hook"
}
]
}
],
"SubagentStart": [
{
"hooks": [
{
"type": "command",
"command": "nix run \"${CLAUDE_PROJECT_DIR}#quest\" -- worktree hook"
}
]
}
],
"SubagentStop": [
{
"hooks": [
{
"type": "command",
"command": "nix run \"${CLAUDE_PROJECT_DIR}#quest\" -- worktree hook"
}
]
}
]
},
"permissions": {
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/quest-merge/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: quest-merge
description: Queue a reviewed PR to land, or send it to /quest-iterate.
description: Queue a PR to land, running /quest-iterate first when it needs work.
---

Run `quest skill merge` and follow its output.
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
/.claude/cache/
/.claude/tmp/
/.claude/worktrees/
# quest's own checkouts (`quest worktree create`, /quest-spawn, and its Claude
# Code worktree hooks) live under the main checkout's .worktrees/, for the same
# reason.
/.worktrees/

# Per-checkout scratch output, such as benchmark logs and agent notes.
/.tmp/
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ These diff the branch against its base and only run the affected packages.

Quests: before starting work, run `quest guide` and follow it.
The `quest` binary comes from the moq-dev/quest flake input and serves the quest skills; change them upstream and bump the input.
Claude Code's worktree hooks run that pinned `quest` through `nix run`, because hooks don't see the dev shell; `quest init` refuses them, so drop them for its run and restore `.claude/settings.json` afterwards.

# Cross-Package Sync

Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# The quest CLI, which also serves the quest guide and skills the stubs in
# .claude/skills call. Bump the rev to upgrade them.
quest = {
url = "github:moq-dev/quest/5e66075d5acc397e400094ea4f53f7db45e351ce";
url = "github:moq-dev/quest/36d0429cce0d540ad90f6c1a006a9ca1659b0696";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
Expand Down
2 changes: 1 addition & 1 deletion quest/m0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ since cutting segments from first-frame pts waits on nothing in m1.
- [Backport the relay and auth hardening to release](/quest/m0/backport-release-hardening.md) - `release`'s relay refuses dot-segment paths, serves its HTTP routes with main's response hardening, and withdraws advertisements a peer starves of send credit; its auth client refuses redirects
- [Release's MKV importer bounds what it buffers](/quest/m0/backport-mkv-buffer.md) - on `release`, an MKV input that declares a huge element and trickles its bytes no longer grows the importer's memory without limit
- [HLS export on a declared grid](/quest/m0/hls-media-grid.md) - the catalog's `hls` field and record tracks go away, and the export numbers segments on `media.join.interval` from media tracks
- [Agents use quest's worktree hooks](/quest/m0/quest-worktree-hooks.md) - adopt `quest worktree hook` once it's shown to coexist with T3 Code's worktrees
- [quest init keeps moq's nix-wrapped worktree hooks](/quest/m0/quest-worktree-hooks.md) - quest pin bumps keep the hooks that run moq's pinned `quest`
- [HLS lists contributions](/quest/m0/hls-contributions.md) - an HLS master lists each catalog contribution's renditions, and a contribution's media is subscribed only while players fetch it
52 changes: 39 additions & 13 deletions quest/m0/quest-worktree-hooks.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
# [S] Agents use quest's worktree hooks
# [XS] quest init keeps moq's nix-wrapped worktree hooks

## Goal

moq's `.claude/settings.json` carries the `WorktreeCreate`, `WorktreeRemove`,
`SubagentStart` and `SubagentStop` hooks that `quest init` installs (running
`quest worktree hook`), so agent worktrees are created and cleaned up the way
quest expects, without breaking T3 Code's own worktree management.
moq's Claude Code worktree hooks, which run the `quest` moq pins through nix,
survive quest pin bumps: `quest init` leaves them alone instead of refusing
them.

## Plan

Planned 2026-11-02 (maintainer, /quest-unblock), from
[moq-dev/moq#7644](https://github.com/moq-dev/moq/pull/7644): the quest pin bump
left the hooks out because they change how agent worktrees are made here, and
moq never adopted them after moq-dev/quest#350.
Decided 2026-11-03 (maintainer, on
[moq-dev/moq#7674](https://github.com/moq-dev/moq/pull/7674)): ✅ the hooks
reach `quest` through nix (or a submodule) long-term, so they run moq's pin.
A host-wide `quest` on `PATH` is acceptable only as a temporary bridge.
Rejected: relying on an installed `quest`, `direnv exec`, adopting the bare
`quest worktree hook` now, and dropping the quest.

- First confirm the hooks coexist with T3 Code's worktree threads and its
isolated delegate checkouts (create, hand off, and clean up one of each with
the hooks on). If they conflict, stop and report rather than adopting.
- Then add them with `quest init` and document the behavior in AGENTS.md.
Decided 2026-11-03 (maintainer, on
[moq-dev/moq#7674](https://github.com/moq-dev/moq/pull/7674)): ✅ ask
moq-dev/quest to have `quest init` treat any command hook whose arguments end
in `worktree hook` as its own. Rejected: a configured hook command, and not
asking.

[moq-dev/moq#7674](https://github.com/moq-dev/moq/pull/7674) installed the four
hooks as `nix run "${CLAUDE_PROJECT_DIR}#quest" -- worktree hook`. That command
takes 0.1–0.5 s warm and 1.5–3 s with a cold nix cache, and builds a new pin in
about 6 s. It also bumped the pin past
[moq-dev/quest#425](https://github.com/moq-dev/quest/pull/425), so
`--worktree '#123'` starts at the PR head and workflow agents' checkouts get
released, and checked live that the hooks coexist with T3 Code's worktree
threads and isolated delegates. What remains:

- `quest init` matches only the literal `quest worktree hook`, so it refuses a
wrapped `WorktreeCreate`/`WorktreeRemove` command (exit 1, nothing written)
and would add duplicate subagent hooks. Until quest recognizes a wrapped
command, a pin bump drops the four entries for its `quest init` run and
restores `.claude/settings.json` afterwards, as AGENTS.md says. Once
quest recognizes them, bump the pin, check that `quest init` is a
no-op here, and drop that AGENTS.md sentence.

## Waiting

- moq-dev/quest: land `quest init` and `quest uninstall` treating a command
hook whose arguments end in `worktree hook` as Quest's own (being planned
there as of 2026-11-03). Check: with this repository's hooks in place, the
pinned `quest init` exits 0 and leaves `.claude/settings.json` unchanged.