cma-admin
cma-admin provisions and runs the SABLE Claude Managed Agent (CMA), and is the only Edge
Function with prompt-control actions. It runs as an Edge Function because Chris's
ANTHROPIC_API_KEY and the SPINE_MCP_TOKEN (for the vault) live in Edge secrets — never in web
code. Every action is admin/lead gated.
Actions
| Action | Payload | Purpose |
|---|---|---|
provision | { system } | Create the vault (plus a static-bearer credential pointed at spine-mcp), an environment, and the SABLE agent; returns ids |
run | { agent_id, environment_id, vault_id, message, maxMs? } | Create a session, send a message, poll to a result |
poll | { session_id, maxMs? } | Continue polling a running session |
get_prompt | — | Return the live SABLE system prompt, split into base + learned rules |
set_base_prompt | { base } | Update the base prompt, then re-attach approved learned rules |
stage_prompt | { base, message? } | Test a candidate base prompt through agent_with_overrides without promoting it |
prompt_versions | — | List stored base-prompt versions for rollback/diff |
rollback_prompt | { version_row_id | agent_version } | Restore a prior base prompt |
apply_prompt_rules | — | Fold approved prompt_update rows into the learned-rules block |
get_model_config | — | Return the live agent's model and effort, plus the allowed values |
set_model_config | { model_id, effort? } | Update the live agent's model/effort — any admin/lead, for benchmarking |
teardown | { agent_id?, environment_id? } | Archive resources (cleanup) |
The prompt-owner gate sits above this function
cma-admin enforces admin/lead access for every action, but promoting or rolling back the live
prompt additionally requires being on the SABLE_PROMPT_OWNER allowlist — a stricter gate checked
before set_base_prompt/rollback_prompt actually apply. See
Security Posture for the full reasoning, and
Prompt Control for the product-level workflow this function backs.
What the agent can and can't do
The agent's only tools are the spine-mcp MCP server, and only its always_allow (read) tools —
no sandbox bash, no file writes. Restricted content never reaches the agent because spine-mcp
excludes it before the agent ever sees it, not because the agent is instructed to avoid it. Writes
via always_ask are a later phase, not yet wired to this function.
Where the code lives
sable-agents-demo/supabase/functions/cma-admin/index.ts,prompt-blocks.ts,report.tssable-agents-demo/supabase/functions/_shared/rule_merge.js—mergeRules, the near-duplicate learned-rule folding described indocs/2026-09-08-where-we-are.md(PR #196)sable-agents-demo/web/api/sable-prompt.js,_prompt_owner.jssable-agents-demo/docs-site/docs/product/prompt-control.md,docs/product/prompt-maintenance.md