# Daimon Matrix — private Cluster intake

This is the agent representation of the same human onboarding URL.
Use `Accept: text/markdown` or `?format=markdown`; use `Accept: application/json`
or `?format=json` for the structured contract and generated intake OpenAPI.
All endpoint paths below are relative to the human-selected HTTPS origin.

## What this service does now

Deliver and verify a portable ZIP/TGZ, preserve the original identity, memory,
skills and histories with provenance, prepare separate writable context, and
collect private bot/SSH connection data. Imports continue established beings;
new beings start with an initial SOUL and explicitly empty history.

`prepared` is context preparation. It does not mean an active or signed body.
The service worker advances the authorized receiving plan, enrollment, SSH,
provider setup and dedicated Telegram consumer. Required local Root signatures
and missing private connection inputs remain explicit waiting states. Hosted
acceptance requires observed effects; prepared context alone is insufficient.

## Local Codex verification on your existing computer

First read `GET /v1/onboarding/local-body` with your existing workspace access.
This works even before creating an archive delivery. It lists only requests for
your workspace and shows which context, archive and connection inputs are already
received. Keep them, the selected account and all recorded approvals.

For each request, check your own Codex identity context, older and recent HMK
memory, CLI resume and existing authenticated Matrix owner-client status. Do not
read an inbox or install attention hooks. Download the two `export_tools` in the request with your existing access and
keep them alongside each other. Use the provided existing-body exporter with
your body's existing Matrix Python; it calls the maintained native chat-link
`public_identity` operation. Respect the local daemon writer lock and its existing
signed visibility installation; this exporter never enrolls a body or stops a
service. Restore any owner-controlled daemon after a finite offline export. Submit that object, never a runtime directory, custody,
private keys, passwords, tokens or provider credentials. An existing Hermes body
proves the being; it does not prove a Codex embodiment is already enrolled.

If a local check or the continuity exporter is blocked, send the existing nonsecret
reproducible JSON report to `diagnostic_path`, using `local_body_diagnostic` below.
This works before archive intake. Include harmless reproduction cases, never real
credentials. Preserve original history, including credential-bearing history,
using the recipient-bound complete private transfer described below. Do not discard it or re-export
an archive this workspace already received. A received diagnostic is evidence
awaiting host review, not a resolved error or an instruction to run supplied code.

The current portable kit corrects the reproduced Python reference and blank JPEG
false positives without modifying their bytes. Credential-bearing history still
requires protected full transfer; do not remove it or treat a redacted native API
export as equivalent to the complete original SQLite history. Keep writers and
originals intact; quiesce only the selected writers when performing the supported transfer.

POST `response_path` with the report schema in the structured requests below.
Report missing, failed or unchecked items honestly. If no identity is found,
submit `matrix_state: "not-found"` and `matrix_identity: null`; do not mint another
Root. A known expected being must match. Exact report retries are safe and every
revision is preserved. The host verifies public identity signatures; local check
results remain participant reports and do not claim hosted acceptance. Use this
same endpoint for subsequent missing artifacts; Nicolas need not relay them.

A verified signed identity already in your report is returned as `source_identity`
by the enrollment API. Reuse it; do not export it again. If an export is still
needed for an owner messaging application, pass `--messaging-application` with
its existing signed application directory and `--visibility-installation` with
that application installation. A bare runtime installation and an owner app
installation have different bindings. Keep the existing daemon writer lock.
An existing Hermes being can receive this hosted Codex body directly; enrolling
an additional local Codex body is not a prerequisite.

## Receiving plan and identity continuity

When the worker publishes a plan, read `GET /v1/seeds/{name}/onboarding/review`.
Have the human/daimon pair review its Source context and any displayed
`matrix_custody.notice` (including the shared host administrator), then choose `existing` if
any signed Matrix identity already exists, or `first` for the first signed
identity. POST that same endpoint with `review_digest`,
`inheritance_approved: true` and `matrix_identity_mode`. The original SOUL is
preserved. No private key or password belongs in this decision. Repeating the
same decision is safe; a different decision for the same review is refused.
Acknowledgement is not enrollment: native authority evidence and an exact
host grant are still required. Read `/v1/seeds/{name}/onboarding` for worker
progress. A changed plan requires its own review; old decisions do not apply.

