midas as the git host — a design
Status: step 1 built (2026-11-27, session s874): new projects are hosted by
the hub (midas project create, docs/hub.md "Projects the hub hosts"), with the
landing rule on main, LFS uploads, and public pages, clones and archives.
Steps 2 to 4 done (2026-11-28, s885): the public pages, clones, archives and
LFS are at Forgejo's own paths (/<owner>/<name>), with a front page of the
public projects at / (and since s887 their map, docs/hub.md Map), served at garage44.eu. All twelve repositories were
moved in one go with midas hub import (Forgejo stopped first, its copies read
from disk; every branch and tag checked identical, 639 LFS objects, none
missing). Port 2222 is the hub's sshd and code.garage44.eu its proxy, so no URL
changed. Forgejo and its runner are stopped and disabled, their data kept in
/var/lib/forgejo; the nightly CI and mithril's test workflow went with them.
Renaming and deleting a hosted project were built 2026-11-28 (s899, docs/hub.md):
an agent renames, the person deletes on the page. What is below past step 1 is the design as it was proposed; reports from
outside, the reads without a checkout and branch hygiene are not built.
midas hosts the workspace's repositories itself, and Forgejo goes. midas does not become a forge. It keeps what agents and the one person steering them use, and drops the rest: issues, pull requests, wikis, stars, organisations, web editing and user accounts.
Why
Every new project waits on the person, and every landing goes through a server that midas cannot change:
cartopolis-agentis not an owner ofjeroen/*. It cannot create a repository there (s794: "token does not have … write:organization"), add the hub's mirror key (s487: 403 "should be an owner or a collaborator with admin"), or change a setting (s797). Each new project needs the person in Forgejo's web UI, and a missing key shows up only at the first deploy.- Registering a project is a hand edit of
/etc/midas/hub.confoverssh host sudo. It has more than 30 backups, one per session that changed it. - The hub already serves git to every node.
mirror.rskeeps a copy of each repository fetched from Forgejo with a deploy key, and an LFS cache in front of Forgejo's LFS. The origin is one hop away from where the work is. mainis not protected. That the gate ran is a convention of thefinish-branchscript, not something the server enforces.
What Forgejo actually does for the workspace (measured 2026-11-27, last 30 days unless noted):
| Use | Measure |
|---|---|
| Pushes | 2728 by cartopolis-agent, 20 by jeroen |
| Repositories | 12, all under jeroen; 9 public, 3 private (about-cartopolis, stembewijs, pinnacle-website) |
| LFS | 710 MB |
| Actions | cartopolis/ci.yml nightly (30 runs), mithril/test.yml on push (15) |
| Issues, pull requests | 0 issues; landing is a fast-forward, no pull request |
| API calls by sessions | 40 over every session since s448: reading files, keys, branches |
| Anonymous HTTPS | Cargo git = dependencies and a Bun tarball (/archive/<sha>.tar.gz) on jeroen/mithril |
| Web views | about 2,400 requests a week, mostly crawlers (57.141.0.0/24) |
What midas keeps
1. Repositories at the hub
Bare repositories in /srv/midas/git/<owner>/<name>.git, on the same disk as
the mirror they replace. A repository has an owner (the person), a visibility
(private or public) and a project: its gate, gate nodes, pre-land check, main
branch and deploy targets. Today these sit in hub.conf projects. They move to
a file the hub itself writes (/srv/midas/projects.json), changed through the
hub's API, with every change logged as an event. hub.conf keeps only the
machine's own settings.
2. Access by key, over the ssh login the hub already has
midas hub git, the authorized_keys command nodes already log in through,
learns to answer pushes too. Every key belongs to one of three principals:
| Who | Read | Push |
|---|---|---|
| The person's keys | everything | everything, including main, deleting branches and force pushes |
| Agent keys (the container, the Macs' editors) | everything | any branch except main; no force push to a branch another session holds |
| Nodes | their checkout's repository | nothing, as today |
A push to main from an agent key is accepted only from a landing. The pusher
must hold the turn to land (midas land take), the new main must be a
fast-forward, and the hub must have a gate pass on record for exactly that sha
(midas verified). Today all three are only conventions of the land script. In
this design they become the server's rule, so main is protected without a
person watching. The person's keys bypass the rule, as they do today.
The remote URL does not change. A small sshd on port 2222 with the user git
runs the same forced command, so ssh://git@code.garage44.eu:2222/jeroen/x.git
keeps working in every checkout, worktree and memory note.
3. One call makes a project
midas project create <name> (MCP project_create) does in one step everything
a new project needs today:
- makes the bare repository with an empty
main(or imports a given repo or bundle); - registers the project, with a gate if one is given;
- makes it visible to the session's worktree tooling (
project_add), and makes it public if asked.
Agents may create, configure and archive projects. Deleting a repository,
renaming one, and making a private one public go to the person as a card on
the page and happen only on their yes. These are the outward-facing or hard to
reverse actions. midas project set changes a project's gate, nodes or deploy
targets; it replaces the hand edits of hub.conf.
4. LFS in the same place
The hub's LFS cache becomes the store, under the same /srv/midas with its
backups. Agents push LFS objects over ssh (git-lfs-transfer, which mirror.rs
refuses today). Public repositories serve them over HTTPS. "LFS object must reach
Forgejo before the gate" stops being a step: the object is where the node reads
it.
5. Public read-only HTTPS
Kept, because builds depend on it. Caddy sends code.garage44.eu to the hub,
which serves for public repositories only, without a login:
- git's smart HTTP clone (
git http-backend), for Cargo'sgit =dependencies; /<owner>/<name>/archive/<sha>.tar.gz, for Bun's tarball dependency;- LFS downloads.
The paths stay as Forgejo had them, so no Cargo.toml or package.json
changes.
A browsable view (files, README, log, one commit's diff) is the part to decide. It costs a page of the existing web app. Who reads it today is mostly crawlers. See open question 1.
6. The hub knows every push itself
Pushes go through midas, so it no longer has to learn of them:
- no post-receive hook to install in Forgejo's directories;
- no mirror fetch every 20 s;
- no "the hub did not see the branch yet" at a gate.
The page's view of branches, of who changes what, and of what landed reads the repositories directly.
What is new for agent work
The part worth building beyond parity, each small:
- Reads without a checkout.
midas git show <repo>:<path>[@rev],midas git log,midas git grep <pattern> [--repo …]over every repository, as CLI and MCP tools. These replace theforgejo_apiraw-file calls and thecurl … archiveworkarounds (s708). A session can read another project's code before deciding toproject_addit. - Branch hygiene by itself. A
session/*branch is deleted when its session is finished and its work is onmain. An unmerged one is listed on the page with its session. Today branches pile up until someone deletes them through the API. - Refusals at push time, not at the gate. A pushed file that looks like a
secret (a private key, a token by its known prefixes, a
.env), or a binary over 1 MB not tracked by LFS, is refused with the path and the reason. "No secrets or private info in repos" then has a guard, not only a memory note. - Scheduled gates replace Actions. Cartopolis's nightly
ci.ymlbecomes a hub timer that runs the project's gate onmainon a node (midas run). Its result goes on the page, and a red one becomes a note to the next session in that project. Mithril'stest.ymlis its gate.forgejo-runnergoes. The Forgejo deploy workflows were the fallback for when midas is down; after this, midas being down means git is down too (see Risks), so they go with Forgejo.
Reports from outside, with no free text
People outside the workspace can report a problem with a public project after signing in with GitHub. Agents act on those reports, and an agent that reads a stranger's text can be steered by it (prompt injection). So a report holds no text anyone typed: every field is a choice from a list the project defines, and the hub refuses any value that is not on it.
Signing in. GitHub OAuth, through a GitHub OAuth app the person registers
once (its client id and secret go to the hub with midas await --secret). A
reporter is a principal of a fourth kind, visitor, who may only file
reports, add "me too" and follow their own reports. midas keeps no password and
asks GitHub only for identity (no scopes). Accounts younger than 30 days, and
more than five reports a day from one account, are refused, against spam.
A report is a record of choices:
| Field | Values |
|---|---|
| project | the public projects |
| what | broken · missing · slow · looks wrong |
| area | the project's own list, e.g. Cartopolis: map, buildings, chat, calls, sign-in, Android app, web app |
| platform | Android · web · desktop · iOS |
| version | the project's released versions, newest first, or "don't know" |
| how often | every time · sometimes · once |
| how bad | I cannot go on · it gets in the way · it only looks wrong |
| where (optional) | a point on the map, as numbers, for map projects |
| crash report (optional) | an id the app shows after a crash; the hub looks up the report the app itself sent, so the reporter types only an id that must exist |
There is no title, no description, no comments and no picture. A picture can carry text too.
The same report twice is one report. A report whose project, what, area and platform match an open one adds to its count ("3 people, Android, 1.4.2 and 1.4.3"). The count is what a session weighs.
What each side sees:
- Agents see the record, its count and its crash reports. A reporter is an opaque number, never the GitHub name: even a name is a string someone else chose.
- The person also sees the names.
- Reporters see their reports, the count, and a status from a fixed list: seen · planned · fixed in a version · won't fix.
There is no conversation. A report that needs words gets them from the person, who can turn it into a session in their own words.
Into the work. A new report, or one whose count grows, is a note to the project's next session and a line on the page. With the autopilot on, a scheduled template can start a session for reports above a count. The session's brief is built from the record by midas, never from a reporter's string.
What midas does not do
There are no free-text issues, pull requests, reviews, wikis, releases pages, stars, forks, organisations, teams, web editor, webhooks to third parties, mirroring to other forges or user accounts with passwords. A principal is a key, or a GitHub sign-in for a visitor. If one of these turns out to be needed, it is added for the use that needs it.
Moving over
The steps, each of which can be undone until Forgejo goes:
- New projects first.
project_createmakes them at the hub. Forgejo keeps the existing twelve. This alone answers "a new project needs no hand work". - One repository, then the rest. Make Forgejo's copy read-only,
git clone --mirrorit with its LFS objects into the hub, switch the hub to serve it as the origin, and check a push, a gate and a deploy. Start with a small one (fienorwakamonth), thenmithril(public HTTPS dependencies), thencartopolisandmidas. - Port 2222 and HTTPS. Point them at midas once every repository is moved. The URLs do not change.
- Forgejo stays read-only for a month, with a full dump, then goes:
forgejo.service,forgejo-runner.service, its database and its 710 MB of LFS. Removing it is a data deletion on a production box, so it waits for the person's go.
Risks
- One machine for git and the workshop. Forgejo is on the same VPS today, so
the failure domain does not grow, but git now also depends on the hub's
process. Mitigations:
- the forced command serves reads and writes without the hub's HTTP service
(plain
git-upload-pack/git-receive-packon the bare repository, with the landing rule read from the hub's state file); - a nightly
git bundleof every repository and a copy of its LFS objects go off the machine (open question 2).
- the forced command serves reads and writes without the hub's HTTP service
(plain
- Bugs in access rules are security bugs. The rules stay few, as above, with
tests for each refusal. Anonymous access is read-only and public-only, served
by
git http-backend, not by our own protocol code. - Hosts outside the workspace (the Macs, the deck) reach port 2222 as today. Nothing on their side changes.
Open questions for the person
A browsable web view of public repositories— decided 2026-11-27: public repositories are visible (files, README, log); private ones are not, to anyone outside the workspace.- Where the off-machine backup goes: another machine of yours (the mini), or storage you name.
- Forgejo after the move: a month read-only and then removed, or kept longer as an archive.
- Each project's lists for reports (areas, versions): written by its sessions in the project's settings, or only by you.