g1t/docs/PLAN.md

1,297 lines73,445 bytesCodeBlame
1# g1t plan
2
3g1t is where people and agents ship software together: a git platform built on Cloudflare Workers and Artifacts for
4the "Build the Next-Gen Git Platform on Cloudflare" competition.
5
6- Submission closes **October 14, 2026, 11:59 PM PDT**: a 5–10 minute demo
7 video, this repository (MIT) and run instructions.
8- Judging: 50% originality and quality of the prototype for agent-oriented
9 collaboration; 25% multi-agent concurrency, coordination, context
10 preservation, review and conflict handling; 25% ease of use.
11
12## The point
13
14**g1t is where a team of agents ships code, with the people they work for.**
15
16Hosting git is table stakes, and g1t does it the familiar way: issues,
17branches, pull requests, review, protected branches, people working by hand.
18None of that is the selling point. The selling point is the layer above it,
19which no forge has: **you hand g1t an outcome, and a fleet of agents converges
20it onto `main`, coordinating with each other and with you, with every decision
21on the record.**
22
23Three things only g1t does, and every feature should serve one of them:
24
251. **Outcomes, not pull requests.** The unit people work in is "make onboarding
26 work offline", not branch #4012. A brief becomes a plan of issues with
27 dependencies; agents take them as they unblock; people steer the outcome
28 and see it converge, rather than stopping at the pull request.
292. **Agents that work as a team.** Agents know what the others are doing, file
30 what they find instead of widening their change, ask and answer each other
31 through the forge, and defer to people. Many agents on one codebase without
32 a human refereeing collisions.
333. **`main` that only ever moves forward.** Every change lands through checks
34 in the combination it will live in (the merge queue), failures go back to the
35 agent that wrote them, and any line can answer "why is this here?"
36
37## Product model
38
39g1t keeps the two things every engineer already knows, issues and pull
40requests, and changes the assumption underneath them. A forge built for
41people expects a few changes in flight, each watched by its author. g1t
42expects dozens of agents working at once across a project, each on its own
43issue, all of which have to land on `main`. A person assigns an issue to
44g1t and chooses nothing else: not how many agents, and not which
45model. An issue can still collect more than one pull request (a second
46attempt, or someone's own agent alongside g1t's), and when it does the
47issue records which one was taken.
48
49| Concept | What it is |
50| --- | --- |
51| **Issue** | What should change in a repo: a bug, a feature, a question. Opened by a person, an agent or an integration such as an error tracker. Carries labels, a description that may say what done means (a Definition of done: context, never a gate), comments, and every pull request made for it. What a merge needs is the default branch's required checks: workflow statuses, the same for people and agents. |
52| **Pull request** | A proposed change in its own Artifacts fork, made by an agent or a person, usually for an issue. Any number can be open for one issue. Starts as a draft; marked ready; merged or closed. |
53| **Session** | The agent's full context for a pull request: prompt, messages, tool calls, cost. Stored with the pull request and linked from every commit it produced. |
54| **Compare view** | Every pull request for an issue side by side with diff, check results, conflicts against main and against each other, and a reviewer agent's summary. |
55| **Merge** | A person or a policy picks a pull request. A per-repo merge queue lands it. The issue closes, recording which pull request resolved it; the others for that issue close as superseded, or are rebased by their agents when the issue is kept open. |
56
57Issues and pull requests share one sequence of numbers per repository, so
58`#12` names exactly one of them.
59
60Features that fall out of the model:
61
62- **Why-blame.** Click a line and see the prompt and reasoning that produced
63 it, not only the commit.
64- **Overlap radar.** Pull requests that touch the same files are flagged
65 while the agents are still working, and the agents are told.
66- **Live lanes.** Watch every pull request progress in real time.
67
68## Why issues and pull requests, not something new
69
70An earlier version of this plan merged the two into one new object, an
71"issue" holding "pull requests". That was wrong, for three reasons.
72
73- **Issues come from everywhere.** People file them, agents file them, and
74 Sentry files them. Most are never worked on by whoever opened them. They
75 need their own life: labels, triage, discussion, closing as not planned.
76- **"Which change did we take?" needs two objects.** When five agents each
77 propose a change, the answer has to be recorded somewhere other than the
78 five proposals. On g1t it is on the issue: `resolved by #14`.
79- **Nobody should have to learn a word to use the product.** An engineer who
80 has used any forge can use g1t on the first day, and finds the agent
81 features where they would look for them.
82
83What g1t adds to the familiar pair:
84
85- **Several pull requests per issue is supported**, not an accident. It
86 is the exception, for a second attempt or a competing one, but when it
87 happens the issue's page lists them with their state, and merging one
88 closes the issue with that pull request recorded and the others marked
89 superseded.
90- **A pull request can be part of the work.** Merging with "keep the issue
91 open" leaves the issue and its other pull requests alone.
92- **Every pull request has a fork and a session.** See
93 [forks and branches](https://docs.g1t.sh/concepts/forks/).
94- **Labels need no setup.** A repository starts with `bug`, `feature`,
95 `docs`, `chore` and `question`; any other name becomes a label the first
96 time it is used, so an integration can tag what it files.
97- **The developer path is unchanged.** Push a branch, open a pull request
98 from it, get review, merge. Agents get a fork per pull request instead.
99- **Both paths meet at `main`.** The same landing rules apply to a person's
100 pull request and an agent's.
101
102## Converging on main
103
104Twelve issues started together will finish at different times and touch
105overlapping code. Getting them all into `main` without a person refereeing
106is the hard part, and it is handled in four places.
107
1081. **Before work starts: plan the overlap away.** A project is a graph of
109 issues. A planner agent can split a large goal into issues, predict
110 which files each will touch, and add a dependency where two would collide,
111 so one starts from the other's result instead of from `main`.
1122. **While agents work: overlap radar.** Each pull request's changed files and
113 symbols are tracked as it pushes. When two pull requests from different issues
114 enter the same area, both agents are told what the other is doing there.
1153. **When `main` moves: the author resolves.** Every open pull request is
116 trial-merged against the new `main`. A clean merge updates the pull request
117 silently. A conflict resumes that pull request's agent with its original
118 session and the incoming change, so the conflict is resolved by the agent
119 that wrote the code and still knows why.
1204. **At landing: a speculative queue.** Approved pull requests enter the
121 repo's queue. g1t builds the combined states (`main`+A, `main`+A+B, …) and runs
122 their checks in parallel. Pull requests land in order as their combined state
123 passes; one that fails is ejected back to its agent and the states behind
124 it are rebuilt. `main` only ever receives a state that passed.
125
126Landing can be fully automatic: a repo policy such as "checks pass and the
127reviewer agent approves" merges without a person.
128
129## Agents aware of each other
130
131Each repo keeps a live **work registry**: for every running pull request, its
132issue, a running summary of what it has done, and the files and symbols it
133has touched or plans to touch. Agents use it through MCP tools; g1t also
134acts on it without being asked.
135
136- **Before starting.** When an issue is opened, or an agent is about to
137 begin a task, g1t searches open issues and running pull requests for the same
138 goal (by meaning, not wording) and for the same area of code. If a match
139 exists the agent is told who is on it and how far along, and chooses: join
140 as a deliberate racer, wait for the result, or drop the task. Duplicate
141 issues are offered for merging.
142- **Finding out-of-scope work.** An agent that discovers something outside
143 its issue asks the registry who works there. If another pull request owns that
144 area, it **hands off**: a note, the relevant excerpt of its session, and
145 optionally commits the receiver can take. If nobody does, it opens a child
146 issue instead of widening its own change.
147- **Asking.** An agent can put a question or a request to another pull request.
148 The receiver gets it at its next turn.
149- **Waiting.** An agent that needs another pull request's result parks itself.
150 Its sandbox sleeps, spend stops, and it resumes from the new state when
151 that pull request merges.
152- **Agents that do not cooperate.** For pushes from tools that never call
153 these tools, g1t compares the pushed change against running pull requests and
154 flags near-duplicates itself.
155
156Every handoff, question and wait has a state (offered, accepted, declined,
157done), appears in the timeline, and is visible to people. A handoff declined
158twice, or two agents passing work back and forth, goes to the "needs you"
159inbox.
160
161## Review at scale
162
163Cloudflare's brief asks "how do you review everything they produce?". With
164hundreds of agents, a person cannot read every diff, so review is by
165exception.
166
167- **Evidence, not diffs.** Every pull request carries a proof bundle: checks run
168 and their output, a preview URL, a plain-language summary, and the
169 behaviour that changed.
170- **Two agent reviewers.** One reviews the change against the issue. A
171 second is adversarial: it tries to break the change and reports what it
172 found.
173- **Risk tiers.** Each change is scored from what it touches, how large it
174 is, and how the reviewers ruled. Low risk merges on policy; high risk goes
175 to a person with the evidence already assembled.
176- **Trust is earned.** An agent's record on a path (merged, reverted, caught
177 by review) raises or lowers the tier its changes land in.
178- **Sampling.** A share of auto-merged changes is sent to a person anyway,
179 to keep the policy honest.
180
181## Rethinking the git primitives
182
183- **No branches for agents.** A pull request is a fork; `main` is the only
184 long-lived line. There is nothing to name, clean up or go stale.
185- **Projected main.** New pull requests start from `main` plus everything already
186 in the landing queue, so they are built on the state they will land on.
187- **Structural merge.** The merge engine merges by syntax tree, not by line,
188 for supported languages. Two agents adding different functions to the same
189 file do not conflict.
190- **Forkable sessions.** A session can be forked at any turn: the code as it
191 was at that moment plus the conversation up to it, continued with a
192 different instruction. Branching applies to the reasoning as well as the
193 code.
194- **Provenance in history.** Every commit records its issue, session,
195 agent, model and cost, and is signed with a key issued to that pull request. The
196 history can be audited by machine.
197
198## People in the loop
199
200### Code that arrives from outside
201
202People will keep pushing with plain git, their editor, or another tool. Every
203push goes through g1t's git front end, so none of it bypasses the model.
204
205- **A push to a branch becomes a pull request.** g1t adopts it with the pusher as
206 author. A reviewer agent writes the issue it appears to serve and offers
207 to attach it to an open issue it matches. From there it gets the same
208 checks, compare view and queue as agent work.
209- **A push to `main` follows repo policy.** Protected: refused with a message
210 saying which ref to push to instead, so it enters the queue. Open: accepted
211 and treated as "`main` moved", which re-verifies the queue and triggers
212 resolve-on-move for every open pull request.
213- **Context is an open format.** A commit trailer names the session that
214 produced it, so any tool can attach its transcript. Commits without one are
215 shown in why-blame as "pushed by a person, no session".
216- **Approval rules.** Per repo and per path: merge automatically, require a
217 named person, or require a person when the change is large or the reviewer
218 agent is unsure.
219
220### Joining work that is already running
221
222- **Every session has a live page** that works on a phone: the transcript as
223 it streams, the current diff, check results.
224- **Steer.** Send a message, pause, or redirect. Hosted agents receive it
225 immediately; a person's own Claude Code receives it at its next turn
226 through the CLI hooks.
227- **Answer.** When an agent is blocked on a question, it appears in a "needs
228 you" inbox and as a notification. The answer resumes the agent.
229- **Take over and hand back.** Check out the pull request's fork, commit by hand,
230 push, and let the agent continue from there.
231
232### Planning by writing
233
234- **Brief.** Write the outcome in prose on the site, or commit it as a
235 markdown file. A planner agent turns it into a project: issues, each with
236 what done means, and dependencies. The person edits the graph before anything starts.
237- **Plan from their own agent.** The same operations are MCP tools, so a
238 person can plan in their own Claude Code session and create the project
239 from there.
240- **The brief stays the source of truth.** Editing it later re-plans: new
241 issues are added, obsolete ones are closed.
242
243### Seeing what moved
244
245- **Project page.** The outcome, the issue graph coloured by state, and how
246 many of its issues have landed with their required checks passing,
247 compared with when the project started.
248- **Digest.** An agent-written summary per project and per person: what
249 merged, what is blocked on whom, which conflicts were resolved, what it
250 cost.
251- **Timeline.** Every event (push, steer, check, conflict, merge) in order,
252 each linked to the session and the person or agent behind it.
253
254## One session, any surface
255
256A session belongs to g1t, not to the device it started on. The browser, a
257phone and Claude Code are views of the same session.
258
259- **Browser and phone.** The site is a responsive, installable web app with
260 push notifications. Everything a person does (brief, steer, answer,
261 approve, merge) works there.
262- **Claude Code.** Through `mcp.g1t.sh` and the CLI hooks, a local session is
263 a g1t session: its transcript syncs as it runs and it appears in mission
264 control like any other.
265- **Moving a session.** A local session can be sent to the cloud: a hosted
266 agent takes over the fork and the transcript and continues, so the laptop
267 can close. A hosted session can be pulled down: the CLI checks out the fork
268 and resumes it in local Claude Code with its history.
269- **Limit.** A session running only on a laptop stops when the laptop does.
270 It can be steered between turns but not continued until it is moved or the
271 laptop is back.
272
273## For people who do not write code
274
275- **Documents are first-class.** Specs, guides, policies and decisions live
276 in repos as markdown, shown in a Docs view: rendered pages, edited in the
277 browser like a document, with inline comments. "Suggest a change" is an
278 pull request and "publish" is merge, without git vocabulary.
279- **Document issues.** "Write the onboarding guide for the billing API" is
280 an issue. Its Definition of done is a checklist judged by a reviewer agent
281 instead of a workflow. Agents draft and revise; people comment and approve.
282- **Templates.** Product brief, RFC, decision record. A filled-in template is
283 a brief the planner can turn into a project.
284- **Explain.** Ask about any repo, project or change in plain language and
285 get an answer with links to the code and sessions behind it.
286- **Living documentation.** g1t generates "how this works" pages from the
287 code and keeps them current. When a merged change contradicts a document,
288 an issue opens to update it.
289- **See it, don't read it.** Every pull request on a deployable repo gets a
290 preview URL (Workers Builds from the pull request's fork), so an approver clicks
291 through the result instead of reading a diff. Changes are also summarised
292 in plain language.
293- **Roles.** Viewer, commenter, planner, approver: a person can plan and
294 approve work without ever cloning a repo.
295
296## The macro view
297
298The hierarchy above a single repo:
299
300| Level | What it is |
301| --- | --- |
302| **Workspace** | A company or team: its people, repos, agents, budget and policies. |
303| **Initiative** | A business outcome with an owner and measurable results, e.g. "move billing to usage-based pricing". Spans any number of repos. |
304| **Outcome** | One deliverable inside an initiative: a brief and its graph of issues (shown as **Plan**). Called "project" before 2026-10-04; that name now means what [Projects](#projects) describes. |
305| **Issue / Pull request** | As above. An issue may touch several repos; a pull request for it then holds one fork per repo and they land together. |
306
307How it feeds up, and what is built:
308
309- **A workspace is the unit everything belongs to.** Repositories, people,
310 access tokens, and later projects, budgets and policies are the
311 workspace's, never a person's. An account owns nothing; its first step
312 after confirming its email is creating a workspace, and the site sends it
313 there from wherever it was going.
314- **One namespace.** Usernames and workspaces share one set of names, as on
315 Docker Hub and npm. A username is reserved for its owner's workspace, so
316 `g1t.sh/<name>` never means two things.
317- **The workspace page is the roll-up.** `g1t.sh/<workspace>` shows its
318 repositories with their open issues and pull requests, and the pull
319 requests in progress across all of them. Projects and initiatives will
320 roll up to the same page. Its own pages live under `/<workspace>/-/`
321 (people, access tokens, settings), which no repository can be named.
322- **Workspace access tokens instead of service accounts.** A workspace has
323 tokens of its own, in the same table and code path as personal ones. One
324 acts as the workspace, with a member's rights in that workspace only,
325 records who made it and when it was last used, and keeps working when
326 that person leaves. CI, integrations and automations use these.
327
328### Portfolio
329
330One page answers "where is the business" across every initiative:
331
332- **Health** per initiative: on track, at risk, or blocked, derived from
333 facts (checks passing, issues stalled, questions waiting on a person),
334 not self-reported.
335- **Progress** as measurable results: required checks passing, issues
336 merged out of planned, and the trend since the start.
337- **Forecast** from actual throughput: at the current rate, when the
338 remaining issues land.
339- **Spend** in tokens and dollars against a budget, per initiative.
340- **Waiting on people**: every decision or approval a person owes, by name.
341- **Roadmap**: initiatives laid out as now, next, later, with optional
342 time-boxed cycles for teams that work in sprints.
343
344### Status without asking
345
346- **Standup.** An agent writes a daily report per initiative and one for the
347 whole workspace: what merged, what changed direction, what is at risk and
348 why, what needs a person. Delivered by email or webhook.
349- **Ask.** A question box over the full event log and all sessions: "what
350 happened on the billing migration since Monday?" answers with links to the
351 sessions and commits behind each claim.
352
353### Long-running agents
354
355Work that runs for days needs supervision that does not depend on someone
356watching.
357
358- **Checkpoints.** A long pull request reports milestones against its issue, so
359 progress is visible before anything merges.
360- **Stall and drift detection.** A pull request with no meaningful progress, or
361 whose changes have wandered away from its issue, is flagged and can be
362 stopped or re-briefed automatically.
363- **Budgets.** Hard limits on spend and time per pull request, project and
364 initiative.
365
366### Context hub
367
368Agents working across repos and days need context that outlives any one
369session and reaches beyond the code. The context hub is one place an agent
370asks, whatever the source.
371
372| Source | What it holds | How it gets there |
373| --- | --- | --- |
374| **Memory** | Decisions, conventions, gotchas, facts about systems | Written by agents and people in g1t |
375| **Code and sessions** | The repos, and the reasoning behind every change | Already in g1t |
376| **Connected sources** | Jira and Linear tickets, Notion and Confluence pages, Google Drive documents, Slack threads, Sentry issues | Connectors, authorised per workspace |
377
378How it behaves:
379
380- **One search.** An agent asks a question and gets ranked results across
381 all sources, each labelled with where it came from, who wrote it, and how
382 fresh it is.
383- **Connected sources stay where they are.** g1t indexes them for search and
384 fetches the current version when an agent opens one. The external system
385 remains the source of truth, and a link placed on an issue ("see
386 JIRA-482", a Notion URL) is pulled into the agent's starting context.
387- **Permissions carry over.** A connector only exposes what the connecting
388 account can see, and a workspace admin chooses which spaces, projects or
389 channels are included.
390- **External content is untrusted.** A ticket or page can contain text meant
391 to manipulate an agent. It is marked as reference material, never treated
392 as instructions.
393- **Documentation is separate.** Context is what agents know; documentation
394 is what people read, and it is generated from context and code.
395
396Memory is the part of the hub that g1t owns and agents write to:
397
398- **Memory is written freely.** Any agent or person adds an entry with one
399 call: a decision, a convention, a gotcha, a fact about a system. No review
400 gate. Each entry records who wrote it, from which session, and when.
401- **It is still a repository.** Each workspace has a memory repo in
402 Artifacts, so every write is a commit: versioned, attributable, and
403 revertible.
404- **It is kept healthy by an agent.** A consolidation agent merges
405 duplicates, retires entries that newer ones contradict, and flags
406 conflicts it cannot settle. People can pin an entry (agents may not change
407 it), correct it, or retract it.
408- **Agents read it.** Every session starts with the context relevant to its
409 issue, found by search, and can query more through MCP.
410- **Updates are events.** A memory write or a change in a connected source
411 is an event, so "when context changes, update the affected docs" is an
412 automation, on by default.
413- **It is scoped inside the workspace.** Some context applies to the whole
414 workspace, some to one initiative, project or repo, so an agent gets what
415 applies to its work.
416- **It never crosses workspaces.** A workspace is the isolation boundary: its
417 context, sessions and private repos are invisible to every other
418 workspace, and an agent's token is bound to one workspace.
419
420## Working in g1t
421
422- **Mission control.** The signed-in home page: every running session, every
423 issue waiting on a decision, and what merged, across all repos.
424- **Outcomes.** Group issues across repos toward one result and track how
425 many are open, racing, or merged. (What [Projects](#projects) means is
426 below.)
427- **Steering.** Send a message to a running pull request, or to all pull requests on an
428 issue at once, without stopping them.
429- **Automations.** Rules that start work without a person (next section).
430
431## Automations and integrations
432
433> **2026-10-03:** g1t's own `.g1t/automations` format was built and then set
434> aside at the user's request ("let's just copy GitHub Actions on that for the
435> time being"). Automation on g1t is GitHub Actions workflows in
436> `.g1t/workflows/`; the format below is kept for later.
437
438An automation is **when** an event happens, **if** conditions hold, **do**
439something. They are defined as files in the repo (`.g1t/automations/`), the
440way GitHub Actions workflows are, and can also be built in the UI.
441
442### Events that can trigger one
443
444| Source | Examples |
445| --- | --- |
446| Git | push, merge, check failed, `main` moved |
447| g1t | issue opened, pull request stalled, context updated, handoff declined, budget reached |
448| Time | cron schedule |
449| Integrations | Sentry issue, PagerDuty incident, Linear or Jira ticket, Slack message or mention, GitHub issue, Stripe event |
450| Anything else | a signed generic webhook, or an email to a per-repo address |
451
452**Actions**: open an issue (optionally assigning N agents to it), message
453a running pull request, update documentation, notify, call a
454webhook, write back to the source system.
455
456**Example: Sentry.** A new production error arrives. The automation opens an
457issue labelled `bug`, with the stack trace, release and frequency in its
458description. Why-blame
459finds the session that wrote the failing line, so the fixing agent starts
460with the original reasoning. When the fix merges, g1t comments on the Sentry
461issue and resolves it.
462
463### Rules every automation obeys
464
465- **Deduplication.** The same Sentry issue firing 500 times maps to one
466 issue.
467- **Limits.** Concurrency and budget caps per automation.
468- **Loop protection.** Work started by an automation cannot retrigger the
469 same automation without a person in between.
470- **External input is untrusted.** A webhook payload can contain text written
471 by an attacker. Agents started by external events run with reduced
472 permissions and cannot merge without the repo's approval rule passing.
473
474**Checks** are the other half of what GitHub Actions does: build and test
475commands declared in `.g1t/checks.yaml`, run in sandboxes on every pull request
476and on every combined state in the landing queue.
477
478Agents can also reach integrations directly: an agent definition lists MCP
479servers (Sentry, Linear and so on) it may use while working.
480
481## A repository that maintains itself
482
483> **2026-10-04:** the user asked for Dependabot, GitHub Advanced Security and
484> Vercel-style deployments, "so you're not having to maintain shit and you're
485> just pushing up agents that are delivering work consistently".
486
487GitHub reports problems and leaves the fix to you. In g1t, an agent opens an
488issue for each problem, writes the fix, runs its checks, links a preview and
489lands it through the queue. People only decide.
490
491### Upkeep agents
492
493- **Dependency updates.** A scheduled scan reads the lockfiles (npm, Cargo,
494 Go, pip), finds outdated and vulnerable packages and opens one issue per
495 update or group, assigned to g1t. The agent upgrades the package,
496 fixes what the upgrade broke and lands it through the queue. A repository
497 sets how often it scans, which packages it groups and what lands without
498 review (`.g1t/upkeep.yml`, shaped like `dependabot.yml`).
499- **Secret scanning.** Pushes are scanned for known token formats. A push
500 that adds a secret is refused with the file and line; one already in
501 history opens an issue to rotate it and remove it.
502- **Vulnerability alerts.** Dependencies are matched against the OSV
503 database. Every alert links to the issue and pull request fixing it.
504- **Code scanning.** A reviewer agent reads each pull request's diff for
505 security problems and leaves findings as review comments with a
506 suggested fix. Findings on `main` open issues.
507- **A security page per repository** lists alerts, secrets and findings,
508 with the agent work on each, like GitHub's Security tab.
509
510All of these are event sources for the existing issue → agent → checks →
511queue pipeline; they need no new kind of work.
512
513### Deployments
514
515- **A preview for every pull request**, at
516 `<pr>--<repo>--<owner>.g1t.page`, linked on the pull request and updated
517 on each push. `main` deploys to `<repo>--<owner>.g1t.page`, and a
518 repository can add its own domain.
519- **On g1t.page, not g1t.sh,** so customer code never shares cookies or an
520 origin with the site people sign in to.
521- **Built on Workers for Platforms.** Each deployment is a user Worker in a
522 dispatch namespace; one dispatch Worker on `*.g1t.page` routes to it. The
523 build runs in the same runners as Actions. Static sites and Workers apps
524 first; container apps and databases later.
525- **Agents use the preview.** The reviewer agent opens the preview in a
526 browser, takes screenshots of what changed and attaches them to its
527 review, so an approver sees the result without reading the diff.
528- **Environments.** Preview, production and their secrets; deploy history
529 and one-click rollback.
530- **Scale to zero.** An idle branch costs neither g1t nor the customer
531 anything: a Worker runs, and is billed, only while it answers a request.
532 A preview is deleted when its pull request closes or merges, and after
533 a set number of idle days. Container apps, later, sleep when idle.
534- **Billed to the customer, never free.** The user (2026-10-04): "we
535 should not be giving any of this available for free". Every deployment
536 is metered per workspace (requests, CPU time, deployed apps, stored
537 data), priced at Cloudflare's cost + 20% like agent usage, and drawn
538 from prepaid credit. `FREE_WHILE_BUILDING` and the free model allowance
539 do not cover deployments: a workspace without credit cannot deploy, and
540 turning deployments on says so first.
541- **Turning them on is a paid plan, the way Cloudflare's is.** "Including
542 things like them even enabling the feature should have that pay like
543 Cloudflare does." Enabling deployments for a workspace starts a monthly
544 fee that includes an allowance of requests, CPU time and deployed apps;
545 usage past it is billed per unit, as Workers for Platforms bills g1t.
546 The fee and allowance are the user's to set.
547- **Recommended, off in one click.** Because enabling costs money, it is
548 never switched on without the workspace agreeing: new repositories
549 recommend it prominently. A repository can turn it off, keep only production, or
550 deploy somewhere else from its own workflows. Apps built for Cloudflare
551 (Workers, static assets, D1, KV, R2) deploy without configuration.
552
553Later, toward GitLab's DevOps breadth: environment protection rules,
554package and container registries, releases, container hosting.
555
556## Projects
557
558> **2026-10-04:** the user: "an extra dimension of Projects so it's not
559> just repositories … where a lot of things can live", "very Vercel
560> like", with dependencies across projects "the Platform Engineering /
561> Port route", and "the repository is *part* of a project: you could be
562> mirroring it from GitHub/GitLab/Bitbucket, or you could let us host it
563> for you", with room for Mercurial or anything else later.
564
565**A project is the thing you are building and running; a repository is
566where some of its code lives.** Everything that is about running software
567(deployments, environments, domains, secrets, dependencies, owners,
568health, upkeep) belongs to the project. What is about the code itself
569(branches, pull requests, review, merge rules) stays with the repository.
570That split is what lets the code live anywhere.
571
572### The model
573
574| | What it is | Like |
575| --- | --- | --- |
576| **Workspace** | The company or team. Members, billing, plans, shared secrets. | Vercel team, GitLab group, GitHub org |
577| **Group** | An optional named set of projects, one level: "Payments", "Mobile". For browsing, ownership and shared settings. | GitLab subgroup, Backstage system, Port domain |
578| **Project** | One deployable thing: a site, an API, a worker, a library. Has exactly one **source**. | Vercel project, Port service, Backstage component |
579| **Source** | Where its code is: a repository and a **root directory** in it. | Vercel's connected repo + root directory |
580| **Dependency** | Project A uses project B: calls its API, consumes its package, reads its queue. | Port relations, Backstage `dependsOn` |
581
582- **One project, one source; one repository, any number of projects.** A
583 project builds from exactly one place, which keeps it as simple as
584 Vercel's. A monorepo is several projects on one repository, each with
585 its own root directory (`apps/web`, `services/api`), and a push builds
586 only the projects whose root it touched. The common case stays 1:1, and
587 every existing repository gets a project of its own name when this
588 ships, so nobody has to set anything up.
589- **Groups are for people; dependencies are for software.** Groups decide
590 where a project shows up and who owns it. Dependencies decide what
591 happens when one changes. Neither replaces the other, and a dependency
592 can cross groups.
593
594### Sources: where the code lives
595
596A source is an adapter behind one interface (`SourcePort`: clone URL,
597branches, commits, pushes as events, pull requests if it has them):
598
599| Source | Code lives | g1t gets pushes by | Pull requests |
600| --- | --- | --- | --- |
601| **Hosted on g1t** (today) | Artifacts | its own events | g1t's, with agents, the queue, review |
602| **Mirrored** from GitHub, GitLab or Bitbucket | Both; g1t keeps a copy | the provider's webhook, then fetch | The provider's, read into g1t; agents open theirs there |
603| **Connected, not copied** | The provider only | webhook | The provider's |
604| **Later:** Mercurial, Perforce, a tarball upload | Behind the same port | per adapter | per adapter |
605
606A mirrored or connected project still gets everything that is the
607project's: previews on its pull requests (a status and a comment on
608GitHub's), production on its default branch, secrets, dependencies,
609upkeep agents. That is the on-ramp: a team keeps GitHub and gets g1t's
610deployments and agents first, and moves the code later or never.
611Bring-your-own-git is also why the project, not the repository, holds the
612URL `g1t.sh/<workspace>/<project>`.
613
614### What lives on a project
615
616| | Today it is on | Moves to the project |
617| --- | --- | --- |
618| Deployments: production, previews, build settings, root directory, framework | The repository | Yes |
619| Environments: production, preview, and custom ones (`staging`) with protection rules (required approvers, branch limits) | Nowhere yet | New, on the project |
620| Domains: `<project>--<workspace>.g1t.page`, and custom domains | The repository's name | Yes |
621| Secrets and variables | The repository | Yes. Workspace rows link to projects instead of repositories. A repository's workflows read the rows of its project (with several projects on one repository, the one marked as the repository's default). |
622| Dependencies | Nowhere | New |
623| Owners, on-call, links (docs, dashboards, runbooks) | Nowhere | New: the catalog's metadata |
624| Health: scorecards (has an owner, CI passes, dependencies current, no open security alerts, deploys within N days) | Nowhere | New |
625| Upkeep agents: dependency updates, security alerts | The plan | Scoped per project |
626| Logs and analytics of the running app | Nowhere | New: requests, errors and CPU per environment, from Workers analytics |
627| Branches, pull requests, review, merge rules, the queue, webhooks | The repository | Stay |
628
629### Dependencies: why this gets powerful
630
631Declared in the UI, or in the source as `.g1t/project.yml` (which wins
632when present, as `catalog-info.yaml` does in Backstage):
633
634```yaml
635name: web
636root: apps/web
637dependsOn:
638 - project: api # calls its HTTP API
639 as: API_URL # its URL, per environment, as a variable
640 - project: ui-kit # consumes its package
641```
642
643What g1t does with them:
644
6451. **Reference variables.** `API_URL` above resolves to `api`'s production
646 URL in production and to the matching preview in a preview, the way
647 Railway's `${{ api.URL }}` references work. No hard-coded URLs.
6482. **Preview stacks.** A pull request on `api` gets its own preview, and
649 **Preview with dependents** builds `web`'s preview pointed at it, so a
650 reviewer clicks through the whole change across projects. A change that
651 spans repositories (one issue, one fork per repository) gets one stack.
6523. **Release order.** Production deploys go out in dependency order; a
653 change set across projects lands through the queue together or not at
654 all.
6554. **Impact on every pull request.** "Changes `api`; `web` and `mobile`
656 depend on it." Agents get the graph in their context: an agent
657 changing an API opens follow-up issues on the projects that call it,
658 and reviewers see what else could break.
6595. **Upkeep across the graph.** A vulnerable package in `ui-kit` opens
660 issues, assigned to agents, on every project that consumes it.
6616. **Scorecards turn into work.** A project failing a scorecard check
662 ("no owner", "dependencies 90 days old") gets an issue an agent can fix.
663 That is the Port idea with the work done for you.
6647. **The map.** A workspace's projects as a graph, coloured by health and
665 by what is deploying now.
666
667### Pages
668
669- `g1t.sh/<workspace>`: projects first (grouped, with health and
670 production status), then repositories.
671- `g1t.sh/<workspace>/<project>`: overview (production, latest previews,
672 health, owners, dependencies both ways), **Deployments**,
673 **Environments**, **Secrets and variables**, **Logs**, **Settings**
674 (source, root directory, build, domains, groups, owners).
675- A hosted repository keeps its code pages; from a project they are its
676 **Code** tab. A repository page lists the projects built from it.
677
678### Services
679
680- `services/projects` (new): projects, groups, sources, dependencies,
681 owners, scorecards. Events `project.created`, `project.updated`,
682 `dependency.changed`.
683- `services/deployments`: keyed by project instead of repository.
684- Secrets and variables: the scope becomes workspace → project.
685- Sources: the hosted adapter wraps `services/repos`; a mirror adapter
686 per provider in `services/integrations`, which already holds those
687 connections.
688
689### Build order
690
6911. **Projects as the home of deployments and secrets**, 1:1 with every
692 existing repository: the service, the pages, deployments and secrets
693 moved to the project, `<project>--<workspace>.g1t.page`.
6942. **Dependencies:** declared in the UI and `.g1t/project.yml`, reference
695 variables, impact on pull requests and in agents' context, the map.
6963. **Preview stacks** and cross-project change sets.
6974. **Monorepos:** several projects on one repository, each with a root
698 directory, building only what a push touched.
6995. **Mirrored sources:** GitHub first, then GitLab and Bitbucket.
7006. **Groups, owners, scorecards** feeding the upkeep agents.
7017. **Environments** with protection rules; custom domains; logs.
702
703**Step 1 shipped 2026-10-04:** `services/projects`; every repository a
704project of its own name; the site projects-first (workspace page of
705project cards, the project overview at `g1t.sh/<workspace>/<project>`, code
706under `/code`, the sidebar and the New project flow); deployments keyed by
707project and branch at `<project>-<workspace>.g1t.page` and
708`<project>-git-<branch>-<workspace>.g1t.page`; secrets and variables owned
709by the project.
710
711**Step 5, GitHub, built 2026-10-05:** one GitHub App (`g1t-sh`) for both
712sign-in and repository access. Sign-in is its user authorization with PKCE
713(identity, `src/github.rs`): accounts known by GitHub's numeric id, a
714matching verified email never linked without signing in to the account,
715new accounts behind the invite check. Repositories come through its
716installations (integrations, `src/github.rs`), copied with every branch and
717tag by the repos service (`src/mirror.rs`) as **import**, **mirror** (g1t
718follows GitHub on its push webhook) or **move to g1t** (GitHub follows g1t
719on `git.push`). A mirror is a hosted repository that keeps a full copy, so
720its project stays `hosted` and deploys like any other; the tie lives in
721integrations' `github_repos`. Not yet: previews and statuses on GitHub's own
722pull requests, comments and pull requests copied, GitLab and Bitbucket.
723
724### People and search
725
726> **2026-10-04:** "pull up user profiles, using a /u/username prefix kinda
727> like DockerHub … search for users if you search that explicitly, how
728> GitHub has the aside for searching against filters … a significantly
729> stronger implementation."
730
731- **Profiles at `g1t.sh/u/<username>`**, apart from workspaces at
732 `g1t.sh/<workspace>`: who they are, their workspaces, recent work,
733 agents' sessions they steered.
734- **Search with a filter sidebar:** Projects, Code, Issues, Pull requests,
735 Users, Workspaces, each with its count; filters by workspace, language,
736 state, author, agent, label, date; qualifiers in the query
737 (`user:`, `is:open`, `agent:g1t`) as on GitHub. Typing `u/name`
738 searches people directly, as Docker Hub does.
739
7401 and 2 serve the competition directly (multi-agent coordination across
741projects is 25% of the score); 3 is the demo's best moment if time allows.
742
743## Billing model
744
745> **2026-10-04:** "Some things just require you to have a card on file …
746> some things will be something you give us an initial amount of money
747> per month just to activate, tons of things additionally will be usage
748> based, some things will just be usage based only … at minimum a
749> breakeven with Cloudflare costs, or in some cases a value add." Stripe
750> moves to Flagon, Inc. (g1t.sh is its product). Proposed below; the
751> prices are the user's to confirm.
752
753### Four kinds of charge
754
755Every feature is exactly one of these, and the Billing page says which:
756
757| Kind | What the workspace does | Example |
758| --- | --- | --- |
759| **Free** | Nothing | Hosting code, issues, pull requests, review, the merge queue, bringing your own agent over MCP |
760| **Card on file** | Adds a card; pays only for what it uses | Previews, g1t's agents, workflow minutes |
761| **Activation** | Turns a feature on for a monthly fee that includes an allowance; usage past it is metered | Production deployments, Security and quality |
762| **Usage only** | Nothing up front; every unit is metered | Model tokens, build minutes, storage past the free amount |
763
764A card is needed before anything that can cost money starts. Nothing is
765ever switched on without the workspace choosing it.
766
767### Postpaid, with spend limits
768
769- **One Stripe customer and one subscription per workspace**, on Flagon,
770 Inc.'s account. Activations are licensed line items; every usage
771 dimension is a metered price backed by a Stripe Meter. Stripe invoices
772 monthly in arrears and charges the card on file; failed payments go
773 through Stripe's retries and emails, and g1t hears of them by webhook.
774- **Spend limits instead of prepaid credit.** A workspace sets a monthly
775 limit overall and per feature (Vercel's spend management). g1t counts
776 usage as it happens and stops starting new paid work at the limit,
777 with a warning at 50%, 80% and 100%. Prepaid top-ups go away; promotions
778 (the free model allowance) become Stripe credit on the customer.
779- **Usage reaches Stripe from billing alone.** Every service reports
780 usage to the billing service as it happens (it already records agent
781 runs and builds); billing batches them into Stripe meter events every
782 few minutes, idempotently by g1t's own ids, and keeps the ledger g1t's
783 pages show. Nothing else talks to Stripe.
784
785### Scope: workspace, then projects
786
787- A feature is turned on for the **workspace** (by an owner, with the
788 activation if it has one), then allowed for **all projects** or
789 **selected projects**.
790- Every **project** can opt out on its own page. A project with nothing
791 to deploy (no Workers config, no build script, no `index.html`) is
792 detected, says so on its Deployments page, and never builds or costs
793 anything.
794- Agents and workflows are allowed per project the same way, so a
795 workspace can keep spend to the projects that matter.
796
797### Prices: what it costs us, passed through
798
799> **2026-10-04, decided:** postpaid with spend limits, as Vercel and
800> Cloudflare do; no per-seat price, ever ("fuck per-seat pricing").
801> "If they're barely using them great, but if they're using the shit out
802> of them that will cost me a ton, so that cost needs to move onto them."
803
804**Every Cloudflare cost a workspace causes is metered to it.** Light use
805fits in a small free allowance; past it, each unit is charged at
806Cloudflare's price times a margin of at least 1.5, which pays for Stripe
807(about 3%), shared overhead (the site, the API, D1) and g1t itself.
808
809Cloudflare's prices (October 2026), and the cost per unit g1t meters:
810
811| What g1t meters | Cloudflare's price | Cost to g1t per unit |
812| --- | --- | --- |
813| **Sandbox minute** (agents, checks, merge queue, workflow jobs, deploy builds), standard-1: ½ vCPU, 4 GiB, 8 GB | CPU $0.00002 / vCPU-s while busy; memory $0.0000025 / GiB-s and disk $0.00000007 / GB-s while running | ≤ $0.0012 / minute (CPU counted as busy throughout, since g1t cannot see it per sandbox) |
814| **App request** (deployments) | Workers for Platforms: $0.30 / million past 20M | $0.30 / million |
815| **App CPU** | $0.02 / million CPU-ms past 60M | $0.02 / million ms |
816| **App** (a deployed script) | $0.02 / script-month past 1,000 | $0.02 / app-month |
817| **Storage** (repositories, artifacts, caches) | Artifacts $0.50 / GB-month (billing starts 2026-10-14); KV $0.50 / GB-month | $0.50 / GB-month |
818| **Git operation** (clone, fetch, push) | Artifacts $0.15 / 1,000 past 10,000 | $0.15 / 1,000 |
819| **Model tokens** | The provider's price | As charged |
820| Container egress, emails, the site's own requests | Small and shared | In the margin |
821
822> **2026-10-06, decided:** no per-feature quotas on the plan. "A paying
823> user should be able to push past the Git operations number, they're
824> just paying usage on it." One plan, $20 a month per workspace with $10
825> of usage included; every meter is charged from the first unit at cost +
826> 20% (builds, app requests and CPU, custom domains), drawn from the $10
827> first, then up to the spend limit, which is the only thing that stops a
828> paying workspace (with abuse protection). Projects, previews and apps
829> are not metered (Workers for Platforms' script pool makes them ~free).
830> The forge's free amounts are the same for everyone: 1 GB private storage
831> and 50,000 git operations a month; past them the plan pays and a free
832> workspace is held (pushes stop, git slowed). The table below is the
833> earlier proposal; billing's price book and g1t.sh/pricing are current.
834
835What a workspace pays:
836
837| Meter | Free each month | Then | Margin | For comparison |
838| --- | --- | --- | --- | --- |
839| Sandbox minutes | None (2026-10-05: charged from the first second) | Cost + 20%, by the second | 1.2× | GitHub Actions $0.008 / minute (Linux 2-core); Vercel builds $0.0035 / CPU-minute |
840| App requests | 1 million with Deployments | $0.50 / million | 1.7× | Vercel $0.60 / million invocations |
841| App CPU | 3 million ms with Deployments | $0.04 / million ms | 2× | Vercel active CPU about $0.036 / million ms |
842| Apps | 10 with Deployments | $0.05 / app-month | 2.5× | |
843| Storage | 1 GB | $1.00 / GB-month | 2× | GitHub LFS $0.07 / GB, but repositories are free there |
844| Git operations | 10,000 | $0.30 / 1,000 | 2× | |
845| g1t's models | | Cost + 20% | 1.2× | The provider's own price |
846| Your own model provider | | Only its sandbox minutes (the $0.10 run fee was dropped 2026-10-05) | | |
847| **Deployments** activation | | $5 / month, with the allowances above | covers Workers for Platforms' $25 / month across workspaces | Vercel Pro $20 per seat |
848| **Security and quality** activation (later) | | $10 / month; fixes as agent usage | | GitHub Advanced Security $49 per committer |
849
850A workspace that uses g1t lightly (a few agent runs, a small site)
851pays nothing or its activation; a workspace running agents all day pays
852for the sandboxes and models those agents use, with g1t's margin on
853each. Nothing in a workspace's bill is subsidised by another's.
854
855### Build order
856
8571. Stripe customer per workspace and card on file (Checkout in setup
858 mode), webhooks (invoice paid and failed, subscription changes,
859 payment method changes), the Billing page rebuilt around the four
860 kinds.
8612. One subscription per workspace with activations as items; Deployments
862 moves onto it.
8633. Meters for each usage dimension above, fed from billing's ledger:
864 every sandbox reports how long it ran when it stops (agents, checks,
865 the queue, workflow jobs and deploy builds alike); deployments report
866 requests, CPU and apps; repos report storage and git operations. Spend
867 limits and their warnings; prepaid credit retired.
8684. Per-workspace allow-lists of projects for each feature, and per-project
869 opt-out; "nothing to deploy" detection.
8705. Turn off FREE_WHILE_BUILDING when the user says so. **Done 2026-10-05.**
871
872Shipped by 2026-10-05: sandbox seconds for every sandbox; the price book
873and its keeper (runs settled to AI Gateway's price every 15 minutes;
874Container and Workers costs checked against Cloudflare's billable usage
875and container analytics daily, with a public change log on
876g1t.sh/pricing); usage limits by trust with automatic payment near the
877limit; app traffic counted toward limits as it happens; billing accounts,
878terms and enterprises; free mode off, syntaqx comped.
879
880Still to build, in order: Stripe card-on-file without a payment (setup
881mode) and webhooks; month-end invoices for postpaid usage (and one
882invoice per enterprise); the subscription with activations as items;
883storage and git-operation meters; limit warnings by email at 50/80/100%;
884self-serve enterprise management for enterprise owners.
885
886### Accounts, terms and enterprises
887
888Every workspace is paid for by a billing account: its own (`ws_<slug>`)
889or an enterprise's (`ent_…`), which pays for several workspaces with one
890limit, one set of terms and, once invoices exist, one bill, as GitHub
891Enterprise does. Terms are standard, comped (nothing charged, usage still
892recorded at cost, paid features on) or custom (a discount, its own
893ceiling, an end date). g1t staff manage them in **sudo.g1t.sh**, a
894separate Worker behind Cloudflare Access that also verifies the Access
895token itself and allows only listed staff emails; every change is kept
896with who made it and why.
897
898### Limits: stop non-payers, never payers
899
900The limit is on usage not yet paid for, counted at cost to g1t or charge,
901whichever is more: $3 before any live payment, then twice what has been
902paid ($25 to $1,000), or what staff set. A workspace with a card on file
903is charged automatically near its limit, which both pays what it owes and
904raises the limit, so paying users are never stopped. A declined card
905stops work until paid. The owner's own spend limit always means stop.
906Test-mode payments never lower exposure or raise trust.
907
908## Agents and models
909
910### Defining an agent
911
912An agent is a file (`.g1t/agents/<name>.md`, or in the workspace library):
913instructions, the harness and model to run, the tools and MCP servers it may
914use, its sandbox image, permissions and budget. Agents take roles: planner,
915implementer, reviewer, conflict resolver, documenter, memory consolidator.
916Each role has a default that a repo can replace.
917
918### Where it runs, and on whose model
919
920| Option | How it works | Fits |
921| --- | --- | --- |
922| Hosted, g1t's model | g1t runs the sandbox and bills usage | Getting started; no keys to manage |
923| Hosted, your API key | Same sandbox, your Anthropic, OpenAI or Google key | Teams with existing contracts |
924| Hosted, your endpoint | Any OpenAI-compatible URL: Bedrock, Vertex, Azure, a self-hosted model | Private or fine-tuned models |
925| Your runner | A g1t runner daemon on your own machines picks up pull requests | Code or models that may not leave your network |
926| Your own session | Local Claude Code, Cursor or any MCP client joins through `mcp.g1t.sh` | Individuals; subscription plans |
927
928Decisions behind this:
929
930- **g1t does not build its own agent loop.** It runs existing harnesses
931 (Claude Code first, through its headless mode) behind a small runner
932 contract: a container image, an entry command, and session events reported
933 through the CLI. Other harnesses plug in by meeting the contract.
934- **All hosted model traffic goes through Cloudflare AI Gateway.** That gives
935 one place for spend tracking, budgets, rate limits, fallback and logs,
936 whichever provider or endpoint is behind it.
937- **Nobody picks a model.** A person assigns work to `g1t`, as they
938 would assign an issue to Copilot, and g1t routes it. Today the kind of
939 work decides (implementing, reviewing, catching up), from one setting on
940 the runner, and each request is tagged at the gateway with that kind, the
941 repository and the pull request. The session records which model ran.
942 The gateway's own dynamic routes cannot make the choice yet: they work
943 only on its OpenAI-compatible endpoint, and the harness speaks
944 Anthropic's.
945- **Subscriptions stay local.** A Claude subscription cannot be used by a
946 hosted sandbox; it needs an API key. People on subscriptions use their own
947 Claude Code session, which is a full participant.
948- **The workspace pays.** A workspace buys credit by card and each agent
949 run deducts what the model cost plus a margin. The billing service asks
950 nothing of the others: the runner asks it before starting a sandbox and
951 is refused when there is no credit, and the sandbox reports what its run
952 cost with a token only it holds. Where no card processor is configured
953 nothing is charged and agents stay limited to listed accounts.
954- **Keys are secrets.** Stored in Cloudflare Secrets Store, injected into the
955 sandbox for one pull request, never shown again.
956
957### Seeing a pull request through
958
959Assigning an issue is the only thing a person does until there is something
960to merge. A pull request made by g1t goes through checks, a review
961by another agent, revision when either finds something, and catching up
962when `main` moves, without anyone pressing a button. It ends as ready to
963merge, or as "needs you" with the reason: the checks still fail after two
964revisions, a review could not be written, or a conflict could not be
965resolved.
966
967The work service decides the next step from the pull request's state and
968claims it in one statement, so a step is taken once. The runner asks on
969every event that could change the answer (ready, pushed, checks finished,
970review finished, `main` moved), and on a five-minute sweep for anything
971missed, and carries the step out in a sandbox.
972
973A pull request does not have to be up to date with `main` to merge,
974unless the repository's settings require it, as on GitHub. Merging one that
975is behind brings it up to date first (a clean merge needs no model; an
976agent resolves a conflict) and lands it when that push arrives. With the
977requirement on, catching up is a step of its own and the checks run again
978on the result.
979
980Each repository sets its own rules, on one settings page: whether its
981default branch takes pushes at all, how many approvals a merge needs and
982whether an agent's counts, whether failed checks can be overridden, whether
983a second agent reviews, and how often an agent is sent back before a person
984is asked. A pull request g1t opens follows the same rules as anyone's.
985Pushes to a protected branch are refused in the git front end, with the
986reason shown by git beside the branch.
987
988Merging is a person's decision unless the repository says otherwise. With
989"merge automatically when ready" turned on in its settings, a ready pull
990request lands by itself, attributed to `g1t`. That is the whole path from
991an assigned issue to a commit on `main` with nobody in between. Required
992human approval per path, and risk tiers, are still to come.
993
994### Choosing the right agent automatically
995
996Because several agents can work on the same issue, every issue with more
997than one pull request is an evaluation on real work. g1t records, per repo and per kind of issue, each
998agent's win rate, cost and time. That produces a leaderboard, and a routing
999policy: send each new issue to the agent that wins that kind most often,
1000start with the cheapest that is good enough, and escalate to a stronger one
1001when checks fail.
1002
1003## Talking: the inbox and channels
1004
1005Not a discussions forum. People and agents need one place to talk in real
1006time, and an app that feels like one on desktop and phone.
1007
1008**The inbox comes first.** Everything that needs a person or that they
1009follow, from people and agents: review requests, agent questions and
1010handoffs, failures, mentions, deploys. Read and unread, saved, done,
1011snoozed; ranked so what an agent is blocked on comes first; email digests
1012and push. It is the delivery layer chat needs too (who is told what, read
1013state, push), so building it first makes channels cheap.
1014
1015**Channels** (working name): workspace channels, direct messages and
1016threads, live.
1017
1018- Each channel is a Durable Object holding its WebSocket connections with
1019 hibernation, so idle channels cost nothing; history in D1, files in R2.
1020- Agents are members. `@g1t` in a channel starts work, answers, or
1021 posts a summary; agents post their questions and handoffs where people
1022 already are. A thread becomes an issue or an outcome in one action, and
1023 the agent's progress streams into that thread.
1024- Tied to the work: issues, pull requests, runs and deploys each have a
1025 thread; links unfurl into live cards (checks, agent step, preview).
1026 What a channel settles can become workspace memory, with its source.
1027- Apps: an installable PWA first (desktop and mobile, offline shell, Web
1028 Push), then native shells on the same API: Tauri for desktop (tray,
1029 deep links), React Native for iOS and Android (background
1030 notifications).
1031
1032GitHub-style Discussions are not planned: channels and threads on the
1033work replace them.
1034
1035## What GitHub ships today, and where g1t differs
1036
1037GitHub's Agent HQ and Copilot app give each agent session its own git
1038worktree and branch, list sessions in a mission-control view grouped by
1039project, and let a task be assigned to several agents so their output can be
1040compared. Underneath, the unit of work is still a branch and a pull request.
1041
1042| | GitHub | g1t |
1043| --- | --- | --- |
1044| Where a session works | A worktree on one developer's machine, or a cloud sandbox | A server-side fork that any agent on any machine can join and anyone can open |
1045| Agent context | Lives in the app's session view | Stored with the repository and linked from each commit (why-blame) |
1046| Several agents on one task | Separate pull requests to compare by hand | One issue holding every pull request made for it, compared side by side, with the merged one recorded on the issue |
1047| Collisions between agents | Found as merge conflicts at the end | Flagged during the work (overlap radar) |
1048| Landing changes | One pull request at a time | A merge queue that lands the chosen one and closes the rest as superseded |
1049| Which agents | Those offered through a Copilot subscription | Any MCP client, plus hosted agents |
1050
1051## How agents connect
1052
10531. **Bring your own agent.** A remote MCP server at `mcp.g1t.sh` lets Claude
1054 Code (or any MCP client) list issues, claim one, get a clone URL and
1055 token, report progress and submit. Adding it is one command; sign-in is a
1056 browser OAuth flow with no token to paste. The `g1t` CLI installs Claude
1057 Code hooks that upload the session transcript as the agent works.
10582. **g1t's agent.** Assign an issue to g1t, or many issues at
1059 once, each to an agent of its own. g1t starts a sandbox for each
1060 (Cloudflare Containers), running a coding agent headless against its
1061 own pull request and fork.
10623. **API and CLI.** Everything above is available at `api.g1t.sh` and
1063 through `g1t`.
1064
1065## Public surfaces
1066
1067| Host | What it serves |
1068| --- | --- |
1069| `g1t.sh` | The site, git over HTTPS, git over SSH |
1070| `api.g1t.sh` | REST API, with no version in its paths, with a published OpenAPI document, cursor pagination, rate-limit headers, idempotency keys on writes, server-sent events for live pull request state, and signed webhooks |
1071| `mcp.g1t.sh` | Remote MCP server over streamable HTTP |
1072
1073g1t is its own OAuth 2.1 authorization server: authorization code with PKCE,
1074dynamic client registration that stores nothing (a client id encodes its
1075own registration, so the open endpoint cannot be used to fill a database),
1076discovery metadata and rotating refresh tokens. Still to come: scopes
1077per resource (`repo:read`, `repo:write`, `issue:write`, `pull:write`).
1078MCP clients, the CLI (device flow) and third-party apps all use it. Access
1079tokens and SSH keys remain for git itself.
1080
1081## Architecture
1082
1083| Component | Language | Runs on | Responsibility |
1084| --- | --- | --- | --- |
1085| `crates/contracts`, `packages/contracts` | Rust, TypeScript | — | The interface of every service, the event catalogue, shared types. Services and clients depend on this, never on each other's code. |
1086| `services/identity` | Rust | Worker + D1 | Accounts, workspaces and memberships, sessions, SSH keys, access tokens, device sign-in, OAuth codes and grants |
1087| `services/repos` | Rust | Worker + D1 + Artifacts | Repository registry, contents, forks, diffs, landing, git over HTTPS. Storage sits behind a `GitStore` port with an Artifacts adapter. |
1088| `services/work` | Rust | Worker + D1 | Issues, pull requests, comments, sessions; later a Durable Object per repo for the landing queue and live state |
1089| `services/billing` | Rust | Worker + D1 + Stripe | Each workspace's agent credit: payments, the ledger of every run, and the gate on starting one |
1090| `services/events` | Rust | Worker + Queues + D1 | The event bus: durable log, and one queue per subscribing service |
1091| `services/runner`, `crates/runner` | TypeScript, Rust | Worker + Containers | Starts a sandbox per g1t run; the program inside runs the agent harness and reports through the public API |
1092| `services/og` | TypeScript | Worker + Cache API | Social cards at `og.g1t.sh`: one PNG per page of the site and the docs (satori and resvg), looked up as an anonymous visitor, so nothing private appears on one |
1093| `apps/web` | TypeScript | Worker | Server-rendered site. Holds no data; calls services over RPC. |
1094| `apps/docs` | TypeScript | Worker (static) | Documentation and the API explorer |
1095| `apps/api` | Rust | Worker | REST API (`api.g1t.sh`), MCP server (`mcp.g1t.sh`) and OpenAPI document, all generated from one list of operations; the OAuth endpoints |
1096| `crates/sshd` | Rust | Container | Git over SSH, bridged to Artifacts |
1097| `crates/merged` | Rust | Container | Trial merges, conflict matrix, landing merges (needs real git; the Artifacts binding is read-only) |
1098| `crates/core` | Rust | native and WASM | pkt-line, packfile and diff code shared by the above and by the Worker |
1099| `crates/g1t` | Rust | user's machine | CLI: auth, SSH proxy, Claude Code hooks, issues and pull requests |
1100
1101Storage: Artifacts for repositories (one fork per pull request), D1 for accounts
1102and metadata, R2 for session transcripts and logs, Durable Object SQLite for
1103per-repo coordination state.
1104
1105How the services fit together:
1106
1107- **Each service is its own Worker with its own database.** It deploys,
1108 scales and fails on its own. Callers reach it through a typed RPC binding
1109 to the interface in `packages/contracts`.
1110- **Expected failures are values.** Every call returns a `Result`, so "not
1111 found" or "forbidden" crosses a service boundary as data.
1112- **Side effects travel as events.** A service publishes what happened
1113 (`git.push`, `issue.opened`, `pull.merged`, …) to the bus and does not
1114 call other services to react. Each subscriber consumes from its own queue.
1115 Timelines, webhooks and automations read the same stream, which is what
1116 lets something like GitHub Actions be built on top.
1117- **Every read takes the viewer.** Authorization is decided inside the
1118 service that owns the data, not by its callers.
1119
1120The Workers runtime scales request handling on its own, so the edge layer
1121stays in TypeScript. Rust is used where there is real computation or a real
1122protocol to implement.
1123
1124## Languages
1125
1126The site is TypeScript. Everything behind it is Rust, compiled to
1127WebAssembly for Workers and natively for containers and the CLI. Identity, repos, work, events and the API are all Rust. The one exception
1128is the Worker that starts sandboxes, because Cloudflare's Containers
1129library is TypeScript. Rust services speak a
1130small JSON protocol over service bindings (`POST /rpc/<method>`), with the
1131types in `crates/contracts`.
1132
1133## Identifiers
1134
1135Every id is a [TypeID](https://github.com/jetify-com/typeid): a prefix naming
1136the kind of thing, then a UUIDv7 in lowercase base32, such as
1137`pr_01jb2k7x9hfq0b3zj0f5s2m8ra`.
1138
1139- The prefix makes an id self-describing and stops ids of different kinds
1140 being mixed up.
1141- Ids sort by creation time as plain strings. In SQLite (D1 and Durable
1142 Objects) that keeps inserts at the end of the primary-key index instead of
1143 scattering them, and gives time-ordered paging for free.
1144- The suffix decodes to a standard UUIDv7 for any system that wants one.
1145- Ids are made by the service that creates the record, not by the database,
1146 so they work across services and can be assigned before a write.
1147
1148## Events at scale, and audit
1149
1150The current event log is a single D1 database. That is fine for a
1151prototype and wrong for the target: D1 is one writer and 10 GB. The design
1152for volume splits storage by how the data is read.
1153
1154| Tier | Store | Holds | Read by |
1155| --- | --- | --- | --- |
1156| Hot | A Durable Object per repository, with SQLite | Recent events for that repo | Timelines, live pages over WebSocket |
1157| Complete | Cloudflare Pipelines into R2 as Apache Iceberg | Every event, forever, partitioned by day and workspace | Analytics, standups, "ask", export |
1158| Audit | The same R2 store, under object lock | Who did what, from where, with which credential | Compliance, investigation |
1159
1160- **No single hot database.** Each repository's recent events live with that
1161 repository, so load spreads across as many objects as there are repos.
1162- **The complete record is files, not rows.** Iceberg on R2 has no practical
1163 size limit and is queried with SQL.
1164- **Audit is a property of every event.** The envelope carries the actor
1165 (person, agent, token or system), the credential used, the request id and
1166 the source address. Audit entries for a workspace are hash-chained, so a
1167 removed or altered entry is detectable, and are written under a retention
1168 lock.
1169- **Delivery is at least once.** Consumers are idempotent on the event id.
1170
1171## Accounts and forge basics
1172
1173- Registration with email verification, sign-in, forgot password (Cloudflare
1174 Email Sending), Turnstile on public forms.
1175- GitHub sign-in, SSH keys, access tokens, active sessions.
1176- Profiles, public and private repositories, repository search (D1 full-text).
1177- Rendered README, syntax highlighting, commit history, diffs.
1178- Transferring a repository between workspaces (by id: its git store key
1179 never moves; every service follows `repo.transferred`; old paths redirect
1180 until reused) and deleting an empty, settled workspace (its slug is
1181 tombstoned, never reissued except to the person whose username it is).
1182
1183## Built on Cloudflare
1184
1185| Need | Product |
1186| --- | --- |
1187| Repositories; a fork per pull request; data residency per workspace | Artifacts (forks, jurisdictions) |
1188| Reacting to pushes | Artifacts event subscriptions on Queues |
1189| Preview URL per pull request; deploy on merge | Workers for Platforms on `g1t.page` |
1190| Site, API, MCP, git front end | Workers |
1191| Per-repo coordination, live updates | Durable Objects |
1192| Pull request lifecycles, automations | Workflows, Cron Triggers |
1193| Agent sandboxes, SSH server, merge engine | Sandbox SDK and Containers |
1194| Fast starts on large repos | ArtifactFS |
1195| Model traffic, spend, budgets | AI Gateway |
1196| Summaries, embeddings | Workers AI |
1197| Context hub search | Vectorize |
1198| Accounts and metadata | D1 |
1199| Transcripts and logs | R2 |
1200| Email, bot protection, keys | Email Sending, Turnstile, Secrets Store |
1201
1202## Running g1t yourself
1203
1204g1t.sh runs on Cloudflare, and that does not change. The core is MIT and
1205must also run on anyone's own machine with `docker compose up`. A free
1206core people can self-host is what makes paid hosting worth trusting.
1207Self-hosting never makes hosted worse: hosted code paths keep their
1208behaviour, and a self-hosted adapter sits beside the hosted one. The
1209inventory of every Cloudflare dependency, the design and the risks are in
1210[SELF_HOSTING.md](SELF_HOSTING.md).
1211
1212The approach: the Workers stay Workers, and self-hosted they run in
1213workerd, the open-source Workers runtime. D1, KV and Queues are SQLite on a
1214volume, with the same migrations. Cloudflare-only bindings are replaced
1215by stand-ins:
1216
1217- Artifacts becomes bare repositories served by `git http-backend`;
1218- Email Sending becomes SMTP, through Mailpit;
1219- services that are off answer "off" instead of failing.
1220
1221| Phase | Scope | Estimate |
1222| --- | --- | --- |
1223| 1. Core forge | Done: `deploy/self-host/` (compose, git store, binding stand-ins, smoke test) and the "Run g1t yourself" guide. Left: the API on its own port, `PUBLIC_URL` in place of hard-coded hosts, cron, pull requests in the smoke test, CI that runs it. | 1–1.5 weeks left |
1224| 2. Agents | Docker sandboxes with the same runner image, an egress allow-list proxy for guardrails, `g1t.toml`, a launcher in place of `wrangler dev` | 2–3 weeks |
1225| 3. Search, context, deployments | sqlite-vec plus an OpenAI-compatible embedder; an app host on workerd; Caddy for app and custom domains; SSH | 3–4 weeks |
1226| 4. Parity and upgrades | Code-level ports in `g1t_kit` and `@g1t/platform`, sudo without Access, online backups, released images, an upgrade test in CI | 3–4 weeks |
1227
1228## The submission
1229
1230- **g1t is built on g1t.** This repository is hosted on g1t.sh, its features
1231 are opened as issues and built by racing agents, and it deploys from
1232 Artifacts through Workers Builds. The history is the proof.
1233- **The demo follows one story.** A brief becomes a project; twelve issues
1234 fan out to dozens of agents; agents notice each other, hand off, and
1235 resolve a conflict; reviewers triage; the queue lands everything on
1236 `main`; why-blame explains a line; the portfolio shows where it all
1237 stands. Then the same thing at a thousand agents.
1238- **Judges can try it in a minute.** Open registration on g1t.sh, one-click
1239 import of a GitHub repo, one command to connect Claude Code, a seeded demo
1240 workspace, and a single deploy command for running their own copy.
1241- **The formats are open.** The commit trailers, session format and runner
1242 contract are published so other tools can interoperate.
1243
1244## Build order
1245
1246What is left is ordered by how much it shows the point above, not by forge
1247parity. Forge basics are done well enough; each item below should make the
1248demo's story stronger.
1249
1250Done from this list: the outcome page (a plan's issues as a live graph with
1251cost and a feed of what happened), coordination you can see (agents' issues
1252and comments stand out in the feed; agents hold g1t's tools through a token
1253scoped to one repository), steering a running agent (messages delivered
1254between steps, and at the end), and recording sessions from anyone's own
1255Claude Code (`curl -fsSL https://g1t.sh/install/claude.sh | sh`). Integrations are
1256in: a workspace's own model provider (Anthropic or any Anthropic-compatible
1257endpoint, reached through a model proxy so no sandbox holds a key; its
1258runs pay only their sandbox time), alerts from Sentry, Datadog and signed webhooks
1259that open one issue per problem and can start an agent, and Jira and Linear
1260tickets that agents read, people import, and that hear back. Racing a
1261set number of agents on one issue is dropped: choosing how many agents to
1262use is not something people should have to do.
1263
12641. ~~**Handoffs and questions between agents** as states on the outcome
1265 page.~~ Done: questions and handoffs show as waiting, read, answered,
1266 taken on or declined; since 2026-10-03 an agent asked while it is not at
1267 work is woken to answer, where before the question waited forever.
12682. **Upkeep agents** (above): dependency updates, secret scanning,
1269 vulnerability alerts, code scanning, the security page. No new
1270 infrastructure.
12713. **Deployments on `g1t.page`** (above): previews per pull request,
1272 production on merge, the reviewer agent checking the preview.
12734. **The large run, building 2 and 3.** About 20–30 issues on g1t itself,
1274 built by agents and landed through the queue, for the video: g1t built
1275 on g1t.
12765. **Polish for judges trying it in a minute:** a seeded demo workspace, the
1277 empty states, and the first-run path from sign-up to an outcome landing.
1278
1279Earlier items still open, after those:
1280
12811. Deleting a branch once its pull request merges; approval rules per
1282 path; risk tiers.
12832. Scopes on OAuth grants and access tokens.
12843. Event storage per the design above: per-repo hot log, Iceberg on R2,
1285 hash-chained audit.
12864. CLI with Claude Code hooks to record sessions automatically.
12875. Reviewing and catching up automatically, by policy; required reviews;
1288 risk tiers.
12896. Compare view, proof bundles; handoff between agents.
12907. Projects, mission control, steering; why-blame, digest, timeline.
12918. Context hub, portfolio; automations and integrations (Sentry first).
12929. SSH; bot protection; own keys, endpoints and runners.
129310. Large run (100+ agents across many issues), hardening, demo.
1294
1295Later: code search, mirroring to GitHub, passkeys, SSH
1296on port 22 without the CLI proxy (needs the Workers inbound TCP private
1297beta).