@remixhq/claude-plugin 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remixhq/claude-plugin",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Claude Code plugin for Remix collaboration workflows",
5
5
  "homepage": "https://github.com/RemixDotOne/remix-claude-plugin",
6
6
  "license": "MIT",
@@ -34,12 +34,12 @@
34
34
  "postbuild": "node -e \"const fs=require('node:fs'); for (const p of ['dist/mcp-server.cjs','dist/hook-pre-git.cjs','dist/hook-user-prompt.cjs','dist/hook-post-collab.cjs','dist/hook-stop-collab.cjs']) fs.chmodSync(p, 0o755);\"",
35
35
  "dev": "tsx src/mcp-server.ts",
36
36
  "typecheck": "tsc -p tsconfig.json --noEmit",
37
- "test": "node --import tsx --test src/**/*.test.ts",
37
+ "test": "node --import tsx --test 'src/**/*.test.ts'",
38
38
  "prepack": "npm run build"
39
39
  },
40
40
  "dependencies": {
41
- "@remixhq/core": "^0.1.15",
42
- "@remixhq/mcp": "^0.1.15"
41
+ "@remixhq/core": "^0.1.17",
42
+ "@remixhq/mcp": "^0.1.17"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.4.0",
@@ -5,11 +5,13 @@ description: Use when deciding whether to bind the current repo to Remix or crea
5
5
 
6
6
  # Init, Remix, Or Checkout
7
7
 
8
- ## Silent-init rule
8
+ ## Mid-turn unbound branch is hook-owned
9
9
 
10
- If during any turn you find yourself on an unbound branch in a Remix-bound repo — whether the user mentioned Remix or not, whether the prompt is trivial or not — **silently run `remix_collab_init` on the current branch without asking**. This is not a decision point. Do not present init as one option among several. Do not switch to a bound branch to avoid init. Init the branch you are on.
10
+ When the current branch is unbound in a Remix-bound repo — whether the user mentioned Remix or not, whether the prompt is trivial or not — **the Remix `UserPromptSubmit` hook detects this and spawns `remix collab init` for you, detached, in the background**. You do not need to call `remix_collab_init` yourself for that case, and you should not present init as a decision point. The prompt context will include a Remix note when init is in flight; treat it as informational.
11
11
 
12
- The user-facing decision tree below (init vs. remix vs. checkout) only applies when the user is explicitly choosing how to bring a repo into Remix for the first time. Mid-turn unbound-branch recovery is always silent init.
12
+ If the user explicitly asks you to initialize the current branch, you may call `remix_collab_init` to give them an immediate synchronous result instead of waiting for the hook. Otherwise, leave it to the hook.
13
+
14
+ The user-facing decision tree below (init vs. remix vs. checkout) applies when the user is explicitly choosing how to bring a repo into Remix for the first time, or when the repo has no Remix binding at all (no `.remix/config.json`). The hook's auto-init path only fires when the repo already has a binding for some other branch.
13
15
 
14
16
  Use this skill when onboarding a repository into Remix, starting from an existing Remix app lineage, or checking out an exact existing Remix app.
15
17
 
@@ -31,7 +31,7 @@ Important rules:
31
31
  - In a bound repo, use Remix review tools as the default path for MR handling.
32
32
  - Choose an explicit queue instead of treating merge requests as one broad inbox.
33
33
  - Do not treat raw `git merge` as the way Remix merge requests are approved or applied.
34
- - Do not assume a successful `remix_collab_finalize_turn` already created a remote change step; drain and re-check when status reports `await_finalize`.
34
+ - Do not assume queued hook recording already created a remote change step; drain and re-check when status reports `await_finalize`.
35
35
  - If approval would mutate the local target repo, explain that before applying it.
36
36
  - If the repo context is unclear, stay in remote-only review mode until the target repo is confirmed.
37
- - Before the final response, use `remix_collab_finalize_turn` to record the completed review turn.
37
+ - Rely on automatic hook recording to capture the completed review turn.
@@ -9,30 +9,35 @@ In a Remix-bound repo, treat Remix MCP tools as the authoritative workflow layer
9
9
 
10
10
  ## Runtime override (read this first)
11
11
 
12
- When this turn's context contains a Remix runtime status note (recognizable by the literal `[Remix runtime status]` prefix from the Remix `UserPromptSubmit` hook), recording and queue draining for **this** turn are handled automatically by the runtime's `Stop` hook. In that case:
12
+ In a Remix-bound repo, the Remix plugin hooks own all "plumbing" for recording: turn finalize, branch init when the current branch is unbound, baseline repair when the local anchor diverged, and safe sync recovery when the server moved ahead. These run automatically, detached, in the background. You are not the recovery layer.
13
13
 
14
- - Do **not** call `remix_collab_finalize_turn` for this turn — the runtime is recording it. Calling it would create a duplicate record.
14
+ Concretely:
15
+
16
+ - Do **not** call `remix_collab_init` to "fix" an unbound branch. The `UserPromptSubmit` hook detects an unbound current branch and spawns `remix collab init` itself; the prompt context will tell you when this is in progress. Only call `remix_collab_init` when the user explicitly asks you to initialize a repo or when the runtime surfaces an unrecoverable error pointing at it.
17
+ - Do **not** call any MCP tool to "re-anchor" or "repair the baseline". The `Stop` hook auto-dispatches `remix collab re-anchor` when the server returns `re_anchor_required`; the next prompt will surface progress or failure.
18
+ - Do **not** call `remix_collab_sync_apply` purely as a precondition for recording. The `Stop` hook auto-dispatches `remix collab sync` when the server returns `pull_required`. Sync remains the right tool when the **user** asks to pull or when status shows divergence the user wants to act on.
19
+ - Do **not** call a finalize MCP tool for the current turn. The MCP surface does not expose one; the `Stop` hook is recording it.
15
20
  - Do **not** call `remix_collab_drain_finalize_queue` as a precondition for anything. The runtime drains the queue automatically in the background; mutation tools (`remix_collab_request_merge`, `remix_collab_reconcile_apply`) also drain internally before they run.
16
21
 
17
- The runtime status note is authoritative for the override. The rest of this skill including the "before the final response, you must record" rule still applies for **tool errors**, **explicit recovery flows**, and **turns where no runtime status note is present**.
22
+ When the prompt context includes a `[Remix recovery]` note from a previous turn, treat it as informational. The runtime is already retrying or has already failed and surfaced the log path; do not race it with another MCP call unless the user asks you to.
23
+
24
+ The runtime status note is authoritative for automatic recording. Use queue drain only for **explicit recovery flows**, such as status reporting `await_finalize` before a merge-related operation.
18
25
 
19
26
  Canonical rules:
20
27
 
21
28
  - In a bound repo, Remix tools are the required workflow layer for collaboration work.
22
29
  - In a bound repo, branch switches are collaboration-state transitions because each branch can resolve to its own Remix lane and app lineage.
23
30
  - Never switch git branches on your own. Branch switches are user-initiated only. If a Remix tool points at a different branch, do not "fix" it by switching — run `remix_collab_status` and follow its recommendation for the current branch.
24
- - An unbound branch is always a silent-init situation. Run `remix_collab_init` without asking. The user's intent when working on a branch is that the branch be bound.
31
+ - An unbound current branch is handled automatically by the `UserPromptSubmit` hook. Do not call `remix_collab_init` for the current branch unless the user explicitly asks; the hook spawns it detached and surfaces progress on the next prompt.
25
32
  - Historical intent questions go to Remix memory before raw git history.
26
- - Remix is source-blind: any local content change since the last recorded turn — whether you typed it, the user typed it, a merge produced it, `git pull` brought it in, or an IDE saved it — is captured by exactly one `remix_collab_finalize_turn`. Do not pick a different command based on what produced the change. `re-anchor` is for the narrow missing-baseline case only (status reports `re_anchor`).
27
- - Raw git mutation is allowed in a bound repo, but it never substitutes for `remix_collab_finalize_turn`. After raw git mutations, run `remix_collab_status` and record with `finalize-turn`.
28
- - Before the final response, you must record exactly one completed turn with `remix_collab_finalize_turn` — **unless the runtime override at the top of this skill applies** (a `[Remix runtime status]` note from the Remix hook stating that the Stop hook will record this turn).
29
- - `remix_collab_finalize_turn` is queued only. It captures the local boundary first; a remote change step does not exist yet until the finalize queue drains.
30
- - The recording call must include the exact user prompt and your final assistant response.
31
- - Do not finish the response before recording the completed turn (subject to the runtime override).
33
+ - Remix is source-blind: any local content change since the last recorded turn — whether you typed it, the user typed it, a merge produced it, `git pull` brought it in, or an IDE saved it — is captured by exactly one completed-turn hook recording. Do not pick a different command based on what produced the change. Baseline repair (`re-anchor`) is hook-owned: when the runtime needs it, the `Stop` hook spawns it and the next prompt explains it in plain language.
34
+ - Raw git mutation is allowed in a bound repo, but it never substitutes for automatic hook recording. After raw git mutations, run `remix_collab_status` if you need to inspect state; `recommendedAction: record` means the completed-turn hook will capture the boundary.
35
+ - The runtime records the exact user prompt and final assistant response automatically at turn completion.
36
+ - Hook recording is queued. A remote change step does not exist yet until the finalize queue drains.
32
37
  - Prefer preview tools before apply tools whenever both exist.
33
38
  - Treat reconcile as high risk and use it only when sync is unavailable and clearly required.
34
39
 
35
- Raw git mutation commands are not the normal collaboration path, but they are allowed. When they are used, treat the result the same as any other local content change: run `remix_collab_status` and follow its `recommendedAction` (almost always `record` `remix_collab_finalize_turn`). Raw git reads are reserved for exact repository facts, not for normal collaboration-state or historical-reasoning flows.
40
+ Raw git mutation commands are not the normal collaboration path, but they are allowed. When they are used, treat the result the same as any other local content change: run `remix_collab_status` if you need to inspect state; `recommendedAction: record` means the completed-turn hook will capture the boundary. Raw git reads are reserved for exact repository facts, not for normal collaboration-state or historical-reasoning flows.
36
41
 
37
42
  Follow this order:
38
43
 
@@ -49,13 +54,13 @@ Follow this order:
49
54
  - `remix_collab_memory_timeline`
50
55
  7. Only call `remix_collab_memory_change_step_diff` after you already have a specific `changeStepId`.
51
56
  8. Use raw git history only after Remix memory has narrowed the relevant change, or when the user explicitly asks for exact commit, blame, ancestry, or patch-level detail.
52
- 9. Before the final response, call `remix_collab_finalize_turn`, **unless** the runtime override at the top of this skill applies for this turn in which case the runtime records it on your behalf and a manual call would be a duplicate.
57
+ 9. Before merge-related or recovery flows, drain and re-check only if status reports `await_finalize`; routine completed-turn recording is automatic.
53
58
 
54
59
  After switching branches:
55
60
 
56
61
  1. Run `remix_collab_status`.
57
62
  2. If the branch is healthy and bound, continue with the requested workflow.
58
- 3. If the branch is unbound, silently run `remix_collab_init` on that branch before mutation commands. Do not ask, do not offer to switch back to another branch init the branch you are on.
63
+ 3. If the branch is unbound, do not call `remix_collab_init` yourself. The next `UserPromptSubmit` will trigger the hook-owned init for that branch automatically. Continue with read-only work; mutations land in the deferred-turn queue and replay once the branch binds.
59
64
  4. If status reports a branch mismatch, stop and recover the correct branch binding before recording, syncing, reconciling, or opening a merge request.
60
65
  5. Do not assume another branch's binding is safe to reuse on the current checkout.
61
66
 
@@ -74,16 +79,16 @@ Branch state can change between turns by means you did not initiate — external
74
79
 
75
80
  **NEVER end your response with an unhandled Remix error.** If a Remix tool fails and you cannot resolve it this turn, at minimum: run `remix_collab_status`, report the real state to the user, and explicitly ask how to proceed. Silently giving up is not an option in a bound repo.
76
81
 
77
- **NEVER switch branches to "recover" from an unexpected binding state.** If status shows the current branch is unbound or mismatched, the recovery is `remix_collab_init` (silent) or a user-facing question — never `git checkout` another branch. Branch switches belong to the user.
82
+ **NEVER switch branches to "recover" from an unexpected binding state.** If status shows the current branch is unbound or mismatched, the recovery is hook-owned (the next `UserPromptSubmit` spawns init automatically) or a user-facing question — never `git checkout` another branch. Branch switches belong to the user.
78
83
 
79
84
  Important rules:
80
85
 
81
- - If the repo is unbound, use `remix_collab_init` for the current repo, `remix_collab_remix` for a new fork from an existing app lineage, or `remix_collab_checkout` to materialize an existing app as-is.
82
- - In a bound repo, raw git mutations (`commit`, `pull`, `merge`, `rebase`, `reset`) are allowed but never replace `remix_collab_finalize_turn`. After any raw git mutation, run `remix_collab_status` and record with `finalize-turn`. Do not assume `re-anchor` is the recovery that command is only for missing-baseline cases (`recommendedAction: re_anchor`).
86
+ - If the repo has no Remix binding at all (no `.remix/config.json`), use `remix_collab_init` for the current repo, `remix_collab_remix` for a new fork from an existing app lineage, or `remix_collab_checkout` to materialize an existing app as-is. The `UserPromptSubmit` hook only auto-spawns init when a binding exists for some other branch on the same repo; it does not initialize a brand-new repo for you.
87
+ - In a bound repo, raw git mutations (`commit`, `pull`, `merge`, `rebase`, `reset`) are allowed but never replace automatic hook recording. After any raw git mutation, run `remix_collab_status` if you need to inspect state; `recommendedAction: record` means the completed-turn hook will capture the boundary. Do not call `remix_collab_re_anchor`, `remix_collab_init`, or `remix_collab_sync_apply` purely to "satisfy" recording the `Stop` hook auto-dispatches each of those when finalize reports the matching preflight code.
83
88
  - In a bound repo, do not start why/history/failed-attempt questions with raw git `log`, `show`, `blame`, or `diff`; start with Remix memory reads instead.
84
- - In a bound repo, do not finish the response before recording the completed turn yourself.
85
- - Do not treat a successful `remix_collab_finalize_turn` call as proof that the turn is already available for merge-request or remote-history workflows. Drain and re-check when status reports `await_finalize`.
86
- - After the final recording call, avoid further repo mutations unless you intend to record another final turn.
89
+ - In a bound repo, rely on automatic hook recording for the completed turn.
90
+ - Do not treat queued hook recording as proof that the turn is already available for merge-request or remote-history workflows. Drain and re-check when status reports `await_finalize`.
91
+ - After the final response, avoid further repo mutations unless you intend to capture them in a later turn.
87
92
  - Use raw git reads only when the task is clearly about exact repository facts or a separate GitHub-only branch workflow rather than Remix state.
88
93
  - When viewing merge requests, request bounded diff output first and only ask for more detail if needed.
89
94
  - For merge-request listing, choose the explicit queue that matches the intent: `remix_collab_review_queue`, `remix_collab_my_merge_requests`, or `remix_collab_list_app_merge_requests` with required `queue` set to `app_reviewable`, `app_outgoing`, or `app_related_visible`.
@@ -1,91 +1,63 @@
1
1
  ---
2
- name: finalize-turn-workflow
3
- description: Use when code edits or review work are complete in a Remix-bound repo and the turn should be recorded with `remix_collab_finalize_turn`.
2
+ name: turn-recording-workflow
3
+ description: Use when code edits or review work are complete in a Remix-bound repo and the completed turn should be captured by automatic hook recording.
4
4
  ---
5
5
 
6
- # Finalize A Remix Turn
6
+ # Record A Remix Turn
7
7
 
8
8
  Use this skill after edits or review work are complete and the task should be captured as the final recorded turn in a Remix-bound repo.
9
9
 
10
- This skill is specifically about the queued-finalize model behind `remix_collab_finalize_turn`.
10
+ This skill is specifically about the automatic hook recording model. The MCP surface does not expose a manual finalize tool.
11
11
 
12
12
  ## Source-blind recording rule
13
13
 
14
- Remix records turns source-blind. Any local content change since the last recorded turn — whether you typed it, the user typed it, a `git pull` brought it in, a `git merge` or `git rebase` produced it, or an IDE saved it — is captured by exactly one `remix_collab_finalize_turn`. `finalize-turn` automatically attaches `preTurnEvents` metadata describing any commits, merges, or uncommitted state captured at the boundary; you do not need to summarize that yourself.
14
+ Remix records turns source-blind. Any local content change since the last recorded turn — whether you typed it, the user typed it, a `git pull` brought it in, a `git merge` or `git rebase` produced it, or an IDE saved it — is captured by exactly one completed-turn hook recording. The recording automatically attaches `preTurnEvents` metadata describing any commits, merges, or uncommitted state captured at the boundary; you do not need to summarize that yourself.
15
15
 
16
- Do **not** pick a different command (`re-anchor`, `sync`, `reconcile`) based on what produced the local change. Those commands are only correct when `remix_collab_status.recommendedAction` explicitly names them:
16
+ Do **not** call `remix_collab_re_anchor_*`, `remix_collab_init`, or `remix_collab_sync_apply` purely as preconditions for recording. The runtime's `Stop` hook auto-dispatches each of those when finalize reports the matching preflight code:
17
17
 
18
- - `record` (or `repoState: local_only_changed`) `remix_collab_finalize_turn`. This is the catch-all and the most common case.
19
- - `re_anchor` → `remix_collab_re_anchor_*`. Only when no local Remix baseline exists for this lane (fresh clone, deleted `.remix/`, or first init didn't seed). Re-anchor seeds the baseline; it is not a recovery for "the local content changed."
20
- - `pull` → `remix_collab_sync_*`. Only when the server lane advanced and local did not.
21
- - `reconcile` → `remix_collab_reconcile_*`. Only when both sides changed since the agreed baseline.
18
+ - `branch_binding_missing` hook spawns `remix collab init`.
19
+ - `re_anchor_required` → hook spawns `remix collab re-anchor`.
20
+ - `pull_required` → hook spawns `remix collab sync`.
22
21
 
23
- ## Runtime override (read this first)
22
+ Each fix runs detached, logs to `.remix/<command>.log`, and writes a marker the next prompt surfaces. If you see a `[Remix recovery]` note in the next prompt's context, it is the runtime telling you what already happened — not a request for you to retry.
24
23
 
25
- When a Remix runtime status note appears in this turn's context — recognizable by the literal `[Remix runtime status]` prefix and originating from the Remix `UserPromptSubmit` hook recording and queue draining for **this** turn are handled automatically by the runtime's `Stop` hook. In that case:
24
+ The recommended-action codes from `remix_collab_status` (`record`, `re_anchor`, `pull`, `reconcile`) remain meaningful when the **user** is reasoning about state or explicitly asks for a sync, a re-anchor, or a reconcile. Don't pre-emptively invoke them just to "satisfy" recording.
26
25
 
27
- - Do **not** call `remix_collab_finalize_turn` for this turn. The runtime is recording it. A redundant call would create a duplicate record.
26
+ ## Runtime recording
27
+
28
+ In a Remix-bound repo, the `Stop` hook is the authoritative recorder for every completed turn:
29
+
30
+ - Do **not** call a finalize MCP tool. The MCP surface does not expose one.
28
31
  - Do **not** call `remix_collab_drain_finalize_queue` for this turn. The runtime drains the queue automatically in the background. Mutation tools (`remix_collab_request_merge`, `remix_collab_reconcile_apply`) drain internally before they run, so manual draining is never required as a precondition.
29
32
 
30
- The runtime status note is authoritative for the override. Everything else in this skill — the mandates, the "NEVER" rules, the recovery sequences — still applies for **error recovery**, **tool failures**, and **turns where no runtime status note is present**. Treat the override as covering only the routine "I just finished a healthy turn, time to record it" case.
33
+ Use `remix_collab_drain_finalize_queue` only for explicit recovery flows, such as status reporting `await_finalize` before a merge-related operation.
31
34
 
32
35
  Workflow:
33
36
 
34
37
  1. Run `remix_collab_status` first to confirm the repo is bound and inspect current warnings.
35
- 2. If status recommends `await_finalize`, do not record again and do not request a merge yet. Use `remix_collab_drain_finalize_queue`, then re-check `remix_collab_status`.
36
- 3. When the repo is ready, use `remix_collab_finalize_turn` before the final response, with the exact user prompt and your final assistant response **unless the runtime override above applies**.
37
- 4. Treat `remix_collab_finalize_turn` as capturing the local workspace boundary and queueing remote processing, not as immediate proof that a remote change step already exists.
38
+ 2. If status recommends `await_finalize`, do not request a merge yet. Use `remix_collab_drain_finalize_queue`, then re-check `remix_collab_status`.
39
+ 3. When status recommends `record`, continue the turn normally. The completed-turn hook captures the exact user prompt, final assistant response, and local workspace boundary.
40
+ 4. Treat hook recording as local capture plus queued remote processing, not as immediate proof that a remote change step already exists.
38
41
 
39
42
  Important behavior:
40
43
 
41
- - `remix_collab_finalize_turn` is the authoritative recording path for completed work instead of raw git commit or push.
42
- - `remix_collab_finalize_turn` is queued only. A remote change step does not exist yet until the finalize queue drains successfully.
43
- - A successful finalize call means local capture and queueing succeeded. It does not mean merge-request or remote-history workflows can assume the turn is already materialized remotely.
44
+ - Automatic hook recording is the authoritative path for completed work instead of raw git commit or push.
45
+ - Hook recording is queued. A remote change step does not exist yet until the finalize queue drains successfully.
44
46
  - If `remix_collab_status` reports `await_finalize`, use `remix_collab_drain_finalize_queue` and re-check status before merge-related or recovery flows.
45
- - If the user wants to understand current repo state before recording, re-run `remix_collab_status`.
46
- - Do not make further repo mutations after the final recording call unless you intend to record another completed turn.
47
- - Do not retry finalize immediately just because a remote record is not visible yet; queue drain is the next step, not a second finalize.
48
- - If finalize or drain returns `recommendedNextActions` or an `error.hint`, those fields are **authoritative and mandatory**. Do not ignore them. Do not improvise around them. Call `remix_collab_status` first and use its result plus the hint together to choose the next tool. Skipping this step is the single most common way agents fail in this skill.
47
+ - If the user wants to understand current repo state before the turn ends, re-run `remix_collab_status`.
48
+ - Do not make further repo mutations after the final response unless you intend them to be captured by a later completed turn.
49
+ - Do not retry recording just because a remote record is not visible yet; queue drain is the next step, not another recording attempt.
50
+ - If drain returns `recommendedNextActions` or an `error.hint`, those fields are **authoritative and mandatory**. Do not ignore them. Do not improvise around them. Call `remix_collab_status` first and use its result plus the hint together to choose the next tool.
49
51
  - If the tool surfaces a preserved local recovery artifact, mention it explicitly and keep it available while you repair repo state.
50
52
 
51
- Use the live worktree as the source of truth for finalized work. If the repo is not ready, fix the preflight state first rather than trying to bypass it.
52
-
53
- ## Finalize errors — non-negotiable rules
54
-
55
- When `remix_collab_finalize_turn` returns an error, you are in a state-recovery situation. You do not have permission to end your turn until it is resolved.
56
-
57
- **NEVER, UNDER ANY CIRCUMSTANCES, END A TURN WITH AN UNHANDLED FINALIZE ERROR.**
58
-
59
- This means:
60
-
61
- - Do not decide "finalize isn't applicable here" because the user's prompt was trivial (e.g. "hello world"). The recording rule fires on any turn that touches the bound repo — including the very finalize call that just failed. The call touched the repo. You must record.
62
- - Do not skip finalize because the error seems like a state problem outside your control. State problems are exactly what the error's `hint` and `recommendedNextActions` fields are there to resolve. Read them. Follow them.
63
- - Do not run a random bash command to "check what happened" and then give up. That is the failure pattern. `remix_collab_status` is the correct first tool, every time, without exception.
64
-
65
- **Mandatory recovery sequence when finalize errors:**
66
-
67
- 1. Read the error's `message`, `hint`, and `recommendedNextActions` fields in full. They are authoritative. If the hint names a tool, that tool is almost certainly the next correct call.
68
- 2. Call `remix_collab_status` immediately. The hint from status supersedes anything you inferred from the error alone — status sees the actual current binding, branch, worktree, alignment, and queue state.
69
- 3. Based on status, pick the correct recovery tool:
70
- - `local_only_changed` (or `recommendedAction: record`) → `remix_collab_finalize_turn`. This is the catch-all for any local mutation, including raw `git commit`, `git pull`, `git merge`, `git rebase`, or `git reset`. The source of the change does not matter.
71
- - `baseline_missing` or `external_local_base_changed` (or `recommendedAction: re_anchor`) → commit any pending edits, then `remix_collab_re_anchor_preview` → `remix_collab_re_anchor_apply`. This applies only when no local Remix baseline exists for this lane yet, not whenever local content moved.
72
- - `await_finalize` → `remix_collab_drain_finalize_queue`, then re-check status.
73
- - Unbound or mismatched branch → follow the branch-recovery rules below.
74
- - `delta_ready` for sync (or `recommendedAction: pull`) → `remix_collab_sync_preview` → `remix_collab_sync_apply`.
75
- - `both_changed` (or `recommendedAction: reconcile`) → `remix_collab_reconcile_preview` → `remix_collab_reconcile_apply`.
76
- 4. Retry `remix_collab_finalize_turn` only after status confirms the blocker is cleared.
77
- 5. Only then produce your final user-facing response.
78
-
79
- **If finalize fails because the current branch is unbound:**
53
+ Use the live worktree as the source of truth for recorded work. If the repo is not ready, fix the preflight state first rather than trying to bypass it.
80
54
 
81
- The error hint will explicitly name the branch (e.g., `"Run remix collab init on branch X"`). That hint is the answer. Sequence:
55
+ ## Branch recovery
82
56
 
83
- 1. Call `remix_collab_status` to confirm the current branch is unbound (not mismatched, not in another recoverable state).
84
- 2. **Silently run `remix_collab_init` on the current branch.** Do not ask the user first. Do not offer alternatives. Do not switch branches. An unbound branch in a Remix-bound repo is always a silent-init situation — that is the entire point of the init-on-demand contract.
85
- 3. Retry `remix_collab_finalize_turn`. Only after it succeeds, respond.
57
+ If status shows the current branch is unbound, **the next `UserPromptSubmit` hook will spawn `remix collab init` for you, detached, in the background.** Continue the requested work. The current turn lands in the deferred-turn queue and replays automatically once init completes; if init fails, the next prompt's context will explain it in plain language and point at `.remix/collab-init.log`.
86
58
 
87
- **NEVER switch git branches to resolve a finalize error.** Branch switching is a user-initiated action and requires explicit user instruction. If status shows the current branch is unbound, init it do not switch to some other bound branch to avoid the init. Silently initing the current branch is always correct; silently switching branches is always wrong.
59
+ You should not call `remix_collab_init` yourself for this case unless the user explicitly asks for an immediate, synchronous result. Calling it eagerly races the hook and produces no observable benefit.
88
60
 
89
- **Cross-branch finalize** (`allowBranchMismatch: true`) applies only when the user has explicitly asked for it. Do not infer it from status.
61
+ **NEVER switch git branches to resolve a recording issue.** Branch switching is a user-initiated action and requires explicit user instruction. If status shows the current branch is unbound, leave it for the hook — do not switch to some other bound branch to avoid the init.
90
62
 
91
- **The triviality of the user's current prompt is irrelevant.** "Say hello world" does not exempt you from the protocol. Neither does "what time is it", "thanks", or any other small talk. If the bound repo was touched — including by a failing Remix tool call — you finalize. No exceptions, **except** the explicit runtime override at the top of this skill (a `[Remix runtime status]` note from the runtime hook stating that the Stop hook will record this turn automatically). The runtime override is the **only** sanctioned way to skip a finalize call; nothing else exempts you.
63
+ The triviality of the user's current prompt is irrelevant. "Say hello world" does not exempt the turn from recording if the bound repo was touched. The hooks handle routine recording automatically.
@@ -14,8 +14,8 @@ Mental model:
14
14
  - `remix_collab_sync_*` is for pulling Remix-known app state into the local repo when fast-forward sync is possible (i.e. `recommendedAction: pull`, `repoState: server_only_changed`).
15
15
  - `remix_collab_reconcile_*` is for the rare case where both the local workspace and the server lane changed since the last agreed baseline (i.e. `recommendedAction: reconcile`, `repoState: both_changed`).
16
16
  - `remix_collab_sync_upstream` is for bringing new upstream app changes into a remix.
17
- - `remix_collab_finalize_turn` is not a sync tool. It records the completed turn, but it does not replace sync, reconcile, or upstream-sync workflows.
18
- - `re-anchor` is **not** a sync or recovery tool for diverged history. It only seeds a missing local Remix baseline (`recommendedAction: re_anchor`). See the finalize-turn-workflow skill for full handling. If status reports `local_only_changed` (or `recommendedAction: record`), the answer is `finalize-turn`, never reconcile.
17
+ - Automatic hook recording is not a sync tool. It records the completed turn, but it does not replace sync, reconcile, or upstream-sync workflows.
18
+ - `re-anchor` is **not** a sync or recovery tool for diverged history. It only seeds a missing local Remix baseline (`recommendedAction: re_anchor`). If status reports `local_only_changed` (or `recommendedAction: record`), routine completed-turn hook recording is the answer, never reconcile.
19
19
 
20
20
  Workflow:
21
21