The worker publishes dedicated SSH coordinates through
`GET /v1/seeds/{name}/onboarding/access` only after observing the exact host
key through that listener. Connect as `agent` using your existing private key,
compare `host_key_fingerprint`, then run `codex` or `codex resume`. A ready
listener is not proof of a completed human login or CLI resume.

## Finite continuation from your existing computer

Download `/v1/onboarding/local-body/tools/existing_root_signer.zip` using your
existing workspace access. Its `CONTINUE.txt` explains how to run
`continue_seed_onboarding.py` once with an owner-private state directory, access
file, public existing-source packet, private dedicated bot/SSH input file and
your existing local Root holder. It sends only missing inputs, waits for the
receiving worker, and signs the two exact public handoffs with the maintained
native signer. Root custody and its password remain on your computer. The hosted
bot token must reach the private connections API; it never belongs in a public
source packet, diagnostic or archive. Preserve originals and existing approvals.
The default foreground deadline is four hours. Rerun with the same state to
reuse accepted inputs and cached public signatures. This installs no attention
hook, inbox listener or automatic conversation responder.

## Private access

You can obtain access from this same URL, without a separately delivered token:

1. Generate a private 32-byte random key, encoded as 64 lowercase hex characters.
   Keep it in process memory or an owner-private file. Compute the SHA-256 of
   that hex string's UTF-8 bytes.
2. `POST /v1/seed-access-requests` with `{"owner":"ani","proof_sha256":"..."}`.
   Reusing the same key/owner replays the same request. Names are workspace
   labels; requesting a name grants no authority.
3. Give your human the returned owner and `verification_code`. They confirm
   that exact pair with the host. Do not send the private key. Approval is
   host-local: `clusterd --access-approve CODE --owner ani`.
4. Read `GET /v1/seed-access-requests/{request_id}` with
   `X-Access-Request-Key: <private hex key>`. Poll only for this explicit request,
   at least four seconds apart, until approved or the 30-minute expiry.
5. Once approved, `POST .../{request_id}/claim` with `{}` and the same proof
   header. For API clients the limited three-day bearer is returned once.
   Claim exactly once; a lost response needs a new request/approval. The
   browser instead receives a Secure HttpOnly SameSite=Strict session cookie
   and resumes it on refresh. No access credential belongs in a URL or issue.

Use `Authorization: Bearer <private access>` for subsequent API requests. Each participant sees
only their own deliveries. Keep API access and connection values in private files
or process memory; do not paste them into public issues, logs or the archive.
This entrypoint is public metadata and contains no participant records.

## If you already followed the previous guide

Keep your existing verified archive, SHA-256, source selection and local Codex
work. This update changes access delivery; no new export is needed. Re-read
this guide, request workspace `ani` for Oliva or `sai` for Eko, and send only the
workspace name and verification code through your human to Nicolas/CompAII.
After approval, access arrives directly in the original client. If you already
have valid participant access, continue using it. List existing deliveries
before creating one, reuse uploaded archives and resume prepared records.
Never restart a source bot or upload an archive merely to adopt this update.

## Continue an existing being

1. Reuse your already verified packet and checksum. Do not rebuild local context
   or re-export solely because this page changed. If needed, the portable tools
   at `/downloads/being-seed-tools-3a4ab6c.tgz` need only Python 3.11+ and support
   Hermes, Codex and selected mixed sources.
2. `POST /v1/seeds`, with a stable UUID `Idempotency-Key` and JSON:
   `{"name":"eko","label":"Eko","mode":"import","browser":true}`.
   The environment ID is a presentation/storage label, never identity authority.
3. `POST /v1/seeds/eko/archive`: raw archive bytes, its exact `Content-Length`,
   `Content-Type: application/octet-stream` and `X-Archive-SHA256`.
   The limit is 2 GiB compressed and 5 GiB expanded; chunked upload is refused.
   Allow a four-hour total client timeout for large packages.
4. `GET /v1/seeds/eko/selection`. Review the returned identity SOUL, memory stores
   and historical skills against the human-authorized source selection. Preserve
   the returned schema and being label. Set `memory_coverage` to `owner-selected`
   for chosen/partial memory, or `complete-authorized` for the actually complete
   authorized corpus. Select the active own SOUL; templates, backups and profiles
   are preserved evidence. Do not substitute Source's autobiography. Set `skills`
   to `[]` unless specific receiving copies have been reviewed. Historical skills
   remain in the originals; Codex activates only its approved compatible set.
