carlos / platform Public

spec: settings and secrets in the console (slice 2), draft

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 243da1551b465c7550d1ca4540e80cb476caaff6 parent 06bb3f7
1 file changed, +97 −0
  • docs/superpowers/specs/2026-11-08-console-secrets-design.md +97 −0

CI cancelled — superseded by a newer push — run details

Intent

Attributed to this commit: 53.1 g CO₂e (6,950,774 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-secrets, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/specs/2026-11-08-console-secrets-design.md b/docs/superpowers/specs/2026-11-08-console-secrets-design.md
new file mode 100644
index 000000000..3923d69e7
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-08-console-secrets-design.md
@@ -0,0 +1,97 @@
+# Settings and secrets in the console (slice 2)
+
+Status: draft for Paul, 2026-11-08. Slice 2 of "agent-first onboarding and
+console parity" (slice 0 agent login by link, v0.34.27; slice 1 Getting
+started checklist, v0.34.28).
+
+## Why
+
+A new user's agent told him to run a terminal command to add secrets, and
+he asked: "presumably I can add secrets in the Carloku UI?" He couldn't.
+Paul's ruling R3: secrets are the person's choice, through their agent or
+entered on Carloku. The app settings page already has an Environments
+section that lists each variable by name, marks secrets "sealed", and tells
+you to use the CLI.
+
+## Paul's decisions (2026-11-08)
+
+- Settings and secrets live in app settings ("Wouldn't app settings have a
+ Secrets section?"); he left the shape to the recommendation: ONE editable
+ section, one card per environment, ordinary settings and secrets
+ together, because `carlos secrets` is "the same shape as `carlos env`,
+ sealed" and both write the same per-environment bundle.
+- Saving applies **immediately**: the app restarts on save.
+
+## What
+
+On `/a/<account>/apps/<app>/settings`, the Environments section becomes
+editable for anyone allowed to run `carlos env set` / `carlos secrets set`
+on that app (the same role the CLI doors require; others keep today's
+read-only view):
+
+- Each environment card lists its variables: name, then the value for an
+ ordinary setting, or "Sealed" for a secret. Secrets can be replaced or
+ removed, never revealed (the GET door has no envelope field today; keep it
+ that way).
+- Add a variable: name, value, and a "Secret" checkbox, ticked by default
+ when the name looks like a credential (contains KEY, TOKEN, SECRET,
+ PASSWORD, PASS, PRIVATE, DSN, or the value looks like one).
+- Changes are staged on the page and applied together with one **Save and
+ restart** button: one config write, then one restart of what reads that
+ environment (the existing `POST .../restart` door's behaviour), so editing
+ three secrets causes one restart. The page then shows the outcome per
+ route as the CLI prints it (restarted, asleep, not reached, blocked), in
+ plain words.
+- Same rules as the CLI: empty values refused, the same name rules and size
+ limits, an app on a fleet sealed to the fleet's key, the same refusals for
+ stamped or unreachable routes, worded for a person.
+
+## Secrets stay sealed end to end (my call, flagged for Paul)
+
+Today the console never sees a secret's plaintext: `carlos secrets set`
+seals on the person's machine with the app's public key (ECDH P-256, HKDF
+SHA-256, AES-256-GCM; v2 bound to account and app; `appconfig/crypto.go`),
+and the console refuses a "secret" carrying a plaintext value
+(`apiconfig.go` package comment). The console page keeps that property:
+**the browser seals the secret** with the same public key and envelope
+format using WebCrypto (all three primitives are built in; no library), and
+posts only the envelope through the same validation as the CLI door
+(`handleAPIConfigPut` rules, including the bound-sealing and SealedTo
+checks). Consequence: entering a secret needs JavaScript; with JS off the
+secret field explains that and points to the agent or CLI. Ordinary
+settings work without JS. Golden-vector tests prove the browser envelope
+opens with the Go `Open` (v2 bound) and fails for the wrong app.
+
+## Goals
+
+- Everything `carlos env set|unset` and `carlos secrets set|unset` can do
+ for an app's environments can be done here, with the same refusals.
+- The console still never handles a secret's plaintext.
+- One restart per save, with an honest per-route outcome.
+- Existing console components only (docs/console-styleguide.md; mockups
+ with docs/console-mockup-kit); checked at 390 px.
+
+## Non-goals
+
+Creating or deleting environments (fork/adopt/release stay where they are),
+store or mail credentials (written by their own flows), history or rollback
+of settings, bulk import (.env upload), showing secret values.
+
+## Anti-goals
+
+- A secret's plaintext reaching the console, a log, or the page after save.
+- A save that silently doesn't reach the running app.
+- A page whose rules differ from the CLI's (the parity guard in slice 3 will
+ check this).
+
+## Constraints
+
+CSRF on every mutation (the star handler pattern), the same role gates as
+the CLI doors, copy through the Luna pass (house rules), census and Astra
+reviews as usual, console-only release through the agent manager.
+
+## Left to the builder
+
+Template and handler structure, the credential-name heuristic's exact list,
+how staged changes are held (form fields; no server-side draft), and how
+the per-route outcome is laid out, within the existing components.