interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / docs / AGENT-DOOR.md

164 lines · 13479 bytes Raw Blame History Rendered
1# The agent door: agents.json, the event stream, the feed
2
3Owner: AgentDoor (2026-11-14). Code: `server/agents.om` and `server/agents.tsv` (the address list),
4`door/` (the stream and the feed; names `ev*`, globals `gev*`, texts `tev*`), `server/nodoor.om` (the
5seam). Schemas: `interplane/agents/1` and `interplane/events/1` in `docs/API.md`. Gate:
6`server/tests/agentdoor.sh` (with `server/tests/agentdoor.py`). Status: HOST_TESTED, not deployed.
7
8Read-only. Nothing here writes to Radicle, git or the social log, and nothing changes sign-in.
9
10## The three addresses
11
12| Address | What it is |
13|---|---|
14| `<base>agents.json` | The document an agent reads first: every machine-readable address the forge answers, as a path template, with how to ask for JSON (`.json` name, `Accept` header, or always), the schema it answers, whether it needs a browser session, and one line of purpose. Also the plain-text form (`format=text`), the error schema `forge/error/1`, the event stream, and a `not_available` list (writes over HTTP without a browser session, an MCP server, git over this HTTP server, webhooks, an HTML `/agents` page) so agents stop guessing. |
15| `<base>events.json?after=<seq>&limit=<n>` | The public activity of the forge as one append-only stream, oldest first. Also `<base>events` and `<base>feed` with `Accept: application/json`; `<base>events` without it redirects to the feed. `after` is exclusive; `limit` is 50 by default and 200 at most (a larger one is answered with 200 and `limited: true`); `next` is the address to read next. An `ETag` lets a poller send `If-None-Match` and get `304` while nothing changed. |
16| `<base>feed` | The same stream for people: newest first, 50 a page, older pages with `?before=<seq>`, one plain sentence each ("fixdev proposed a change to hop: <title>", "hop: 3 new commits on main", "someone starred omega-mv"), each naming who did it with a link to their page and linking the thing. `?format=text` is its plain-text form; its `<link rel="alternate" type="application/json">` is `<base>events.json`; "Feed" is in the forge row of every page. |
17
18`/agents` is not claimed: interplane.io serves the static `/agents/` page of the site first (nginx
19`try_files $uri $uri/ @forged`), so only `agents.json` is the forge's.
20
21## The list cannot drift
22
23`server/agents.tsv` is the one table (method, path template, how to ask for JSON, schema, auth, doc,
24purpose; rows whose first field is `none` are the `not_available` list). `./run.sh units` (every build)
25compiles it into `.build/agents.om` as one text, refusing a byte that is not printable ASCII or tab, a
26quote or a backslash. `server/tests/agentdoor.sh` fetches every row under both bases with the template
27filled from its fixture and checks the schema the address answers, checks that every `## ` schema
28heading of `docs/API.md` is a row and that every row's schema is written in the file its `doc` column
29names; a row with a wrong schema makes it fail (negative control `broken-row`).
30
31## Kinds
32
33Only from records that exist, each with the object it was read from as `source`:
34
35| Kind | Read from | `source` | `time` |
36|---|---|---|---|
37| `patch_opened`, `issue_opened` | the COB (collab `coload`) | the COB id | the root change's author time |
38| `patch_revised` | a revision after the first | the change commit | its author time |
39| `patch_merged` | a merge action | the change commit | its author time |
40| `patch_archived`, `issue_closed` | the lifecycle action in force (`gclfc`) | the change commit | its author time |
41| `review` (`verdict` accept or reject) | a review action | the change commit | its author time |
42| `comment` | a patch or issue comment (not the issue's opening text, not a redacted one) | the change commit | its author time |
43| `release` | a tag, at the storage root or in the delegate's namespace | the tag object (or the commit of a light tag) | the tag date |
44| `branch_moved` (`from`, `commits`) | the default branch moving from one head to another | the new head | its committer date |
45| `star` | a `star` line of the social log, of a public repository | `social.log:<seq>` | the line's `ts` |
46| `follow` (`target`) | a `follow` line of the social log | `social.log:<seq>` | the line's `ts` |
47| `open_brought`, `open_withdrawn` | a `held`/`stored` or `withdrawn` row of `<data>open/list.tsv` | `open/list.tsv:<rid>@<day>` | the row's day, 00:00 UTC (the list keeps the day only) |
48
49One event per kind and change: two comments in one change are one event. Several states between two
50reads of a COB are seen as the last one (an archive undone before the next read is not an event).
51
52Never an event: favorites (private), unstar, watch, unwatch, unfollow, account, name, session and logout
53lines; anything about a repository that is not on the public allow-list (a private one, a name or RID
54refused by `server/repos.om` fdeny); the refused RIDs on the open shelf. An event whose repository
55leaves the allow-list later is no longer shown (its `seq` stays used).
56
57## Storage
58
59`<data>events/log`, one line an event, tab-separated: seq, time, kind, actor, rid, source, path, json,
60x, subject, prev, where prev is the hex sha256 of the previous line (64 zeros for line 1), the same
61chain as `social.log`. It is read and checked once after a start; a line that does not check switches
62the stream off (`503`, `EVENTS-LOG TAMPER` on stderr) and nothing is appended to it. `seq` is the line
63number, so it is stable across restarts and never reused. `<data>events/r/<rid>` is the last ref list
64read of each repository (written to `.tmp`, then renamed). An event is appended once: its key (kind,
65rid, source, x) is checked against every line already in the log. Account names are not stored: the
66stream shows the name an account has when it is read.
67
68## The trigger: change-triggered, never a clock, never a full rescan per request
69
70forged serves one request at a time, so collection runs inside the request that needs it: before
71`events.json`, `events` or `feed` is answered, `evcollect` compares cheap fingerprints with the ones of
72the last pass and reads only what moved:
73
74- the social log: its size (stat). New bytes are read from where the last pass stopped, with the social
75 slice's own line parser.
76- the open shelf: the change time and size of `<data>open/list.tsv`.
77- each public repository: the change times of `refs/heads`, `refs/tags`, `packed-refs`,
78 `refs/namespaces`, `refs/rad` and every `refs/namespaces/<node>/refs/rad` folder (Radicle renames a
79 new `sigrefs` into the node's `refs/rad` at every ref update of that node, COB changes included; git
80 renames into `refs/heads` and `refs/tags`). When they moved: one `git for-each-ref` of the default
81 branch, the tags and the patch and issue COB refs, compared line by line with the last list; only the
82 COBs whose tip moved are loaded.
83
84Why this trigger: the sources are files that change only when someone acts; a stat of each is cheap
85and needs no other process. A timer would run when nobody reads; a rescan per request would load every
86COB of every repository each time; a hook in the node or the social writer would put this slice inside
87code it does not own (the social log is written by forged itself, but the Radicle storage is written by
88the node and `git push`). Nothing runs when nobody reads the stream; the first read after a change pays
89for that change only. A start reads every repository's ref list once (fingerprints live in memory) and
90appends nothing new.
91
92## Store-reading build
93
94The store-reading build (`FORGE_STORE`, interplane-native DESIGN.md step 2) serves every public line
95of the store's `catalog.tsv` less the deny list (there is no separate served list since 2026-11-14)
96and composes `door/` with `store/evcol.om` in place of `door/ev3col.om` (which reads Radicle refs and
97COBs); it needs `social/` only. Its collector reads the store: per served project, its own catalog
98line (id, branch, head), and the change times and sizes of `repo.git/refs/heads`,
99`repo.git/refs/tags`, `repo.git/packed-refs` and `chain.tsv`; a moved project gets one
100`git for-each-ref` of its default branch and its tags, compared with its snapshot. The catalog file's
101own stat is not in any fingerprint: `ipl` rewrites `catalog.tsv` on every landing, and with it in
102every fingerprint each landing made the next request read every served project. A landing changes
103its project's line (head) and refs, so it costs that one project's read; a project added, removed or
104replaced, or rows moved by a reload, give the row another key or id, so it is read; a catalog
105rewritten with the same lines reads nothing. Kinds: `branch_moved` (old and new head, commit count;
106source `chain.tsv:<N>`, the LAND or IMPORT record of that branch whose payload says `new <head>`, and
107its time, or `repo.git:<sha>` and the commit time when no record names the move), `release` (a tag
108created or moved, source `repo.git:<sha>`), `star` and `follow` (`social.log:<seq>`). The patch, issue
109and open-shelf kinds never occur: their slices are seams in this build, and `agents.json` lists their
110addresses under `not_available` (generated from the build's units, `run.sh agentsgen`). The feed's
111first lines name only these kinds. Gate: `store/tests/agentdoor-store.sh` (two served projects: a
112landing reads one source; the same catalog rewritten reads none; an added project is read once).
113
114The parts this build composes out while they move to the new Interplane store (the Salvage Yard,
115Community Machines, Open builds, trending) answer `503` with no `Retry-After` and the text "This part
116is moving to the new Interplane store and is not available yet." (`forge/error/1` with
117`"reason":"moving"` to a JSON request; docs/API.md "Parts moving to the new Interplane store" lists
118the addresses). `agents.json` names them under `not_available`: their rows (`open.json`,
119`open/{project}.json`, `open/alarms.json`, `trending.json`) say "moving to the new Interplane store"
120and that the address answers 503, and two rows `salvage/` and `community/` name those parts, which
121have no machine-readable row of their own. The growth rows that are not moving addresses
122(`explore?order=`, `insights`) say they answer 404 or without their schema.
123
124A build that composes neither (no `social/`, or the Radicle build without `collab/`) gets the seam
125`server/nodoor.om`: `events.json`, `events` and `feed` answer `501` (`forge/error/1` for `events.json`),
126the forge row has no Feed entry, and `agents.json` moves those three addresses to `not_available`.
127Chosen over an empty stream because an empty stream would say "nothing happened" when the truth is
128"not built here".
129
130## Measured costs
131
132MEASURED on the Spark, 2026-11-14 15:03Z, build of `a37cb7bc` (pinned omc `3ad9f10f...3194`), cores
13316-18 at nice 10 while the machine carried other lanes (load about 17), by `server/tests/agentdoor.sh`
134(log sha256 `7466ed88ad31621021b830b7c2a42846bf0d07f4e80121ab86598ddc45327ffe`, in
135`~/work/hive/agent-door/ev-a37cb7b/logs/agentdoor.log`). Client: `curl` `time_total`, one request at a
136time. Pass times are forged's own stderr line (`events: pass <us> us, sources read <n>, events added <n>`).
137The ranges below are the smallest and largest sample; no other statistic was computed.
138
139| What | Data | Measured |
140|---|---|---|
141| `events.json?limit=200`, nothing changed (fingerprints only, no pass) | fixture, 19 events | 20 requests: 0.362 ms to 3.053 ms |
142| `events.json?limit=200`, nothing changed | live-sized: the 50 public repositories of the real storage and allow-list (read-only), copies of the real social log and open list; 1,318 events | 20 requests: 2.654 ms to 5.316 ms |
143| `feed`, nothing changed | live-sized | 5 requests: 1.943 ms to 17.737 ms |
144| first pass (backfill: every source read, every changed COB loaded) | fixture: 3 sources, 17 events | 67.5 ms |
145| one repository changed (main moved by 2 commits) | fixture | 23.2 ms, 1 source read, 1 event |
146| one COB changed (an issue comment after a restart) | fixture | 34.4 ms, 1 source read, 1 event |
147| first pass after a restart, nothing new (fingerprints are in memory, so every ref list is read once and compared) | fixture / live-sized | 15.2 ms / 517.5 ms (52 sources: the social log, the open list, 50 repositories; 0 events) |
148| first pass ever (backfill) | live-sized | 11.06 s (52 sources, 1,318 events); an earlier run the same day on the same data took 6.87 s |
149| the log and the snapshots | live-sized | 1,318 lines, 550,559 bytes; `events/r/` 125,794 bytes |
150
151The cost that matters is the backfill: forged is sequential, so the first stream request after the first
152deploy holds every other request for about 7 to 11 seconds on today's data, once. After that, a pass
153reads only what changed; a restart costs about half a second once. Live-sized backfill kinds: 598
154patch_opened, 516 patch_merged, 47 patch_revised, 2 patch_archived, 8 issue_opened, 10 comment, 66
155release, 1 star, 69 open_brought, 1 open_withdrawn; no COB failed to load.
156
157## Not done
158
159- Signed agent writes (work units Ask, Claim, Attempt, Landing): design only, back to Drake first.
160- A per-reader feed (only the accounts you follow): the feed is the whole public stream.
161- RSS or Atom of the stream.
162- The feed is not part of the edge smoke test (`infra/smoke.sh`); it is not deployed.
163- The backfill is not spread over several requests: the first read after the first deploy pays it whole
164 (above). Running one stream request by hand right after the deploy keeps visitors from paying it.