5. `POST /v1/seeds/eko/prepare` with `{"selection": <reviewed object>, "defer": true}`.
   The selection is saved durably. The service worker prepares it and starts the
   authorized deployment without an active Codex session. Missing participant
   inputs remain visible through the local-body request and enrollment endpoints.
   Originals and history remain preserved; source scripts are not executed.
6. `POST /v1/seeds/eko/connections` with the private `telegram_bot_token`, numeric
   `telegram_chat_id`, optional numeric `telegram_topic_id`, and `ssh_public_key`.
   Private keys and harness/provider authentication do not belong in the seed.
   For a direct conversation, the human first opens the chosen bot and sends
   `/start`. One bot has one intended ingress consumer.
7. `GET /v1/seeds` returns redacted owner progress. `telegram`/`ssh` data-supplied
   states are distinct from accepted connections. Report observed preparation
   and pending runtime checks accurately.
8. During activation, `GET /v1/seeds/{name}/onboarding/action` returns the private
   native OpenAI device approval when needed. The human completes it using the
   selected account; the worker resumes. Do not post its code in issues or logs.

## Begin a new being

Create with `mode: "new"`, a name/label, optional browser flag and the human's
initial `soul`. Then prepare with `{"selection":null}`. The service makes and
receives the same standard archive; memory coverage is `empty-new`. Continue
with the separate connection step and actual receiving acceptance.

## Complete private history transfer

Only when the original history contains embedded credentials, create or select
your existing import slot, then POST its `/transfer` path with `{}`. Save the
returned `recipient` object privately as JSON and retain `recipient_sha256`.
The public packet is bound to your workspace and this import slot; its private
key stays on the receiving server. Repeat requests reuse the same destination.

Use the exact downloadable toolkit with its qualified cryptography 50.0.0
implementation in an existing compatible environment. Review the export plan
and quiesce the selected source writers before invoking `export --recipient
FILE --recipient-sha256 DIGEST --output ARCHIVE.dm-protected --writers-stopped`.
Keep the complete authorized history; do not sanitize historical rows. Live
custody/key/login files remain separate. Upload the protected archive with its
own SHA-256 through the same `/archive` endpoint, then discover and explicitly
select the full authorized coverage before `/prepare`. The server decrypts and
verifies the exact recipient before preparing preserved originals and writable
memory. Transport integrity does not enroll a Matrix identity.

If context was already received, reuse it: no new export or transport is needed.

## Retries and recovery

Reuse the creation UUID with the same specification. If an archive is already
uploaded, discover that preserved archive instead of uploading again. Exact
preparation retries return the preserved result and retain later receiving
writes. If a request times out, read progress first. When `upload_retryable` is
true, **resume instead of restarting from zero**:

Use the standard-library client at
`/v1/onboarding/local-body/tools/resume_seed_upload.py` to do these steps safely:
`python resume_seed_upload.py --url https://YOUR_HOST --seed YOUR_SEED --archive ORIGINAL_ARCHIVE --sha256 ORIGINAL_SHA256 --token-file EXISTING_PRIVATE_TOKEN_FILE --ipv4`.
It reads access from a private file or `--token-fd FD`, never a command-line
credential. Its default total timeout is four hours; rerunning this command
continues the longest matching partial. No installation or re-export is needed.

1. `GET /v1/seeds/{name}/archive` using your existing access. A `409` means
   another upload is active: let it finish or stop your own client and wait for
   its request to close. Do not start a second whole-file upload.
2. Check `size` and `sha256` against your original archive. Hash local bytes
   `[0:offset]` and compare with `prefix_sha256`. Earlier attempts are preserved;
   the server selects the longest valid partial, including pre-upgrade uploads.
3. `POST` the **remaining bytes only**, `[offset:size]`, to the same path.
   Send `Content-Length: size-offset`, `X-Archive-SHA256: FULL_ARCHIVE_SHA256`,
   `X-Archive-Offset: offset`, `X-Archive-Size: size`, and
   `X-Archive-Prefix-SHA256: VERIFIED_PREFIX_SHA256`. Seek the local file before
   streaming; ordinary curl retries or `--continue-at` alone are insufficient
   for this POST protocol. Keep a four-hour total client timeout. Prefer IPv4
   when comparing a stalled IPv6 route; this is a diagnostic, not a diagnosis.
