Git + AI guide · 3 min

Pick up where the agent left off, on the right branch.

An interrupted AI session isn't just lost context: it's also a git state. Resuming in the wrong worktree risks a dirty merge or a silent regression. Here's the procedure to follow.

The real problem

Why resuming "just anywhere" breaks things.

Accidental merge

Resuming on main when the session lived on feature/x means merging unfinished changes into the main branch.

Lost intermediate files

An agent often leaves exploration files behind. Without the original worktree, it can't find them and regenerates an inconsistent state.

Historically skewed context

The summary is built on the fly from the repository's current state. If the repo has moved on, the summary describes a project that no longer exists.

Procedure

Four steps in Tramya.

  1. 1. Open the archived session

    Filter by project, sort by date. The record shows: git branch, worktree path, agent used, last known commit.

  2. 2. Check the repository state

    Tramya compares the current HEAD with the expected branch. A difference? A visual alert before any action.

  3. 3. Recreate the worktree if needed

    A "git worktree add" button: the exact command, with the right path and the right branch. No other worktree is touched.

  4. 4. Relaunch the agent

    The original agent or another agent of your choice. Tramya injects the context summary based on the state from back then, not the current state.

Frequently asked questions

What happens if the branch has been deleted?

Tramya offers to recreate it from the last known commit or from a closed PR. Nothing automatic.

Can I resume in an agent other than the original one?

Yes. The handoff is agent-agnostic: Claude Code → Codex, Cursor, Hermes, with no loss of project context.

The original worktree is still there — should I reuse it?

Yes, if it's clean. Otherwise, Tramya creates a fresh worktree on the same branch to avoid conflicts.