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
58 linesCodeBlameRaw
1-- Subagents, what sessions touched, and the issues and pull requests they
2-- worked on (src/coordination/sessions.rs, links.rs).
3
4-- A subagent is a session of its own whose parent_id names the session
5-- that started it (a Claude Code subagent, a Managed Agents thread). It
6-- carries its kind, the task and prompt its parent gave it (cut short),
7-- and its result: its final message, which is its parent's evidence.
8ALTER TABLE sessions ADD COLUMN parent_id TEXT;
9ALTER TABLE sessions ADD COLUMN agent_type TEXT;
10ALTER TABLE sessions ADD COLUMN task TEXT;
11ALTER TABLE sessions ADD COLUMN prompt TEXT;
12ALTER TABLE sessions ADD COLUMN result TEXT;
13ALTER TABLE sessions ADD COLUMN model TEXT;
14-- When its recording was last announced as session.progressed, so that it
15-- is announced at most every few seconds.
16ALTER TABLE sessions ADD COLUMN progressed_at TEXT;
17CREATE INDEX sessions_by_parent ON sessions (parent_id) WHERE parent_id IS NOT NULL;
18
19-- What a session says it touched: files it wrote, commits it made, branches
20-- it pushed, pull requests it opened, issues it named. Once per session,
21-- kind and value; the first time it said so.
22CREATE TABLE session_touches (
23 session_id TEXT NOT NULL,
24 repo_id TEXT NOT NULL,
25 -- file, commit, branch, pull or issue.
26 kind TEXT NOT NULL,
27 value TEXT NOT NULL,
28 at TEXT NOT NULL,
29 PRIMARY KEY (session_id, kind, value)
30);
31CREATE INDEX session_touches_by_value ON session_touches (repo_id, kind, value);
32
33-- How a session is tied to an issue or pull request, one row per way:
34-- attached, claim, branch, commit, trailer, opened or ref. The issue and
35-- pull request pages list the sessions tied to them from here.
36CREATE TABLE session_links (
37 session_id TEXT NOT NULL,
38 repo_id TEXT NOT NULL,
39 -- issue or pull.
40 kind TEXT NOT NULL,
41 number INTEGER NOT NULL,
42 via TEXT NOT NULL,
43 at TEXT NOT NULL,
44 PRIMARY KEY (session_id, kind, number, via)
45);
46CREATE INDEX session_links_by_number ON session_links (repo_id, kind, number);
47
48-- Pairs of sessions announced as changing the same files
49-- (overlap.detected), lower id first: announced once.
50CREATE TABLE session_overlaps (
51 repo_id TEXT NOT NULL,
52 low TEXT NOT NULL,
53 high TEXT NOT NULL,
54 -- JSON array of the paths both touched when it was announced.
55 files TEXT NOT NULL,
56 noticed_at TEXT NOT NULL,
57 PRIMARY KEY (repo_id, low, high)
58);