Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

338 linesCodeBlameRaw
1---
2title: Claude Code plugin
3description: Install g1t's plugin for Claude Code, which records your sessions on g1t, gives Claude the issue's work context, and adds g1t's MCP server, skills and commands. What each hook records and never records, and how to opt out.
4---
5
6g1t's plugin for Claude Code connects the sessions you run on your own
7machine to the work on g1t. With it installed, working in a g1t repository:
8
9- each Claude Code session is recorded on g1t as a
10 [session](/guides/why-blame/#sessions), titled with what you asked for
11 and attached to its issue and pull request, so the people and agents
12 also working there can see it, issue or not;
13- Claude starts each session knowing the issue it is on: its definition of
14 done, who has claimed it, its pull requests and what blocks it;
15- Claude has g1t's [MCP tools](/reference/mcp/), three skills for working
16 on issues, and the commands `/g1t:claim`, `/g1t:status` and
17 `/g1t:handoff`.
18
19Your session runs where it always does. g1t keeps the record and the
20coordination; nothing about how Claude Code runs changes.
21
22## Install
23
24You need Claude Code, the [g1t CLI](/guides/cli/) 0.3.2 or later, which
25the plugin's hooks use, and Node 18 or later on your `PATH`, which runs
26them. Claude Code's native installer does not bring Node with it: run
27`node --version` to check, and install it from
28[nodejs.org](https://nodejs.org) if it is missing or older.
29
301. Install the g1t CLI and sign in, if you have not:
31
32 ```sh
33 curl -fsSL https://g1t.sh/install | sh
34 g1t auth login
35 ```
36
37 On Windows, `irm https://g1t.sh/install.ps1 | iex` installs it.
38
392. Add g1t's plugin marketplace and install the plugin:
40
41 ```sh
42 claude plugin marketplace add https://g1t.sh/flagon-io/g1t.git
43 claude plugin install g1t@g1t
44 ```
45
46 Or run `/plugin` inside Claude Code and choose the marketplace there.
47
483. Start Claude Code again, run `/mcp` and choose **plugin:g1t:g1t** to
49 sign g1t's MCP server in through your browser.
50
51The plugin adds g1t's MCP server itself. If you added it before with
52`claude mcp add … g1t https://mcp.g1t.sh`, remove that one
53(`claude mcp remove g1t`), or Claude sees every g1t tool twice.
54
55`curl -fsSL https://g1t.sh/install/claude.sh | sh` prints the same
56commands; add `-s -- --cli` to have it install the CLI too.
57
58The plugin works in any working copy whose git remote is on g1t.sh, or on
59the host in `G1T_HOST` for a self-hosted g1t. Everywhere else its hooks do
60nothing.
61
62## What it records
63
64The plugin's hooks call the `g1t` CLI, signed in as you, so a session is
65recorded as yours and is as visible as the repository it is in.
66
67| When | The hook runs | What g1t receives |
68| --- | --- | --- |
69| A session starts or resumes | `g1t session start --harness claude_code --harness-session-id ID` | A session for this Claude Code session. Starting the same session again, as a resume does, finds it rather than making another. |
70| You send a prompt | `g1t session log --kind prompt TEXT` | Your prompt's first 2,000 characters. |
71| You send the session's first prompt that is not a slash command | `g1t session heartbeat --json`, then, if the session has no title, `g1t session attach --title INTENT` | Its title: what the prompt is for, as its first line or sentence without code blocks or markdown, up to 80 characters, cut on a word with `…`. A title the session already has (one Claude, you or an earlier prompt set) is never replaced. Not sent with prompts kept back. |
72| Claude uses a tool | `g1t session log --kind tool_call TEXT` | The tool's name and one line on what it was called with: the command, file, pattern or address, up to 200 characters, with anything that looks like a token or password replaced by `…`. |
73| Claude uses a skill, or you run one (`/g1t:work-on-issue 42`) | `g1t session log --kind skill NAME` | The skill's name, nothing more, once in a turn. A plugin's skill or command you type as `/plugin:name` is recorded even with prompts kept back. |
74| Claude writes a file, makes a branch or a commit, or claims an issue | `g1t session touch --file PATH` (or `--branch`, `--commit`, `--issue`) | What it touched: the path from the repository's root, the branch, the commit, the issue. g1t ties the session to the pull requests and issues these lead to, and tells two sessions that touch the same file. |
75| A `git push` reaches the remote | `g1t api update_session -f id=ID -f head_commit=SHA` and `g1t session touch --commit SHA --branch BRANCH` | The commit you pushed and its branch, so the session's entries line up with the code and it is tied to the branch's pull request. |
76| Claude starts a subagent | `g1t session start --parent SESSION --agent-type TYPE --task TASK --prompt PROMPT` | A session of its own for the subagent, under this one, with its kind and the task it was given (its prompt's first 4,000 characters). See [Subagents](#subagents). |
77| A subagent finishes | `g1t session end --result MESSAGE` | Its final message, up to 8,000 characters: what it reported to Claude. |
78| Claude finishes a turn | `g1t session heartbeat` | That the session is still active, which also renews its claims. |
79| The session ends | `g1t session end --reason REASON` | That it ended, and why: you exited, cleared it or logged out. |
80
81It never records:
82
83- what a tool returned: command output, file contents, search results and
84 web pages are never sent (an Agent call's answer is the one thing read,
85 for its subagent's final message and id), nor the turns Claude Code
86 starts itself to hand Claude a background task's output;
87- Claude's replies or reasoning;
88- your files, environment or transcript.
89
90A session that stops sending heartbeats reads as idle after 15 minutes and
91ended after two hours, so a closed laptop does not leave work looking
92claimed.
93
94The hooks return at once: the CLI calls run in a background process, so a
95slow network never holds Claude up.
96
97Shell commands are read the same way from the Bash tool and, on Windows,
98the PowerShell tool: a `git commit`, a `git push`, a branch made or a
99`g1t work claim` in either is recorded.
100
101Once the session has started, the plugin sets `G1T_SESSION` for the
102commands Claude runs (through Claude Code's session environment), so
103Claude's own `g1t` commands act in this session even when another session
104works in the same working copy. A command run before the session's id
105arrives, in its first second, uses the working copy's session.
106
107## The context Claude starts with
108
109When a session starts, the plugin looks for the issue it is working on:
110the one the session claimed earlier, or a number in the branch's name
111(`42-fix-login`, `issue-42`, `fix/42`). If it finds one, it runs
112`g1t work context N` and gives Claude the answer: the issue and its
113definition of done, its claims and sessions, its pull requests with their
114checks and overlaps, what blocks it and what it blocks, the decisions
115recorded on it and the last integration failure. If the answer takes longer
116than a second, Claude is told to load it itself.
117
118With no issue in sight, Claude is told that the session is already
119recorded on g1t and shows to the team with what it is for, so it can just
120work; see [Work with no issue yet](#work-with-no-issue-yet).
121
122Claude is also told to put the trailer `G1t-Session: $G1T_SESSION` on the
123commits it makes, so g1t ties them, and the pull request they land in, to
124the session.
125
126A session started from a hand-off (**Start a session** without an
127Anthropic connection, or `g1t work dispatch N --handoff`) runs as
128`G1T_ISSUE=N claude '…'`: the plugin attaches it to issue N as it starts.
129
130## Work with no issue yet
131
132Most sessions start from a question or a request, not an issue, and most
133never need one. The session is the record of that work:
134
1351. **It is titled with what it is for.** At the session's first prompt
136 that is not a slash command (`/clear` and `/g1t:status` are not), the
137 plugin gives the session a title from it, unless it has one. To name
138 it yourself, or have Claude name it, run
139 `g1t session attach --title "Fix the preview builds"`; that replaces
140 the title the prompt gave.
1412. **It shows to the team.** The project's overview and its **Work** page
142 list it in **Live now** under its pull request, else its branch, else
143 under **No branch yet**, with who it is for, Claude Code, its state,
144 when it was last heard from and its branch.
1453. **It gets an issue when it becomes a change** others should know about:
146 a branch to push, a pull request. Claude is told to look for an issue
147 first (`g1t work list`, `g1t issue list`) and claim it with
148 `g1t work claim N`, and if there is none, to open one and claim it in
149 one step:
150
151 ```sh
152 g1t work claim --title "Preview builds time out on large repositories"
153 ```
154
155 The issue is opened, claimed for this session, and the session is
156 attached to it, so **Live now** lists it under the issue from then on.
157 Claude is told never to open issues for questions, exploration or
158 trivial fixes. `/g1t:claim` with a title instead of a number does the
159 same.
160
161## Subagents
162
163Each subagent Claude Code starts is recorded as a session of its own,
164under the session that started it, so if Claude hands parts of an issue to
165twelve subagents, g1t shows twelve sessions and they see each other.
166
167- **When it starts** (`SubagentStart`), the plugin starts its session with
168 the parent's session as `--parent`, its kind (`Explore`, your own
169 subagents' names) and the task Claude gave it: the description and
170 prompt of the Agent call, kept from the moment Claude made it
171 (`PreToolUse`). The subagent is told it has a session of its own, to
172 look at its siblings with `g1t session list --issue N --subagents`
173 before changing anything, and to claim only what it takes.
174- **While it works**, what it does is recorded in its own session, not its
175 parent's: its tool calls, the skills it uses and the files it touches.
176 Its `g1t` commands and g1t MCP claims act as its own session: the
177 plugin sets `G1T_SESSION` for its shell commands and `session_id` for
178 its claims. Each subagent's claim is its own, so siblings see each
179 other's, and when two touch the same file both are told
180 (`overlap.detected`).
181
182 A subagent shares its parent's shell environment, so the plugin sets
183 its session on each of its commands that runs `g1t` or names
184 `G1T_SESSION`, as Claude Code lets a `PreToolUse` hook do: the command
185 runs with `export G1T_SESSION=ses_…;` before it in Bash, or
186 `$env:G1T_SESSION='ses_…';` in PowerShell. The plugin makes no
187 permission decision: Claude Code checks your permission rules against
188 the command as it runs, with that prefix, so a rule such as
189 `Bash(g1t work claim:*)` may no longer match it and Claude Code asks
190 instead. Other commands are left as Claude wrote them, and the session
191 records each command as Claude wrote it.
192- **When it finishes** (`SubagentStop`), its session ends with its final
193 message as its result. A background subagent's, or a late hook's, order
194 does not matter: starting a subagent again finds the same session, and
195 an ended one stays ended.
196
197Subagents use g1t's MCP tools as Claude does: Claude Code gives a
198subagent the MCP servers of the session that started it, including the
199plugin's g1t server, unless the subagent's own definition leaves them
200out.
201
202## Skills
203
204Claude uses a skill when the task matches it, or you can run one by name.
205
206| Skill | What it does |
207| --- | --- |
208| `/g1t:work-on-issue N` | Loads the issue's context, claims it, makes a branch named for it, opens a draft pull request early with `g1t pr create --issue N --draft`, does the work, watches the checks and merges, or adds the pull request to the [merge queue](/guides/merge-queue/). |
209| `/g1t:fix-integration N` | For a pull request the merge queue failed together with others: reads the `integration.failed` event and the failing check, compares the other pull requests in the combination, fixes, pushes and queues it again. |
210| `/g1t:coordinate N` | Follows the issue's events in the background with `g1t work events --follow --issue N`, and acts on another claim, an overlapping pull request, a change to what blocks it or an integration result as it happens. |
211
212## Commands
213
214| Command | What it does |
215| --- | --- |
216| `/g1t:claim N [note]` | Loads issue N's context and claims it for this session, telling you who else holds a claim. With a title instead of a number (or nothing), looks for an issue that covers the work in hand, and opens and claims one with `g1t work claim --title` if there is none. |
217| `/g1t:status` | This session (its title, issue, branch or pull request), and the repository's active claims and sessions. |
218| `/g1t:handoff N [@login]` | Pushes what is unpushed, writes a hand-off note and hands the issue off, to anyone or to one person. |
219
220A claim says you are working on an issue. It is never a lock: a second
221claim is allowed, and whoever makes it is told about the first.
222
223## When the CLI is missing, signed out or out of date
224
225If `g1t` is not installed, not signed in, or older than 0.3.2 (the oldest
226that takes every command the hooks run), the hooks record nothing and
227Claude Code says so once. The plugin never installs anything itself.
228Install the CLI or run `g1t auth login`, and the next session is recorded.
229
230To update the CLI, run its installer again:
231
232```sh
233curl -fsSL https://g1t.sh/install | sh
234```
235
236On Windows, `irm https://g1t.sh/install.ps1 | iex`. `g1t --version` says
237which you have. A CLI that refuses a command the hooks send is taken as
238out of date, and said the same way.
239
240The hooks run on Node. Without Node 18 or later they record nothing:
241with an older Node, Claude Code says so once; with no `node` on your
242`PATH` at all, Claude Code shows each hook's failure (`node: command not
243found`) as a hook error. Install Node, or turn the plugin off until you
244do.
245
246## Opt out
247
248| To | Do |
249| --- | --- |
250| Not send prompts | Set `G1T_RECORD_PROMPTS=0` in the environment Claude Code runs in. |
251| Not record anything | Set `G1T_RECORD=0`. |
252| Turn the plugin off for now | `claude plugin disable g1t@g1t` |
253| Remove it | `claude plugin uninstall g1t@g1t` |
254
255To set one of these for every session, put it under `env` in Claude Code's
256settings, for example in `~/.claude/settings.json`:
257
258```json
259{ "env": { "G1T_RECORD_PROMPTS": "0" } }
260```
261
262A recorded session can be read on its own page, linked from the issue, the
263pull request's **Session** tab and the repository's **Work** page: who ran
264it, its subagents as a tree, the skills used, what it touched, and the
265issues and pull requests it worked on.
266
267## The earlier hook installer
268
269An earlier `curl -fsSL https://g1t.sh/install/claude.sh | sh` added a hook
270of its own, `node ~/.g1t/hook.mjs`, to `~/.claude/settings.json`. The
271plugin replaces it. Once the plugin is installed, remove those entries from
272`~/.claude/settings.json` so a session is not recorded twice. Running the
273installer again brings the old hook up to date and prints the plugin's
274commands.
275
276## Other coding agents
277
278Agents without plugins use the same CLI commands from their instructions
279file. Put this in the repository's `AGENTS.md`:
280
281```md title="AGENTS.md"
282## Working on g1t
283
284This repository is on g1t. Other agents and people may be working in it at
285the same time; the `g1t` CLI is how you see them and how they see you.
286
287- When you start, record a session titled with what you were asked to do:
288 `g1t session start --harness codex --title "Fix the preview builds"`
289 (or `cursor`, `copilot`, `other`: the harness you are). The CLI remembers
290 it for this working copy. Run `g1t session heartbeat` every few minutes
291 while you work, and `g1t session end` when you stop.
292- With no issue, just work: the session shows to the team. When the work
293 becomes a change others should know about (a branch to push, a pull
294 request), look for its issue (`g1t work list`, `g1t issue list`) and
295 claim it; if there is none, open and claim one with
296 `g1t work claim --title "TITLE"`. Never open issues for questions,
297 exploration or trivial fixes.
298- Before working on an issue, load it with `g1t work context N`: its
299 definition of done, who has claimed it, its pull requests, checks and
300 overlaps, and what blocks it. Then claim it with
301 `g1t work claim N --note "what you are about to do"`. If someone else
302 holds a claim, say so before going on.
303- Work on a branch whose name starts with the issue number
304 (`42-short-description`), and open a draft pull request early:
305 `g1t pr create --issue N --draft --fill`.
306- Log decisions worth keeping with `g1t session log --kind note "TEXT"`.
307 Never log secrets or command output.
308- Run the repository's tests before each push, and watch the checks with
309 `g1t pr checks --watch --fail-fast` (and `g1t run logs --failed` for why
310 one failed). When the merge queue reports an integration failure, read
311 it with `g1t work events --type integration.failed --issue N`, diff the
312 other pull requests in the combination (`g1t pr diff OTHER`), fix, push
313 and merge again.
314- If you stop before the issue is done, hand it off:
315 `g1t work handoff N --note "what is done, what is left"`.
316```
317
318The same text is in the g1t repository at
319`plugins/other-harnesses/AGENTS.snippet.md`.
320
321To give Codex g1t's MCP tools as well:
322
323```sh
324codex mcp add g1t --url https://mcp.g1t.sh
325codex mcp login g1t
326```
327
328or, in `~/.codex/config.toml`, with a token in `G1T_TOKEN` instead of
329signing in through the browser:
330
331```toml
332[mcp_servers.g1t]
333url = "https://mcp.g1t.sh"
334bearer_token_env_var = "G1T_TOKEN"
335```
336
337[Connect a coding agent](/guides/bring-your-own-agent/) covers Cursor,
338OpenCode and other MCP clients.