This doc describes what the Worker exposes today and how the browser controlsurface maps to the API.
| Method | Path | Behavior |
|---|---|---|
| GET / HEAD | / | Serves the browser UI. HEAD is safe for probes. |
| GET / HEAD | /health | Returns runtime/auth/assistant status. HEAD is safe for probes. |
| POST | /telegram/webhook | Optional Telegram ingress. Validates the Telegram secret header when configured, maps the Telegram sender/chat to a deterministic session ID, runs the existing chat path, and replies through Telegram Bot API. |
/health is the quickest way to confirm whether a deployment is open or token-protected and which assistant path is the default versus the current activefallback.
The JSON payload reports the runtime contract for the current deployment,including:
- service and control-surface identity
- version signature (e.g.
92.5) - Durable Object and memory-source labels
- auth mode and auth boundary
- engine pulse (latest transaction and signal count)
- assistant default path, active path, and fallback policy
- the public session route list
The landing page includes:
- a deployment token field (visible only when auth is enabled)
- a session ID field
- Create session, Load session, and Reload state actions
- a protected Operator controls section for bundled hands, skills, and improvement candidates
- a message composer
- a status panel that shows the current auth/runtime mode
Important browser behavior:
- The UI stores
APP_AUTH_TOKENin browser local storage. - The active session ID is written to
?session=<id>in the page URL. - Reloading the page does not create a new session automatically; it reloads thesession you already selected.
- The operator section reuses the same token and lets an operator refresh hands, skills, and improvement candidates, activate/pause a hand, and approve/reject/pause a candidate while inspecting evidence and lifecycle history.
- When a hand records bounded findings (for example,
regression-watch,provider-health-watchdog, ordocs-drift), the detailed hand payload also carries the structured evidence for operator review. - The landing page does not currently expose a skill picker for chat turns.Skill selection is API-driven through
POST /api/sessions/:id/chatwithskillId.
| Method | Path | Notes |
|---|---|---|
| POST | /api/sessions | Creates a new session and returns { sessionId, session }. |
| GET | /api/sessions/:id | Returns { session } for the current projection. Supports optional ?asOf=. |
| POST | /api/sessions/:id/chat | Appends a user message, optionally applies one bundled skill for that turn via skillId, generates an assistant reply, persists both turns, returns { assistant, session }. |
| POST | /api/sessions/:id/messages | Lower-level append endpoint for one message event. |
| POST | /api/sessions/:id/tool-events | Lower-level append endpoint for one tool-event record. |
| GET | /api/sessions/:id/recall?q=... | Returns recall matches. Supports optional limit and asOf. |
skillIdis optional and applies to one chat turn only; there is no persisted"active skill" on the browser landing page.- Unknown skills return
404. - Skills that are not ready because required secrets are missing return
409with the resolved manifest payload. - When a skill is active, the runtime attaches skill metadata plus a
toolAuditTrailto the assistant message metadata so the chosen capabilitiesremain inspectable after reload. - Knowledge-vault access is gated by the skill manifest's declared tools andmemory scope. When enabled, the runtime prefers Vectorize-backed lookup andfalls back to D1-compatible ranking if needed.
| Method | Path | Notes |
|---|---|---|
| GET | /api/model | Lists runtime model availability, persisted selection, active model, and fallback state. |
| POST | /api/model | Persists a selectable operator model ID. |
| GET | /api/key | Lists provider-key status with masked-only output. Never returns raw secret material. |
| POST | /api/key | Protected Gemini-first key set/validate flow. |
| GET | /api/improvements | Lists structured improvement candidates with evidence and history. |
| GET | /api/hands | Lists bundled hands with lifecycle status and recent run summaries. |
| POST | /api/hands/:id/run | Manually triggers a hand and returns the immediate result summary. |
| GET | /api/skills | Lists bundled manifest-driven skills with readiness details. |
| GET | /api/telemetry | Inbound telemetry stream from managed projects. |
| POST | /api/pulse | Inbound activity pulse from managed nodes. |
| POST | /api/managed/project | Registration endpoint for managed project isolates. |
| POST | /api/onboard | Manual trigger for project onboarding. |
| POST | /api/spawn | Request to spawn a new managed agent/project. |
| GET/POST | /api/nexus/peers | Peer discovery and registration for the Knowledge Nexus. |
/api/hands, /api/skills, and /api/improvements back the landing page's operator section. The UI can inspect all three surfaces today; hands expose lifecycle controls, improvements expose bounded review controls, and skills remain inspectable manifests that are selected from the chat API.
Current bundled hands/operators posture:
scheduled-maintenanceimprovement-handuser-correction-minerregression-watchprovider-health-watchdogdocs-driftttl-garbage-collectororphan-fact-cleanupdaily-briefing-generatordocs-factorywebsite-factorymanaged-refactormesh-coordinatorsubstrate-wardenrecursive-evolutionpaperclip-bridgefact-log-compactordemiurge-metasovereign-rebalanceethics-alignmentisolate-sentinelisolate-onboarding| Method | Path | Engine | Behavior | | --- | --- | --- | --- | | GET | /api/sovereign/metrics | Sovereign | Returns drift and infrastructural posture metrics. | | POST | /api/sovereign/rebalance | Sovereign | Triggers autonomous infrastructure rebalancing. | | GET | /api/economos/metrics | Economos | Returns efficiency and economic audit data. | | GET | /api/economos/audit | Economos | Runs a deep economic efficiency audit. | | GET | /api/sophia/yield | Sophia | Returns knowledge synthesis and discovery metrics. | | POST | /api/sophia/harvest | Sophia | Triggers a knowledge harvest from recent trajectories. | | GET | /api/architectura/propositions | Architectura | Lists proposed structural refactors. | | POST | /api/architectura/optimize | Architectura | Triggers architectural optimization. | | GET | /api/aeturnus/status | Aeturnus | Returns Swarm health and redundancy status. | | POST | /api/aeturnus/recover | Aeturnus | Triggers self-healing in the Swarm. |
Current bundled skills posture:
aarondb-researchgemini-reviewincident-triage
The hands/skills rollout ships a small explicit tool-policy catalog:
- automatic-safe — skill-declared runtime reads like
session-recallandknowledge-vault, plus the coremodel-selectionroute resolution. - operator-protected — operator-only controls like
hand-lifecycle. - admin-sensitive — protected provider-key management through
/api/key. - scheduled-safe — scheduled runtime work like
hand-run,session-reflection,scheduled-maintenance, andmorning-briefing.
Audit history stays close to where work happened:
- session chat turns persist
toolAuditTrailin assistant message metadata - bundled hand lifecycle/run events expose
recentAuditandrecentRuns - audit records include capability, policy, actor, scope, outcome, and detail
/api/key has a stricter expectation than the rest of /api/*: it requiresAPP_AUTH_TOKEN to be configured so the route stays admin-only and the storedprovider key can be encrypted at rest.
Current key-management behavior:
- provider support starts with Gemini only
- raw key material is accepted only on
POST /api/key - validation calls Gemini with
X-Goog-Api-Keyheader auth, not a query-stringkey - stored provider keys are written into the existing D1 settings fact stream asAES-GCM ciphertext derived from
APP_AUTH_TOKEN - responses expose only masked key state (for example
••••••••1234), a shortfingerprint, validation status, and timestamps
Because the current encrypted store derives from APP_AUTH_TOKEN, rotating theoperator bearer token requires re-entering the protected provider key.
POST /api/sessions/:id/chat- body:
{ "content": string, "skillId"?: string, "metadata"?: object } 400ifcontentis missing or empty404ifskillIddoes not match a bundled manifest409ifskillIdis known but its required secrets are not ready
- body:
POST /api/sessions/:id/messages- body:
{ "role": "user" | "assistant", "content": string, "metadata"?: object } 400ifroleorcontentis missing
- body:
POST /api/sessions/:id/tool-events- body:
{ "toolName": string, "summary": string, "metadata"?: object } 400iftoolNameorsummaryis missing
- body:
POST /telegram/webhook- expects a Telegram update JSON payload
- returns
503ifTELEGRAM_BOT_TOKENis not configured in Worker secrets - returns
401ifTELEGRAM_WEBHOOK_SECRETis configured and the request is missingX-Telegram-Bot-Api-Secret-Token - returns
200 { ok: true, ignored: ... }for unsupported or non-text updates
Telegram turns reuse the same AaronDB-backed session runtime rather than a parallel channel-specific state model:
- session ID shape:
telegram:chat:<chat-id>:user:<user-id> - inbound Telegram metadata is stored on the appended user message
- assistant generation still flows through
POST /api/sessions/:id/chat - a Telegram "typing" indicator is sent while the assistant processes the request
- the final assistant text is sent back with Telegram
sendMessageusing HTML parsing for safe markdown conversion.
As of Phase 92, the Telegram ingress can also operate in User-Client mode via the MTProto protocol (GramJS):
- Forensic Inhalation: Monitors specific market-intel channels without the limitations of the Bot API.
- Session Facts: MTProto sessions are treated as re-hydratable facts in AaronDB, enabling stateless execution across Workers.
- Admin Grounding: Success/failure notifications and autonomous alpha signals are delivered to the
TELEGRAM_ADMIN_CHAT_ID.
The Telegram integration also exposes several native commands:
/start— Welcome screen with quick actions/help— Full command listing/status— Multi-engine health and resource limits/model— View and switch the active AI model/hands— List bundled autonomous hands/audit— Run a telemetric fact verification audit/site <prompt>— Synthesize a website/onboard <repo>— Ingest a project into the mesh
For append endpoints, 404 session not initialized means the session ID exists in the URL but has not been created in D1 for that environment yet.
- If
APP_AUTH_TOKENis unset, the deployment is effectively open. - If
APP_AUTH_TOKENis set, every/api/*route requires:Authorization: Bearer <APP_AUTH_TOKEN> GET /andGET /healthstay public even when auth is enabled./telegram/webhookalso stays outside/api/*bearer auth because Telegramcannot sendAPP_AUTH_TOKEN; protect it withTELEGRAM_WEBHOOK_SECRETinstead when you enable Telegram.
This split is deliberate so the UI can load before you supply a token.
AaronClaw returns assistant metadata alongside chat results.
assistant.source = "workers-ai"when the AI binding succeeds.assistant.source = "gemini"when the validated Gemini route succeeds.assistant.source = "fallback"when the app uses deterministic fallback.assistant.fallbackReason = "no-ai-binding"when no AI binding exists.assistant.fallbackReasonreports the exact upstream failure class (forexample Workers AI error/empty-response or Gemini provider error/empty-response) when the selected route degrades.
Fallback is not an error path for persistence. AaronClaw still appends andstores both the user turn and the fallback assistant turn.
Projected sessions include:
id,createdAt,lastActiveAt,lastTxeventsordered by transaction- filtered
messagesandtoolEventslists recallableMemoryCountpersistence: "aarondb-edge"memorySource: "aarondb-edge"
Those values are reconstructed from the D1 fact log, not from Durable Object-local state.
Recall queries search the persisted per-event memoryTerm facts and return:
- the matching
eventId kindtxmatchedTerms- a simple relevance
score - a human-readable
preview
See docs/state-model.md for how those memory terms are built.