---
name: safe-collab-workflow
description: Use when working in a repo that may be bound to Remix, especially for collaboration, sync, merge request, or state-recovery tasks.
---

# Safe Remix Collaboration Workflow

In a Remix-bound repo, treat Remix MCP tools as the authoritative workflow layer for collaboration state and historical reasoning.

Canonical rules:

- In a bound repo, Remix tools are the required workflow layer for collaboration work.
- In a bound repo, branch switches are collaboration-state transitions because each branch can resolve to its own Remix lane and app lineage.
- Historical intent questions go to Remix memory before raw git history.
- Raw git mutation is not the normal collaboration path in a bound repo.
- Before the final response, you must record exactly one completed turn with `remix_collab_finalize_turn`.
- The recording call must include the exact user prompt and your final assistant response.
- Do not finish the response before recording the completed turn.
- Prefer preview tools before apply tools whenever both exist.
- Treat reconcile as high risk and use it only when sync is unavailable and clearly required.

Raw git mutation commands must not be used for ordinary bound-repo collaboration work. Raw git reads are reserved for exact repository facts, not for normal collaboration-state or historical-reasoning flows.

Follow this order:

1. Start with `remix_collab_status`.
2. Use the returned recommendation and warnings to choose the next tool.
3. Prefer preview tools before apply tools:
   - `remix_collab_sync_preview` before `remix_collab_sync_apply`
   - `remix_collab_reconcile_preview` before `remix_collab_reconcile_apply`
4. Prefer Remix merge request tools over raw git merge flows for collaboration review work.
5. When you need historical context, hidden intent, failed attempts, merge/reconcile lineage, or pre-change risk context, check Remix memory before falling back to broader repo exploration:
   - `remix_collab_memory_summary`
   - `remix_collab_memory_search`
   - `remix_collab_memory_timeline`
6. Only call `remix_collab_memory_change_step_diff` after you already have a specific `changeStepId`.
7. 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.
8. Before the final response, call `remix_collab_finalize_turn`.

After switching branches:

1. Run `remix_collab_status`.
2. If the branch is healthy and bound, continue with the requested workflow.
3. If the branch is unbound, initialize or provision that branch lane before mutation commands.
4. If status reports a branch mismatch, stop and recover the correct branch binding before recording, syncing, reconciling, or opening a merge request.
5. Do not assume another branch's binding is safe to reuse on the current checkout.

Important rules:

- 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.
- In a bound repo, do not use raw git `commit`, `push`, `pull`, `merge`, `rebase`, or `reset` for ordinary Remix collaboration work.
- 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.
- In a bound repo, do not finish the response before recording the completed turn yourself.
- After the final recording call, avoid further repo mutations unless you intend to record another final turn.
- 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.
- When viewing merge requests, request bounded diff output first and only ask for more detail if needed.
- 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`.
