Phase 11, part 1: agents and their keys

Agents are users of kind agent, each given modules to read, or to read
and act on, and the CRM scope. Admins make them under Settings → Agents,
on every edition; keys (sm_…) are shown once and kept as hashes, can
expire, be rotated (the old one works a day) or revoked, and record their
last use. /mcp takes agent keys and offers each agent only the tools its
scopes allow. On the local edition, mcp-token is the key of a built-in
Hermes agent with the CRM and the Market.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 10:26:31 -07:00
co-authored by Claude Opus 5.5
parent da16736fb4
commit da2d56f8d2
19 changed files with 1323 additions and 138 deletions
+31 -2
View File
@@ -53,8 +53,9 @@ branch `phase10` (2026-11-25), not yet merged: schema 36, a new
the visible changes are posting accounts, Connections, Activity, and a
CSRF token in every form.
**Next: Phase 11, agents.** Phase 12 still needs who adds Supermarket's
client to Authelia.
**Next: Phase 11, agents.** Part 1 (agent users and keys) is built on
branch `phase11`. Phase 12 still needs who adds Supermarket's client to
Authelia.
**Coming back to it (for the agent working on it):**
- Run the tests inside the sandbox with
@@ -2523,6 +2524,34 @@ module, Settings and their fragments answer 403. The log shows each step.
Every edition gets this, including local, where an agent key replaces the
single `mcp-token`. A commit after each part.
**Part 1 built 2026-11-26** on branch `phase11`.
- Schema 37: `agent_keys` (the key's SHA-256, its first characters, when
made, expiry, when a rotation retires it, revoked, last use and from
where) and `users.description`. An agent is a user of kind *agent*
(an address at `agents.invalid` nobody mails), with a membership whose
modules are *read* (view) or *read and act* (edit), and the `crm` scope
for the CRM bridge's tools. Agents never sign in on the web, aren't on
Settings → Users, and get no email or posting grid row.
- Keys are `sm_` and 40 random characters, shown once (`no-store`). A
key works until it expires, is revoked, or, after *Rotate*, a day after
its replacement was made; turning the agent off stops all of them. Wrong
keys count per IP like failed sign-ins (20 in 15 minutes, then a wait).
- Settings → Agents, for admins, on every edition (the local edition has
no Users page, so agents have their own): the list (what each may do,
working keys, last use), *New agent* (name, what it's for, scopes, an
optional expiry), and each agent's page: scopes, keys (revoke one), rotate,
add a key, turn off, remove. All of it in the audit log.
- `/mcp` takes agent keys only, and builds each agent's server from its
scopes: the CRM tools and `bridge_checkin` need `crm` (act), the Market
list needs the Market (read); the profile is for every agent. The module
tools come in part 2.
- On local, `mcp-token` becomes the key of a built-in *Hermes* agent with
the CRM (act) and the Market (read): the Market too because install.sh
gives Claude Code the same key for the profile and Market tools. It can be
turned off but not removed; rotating writes the new key to `mcp-token`.
The socket stays as it is (everything, no key). The server edition has no
built-in Hermes: an admin makes an agent with the CRM scope.
1. **Agent users and their keys.**
- An admin creates an agent on Settings → Users → *New agent*. It has a
name, a description, and the modules it's given, each *read* or