| 1 | --- |
| 2 | title: Sessions, claims and dependencies |
| 3 | description: How agents and people on one repository see who is working on what, with sessions of their own harnesses, advisory claims on work items, what a work item is blocked by, and the one call that loads a work item's whole context. |
| 4 | --- |
| 5 | |
| 6 | When several agents and people work on one repository at once, each needs |
| 7 | to know what the others are doing. g1t keeps that around the |
| 8 | [work item](/guides/work-items/), which is the unit of work: its |
| 9 | description says what is wanted and what done means, its pull requests are |
| 10 | the proposals, and around it g1t records: |
| 11 | |
| 12 | - **Sessions**: one run of your own harness (a Claude Code session, a |
| 13 | Codex run) on the repository, attached to the work item and pull request |
| 14 | it works on. A session is recorded in the repository it is checked out |
| 15 | in; its work item is the workspace's. |
| 16 | - **Claims**: an advisory, expiring "I'm working on #12". Never a lock. |
| 17 | - **Dependencies**: the work items that have to land before this one. |
| 18 | |
| 19 | Until there is a work item, the session is the unit: work that starts from |
| 20 | a question or a quick request is recorded as a session titled with what it |
| 21 | is for, and shows to the team on its branch or pull request. It opens or |
| 22 | claims a work item only when it becomes a change others should know about; |
| 23 | see [Work with no work item yet](#work-with-no-work-item-yet). |
| 24 | |
| 25 | Nothing here waits on a harness. A harness that crashes, loses its |
| 26 | network or sends the same thing twice does no harm: sessions and claims |
| 27 | that go quiet are read as idle, ended or expired the next time anyone |
| 28 | looks, and starting a session or recording an entry again is a no-op. |
| 29 | What git and g1t record (commits, pull requests, checks, merges) is the |
| 30 | truth; sessions are the account of how it got there. |
| 31 | |
| 32 | ## On the site |
| 33 | |
| 34 | Everything here shows on g1t.sh as it happens, without reloading. |
| 35 | |
| 36 | - **The Sessions page**, `g1t.sh/<owner>/<repo>/sessions`, a tab beside |
| 37 | **Pull requests** and **Merge queue** (it used to be the repository's |
| 38 | **Work** page, and the old address redirects here): |
| 39 | - **Live now**: the active claims and the active and idle sessions, |
| 40 | grouped by the work item they are on, the most recently active first. |
| 41 | A work item with more than one claim is marked. Sessions on no work |
| 42 | item yet follow, grouped by their pull request, else by their branch (when it |
| 43 | is not the default branch), the most recently heard from first; those |
| 44 | on neither are last, under **No branch yet**. Each session shows its |
| 45 | title, who it acts for, its harness, its state, when it was last heard |
| 46 | from and its branch. A session with no title is named by what its |
| 47 | first prompt was for, else **Session on** its branch, else **Untitled |
| 48 | session**. A title that is only a tag, such as |
| 49 | `<pasted_content id="5c50">`, counts as no title. |
| 50 | - **Merge queue**: what is waiting to land and what is being tested, |
| 51 | as on the [Merge queue](/guides/merge-queue/#the-merge-queue-page) page. |
| 52 | - **What happened**: the latest 30 coordination events, from claims to |
| 53 | what the merge queue found when it combined changes. |
| 54 | - **Just landed**: the latest merges, each with a link to the session |
| 55 | behind it. |
| 56 | - **Recorded on pull requests**: the latest sessions recorded on its pull |
| 57 | requests, each opening that pull request's session. |
| 58 | |
| 59 | With nothing going on, choose your client in the |
| 60 | [connection instructions](/guides/bring-your-own-agent/), or run |
| 61 | `g1t work claim <number>` from any harness. |
| 62 | - **A work item's Work panel**, at the top of its sidebar: its claims |
| 63 | (who, from which harness, since when and when each lapses; ones |
| 64 | released, expired or handed off lately are shown dimmed), the sessions on |
| 65 | it with their state and when each was last heard from, what |
| 66 | it is blocked by and where each of those stands, and the work items it |
| 67 | blocks. Its author and anyone with the Triage role change what it is |
| 68 | blocked by with **Edit**. Under its pull requests, the work item shows |
| 69 | the latest combination that failed in the merge queue, and its |
| 70 | [decision records](/guides/why-blame/#decision-records), each marked |
| 71 | **Claimed**, **Tested** or **Approved**. |
| 72 | - **A session's page**, `g1t.sh/<owner>/<repo>/sessions/<id>` (the |
| 73 | `ses_…` id; a pull request's number there goes to that pull request's |
| 74 | recorded session, `…/pull/<number>/session`), opened from any of these: who ran it, in which harness and on which |
| 75 | model, how long it has run, the work items and pull requests it and its |
| 76 | subagents worked on (each says how it was tied), its subagents as a tree |
| 77 | you open one at a time (each with its kind, the task it was given, what |
| 78 | it touched and what it reported), the skills used, what was touched |
| 79 | (files, commits, branches, pull requests), and everything it recorded, |
| 80 | as it records it: its prompt folded, its messages formatted as they were |
| 81 | written, and the tool calls between them a line each (a command as code, |
| 82 | a file by its path, a g1t tool by what it did, such as *work item · claim*), |
| 83 | more than three in a row folded into one line that opens to them; a |
| 84 | long command and what a tool gave back open under its line. A |
| 85 | subagent's own page links back to the session that started it. |
| 86 | - **A work item's and a pull request's sessions**: every session tied to |
| 87 | it in any way, in any of the workspace's repositories, with its |
| 88 | subagents under it. |
| 89 | - **Start a session** on a work item, for members of a workspace with an |
| 90 | Anthropic AI provider: see |
| 91 | [Start a session on your Anthropic account](#start-a-session-on-your-anthropic-account). |
| 92 | |
| 93 | ## Picking up a work item |
| 94 | |
| 95 | Before working on a work item, load its whole context in one call: |
| 96 | `work_item` with `"action": "work"` over MCP, `g1t work view 12`, or |
| 97 | [`GET /workspaces/{workspace}/work/{number}/work`](/reference/api/work-items/get-work/): |
| 98 | |
| 99 | ```sh |
| 100 | curl https://api.g1t.sh/workspaces/acme/work/12/work \ |
| 101 | -H "Authorization: Bearer $G1T_TOKEN" |
| 102 | ``` |
| 103 | |
| 104 | | Field | What it holds | |
| 105 | | --- | --- | |
| 106 | | `item` | The work item, with its body and its repositories: each with its role and whether it has landed. | |
| 107 | | `missing` | Its targets that have not landed yet. | |
| 108 | | `suggested` | Repositories of the workspace it may also need, each with `why`. | |
| 109 | | `definition_of_done` | The items under its **Definition of done** heading. | |
| 110 | | `required_checks` | The checks every pull request into the default branch must pass. | |
| 111 | | `claims` | Who says they are working on it now. | |
| 112 | | `sessions` | Sessions on it or its pull requests, or tied to it any other way, subagents included, active ones first. Each says how many `subagents` it started. | |
| 113 | | `pulls` | Its pull requests, in every repository it links. Those still open or draft carry their `required_checks` as they stand on the head, `mergeable`, the other pull requests they `overlap`, and their place in the merge `queue`. | |
| 114 | | `blocked_by` | Each work item it waits on, with that work item's claims and pull requests. | |
| 115 | | `blocks` | The work items waiting on it. | |
| 116 | | `decisions` | [Decision records](/guides/why-blame/#decision-records) on it and its pull requests, newest first. | |
| 117 | | `last_integration_failure` | The latest `integration_failure` decision among them, if any: the combination that failed in the merge queue, the check, the `suspects` and, when it failed on `main` alone, the pull requests that `landed` on `main` since it branched. | |
| 118 | | `recent` | Its latest 20 coordination events, newest first. | |
| 119 | |
| 120 | Then claim it, and start (or attach) your session. |
| 121 | |
| 122 | ## Sessions |
| 123 | |
| 124 | A session is one run of your harness on a repository. Start one when the |
| 125 | harness starts, keep it alive while it works, and end it when it stops. |
| 126 | |
| 127 | 1. **Start** it with `session` `start`, or |
| 128 | [`POST /repos/{owner}/{name}/sessions`](/reference/api/sessions/start-session/), |
| 129 | naming the `harness` (`claude_code`, `claude_managed_agents`, `codex`, |
| 130 | `cursor`, `copilot` or `other`) and the harness's own id for the session as |
| 131 | `harness_session_id`. Starting again with the same id returns the |
| 132 | session already started, so a hook can call it every time without |
| 133 | checking first. Give `item` (the work item's number in the |
| 134 | repository's workspace), `pull` and `branch` when you know them, and a |
| 135 | `title`: what the session is for, in a few words (up to 200 |
| 136 | characters). |
| 137 | 2. **Heartbeat** with `session` `update`, or |
| 138 | [`PATCH /repos/{owner}/{name}/sessions/{id}`](/reference/api/sessions/update-session/) |
| 139 | with an empty body. The same call attaches the session to a work item |
| 140 | or pull request, records the `head_commit` it pushed, or changes its |
| 141 | `title`. |
| 142 | 3. **Record** what happens with `session` `record`, or |
| 143 | [`POST /repos/{owner}/{name}/sessions/{id}/entries`](/reference/api/sessions/record-session-entries/): |
| 144 | prompts, reasoning, tool calls, notes and the skills it used (`skill`, |
| 145 | the skill's name only), up to 200 a request, and in `touched` what it |
| 146 | touched (see [What a session worked on](#what-a-session-worked-on)). |
| 147 | Give each entry a `key`, and recording it again does nothing. |
| 148 | 4. **End** it with `session` `end`, or |
| 149 | [`POST /repos/{owner}/{name}/sessions/{id}/end`](/reference/api/sessions/end-session/), |
| 150 | with its `result` when it has one: what it reported when it finished. |
| 151 | |
| 152 | ```sh |
| 153 | curl -X POST https://api.g1t.sh/repos/acme/web/sessions \ |
| 154 | -H "Authorization: Bearer $G1T_TOKEN" \ |
| 155 | -H "Content-Type: application/json" \ |
| 156 | -d '{"harness": "claude_code", "harness_session_id": "5b0c1f9e-3d2a-4e8b-9f61-0c7d2a9e4b13", "item": 12}' |
| 157 | ``` |
| 158 | |
| 159 | A session's `state` is worked out from when it was last heard from. Every |
| 160 | update and every batch of entries counts as a heartbeat: |
| 161 | |
| 162 | | State | Means | |
| 163 | | --- | --- | |
| 164 | | `active` | Heard from in the last 15 minutes. | |
| 165 | | `idle` | Not heard from for 15 minutes. It may still come back. | |
| 166 | | `ended` | Ended with `end_session`, or not heard from for 30 minutes (`end_reason` `timed_out`). A heartbeat brings a timed-out session back; an ended one stays ended. | |
| 167 | |
| 168 | A session its harness left behind, killed or never told to end, can be |
| 169 | ended by hand: **End session** in its menu under Live now (on the |
| 170 | project's overview and the Sessions page), or on its page. Whoever runs a |
| 171 | session can end it, and so can anyone with write access to the |
| 172 | repository; nobody else sees the action. It ends with `end_reason` |
| 173 | `ended by hand by @name`, its subagents still going end with it, and its |
| 174 | claims stay until they are released or expire. Ending by hand is a |
| 175 | soft close: like a session that timed out, it comes back the moment |
| 176 | its harness is heard from again (an update, a recorded entry or a |
| 177 | start), so a harness that was in fact still running picks up where it |
| 178 | was. Through the API, |
| 179 | `end_session` on someone else's session does the same, without their |
| 180 | `reason` or `result`. A session g1t runs on the workspace's Anthropic |
| 181 | account is stopped from its page instead. |
| 182 | |
| 183 | Entries of a session attached to a pull request show in that pull |
| 184 | request's [session](/guides/why-blame/#sessions), beside what was recorded |
| 185 | on it with `record_session`, so reviewers and why-blame see them. Entries |
| 186 | recorded before the session named its pull request move onto it when it |
| 187 | does. A session never records tool output unless you send it as a |
| 188 | `tool_result` entry. What looks like a credential is taken out of |
| 189 | everything a session records, and only the workspace's members see inside |
| 190 | a session: see [Who sees what](#who-sees-what). |
| 191 | |
| 192 | List a repository's sessions with `session` `list`, or |
| 193 | [`GET /repos/{owner}/{name}/sessions`](/reference/api/sessions/list-sessions/) |
| 194 | by `state`, `item` or `pull` (any session tied to it), or `path` (those |
| 195 | that touched a file, or any under a folder ending in `/`); subagents are |
| 196 | listed too with `subagents=true`. A session in the list with no `title` |
| 197 | carries `first_prompt`: the first 300 characters of the first prompt it |
| 198 | recorded. Read one with its entries, subagents, links, skills and what it |
| 199 | touched with `session` `get`. |
| 200 | |
| 201 | ## Work with no work item yet |
| 202 | |
| 203 | Not every session starts from a work item, and most should not end with |
| 204 | one: a question, a look around or a quick fix needs no work item. The |
| 205 | session is the record of that work, and the team sees it in **Live now** |
| 206 | while it goes: |
| 207 | |
| 208 | 1. **It says what it is for.** Give it a `title` when you start it, or |
| 209 | later with `session` `update`. The |
| 210 | [Claude Code plugin](/guides/claude-code-plugin/#work-with-no-work-item-yet) |
| 211 | titles each session from its first prompt that says what it is for, |
| 212 | from the words you typed: pasted text and image placeholders are left |
| 213 | out, and a slash command or a prompt that is only a paste leaves the |
| 214 | title to the next prompt. It never replaces a title the session |
| 215 | already has. |
| 216 | 2. **It shows where it works.** Attach its `branch` and, once there is |
| 217 | one, its `pull`: **Live now** groups sessions on no work item by pull |
| 218 | request, then by branch. |
| 219 | 3. **It opens or claims a work item when it becomes a change** others |
| 220 | should know about: a branch to push, a pull request. Look for one first |
| 221 | (`work_item` `list`, `work_item` `list_claims`); if one covers the work, |
| 222 | claim it. Otherwise open one and claim it in one step with `work_item` |
| 223 | `claim` and a `title` instead of a `number` (see [Claims](#claims)), |
| 224 | which attaches the session to it. |
| 225 | |
| 226 | ## Subagents |
| 227 | |
| 228 | A harness that hands part of its work to a subagent (Claude Code's |
| 229 | subagents, a Managed Agents session's threads) records each as a session |
| 230 | of its own under the one that started it: |
| 231 | |
| 232 | - Start it with `parent_id` (the session that started it), `agent_type` |
| 233 | (its kind, such as `Explore`), the `task` it was given in a few words and |
| 234 | the `prompt` (kept up to 4,000 characters). As its `harness_session_id`, |
| 235 | give the parent's, `/agent/` and the subagent's id: starting it again |
| 236 | returns it, in whatever order the harness's hooks arrive. |
| 237 | - It starts on its parent's work item, pull request and branch unless it says |
| 238 | otherwise, so it is listed on them, and its heartbeats keep its parent |
| 239 | active. |
| 240 | - End it with its `result`: its final message, kept up to 8,000 |
| 241 | characters. That is its parent's evidence; what its tools returned is |
| 242 | never recorded. Once ended it stays ended, even when a late hook starts |
| 243 | it again: that only fills in what it says. |
| 244 | - Ending a session ends the subagents it left going (`end_reason` |
| 245 | `parent ended`). |
| 246 | |
| 247 | Subagents see each other. Sibling subagents on one work item are listed in |
| 248 | `get_work` and `session` `list` beside the session that started them, |
| 249 | each holds a claim of its own (claims are told apart by session, so a |
| 250 | sibling's claim is listed in `others`), and when two of them touch the |
| 251 | same file, each is told with `overlap.detected`. The |
| 252 | [Claude Code plugin](/guides/claude-code-plugin/#subagents) does all of |
| 253 | this for Claude Code's subagents. |
| 254 | |
| 255 | ## What a session worked on |
| 256 | |
| 257 | A session says what it touched in `touched`, each kept once: |
| 258 | |
| 259 | | `kind` | `value` | |
| 260 | | --- | --- | |
| 261 | | `file` | A file it wrote, from the repository's root. | |
| 262 | | `commit` | A commit it made. | |
| 263 | | `branch` | A branch it made or pushed. | |
| 264 | | `pull` | A pull request it opened, by number. | |
| 265 | | `item` | A work item it named or claimed, by its number in the workspace. | |
| 266 | |
| 267 | From these and the rest of what it records, g1t ties the session to the |
| 268 | work items and pull requests it worked on, each in as many ways as it was |
| 269 | (`via` in the session's `links`): |
| 270 | |
| 271 | | `via` | When | |
| 272 | | --- | --- | |
| 273 | | `attached` | It said it is on it, starting or updating. | |
| 274 | | `claim` | It claimed the work item. | |
| 275 | | `opened` | It opened the pull request. | |
| 276 | | `branch` | It pushed the pull request's branch, also when the pull request is opened later. | |
| 277 | | `commit` | It made the pull request's head commit. | |
| 278 | | `trailer` | A commit pushed to the pull request's branch names it in a `G1t-Session: ses_…` trailer. | |
| 279 | | `ref` | Its prompt, its task, its result or a subagent's names it as `#12`. | |
| 280 | |
| 281 | A session's links cover its subagents too, and the work item and pull |
| 282 | request pages list every session tied to them with its subagents. Put the |
| 283 | trailer on the commits a session makes (`git commit --trailer "G1t-Session: |
| 284 | $G1T_SESSION"`) and they lead back to it. A work item a session closes, or |
| 285 | a repository it lands on one, says so on its timeline, **via session** and |
| 286 | a link to it: closed with the session's token while it works on the work |
| 287 | item, or by a commit naming it in that trailer (see |
| 288 | [Closing work items](/guides/pull-requests/#closing-work-items)). |
| 289 | |
| 290 | When a file a session touched was touched by another active session as |
| 291 | well (outside its own parents and subagents), g1t sends `overlap.detected` |
| 292 | to both, naming each other and the files: once per pair, and again when |
| 293 | they touch another file in common, naming the new files. |
| 294 | |
| 295 | ## Start a session on your Anthropic account |
| 296 | |
| 297 | g1t runs no model. Work on a work item happens in your own harness, with |
| 298 | your own Claude, its skills and settings; g1t ties it back to the work |
| 299 | item. To hand a work item to a session from g1t itself (the work item |
| 300 | page's **Start a session**, `g1t work dispatch`, the `session` tool's |
| 301 | `dispatch`, or |
| 302 | [`POST /repos/{owner}/{name}/agent-sessions`](/reference/api/sessions/start-agent-session/), |
| 303 | in the repository the session works in): |
| 304 | |
| 305 | ```sh |
| 306 | curl -X POST https://api.g1t.sh/repos/acme/web/agent-sessions \ |
| 307 | -H "Authorization: Bearer $G1T_TOKEN" \ |
| 308 | -H "Content-Type: application/json" \ |
| 309 | -d '{"item": 12, "mode": "implement", "instruction": "Keep the old greeting behind a flag."}' |
| 310 | ``` |
| 311 | |
| 312 | Give `item`, or `title` and `body` to open a new work item first (with |
| 313 | the repository as its origin), a `mode` |
| 314 | (`plan`, `implement` or `review`) and an optional `instruction`. |
| 315 | |
| 316 | - **With an Anthropic AI provider** in the workspace (an owner adds one |
| 317 | under [**AI**](/guides/ai/)), g1t starts a |
| 318 | [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) |
| 319 | session on that account, with its key, on the model Ask is set to use |
| 320 | (or `claude-opus-5-5`). It runs in a sandbox on Anthropic's side. Its |
| 321 | first step installs the [g1t CLI](/guides/cli/) from g1t, sets git up to |
| 322 | send the token and to commit as you (your username and noreply address), |
| 323 | clones the repository and ties the clone to the session, |
| 324 | so it works the way the work-on-item skill describes: `g1t work |
| 325 | view`, `g1t work claim`, `g1t pr create --item`, `g1t pr checks --watch`. |
| 326 | It works on a branch and a pull request, except in a repository with no |
| 327 | commits yet, where there is nothing to open one against: it pushes the |
| 328 | first version straight to the default branch. To show a screenshot of its |
| 329 | preview in the pull request or a comment, it uploads the image with |
| 330 | [`g1t attach`](/guides/cli/#images-in-descriptions-and-comments) (or |
| 331 | `--attach` on `g1t pr create`, `g1t pr ready` and `g1t pr comment`) and |
| 332 | pastes the Markdown it prints, rather than committing the image. |
| 333 | g1t's MCP server is attached too, for anything the CLI has no command |
| 334 | for. Its sandbox reaches the internet as a CI runner does, and it can |
| 335 | search and read the web (web search and web fetch), for a fact the work |
| 336 | needs from outside g1t or to open its own deploy. Before a headless |
| 337 | browser (Playwright, Puppeteer) opens an https page, it copies the |
| 338 | certificates the sandbox trusts into Chromium's own store, so pages load |
| 339 | with certificate checks on. Both reach g1t with one token: g1t |
| 340 | acting on your behalf, in that repository only, which lasts the session |
| 341 | and is revoked when it ends. What the session does on g1t shows as |
| 342 | **g1t, on behalf of @you**: its comments and reviews, what it closes or |
| 343 | labels, and the work items and pull requests it opens (g1t's, requested |
| 344 | by you); the audit log says "g1t on behalf of you". What it may do is |
| 345 | your role in that repository, never more than Write, with what working on |
| 346 | a work item needs (`repo:read`, `code:write`, `work:write`, |
| 347 | `pull_requests:write`, and reading checks, workflows, deployments and |
| 348 | observability): never settings, members, secrets, webhooks or merging. |
| 349 | The session itself, its claims and its commits stay yours, and its |
| 350 | pushes are yours too: to the repository and to its pull requests' |
| 351 | working copies, under the repository's rules. An approval it gives is |
| 352 | g1t's, so it counts toward required approvals only where agents' |
| 353 | approvals do. The token is kept in a vault on the Anthropic account: the MCP |
| 354 | server's credential, and `G1T_TOKEN`, which the sandbox holds only as a |
| 355 | placeholder that is swapped for the token on its way to g1t. It is never |
| 356 | in the prompt, and the model never sees it. The session has g1t's skills |
| 357 | (work-on-item, coordinate and fix-integration, uploaded to the account |
| 358 | the first time, and as a new version whenever g1t changes them; the |
| 359 | agent uses the version g1t uploaded) next to the account's own custom |
| 360 | skills, at their latest version, up to 20 in all. It may hand parts of the work to copies of itself; each is recorded |
| 361 | as a subagent. |
| 362 | - **Without one**, or with `handoff: true`, nothing starts: you get |
| 363 | `command`, a Claude Code command line to run in your working copy with |
| 364 | the [plugin](/guides/claude-code-plugin/), and `prompt`, what to paste. |
| 365 | The session that starts attaches to the work item. |
| 366 | |
| 367 | The answer has the `session` on g1t, its `session_url`, and |
| 368 | `provider_session_url`, where the Anthropic Console shows it. The Console |
| 369 | keeps sessions in the workspace the key belongs to, and a session does not |
| 370 | say which that is: if the key is not in the account's Default workspace, |
| 371 | set the provider's **Console workspace** under [**AI**](/guides/ai/#anthropic-console-workspace) |
| 372 | so the link opens there. |
| 373 | The session is recorded as harness `claude_managed_agents`: its messages, |
| 374 | the tools it called and with what (never what they returned), the skills |
| 375 | it read, what it touched, and each thread as a subagent with its task and |
| 376 | report. g1t follows it every minute, and at once while its page is open. A |
| 377 | call that waits for someone's approval is declined, since nobody is |
| 378 | watching. When it finishes, its session ends with its last message as its |
| 379 | result. Whoever started it can stop it from its page, and open it on the |
| 380 | Claude Console from there (**Open in Claude Console**); nobody else is |
| 381 | given that link, since the Console shows everything the session was asked |
| 382 | and every tool's output. It runs on your |
| 383 | workspace's key and Anthropic bills the account for it; g1t bills nothing. |
| 384 | |
| 385 | ## Assign g1t, or ask it in the thread |
| 386 | |
| 387 | You can also hand work to g1t from the work item or pull request itself, |
| 388 | the way you would ask a teammate: |
| 389 | |
| 390 | - **Assign the work item to `g1t`**: **Assign to g1t** in the work |
| 391 | item's sidebar, `g1t` among the assignees in |
| 392 | [`update_work_item`](/reference/api/work-items/update-work-item/), or |
| 393 | `g1t work edit 12 --add-assignee g1t`. |
| 394 | - **Mention `@g1t` in a comment** on a work item or a pull request: |
| 395 | "@g1t the button still overlaps on a phone, fix that". On a pull |
| 396 | request, the session carries on with that pull request on its branch. |
| 397 | On a work item, it takes the work item on. |
| 398 | |
| 399 | g1t reacts 👀 to what asked it, the comment or (for an assignment) the |
| 400 | work item, then starts a session on the workspace's Anthropic account, as |
| 401 | the person who asked, with what they wrote as its instruction. Each |
| 402 | session shows in the work item's or pull request's conversation as a card, |
| 403 | where it started, the way a comment or a review does: who it works for, |
| 404 | where it stands, its branch, and its report when it ends, linked to its |
| 405 | page. Not happy with what a session did? Say so with `@g1t` in the same |
| 406 | thread. The next session is told to fix the work on the same branch and |
| 407 | pull request, not start over, and `g1t work view` shows it every |
| 408 | session and pull request so far. If the session you started on that |
| 409 | thread is still going, your comment goes to it instead of starting |
| 410 | another. |
| 411 | |
| 412 | Only the workspace's members can ask g1t; anyone else's `@g1t` is an |
| 413 | ordinary mention. A mention in quoted text or code (`` `@g1t` ``) asks |
| 414 | nothing. g1t answers one thread at most six times an hour. When it cannot |
| 415 | start a session, for instance because the workspace has no Anthropic AI |
| 416 | provider, it says why in the thread. On an update pull request g1t opened, |
| 417 | `@g1t rebase` and the other |
| 418 | [comment commands](/guides/dependency-updates/#comment-commands) still do what |
| 419 | they say. |
| 420 | |
| 421 | ## Claims |
| 422 | |
| 423 | A claim says you are working on a work item. It is advisory: anyone may |
| 424 | claim a work item someone else has, and is told about them, so two agents |
| 425 | can decide between themselves rather than collide. Nothing is refused |
| 426 | because of a claim. A claim is the workspace's, whichever repository the |
| 427 | session that holds it is checked out in, so sessions in different |
| 428 | repositories see each other's claims on the same work item. |
| 429 | |
| 430 | - **Claim** an open work item with `work_item` `claim` (with |
| 431 | `session_id`, so that two of your sessions, such as sibling subagents, |
| 432 | hold claims of their own and each is told of the other's), |
| 433 | `g1t work claim 12`, or |
| 434 | [`POST /workspaces/{workspace}/work/{number}/claim`](/reference/api/work-items/claim-work-item/). |
| 435 | The answer has your `claim`, the `others` already on the work item, and |
| 436 | `blocked_by`: each work item this one waits on, with its claims and pull |
| 437 | requests. |
| 438 | - **Open a work item and claim it** in one step, for work that has no |
| 439 | work item yet: `work_item` `claim` with `title` (and `body`) and no |
| 440 | `number`, `g1t work claim --title "…"`, or |
| 441 | [`POST /workspaces/{workspace}/claims`](/reference/api/work-items/claim-new-work-item/). |
| 442 | The work item is opened (a `work_item.opened` event), with the |
| 443 | session's repository as its origin when you give `repo`, then claimed, |
| 444 | and the session named by `session_id` is attached to it. The answer |
| 445 | also has `item`, the work item opened. The session is checked first: a |
| 446 | claim that would be refused for it opens nothing. |
| 447 | - **Renew** it by claiming again, or give the `session_id` of your session |
| 448 | when you claim, and that session's heartbeats renew it. |
| 449 | - **Release** it with `work_item` `release`, `g1t work release 12`, or |
| 450 | [`POST /workspaces/{workspace}/work/{number}/release`](/reference/api/work-items/release-claim/), |
| 451 | with an optional `reason`. |
| 452 | - **Hand it off** with `work_item` `handoff`, `g1t work handoff 12`, or |
| 453 | [`POST /workspaces/{workspace}/work/{number}/handoff`](/reference/api/work-items/hand-off-work-item/), |
| 454 | with a `note` on where the work stands, for `to` (a username) or anyone. |
| 455 | When whoever it was for claims the work item, their `work.claimed` event |
| 456 | names the hand-off in `took_over`. |
| 457 | |
| 458 | ```sh |
| 459 | curl -X POST https://api.g1t.sh/workspaces/acme/work/12/claim \ |
| 460 | -H "Authorization: Bearer $G1T_TOKEN" \ |
| 461 | -H "Content-Type: application/json" \ |
| 462 | -d '{"session_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "note": "Taking the argument parsing first."}' |
| 463 | |
| 464 | curl -X POST https://api.g1t.sh/workspaces/acme/claims \ |
| 465 | -H "Authorization: Bearer $G1T_TOKEN" \ |
| 466 | -H "Content-Type: application/json" \ |
| 467 | -d '{"session_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "repo": "acme/web", "title": "Preview builds time out on large repositories"}' |
| 468 | ``` |
| 469 | |
| 470 | | | | |
| 471 | | --- | --- | |
| 472 | | How long a claim lasts | `ttl_minutes`: 30 unless you say, at most 240. | |
| 473 | | Opening its work item | `title` (and `body`) instead of `number`. Giving both is refused with `422`. | |
| 474 | | When it ends | Released, handed off, its work item closed, or not renewed in time (`expired`). | |
| 475 | | States | `active`, `released`, `expired`, `handed_off`. | |
| 476 | |
| 477 | See who is on what with `work_item` `list_claims`, `g1t work status`, or |
| 478 | [`GET /repos/{owner}/{name}/claims`](/reference/api/work-items/list-claims/): |
| 479 | active claims unless `state` says otherwise, and `item` for one work |
| 480 | item's. |
| 481 | |
| 482 | ## Dependencies |
| 483 | |
| 484 | A work item's `blocked_by` lists the work items of the same workspace that |
| 485 | have to land before it. Set it with `work_item` `update`, or |
| 486 | [`PATCH /workspaces/{workspace}/work/{number}`](/reference/api/work-items/update-work-item/), |
| 487 | which replaces the whole list: |
| 488 | |
| 489 | ```sh |
| 490 | curl -X PATCH https://api.g1t.sh/workspaces/acme/work/12 \ |
| 491 | -H "Authorization: Bearer $G1T_TOKEN" \ |
| 492 | -H "Content-Type: application/json" \ |
| 493 | -d '{"blocked_by": [9, 10]}' |
| 494 | ``` |
| 495 | |
| 496 | A list is refused with `422` when a number is not a work item of the |
| 497 | workspace, names the work item itself, or would make a cycle (the answer |
| 498 | shows the cycle, such as `#12 → #9 → #12`). Up to 50 work items. Changing |
| 499 | it notes the change in the work item's conversation and needs what |
| 500 | editing the work item does: being its author, or the Triage role. |
| 501 | |
| 502 | g1t says when a dependency moves, as a `dependency.changed` event on the |
| 503 | blocked work item: when its list changes, and when one of its blockers |
| 504 | closes or has a pull request merged into the default branch. `remaining` |
| 505 | lists the blockers still open; when it is empty, the work item is |
| 506 | unblocked. |
| 507 | |
| 508 | ## Overlaps |
| 509 | |
| 510 | Opening a pull request, and each push to it, works out which files it |
| 511 | changes. When it starts changing files another open or draft pull request |
| 512 | changes, g1t sends `overlap.detected` once for each of the two, naming the |
| 513 | other and the files. A pair is announced once, and again only after it stopped |
| 514 | overlapping. `get_work` and `pull_request` `get` show current overlaps |
| 515 | whenever you look. |
| 516 | |
| 517 | Sessions overlap too, before there is a pull request: when a session says |
| 518 | it touched a file that another active session touched (see |
| 519 | [What a session worked on](#what-a-session-worked-on)), each gets |
| 520 | `overlap.detected` with `session_id`, `other_session_id`, `other_actor` |
| 521 | and `files`, once per pair, and again with the new `files` when another |
| 522 | file in common joins. |
| 523 | |
| 524 | ## Events |
| 525 | |
| 526 | Coordination is published as events, which [webhooks](/guides/webhooks/) |
| 527 | deliver and the repository's timeline lists. Each carries `number` (the |
| 528 | work item or pull request it is about) and `item` (the work item's number |
| 529 | in the workspace) where there is one. |
| 530 | |
| 531 | | Event | When | |
| 532 | | --- | --- | |
| 533 | | `session.started` | A session (or a subagent) starts, or one that ended starts again. Not on a repeated start. | |
| 534 | | `session.ended` | A session ends, or times out after 30 minutes without a heartbeat. | |
| 535 | | `session.progressed` | A session recorded more: at most every 5 seconds for each, with `session_id` (and `root_id` for a subagent), never what it recorded. Pages showing the session follow it with this. | |
| 536 | | `work.claimed` | Someone claims a work item. `others` lists the claims already on it; `took_over` names a hand-off it takes. | |
| 537 | | `work.released` | A claim is released, or its work item closed (`reason` `item_closed`). | |
| 538 | | `work.claim_expired` | A claim was not renewed in time. | |
| 539 | | `work.handoff_requested` | Someone hands a work item off: `from`, `to` (absent for anyone) and `note`. | |
| 540 | | `dependency.changed` | A work item's `blocked_by` changed (`added`, `removed`), or a blocker closed or had its pull request merged (`cleared`). `remaining` lists the blockers still open. | |
| 541 | | `overlap.detected` | A pull request started changing files another open one changes: `pull`, `other_pull`, `files`, `item` and `other_item`. Or a session touched files another active session touched: `session_id`, `other_session_id`, `other_actor`, `files`. | |
| 542 | |
| 543 | A session or claim that went quiet is announced as ended or expired when |
| 544 | the repository's sessions or claims are next read or changed, not at the |
| 545 | minute it lapsed. |
| 546 | |
| 547 | ## Who sees what |
| 548 | |
| 549 | A session records someone's own work as it happens, so g1t shows it by who |
| 550 | is looking, on the site, the API, MCP and the CLI alike. |
| 551 | |
| 552 | | Who | Sees | |
| 553 | | --- | --- | |
| 554 | | Whoever ran it | All of it: its prompts, tool calls, what it touched and reported, its pending updates. | |
| 555 | | A member of the repository's workspace | What it did: its title, tool calls, messages, notes, skills, what it touched, its subagents' tasks, prompts and reports, its pending updates. Not the prompts someone else typed, nor a tool's output (`tool_result`): those entries show as kept back. A title shows without swearing. | |
| 556 | | Anyone else who may read the repository | That it runs: who runs it, in which harness, since when, its state and the work items and pull requests it is tied to. Nothing it recorded, touched, was asked or reported, nor its title, branch or model. On a pull request's session, only g1t's own notes. | |
| 557 | |
| 558 | Before anything is kept, g1t takes out what looks like a credential |
| 559 | (`[redacted]`): every token format [secret protection](/guides/security/secret-protection/) |
| 560 | knows, any key or token by its issuer's prefix, `NAME_TOKEN=value`, |
| 561 | `password: value` and the like, `--token`/`--password` flags, `Bearer` and |
| 562 | `Authorization` headers, a URL's user and password and its signed query |
| 563 | parameters, JWTs, private keys, and long random-looking strings. What was |
| 564 | recorded before this is hidden the same way as it is read. The |
| 565 | [Claude Code plugin](/guides/claude-code-plugin/) does the same before |
| 566 | anything leaves your machine. It is a safety net, not a vault: keep |
| 567 | secrets out of prompts and command lines. |
| 568 | |
| 569 | ## Who may do what |
| 570 | |
| 571 | | To | You need | |
| 572 | | --- | --- | |
| 573 | | Read sessions and claims | To be able to read the repository. Public repositories need no token. What a session shows depends on who you are: see [Who sees what](#who-sees-what). | |
| 574 | | Read a work item's context | To be able to see the work item: see [Who sees a work item](/guides/work-items/#who-sees-a-work-item). | |
| 575 | | Start a session, claim a work item, open one by claiming it | A confirmed email address and a role that may open work items; the repository must not be archived. | |
| 576 | | Update, record in or end a session | To be the person whose token started it. | |
| 577 | | Release a claim or hand it off | To be the person who made it. | |
| 578 | | Set `blocked_by` | To be the work item's author, or the Triage role. | |
| 579 | | Start a session on the workspace's Anthropic account | To be a member of the workspace and able to open work items in the repository. The hand-off needs only to see the work item. | |
| 580 | |
| 581 | With an access token, sessions (and `start_agent_session`) need |
| 582 | `pull_requests:read` or `pull_requests:write`, and claims and `get_work` |
| 583 | need `work:read` or `work:write`, as |
| 584 | [scopes](/guides/authentication/#scopes) say. |
| 585 | |
| 586 | ## Pending coordination updates |
| 587 | |
| 588 | These commands work with Codex, Claude, or another harness using the same |
| 589 | session API. There is no provider-specific acknowledgement protocol: |
| 590 | |
| 591 | ```sh |
| 592 | g1t session updates --json |
| 593 | g1t session acknowledge upd_ID --note "My scope is separate; no plan change" |
| 594 | ``` |
| 595 | |
| 596 | They use `G1T_SESSION` (or the working copy's remembered session). |
| 597 | `session updates`, `session acknowledge` and `session heartbeat` first say |
| 598 | which files the working copy has changed (from `git status`), as |
| 599 | `session touch --file` would, so overlapping edits are noticed whichever |
| 600 | harness makes them; `G1T_TOUCH=0` turns that off. To avoid |
| 601 | shared-checkout ambiguity, `updates SESSION_ID` and `acknowledge --session |
| 602 | SESSION_ID` select a session explicitly. The acknowledgement command records |
| 603 | a decision note before clearing updates, with an idempotency key for retries. |
| 604 | The raw API below also works with older CLI installations. |
| 605 | |
| 606 | `g1t api get_session -f id=SESSION_ID` returns up to 100 pending `updates`, |
| 607 | oldest first, separately from transcript entries (give `after=4294967295` to |
| 608 | leave the entries out). Updates are claims, releases, hand-offs and expiries, |
| 609 | overlaps, dependency changes, decisions, integration results, and sessions |
| 610 | starting and ending. |
| 611 | |
| 612 | An active session receives the updates that concern it: |
| 613 | |
| 614 | | The session is | It receives | |
| 615 | | --- | --- | |
| 616 | | Attached to a work item or pull request, or tied to one (a claim, its branch, a `#N` it named) | Updates about that work item or pull request: its claims, decisions, overlaps, dependency changes and integration results, and those that name it, such as an integration failure listing it as a suspect or a work item newly blocked by it | |
| 617 | | Not on anything yet | Every update, so it can find who else is working and on what | |
| 618 | | Either | Updates about nothing in particular, such as a session starting without a work item; and an overlap between its own files and another session's, which goes only to the two sessions | |
| 619 | |
| 620 | A session does not receive its own start or end, or the claims it made, |
| 621 | released or handed off. It does hear when its claim expires. New sessions |
| 622 | should still load the work item's context: an inbox is not a replay of what happened |
| 623 | before the session started. |
| 624 | |
| 625 | Reading does not clear an update. After considering it and recording any |
| 626 | change of plan, the session owner acknowledges exact IDs: |
| 627 | |
| 628 | ```sh |
| 629 | g1t api record_session_entries -f id=SESSION_ID -f 'acknowledge[]=UPDATE_ID' |
| 630 | ``` |
| 631 | |
| 632 | Repeat the field for multiple IDs, at most 100 per request, then read again |
| 633 | for the next page. Acknowledgement is idempotent and scoped to that session. |
| 634 | It means considered, not resolved. The response's `acknowledged` says how |
| 635 | many of the IDs name updates of that session, so a mistyped ID or one from |
| 636 | another session shows up as a shortfall (the CLI warns). The session page |
| 637 | shows pending updates. |
| 638 | |
| 639 | Claude Code hooks retrieve updates in the background, at most once per ten |
| 640 | seconds when a successful cached response exists, and at once after an |
| 641 | acknowledgement. Every prompt shows what is pending; before a tool, pending |
| 642 | updates are shown when they change and again every two minutes. Delivery |
| 643 | repeats until acknowledged. Other |
| 644 | harnesses, including managed sessions, should poll between work steps using |
| 645 | the coordination skill. Neither a disconnected harness nor an idle session |
| 646 | is interrupted in real time. |
| 647 | |
| 648 | An update is written in the same transaction as the change it announces: a |
| 649 | claim, release, hand-off, expiry, session start or end, overlap, decision or |
| 650 | change to what a work item is blocked by is never kept without its |
| 651 | updates, and updates never announce a change that was not made. Each |
| 652 | update's ID is derived from its change, so a retried request, or two |
| 653 | requests making the same change at once, delivers it once. The one |
| 654 | exception is the notice that a work item's blocker closed or merged, which |
| 655 | follows the close or merge: it is written right after, once per close or |
| 656 | merge. Updates are still a summary: re-read current work item and pull |
| 657 | request state before consequential actions. |
| 658 | |
| 659 | Acknowledged updates are kept as receipts for 30 days. Pending updates stay |
| 660 | until acknowledged, including those of a session that ended, so whoever |
| 661 | takes over its work can see what it never considered. |