# Mobile Worktree Finish Command

## Problem

The phone worktree-finish affordance previously treated "commit and merge" as a CTM-side git mutation. That created two product problems:

- It required a step-up/Face ID gate because CTM was about to mutate local git state directly.
- It bypassed each user's coding-agent review workflow. For one user this may be `$tl-commit`; another user may have a different review/commit skill.

## Design

CTM mobile should not commit or merge on behalf of the user from the status UI. The phone action is a low-risk remote reply to the owning coding session:

1. Resolve an appropriate review/commit skill from `/api/skills/autocomplete`.
2. Build a session command using the resolved skill, for example `$review-commit and merge to main`.
3. If no suitable skill is found, send a plain natural-language finish request.
4. Deliver the command through `session.send_message`.
5. The agent validates git state, runs the user's review workflow, commits, and integrates to `main` from its own terminal context.

This mirrors the same authority boundary as normal phone replies: CTM transports intent, while the coding agent performs the work with its configured skills, tools, and repository context.

## Safety

- No Face ID is needed for the phone button because it does not mutate git state.
- The generated command tells the agent to validate the local git state before reporting success.
- The command explicitly asks the agent to stop on unrelated main changes, merge conflicts, or an unready branch.
- Skill discovery is not hard-coded to any user skill name. Ranking uses generic commit/review/merge/git terms from the skill name and description.
