# Acta Technical Reference Manual

> Account authority, work records, persistence, and failure behavior in the Acta implementation.

---

# 1.1 Overview

_Acta / Acta TRM / Introduction_

> The Acta processes, authority boundaries, and durable records described by this manual.

Acta stores accounts, workspaces, tasks, documents, and project history in
PostgreSQL. People use the browser or CLI; external tools use authenticated
CLI and MCP connections.

The browser, command-line client, and Model Context Protocol (MCP) tools share
server-side domain services. Site grants, workspace access, delegated-agent
ceilings, and connection tool grants are separate checks. Possession of one
kind of session credential does not confer another transport's authority.

Backup and update workers are independent processes. They retain their own
state so recovery remains inspectable when the application or its database is
unavailable. The web process controls bounded worker operations through
private authenticated sockets; it does not receive the updater's Docker
socket.

## 1.1.1 Scope and authority

This manual describes the implementation in the accompanying source tree. It
covers state, interfaces, concurrency, limits, and failure behavior. It makes
no forward compatibility promise. The software determines behavior when an
earlier manual differs from it.

The [Learn guides](/acta/getting-started/overview.md) explain user workflows.
[Operational procedures](/acta/deployment/deployment.md) cover installation and
recovery. The command-line executables' help and the MCP tool schemas provide
the available command and argument surfaces.

---

# 1.2 Terminology and Compatibility

_Acta / Acta TRM / Introduction_

> Accounts, sessions, workspaces, and the supported build environment.

Reusing a display name does not establish identity or ownership.

The terms in this manual have these meanings:

| Term | Meaning |
| --- | --- |
| Account | A stable human or human-owned agent identity. |
| Session | Authorized access with expiry and revocation state. |
| Workspace | A boundary for work records and workspace permissions. |
| Task | A tracked piece of work with its own fields and history. |
| Comment thread | A top-level comment and its replies on a task. |

## 1.2.1 Compatibility boundaries

The pekit build supports x86_64 Linux and pins its Go and frontend toolchains.
The production Compose configuration uses PostgreSQL 17. API clients use the
account, workspace, and connection permissions enforced by the server.

---

# 1.3 Architecture

_Acta / Acta TRM / Introduction_

> Locate domain policy, persistence, transports, frontend state, and notification ownership.

Domain services own validation, authority, and behavioral storage operations.
PostgreSQL implements those operations; HTTP and MCP adapt their results to
transport-specific envelopes.

The implementation boundaries are:

| Source | Responsibility |
| --- | --- |
| `internal/accounts`, `internal/auth` | Identity, effective permissions, authentication, and session policy. |
| `internal/workspaces`, `internal/tasks` | Workspace and work-record validation and behavior. |
| `internal/postgres` | SQL transactions, migrations, consistent reads, and persistence. |
| `internal/httpapi` | Routing, origins, cookies, transport validation, and safe errors. |
| `internal/notifications`, `internal/push` | Task inbox contracts and browser push delivery. |
| `internal/client` | Shared command-line HTTP transport and response handling. |
| `web/src/lib` | Shared forms, typed clients, task views, and browser state. |

Migrations are embedded, ordered, and checksummed. Startup applies them in a
transaction under a database advisory lock. An altered applied migration or an
unknown migration fails startup. A release migration can retire stored data;
operators review migration
effects before upgrading.

---

# 2.1 Account Identity

_Acta / Acta TRM / Accounts and Authority_

> Stable account identities, username reservations, first-run setup, password storage, and browser session behavior.

Account identity uses stable UUIDs. Usernames and display names can change
without changing the ownership of credentials, work, or historical references.

## 2.1.1 First-run setup

A new installation prints a random 8-character setup code to its server
terminal. It uses uppercase letters and digits, excluding `I`, `O`, `0` and
`1` to make manual entry easier. Input is case-insensitive and surrounding
whitespace is ignored. Five cryptographically random bytes provide 40 bits of
entropy. Open `/setup`, enter that code, then choose the first administrator's
username, optional display name and password. The code is valid for one hour
after that server process starts. Restarting an uninitialized server produces
a new code. Treat terminal logs as operator-only data. The code is never
returned by an HTTP endpoint.

A successful code exchange creates a browser setup grant valid for 15 minutes.
Reloading within that period retains the administrator form. If it expires,
enter the operator code again. Setup creates the administrator and credential,
consumes the grant, invalidates all other grants, and permanently marks the
installation as set up in one transaction. Concurrent submissions have exactly
one winner. The permanent marker is independent of whether an administrator is
subsequently disabled or demoted.

After creation, Acta takes the user to sign-in with a success message. It does
not sign them in automatically. Creating the real administrator is an operator
step; test fixtures never initialize the development installation.

## 2.1.2 Identity

Account UUIDs are permanent references. Usernames are human-readable names,
not identifiers for relationships or future mentions.

The account domain owns segment validation and handle derivation:

- A segment is 1–32 ASCII letters/numbers with `.`, `-`, `_` permitted
  internally. The first and last characters are alphanumeric. Case folds to
  lowercase. Whitespace and slashes are not accepted as segment input.
- Root names are unique across the installation. The schema can represent a
  direct child through a parent UUID and a segment unique under that parent.
  Its handle is derived as `parent/child`; parent display text does not
  establish ownership. [User-owned
  agents](/acta/technical-reference/accounts/agents.md) expose creation and
  delegated CLI/MCP authorization through the human owner.
- A display name is optional and nonunique, Unicode NFC, trimmed at the ends,
  single-line, and at most 100 grapheme clusters. Blank means absent.
  Administrator setup accepts this optional name and persists it in the same
  transaction as the account. Omitting it or entering whitespace leaves it
  absent. These same rules apply to Profile edits.

## 2.1.3 Profile

User Settings opens **Profile** at `/user-settings/profile`. It contains
optional Display name and Username fields directly in the main panel. Save
changes is available only when edited. A successful save updates the sidebar
immediately, resets the form to the normalized values, and announces a quiet
success message. Field errors are associated with their inputs and receive
focus. Unsaved edits are guarded when navigating away.

A username change opens a confirmation naming the old and proposed usernames.
Cancel receives initial focus; Escape cancels and returns focus to Save. A
successful rename retains the UUID and existing sessions, and child handles
follow the parent name. Sign-in uses the new current username. Historical
names are reserved for their owner, who can switch back to them. Reservations
do not act as sign-in aliases. Another account cannot claim a current or
reserved name, either through creation or rename. Names are keyed by parent
UUID and segment, so a parent's rename does not change its children's
namespace ownership.

A collapsed **Previous usernames · N** disclosure appears below the username
help text when this account has reserved names. Expanding it shows a plain,
alphabetically ordered list. **Use again** fills and focuses the username
field; it does not save. The normal Save and rename confirmation still apply.
The current username is excluded, and the list updates after a successful
save.

`GET /api/account` returns the current account, `profile_version`, and
`previous_usernames` (an array, empty when no previous names are reserved).
The history is private to the authenticated account, not a public name
directory. `POST /api/account/profile` accepts `username`, `display_name`
(string or null), and the expected `profile_version`. The authenticated
session supplies the UUID; the caller cannot choose an account or edit
permissions. Each changed name field requires its corresponding Own Account
permission. Display name is replaced in full (null/omitted/blank clears it).
Username is required. The response is the updated current-account
representation. All existing Origin, JSON-only, and no-store protections
apply. A stale version receives HTTP 409 `profile_changed` and makes no
changes; the UI lets the user explicitly load the latest profile before
editing again. Validation failures receive 422 with field messages.

Account changes, version increment, name claims, and the profile event commit
atomically. PostgreSQL uses a shared name registry for current and historical
names, with a unique constraint and a claim trigger covering both inserts and
renames. Failed claims roll back the entire edit. Migration 002 backfills
names for existing accounts and preserves their credentials and sessions.
Concurrent writes preserve active-account checks, owner reclamation, and
stale-edit rejection.

Administrators cannot release username reservations through the account
interface. Task mentions bind resolved identities to UUIDs, preserving
references across renames.

## 2.1.4 Passwords and browser sessions

Passwords have 15–128 Unicode code points after NFC normalization. There are
no composition requirements or periodic expiry. Spaces are preserved. A
bundled common-password list and repeated-character check reject obvious
choices; no password is transmitted to a breach-checking service. The list is
a modest baseline, not exhaustive. Its provenance and license are in
`internal/auth/data/README.md`.

Argon2id hashes use random 16-byte salts, 19 MiB memory, two iterations, one
lane, and a 32-byte key. Stored hashes carry their parameters and the verifier
bounds those parameters before allocating memory. At most two password hashes
run concurrently per server; excess work receives a retryable busy response.
This profile follows the [OWASP password storage
guidance](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).

Successful sign-in sets a persistent, opaque browser cookie. Only its SHA-256
digest is stored in PostgreSQL. Sessions expire after seven days without use
or 30 days from creation, whichever comes first. Activity refreshes only the
idle deadline. Restarting the application does not invalidate sessions.
Sign-out revokes the server-side record; copying an old cookie cannot restore
it. Signing in again in the same browser also revokes that browser's prior
session. Disabled accounts cannot authenticate or use a session.

Cookies are HttpOnly, SameSite=Strict, and path `/`. HTTPS installations also
use Secure and `__Host-` cookie names without a Domain attribute. HTTP is
supported only on explicitly configured loopback origins for development. All
API responses have `Cache-Control: no-store`. Mutations require JSON and an
exact allowed Origin; sign-in and setup receive the same CSRF protection.

Rate limits are stored in PostgreSQL and shared by server instances: 60
sign-in attempts per remote IP and 10 per normalized username per five-minute
fixed window; setup-code checks allow 10 per remote IP per five minutes.
Successful attempts count too. Invalid and nonexistent usernames receive the
same generic credential error. Unknown-account checks still perform a password
hash.

Client IPs default to the direct TCP peer. Deployments can set
`ACTA_TRUSTED_PROXIES` to explicit comma-separated proxy IPs/CIDRs. Only
requests from those peers use `X-Forwarded-For`: walk right to left through
trusted hops, stopping at the first untrusted address. Invalid, absent, or
oversized chains fall back to the direct peer. Other forwarding headers do not
select client identity, public URLs, cookie security or allowed origins. See
[deployment](/acta/deployment/deployment.md).

Expired grants, security flows, rate-limit buckets, and sessions are removed
at startup and every 15 minutes. Expiry is enforced on each operation
regardless of cleanup. Administrator creation, successful sign-in, profile
changes, and session revocation append account events with UUIDs; this is a
small internal event record, not a finished audit UI.

## 2.1.5 Boundaries and persistence guarantees

- `internal/accounts`: identity, naming policy, profile service and its
  storage contract.
- `internal/auth`: authentication policy, password handling, session lifetime,
  setup workflow, and behavioral storage contracts.
- `internal/postgres`: the SQL implementation, pool, and embedded migrations.
- `internal/httpapi`: JSON, origin enforcement, cookies, and error
  translation.
- `web/src/lib`: shared form components and typed HTTP client; route
  components own screen behavior. The Go server serves the compiled frontend.

Storage operations describe guarantees rather than generic CRUD. Storage
operations preserve atomic setup, active-account checks, session expiry and
revocation, and concurrent rate limits. Domain and HTTP code do not import
pgx. The real PostgreSQL integration suite tests these guarantees in isolated
schemas. Adding another adapter would also require translating migrations and
moving existing data; a storage interface cannot make data migration
automatic.

Migrations are embedded, ordered, checksummed, and applied in a transaction
under a database advisory lock. A changed applied migration or an unknown
migration fails startup. Ordinary startup never drops or recreates the schema.
A deliberate development reset is a separate operator action.

## 2.1.6 Appearance

A sun/moon toggle is available in the top-right corner on setup and sign-in,
and beside the profile in the signed-in sidebar. It defaults to the operating
system's color preference until explicitly changed. A choice is remembered in
this browser and synchronized across its open Acta tabs; it is not an account
preference. Without browser storage, toggling still works for the current
page.

An early, self-hosted theme script applies the preference before first paint,
avoiding a light-page flash during dark-mode reloads. Shared semantic color
values cover surfaces, fields, focus rings, errors and success messages. The
sun's rays rotate away as the disc becomes a crescent, with a small
hover/press movement on the toggle. Reduced-motion preferences disable these
animations.

---

# 2.2 Authentication

_Acta / Acta TRM / Accounts and Authority_

> Server-owned authentication flows, credential encryption, freshness, expiry, and account restrictions.

Acta authenticates browser, command-line, and agent connections through shared
account policy. Security state is encrypted with an installation key kept
separately from the database.

## 2.2.1 HTTP and flow state

All endpoints retain exact-Origin, JSON-only mutation checks, no-store
responses, and existing cookie protections. The maximum request body is 64 KiB
to allow WebAuthn responses. No application session is issued while an
additional factor is pending.

| Endpoint | Behavior |
| --- | --- |
| `POST /api/login` | Username/password proof; returns a flow result, optionally requiring a code. |
| `GET /api/security` | Current account's safe passkey metadata, MFA settings, remaining code count, and sessions. |
| `POST /api/security/flow` | Begin `login`, `password`, `passkey_add`, `passkey_remove`, `mfa_setup`, `mfa_disable`, `mfa_policy`, or `recovery`. Optional `target` and `enabled` are fixed when the flow begins. |
| `POST /api/security/advance` | Submit `id`, `action`, and step-specific fields. The server validates the transition and current policy. |
| `POST /api/security/cancel` | Cancel the browser-bound flow by `id`. |
| `POST /api/security/revoke` | Revoke another session by public UUID `id`, or all others when empty. Always preserves the caller. |

A flow response includes its opaque `id`, `purpose` and authoritative `step`.
Only enrollment steps return a QR/manual secret, or newly prepared recovery
codes. A `done` sign-in response sets the actual application cookie; its
session token is never included in JSON. Unknown/stale/consumed flows return
409 `flow_expired`; validation returns 422 with field errors. The UI leaves
failed ceremonies retryable and refreshes settings after a modal closes,
including when a response was lost after a successful commit.

Flows expire after ten minutes and bind to a random HttpOnly browser cookie.
Settings flows additionally bind to the current authenticated session. Fresh
proof expires after five minutes and carries method, credential, MFA evidence
and account security revision. Reusing a recent second factor during an
explicit current-password check preserves its original freshness deadline.
Browsing never extends authentication freshness. Security mutations invalidate
previous proof and flows. Session issuance and changes serialize on the same
account.

Flow starts allow 40 attempts per resolved client IP (using the deployment
proxy trust policy) per five minutes; advances allow 30 per flow, password
checks 10 per account, and authenticator/recovery checks 10 per account in the
same window. Limits are shared in PostgreSQL and include successful attempts.
Existing password-sign-in limits also apply.

## 2.2.2 Credentials and persistence

WebAuthn uses `go-webauthn/webauthn`. The RP ID is the configured public URL's
hostname, and allowed origins come from the validated server configuration.
Discoverable credentials and signed user verification are required. The server
checks challenge, origin, RP ID, credential ownership, signature, flags, and
counter behavior. Each credential ID has a unique owner across the site;
public metadata uses separate random IDs. Names are required, with the
existing 100-grapheme display-name validation. Accounts can hold up to 20
passkeys. Changing the hostname changes the relying party; plan the permanent
hostname before relying on enrolled passkeys.

Authenticator codes use six-digit SHA-1 TOTP with a 30-second period and one
adjacent step of clock tolerance. Accepted steps cannot be reused. Ten
recovery codes each contain 80 random bits, displayed in grouped base32.
Active recovery codes are stored as SHA-256 digests; comparison normalizes
case and hyphens. A code is consumed in the same transaction as its successful
flow transition. Recovery-code preparation does not replace the active set
until acknowledgment.

MFA secrets, passkey credential material, and short-lived flow payloads are
AES-256-GCM encrypted with distinct account/flow context. Prepared recovery
plaintext exists only in its encrypted, expiring flow until completion or
cancellation. Public views and account events never contain these secrets.
`ACTA_SECURITY_KEY_FILE` is a private 32-byte key encoded as base64,
provisioned once with mode 0600. The database stores a fingerprint and refuses
a different key. Preserve this file across restarts, upgrades, and restores;
every instance using the database requires the same key. Automatic key
rotation and lost-key recovery are not implemented.

`SecurityStore.WithSecurity` locks an active account before its
flows/sessions. Its callback and all writes commit together or roll back.
Storage transactions preserve this ordering, security-revision rechecks,
global credential ownership, single-use challenges and codes, and atomic
revocation. Expensive password hashing occurs outside the account lock, then
credential/revision checks repeat inside it. PostgreSQL owns SQL and
migrations; the authentication domain owns policy, flow transitions, and
encryption. No generic workflow engine was added.

## 2.2.3 Account requirements

