# Authority landscape

Local interfaces and channels such as Telegram and Discord share one Agent and memory workspace. [The design](https://fzkuji.github.io/OpenProgram/docs/reference/design/memory/authority-handoff.html) holds the rules.

## Who can do what

|  | Owner terminal, local Web | Paired approved stable ID | Unpaired not approved |
| --- | --- | --- | --- |
| Reach the Agent, get replies | Yes | Yes | No |
| Be recorded and append memory | Yes | Yes | No |
| Rewrite or delete memory | Yes | No | No |
| Commands, files, sending | Yes | No | No |

An unpaired direct message gets an eight-character code, once an hour. An unpaired group message is ignored. Renaming to impersonate the owner does nothing.

## Order after a message arrives

1. **Channel ingress.** Speaker ID and display name come from platform metadata, never message text.
2. **Pairing.** The stable ID is looked up; unpaired messages stop here. Approval comes only from the local CLI or a loopback Web request.
3. **Attribution.** `speaker_*`, the owner principal and `authority_tier` persist as separate fields.
4. **Capability.** `_gated_execute` checks the fixed table; rules and bypass cannot skip it.
5. **Execution or memory.** Paired changes through `memory_update` are limited by workspace enforcement to create or byte-append.

## Reference systems

Checked against local source of the first four rows. Documentation research also covers Claude Code, the MCP specification, LangGraph, OpenAI Agents SDK, AutoGen and Letta; only mechanisms verifiable in local code count as evidence.

| System | Mechanism | Taken | Differs |
| --- | --- | --- | --- |
| OpenClaw (src/pairing/pairing-store.ts) | Eight-character codes without `0O1I`, one-hour expiry, 3 pending per channel account. Unknown DMs unprocessed. DM admission, command owner and group authorization are separate states. | Pairing constants, stable-ID authorization, rejection before the Agent | Pairing here also fixes a tool tier; it never implies owner |
| Codex (codex-rs/memories/README.md) | Extraction claims bounded rollout tasks with leases and backoff. One writer consolidates and records the result. Thread-level watermarks; no branch provenance within one session graph. | Bounded batches, single writer, failure classes | No task database: node markers, Source references and workspace revisions exist |
| Hermes Agent (agent/memory_manager.py) | `sync_all` calls all providers after a turn; `MemoryProvider.on_session_switch` notifies switches. No durable pending cursor. | One provider entry, post-turn trigger | Model writes run at token thresholds or on idle, not every turn |
| OpenCode, pi-mono, WeClaw | No equivalent long-term memory flow. pi-mono: append-only `label` and `leaf` records. OpenCode: linear messages, tail managed by revert. WeClaw: downstream session IDs or limited in-process history. | pi-mono's stable node IDs for linked records | None combines trusted Sources, Topic transactions, backfill and writer status |

| Decision | Design |
| --- | --- |
| Adopted | Stable-ID admission, a fixed capability table, one writer entry, persistent status, bounded backfill |
| Modified: OpenClaw backfill and status | Backfill selects only trusted Sources no Topic references. Status counts locally, read-only, without loading models or repairing. |
| Rejected | Separate task database, per-turn sync, external archives in backfill preview: file locks and existing records suffice, models run at thresholds or idle, external archives stay out of trusted synthesis |

## What people notice

| Situation | Result |
| --- | --- |
| Unknown private sender | Gets a pairing code; the owner approves with one command. No migration: non-owner accounts pair on first contact. |
| Paired member says "remember this" | Recorded, attributed |
| Unpaired group message | Never becomes a turn; memory never records or cites it |
| Rejections | Structured reason codes |
| `memory.backend=none` | All CLI memory verbs and `/api/memory/*` rejected before a workspace is created |
| Integration tests cover | SessionDB, default model resolution, managed tools, staged transactions, Topics, markers, watcher status |
| Planned | A paired over-tier request goes to the owner and runs once if approved; non-owner reads stop showing owner-private content. See [status](https://fzkuji.github.io/OpenProgram/docs/reference/design/memory/authority-handoff.html#implementation-status). |

[Authority: two tiers and pairing](https://fzkuji.github.io/OpenProgram/docs/reference/design/memory/authority-handoff.html)
