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.

g1t.sh
68 linesCodeBlameRaw
1---
2name: work-on-issue
3description: Work on a g1t issue from start to merge. Use when asked to work on, fix, implement or pick up an issue in a g1t repository (an issue number such as #42, or a g1t.sh issue link).
4argument-hint: "[issue number]"
5allowed-tools: Bash(g1t:*) Bash(git:*)
6---
7
8# Work on a g1t issue
9
10The issue is the work: its description says what is wanted, its
11"Definition of done" and the repository's required checks say when it is
12done, `blocked_by` lists what must land first, and its pull requests are
13the attempts. Other agents and people may be working in the same
14repository; claims and events are how you stay out of each other's way.
15Every `g1t` command takes `--json` when you need fields rather than text.
16
17Issue: $ARGUMENTS (if empty, ask which issue, or list open ones with `g1t issue list`).
18
191. **Load the context.** Run `g1t work context N`. It shows the issue and
20 its definition of done, who has claimed it, the sessions and pull
21 requests already on it with their checks and overlaps, what blocks it,
22 what it blocks, the decisions recorded so far and the last integration
23 failure. Read all of it before you change anything.
242. **Check it is free to start, and who else is on it.**
25 - Its sessions include subagents: if you are one of several agents on
26 this issue (siblings started by the same session, or other people's),
27 run `g1t session list --issue N --subagents` and read what each is
28 doing and has touched (`g1t session view ID`). Take a part nobody has,
29 and say which in your claim's note. Before editing a shared file,
30 `g1t session list --path FILE` says who else touched it.
31 - If it is blocked by issues that are still open, say so and stop
32 unless you are asked to go on anyway.
33 - If someone else holds an active claim, tell the person who asked you,
34 and go on only if they say to. Two claims are allowed; they are a
35 warning, not a lock.
36 - If a pull request for it is already open, prefer continuing that one
37 (`g1t pr checkout NUMBER`) over starting another.
383. **Claim it.** `g1t work claim N --note "what you are about to do"`. The
39 claim belongs to this session (a subagent's to its own session) and is
40 renewed while the session is active. Its answer lists the other claims
41 on the issue, siblings' included: read them. If g1t later reports an
42 overlap (`overlap.detected`) with another session, agree who changes
43 the file before going on; `g1t work events --follow --issue N` keeps
44 you told.
45 Without the CLI, g1t's MCP server does the same: `issue` with action
46 `work`, `claim` and `release`, and `session` with action `list`.
474. **Branch.** From an up-to-date default branch, make a branch whose name
48 starts with the issue number, such as `42-short-description`, so the
49 session and the next one know which issue it is for.
505. **Open a draft pull request early**, as soon as there is a first commit:
51 `g1t pr create --issue N --draft --fill`. Others then see your changes,
52 and g1t tells you when they overlap with someone else's.
536. **Do the work.** Commit in small steps and push often, with the
54 trailer `G1t-Session: $G1T_SESSION` on each commit
55 (`git commit --trailer "G1t-Session: $G1T_SESSION"`) so g1t ties the
56 commits to this session. Run the same
57 tests and linters the repository's workflows run before each push. Log
58 a decision worth keeping with `g1t session log --kind note "TEXT"`.
597. **Watch the checks.** `g1t pr checks --watch --fail-fast`. When one
60 fails, `g1t run logs --failed` says why; fix it and push again.
618. **Finish.** When the definition of done is met and the checks pass,
62 `g1t pr ready --summary "what changed and why"`, then `g1t pr merge`
63 when you are allowed to merge. With the merge queue on, merging adds the
64 pull request to the queue; if the queue reports an integration failure,
65 use the `fix-integration` skill.
669. **Let go.** If you stop before it is done, hand it off rather than
67 leaving a claim to expire: `g1t work handoff N --note "where it stands,
68 what is left, what to watch out for"`.