[Permissions](/acta/technical-reference/accounts/permissions.md) adds Require
MFA. Unenrolled accounts enter a restricted version of the shared setup flow
at `/mfa-required`; only identity, enrollment, and sign-out remain available.
Acknowledging recovery codes completes enrollment. Required accounts cannot
disable MFA, and recovery that clears MFA credentials retains the requirement.
Superusers obey it. Verified passkeys and the optional extra-code policy
retain their existing sign-in behavior.

---

# 2.3 Security Flows

_Acta / Acta TRM / Accounts and Authority_

> Authentication proof, security-flow transitions, credential replacement, and session revocation.

Security operations use server-owned flows. The browser supplies proof and
requested inputs; the server determines the next step and commits only the
action bound to the flow.

## 2.3.1 Authentication policy

Passkey sign-in requires signed user verification. Password sign-in and
passkey sign-in apply the account's authenticator policy as shown here:

| Account policy | Password proof | Verified passkey proof |
| --- | --- | --- |
| No authenticator | Completes authentication | Completes authentication |
| Authenticator with no extra passkey code | Also requires a code | Completes authentication |
| Authenticator with an extra passkey code | Also requires a code | Also requires a code |

A single-use recovery code can replace an authenticator code. It cannot
replace the password or passkey, turn off protection, or change the extra-code
policy.

Fresh proof lasts five minutes, is bound to the session and verified methods,
and is not extended by ordinary browsing. An incomplete sign-in with a pending
second factor grants no application session. Sensitive changes check the
policy in force before the change, including a change that would weaken that
policy.

## 2.3.2 Passwords and passkeys

A password change checks the explicit current password and any additional
proof, updates the credential, and revokes every other session atomically. The
initiating browser remains signed in.

Passkey registration checks fresh proof, a supplied name, and the browser's
credential ceremony. Canceling before acceptance stores no usable Acta
credential. A device-side credential whose registration fails on the server
cannot authenticate. Adding a passkey retains sessions; removal revokes other
sessions after fresh proof. The account retains its password.

The optional passkey invitation follows a completed password sign-in. It does
not open a native credential prompt without selection. Dismissal or successful
creation is remembered for that account in that browser; canceling creation is
not success.

## 2.3.3 Authenticators and recovery codes

Enrollment verifies a code from the proposed authenticator, presents ten
recovery codes, and activates protection only after acknowledgment.
Replacement keeps the previous authenticator and recovery codes active until
the replacement commits. Configuration and recovery-code replacement occur
together, with other sessions revoked in the same transaction.

Turning off the authenticator removes its secret and recovery codes, clears
the extra-passkey-code preference, and revokes other sessions.
Required-authenticator policy rejects this operation. Changing the extra-code
preference uses the existing policy's fresh-proof requirements and revokes
other sessions.

Recovery-code replacement prepares an encrypted pending set. Acknowledgment
replaces the active set; cancellation retains the old set. The UI shows how
many active codes remain without revealing their earlier plaintext.

## 2.3.4 Sessions and restricted access

Session revocation checks the current account and session. Revoking other
sessions preserves the caller. Browser, CLI, and MCP sessions share account
revocation rules but use distinct credentials and authorization transports.

An unenrolled account subject to Require MFA has access only to identity
inspection, the required enrollment flow, and sign-out. Completing
recovery-code acknowledgment ends that restriction. Administrator recovery can
clear credentials without clearing the requirement; the next sign-in returns
to enrollment.

---

# 2.4 Account Administration

_Acta / Acta TRM / Accounts and Authority_

> Pending accounts, invitation and recovery links, administrator edits, and suspension without session revival.

Account administration creates pending users, issues invitations and recovery
links, and suspends access. These operations preserve account identity and
recorded work.

## 2.4.1 Accounts and administration

The searchable list supports Active, Pending, and Disabled filters and
50-account pages. Search matches display names and usernames literally and
without regard to case. Each account opens a management page immediately,
including pending accounts. That stable UUID-based page includes permission
management before the owner redeems an invitation.

Creation requires a username and permits an optional display name. It
atomically creates an explicit pending root account, reserves the name, and
creates its invitation. No password credential or application session exists .
The new account page opens with the invitation-link modal. Closing that modal
does not delete the account. A new invitation can be generated from its
management page. Saving permissions invalidates any previously issued
invitation or recovery link; generate a new link after configuring access.
Creation without View users shows the invitation in place instead of
navigating to restricted account details.

Administrator profile edits reuse the Profile form, validation, rename
confirmation, optimistic profile version and username-reservation rules.
Disabled and pending profiles remain editable. An administrator's name change
does not change identity, credential ownership or existing references. There
is no account deletion. Superuser is managed through permissions.

## 2.4.2 Invitations and password recovery

Invitation and reset links use the same transport and redemption UI with
explicit purposes. Each is a random 256-bit bearer token, stored as a SHA-256
digest, valid for 24 hours and single use. Only one can be outstanding per
account: generating another replaces the previous link. An account security
change also invalidates a link issued under the old security revision.

Links use the configured public origin and `/account-link#token=…`. The
fragment keeps the secret out of server request URLs. The browser removes it
from the address bar and retains it in tab-scoped session storage for reloads
until successful redemption. The administrator's newly created link is handed
between pages in memory, never placed in route state or persistent browser
storage. Link APIs are JSON-only, Origin-checked, and no-store. Do not share
links publicly.

Invitation redemption shows the current username and allows choosing an
optional display name, initially filled with the administrator's value,
alongside the new password. An intervening admin profile edit produces a
version conflict instead of being overwritten silently. Activation, profile
editing, password creation, and link consumption commit together. Success
leads to ordinary sign-in, not an automatically authenticated application
session. Display-name editing is conditional on Change own display name;
protected assigned names are retained.

**Reset password** offers **Also disable MFA** and **Also remove passkeys**,
both off by default. Issuing a link changes no credentials or protection.
Redemption sets the new password, applies exactly the selected options,
consumes the link, and revokes all existing sessions atomically. A normal
reset preserves MFA and passkeys; the next sign-in follows the resulting
account policy. Recovery links replace proof of the old password for this
operation only; they do not grant normal application access. Only Superusers
can issue credential links for access managers or Superusers. Clearing MFA
credentials preserves any Require MFA requirement and forces enrollment on the
next sign-in. Resetting one's own account also revokes that session.

## 2.4.3 Disabling and re-enabling

Disabling immediately prevents application access, revokes sessions and
outstanding links, and invalidates in-flight authentication authorizations.
The account and its work/history remain. The last active Superuser cannot be
disabled. Pending accounts retain their pending state beneath Disabled;
enabling one again still requires a newly issued invitation.

A browser presenting a revoked session from a -disabled account receives
`account_disabled` and is taken to **Account disabled. Contact your
administrator.** A new password or passkey sign-in receives that explanation
only after valid credential proof. Wrong credentials keep the ordinary generic
error. Passkey verification still checks origin, challenge, signature, and
required user verification before revealing disabled status. No application
session is issued.

Disabled-session notices retain only token digests, account IDs and the former
absolute expiry, with no authorization value. Re-enabling never restores these
sessions or revoked links; the owner signs in again. A new disable operation
cannot turn an older revoked token back into a session.

## 2.4.4 API and storage contracts

| Endpoint | Behavior |
| --- | --- |
| `GET /api/users?q=&status=&offset=` | Administrator list, up to 50 entries and a `more` indicator. |
| `POST /api/users` | Create a pending account from username and display name; return account and invitation URL. |
| `GET /api/users/{uuid}` | Administrator account detail, including status and profile version. |
| `POST /api/users/{uuid}/profile` | Version-checked username/display-name edit. |
| `POST /api/users/{uuid}/link` | Replace outstanding invitation/reset link; accepts `disable_mfa` and `remove_passkeys` for active-account recovery. |
| `POST /api/users/{uuid}/disabled` | Disable/re-enable using the `disabled` boolean. |
| `POST /api/account-link/open` | Inspect the bearer grant and account form metadata. |
| `POST /api/account-link/redeem` | Submit token, new password, and invitation display name/profile version. |

Management transactions recheck the active actor, permission, MFA requirement
and session, serialize administration through the installation row, then lock
the target account before its flows, links or sessions. This coordinates
last-Superuser checks and changes to other users. Link redemption uses the
same account lock and encrypted security record as normal authentication.
Password hashing occurs before the final lock; the link, expiry, status,
purpose, and security revision are rechecked afterward. Consequently, a
competing reset or disable cannot leave a surviving old sign-in.

Admin events record both target UUID and acting administrator UUID. Secrets,
passwords, and link plaintext are not included. These transactions preserve
authorization and state changes together. Migration 005 adds pending state,
account links, disabled-session notices, and event actors without changing
existing credentials or accounts.

---

# 2.5 Site Permissions

_Acta / Acta TRM / Accounts and Authority_

> Effective site grants, capability management, credential authority, and required-authenticator enforcement.

Site permissions are additive grants. Direct grants and group grants combine;
account requirements such as multi-factor authentication (MFA) are enforced
separately.

## 2.5.1 Catalog and defaults

| Tab | Permission | Identifier |
| --- | --- | --- |
| Memories | Write user memories | `own.memories.write` |
| Memories | Read site memories | `site.memories.read` |
| Memories | Write site memories | `site.memories.write` |
| Site Administration | Manage backups | `site.backups.manage` |
| Site Administration | Edit site guide preferences | `site.guide.write` |
| Own Account | Change own username | `own.username` |
| Own Account | Change own display name | `own.display_name` |
| Site Administration | Create workspaces | `site.workspaces.create` |
| Site Administration | Superuser | `site.superuser` |
| Site Administration | View users | `site.users.view` |
| Site Administration | Create users | `site.users.create` |
| Site Administration | Edit users | `site.users.edit` |
| Site Administration | Reset user credentials | `site.users.reset_credentials` |
| Site Administration | Disable users | `site.users.disable` |
| Site Administration | Manage permissions | `site.permissions.manage` |

Require MFA appears in Own Account alongside these switches, but is a separate
account requirement, not a capability. Direct and group requirements combine
with OR. Superuser grants every known capability, including future additions,
without enabling or bypassing requirements.

The first setup account receives a direct Superuser grant. Migration 006 maps
existing administrators to Superuser and removes `is_admin`. Ordinary accounts
existing at the direct-permissions migration retain their two name-changing
direct grants. New accounts join Default instead; see
[Groups](/acta/technical-reference/accounts/groups.md).

Password changes, passkey management, session inspection/revocation, and
optional MFA management remain baseline authenticated-account capabilities.
Profile edits check each changed field, so an unchanged protected name can
accompany another permitted change. Editing yourself through user management
also applies these own-account restrictions. Invitation activation only shows
and accepts a chosen display name when Change own display name is effective;
otherwise the assigned name is preserved.

## 2.5.2 Management and visibility

Each user detail page has a Manage permissions button for access managers. Its
modal groups capabilities by category, with Superuser first in Site
Administration. Changes are staged until Save changes; Cancel discards them. A
permissions revision detects stale edits and requires reopening the dialog to
review the latest values.

Capabilities supplied by Superuser appear enabled and greyed out with their
source. If also granted directly, Remove direct grant removes that explicit
grant while showing that effective access remains enabled. Superuser never
checks Require MFA automatically.

Only access managers can change grants. For every added or removed grant, the
transaction checks that the actor holds that capability. Existing unowned
grants can remain unchanged. Only Superusers can add or remove Superuser. An
access manager can change the MFA requirement. The installation rejects
removal of its last active, non-pending Superuser: concurrent demotions and
disables cannot remove the last one.

View users controls list/detail access; the action grants do not implicitly
include it. Create users can still open the Users page and create accounts
when View users is absent, receiving the invitation in place. Other
administration controls appear on user detail pages, so their normal UI use
also needs View users. Site Settings is available when Users or Groups is
accessible. The home route opens the most recent accessible
[workspace](/acta/technical-reference/accounts/workspaces.md).

Unavailable actions are hidden. Protected profile fields become readable text.
The last Superuser's disable and Superuser-removal controls are disabled with
an explanation. Restricted direct URLs and rejected requests show an
access-denied message. Account access is refreshed on tab focus and after a
permission denial or saved permission edit; an idle page is not a
push-synchronized permission subscription. Every backend operation
independently checks current access.

## 2.5.3 Credential authority

Create users permits invitations for pending accounts. Reset user credentials
permits recovery for active accounts, including the existing optional MFA and
passkey clearing. Only a Superuser can issue either kind of credential link
for an account that has Manage permissions or Superuser. A link can otherwise
be an indirect way to take over access-management authority.

Saving permissions invalidates outstanding invitation/recovery links for the
target account. The modal explains that links need replacing. This prevents an
old link acquiring new authority after an account is promoted. Existing
sessions remain, but their capabilities are resolved afresh; no grants live in
cookies.

## 2.5.4 Required MFA

Requiring MFA on an unenrolled account restricts both existing and new
sessions. The browser opens `/mfa-required` using the shared authenticator
flow. Only identity inspection, that setup flow and sign-out are available
until enrollment and recovery-code acknowledgment complete. Starting or
advancing unrelated security actions is blocked, including a flow opened
before the requirement.

Password sign-in requires an authenticator or recovery code once enrolled. A
user-verified passkey satisfies sign-in MFA by default; the user's existing
extra-code preference can also require a code after a passkey. Required
accounts cannot disable their authenticator, including by finishing an older
disable flow. Replacing it remains available. Superusers obey these rules too.

Administrator-authorized recovery can clear MFA credentials but does not clear
the requirement. The next sign-in requires authenticator enrollment. Acta has
no bypass for total credential loss by a sole Superuser.

## 2.5.5 API and persistence contract

- `GET /api/permissions`: central capability catalog, requiring Manage
  permissions.
- `POST /api/users/{uuid}/permissions`: complete direct `permissions` array,
  `require_mfa` boolean, and expected `permissions_version`; returns updated
  account.
- Account representations include effective `permissions`,
  `direct_permissions`, `require_mfa`, `direct_require_mfa`, `groups`,
  `can_create_users`, `mfa_setup_required`, `permissions_version`, and
  `last_active_superuser`. They does not contain `is_admin`.
- HTTP 403 `forbidden` denies capabilities; 403 `mfa_required` requests
  restricted enrollment; 409 `permissions_changed` rejects stale permission
  edits.

`accounts.ResolvePermissions` composes effective access and `CheckPermission`
is the capability choke point. Features never inspect direct grants for
permission checks. Group grants extend resolution here; UI checks consume the
resulting capability list, not their own Superuser expansion. The MFA
requirement is resolved independently from capabilities. [Agent
accounts](/acta/technical-reference/accounts/agents.md) use this same boundary to
cap explicit grants by current owner permissions; owner access changes
transactionally prune delegations absent from the owner's effective
permissions.

Administration locks installation, actor and target in that order and rechecks
actor status, session, MFA restriction and capability under the transaction.
Updates, revision increments, link invalidation, and actor/target audit events
commit together. Self-profile and security operations recheck relevant rules
under the account lock. Last-Superuser invariants share the administration
lock. The storage boundary preserves this ordering and atomicity.

`mfa_enrolled` is a non-secret projection of encrypted authenticator state,
maintained whenever that state is saved and refreshed before requiring MFA.
The encrypted security record remains authoritative. Existing accounts without
a requirement need no credential migration. The projection permits the common
session gate to enforce enrollment without decrypting security material per
request.

---

# 2.6 Groups

_Acta / Acta TRM / Accounts and Authority_

> Shared grants, automatic Default membership, transactional access changes, and last-Superuser protection.

Groups share site permissions and multi-factor authentication (MFA)
requirements across human accounts. Groups do not nest and have no negative
grants.

## 2.6.1 Management

Site Settings → Groups lists groups with their member counts and optional
descriptions. Search and pagination use 50 entries per page. Each group has a
stable UUID, a case-insensitively unique name of 1–100 characters, an optional
500-character description, a permission set and a Require MFA setting.

Group pages provide profile editing, the same Manage permissions modal used
for users, and a searchable member list. Members can be removed there. Add
membership from a user's Groups section using Add to group. That section also
supports removal. There is no role ordering, and a user can belong to multiple
groups.

All group management requires Manage permissions. Users with View users can
see a user's membership names but cannot change membership without Manage
permissions. Access managers can view group members without View users; links
to complete user pages and the Users navigation still require the
corresponding permission. Groups keep Site Settings accessible to access
managers who cannot view users.

The permission editor groups capabilities by category. On a user, inherited
switches appear enabled and disabled for editing, naming every source group.
If a permission is also direct, Remove direct grant removes that explicit copy
while inherited access stays enabled. Require MFA behaves the same way, with a
separate direct requirement and named group sources. Group permission changes
are staged until Save changes; the modal shows the current member count.

