Create Feature Branch
Create a new feature branch for the user's next task in the intended repository.
Quick start
- Confirm the target repository root unless the calling workflow already resolved it.
- Ask what feature the branch should represent unless the user already gave a clear branch name.
- Turn the answer into a short branch name such as
feature/<name>. - Switch into the target repository root with
Push-Location/Pop-Locationor an equivalent directory stack. - Update the local
mainbranch to the latest state and create the new branch there.
Workflow
- Resolve the repository context.
- If a calling workflow already resolved a repository root or repository id, treat it as binding.
- If multiple repositories could apply, ask one narrow question before running any git command.
- Run
git rev-parse --show-toplevelin the working directory and stop if it does not match the intended repository. - Never rely on the shell's inherited current directory when the repository matters.
- Confirm the branch target.
- If the user gives a feature description, convert it to a concise kebab-case slug.
- If the user gives an exact branch name, use it when it matches the repository convention.
- If the repository uses a different prefix than
feature/, follow that convention.
- Sync
mainin the target repository.- Use
Push-Location/Pop-Locationor an equivalent directory stack when switching into the target repository root. - Switch to the local
mainbranch in that repository. - Update it from the default remote with a non-interactive command.
- Use
- Create the feature branch.
- Create the branch from the updated
mainbranch in the target repository. - Switch to the new branch immediately.
- Create the branch from the updated
- Report the result.
- Tell the user the final branch name.
- Tell the user which repository root the branch was created in.
- Surface blockers such as repository mismatches, uncommitted changes, missing remotes, or pull failures instead of guessing.
Notes
- Never run git against
agent-harnessunless that repository is intentionally the target. - Use non-interactive git commands.
- Do not invent a branch name when the requested feature is still ambiguous.
- Only perform the git steps when the user has explicitly asked for branch creation.