Adapter guide
Spacecraft is designed so the runtime components you swap most often — inference backend, memory strategy, inbound channel, vector store, tool dispatcher — are pluggable adapters, registered by ID and resolved at launch. This page is the authoritative reference; the canonical source is packages/spacecraft/cli/ADAPTERS.md.
SDK surface
Section titled “SDK surface”The stable SDK entry point is celestial-cli/sdk. It exports the registration helpers plus matching list* / get* helpers for inference, memory, tool, gateway, and vector-DB adapters:
import { registerInferenceAdapter, registerMemoryAdapter, registerToolHandler, registerGatewayAdapter, registerVectorDbProvider,} from 'celestial-cli/sdk'Starter template: packages/spacecraft/cli/examples/custom-adapter-plugin.ts.
Unified capability catalog (sc capabilities)
Section titled “Unified capability catalog (sc capabilities)”Per ADR-030, sc capabilities lists everything pluggable in one view: inference adapters, memory adapters, harness tool types (bash, http, js), gateway adapters (telegram, http), vector-DB providers (chroma today), depot models, registered spacecraft packages, and skills.
sc capabilities # human-readablesc capabilities --json # machine-readable, catalogVersion: "capabilities/v0"sc adapters is the narrower legacy view — inference + memory only.
Remote catalog overlays (Supabase, ADR-031)
Section titled “Remote catalog overlays (Supabase, ADR-031)”When Supabase URL + key env vars are set, sc capabilities merges remote rows from spacecraft_catalog_capabilities (migration packages/supabase/migrations/003_spacecraft_catalog_capabilities.sql) into the local catalog.
| Variable | Role |
|---|---|
CELESTIAL_CATALOG_SUPABASE_URL | Supabase URL (falls back to SUPABASE_URL). |
CELESTIAL_CATALOG_SUPABASE_SERVICE_ROLE_KEY / _ANON_KEY | API key (falls back to the matching SUPABASE_* env vars). Anon works with the migration’s SELECT RLS policy. |
CELESTIAL_CATALOG_MERGE_MODE | off — no network. enrich — overlay display_name, drop ids with enabled = false. restrict — per kind, if any row exists, only listed enabled ids remain (intersected with local). Default enrich when URL+key exist. |
Upsert overlays with sc catalog sync:
sc catalog sync ./catalog-overlays.yaml --dry-runsc catalog sync ./catalog-overlays.yamlStarter file: packages/spacecraft/cli/examples/catalog-overlays.yaml.
Accepted shapes: top-level array of rows, or { rows: [...] }. Row schema:
kind:inference | memory | tool | gateway | vectordbcapability_id: string (required)display_name: string | nullenabled: boolean (defaulttrue)metadata: object
Overlays affect discovery (what
sc capabilitiesand wizards see). They do not changeToolExecutorwiring — executables are still resolved from in-process registries.
Inference adapters
Section titled “Inference adapters”Resolved by ID through src/orchestrator/adapters/factory.ts.
Built-in IDs: vercel-ai, default (alias of vercel-ai).
Selection order at runtime:
- CLI:
sc launch --adapter <id> - Agent-level config:
inference_adapter - Blueprint-level config:
inference.adapter - Default:
vercel-ai
Register a custom inference adapter
Section titled “Register a custom inference adapter”import { registerInferenceAdapter } from './src/orchestrator/adapters/factory'
registerInferenceAdapter('my-adapter', ({ defaultBaseUrl }) => ({ async generate(agent, messages) { // your provider call return { reply: 'ok' } }, getCapabilities() { return { supportsTools: false, supportsStructuredOutput: true, supportsTierRouting: false, } },}))Gateway ingress (GatewayPort)
Section titled “Gateway ingress (GatewayPort)”Inbound mission traffic (Telegram today, HTTP webhook stub, future channels) is selected from blueprint comm_array[0].adapter and constructed via src/gateway/create-gateway-port.ts. Additional adapters register with registerGatewayAdapter(id, factory).
telegram— wrapsTelegramCommAdapter(CommAdapterGateway).http—HttpWebhookGateway: POST JSON{ "text": "..." }tooptions.path(default/ingress); optionaloptions.port/SPACECRAFT_HTTP_GATEWAY_PORT; optionaloptions.replyWebhookUrlfor outbound replies.
Blueprint shape (only comm_array is read — there is no mouth key):
comm_array: - adapter: telegram options: token_env: TELEGRAM_BOT_TOKEN chat_id_env: TELEGRAM_CHAT_ID mode: single-chatYou may also set comm_array to a single object; the loader normalizes it to the array shape.
Tool sandboxing
Section titled “Tool sandboxing”Set tools_use_sandbox: true on the blueprint (or pass sc launch --tool-sandbox) to dispatch tool calls through SandboxRuntimePort (ADR-027). See src/orchestrator/tool-sandbox.ts.
Harness tools (ToolExecutor)
Section titled “Harness tools (ToolExecutor)”Harness YAML tools[].type is dispatched through src/orchestrator/tool-registry.ts. Built-ins (bash, http, js) register when ToolExecutor loads. Extensions:
registerToolHandler('my-type', async (tool, args) => { // ...})Vector DB (RagConfig.provider)
Section titled “Vector DB (RagConfig.provider)”RAG vector stores are created via src/orchestrator/vectordb/factory.ts, backed by src/orchestrator/vectordb/vector-db-registry.ts. Register new backends with registerVectorDbProvider('id', config => adapter) and extend RagConfig.provider in src/orchestrator/types.ts.
Memory adapters
Section titled “Memory adapters”Resolved by ID through src/orchestrator/memory-factory.ts.
Built-in IDs:
defaultstandard(alias ofdefault)ragscribe,scribe+standard,scribe+rag— tee turns to.scribe/session.jsonl. Optionalscribe_metadataon blueprintmemoryis merged into every JSONL line’smetadata(use forworkspace_id,agent_id,episode_idacross multi-agent hosts).
Selection order at runtime:
- CLI:
sc launch --memory-adapter <id> - Blueprint-level config:
memory.adapter - Auto-default:
ragwhenmemory.strategy === 'rag'; otherwisedefault.
Register a custom memory adapter
Section titled “Register a custom memory adapter”import { registerMemoryAdapter } from './src/orchestrator/memory-factory'
registerMemoryAdapter('my-memory', ({ memory }) => ({ async compress(messages, lastUserMessage) { // your memory policy return messages },}))Recommended adapter contract
Section titled “Recommended adapter contract”- Keep adapters stateless when possible.
- Expose capabilities (
getCapabilities) for feature gating. - Return explicit, typed errors for unsupported features.
- Avoid side effects in constructors; initialize lazily in
generate/compress.
See also
Section titled “See also”- Blueprint schema
- Compose with Starflow — gateway + personal agent
- ADR-026 — GatewayPort abstraction
- ADR-027 — Tool sandbox runtime
- ADR-030 — Composable adapters + unified catalog
- ADR-031 — Remote catalog overlays