## 2.6.2 Workspace grants

Existing site groups can also receive [workspace
permissions](/acta/technical-reference/accounts/workspaces.md) from that
workspace's permission manager. These grants apply only to explicit human
members of the workspace. They do not admit group members automatically. Site
group assignment remains a site-level privilege; the workspace UI does not
change group membership.

## 2.6.3 Default

A built-in Default group starts with Change own username and Change own
display name. Its profile, grants, and MFA requirement are editable; its
automatic role is identified by a stable database flag, independent of its
editable name.

Newly created accounts join Default in the same transaction as account
creation, without receiving duplicate direct name grants. This includes the
first account on a fresh installation, which also receives direct Superuser.
Individual users can be removed from Default. Migration 007 does not enroll
existing accounts or remove any existing direct grants. Existing accounts can
be added explicitly.

Creating a pending account automatically assigns Default and issues an
invitation. Creation checks every capability Default grants, as well as Create
users. This prevents an elevated Default group becoming an indirect
privilege-escalation route. The UI hides creation when this condition is not
met and explains why. Fresh installation setup has separate operator proof and
creates the Superuser.

## 2.6.4 Authorization and consistency

Effective capabilities are the union of direct and group grants, expanded by
Superuser at the existing `accounts.ResolvePermissions` / `CheckPermission`
choke point. Individual feature checks do not need to distinguish grant
sources. Require MFA is the OR of the direct requirement and all group
requirements; Superuser does not bypass it. Removing a source leaves other
sources intact.

Direct and group permission edits share `GrantChangesAllowed`: every added or
removed capability is checked against the actor's effective grants. Adding or
removing membership requires authority over every capability carried by that
group, even when another source already grants one of them. Only a Superuser
can assign a Superuser group or change its Superuser grant. Group
names/descriptions need only Manage permissions.

Changes to group grants/requirements refresh all affected members atomically.
Membership changes refresh the affected account. These operations increment
each affected account's permissions revision, invalidate its outstanding
invitation or recovery link, and refresh the non-secret MFA-enrollment
projection from the existing encrypted security record. They do not revoke
sessions or change credentials. Existing sessions resolve effective access on
their next request.

An unenrolled member newly subject to Require MFA enters the existing
restricted setup flow. Enrolled members retain their authenticator, recovery
codes, passkeys, and extra-code preference. Removing the requirement does not
disable existing MFA. Credential recovery protection uses effective
permissions, so accounts made privileged through groups can only receive
credential links from a Superuser.

The transaction rejects removal of the last active, non-pending account with
effective Superuser access. The invariant covers direct-grant removal,
group-grant edits, membership removal, and disabling. Multiple sources on one
account count as one Superuser account. Administration shares the installation
lock, then locks its actor, group/target and affected account records before
committing. All member refreshes, link invalidation, and events share one
transaction. Concurrent access changes cannot each mistake the other for a
remaining Superuser.

Group profile and permission forms use the group revision for optimistic
concurrency. Membership changes supply both the current group revision and the
target account's permissions revision. A stale edit is rejected with
`permissions_changed` rather than applied against different grants. Group
renames change that group revision but do not invalidate credentials or member
links.

## 2.6.5 API

All group endpoints require Manage permissions. JSON mutations retain the
existing Origin validation, no-store responses and session/MFA checks.

| Endpoint | Purpose |
| --- | --- |
| `GET /api/groups?q=&offset=` | List groups with member counts and whether the actor can assign each group. |
| `POST /api/groups` | Create from `name` and optional `description`, with no grants or members. |
| `GET /api/groups/{uuid}` | Group profile, default flag, grants, requirement, revision, and count. |
| `POST /api/groups/{uuid}/profile` | Save `name`, `description`, expected `permissions_version`. |
| `POST /api/groups/{uuid}/permissions` | Save `permissions`, `require_mfa`, expected `permissions_version`. |
| `GET /api/groups/{uuid}/members?q=&offset=` | Paginated member account representations. |
| `POST /api/groups/{uuid}/members/{account}` | Set `member`, with expected `group_version` and account `permissions_version`. |

Account representations add `groups`, `direct_require_mfa`, and
`can_create_users`. `require_mfa` remains the effective requirement. Each
membership includes its group ID, name, revision, direct permission set,
direct requirement and default flag for provenance. Capabilities in
`permissions` remain fully resolved by the server.

Migration 007 creates group, membership and group-event tables and the shared
Superuser-source view, changes future direct-grant defaults to empty, and
creates Default without enrolling existing accounts. The view exists for the
transactional last-Superuser invariant; it is not a second feature permission
engine. Group events record group, actor, optional member UUID, operation, and
timestamp. Account audit events record group access updates. No credential
material is logged.

---

# 2.7 Agent Identities

_Acta / Acta TRM / Accounts and Authority_

> Human-owned agent identities, delegated permission ceilings, name reservations, and connection authorization.

An agent is a persistent account owned by one human. Its UUID and owner are
immutable; its effective access is bounded by the owner on every request.

## 2.7.1 Managing an agent

Create agent asks for a username and optional display name, then opens the
shared permission editor on its detail page. A new agent starts with no site
grants. The editor only lists capabilities the owner holds and excludes
Superuser, Create workspaces, Manage backups, and Edit site guide preferences.
Changes are staged until saved. The owner can edit names, inspect and revoke
individual or all sessions, and disable or re-enable the identity. There is no
delete action; UUIDs and historical references are retained.

The owner's own name-changing permissions do not limit their ability to name
agents. Segment validation is shared with human usernames. Renaming either the
agent or its owner reserves previous full handles against the same agent UUID.
Owner renames also advance the agent's profile revision, so stale profile
forms receive a conflict. Historical handles with a previous owner prefix
remain visible but cannot be selected as a new agent segment under the current
prefix.

## 2.7.2 Delegated access

Effective agent site access is the intersection of its explicit grants and its
owner's current effective permissions. `accounts.ResolvePermissions` is the
common resolution point for browser API, CLI and MCP account checks. A missing
owner projection grants no access. Group membership is resolved on the owner;
agents do not inherit all owner site permissions automatically.