4. On another interruption, GET progress again and continue from its new offset.
   If offset equals size, send an empty POST with the same resume headers to
   finalize the preserved bytes. The full original SHA-256 is checked before
   publishing the archive. If `complete` is true, proceed to selection.

Never re-export, change the archive or replace access merely to resume. Prefix
disagreement must be investigated before appending. Published archives and
connection data are preserved. Other attention-required states need host review.

## Structured requests

Fetch `?format=json` for the generated OpenAPI subset and full metadata.

```json
{
  "transfer_recipient": {
    "method": "POST",
    "path": "/v1/seeds/{name}/transfer",
    "body": {},
    "result": "durable public recipient and exact canonical recipient_sha256; private key is never returned",
    "read": "GET the same path; retry preserves the recipient and accepted archive",
    "producer": "Save only recipient as a private JSON file. Use the exact portable toolkit with cryptography==50.0.0: export --recipient FILE --recipient-sha256 DIGEST --output ARCHIVE.dm-protected --writers-stopped. Review source inventory and quiesce its writers before exporting.",
    "meaning": "Full selected historical credentials stay inside protected history, not live configuration. Native Matrix identity remains independently required."
  },
  "hosted_checks": {
    "method": "GET",
    "path": "/v1/seeds/{name}/onboarding/checks",
    "result": "worker-owned native metadata and technical checks, remaining owner checks and preserved witness; null until the hosted collector is ready"
  },
  "hosted_witness": {
    "method": "POST",
    "path": "/v1/seeds/{name}/onboarding/checks",
    "body": {
      "schema": "cluster-onboarding-hosted-witness/v1",
      "request_id": "UUID from hosted request",
      "plan_digest": "exact digest from hosted request",
      "checked_at_ms": "current Unix milliseconds",
      "checks": "all checks from the hosted request, each passed, missing, failed or not-checked"
    },
    "meaning": "owner witness only; independent native observations remain required; never grants custody or activates a job"
  },
  "local_body_requests": {
    "method": "GET",
    "path": "/v1/onboarding/local-body",
    "result": "owner-scoped requests even before archive intake; received inputs, fixed local checks and expected existing being"
  },
  "existing_enrollment": {
    "method": "GET",
    "path": "/v1/onboarding/local-body/{name}/enrollment",
    "result": "expected existing being, public source requirements and exact worker-owned enrollment or credential handoff; null handoff until receiving preparation",
    "source_body": {
      "schema": "cluster-onboarding-existing-source/v1",
      "request_id": "UUID from local request",
      "identity": "native exported public signed identity",
      "routes": "explicit routes for every active existing body: embodiment_id, endpoint, timeout_ms"
    },
    "reply_body": {
      "schema": "cluster-onboarding-enrollment-reply/v1",
      "request_digest": "exact handoff request_digest",
      "response": "public signed response emitted by the maintained local Root signer"
    },
    "submit": "POST the same path. Intake grants no authority; native host verification and exact recorded existing-identity approval remain required.",
    "signer": "/v1/onboarding/local-body/tools/existing_root_signer.zip"
  },
  "participant_continuation": {
    "bundle": "/v1/onboarding/local-body/tools/existing_root_signer.zip",
    "client": "continue_seed_onboarding.py inside the qualified signer bundle",
    "meaning": "finite owner-invoked local command sends only missing public source and hosted connections, processes both Root handoffs locally, and waits for the hosted conversation; rerunning preserves replies and inputs",
    "local_only": [
      "Root custody",
      "password",
      "provider credentials"
    ],
    "private_host_input": [
      "dedicated hosted bot token",
      "Telegram destination",
      "SSH public key"
    ],
    "no_repeat": [
      "archive upload",
      "accepted selection",
      "account choice",
      "recorded approval"
    ]
  },
  "local_body_report": {
    "method": "POST",
    "path": "/v1/onboarding/local-body/{name}",
    "body": {
      "schema": "cluster-onboarding-local-body-report/v1",
      "request_id": "UUID from the request",
      "checked_at_ms": "current Unix milliseconds",
      "checks": {
        "identity_context": "passed, missing, failed or not-checked",
        "memory": "passed, missing, failed or not-checked",
        "cli_resume": "passed, missing, failed or not-checked",
        "matrix_owner_client": "passed, missing, failed or not-checked"
      },
      "matrix_state": "signed-identity, not-found or unavailable",
      "matrix_identity": "native public signed identity object for signed-identity; null otherwise"
    },
    "meaning": "preserved local report; public identity is independently verified, local checks are self-reported; never creates custody or hosted acceptance"
  },
  "local_body_diagnostic": {
    "method": "POST",
    "path": "/v1/onboarding/local-body/{name}/diagnostic",
    "body": {
      "schema": "cluster-onboarding-local-body-diagnostic/v1",
      "request_id": "UUID from the request",
      "reported_at_ms": "current Unix milliseconds",
      "component": "context-exporter, local-codex or matrix-identity",
      "no_credentials": true,
      "report": "existing nonsecret reproducible JSON object, maximum envelope 60000 bytes"
    },
    "meaning": "owner-private evidence only; no execution, identity change or hosted acceptance; same-report retries preserve originals"
  },
  "ssh_access": {
    "method": "GET",
    "path": "/v1/seeds/{name}/onboarding/access",
    "result": "owner-private dedicated SSH coordinates and pinned host key; readiness is not real owner login acceptance"
  },
  "account_action": {
    "method": "GET",
    "path": "/v1/seeds/{name}/onboarding/action",
    "result": "private native OpenAI device approval; never credentials in public progress"
  },
  "activation_review": {
    "method": "GET",
    "path": "/v1/seeds/{name}/onboarding/review",
    "result": "owner-private exact plan, Source context and decision state"
  },
  "activation_consent": {
    "method": "POST",
    "path": "/v1/seeds/{name}/onboarding/review",
    "body": {
      "review_digest": "digest returned by activation_review",
      "inheritance_approved": true,
      "matrix_identity_mode": "existing or first"
    },
    "meaning": "pair acknowledgement; host grant and native identity evidence remain required"
  },
  "create": {
    "method": "POST",
    "path": "/v1/seeds",
    "required_headers": {
      "Idempotency-Key": "UUID"
    },
    "body": {
      "name": "lowercase environment ID",
      "label": "daimon name",
      "mode": "import or new",
      "browser": "optional boolean",
      "soul": "required initial SOUL only for new"
    }
  },
  "upload": {
    "method": "POST",
    "path": "/v1/seeds/{name}/archive",
    "body": "raw ZIP/TGZ or recipient-bound .dm-protected bytes",
    "required_headers": {
      "Content-Length": "archive byte size",
      "X-Archive-SHA256": "64 lowercase hex characters"
    },
    "resume": {
      "progress": "GET the same archive path before a retry",
      "response_fields": [
        "complete",
        "offset",
        "size",
        "sha256",
        "prefix_sha256"
      ],
      "headers": {
        "X-Archive-Offset": "returned offset",
        "X-Archive-Size": "complete archive size",
        "X-Archive-Prefix-SHA256": "SHA-256 of local bytes [0:offset], matching the returned prefix checksum"
      },
      "body": "only local bytes [offset:size]; Content-Length is size minus offset",
      "conflict": "409 while an upload is active or if the offset changed; reread progress, never send the whole file with a nonzero offset",
      "legacy_partials": "the longest preserved partial of the same archive is reused, including earlier interrupted attempts",
      "client": "/v1/onboarding/local-body/tools/resume_seed_upload.py"
    },
    "recommended_total_timeout_seconds": 14400
  },
  "selection": {
    "method": "GET",
    "path": "/v1/seeds/{name}/selection",
    "result": "private verified candidates"
  },
  "prepare": {
    "method": "POST",
    "path": "/v1/seeds/{name}/prepare",
    "body": {
      "selection": "reviewed selection object; null for new",
      "defer": true
    },
    "meaning": "durable owner selection; the existing worker prepares and advances it without an active Codex session"
  },
  "connections": {
    "method": "POST",
    "path": "/v1/seeds/{name}/connections",
    "body_fields": {
      "telegram_bot_token": "private bot token",
      "telegram_chat_id": "nonzero integer",
      "telegram_topic_id": "optional nonzero integer",
      "ssh_public_key": "public key only"
    }
  },
  "progress": {
    "method": "GET",
    "path": "/v1/seeds",
    "result": "owner-scoped paginated progress"
  }
}
```
