Skip to content

Branch Awareness

Agents in Ptah are branch-aware. The current branch name, upstream tracking info, and recent branch-specific commits are all part of the context bundle that every agent receives.

This isn’t cosmetic — it changes what agents do.

At spawn time, each agent sees:

FieldExampleUsed for
Branch namefeature/workspace-intelligenceInferring the task (often encoded in the name)
Upstreamorigin/feature/workspace-intelligenceDeciding whether to suggest a push
Ahead / behind5 ahead, 0 behindWarning about unsynced commits
Base branchmain (auto-detected)Scoping diffs for PR descriptions
Recent commits on branchLast 10 subjectsUnderstanding the arc of the branch
Dirty filesFrom git statusScoping edits to in-progress work

Concrete examples:

On a branch called fix/auth-redirect-loop, an agent asked “what’s going on here?” starts with the assumption you’re investigating an auth redirect bug, not writing a new feature.

On a branch called refactor/extract-git-service, an agent asked to refactor something will look at what’s already been changed on the branch (via git diff main...HEAD) and continue in that direction instead of starting over.

Ask an agent to draft a PR description and it automatically scopes the diff to the branch (base...HEAD), not the entire working tree. The draft reflects exactly what will be in the PR, not what you happen to have dirty locally.

If you’re on main and ask an agent to make a risky change, it may suggest creating a feature branch first:

“This change touches the provider registry, which affects all workspaces. Want me to create a branch refactor/provider-registry before editing?”

When you switch branches mid-chat, Ptah’s next agent invocation in that chat sees the new branch state. The chat history stays — agents get the new branch as updated context, not as a reset.

If you want a clean, branch-agnostic run — for example, when asking a general programming question — use Chat → Show context → Git state and toggle it off. Future messages in that chat omit git context until re-enabled.