[Workspace access](/acta/technical-reference/accounts/workspaces.md#agent-access)
has separate defaults: all owner workspaces and inherited workspace
permissions, with optional selection and explicit per-workspace overrides.
Workspace creation remains human-only.

When a human loses access through direct grants, group edits, group deletion
or membership changes, the same transaction prunes affected grants from their
agents and advances those agents' permissions revisions. Another remaining
source preserves a grant. Restoring the owner's access later does not restore
previous delegation: restoration requires an explicit grant by the owner.

Disabling an agent revokes all its sessions. Disabling its owner also revokes
all owned-agent sessions and prevents new authorization. Re-enabling either
account does not revive old connections. A unmet owner MFA requirement blocks
agent use and authorization until the human completes enrollment.

## 2.7.3 CLI and MCP authorization

Both browser authorization pages use the same **Act as** selector. It defaults
to the signed-in human and offers their active agents. The human completes the
existing password/passkey/MFA flow and approves the connection. The resulting
session belongs to the selected UUID and records the human who authorized it.
CLI status and MCP `whoami` return that selected identity, including its full
username. An agent cannot authorize another connection.

Human connections remain under User Settings → Security. Agent connections
appear on that agent's detail page. Session expiry stays seven days idle and
thirty days absolute. MCP tool grants remain an additional ceiling; selecting
an agent does not grant extra tools. [Task
tools](/acta/technical-reference/work-records/tasks.md) add workspace-scoped
reading, creation and editing, subject to separately approved MCP tool grants.

## 2.7.4 API and storage contract

- `GET /api/agents` lists the caller's agents, including disabled ones.
- `POST /api/agents` creates an agent with `username` and `display_name`.
- `GET /api/agents/permissions` returns the owner's delegable catalog.
- `GET /api/agents/{uuid}` returns one owned account.
- `POST /api/agents/{uuid}/profile` accepts the same fields and
  `profile_version` as human profile editing.
- `POST /api/agents/{uuid}/permissions` accepts the complete `permissions`
  array and expected `permissions_version`; no MFA requirement is accepted.
- `POST /api/agents/{uuid}/disabled` accepts a `disabled` boolean.
- `GET /api/agents/{uuid}/sessions` lists active connections.
- `POST /api/agents/{uuid}/revoke` accepts a session `id`, or an empty ID for
  all.
- Device and OAuth approval accept an optional `account_id`. Empty or the
  caller's UUID means self; another UUID is accepted only for an active owned
  agent.
- Account responses add `username_segment`, `owner_id`, and `owner_username`;
  `username` remains the full handle.

`AgentStore` extends management persistence; `Security.connectionIdentity`
owns shared CLI/OAuth subject selection. Transactions recheck ownership,
status, session, and owner policy. Account-family mutations lock the human
before an agent, including authentication, naming and permission pruning.
Management retains the installation lock for existing administrative
invariants. Session issuance, authorization records, and events commit
atomically.

Migration 010 adds durable full-handle reservations and session authorizers,
and database guards against agent credentials, groups, browser sessions and
account requirements. The storage boundary includes transactional grant
pruning and revocation.

---

# 2.8 Workspace Access

_Acta / Acta TRM / Accounts and Authority_

> Human membership, group grants, bounded agent access, slug reservations, and workspace transaction rules.

A workspace owns tasks, releases, memberships, and local permissions. Human
membership and agent access follow different rules, both enforced by the
server.

## 2.8.1 Identity and navigation

Each workspace has a stable UUID, a name of 1–100 grapheme clusters, a unique
case-insensitive slug of 1–63 ASCII characters, and an optional description of
up to 1,000 Unicode code points. Slugs contain lowercase letters, digits, and
internal hyphens. Names need not be unique. Renaming a slug reserves the old
slug for the same UUID; old browser links redirect to the current slug only
after checking access. Unavailable workspaces and aliases return not found.

The Workspaces scope sits above Site Settings. Within that scope, the top of
the sidebar becomes a searchable workspace switcher, including a Create
workspace button when permitted. Sign-in and the signed-in root open the last
visited accessible workspace. Visits are stored per account on the server.
With no accessible workspaces, the page offers creation or asks the user to
contact their administrator. The switcher supports search and 50-item
pagination.

Details edits name, slug, and description. Previous slugs appear in an
expandable section. Forms protect unsaved edits and reject stale revisions.
The sidebar and page header remain fixed while the main content scrolls, with
an icon rail on collapse and a navigation drawer on narrow screens.

## 2.8.2 Human access

Workspace creation is human-only and requires the site capability
`site.workspaces.create` (Create workspaces). Superuser includes it. Creation
atomically adds the creator as a member with all workspace permissions,
including task capabilities. Agents cannot receive this site capability or
create workspaces.

A human can access a workspace only through explicit membership or site
Superuser. Site groups do not confer membership. Membership alone permits
basic workspace access; management capabilities are separate:

| Permission | Identifier | Allows |
| --- | --- | --- |
| Edit workspace | `workspace.edit` | Edit name, slug, and description. |
| Manage members | `workspace.members.manage` | List members, search candidates, add, and remove human members. |
| Manage workspace permissions | `workspace.permissions.manage` | List members and site groups; edit their workspace grants. |

Effective workspace permissions are the union of direct membership grants and
grants assigned to the member's site groups. Superuser has every workspace
capability without requiring membership. There are no deny rules. A shared
permission editor shows inherited sources and preserves direct/inherited
overlap. Every added or removed grant is checked against the actor's effective
grants; unchanged grants outside the actor's authority can remain.

Adding a member can activate greater authority through existing group grants.
This is intentional: the grant belongs to the group, not a snapshot of its
current workspace members. Assigning site groups remains under site permission
management and cannot be done from workspace settings. Removing a member
requires holding every workspace capability that member has. Removing explicit
membership does not remove Superuser access.

## 2.8.3 Agent access

Agents have no independent workspace membership. Their owner manages access in
User Settings → Agents → an agent's Workspaces section. Defaults apply to both
existing and newly created agents:

- All workspaces: every workspace the owner can access, including future ones.
- Selected workspaces: only selected UUIDs, always bounded by owner access.
- Inherit from User: enabled separately for each workspace by default;
  effective permissions follow the owner's current workspace permissions.

Unticking Inherit from User reveals the full workspace permission set,
initially copied from the owner's current grants. Saving creates an explicit
set that replaces inheritance, including when the set is empty. Restoring
inheritance clears that explicit set. Access selection and permission edits
are staged until saved; save access changes before opening a workspace
permission editor.

Explicit agent grants are always capped by the owner and are permanently
pruned when the owner loses corresponding grants or workspace access. Site
Superuser changes, site group membership changes and workspace
membership/grant changes participate in this pruning. Restoring owner access
does not restore pruned explicit grants. Inherited permissions naturally
follow restoration. Selection and inheritance choices remain intact when the
owner temporarily loses access.

These defaults apply only to workspace permissions. Agent **site** permissions
remain explicitly delegated as described in
[Agents](/acta/technical-reference/accounts/agents.md). Owner/agent status,
session expiry, and required MFA still apply to every workspace request.
[Tasks](/acta/technical-reference/work-records/tasks.md) adds workspace discovery
and task operations to CLI and MCP. Existing MCP connections keep their
previously approved tool grants.

## 2.8.4 API

All endpoints use existing session, MFA, and Origin protections. List
responses include `more`; paginated lists accept `q` and `offset` with a page
size of 50.

| Endpoint | Purpose |
| --- | --- |
| `GET /api/workspaces` | Accessible workspaces ordered by most recent visit, then name. |
| `POST /api/workspaces` | Create from `name`, `slug`, `description`. |
| `GET /api/workspaces/permissions` | Workspace capability catalog. |
| `GET /api/workspace-slugs/{slug}` | Resolve current or reserved slug after access checking. |
| `GET /api/workspaces/{uuid}` | Workspace details and effective permissions. |
| `POST /api/workspaces/{uuid}/profile` | Save details with expected `version`. |
| `POST /api/workspaces/{uuid}/visit` | Record a visit after access checking. |
| `GET /api/workspaces/{uuid}/members` | Members; `candidates=true` lists human nonmembers. |
| `POST /api/workspaces/{uuid}/members/{account}` | Set `member` with expected workspace `version`. |
| `GET /api/workspaces/{uuid}/groups` | Site groups and their grants in this workspace. |
| `POST /api/workspaces/{uuid}/members/{account}/permissions` | Replace direct grants using `permissions` and workspace `version`. |
| `POST /api/workspaces/{uuid}/groups/{group}/permissions` | Replace group grants using `permissions` and workspace `version`. |
| `GET /api/agents/{uuid}/workspaces` | Owner's available workspaces and this agent's access policy. |
| `POST /api/agents/{uuid}/workspaces` | Save `all`, `selected` UUIDs, and expected agent-access `version`. |
| `POST /api/agents/{uuid}/workspaces/{workspace}/permissions` | Save `inherit`, `permissions`, and agent-access `version`. |

A workspace revision covers profile, membership, and local grants. Agent
access has its own revision covering selection and all per-workspace policies.
Pruning advances affected agent revisions. Stale writes return 409
`permissions_changed`. Visit updates do not change the workspace revision. The
browser refreshes access on focus and relevant saved edits; it is not a push
subscription.

## 2.8.5 Storage guarantees

`internal/workspaces` owns pure validation and access composition. Auth
services own authorization and orchestration through `WorkspaceStore` /
`WorkspaceTx`; PostgreSQL owns persistence. Feature checks consume resolved
permissions rather than reading direct grants independently.

Migration 011 stores workspaces, durable slug reservations, human memberships,
site-group grants, account visits, agent access policies, and workspace
events. Database triggers enforce human membership and agent-only policies.
Writes serialize with existing site administration using the installation lock
and revalidate the actor, session, owner policy and MFA inside the
transaction. Permission edits, revision increments, explicit-agent pruning,
and workspace events commit together. Reads use a repeatable-read snapshot,
including session and access checks, without acquiring write locks. The
storage contract includes these atomicity and consistency guarantees.

## 2.8.6 Returning between scopes

The Workspaces scope button returns to the last visited workspace location,
including its task query and URL fragment. Locations are remembered per
account in the current browser and
survive reloads. A section without a saved location opens its normal index.
Navigation still remembers locations for the current session when browser
storage is unavailable. Site Settings and User Settings retain their existing
entry destinations.

---

# 3.1 Tasks

_Acta / Acta TRM / Work Records_

> Identity, boards, independent field versions, task queries, saved views, and transactional state.

A task belongs to one workspace and has a stable UUID and sequential local
number. Status, assignments, parentage, description, and release targeting are
independent properties. A mutation records its activity and refresh revision
atomically.

## 3.1.1 Identity and hierarchy

Workspace task prefixes contain 2–10 ASCII letters, fold to uppercase, and are
unique across the installation. Previous prefixes remain reserved and resolve
to the same workspace. Numbers begin at one, are allocated transactionally,
and are never reused. Every subtask has its own number.

Parentage stays within the workspace and rejects cycles. Reparenting retains
the task identity. Parent and child statuses and assignments do not propagate
into one another. Descendant assignments shown on a parent are derived
indicators with source task references, not additional direct assignments.

## 3.1.2 Boards and statuses

Tasks and Backlog share task numbering but have separate workflows. Status
names are unique within a board. Tasks accepts 2–50 statuses and distinct
entry and completed selections. Backlog accepts 1–50 statuses and an optional
completed selection; when present, it differs from the entry selection.

A task's status determines its board. Board moves use the status field
revision and select the destination entry status. A specific status change can
select another lane. Children retain their own board and status. A child whose
parent is on another board is also a root in its own board's list.

Status removal replaces affected task statuses and updates the workflow in one
transaction. Stale configuration revisions are rejected. Completion is
computed from each task's board configuration; changing the completed
selection changes which existing tasks count as finished.

## 3.1.3 Permissions

Workspace access permits reading tasks. Changes use the corresponding
capability:

| Capability | Identifier | Controlled operation |
| --- | --- | --- |
| Create tasks | `tasks.create` | Create tasks and subtasks. |
| Edit tasks | `tasks.edit` | Edit fields, archive, restore, and change documents. |
| Comment | `tasks.comment` | Post and manage the caller's own comments. |
| Manage others' comments | `tasks.comments.manage` | Edit or delete another author's comments. |
| Manage statuses | `tasks.statuses.manage` | Configure each board's workflow. |
| Manage releases | `tasks.releases.manage` | Create and edit release records. |
| Edit workspace | `workspace.edit` | Change the task prefix and workspace details. |

New workspace creators receive its capabilities. Superusers resolve every
workspace capability. Agents use owner-bounded inherited or explicit workspace
permissions. Assignment does not grant access or start execution.

## 3.1.4 Fields and concurrency

Descriptions contain at most 100,000 UTF-8 bytes. A task has up to 100 direct
assignees. A newly added assignee has workspace access; an existing
unavailable assignment can remain while other assignments change.

Each editable field has its own revision. Unrelated field edits can commit
independently. A stale same-field edit returns a conflict with the current
value and revision. Repeating the saved value is a no-op. Assignment updates
replace the complete direct set; clearing one assignment is not an implicit
merge.

Priority, type, and size use the shared domain catalog:

| Property | Values in ascending order |
| --- | --- |
| Priority | `none`, `low`, `medium`, `high`, `urgent` |
| Type | `none`, `bug`, `chore`, `feature` |
| Size | `none`, `xs`, `s`, `m`, `l`, `xl` |

Size represents relative effort, not hours. None of these properties rolls up
from children. An omitted update does not clear a field; explicit empty text
clears these properties to `none`. The target release is also direct,
optional, and independently versioned, with no inheritance from the parent.

## 3.1.5 Descriptions and drafts

Rich text and Markdown modes share one draft. Supported structure survives
round trips, while Markdown spelling and whitespace can normalize. Raw HTML
and images remain in source mode. Task documents are stored separately from
the description.

Accessible task references and account handles in prose become UUID-backed
links on save. Existing links, code, and HTML are not rewritten. Unknown or
inaccessible references remain literal. Link labels retain the author's
wording; the UUID target survives renaming.

Title and description autosave after a 700 ms pause. Title blur flushes a
pending save; property choices save immediately. Out-of-order responses do not
regress a newer revision. Conflicts retain the local draft for explicit
reconciliation.

Recovery drafts are scoped by account, task, field, and browser tab. They are
local, not synchronized across devices. A recovered draft is not evidence of a
successful server save. If browser storage is unavailable and navigation would
lose unsaved text, the application asks before leaving.

## 3.1.6 Queries and pagination

Lists use 50-item cursor pages. Ordinary lists show board roots; explicit
parent queries show direct children across boards. `all_depths` selects a flat
hierarchy and cannot be combined with a parent. Filters match any selected
value within a category and intersect across categories. Filtering does not
promote matching children into an ordinary root query.

Sorting occurs before pagination. Task number breaks equal-key ties; status
sorting follows workflow order. Cursor pages are separate live reads, so
concurrent changes can move a task across a boundary. The browser deduplicates
overlapping pages by task UUID and preserves its loaded window during refresh.

Global search covers all depths and both boards. It is distinct from the local
board filter. Archived content is excluded unless explicitly requested.

## 3.1.7 Views and display state

Personal views belong to an account, workspace, and board. Names are distinct
within that scope, have 1–60 characters, and have a limit of 50 views. At
least one view remains. Editing a personal view requires workspace access, not
task editing permission, and compares its revision.

Filters and display choices are saved on the server. A draft remains while
switching views during a visit; reload restores the saved baseline. Search
text is temporary. Column order and percentage widths are browser-local per
preset and do not make the saved view dirty. Hidden columns retain their local
layout.

The display representation has these fields:

| Field | Accepted values |
| --- | --- |
| `mode` | `table`, `board` |
| `columns` | Up to six of `status`, `assignees`, `priority`, `size`, `type`, `release` |
| `sort` | `number`, `title`, `status`, `created`, `updated`, `priority`, `type`, `size` |
| `direction` | `asc`, `desc` |
| `group` | `none`, `status`, `assignee`, `agents`, `priority`, `type`, `size`, `release` |
| `density` | `comfortable`, `compact` |

Grouping and filtering apply before pagination and each group pages
independently. A task can appear in several assignment groups. Assignee
grouping combines a human with their agents; agents grouping is relative to
the authenticated human owner. Retained assignments to unavailable accounts
remain visible.

Dragging changes the property represented by the destination. Assignment moves
remove only the source account in agents grouping, or the source human and
their agents in assignee grouping. Other assignments survive. Unassigned means
no direct assignments remain; dropping there does not silently clear unrelated
assignments.

## 3.1.8 Browser navigation and access changes

Opening a task retains its board and view beneath the detail surface. A wide
workbench uses a side panel, intermediate widths use a modal, and phones use a
full-screen surface. Browser history identifies the selected task. Resizing or
changing presentation preserves mounted drafts.

Temporary connection failures retain loaded work and retry the revision feed.
Access loss and expired sessions clear or redirect the affected view.
Superseded reads are canceled, and an old poll cannot roll back a newer focus
refresh. The server rechecks access independently of the browser's cached
capability list.

## 3.1.9 Persistence

Task mutations serialize with workspace authority changes. Number allocation,
cycle checks, field versions, activity, and refresh revisions commit together.
Read snapshots include authorization. PostgreSQL constraints guard workspace,
parent, and status relationships; clients do not cache authoritative grants.

---

# 3.2 Comments

_Acta / Acta TRM / Work Records_

> Reply relationships, author permissions, read positions, revision conflicts, and retry-safe posting.

Comments share the task's Activity tab with task changes. Posting uses
**Post** or Ctrl/Cmd+Enter. The composer sits at the newest end: below the
feed when oldest first, above it when newest first. Switching order preserves
the composer draft and keeps keyboard traversal in the same order as the page.
Selecting outside a comment or reply composer collapses its editing controls
into a quiet text preview. Select the preview to resume editing the same
draft. Post/Reply sits at the bottom right of the expanded composer, sized to
its label with the standard 46px button height.

Unsent posts are kept in this browser, separately for each signed-in account,
task and reply target. A lost response retains the original request until
retry resolves it; it cannot silently create a second comment. Drafts are not
synced between devices. Comment edits use explicit Save and retain unsaved
text in the open editor on failure; unlike new-post drafts, edits are not
persisted on reload.

## 3.2.1 Conversations

Every top-level comment can have one reply thread. Replying to a reply stays
in that thread and links to the particular comment being answered. Threads
always read oldest first. A reply-count toggle expands them; Reply or
navigation to an unread reply expands the relevant thread automatically.
Replies are paginated in batches of 50, with older replies available on
demand.

Edits retain the author's identity, original position and creation time, and
show an Edited marker. Conflicting edits show the latest content alongside the
local draft for reconciliation before saving against the newer version.
Deletion removes the text and leaves a placeholder; replies and their targets
remain valid. Deleted comments cannot be restored through Acta. Full comment
revisions are not retained.

## 3.2.2 Permissions and read state

Workspace **Comment** (`tasks.comment`) allows posting/replying and editing or
deleting the caller's own comments. **Manage others' comments**
(`tasks.comments.manage`) allows editing or deleting another account's
comments. It does not independently grant posting or editing the caller's own
comments. Actions are hidden when unavailable, and every mutation rechecks
current authority in its transaction. Agent accounts use their existing
workspace inheritance/ceiling; ownership does not make a human and their
agents the same comment author.

New workspaces grant their creator all workspace permissions. Existing
explicit grants are not widened by this addition; superusers and agents
inheriting from them receive the new capabilities through the usual permission
resolver.

Each comment and reply has its own read position. Merely viewing a parent
comment never acknowledges a collapsed thread. Visible focused activity is
acknowledged; CLI and MCP reads remain inert. Someone else's edit makes that
comment unread again, including when a moderator edits the reader's own
comment. New replies and edits keep the parent in place. The feed carries the
latest event's root identity so new-activity navigation can find an updated
thread beyond the first loaded page.

## 3.2.3 API and agent workflow

All endpoints are relative to `/api/tasks/{task}`, where task is a UUID or
reference:

- `POST /comments`: `{body, request_id, reply_to?}`. `request_id` is a
  caller-created UUID reused only for retries of this exact logical post.
  `reply_to` is a comment UUID from the same task; the service derives the
  root thread.
- `GET /comments/{id}`: current comment, author, version, and action
  capabilities.
- `POST /comments/{id}`: `{body, version}` to edit or `{delete:true, version}`
  to delete. Stale mutations return the shared 409 conflict envelope with
  current version/content. Repeating an already-applied value or deletion is a
  no-op.
- `GET /comments/{root}/replies?cursor=...`: newest-first API pagination;
  render oldest first when presenting a conversation.
- `GET /activity`: top-level comments mixed with changes, plus reply counts,
  thread unread state, and latest-event metadata. Replies are fetched
  separately.

MCP exposes `comment_create`, `comment_get`, `comment_replies`,
`comment_update` and `comment_delete`, using the existing Tasks read/write
OAuth grants. The tools use the same typed success/problem envelopes and
authorization as the web app. Call `task_activity`, then `comment_replies`
when a thread matters. Discover UUIDs; do not infer authors or targets from
display names. After an uncertain post, retry the same `request_id` and
inputs. On conflict, read/reconcile before editing.

CLI examples:

```sh
acta task comment add ACT-151 --body 'Review complete.'
acta task comment add ACT-151 --reply-to <comment-uuid> --body-file notes.md
acta task comment get ACT-151 <comment-uuid>
acta task comment replies ACT-151 <root-comment-uuid>
acta task comment edit ACT-151 <comment-uuid> --version 1 --body 'Updated review.'
acta task comment delete ACT-151 <comment-uuid> --version 2
```

`--body-file -` reads stdin. `--json` uses the normal structured CLI output.
The CLI prints a generated post request UUID on stderr before submission;
retry with `--request-id <that-uuid>` and the same inputs if the outcome was
uncertain.

## 3.2.4 Persistence

`task_comments` stores current Markdown, author, version, reply target and the
original request's hash, unique per author/request UUID. Activity entries
carry root-thread relationships, while immutable activity events record the
actor and kind of each mutation without retaining comment bodies. The database
transaction commits content, activity, and workspace refresh revision
together. Write serialization also protects duplicate-post and
expected-version decisions.

Grouping follows the latest raw event, so posting or editing a comment — even
an older one — breaks adjacent task-edit grouping. Comment edits update their
entry's latest event while retaining its first event. Unread attribution uses
the latest event actor, not the original author. Read acknowledgments stay per
entry.

---

# 3.3 Activity

_Acta / Acta TRM / Work Records_

> Atomic task events, presentation grouping, sparse read acknowledgments, and stable history pagination.

Task activity combines recorded changes with comments and replies. Changes and
their activity entries commit in the same transaction, so the feed does not
announce a failed edit.

## 3.3.1 Records and grouping

Task creation, title/description edits, status changes, assignment
replacement, and reparenting record activity in the same database transaction
as the change. Workspace status removal also records each affected task's
status replacement, with the operator as actor and an explicit replacement
reason. Saved-value retries, failed validation, and stale conflicts do not
emit events. Existing tasks receive no synthetic backfill: their activity
starts with new changes.

Raw events have a stable sequence, group ID, workspace and subject references,
actor UUID, schema version, timestamp and an explicitly selected change
payload. Title changes retain their before/after text. Statuses retain UUIDs
and names; parents retain UUIDs and task references; assignments retain
account UUIDs and handles. Description events record that an edit occurred,
never the description body. This is not full revision history or comprehensive
security auditing.

Actors are resolved by UUID for display. Agent ownership is immutable (already
enforced by the account schema), so ownership is derived from the agent
account instead of copied into every event. Event actor references prevent
hard deletion of historical identities. Historical change labels are preserved
even if the referenced status/account/task is subsequently renamed.

Only consecutive events on the same subject with the same actor, kind, field
and reason can group. Each successful edit extends a 60-second inactivity
window; 60 seconds from the latest edit is inclusive. A different
actor/field/reason or another event kind breaks the group. Posting, editing or
deleting a comment creates a barrier, including mutations on older threads.
Grouped entries show the first before value, latest after value, latest
timestamp and number of changes. Raw events remain separate.

`activity_events` is append-only; a trigger rejects row updates/deletes.
`activity_entries` is a mutable presentation projection with stable group IDs
and first/last event positions. Both are updated atomically under the existing
workspace mutation lock order. This is not tamper protection against a
database administrator. The persistence boundary serializes each subject and
commits domain state, events, and projections together, with stable ordering
and consistent read snapshots. The shared table supports other subject types,
but only task activity is exposed.

## 3.3.2 Visibility and read tracking

Anyone who can access the task can read its activity; there is no separate
activity permission. Every fetch and acknowledgment revalidates
account/session and current workspace access, including agent delegation.
Workspace and site activity feeds are not exposed.

Read acknowledgments are server-side and belong to the calling account. They
identify a particular grouped entry and the last event actually displayed.
Acknowledgments only advance, cannot cross tasks or acknowledge nonexistent
positions, and never mark a later extension read. They are deliberately
sparse: seeing recent entries cannot mark unseen older entries read when the
user reverses order or has not loaded earlier pages. A user's own events are
excluded from unread calculation; their agent's events remain distinct.

The browser acknowledges visible entries after a short pause only while
Activity is selected, the document is visible and focused, and the entry is
not covered by another UI element. Opening Subtasks or fetching activity
through CLI or MCP does not mark it read. An unread dot appears on Activity;
unseen entries receive a subtle highlight and a New activity divider.
Highlights remain for the current task visit even after acknowledgment, while
the dot reflects remaining unread activity. A grouped item extended after
acknowledgment becomes unread again. Read changes from other browsers refresh
on focus or the periodic refresh.

## 3.3.3 Ordering, scrolling, and live updates

The browser defaults to oldest first, and remembers the ordering preference in
local storage across tasks. The order button occupies the same tab-bar
position as Add subtask on Subtasks. Activity opens by default, but opening a
task starts at its title. Explicitly selecting Activity scrolls to the latest
loaded entry in the chosen order. Older entries load on demand above/below the
feed as appropriate.

The card body scrolls as one surface; the toolbar remains fixed. Incoming
events follow automatically only when the reader is already at the latest
entry. Otherwise the visible entry anchor is preserved and a New activity
arrow offers a jump to the latest entry. Reduced-motion preferences suppress
smooth scrolling. Workspace revision changes drive content refresh;
focus/recovery and a 15-second visible-document refresh also reconcile
activity/read state. Refreshes retain the loaded history window and cancel
superseded requests.

## 3.3.4 HTTP, CLI, and MCP

`GET /api/tasks/{uuid-or-reference}/activity?cursor=...` returns grouped
entries newest first, at most 50 per page, with `more`, an older-page
`cursor`, and task-wide `unread`. Event positions/cursors are decimal strings
to preserve 64-bit precision in JavaScript. Entry IDs are UUIDs. Ordering uses
immutable first-event positions; extending the latest group does not move its
identity across pages.

`POST /api/tasks/{uuid-or-reference}/activity/read` accepts up to 50 visible
positions:

```json
{"entries":[{"id":"ENTRY_UUID","through":"123"}]}
```

Ordinary API session, Origin, and MFA protections apply. Read acknowledgments
do not themselves create activity or increment the workspace task revision.

```sh
acta task activity ACT-151
acta task activity ACT-151 --cursor 123 --json
```

MCP `task_activity` takes `task` and optional `cursor`, and uses the existing
`tasks.read` grant and typed data/error envelope. It neither marks history
read nor adds a new consent category. Clients can need to refresh their tool
catalog. Both CLI and MCP return newest-first pages without applying browser
preferences.

---

# 3.4 Task Documents

_Acta / Acta TRM / Work Records_

> Immutable document versions, byte storage, limits, revision checks, and authorized file transfer.

Documents belong to a task. Open its **Documents** tab to upload a file,
preview it, download it, browse previous versions, upload a replacement or
delete it. The tab shows the current document count, including before it is
opened. Versions do not inflate that count. A document keeps the same UUID
across updates. Each update creates an immutable version with its own file
UUID, revision, title, filename, detected media type, size, SHA-256 digest,
creator and timestamp. Previous bytes never change.

Each version can be up to 20 MiB. Empty files are allowed. PNG, JPEG, GIF and
WebP images, PDFs, Markdown and plain text have previews. Text previews are
limited to 1 MiB. Other formats remain downloadable. HTML and SVG are not
executed; file downloads use attachment disposition and restrictive response
headers. Uploaded content is untrusted, including instructions inside
documents.

## 3.4.1 Access and consistency

Workspace task readers can read documents and every version. Task edit
permission (`tasks.edit`) is required to create, replace, or delete. These
checks run for every metadata and file request; a saved download URL does not
grant access. MCP uses the existing `tasks.read` and `tasks.write` tool grants
as well as the account's current workspace permissions.

Updates and deletion require the latest document revision. A stale revision
returns HTTP 409 (`document_changed`) without changing files or activity. The
UI keeps the selected upload after an error; reload the document before
deciding whether to replace a newer version. A supplied creation UUID cannot
be reused to create another document. There is no automatic overwrite on
conflict.

The latest pointer, immutable metadata, bytes, and task activity are committed
in one database transaction. File bytes live in a separate PostgreSQL table so
list, version-history and activity queries do not retrieve them. Include these
tables in normal database backups. Deleting a document deletes all versions
and stored bytes; the task's activity record remains. Acta has no recycle bin,
full-text indexing, or total-storage quota beyond the per-file limit.

## 3.4.2 Agents and CLI

MCP tools: `documents_list`, `document_get`, `document_versions`,
`document_read`, `document_save`, `document_delete`. Lists are paginated (50
entries); follow `cursor` or `before`. A read returns up to 32 KiB, UTF-8 for
valid text and base64 otherwise. Use `next_offset` and pin the returned
revision to avoid mixing versions. `document_save` accepts exactly one of
`content` or `base64`, with a 128 KiB inline-payload limit. Use the CLI for
local or larger files:

```sh
acta --profile default document list ACT-96
acta --profile default document upload ACT-96 ./design.pdf --title 'Design'
acta --profile default document upload ACT-96 ./design.pdf --id UUID --revision 1
acta --profile default document download UUID --revision 1 --output ./design-v1.pdf
```

Download defaults to the latest revision if `--revision` is omitted. It
creates a new local file, never overwrites one, and removes a partial file on
failure. CLI transfers are binary; they do not put base64 into an agent's
context.

Task documents belong to their task and retain immutable versions.

---

# 3.5 Task Search

_Acta / Acta TRM / Work Records_

> Search matching, ranking, access filtering, excerpts, and cursor behavior across task hierarchies.

The sidebar Search action and Ctrl/Cmd+K open global search. The popup
searches every accessible workspace and every subtask depth, including
completed tasks and tasks excluded by the current view's filters. The
workspace picker optionally narrows the scope. It accepts 2–200 characters,
waits briefly while typing, and cancels obsolete requests. Arrow keys or
Ctrl+N/Ctrl+P select the next/previous result, Enter opens it, and Escape
closes search.

Below 760px, Search fills the visible screen. A horizontally scrollable
workspace pill bar sits at the top, including All workspaces. Results scroll
between that bar and the focused search input with a 44px X control at the
bottom. Mobile hides the Include archived checkbox; desktop retains its
workspace picker and checkbox. The overlay follows the visual viewport so the
controls stay above the software keyboard, respecting safe areas. Selecting a
result, X, or Escape closes it; selecting empty space does not dismiss it or
activate the page underneath. Desktop retains its centered popup. Backdrop
dismissal occurs on select rather than pointer-down so the page remains inert
throughout the dismissal gesture.

Results contain one row per task: reference, title, status, workspace,
ancestors, and an excerpt of the best matching description or comment.
Highlighted spans are plain text, never provider-supplied HTML. Selecting
opens the existing task viewer beside the current page when space permits, as
a modal when narrower, and full screen on mobile. The current page and its URL
remain unchanged. A comment match opens its discussion in a highlighted
Matching comment section of Activity, even when outside the loaded activity
window. Back to latest returns to ordinary activity. Access is checked again
when opening it.

## 3.5.1 Matching and storage

PostgreSQL stored generated vectors and GIN indexes cover task titles,
descriptions and non-deleted comment bodies. They update in the same
transaction as their source rows; there is no separate indexing service or
synchronization queue. Existing content is indexed by the migration. No
extension is required.

Exact task UUIDs and current or previous references rank first. Exact titles,
title-word matches and title-word prefixes rank above description matches,
then comments. Descriptions/comments use English word stemming; title prefixes
use the simple dictionary to retain names and short terms such as "IT".
Queries are plain words, not a Boolean query language. This is lexical search,
not semantic or typo-tolerant search. Alternative wording can find different
results.

The best source per task is selected before paging, so many matching comments
cannot fill a page with duplicates. Matching title/description words can span
both fields. If content changes or a comment is deleted, the next query sees
the new content. Workspace filtering uses the normal human/agent access rules
inside the same consistent database read as search.

## 3.5.2 Shared API

- HTTP: `GET
  /api/tasks/search?q=words&workspace=optional-slug&cursor=optional`.
- MCP: `task_search({"query":"words","workspace":"optional-slug"})`, under the
  existing `tasks.read` grant. Omit workspace to search everywhere allowed.
- CLI: `acta task search "words" [--workspace slug] [--cursor cursor]
  [--json]`.

Each page contains `tasks`, `more` and `cursor`, with at most 25 compact task
results. A result includes `id`, `reference`, `title`, `status`,
`workspace_id`, `workspace_slug`, `workspace_name`, `ancestors`, `source`,
`excerpt`, and an optional `comment_id`. Excerpts are arrays of
`{text, match?}` spans. The browser renders text normally and highlights spans
with `match:true`. Use `task_get` to read full details, or `comment_get` for
the matched comment.

The opaque cursor binds the query and workspace and continues by rank and
UUID, not offset. Keep these inputs unchanged while paging. Each request
rechecks permissions. Search is a live view: edits between pages can change
rank or membership; restart the search for a fresh result set rather than
treating a multi-page search as an immutable export.

The [agent guide](/acta/connections/agent-guide.md) directs agents to search and
try alternative wording before creating work. Exhaustive checking is reserved
for concrete evidence that a task already exists; ordinary creation does not
call for scanning an entire workspace.

---

# 3.6 Task Archiving

_Acta / Acta TRM / Work Records_

> Atomic subtree archiving, batch-specific restoration, read-only behavior, and archive query options.

Archiving makes a task and its active descendants read-only while preserving
identities, content, assignments, documents, and followers. Completion and
archiving are independent.

## 3.6.1 Transactions and restoration

`archived` and `archived_at` appear on task detail; compact lists/search
include `archived`. `versions.archived` is an independent optimistic
concurrency version. Archive/restore requires the existing workspace
`tasks.edit` permission.

Archiving stamps every active descendant with one batch UUID and timestamp and
increments each changed task's archive version. Existing archived descendants
keep their own batch. Restoration clears only the target's batch within its
subtree. A target with an archived parent cannot be restored independently.
This preserves separately archived children, while restoring ordinary
descendants atomically. A same-state retry is idempotent; a stale
opposite-state change is a conflict. Normal task writes and archive operations
share the existing serialized workspace authority transaction, so
creation/reparenting cannot strand an active child under an archived parent.

Archived tasks reject task edits, child creation/reparenting into them,
comment creation/edit/deletion, and document upload/replacement/deletion.
Reads, download, following, and read acknowledgments still work. The UI hides
edit controls and shows an Archived banner with Restore. Archive/restore
records a root task activity entry and notifies its followers through existing
notification rules.

## 3.6.2 Interfaces

- `POST /api/tasks/{task}/archive` with `{archived: true|false, version: N}`
  returns the task. `version` comes from `versions.archived`.
- Ordinary lists default to active only. `GET
  /api/workspaces/{workspace}/tasks?archived=true&state=all` lists only
  archived roots (including archived children whose parent is active). Supply
  `parent` for direct archived children. Other filters and pagination apply.
- `GET /api/tasks/search?...&include_archived=true` includes both active and
  archived matches. The cursor binds this option along with query/workspace.
- MCP `task_archive` / `task_restore` take `task` and `version`, under
  `tasks.write`. `tasks_list` takes optional `archived`; `task_search` takes
  `include_archived`.
- CLI: `acta task archive ACT-12 --version 1`, `task restore ACT-12 --version
  2`, `task list -w acta --archived`, `task search query --include-archived`.

The archive icon beside Search in the task header opens the separate workspace
Archived view, which keeps independent temporary filters and preserves active
preset drafts. Global search hides archived matches by default; its Include
archived checkbox exposes them explicitly.

---

# 3.7 Releases

_Acta / Acta TRM / Work Records_

> Workspace release records, informational states, direct task targeting, progress, and update conflicts.

A release groups tasks in one workspace under a name, state, and set of notes.
Progress counts directly targeted active tasks at every hierarchy depth.

## 3.7.1 Release records

A release belongs to one workspace and has:

- a **name**, 1–60 characters, unique in the workspace case-insensitively (for
  example `2026.9`);
- an optional **codename**, at most 60 characters (for example `Bedrock`);
- a **state**;
- Markdown **notes**, at most 100,000 bytes, which also serve as the release
  notes. Task references in the notes are linked, as in task descriptions;
- one **version** for the whole record.

| State | Meaning |
| --- | --- |
| `planned` | The release exists and work can target it, but nobody is working toward it. The default. |
| `open` | The release is taking work. Several releases in a workspace can be open at once. |
| `frozen` | No new work starts; only work already in flight finishes. |
| `released` | The release has shipped. |

Any transition is allowed, including backwards (for example frozen → open), so
a mistaken transition can be undone. States are informational: Acta does not
stop a task from targeting a frozen or released release.

Releases cannot be deleted, so a task's target never dangles. Rename a release
instead of replacing it.

Releases are listed in natural name order everywhere: runs of digits compare
as numbers and other text compares case-insensitively, so `2026.8` < `2026.9`
< `2026.10`. There is no manual ordering.

Creating and editing releases requires the workspace's **Manage releases**
permission (`tasks.releases.manage`). Workspace creators receive it with every
other workspace permission, and site superusers hold it everywhere. Existing
members are not granted it automatically. Reading releases needs only
workspace access.

Edits change only the supplied fields and require the release's current
version. An unchanged retry succeeds without a new version. A stale edit fails
with `release_changed` (HTTP 409); read the release again and reconcile.

## 3.7.2 Progress

A release reports `total` and `finished`. Both count active (unarchived) tasks
that target the release directly, at any depth. A task is finished when it
holds its own board's completed status. Backlog starts without a completed
status. If none is configured, its tasks contribute to `total` but not
`finished`.

## 3.7.3 Target release on tasks

`release_id` is an optional task field with its own field version, like
`parent_id`. An empty value clears it. It is set directly on each task and is
**not inherited**: subtasks of one parent can target different releases. The
service rejects a release outside the task's workspace. Setting it requires
Edit tasks.

Tasks, summaries and search results carry a compact `release` object with the
release's `id`, `name`, `codename` and `state`, or `null`. Readers can see
that a release is frozen without a second request. Changes appear in task
activity with the release names before and after.

## 3.7.4 Filtering and grouping

List queries accept release selections: release UUIDs, or `none` for tasks
without a release. They match any selected value and intersect with the other
filter categories. Group by Release returns a `none` group named "No release"
first, then every release in natural order.

Like other filters, release filters match one hierarchy level: roots by
default, or a parent's direct children. Set `all_depths` to match tasks at
every depth instead, which is how to list everything targeted at a release.
`all_depths` cannot be combined with a parent.

Saved views store release selections in `filters.releases`. Display options
accept `release` as a Group by value and as an optional column.

## 3.7.5 Web

**Releases** sits in the workspace navigation beside Tasks and Backlog. The
Releases page lists every release in natural order with its codename, state
and finished/total progress; released releases are dimmed. Accounts with
Manage releases see **New release**, which asks for a name, an optional
codename and a starting state.

Opening a release shows its progress, notes and tasks. Managers can switch its
state with the state control (any direction), rename it, and edit its notes. A
stale save reloads the latest release and says so, rather than overwriting
another change. The task list shows every task that targets the release
directly, at any depth and on either board, as a flat list; opening a task
goes to it on its own board.

On a task, **Release** sits beside Priority, Type and Size. Its label shows
the target release's state, for example "Release · Frozen". The filter menu
has a Release section (including None), Display offers Release as a Group by
option and as a column, and board cards show the release when that column is
selected. Grouping the board by release gives a No release column first;
dragging a card between columns changes its release, and creating a task in a
release column targets it.

## 3.7.6 Interfaces

HTTP:

| Method and path | Purpose |
| --- | --- |
| `GET /api/workspaces/{workspace}/releases` | `{"releases": [...]}`, in natural order, with notes and progress. |
| `POST /api/workspaces/{workspace}/releases` | Create from `name`, optional `codename`, `state`, and `description`. Returns 201. |
| `GET /api/workspaces/{workspace}/releases/{release}` | One release. |
| `POST /api/workspaces/{workspace}/releases/{release}` | Update the supplied `name`, `codename`, `state` and `description`, with `version`. |

Task list queries accept repeated `release` parameters and `all_depths=true`.
Task creation accepts `release_id`; task edits use field `release_id`.

MCP:

| Tool | Purpose | Grant |
| --- | --- | --- |
| `releases_list` | Releases with state and progress, without notes | `tasks.read` |
| `release_get` | One release, including notes | `tasks.read` |
| `release_create` | Create a release | `tasks.write` |
| `release_update` | Change the supplied fields with the current version | `tasks.write` |

`tasks_list` accepts `releases` and `all_depths`; `task_create` accepts
`release_id`; `task_update` accepts field `release_id`; `task_groups` accepts
`release`.

CLI:

```sh
acta release list -w acta
acta release create -w acta --name 2026.9 --codename Bedrock --state open --notes-file notes.md
acta release edit RELEASE-UUID -w acta --state frozen --version 3
acta task list -w acta --release RELEASE-UUID --all-depths --state unfinished
acta task edit ACT-151 --field release_id --version 1 --value RELEASE-UUID
acta task edit ACT-151 --field release_id --version 2 --clear
```

---

# 3.8 Task Notifications

_Acta / Acta TRM / Work Records_

> Following preferences, notification reasons, access checks, and revision- bound read acknowledgments.

The small bell beside a task's menu follows or unfollows that task. A filled
bell means following. Anyone who can read the task can follow it; editing
rights are not required. The preference belongs to the signed-in human and
persists across devices. Agents cannot change it directly.

Creating a task or receiving a direct assignment automatically follows it for
the human account, including when the creator or assignee is one of their
agents. Human and agent assignments to the same owner produce one follow.
Removing an assignment does not remove following. Explicit unfollowing is
retained and is never overwritten by later assignments. Existing creators and
assignees are seeded on installation without sending historical notifications.

The shared sidebar inbox includes changes, comments and document activity on
followed tasks. Direct assignments, new resolved @mentions, and replies to the
recipient's comments notify that person even without following. Multiple
reasons produce one notice per activity item. A human's actions do not notify
that same human; their agents' actions can, with the agent identified as the
actor. References inside code do not create mentions. Editing unrelated text
does not re-notify a non-follower about an existing mention.

Selecting a notification opens its task and acknowledges that notice. Viewing
activity acknowledges only the revisions actually seen. Rapid changes share
the activity feed's existing grouping window, updating one inbox record. A new
change after reading makes that record unread again. Deleting a comment
resolves its notice; deleting a task removes its notices and following
preferences.

Task alerts use the existing opt-in Web Push subscription. The worker
suppresses an alert when that task is already visible and focused. Reading the
inbox or fetching a push notice rechecks current workspace access, so revoked
members cannot receive task details. See [Push
delivery](/acta/technical-reference/application/pwa.md) for deployment setup.

## 3.8.1 API and storage

- `GET /api/tasks/{task}/following` returns `{"following":true}` or false.
- `POST /api/tasks/{task}/following` accepts the same explicit boolean. Both
  endpoints require an authorized human session and normal workspace access.
- `GET /api/notifications` is the unread task inbox. Task records
  include `task_id`, `workspace_slug`, `task_reference`, `task_title`, and
  `activity_id`. Counts are keyed by the task UUID.
- `POST /api/notifications/read` acknowledges exact notification
  IDs/revisions. The request contains `items`, each with an `id` UUID and a
  positive `revision`. It accepts between 1 and 200 items and requires a human
  session. A newer revision remains unread.

`task_followers` retains explicit true/false preferences per task and human.
`notifications` holds task records, each with a required task UUID.
Task mutations, activity, following, and notification/push intents commit
in one transaction. Task notice uniqueness is `(owner, task, activity entry)`.
Replayed comment requests and rolled-back mutations cannot create extra
notifications. Revision-bound reads also advance the corresponding activity
read position; stale reads never acknowledge newer grouped changes.

---

# 3.9 Memories

_Acta / Acta TRM / Work Records_

> Knowledge scopes, access boundaries, revision-checked writes, recall pagination, and explicit client reads.

Memories are core Acta records available across authorized client sessions.
They store durable standalone knowledge. Task-specific progress, decisions,
and findings belong in task descriptions/comments; public documentation
belongs in maintained Learn documentation. Do not store facts readily
rediscovered from current source.

## 3.9.1 Scopes and permissions

- Workspace is the normal destination. Anyone with workspace access can read;
  `memories.write` controls create/edit/delete and follows the existing agent
  workspace policy and owner permission ceiling.
- User is only for person-specific knowledge across projects. Humans manage
  their own memories. Agents automatically read their owner's user memories;
  writes require an explicit `own.memories.write` agent grant and that
  permission on the owner. Sibling agents do not share agent-scoped memories.
- Agent is rare, for knowledge specific to a persistent Acta agent
  identity/role. The agent and its human owner can read/write it. Clients
  using the same agent identity share these records. Learning something does
  not make it agent-specific.
- Site is rare, for truly global knowledge across the installation.
  `site.memories.read` and `site.memories.write` govern it; writing also
  requires read access. Superusers have these capabilities. No automatic
  cross-user access to private memories is granted to site administrators.

Save always requires an explicit destination, never a fallback scope. UUIDs
are stable; keys are unique within a scope and use 1–100 lowercase
letters/numbers/ hyphens. Summaries are up to 500 bytes; Markdown content up
to 64 KB. Author and editor account UUIDs and timestamps are retained.
Updates/delete require the revision read. There is no append mode: read the
current memory, reconcile the new knowledge into its content, and save using
that revision. Concurrent changes return HTTP 409 `memory_changed`. A memory
cannot be moved to another scope by updating it. Duplicate creation keys
return validation errors instead of silently overwriting. Invalid
scope/selector combinations (such as workspace on an agent memory) return
validation errors. Creating at site scope without its required account
permissions returns forbidden. Reading an inaccessible memory by ID still
returns not_found, protecting private records. Deletion is permanent.

## 3.9.2 MCP and HTTP

Authorize `memories.read` and `memories.write` on the normal Acta MCP
connection. Existing connections do not silently gain these grants: use **Edit
access** on the connection in session settings and select the memory
checkboxes. Tools share the same transactions and permissions as the browser
and CLI-authenticated HTTP requests.

- `memory_recall({workspace:null,query?,cursor?})` combines accessible site,
  user/owner, and own-agent summaries. Providing a workspace UUID/current or
  old slug adds that workspace. Search matches key, summary and content
  literally, case-insensitively. MCP entries contain only `id`, `scope`,
  `key`, `summary`, and `revision`; IDs allow retrieval and scope
  distinguishes repeated keys. Browser recall retains its metadata for the
  management UI. Pages contain 50 summaries sorted by key/UUID. Cursors bind
  the query and scopes and access is checked on every request.
- `memory_get({id})` retrieves Markdown, attribution, revision, and write
  ability.
- `memory_save({scope,workspace?,id?,key,summary,content,revision})` creates
  with revision 0/no ID, or edits using ID/current revision. User/agent
  identity is derived from authentication. Its tool description contains scope
  guidance.
- `memory_delete({id,revision})` deletes with write permission.

HTTP endpoints: GET `/api/memories`, GET `/api/memories/{id}`, POST
`/api/memories`, POST `/api/memories/{id}/delete`. The human browser at User
Settings → Memories can select an owned agent using `agent_id` and add a
workspace. MCP does not expose agent selection. Recall never injects full
memory bodies into external tools automatically. Clients read relevant
records explicitly.

---

# 4.1 Command-Line Connections

_Acta / Acta TRM / Connections and Tools_

> Named profiles, browser device authorization, credential storage, token overrides, and command output.

The command-line client stores named server profiles and obtains its
credentials through browser authorization. Profile selection, credential
storage, and server sessions are separate concerns.

## 4.1.1 Profiles

`default` is an ordinary, automatically available initial profile. An active
profile is used unless a command supplies `--profile NAME` or `-p NAME`. An
unknown profile is an error, never a fallback. Creating a profile does not
change the active selection.

```sh
acta login localhost:8081
acta profile add work --server https://acta.peios.org
acta -p work login
acta profile use work
acta profile list
acta whoami
acta -p default status --json
acta logout
```

`acta login [server]` uses the supplied URL first, then the selected profile's
saved URL, then an interactive prompt. URLs default to HTTPS; loopback
addresses can use HTTP. Paths, embedded credentials, queries, and fragments
are rejected. Redirects are not followed, preventing credential forwarding, or
silent changes of server. A differing saved URL requires confirmation, or
`--change-server`. Declining cancels sign-in. Canonically equivalent URLs do
not prompt.

A profile with a saved sign-in offers to create another profile, replace its
sign-in, or cancel. `--new-profile NAME` and `--replace` provide explicit
non-interactive choices. A new profile can use the selected profile's server;
an explicit URL still takes precedence. Interactive creation asks whether to
make it active.

URL and credential changes are saved only after successful authentication.
Config updates use a file lock and atomic replacement; sign-in checks that its
profile has not changed while browser approval was pending. Failed persistence
attempts revoke the new session. Replacing a sign-in attempts to revoke the
old profile session and reports failures without undoing the new sign-in.

## 4.1.2 Browser sign-in

The CLI requests a ten-minute device handoff with a random 256-bit private
polling secret and a separate eight-character, case-insensitive user code. The
code uses an unambiguous alphabet and displays as `ABCD-2345`. Separators and
whitespace are ignored when entering it. Only digests of both codes are
stored.

The CLI opens `/login/device?code=...` and prints both the complete link and
the manual-entry URL `/login/device`. `--no-browser` suppresses automatic
opening. The existing sign-in page handles password, passkey and MFA
authentication and returns to the device page. Approval checks completion of
required MFA enrollment. The page displays the account, matching code, and
client-supplied machine label; the user explicitly authorizes or declines.
Visiting the link alone grants nothing. The shared Act as selector defaults to
the human and can select an active [owned
agent](/acta/technical-reference/accounts/agents.md). Choosing another human
account signs out the current browser account first.

Creation is limited to 10 requests per source address per five minutes, code
lookups to 30 per address per five minutes, and polling to once per five
seconds per valid request. The CLI backs off when asked to slow down. Client
addresses follow the deployment proxy trust policy. Forwarded addresses are
accepted only through explicitly trusted transport peers.

Approval locks the account and device request, revalidates the browser session
and MFA policy, and atomically creates a CLI session with an encrypted
temporary handoff credential. Only the private polling secret can retrieve it.
Retrieval rechecks active account policy and that the issued session has not
been revoked, then consumes the handoff. Concurrent approval or collection
cannot duplicate it. A lost successful collection response requires a new
sign-in; the uncollected session remains revocable from Security or the
selected agent's detail page. Expired device records are cleaned by the
existing authentication maintenance job.

CLI sessions have independent opaque `cli_` credentials and use the same
session store and policy as browsers: seven days idle and thirty days absolute
expiry. They appear in Security (or the selected agent's detail page) as
`CLI · acta · <machine>` and respond to ordinary session revocation, account
disabling and credential-change revocation. The machine label is descriptive,
not device attestation. CLI bearer credentials cannot authorize another device
request. Browser session credentials cannot be used through the bearer
transport. Browser mutations retain Origin checks; originless device
start/poll and CLI bearer requests remain JSON-only.

## 4.1.3 Credentials and headless operation

The OS credential store is preferred (Secret Service on Linux, Keychain on
macOS, Credential Manager on Windows through go-keyring). If saving fails,
sign-in falls back to a private plaintext credential file and prints its
location. `--insecure-storage` explicitly selects this file mode. Unix files
are mode 0600; Windows files receive a protected DACL granting only the
current user access. Existing keyring read failures are reported, not silently
replaced with file credentials. No saved session secret is printed by status
or JSON output.

Profile configuration lives in the OS user config directory under `acta`:
`config.json` contains the active profile, server URLs, and opaque credential
references. File credentials live separately under `credentials/`. Set
`ACTA_CONFIG_DIR` to override the directory, useful for isolated
automation/tests. Credential references are random IDs, independent of profile
names and URLs.

`ACTA_TOKEN` overrides the selected profile's saved credential without writing
it to disk. The profile still supplies the server. `status` (also available as
the `whoami` alias) identifies the source as `ACTA_TOKEN`, keyring, or a
credential file. The sign-in command refuses while the override is set,
explaining how to unset it. Logout with an environment token revokes that
session and tells the caller to unset the variable; saved profile credentials
are retained. Ordinary sign-out revokes the saved session before removing its
local credential, retaining the profile URL. Acta does not add a separate
personal-access-token creation interface.

`--json` emits machine-readable results on stdout and notices/errors on
stderr. Failures exit nonzero. Prompts require a terminal; missing decisions
otherwise produce errors explaining the necessary arguments. Device approval
can still run headlessly with `--no-browser`: a human completes the printed
browser flow. `ACTA_ACCESSIBLE=1` uses Huh's accessible line-based prompts.
`completion` emits Cobra shell-completion scripts, including profile-name
completion.

## 4.1.4 Tasks

[Task interfaces](/acta/technical-reference/connections/task-interfaces.md)
provides the find → inspect → change workflow, command examples,
query/pagination semantics and explicit edit/conflict handling. Commands
include workspace discovery, task list/get/create/edit, statuses, people, and
assignment groups. Workspace-scoped commands accept a UUID or slug. Human
output uses compact tables and detail text; `--json` retains typed fields,
UUIDs, versions, and cursors. API errors preserve code, field validation, and
current conflict details on stderr. Run `acta task --help` for the command
surface.

`acta task activity REFERENCE` reads grouped history without marking it read.
`--cursor` selects older pages and `--json` selects structured events. See
[activity](/acta/technical-reference/work-records/activity.md).

See [Task comments and
replies](/acta/technical-reference/work-records/comments.md) for threaded
discussions, read state and CLI/MCP comment commands.

---

# 4.2 MCP Connections

_Acta / Acta TRM / Connections and Tools_

> OAuth discovery, consent, rotating tokens, connection grants, and the composed agent guide.

Acta serves the Model Context Protocol (MCP) over Streamable HTTP at `/mcp`.
OAuth connections combine approved tool grants with the authenticated
account's live authority.

## 4.2.1 Connect

An OAuth-capable Streamable HTTP client connects to the installation's
canonical `/mcp` endpoint. Discovery and token audience checks use the exact
origin configured by `ACTA_PUBLIC_URL` and that path.

The client discovers OAuth automatically and opens an Acta consent page.
Existing password, passkey, and MFA sign-in flows return to that request.
Authorization checks completion of required MFA enrollment. The page displays
the client-supplied name, identity access, task read/write choices and a
shared Act as selector. It defaults to the human and can select an active
[owned agent](/acta/technical-reference/accounts/agents.md). Every new connection
requires explicit approval. Cancel returns `access_denied` to the validated
client callback. "Use another account" signs out the browser first. Client
names are labels, not verified publisher identities.

For Codex, after building/running Acta:

```sh
codex mcp add acta --url http://localhost:8081/mcp
codex mcp login acta
```

The server implements dynamic client registration for public clients; clients
need no manually provisioned client ID or secret. It does not advertise client
ID metadata documents or fetch client-supplied URLs. HTTPS callbacks and HTTP
loopback callbacks are supported. Loopback IP callbacks can change port while
retaining their registered address, path and query (RFC 8252).

## 4.2.2 Consent, grants, and sessions

The OAuth scope `acta` requests Acta access. It does not grant every present
or future tool. Approval snapshots the connection's explicit grants in its
session; `identity.read` exposes `whoami`; optional `tasks.read` and
`tasks.write` expose the task tools; `memories.read` and `memories.write`
expose memory tools. Existing connections do not automatically gain new
capabilities. The human can amend access in session settings without repeating
OAuth.

Each request reloads the active account and connection grants before creating
the MCP server's tool catalog. Both listing and calling tools use that same
catalog. Account permissions remain a separate, additional boundary for any
task operations. Disabling an account or imposing an unmet MFA requirement
takes effect on the next MCP request or refresh.

Human connections appear in User Settings → Security; agent connections appear
on that agent's detail page. Both show `MCP · <client name>`, with the
connection's approved capabilities. Sign out revokes the entire connection,
including all of its access and refresh tokens. Sign out all other sessions
and the existing credential-change revocation rules apply to MCP too. Browser
and CLI sessions are independent. Removing a connection does not sign its
approving browser out.

## 4.2.3 Protocol and security boundaries

- Discovery: `/.well-known/oauth-protected-resource/mcp` (also the root
  metadata route) and `/.well-known/oauth-authorization-server`.
- Registration: `POST /oauth/register`, JSON metadata. Unknown metadata is
  ignored.
- Authorization: `GET /oauth/authorize`, code flow with S256 PKCE and exact
  resource audience. An opaque, browser-bound consent request lasts ten
  minutes.
- Browser consent: `/login/oauth`, using authenticated, Origin-checked
  `/api/oauth/consent`, and `/api/oauth/approve`. Merely visiting never grants
  access.
- Token exchange: `POST /oauth/token`, form-encoded public-client requests.
  Authorization codes are single-use and expire after one minute. Exchange
  validates the client, redirect URI, resource, and PKCE verifier. Responses
  include the issuer on the authorization callback and echo the client's
  state.
- Revocation: `POST /oauth/revoke`, form-encoded `token`, and `client_id`.
  Unknown tokens are an idempotent success.

Access tokens last up to five minutes. Refresh tokens rotate on use and never
outlive the connection's thirty-day absolute expiry. Both access and refresh
check the seven-day idle deadline. Refreshing alone does not update last
activity. Refresh tokens are issued only to clients registered for that grant.
Reusing a consumed refresh token, or replaying an otherwise valid consumed
unexpired authorization code, revokes the connection. Concurrent refreshes or
a lost refresh response can require authorization again.

Tokens are random opaque credentials, stored as digests. `mcp_` access and
`mcp_refresh_` refresh credentials are distinct from browser and `cli_`
tokens. MCP accepts access tokens only through the Authorization bearer
header, never cookies or URL parameters. MCP credentials cannot call the
ordinary application API. Browser mutations retain exact Origin checks; native
OAuth and MCP routes allow absent Origin but reject an explicitly untrusted
Origin.

Registration, authorization, exchange, and revocation are rate-limited by the
connection's source address (20, 30, 120 and 60 requests per five minutes,
respectively). As with existing authentication endpoints, untrusted forwarded
IP headers are not used. Requests have bounded bodies and deadlines. Expired
requests and tokens are removed by the existing maintenance job; unused client
registrations become eligible for cleanup after thirty days.

## 4.2.4 Task tools

[Tasks](/acta/technical-reference/work-records/tasks.md) extends the endpoint
with task read/write tool grants. Existing identity-only approvals remain
identity-only until the human adds task access using Edit access in session
settings. Workspace permissions still bound every action, including agent
inheritance and explicit overrides.

Task tools use a consistent typed envelope: `{"data": ...}` on success and
`{"error": {"code": ..., "message": ..., "fields": ..., "current": ...}}` for
service errors. Optional error fields are omitted when irrelevant. Errors set
MCP `isError`; the SDK supplies JSON text as well as structured content.
Schema/protocol validation errors can use the SDK's own error response.
`whoami` retains its small identity object. See [task
interfaces](/acta/technical-reference/connections/task-interfaces.md) for
discovery, filters, subtask pagination, and conflict reconciliation examples.

`task_activity` exposes grouped [task
history](/acta/technical-reference/work-records/activity.md) through the existing
`tasks.read` grant. Fetching it does not mark history read.

See [Task comments and
replies](/acta/technical-reference/work-records/comments.md) for threaded
discussions, read state and CLI/MCP comment commands.

## 4.2.5 Editing connection access

Use **Edit access** beside an MCP session in User Settings → Security, or
under User Settings → Agents → the owned agent. Choose capabilities and Save
access. A live human browser session is required, as for initial consent.
Humans can amend their own connections and their own agents' connections;
agents cannot amend their own access. Account/workspace permissions still
independently limit ordinary tool actions. Migration Assistant is the explicit
superuser-only exception described below. Nothing is enabled automatically.

The update retains the session, tokens, identity, authorization proof, and
expiry. Additions and removals apply when the next MCP request is dispatched,
including calls using an already cached tool name. In-flight requests are not
canceled. The stateless endpoint does not push tool-list change notifications:
clients which cache discovery can need to refresh tools or reconnect with
their existing credentials. They do not need another browser authorization
solely for this change.

`POST /api/security/sessions/{id}/grants` accepts `account_id` (optional;
defaults to the human, otherwise an owned agent), `previous_grants` and
`tool_grants`. An empty grant set leaves only `acta_guide` available while
preserving the connection. Updates compare the previous grant set under the
session lock; a stale save returns 409 `session_grants_changed`. Reload the
session before trying again. Expired, revoked, foreign, and non-MCP sessions
cannot be amended. Successful changes record an `mcp_access_changed` account
event. No migration is required.

## 4.2.6 Agent working guide

Every authenticated MCP connection exposes `acta_guide({})`, including
connections with no data-access grants. It returns the built-in Markdown from
[mcp-agent-guide.md](/acta/connections/agent-guide.md), embedded at compile time,
followed by applicable site and human-owner policy appendices. It has no side
effects and needs no new OAuth grant. Normal connection validity and
revocation checks still apply. Task, memory, and identity tools retain their
existing grant checks.

The MCP initialization response includes short instructions explaining Acta's
purpose and directing agents to read the guide before substantial work. The
full guide is fetched on demand rather than repeated during initialization or
every tool call. Actual client presentation of instructions depends on the
client. Existing clients can need to refresh their tool list or reconnect to
discover the new guide tool and receive initialization instructions;
reauthorization is not required.

The guide covers task/context discovery, record placement, truthful progress,
memory scope, collaboration, pagination, conflicts, and uncertain writes. It
is product guidance under the user's instructions and project conventions, not
an additional source of permissions. Keep it and affected tool descriptions
current as agent-facing features change; this is recorded in the repository
AGENTS.md.

## 4.2.7 Guide preview and preferences

**User Settings → Guide** shows the exact combined Markdown returned by
`acta_guide`. The built-in guide is read-only. The Preferences tab edits the
human's own user appendix and, with `site.guide.write`, the installation's
site appendix. Agents read their owner's appendix and cannot edit either
scope. These preferences are separate from memories and their grants. They are
for short, truly global, always-needed essential policy within the chosen
scope; selectively useful knowledge belongs in memories, work-specific
knowledge on tasks. User preferences take precedence over conflicting site
defaults without changing access permissions. Empty appendices are omitted.
Saved changes apply on the next guide read, including through an existing
authenticated MCP connection.

`GET /api/guide` returns `built_in`, the combined `markdown`, and `site` /
`user` preferences with `content`, `revision` and `can_write`.
`POST /api/guide/preferences` accepts `scope` (`site` or `user`), Markdown
`content` (up to 8,000 Unicode characters), and the revision read. No
caller-selected account is accepted. Revision zero is an absent preference. A
stale save returns 409 `guide_changed`; the editor preserves the draft and
offers the latest version for review. Clearing content retains the revision so
older editors cannot resurrect policy. Migration 031 stores these records
independently, with update author and time.

## 4.2.8 Migration Assistant

The optional `migration.assistant` grant exposes `migration_schema`,
`migration_find`, `migration_get`, `migration_create` and `migration_edit`.
Only human superusers can grant it to their own or their owned agents' MCP
connections. Unlike ordinary tools, these operations have site-wide content
access and accept historical impersonation, task references and timestamps.
Normal tools retain their normal grants and permission checks. Delegation is
checked against the human owner's live superuser authority on every operation.
See [Migration
Assistant](/acta/technical-reference/connections/migration-assistant.md) for
accepted content, transactional checks, notification suppression and
independent operator records.

## 4.2.9 Transport implementation

The server uses stateless Streamable HTTP with JSON responses through the MCP
Go SDK. Acta sessions own durable authorization; there is no background
protocol stream or separate protocol-session state. Safe return paths resume
browser authorization without accepting arbitrary redirect destinations.

---

# 4.3 Task Interfaces

_Acta / Acta TRM / Connections and Tools_

> Task Interfaces in Acta: find, inspect, change, lists and inspection, explicit changes, and conflicts.

The command-line and Model Context Protocol (MCP) interfaces call the same
authorized task services as the browser. Reads expose revisions; mutations
compare the revision of the field being changed.

## 4.3.1 Find, inspect, change

Workspace discovery identifies the accessible workspace. Task inspection
returns field versions and surrounding work for a subsequent version-checked
edit.

```sh
acta workspace list
acta task list -w acta --state unfinished --sort updated --direction desc
acta task list -w acta --query "login"
acta task get ACT-151
acta task edit ACT-151 --field title --version 3 --value "Improve login feedback"
acta task create -w acta --title "Check keyboard navigation" --parent ACT-151
acta task create -w acta --title "Review" --description-file review.md
cat review.md | acta task edit ACT-151 --field description --version 2 --value-file -
acta task edit ACT-151 --field description --version 3 --clear
acta task edit ACT-151 --field assignees --version 1 --assignee ACCOUNT_UUID
acta task edit ACT-151 --field assignees --version 2 --clear
```

Versions above are illustrative; use the actual version of the field returned
by get or the previous successful mutation. `--profile`/`-p` works on every
command. `--json` writes the complete structured result to stdout. Errors go
to stderr and exit nonzero; API errors preserve `status`, `code`, `message`,
optional `fields`, and optional `current` conflict details. CLI argument
errors use `command_error`. Human output uses tables for lists and readable
task details; terminal control characters in task text are neutralized.

Workspace arguments accept UUIDs or exact current/previous slugs, case
insensitively. A UUID-shaped argument is interpreted as a UUID. Display names
are not guessed. Task arguments accept UUIDs or references such as `ACT-151`,
including reserved previous prefixes. Responses always include stable UUIDs
and current references. Status and assignee mutations accept UUIDs, discovered
with `task statuses` and `task people --query ...`. People search returns at
most 50 candidates; narrow the query rather than guessing between similar
names.

## 4.3.2 Lists and inspection

`task list` and MCP `tasks_list` return at most 50 compact summaries: UUID,
workspace UUID, reference, title, named status, parent, direct assignees, and
child count. Descriptions, field versions, and descendant assignment sources
belong to inspection rather than search output.

- Without a parent, only root tasks are listed, including when filtering.
- `--parent ACT-151` selects only its direct children.
- State defaults to `all`; `unfinished` and `completed` use the workspace's
  configured completed status. Each task's own status is decisive.
- `--status` matches any selected status; `--assignee` matches any selected
  direct account assignment. `--unassigned` is ORed with selected assignees.
  Status, assignment, state, and text query categories intersect.
- Sort by `number`, `title`, `status`, `created` or `updated`, in `asc` or
  `desc` direction. Default is task number descending. Number breaks
  equal-sort ties; status sorting follows configured status order.
- Follow `cursor` while `more=true`, passing `--cursor` with the same query.
  `total` counts all matching tasks before pagination. Pages are independent
  reads: concurrent edits can move tasks across a sort boundary.

`task groups -w acta --group assignee` discovers human grouping IDs, combining
each human's direct assignments with their agents. `--group agents` returns
Unassigned, Assigned to me, and the current human's agents. For an agent
caller, the human is its owner. Use the returned ID with list's `--group` and
`--group-id`. Agents grouping excludes assignments solely to other humans and
their agents. Tasks assigned to several people can appear in several groups.

`task get` returns the description as Markdown, direct and descendant
assignees, ancestor references, timestamps and per-field versions. Its
`subtasks` page contains direct children in number-ascending order, including
completed ones. Continue with `task get ACT-151 --subtask-cursor CURSOR`.
Grandchildren are not flattened into that page.

## 4.3.3 Explicit changes and conflicts

Editable fields are `title`, `description`, `status_id`, `parent_id`, and
`assignees`. Each mutation changes one field with its expected version.
Omitting a value or supplying null is an error. Empty string clears
description or parent; `[]` clears assignments. Assignment input is the
complete replacement set and does not start an agent. Parent changes preserve
task identity.

If the field has changed since inspection, the service returns:

```json
{
  "error": {
    "code": "conflict",
    "message": "This task field changed. Review its current value before retrying.",
    "current": {"field": "title", "version": 4, "value": "Another person's title"}
  }
}
```

A retry with version 4 compares against that saved value, so the intended edit
is reconciled with it first. Unrelated field edits do not conflict. Retrying
the already-saved value succeeds without incrementing its version. Creation is
not idempotent: after an uncertain response, search/inspect before retrying to
avoid duplicate tasks.

## 4.3.4 MCP tools

| Tool | Workflow role | Grant |
| --- | --- | --- |
| `whoami` | Current authenticated account | `identity.read` |
| `workspaces_list` | Find workspace UUIDs/slugs; query and offset pagination | `tasks.read` |
| `task_search` | Ranked search across workspaces and every subtask depth | `tasks.read` |
| `tasks_list` | Compact filtered/sorted task pages | `tasks.read` |
| `task_get` | Full inspection and direct-subtask page | `tasks.read` |
| `task_activity` | Grouped task history; read-only, older-page cursor | `tasks.read` |
| `task_statuses` | Status UUIDs and creation/completed defaults | `tasks.read` |
| `task_people` | Search assignable humans and agents | `tasks.read` |
| `task_groups` | Resolve assignee/agents group IDs | `tasks.read` |
| `task_create` | Create task or subtask | `tasks.write` |
| `task_update` | Update one explicit field with its version | `tasks.write` |
| `releases_list` | Releases with state and progress, without notes | `tasks.read` |
| `release_get` | One release, including notes | `tasks.read` |
| `release_create` | Create a release | `tasks.write` |
| `release_update` | Change a release's supplied fields with its version | `tasks.write` |

See [Releases](/acta/technical-reference/work-records/releases.md) for release
semantics and the matching CLI and HTTP interfaces.

Task tools return `{"data": ...}` on success. Service errors return
`{"error": ...}` and set `isError`; structured JSON is also emitted as text
for clients without structured-content support. Tool schemas describe inputs
and outputs. Schema/protocol errors can use the SDK's own error
representation. `whoami` returns its identity directly.

Example calls:

```json
{"workspace":"acta","state":"unfinished","sort":"updated","direction":"desc"}
```

A corresponding `task_get` request inspects one task:

```json
{"task":"ACT-151"}
```

An explicit `task_update` for text or assignments:

```json
{"task":"ACT-151","field":"title","version":3,"text":"Improve login feedback"}
{"task":"ACT-151","field":"assignees","version":2,"assignees":[]}
```

Tool grants and workspace permissions both apply. Existing identity-only
connections do not acquire task access automatically: reconnect and approve
the new grants. Disabled accounts, revoked sessions, lost workspace access,
and agent permission changes are checked again during each operation. Error
classification is shared with HTTP and never forwards unknown internal errors.

## 4.3.5 Task metadata

HTTP task create accepts `priority`, `type`, `size`; task edits use those
field names and their independent versions. Responses (including summaries)
contain all three. GET list queries accept repeated `priority`, `type`, `size`
parameters. MCP `tasks_list` uses `priorities`, `types`, `sizes` arrays. All
match any selected value within the category and intersect across categories.
Sort accepts `priority`, `type`, `size`; `task_groups` accepts the same names
and returns the fixed options for group queries.

CLI examples:

```sh
acta task create -w acta --title "Repair reconnect" --priority high --type bug --size m
acta task list -w acta --priority high,urgent --type bug --sort priority --direction desc
acta task edit ACT-151 --field size --version 1 --value l
acta task edit ACT-151 --field priority --version 2 --clear
```

MCP `task_create` accepts the same singular property names. `task_update` uses
`field`, `version` and `text`, with `none` (or explicit empty text) to clear.
See [Tasks](/acta/technical-reference/work-records/tasks.md) for the fixed values
and semantics.

A task's target release works the same way through `release_id` (create field,
edit field, and `--release` flags), cleared with empty text. List queries take
`release` (MCP `releases`) selections and `all_depths`. See
[Releases](/acta/technical-reference/work-records/releases.md).

