PrimaChat
Stone, connect
Point a session at a git repository, in one of three ways, and keep the push credential off the browser.
Live Built and working today on the surface this card describes.
What it does
One route takes three shapes: a repository you bring, with an optional username and token; a repository created for you on our git host; or a working copy already on the machine running the server.
The local-path form is what makes a repository on the same machine connectable without a network round trip. It is also how the engrave path is tested.
The listing never returns a credential. It returns hasCredential, which says whether a push will authenticate, and writable, which is that or a local path.
A repository belonging to someone else is 404, not 403. The lookup happens in the caller's own registry, so another subject's repository genuinely is not found, and this route cannot be used to probe whether a repository id exists for anyone else.
Inputs and outputs
POST /api/stone/repos | {url, name?, branch?, username?, token?} · {create: true, name} · {path: "/abs/path"}. 201 with the repository record. |
|---|---|
GET /api/stone/repos | {repos, autocreate}. Each record carries id, name, url, branch, createdAt, lastSyncedAt, lastCommit, indexedAt, indexedChunks, fileCount, hosted, hasCredential and writable. |
DELETE /api/stone/repos/:id | Forgets the repository and removes its index. The working copy is deleted only if this server created it. |
| Credential | Stored server-side against the repository id. Never returned by any route. |
Configuration
PRIMA_LOCAL_REPO_ROOTS | Colon-separated allowlist for the local-path form. Empty by default, so that form is refused until an operator names a root. Matched against the resolved path, so .. cannot walk out of an allowed root. |
|---|---|
| Branch | Optional on connect. Taken from the repository when it is created for you. |
| Autocreate | Reported as autocreate on the listing. Whether creating a repository on our git host is available on this deployment. |
Limits
- Only text is read: files ending
.md,.markdown,.mdxor.txt. Dot-directories other than.claude, plusnode_modules,dist,build,.next,.astro,vendor,.venvand__pycache__are skipped, and a single file over 400,000 characters is left out of the index. - A working copy that has gone missing answers 409 with "sync again" rather than pretending the repository is empty.
- Per-tenant repositories on our own git host are decided and not yet built. Until they are, a created repository sits under a shared service account. See the Stone cloning card.
Example
connect a repository you already have
POST /api/stone/repos
Content-Type: application/json
{"url": "https://git.example.com/team/handbook.git",
"name": "handbook",
"username": "…",
"token": "…"} Source of truth
prima-chat/server/routes/stone.ts (the three shapes, publicRepo, the 404-not-403 rule, the local-root allowlist)prima-chat/server/wiki.ts (readable extensions, skipped directories, the 400,000-character cap)philosophers_stone/operations/decisions/0037-stone-per-tenant-forgejo-org-and-token.md (per-tenant repositories, decided, not built)