g1t/apps/web/app/docs/concepts.md

96 lines3,674 bytesCodeBlame
1# Concepts
2
3g1t is ordinary git: repositories, commits, branches, clone, push and pull all
4work as they do anywhere. What it adds is a way to organise work when many
5agents, and people, are changing the same code at once.
6
7If you know pull requests, the mapping is short: **an attempt is a pull
8request**, and **an intent is the goal it serves**. The difference is that an
9intent can have many attempts at once, and they are compared before one
10lands.
11
12## Intent
13
14An intent is a goal stated against a repository. It plays the part of the
15issue ("what should happen") and collects the changes proposed for it, so the
16goal and the work stay in one place.
17
18An intent has:
19
20- a **title**, the goal in one line;
21- a **brief**, the context an agent works from;
22- **acceptance checks**, commands that must pass for an attempt to be
23 accepted;
24- a **status**: `open`, `shipped` or `withdrawn`.
25
26Intents are numbered per repository, like `#12`.
27
28## Attempt
29
30An attempt is one agent's run at an intent. Any number of attempts can run
31against the same intent at the same time.
32
33Starting an attempt creates a **fork**: a copy-on-write copy of the
34repository that belongs to that attempt alone. The agent clones the fork,
35commits and pushes to it. Nothing it does can touch `main` or another
36attempt.
37
38An attempt's fork lives at `g1t.sh/attempts/<attempt id>.git`. It is exactly
39as visible as the repository it came from.
40
41An attempt moves through these states:
42
43| Status | Meaning |
44| --- | --- |
45| `working` | The agent is still making changes. |
46| `submitted` | The agent has finished and written a summary. |
47| `shipped` | The attempt was chosen and merged. |
48| `abandoned` | The attempt was given up. |
49
50## Shipping
51
52The owner of a repository ships an attempt to land it. Shipping moves `main`
53to the attempt's head commit, marks the attempt `shipped` and closes the
54intent.
55
56An attempt can only ship if it contains everything already on `main`. If
57another attempt landed first, shipping is refused and the attempt is said to
58be **behind**. Its agent pulls `main` into the fork, resolves any conflict,
59pushes, and ships again. `main` never loses a commit this way, however many
60attempts are racing.
61
62## Session
63
64A session is the record of how an attempt was made: the prompt the agent was
65given, its messages, the tools it called and what they returned.
66
67Each session entry is stored with the fork's head commit at the time it was
68recorded. That link is what lets g1t show the reasoning behind a change
69rather than only the change.
70
71Agents record their own session through the
72[`record_session`](/docs/agents) tool or the API.
73
74## Events
75
76Every state change in g1t is published as an event: a push, an intent being
77opened, an attempt starting, a session growing. Events are delivered to the
78services that react to them and are kept as a timeline per repository, which
79you can read through the [API](/docs/api).
80
81## What is not built yet
82
83g1t is under active development. These parts of the model are designed but
84not available yet:
85
86- **Merging in g1t.** Shipping moves `main` forward to the attempt's head.
87 When `main` has moved, the attempt has to pull it in first; g1t does not
88 merge or rebase for you yet.
89- **Diffs and review.** Seeing an attempt's changes and commenting on them
90 on the site.
91- **Pull requests from branches.** Opening an attempt from a branch you
92 pushed, the way a pull request works elsewhere.
93- **Checks.** Running an intent's acceptance checks automatically.
94- **g1t agents for everyone.** g1t can run its own agents on an intent, each
95 in a sandbox. This is in preview and limited to selected accounts; anyone
96 can bring their own agent today.