## 4.3.6 Global search

`acta task search "permission approval"` searches all accessible workspaces.
Add `--workspace acta` to narrow the scope, or `--cursor <returned cursor>` to
continue. `--json` returns the same compact contract as MCP `task_search` and
`GET /api/tasks/search?q=permission+approval&workspace=acta`. See [Task
search](/acta/technical-reference/work-records/task-search.md) for ranking,
excerpts, and pagination semantics.

## 4.3.7 Archiving

`task_archive` and `task_restore` (MCP `tasks.write`) take a task
UUID/reference and its current `versions.archived`. CLI equivalents are
`task archive <ref> --version N` and `task restore <ref> --version N`. List
archived roots with `tasks_list`'s `archived: true` or CLI
`task list --archived`; ordinary lists omit them. Search includes archived
matches only with `include_archived: true` / `--include-archived`. See [the
archiving contract](/acta/technical-reference/work-records/task-archiving.md) for
subtree restoration and read-only behavior. Completion never automatically
archives a task.

---

# 4.4 Migration Assistant

_Acta / Acta TRM / Connections and Tools_

> Exceptional content authority, historical attribution, opaque revisions, and independent operator records.

Migration Assistant is an explicitly delegated MCP capability for creating and
editing Acta content with historical attribution and protected metadata. It is
independent of the source system. The tools accept Acta content fields,
without requiring a source-specific format or a migration batch.

