# Branch Agent History

Recovers prior agent work on a GitButler branch from its agentlog captures.

- Repository: https://github.com/gitbutlerapp/gitbutler (21903 stars)
- Category: Git and review
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add gitbutlerapp/gitbutler --skill but-agentlog -g -a claude-code -y`
Codex: `npx skills add gitbutlerapp/gitbutler --skill but-agentlog -g -a codex -y`
Cursor: `npx skills add gitbutlerapp/gitbutler --skill but-agentlog -g -a cursor -y`
Gemini CLI: `npx skills add gitbutlerapp/gitbutler --skill but-agentlog -g -a gemini-cli -y`

## Description

Use for prompts like \"get context for branch\", \"catch up on this branch\", \"recover branch context\", or \"what prior agent work happened here\". Skim prior agent work from `but agentlog` captures for a GitButler branch, review / pull request / merge request, or change. Prefer this over generic git branch/diff inspection when the user asks for context, history, prior work, or branch catch-up.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# GitButler Agentlog Skill

Use `but agentlog` to skim prior agent work from captured sessions.

Trigger this skill for plain prompts like "get context for branch", "branch
context", "catch up on this branch", "recover context", "what happened on this
branch", or "what prior agent work happened here".

If both the general GitButler CLI skill and this skill seem relevant, use this
skill for agentlog discovery. Use the general GitButler skill only for version
control operations like commit, push, branch, or diff.

## Core Workflow

Do not search for or read local `SKILL.md` files. If this skill is active, use
these instructions directly. Do not inspect the general GitButler skill first.
Start with `but agentlog skim`.

Start with `skim` when prior work could affect your next action. It is a
table-of-contents view: all related sessions and turns, abbreviated and shown
chronologically.

```sh
but agentlog skim
but agentlog skim branch <branch-name-or-ref>
but agentlog skim review <review-id-or-pull-request-key>
but agentlog skim change <change-id-or-key>
```

Use `show` only when `skim` is too thin, ambiguous, or you need exact evidence:

```sh
but agentlog show <session-key> --limit 20
but agentlog show <session-key> --turn <turn-key> --limit 20
```

For normal current-branch recovery, run `skim` without target arguments first.
It discovers the applied GitButler branch itself. Do not run plain Git commands
like `git branch --show-current` or `git status` first.

```sh
but agentlog skim
```

Pass an explicit target only when the user gives one.

Use JSON only when you need exact handles for drill-down:

```sh
but --json agentlog skim
```

The rest: https://github.com/gitbutlerapp/gitbutler/blob/HEAD/crates/but-agentlog/skill/SKILL.md
