Skip to content
78 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Agents → Skills is the workspace's skill library in the open SKILL.md format: write a skill in g1t, import a SKILL.md or zip, link a repository whose .g1t/skills folders publish on every push, or save a finished session as a skill once a person reviews it; attach a skill to an agent, a team or the whole workspace, each attachment pinned to a version. Agents see each skill's name and when to use it, and read the rest with use_skill when a request needs it; a skill never adds a permission, and scripts wait for an agent's own computer. The agent skills guide says how.1-- The skill library (docs.g1t.sh/guides/agent-skills/): a workspace's own
2-- skills, each a SKILL.md folder (@g1t/contracts skill-format.ts), every
3-- change a new version, attached to agents, teams or the whole workspace.
4
5-- One row per skill: its newest version's summary, for lists. A draft
6-- (saved from a session) waits for a person to publish it and can't be
7-- attached. `mirrored` skills follow the repository in skill_mirrors.
8CREATE TABLE skills (
9 id TEXT PRIMARY KEY,
10 workspace_id TEXT NOT NULL,
11 name TEXT NOT NULL,
12 status TEXT NOT NULL DEFAULT 'published',
13 version INTEGER NOT NULL,
14 description TEXT NOT NULL,
15 tools TEXT NOT NULL DEFAULT '[]',
16 requires_computer INTEGER NOT NULL DEFAULT 0,
17 files INTEGER NOT NULL DEFAULT 0,
18 bytes INTEGER NOT NULL DEFAULT 0,
19 -- Where the newest version came from (SkillOrigin, JSON).
20 origin TEXT NOT NULL,
21 mirrored INTEGER NOT NULL DEFAULT 0,
22 created_by TEXT NOT NULL,
23 created_at TEXT NOT NULL,
24 updated_by TEXT NOT NULL,
25 updated_at TEXT NOT NULL,
26 archived_at TEXT
27);
28CREATE UNIQUE INDEX skills_name ON skills (workspace_id, name) WHERE archived_at IS NULL;
29
30-- Every version as written: SKILL.md and the folder's other files (JSON
31-- SkillFile[], text as it is and anything else as base64), at most 1 MB.
32-- `digest` tells an unchanged import or push from a new version.
33CREATE TABLE skill_versions (
34 skill_id TEXT NOT NULL,
35 version INTEGER NOT NULL,
36 description TEXT NOT NULL,
37 tools TEXT NOT NULL DEFAULT '[]',
38 requires_computer INTEGER NOT NULL DEFAULT 0,
39 skill_md TEXT NOT NULL,
40 files TEXT NOT NULL DEFAULT '[]',
41 bytes INTEGER NOT NULL,
42 origin TEXT NOT NULL,
43 note TEXT,
44 digest TEXT NOT NULL,
45 created_by TEXT NOT NULL,
46 created_at TEXT NOT NULL,
47 PRIMARY KEY (skill_id, version)
48);
49
50-- Where a skill is attached, and the version its agents use there.
51-- `target` is the agent's id, the team's slug, or '' for the workspace.
52CREATE TABLE skill_attachments (
53 id TEXT PRIMARY KEY,
54 workspace_id TEXT NOT NULL,
55 skill_id TEXT NOT NULL,
56 scope TEXT NOT NULL,
57 target TEXT NOT NULL DEFAULT '',
58 version INTEGER NOT NULL,
59 attached_by TEXT NOT NULL,
60 attached_at TEXT NOT NULL
61);
62CREATE UNIQUE INDEX skill_attachments_once ON skill_attachments (skill_id, scope, target);
63CREATE INDEX skill_attachments_reach ON skill_attachments (workspace_id, scope, target);
64
65-- The repository a workspace's library follows: `.g1t/skills/<name>/` on
66-- its default branch, read when it is linked and after every push there.
67CREATE TABLE skill_mirrors (
68 workspace_id TEXT PRIMARY KEY,
69 repo_id TEXT NOT NULL,
70 repo TEXT NOT NULL,
71 branch TEXT NOT NULL,
72 commit_sha TEXT,
73 synced_at TEXT,
74 error TEXT,
75 linked_by TEXT NOT NULL,
76 linked_at TEXT NOT NULL
77);
78CREATE INDEX skill_mirrors_repo ON skill_mirrors (repo_id);