## 4.4.1 Enable and revoke

A **human superuser** can enable **Migration Assistant** during MCP
authorization, or use **Edit access** on an existing connection under User
Settings → Security or User Settings → Agents → their agent. It is off by
default. No new sign-in or credential replacement is needed when amending an
existing connection. A client that caches its tool list can need a refresh or
reconnect.

The grant is `migration.assistant`. It authorizes all site content
independently of the ordinary workspace and memory permissions of the
connected identity. Each write selects `acting_as`, an existing user, or agent
UUID. Historical authors can be disabled or pending. Each operation checks
that the caller is active, satisfies MFA, has a valid MCP session and the
migration grant, and has a human owner with live Superuser authority. All of
these checks repeat inside the write transaction. Revocation or loss of
superuser authority prevents subsequent operations, including those using a
previously obtained request context.

Ordinary tools retain ordinary authorization and attribution. Migration
Assistant cannot write accounts, memberships, permissions, credentials,
security settings, or sign-in sessions. Create historical identities through
normal administration before attributing records to them.

## 4.4.2 Tools and workflow

1. `migration_schema({})`: read the accepted fields and their semantics.
2. `migration_find({"kind":"account","query":"jack"})`: resolve existing
  actors. Find workspaces with `kind:"workspace"`; find tasks with
  `kind:"task"` and `parent` equal to their workspace UUID. Comments,
  documents, and activity use a task UUID as parent. Memories accept an
  optional scope UUID as parent. `query` is a case-insensitive substring, not
  ranked task search. Follow `next_offset` while `more` is true. Pages contain
  at most 50 records.
