← Commit history

Delete skills/app-creator-caller-identity/SKILL.md

John Lauer ·fde72b2f61 · ·parent ceebca4
1 file changed −115
skills/app-creator-caller-identity/SKILL.mddeleted−115
@@ -1,115 +0,0 @@-----name: app-creator-caller-identity-description: >-  How every Adom app server asks "who is calling?": the mandatory AI-thread-  name on spawn and on every state-changing request, modeled on how ab and pup-  already enforce it. Covers the X-Adom-Thread header / aiThread field, the-  caller_identity_required teaching refusal, precedence, good thread names,-  why identity is never authorization, and forwarding identity when your app-  calls other services. Read when building any app server, or when a call is-  refused with caller_identity_required. Trigger words: ai-thread, aiThread,-  ai thread name, caller identity, who is calling, X-Adom-Thread,-  caller_identity_required, identify your thread, thread attribution,-  anonymous caller, name your thread.-----Parent skill: **app-creator**--# Caller identity: every caller names its AI thread--Adom Bridge (ab, since v1.9.180) and pup already refuse anonymous callers.-Most Adom apps do not yet, and that is a gap: this skill makes the pattern-standard for every new app server. Study `adom-bridge-caller-identity` for-the origin; this page is the app-author's implementation contract.--## Why--A typical Adom user runs roughly 20 AI conversation tabs against one-container and one desktop. Without identity, every server log, activity-line, and approval prompt says "some AI did something": the user cannot tell-the tab doing useful background work from the tab that went off the rails,-and your server cannot manage per-thread instances or state (see-`app-creator-server-lifecycle`). One name, given once per conversation and-sent on every call, fixes all of it.--## The contract your app implements--1. **Spawn**: `<app> start --ai-thread "<name>"`. Required, not optional.-2. **Every state-changing HTTP request** carries the thread name:-   - header `X-Adom-Thread: kicad-bridge dev`, or-   - top-level `"aiThread"` field in the JSON body.-3. **Read-only endpoints stay open** (`GET /state`, `GET /console`,-   `GET /settings`): debugging and observation are never gated.-4. **Precedence** when several are present (mirror ab exactly):-   explicit field in the call's args, then the CLI flag, then the-   `ADOM_AI_THREAD` env var. The env var is acceptable ONLY in-   single-agent containers (CI, dedicated boxes): in a shared container it-   misattributes every concurrent thread, which is worse than no name.--## The refusal (see also app-creator-reason-gating)--An anonymous state-changing call gets HTTP 400 with a payload that TEACHES.-The caller is an AI; your error text is a prompt it will read and obey:--```json-{-  "ok": false,-  "errorCode": "caller_identity_required",-  "error": "This server requires every AI caller to identify its conversation thread.",-  "hint": "Retry with header 'X-Adom-Thread: <name>' or a top-level \"aiThread\" field. Pick a short name a HUMAN would recognize for THIS conversation (like 'kicad board review', not 'agent' or a UUID) and reuse it on every call to every Adom server."-}-```--Use the exact code `caller_identity_required`: ab established it, callers-already know what it means and how to fix it.--## Good thread names--The name is shown to a human deciding whether to trust what is happening.--- Good: `chip-fetcher tab 3`, `kicad board review`, `nightly wiki sync`-- Bad: `claude`, `agent`, `session_1`, a UUID--What the work is, plus which tab, if several do the same thing. If the user-has told the AI what they call the conversation, those words win.--## Identity is never authorization--The thread name is self-reported. Record it, display it, key state by it,-and never verify or trust it: it exists for attribution, logging, and-instance management. Do not grant any privilege based on an `aiThread`-value, and never present a thread name to the user as proof of anything.-(ab's real security is its authenticated transport; your app's is whatever-auth it already has. Identity rides on top, it does not replace it.)--## Forwarding: when your app calls other services--If your server calls ab verbs or another app's API on behalf of a thread,-forward the identity instead of dropping it, exactly like a bridge does:--- Pass through `X-Adom-Caller-Thread` / `-Container` / `-Reason` headers you-  received (or map your `X-Adom-Thread` onto them).-- Add `X-Adom-Caller-Delegate: <your-app-slug>` naming yourself, so the user-  sees `kicad board review (via hero-studio)`: who asked AND who executed.-- When your server acts on its OWN behalf (health poll, reaper, cleanup),-  send your own identity, never a stale forwarded one.--## Node middleware (drop-in)--```js-const READ_ONLY = new Set(['/state', '/console', '/settings', '/events', '/version']);-function requireThread(req, res, body) {-  if (req.method === 'GET' || READ_ONLY.has(req.url.split('?')[0])) return null;-  const thread = req.headers['x-adom-thread'] || (body && body.aiThread);-  if (thread) { req.aiThread = String(thread); return null; }-  res.writeHead(400, { 'Content-Type': 'application/json' });-  res.end(JSON.stringify({ ok: false, errorCode: 'caller_identity_required',-    error: 'This server requires every AI caller to identify its conversation thread.',-    hint: "Retry with header 'X-Adom-Thread: <name>' or a top-level \"aiThread\" field. Use a short human-recognizable name for THIS conversation and reuse it on every call." }));-  return true;  // handled-}-```--Log every accepted call as `thread "<name>": <verb>` in the console ring-buffer, and key registry entries and snapshots by the thread (see-`app-creator-server-lifecycle`). Gated verbs additionally want a `reason`;-that is a separate contract with its own refusal: `app-creator-reason-gating`.