~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

The docs are written fresh from the code, and say nothing of where it came from

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:docs/fresh
.claude/skills/docs/context.mdnew+59−0
@@ -0,0 +1,59 @@
# Context to give a writer
Copy what the page needs into its context file. Give only the glossary
terms its facts use: a writer given more atproto than that teaches the
protocol instead of the page.
## The group host in three lines
- A group is an atproto account of its own, with no password and no one
person behind it. This host is its PDS, the authority for its private
spaces, and its OAuth server.
- Members keep their own accounts on their own PDSes, anywhere. What a
member may do in a group is what their roles there grant, and an app or
assistant a member signs in gets what those roles allow and nothing more.
- The host is one Rust server over SQLite, with a console (a SvelteKit
app) where people start and run groups and approve apps, and a command,
`opensocial`, that does the same from a terminal.
## The reader
Someone who knows atproto roughly: accounts keep records in repos on a
server called a PDS, and are named by DIDs and handles. They are running
a group host, building an app that talks to one, or changing this one.
They do not know the permissioned-data spaces in detail. Explain a term
the first time it matters, in a clause, and link to https://atproto.com
for more.
## Glossary
- **PDS**: the server that holds an account's repo and blobs, and signs
its commits.
- **DID**: an account's permanent ID (`did:plc:…`, or `did:web:…`). A
**handle** is a changeable name that resolves to it. A **PLC
operation** changes a `did:plc` document, signed by a **rotation key**.
- **record / collection / rkey**: a JSON document in a collection (an
NSID such as `fyi.opensocial.rule`) in an account's repo, addressed by a
key.
- **blob**: binary data stored beside records (an avatar, a file).
- **space**: a private record store from atproto's permissioned-data
alpha. Each member writes their records in their own repo in the space,
on their own PDS; the space's **authority** decides who may read and
write, and gives readers **credentials**.
- **service auth**: a short-lived token an account's PDS signs for
calling another service as that account (`aud` the service, `lxm` the
method).
- **OAuth / DPoP**: atproto's OAuth, where a client signs in to an
account at its authorization server; DPoP binds each token to a key the
client holds.
- **lexicon**: the schema for a record or method (`lexicons/fyi/opensocial/`).
- **label**: a moderation tag on a record or account.
- **MCP**: the protocol an AI assistant uses to call tools on a server.
## Pages to link
Design: `README.md` (overview), `spaces.md`, `groups.md`,
`membership.md`, `signing-in.md`, `moderation.md`, `assistants.md`,
`recovery.md`, `moving.md`. Reference: `../reference/api.md`, `mcp.md`,
`cli.md`, `config.md`. `../development.md`. Link to them rather than
restating them.
.claude/skills/docs/questions.mdnew+155−0
@@ -0,0 +1,155 @@
# The questions each design page answers
In roughly the order a reader asks them. Start a page's context from its
list, and add what the facts raise. A page with no list here gets one
written the same way: what the thing is, what problems shape it, then
one question per mechanism.
## README.md (the overview)
1. What is a group host, and what does it do for a group that a PDS does
for a person?
2. What are its pieces: the server, the console, the command, the MCP
server, the atproto primitives, the lexicons?
3. Where does each kind of data live: the group's repo, its spaces, the
members' own repos, the host's database?
4. Which design page answers what?
5. What is built, and what comes next?
## spaces.md
1. What is a space, and what does a group keep in one?
2. Who writes where: the group's own repo in a space, and each member's?
3. How does the host act as a space's authority: who may read, who may
write, how credentials are given and revoked?
4. How does it learn of writes, and keep an index of what is in a space?
5. How does it read the records and files of members on other PDSes, and
whom does it trust for their identities?
6. How does a page or an app read a space through the host?
7. What spaces does a group start with (meta and members), and what is
in each? How are spaces created and deleted?
8. What is the access record, and how does it decide who reads and
writes?
9. What happens when a space or a group is deleted, and what stays on
members' PDSes?
10. When are credentials revoked, and how long does one last?
11. What does the host do in spaces it is not the authority for: invites
in a person's inbox, and checkUserAccess?
12. Who may see a space's images, through /img and getSpaceBlob?
13. What happens to a group's spaces while it is switched off?
## groups.md
1. What is a group, as an account, and what does starting one make?
2. What decides who may do what in it?
3. What may someone outside, or inside, see of it?
4. How are its profile, rules and pictures changed?
5. What other spaces can it have, and who decides who reads them?
6. How does it get a handle on a domain of its own?
7. How is it switched off, on, and deleted, and what is left after?
8. How do people find a group: its declaration, listGroups,
getActorGroups, and what a hidden group still shows?
9. What is a group's address, as distinct from its handle, and how is a
free one found?
10. What does the host keep of a group outside its records?
11. What becomes of a deleted group's DID when a steward holds a
recovery key?
## membership.md
1. What is a role, and what does it grant?
2. What makes someone a member, and where is that recorded?
3. How does someone join: open, by approval, by invite?
4. How are invites delivered, seen, declined and revoked?
5. What happens when a member leaves or is put out, to their access and
to what they connected?
6. Where is membership recorded (the members space: membership, role and
permissions records), and what does each hold?
7. What does putting someone out take with them: credentials, the OAuth
grants they approved, their assistants, their app passwords and
sessions?
8. How long does the host keep trying to deliver an invite to someone's
inbox?
9. What do the default roles do, on joining and on admitting?
## signing-in.md
1. Who signs in to what: a person to the console, an app as a group, an
assistant as a member?
2. How does the console sign people in, and what does it keep?
3. How does an app sign in as a group, when a group has no password?
4. Who approves, and what does the app then get?
5. What may a token do, and how is that checked on each call?
6. How are tokens listed and revoked, by the group and by its members?
7. What are app passwords for, and what may they not do?
8. How does an app start a group and sign in to it at once
(provisioning)?
9. How does an app's own session differ from a person's service auth
when calling the host's methods (cookie vs service auth vs group
token), and which methods take which?
10. What does a grant's lifetime look like end to end: request (5 min),
code (60 s), access (1 h / 2 h / 15 min), grant (14 / 90 days,
sliding), and when is each forgotten?
11. What is the group's activity log, who sees it, and what does (and
doesn't) it record?
12. What happens to an app's tokens when the group is switched off
(tokens still refresh; writes refused; getSession says
`deactivated`)?
13. How do assistant grants relate to group grants: separate server,
separate table, not in `listGroupTokens` — where does the reader go
to see them?
14. What may a confidential client vs a public client do differently
(lifetime; same-key rule; native clients must be public)?
15. How does an app find this host's authorization server for a group
(resource metadata at PUBLIC_URL; the group's DID document naming
this PDS)?
16. Why are nonces stateless and tokens opaque-but-stored (the trade-off
between checking without storage and revoking at once)?
## moderation.md
1. Who moderates a group, and with what permissions?
2. What is a label, where is it written, and what does it do?
3. What is in the queue, and how is a subject resolved or escalated?
4. Who may report, and what becomes of a report?
5. What does a label do once written: which values the host acts on, and
which are left to apps?
6. How does a role get moderation permissions, and what do the roles a
group starts with hold?
7. What happens to the queue when a group is deleted?
## assistants.md
1. What is an assistant, and what may it do in a group?
2. How does it connect and sign in, and how is that kept apart from apps
signing in as a group?
3. What are its tools, and how is each call decided?
4. How does a member see and disconnect one?
5. How long do an assistant's tokens last, and what ends a connection?
## recovery.md
1. What could go wrong with a group's identity if the host failed or
misbehaved?
2. What is a recovery key, and what may its holder do that the host
cannot undo?
3. How are keys added, listed and removed?
4. What happens to recovery keys when a group moves to another host, and
when it is deleted?
## moving.md
1. Why would a group move to another host, and what has to move with it?
2. What are the steps, on each host, and what makes each safe?
3. How does an existing account become a group here, and what of it
comes along: its repo, its handle, its spaces?
4. How is that done from the console, and from the command?
5. What happens when the host itself changes its address?
6. What must still be true for a move to start (the host still holds a
rotation key)?
7. What does the new host do once the group is switched on: telling
relays, reading each space again for the index?
8. What becomes of the group on the host it left?
9. What if the group's address is taken on the new host?
10. Which moves can be done from the console, and which only with the
command?
.claude/skills/docs/SKILL.mdnew+86−0
@@ -0,0 +1,86 @@
---
name: docs
description: Write, rewrite or check a page of the group host's docs (docs/, README.md) against the code. Use when a change alters what a doc page says, when asked to write or rewrite a page, or to audit pages for drift. Facts come from the code first; the page is then written from the reader's questions, never by editing old prose.
---
# Writing the group host's docs
Rewriting a page by editing it keeps its shape and its mistakes. These
pages are written from facts instead: gather what the code does, decide
what the reader asks, and write the page fresh with no old prose in view.
Then check it against the facts.
`docs/` is a small wiki, one kind of page per directory:
- `docs/design/`: why it works the way it does. One mechanism per page,
each explained as the answer to a problem.
- `docs/reference/`: every route, method, tool, command and variable, to
look up.
- `docs/development.md`: building, testing and the checks.
The map from code to pages is in AGENTS.md, under Docs. The pages are
also a site (`docs-site/`); a new page goes in its sidebar.
The docs describe this host as it is. They never compare it with another
implementation or say where an idea came from.
## Which job
- A small change to what a page says (a new method, a changed limit):
edit the page and the reference that lists it, in the pull that makes
the change. Check the edit against the code it describes. Steps 1 and 4
below are enough.
- A page to write or rewrite: all four steps.
- An audit (are these pages still true?): steps 1 and 4 for each page,
then fix what is wrong, or file an issue when the code is what's wrong.
## 1. Facts
Have an agent read the code the page covers, and the page as it stands,
and write a fact inventory to a scratch file. Each fact is one line,
tagged:
- `[code]` read in the code (name the file and function)
- `[doc]` said by a page, not found in the code
- `[both]`
- `[DOC WRONG]` a page says something the code contradicts: give both
A section headed Quirks lists what looks like a bug, with file and line.
Those are filed as issues (`knotless issue create`), not written up as
design. Drop `[doc]` facts the code does not bear out.
## 2. Context
Write a short context file for the writer:
- The reader: who they are, what they already know, and why they came to
this page (see context.md beside this file).
- The group host in three lines (context.md).
- A glossary of only the atproto and host terms the facts use.
- The pages it may link to, by path.
- The questions the page answers, in the order a reader asks them. The
lists for the design pages are in questions.md beside this file; start
from those and add what the facts raise.
## 3. Write
Give a fresh agent only the facts and the context, and tell it not to
read `docs/`, `README.md` or `AGENTS.md`. It may read code to settle a
doubt, and says so. The brief, with the style rules, is writer.md beside
this file.
It reports the facts it left off and where each belongs. Place those in
the reference pages yourself (or with another agent), checking each
against the code as you go: details belong there, not on a design page.
## 4. Check
- Every fact on the page against the inventory, and any doubt against the
code. Agents drop true facts no source stated, and keep false ones a
page did: read the diff of what was there before.
- Pages that state the same thing agree. The design overview draws on the
others, so check it last.
- `just docs`: every relative link and anchor lands. The `docs` check runs
it on the pull, and builds the site.
- `just docs-site`, and read the page once as its reader would, top to
bottom.
.claude/skills/docs/writer.mdnew+58−0
@@ -0,0 +1,58 @@
# Brief for the writer
Fill in the brackets and hand it to a fresh agent.
---
Write the group host's [design page / reference page] for [topic] from
scratch, as one Markdown file at [scratch path]. It will become [docs path].
## Your inputs
These two files are your only sources. Read them in full before writing:
- [context file]: the reader, background, a glossary, the pages you may
link to, and the questions the page answers, in order.
- [facts file]: the facts, from the code and the old pages.
`[DOC WRONG]` means an old page was wrong: write what the code does,
without mentioning the old page. Leave out what the Quirks section lists,
but never state the opposite of a quirk as design: describe the intended
rule.
Do not read existing documentation: README.md, docs/, AGENTS.md. You may
read code only to settle a doubt about a fact, and say so in your report.
Describe this host as it is: never compare it with another
implementation, or say where an idea came from.
## How to write it
- Lead with the problem: [what the page's subject is up against]. Explain
each mechanism as the answer to a problem, so a reader knows why a rule
exists by the time they meet it. Put the lowest-level details in a
short plain list headed "Details" at the end of their section.
- Define before use.
- Plain technical prose: present tense, active voice, one idea per
sentence, exact names in backticks, short paragraphs. A list only for
truly parallel items, a table only for tabular data.
- Don't number the problems and refer back to them; let the structure
make the connection.
- Avoid the marks of machine writing:
- inflated significance ("plays a crucial role", "serves as")
- "not just X but Y", and reflexive groups of three
- trailing "-ing" commentary
- bold-headed bullet lists (`- **Thing.** text`)
- bold for emphasis, em dashes, title case in headings
- slogans, and summary sentences that repeat the paragraph above
- the words delve, robust, seamless, leverage, comprehensive, powerful
- No diagrams.
- Links: only the paths the context file lists.
- Length: about [n] lines. Command syntax and flags belong in
`../reference/cli.md` and `../reference/api.md`.
## Report back
1. The headings, one line each.
2. Facts you left off, and where each belongs.
3. What you checked in the code, and what you found.
4. The page length in lines.
.knotless/workflows/docs.ymlnew+24−0
@@ -0,0 +1,24 @@
# The docs, as `just docs` checks them: every relative link and anchor
# lands (harness/docs.mjs); and the site docs-site/ makes of them builds.
# `just docs-deploy` deploys it, from the owner's machine: the site of a
# private repository is kept in its space, which an app password, all a
# run could sign in with, cannot write. The site's packages are kept
# between runs and installed again only when its lockfile changes.
image: node:24.22.1
# Pushes to main, and pulls that change the docs, their check, the site,
# the lexicons and tokens it takes, or this file. A pull changing none
# passes at once, noted as skipped.
on:
push: {refs: [refs/heads/main]}
pull:
base: [refs/heads/main, refs/heads/feature/*]
paths: [docs/**, README.md, AGENTS.md, harness/docs.mjs, docs-site/**, lexicons/**, web/src/tokens.css, .knotless/workflows/docs.yml, .knotless/uses.lock]
cache: [docs-site/node_modules]
steps:
- uses: chadtmiller.com/steps/npm-ci@1
name: packages
with: {dir: docs-site}
- name: links
run: node harness/docs.mjs
- name: site
run: cd docs-site && npm run build
.knotless/pull.md+2−4
@@ -23,13 +23,11 @@
## How it was checked
<!-- Tests added or run, and which of the TypeScript host's tests they
port. What is left to CI. -->
<!-- Tests added or run, and what they cover. What is left to CI. -->
## Shortcomings
<!-- What it does not do yet that the TypeScript host does, what was not
run, what could go wrong. -->
<!-- What it does not do yet, what was not run, what could go wrong. -->
## Review
crates/group-host/src/actors.rs+0−2
@@ -1,8 +1,6 @@
//! People, as the console shows them: who is asking (`getViewer`, as
//! knotless's), a person (`getActor`), and the groups someone is in
//! (`getActorGroups`).
//!
//! As the prototype's `methods/groups.ts`'s `getActorGroups`.
use crate::Host;
use crate::api::{Params, page, param};
crates/group-host/src/app_passwords.rs+0−2
@@ -12,8 +12,6 @@
//! A session from one is a grant like any other, its tokens bearer ones.
//! Its scope is `atproto transition:generic` (and `transition:chat.bsky`
//! for a privileged one): the group's repo and blobs, never a space.
//!
//! As the prototype's `methods/appPasswords.ts` and `pds/appPasswords.ts`.
use crate::Host;
use crate::api::{Params, invalid, param};
crates/group-host/src/authorization.rs+0−2
@@ -3,8 +3,6 @@
//! approves or declines. The member is whoever signed the service auth,
//! their own PDS vouching for them, so who signed an app in is never a
//! guess, and the grant is theirs: it ends when they are put out.
//!
//! As the prototype's `methods/authorization.ts`.
use crate::Host;
use crate::api::{Params, invalid, param};
crates/group-host/src/group.rs+0−2
@@ -4,8 +4,6 @@
//! of its spaces, for its members). Everything a group is lives in those
//! records, written by the group; who may read or write each space is its
//! access record, against the reader's roles.
//!
//! As the prototype's `bootstrap.ts` makes one, and `group.ts` reads it.
use crate::Host;
use crate::rbac::{ACTIONS, Grant, NS, listed};
crates/group-host/src/group_config.rs+0−2
crates/group-host/src/group_handle.rs+1−3
crates/group-host/src/group_invites.rs+0−2
crates/group-host/src/group_join.rs+0−2
crates/group-host/src/group_lifecycle.rs+0−2
crates/group-host/src/group_members.rs+0−3
crates/group-host/src/group_spaces.rs+2−3
crates/group-host/src/group_tokens.rs+0−2
crates/group-host/src/import.rs+1−1
crates/group-host/src/index.rs+1−2
crates/group-host/src/index_api.rs+0−2
crates/group-host/src/migration.rs+2−3
crates/group-host/src/moderation.rs+0−3
crates/group-host/src/move_host.rs+2−2
crates/group-host/src/oauth.rs+0−2
crates/group-host/src/oauth_clients.rs+1−2
crates/group-host/src/oauth_dpop.rs+1−2
crates/group-host/src/oauth_resource.rs+0−2
crates/group-host/src/oauth_scope.rs+1−2
crates/group-host/src/provision.rs+0−2
crates/group-host/src/rbac.rs+1−2
crates/group-host/src/recovery.rs+0−2
crates/group-host/src/token_writes.rs+0−3
crates/group-host/tests/group_handle.rs+1−1
docs/design/assistants.md+123−52
docs/design/groups.md+211−189
docs/design/membership.md+130−98
docs/design/moderation.md+118−38
docs/design/moving.md+217−201
418 lines changed: not loaded until asked for.
docs/design/README.md+56−131
docs/design/recovery.md+107−34
docs/design/signing-in.md+277−262
539 lines changed: not loaded until asked for.
docs/design/spaces.md+175−153
docs/reference/api.mdnew+236−0
docs/reference/cli.md+13−9
docs/reference/config.md+16−7
docs/reference/mcp.mdnew+44−0
docs/development.md+56−30
docs/README.md+16−12
docs-site/src/content.config.tsnew+8−0
docs-site/src/SiteTitle.astronew+17−0
docs-site/src/theme.cssnew+205−0
docs-site/src/ThemeSelect.astronew+3−0
docs-site/.gitignorenew+4−0
docs-site/astro.config.mjsnew+68−0
docs-site/content.mjsnew+31−0
docs-site/package-lock.jsonnew+6480−0
A large diff, not shown.
docs-site/package.jsonnew+16−0
docs-site/plugins.mjsnew+41−0
docs-site/reference.mjsnew+203−0
harness/docs.mjsnew+67−0
lexicons/fyi/opensocial/applyLabel.json+3−3
lexicons/fyi/opensocial/checkImport.json+2−2
lexicons/fyi/opensocial/completeImport.json+1−1
lexicons/fyi/opensocial/defs.json+4−4
lexicons/fyi/opensocial/finishAccountMove.json+1−1
lexicons/fyi/opensocial/getActor.json+1−1
lexicons/fyi/opensocial/getActorInvites.json+1−1
lexicons/fyi/opensocial/getSubjectHistory.json+1−1
lexicons/fyi/opensocial/importAccount.json+1−1
lexicons/fyi/opensocial/listGroups.json+1−1
lexicons/fyi/opensocial/listSubjects.json+1−1
lexicons/fyi/opensocial/migratePrepare.json+1−1
lexicons/fyi/opensocial/migrateReceive.json+1−1
lexicons/fyi/opensocial/negateLabel.json+1−1
lexicons/fyi/opensocial/putRule.json+1−1
lexicons/fyi/opensocial/resolveSubject.json+1−1
lexicons/fyi/opensocial/startAccountMove.json+1−1
lexicons/fyi/opensocial/updateGroupHandle.json+1−1
lexicons/fyi/opensocial/updateProfile.json+1−1
AGENTS.md+25−27
Justfile+15−0
README.md+1−2