3. `migration_create` creates a record and returns its generated ID and
  revision.
4. `migration_get` inspects an existing record by kind and ID (or task
  reference).
5. `migration_edit` requires that exact opaque revision. A normal edit also
  invalidates it. A conflict returns `migration_changed`; inspect and
  reconcile.

All mutations return a record with `kind`, `id`, `revision` and an object
`data`. The revision is a digest of the inspected record and relevant
metadata. Treat it as opaque; it is not a timestamp or a normal field version.
Creation is not idempotent: inspect before retrying after an uncertain
connection failure.

Example, after resolving the workspace and actor UUIDs:

```json
{
  "kind": "task",
  "acting_as": "<existing-actor-uuid>",
  "fields": {
    "workspace_id": "<workspace-uuid>",
    "reference": "PEI-123",
    "title": "Historical task",
    "description": "Original Markdown description",
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-02-01T17:00:00Z"
  }
}
```

Omitted fields are preserved on edit, except automatic update timestamps. Null
only clears a task's `parent_id` or `archived_at`, or denotes no `reply_to` on
a new comment. Unknown fields, invalid types, invalid relationships, and
timestamp ordering mistakes fail atomically. UUIDs cannot be chosen or
changed.

## 4.4.3 Content rules

- **Workspaces:** name, slug, description, prefix, status names and default
  creation/completion statuses, creation timestamp. Existing status names
  retain IDs. Set statuses before migrating tasks; a status used by a task
  cannot be removed. Normal slug and prefix reservation rules remain in force.
- **Tasks:** title, description, status, priority/type/size, parent,
  assignments, archive date, creator, and timestamps. `reference` uses the
  workspace's current prefix and a positive number. Collisions fail and
  allocation advances past an explicitly set number. Renumbering does not
  retain an alias for the old number. The workspace is immutable; parents are
  validated within that workspace, without cycles. Historical assignments can
  reference existing inactive accounts. Migration archive edits affect the
  specified record, not its descendants.
- **Comments:** body, displayed author, creation/update times, and an optional
  reply target on creation. The task and reply relationship are immutable.
  Deleted comments cannot be rewritten. `author_id` defaults to `acting_as` on
  creation and otherwise remains unchanged unless explicitly supplied.
- **Memories:** all four scopes, key, summary, content, creator, and
  timestamps. `scope_id` identifies a workspace, user or agent, matching the
  scope. Site memories omit it. Scope is immutable; normal scope/key
  uniqueness and content validation remain. `updated_by` is the acting
  identity.
- **Documents:** task, title, filename, base64 content, and historical version
  timestamp. Edits append a version, reusing omitted content, or names. The
  task is immutable. Decoded files have the normal 20 MiB limit; authorized
  migration requests allow 28 MiB to accommodate base64 and metadata. Document
  inspections return metadata, not file bytes.
- **Activity:** task, a recognized task/document `change` object and
  timestamps. These are historical statements, not commands that modify the
  task. Changes use the same `kind`, `field`, `reason`, `before`, and `after`
  format as normal activity; unknown fields and kinds are rejected. Correcting
  an entry appends an event and updates its display projection; it never
  rewrites a raw event.

Task/document creation and edits produce normal-shaped activity automatically.
Only create additional history for events not already represented. Timestamps
control display; history pagination retains insertion order. Create historical
entries chronologically. No migration-specific activity grouping combines
separate submitted records.

## 4.4.4 Integrity and operator attribution

A mutation, its derived state and its operator record commit together. The
transaction serializes with ordinary content and permission changes. Task
search, references, counters, and versions remain consistent; creators and
assignees auto-follow newly created tasks. Migration changes send no inbox or
push notifications. They do not mark existing activity read.

`migration_operations` is an append-only ledger containing the actual MCP
operator, session ID, acting identity, operation, target kind/UUID,
before/after metadata and the real operation timestamp. Historical timestamps
and displayed authors cannot replace this ledger. Sessions need not remain
stored for their IDs to remain in it. Raw activity events also remain
immutable. Document bytes remain in version storage rather than being
duplicated in the operator ledger. This ledger has no migration write tool;
inspecting content does not expose credentials or session secrets. It is
included in ordinary database backups.

### 4.4.4.1 Board workflows

Workspace workflow edits accept `status_board: "tasks"` (default) or
`"backlog"`. The names in `statuses`, `creation_status`, and
`completed_status` apply only to that board. Backlog accepts one status and an
empty completed status. Configure each board before importing its tasks; the
inspected workspace includes `boards` and status-to-board IDs. Task
`status_id` determines its board, so migration keeps board membership without
a second task field. Used statuses cannot be removed by Migration Assistant.

---

# 7.1 Application Navigation

_Acta / Acta TRM / Application Behavior_

> Application scopes, contextual navigation, sidebar resizing, keyboard behavior, and mobile drawers.

The signed-in root opens the last visited accessible workspace. The shared
shell hosts functional User Settings, Site Settings and workspace pages.

Mobile buttons suppress focus outlines after pointer/touch interaction,
including focus restored when closing a dialog. Keyboard interaction restores
focus rings; input focus indicators and desktop button focus remain unchanged.


## 7.1.1 Structure

The bottom of the sidebar selects a scope; the upper section belongs to that
scope. Workspaces has a permanent scope button. Site Settings appears when the
account can access Users or Groups. The main header names the current page.
Within Workspaces, the top scope label becomes a searchable workspace
switcher. On desktop it opens an anchored dropdown; selecting the selector
again or pressing Escape closes it. On mobile it opens a full-screen search
view with results above an input and close button at the bottom, positioned
above the software keyboard. Typing filters accessible workspaces, with
paging, a current-workspace checkmark, and arrow-key/Enter navigation.
Workspace creation remains available to accounts with permission. The mobile
modal prevents selections from reaching the page beneath it. The workspace
work area contains the [task list and responsive task
view](/acta/technical-reference/work-records/tasks.md). Workspace settings
include Details (including task prefix and statuses) and Members, with actions
gated by effective workspace permissions. See
[Workspaces](/acta/technical-reference/accounts/workspaces.md).

A small Acta wordmark and version stamp sit above the scope hairline, at the
bottom of the contextual navigation area. The displayed version comes from the
frontend package version set by the build. A hairline above the scope selector
separates it from the contextual navigation. The compact profile footer sits
below the scope selector without another divider. It shows the account's
display name on one line, falling back to username when no display name is
set. An initial provides a simple avatar placeholder. Long names truncate
within the available space; the account button retains its full accessible
name.

The profile button opens a menu upward with **User Settings** and **Sign
out**. User Settings switches the upper sidebar and main content into its own
scope, but has no permanent entry in the bottom scope selector. The theme
toggle is an independent button alongside the profile and retains its sun/moon
animation. Sign-in and setup keep their top-right theme toggle.

Settings navigation shows the pages available to the account. Navigation uses
real routes under `/user-settings`, `/site-settings` and `/workspaces/{slug}`,
including direct links, reloads and browser history. A shared signed-in layout
owns the current account and chrome across these pages. Existing
authentication and session-revoking sign-out are retained.

## 7.1.2 Interaction

On desktop the sidebar starts at 264 pixels and can be resized between 220 and
400 pixels by dragging its right edge. Dragging below 160 pixels collapses it
to a 68-pixel icon rail; dragging back out to 190 pixels expands it. These
separate thresholds prevent flicker around the collapse boundary. A collapse
gesture preserves the expanded width from before that gesture, which the
expand button restores. Width and collapsed state are saved in browser local
storage; blocked storage does not prevent resizing.

In the collapsed workspace sidebar, a horizontal separator divides Tasks and
Backlog from the workspace settings icons. It appears only when settings are
available; the expanded sidebar uses its Workspace settings heading instead.
The workspace selector shows the workspace name and dropdown chevron without a
leading workspace icon. Search sits close to the sidebar heading, with a
larger gap before the main navigation items so it reads as part of the header.

The expand control remains at the top, with compact branding, Site Settings,
the account avatar at the bottom. The theme toggle and workspace picker are
hidden while collapsed. Scope and account buttons retain accessible names and
reveal visible labels on hover or keyboard focus. The profile menu works in
both widths. The width follows the pointer directly while dragging; button
transitions respect reduced motion.

Double-selecting the edge resets the expanded width to 264 pixels. The edge is
a focusable separator: Left/Right adjust width by 16 pixels (32 with Shift),
Left at minimum width collapses, Right from collapsed restores the remembered
width, Enter toggles collapse, Home collapses, and End expands to maximum
width. Escape, pointer cancellation, or a window resize cancels an active drag
and restores its starting state. Keyboard semantics follow the [ARIA window
splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/).

The account menu supports keyboard focus, arrow keys, Home/End, Escape and
outside-select dismissal. A small entrance animation respects reduced motion.
Selecting a scope closes the account menu. On desktop it focuses the new page
heading; on mobile it retains the open navigation drawer and focus within it.

Below 721 CSS pixels the sidebar becomes a modal navigation drawer, opened
from the main header. Its account menu remains a nested popup; Escape
dismisses that menu before the drawer. Selecting a scope keeps the drawer
open; selecting a destination link closes it. Native dialog behavior manages
focus containment and restoration. Backdrop selections outside the visible
sidebar panel (within its full-screen transparent dialog) close the mobile
drawer only after the completed select, keeping the underlying page inert
through touch release so that select cannot open a task.

On mobile, a rightward swipe starting in the leftmost 28 CSS pixels opens the
drawer. A leftward swipe inside it closes it; a rightward swipe with it open
does nothing. A non-passive `touchstart` listener cancels the native gesture
in that strip before iOS can claim swipe-back, including while the drawer or
another dialog/popover is open. Other overlays prevent opening/closing the
drawer but do not disable edge protection. Links, buttons, labels, editable
fields, and multi-touch starts are excluded from early cancellation to
preserve their native interaction. Native vertical scrolling that starts in
the reserved strip is also suppressed; scrolling elsewhere remains native. The
root document also requests `overscroll-behavior-x: none` as a supplementary
browser defense. Browser history is retained. Actual swipe-back suppression in
iOS home-screen apps requires device validation; this is a best-effort browser
workaround.

## 7.1.3 Security navigation and scrolling

The main panel owns its scrolling; the sidebar and page header remain anchored
to the viewport. The grid row and main flex child have explicit zero minimum
sizes so a long session list cannot expand the shell. Scroll chaining from the
main panel is contained.

---

# 7.3 Installed App and Push

_Acta / Acta TRM / Application Behavior_

> Installed-app behavior, authenticated-data caching, push subscriptions, delivery retries, and expiry.

Acta provides a web app manifest, application icons and a root-scoped service
worker. Install it from the browser's app menu, or use **Install Acta** in the
notification popup when the browser offers that action. On iPhone/iPad, use
**Share → Add to Home Screen**, open that installed app and enable browser
alerts from its bell menu. Installation does not automatically grant
notification permission. Desktop browser support and installation menus
differ.

The app remains server-backed: account pages, API data, tasks, and tool
results are not cached for offline browsing. Offline navigation shows a simple
reconnect screen. This avoids retaining authenticated content in a shared
browser cache.

## 7.3.1 Deployment

Real-device access uses the HTTPS origin configured in `ACTA_PUBLIC_URL`.
Loopback HTTP works for local development; a phone's localhost refers to the
phone, not the Acta server. This feature does not configure a reverse proxy or
publish the server.

The server derives a separate VAPID signing key (the server identity used by
Web Push) from the existing protected installation key. Keep
`ACTA_SECURITY_KEY_FILE` persistent and consistent across all instances. No
additional push API key or Firebase project is required. Production VAPID
contact uses the public HTTPS origin. Local development supplies its
HTTPS-form origin for the signing claim; Apple's push service does not accept
a localhost contact.

Allow outbound DNS and HTTPS to browser-selected public push services. Acta
rejects private/reserved addresses, checks DNS at connection time, pins
resolved addresses for the connection and does not follow redirects or
environment HTTP proxies. The push service receives an encrypted identifier
payload; it does not receive plaintext task content. The device
retrieves current notification details from Acta using its existing browser
session.

## 7.3.2 Delivery guarantees

Subscription registration is user- and session-bound, with at most 16 browser
subscriptions per user. Session deletion cascades to subscriptions and queued
work. Disabled accounts and expired/idle sessions cannot dispatch.

New or corrected notification records enqueue a delivery per subscription in
the same database transaction. Existing inbox records are not backfilled when
alerts are enabled. A three-second grace period lets focused pages acknowledge
updates before dispatch. Read/resolved records and superseded revisions are
canceled before delivery. These checks also run on the device before
rendering.

Workers claim a one-minute lease with `SKIP LOCKED`. Retries use exponential
backoff capped at one hour; queued work expires after 24 hours. A process
crash leaves the lease reclaimable. Stale workers cannot acknowledge a newer
lease. Push-service acceptance ends the server attempt; it is not proof that
the user saw an alert. Push-service delivery has a one-hour TTL. Endpoint
404/410 removes the subscription. Other permanent 4xx responses are not
retried; 408, 429, network failures, and 5xx responses are retried. Failed
attempts log only delivery identity/status, not secret endpoint URLs or
response bodies.

The worker persists a bounded receipt history and uses stable notification
tags for replay suppression. Browser storage loss or operating-system behavior
can still affect delivery. Logout cancels alerts even when the detail request
is already in flight. The durable inbox is always the source of unread state.

## 7.3.3 Push API

Human browser sessions use `GET /api/push` for the public signing key,
`POST /api/push/subscribe` with the browser's endpoint and keys, and
`POST /api/push/unsubscribe` with that endpoint. The worker uses
`GET /api/push/notification?subscription=UUID&id=UUID&revision=N`; it only
returns an unread, unresolved, matching revision belonging to that
session/user. Subscription endpoints and keys are secret credentials.

---

# 8.1 Server Configuration

_Acta / Acta TRM / Installation State_

> Database, origin, key, proxy, and process configuration read by the server.

The executable reads installation configuration at startup. Development run
targets supply convenience defaults; the executable retains its own
validation.

The principal server settings are:

| Setting | Purpose |
| --- | --- |
| `ACTA_DATABASE_URL` | Required PostgreSQL connection URL. Use a dedicated database and role. Configure TLS appropriately for remote PostgreSQL. |
| `ACTA_TRUSTED_PROXIES` | Optional comma-separated IPs/CIDRs trusted to supply `X-Forwarded-For`; empty trusts no forwarding headers. Invalid entries and all-address networks refuse startup. |
| `ACTA_PUBLIC_URL` | Exact external origin, default `http://localhost:8081`. Use `https://acta.peios.org` for that deployment. Non-loopback HTTP is rejected. |
| `ACTA_DEV_ORIGIN` | Optional extra loopback origin for Vite; allowed only with a local HTTP installation. Omit in production. |
| `ACTA_SECURITY_KEY_FILE` | Private, persistent encryption key file; default `.local/security.key` relative to the working directory. Provisioned on first start. All instances sharing a database use the same key. |
| `-listen` | HTTP bind address, default `:8081`. Behind a local proxy, use `127.0.0.1:8081`. |

## 8.1.1 Process and storage boundaries

The database pool permits at most eight connections per server. Bounded
password hashing, request sizes, and HTTP timeouts limit individual request
work. The server serves the static SvelteKit bundle; deployment does not run
Node.

Fingerprint assets use immutable caching. The HTML shell and API do not. The
compiled bootstrap has a hash-based content security policy, and the server
adds frame restrictions and other response headers. JavaScript is required.

The security key is private persistent state. Its fingerprint is bound to the
database, and a mismatched key fails startup. Loss of the key makes encrypted
account security data unreadable. The backup and recovery procedures preserve
both the database and the matching key.

The independent workers use `ACTA_BACKUP_SOCKET`, `ACTA_BACKUP_TOKEN_FILE`,
`ACTA_UPDATE_SOCKET`, and `ACTA_UPDATE_TOKEN_FILE` when configured. The web
process receives bounded private APIs rather than worker filesystem or Docker
authority. `ACTA_RECOVERY_MODE` suppresses external activity for isolated
recovery verification; it is not a replacement for network isolation.

---

# 9.1 Failure Modes

_Acta / Acta TRM / Failure Modes_

> How conflicts, expired credentials, uncertain responses, and recovery failures appear.

Acta distinguishes rejected work from work whose outcome is uncertain. The
recovery path depends on which boundary recorded the operation durably.

## 9.1.1 Record conflicts

Task field edits compare individual versions. Memories, documents, releases,
profiles, and permissions compare their corresponding revisions. A conflict
preserves the stored record and returns its current state. The browser retains
editable drafts where supported. Retrying against a newer revision without
reconciliation can overwrite a valid intervening change.

Task creation is not idempotent. An uncertain response can mean that a task
was created. Comment creation instead binds a request UUID to the author and
exact logical post; repeating that identity and content retrieves the same
outcome. Document and migration operations have their own identity and
revision rules.

## 9.1.2 Authentication and access loss

Expired or revoked credentials stop authorizing requests. Re-enabling an
account does not revive its former sessions. An unmet required-authenticator
policy restricts the account to enrollment, identity inspection, and sign-out.
MCP tool grants do not replace workspace authority. A missing tool can reflect
a connection grant or a cached client catalog, while a forbidden operation can
reflect the account's live permissions.

OAuth refresh tokens rotate. Reuse revokes the connection, so competing
refreshes or a lost refresh response can require authorization again. Browser
revocation invalidates the durable MCP connection and its tokens together.

## 9.1.3 Installation failures

A changed applied migration, unknown migration, or wrong installation key
fails startup. An older executable can reject a schema produced by a newer
release; image rollback alone does not establish recovery.

Backup health distinguishes integrity, restored evidence, and archived-log
age. A failed drill protects retained backup chains and can consume additional
space. Update failure before commit can restore the stopped cold copy. After
commit, recovery finishes the chosen release instead of overwriting accepted
work with an earlier snapshot. A failed rollback retains maintenance mode and
its error.

The [recovery procedures](/acta/backups-and-recovery/backups.md) describe operator
preparation, verification, and cutover. Recovery targets, journals, keys, and
operator logs contain sensitive material and are not public diagnostic
artifacts.
