Skip to content

Secrets

API tokens, passwords and keys that agents use without seeing them. The daemon keeps the values; an agent runs a command with them in its environment through qcc secret exec, and wherever a value shows up — in the command's output, in what the agent says, in a tool's result — it reads [secret:NAME] instead. An agent that needs a secret nobody has stored yet asks the user for it with qcc secret ask; the user types it into a hidden field in the app, and it goes straight into the store.

Terminal window
qcc secret set GITLAB_TOKEN --global # reads the value from stdin, or asks without echo
qcc secret set GITLAB_TOKEN --project Shop # Shop's own, used instead of the global one there
qcc secret list # names, scopes, where the values are kept
qcc secret exec --env GITLAB_TOKEN -- sh -c 'curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.example.com/api/v4/user'
qcc secret rm GITLAB_TOKEN --global
  • A name is an environment variable's: letters, digits and _, not starting with a digit, at most 128 characters (GITLAB_TOKEN).
  • A secret is global or belongs to a project (projects). Where a name is looked up, the project's secret comes first and the global one second, so a project can have its own GITLAB_TOKEN for its own GitLab.
  • --global and --project <id or name> choose the scope. Without them, a command run inside an agent's thread ($QCC_THREAD_ID is set) uses the thread's project, or global for a thread outside projects; outside threads it is global. qcc secret list in a thread shows the global secrets and the project's; outside threads, all of them.
  • Deleting a project deletes its secrets.
  • In the app, global secrets are managed in Settings → Secrets, and a project's own on the Secrets tab of its settings (desktop).
  • The system keyring when there is one: the macOS Keychain, Secret Service on Linux (GNOME Keyring, KeePassXC, KWallet with its Secret Service bridge), the Windows Credential Manager. Each value is one entry of the service qcc <data directory>, named global/NAME or project/<project id>/NAME, so a development daemon with its own data directory keeps its own.
  • A file otherwise: <data>/secrets/values.json, mode 0600, in a directory of mode 0700. The daemon checks for a keyring when it starts and falls back to the file when none answers; the reason is in qcc secret list, in the app, and in the daemon's log. qccd --secrets-backend file (or QCC_SECRETS_BACKEND=file) uses the file even with a keyring.
  • When the keyring appears later (Secret Service was turned on), the next start moves the values from the file into it and deletes the file.
  • Names, scopes and times are kept apart from the values, in <data>/secrets/index.json, so listing secrets never needs the keyring. The journal (qcc.db) never holds a value.

The daemon talks to the keyring on a thread of its own, so an unlock prompt does not hold up the rest of it. At start it reads every value once, to know what to redact.

Without a desktop environment that brings one, nothing answers on org.freedesktop.secrets. GNOME Keyring is the simplest provider, and it works under any window manager (Hyprland, sway):

{
services.gnome.gnome-keyring.enable = true; # the daemon, its D-Bus activation, PAM for `login`
# Unlock the login keyring with the password typed at the display manager: its PAM
# service, "sddm", "greetd", "gdm-password", … ("login" is set by the line above).
security.pam.services.sddm.enableGnomeKeyring = true;
programs.seahorse.enable = true; # optional: a window to see what is stored
}

After nixos-rebuild switch, log out and in again (PAM starts and unlocks the keyring at login), then restart qccd; qcc secret list should say keyring (Secret Service), and values kept in the file until then move into the keyring. KeePassXC with its Secret Service integration works too, as long as only one provider runs.

qcc secret exec --env NAME[,NAME…] [--project P | --global] -- <command> [args…]

  1. The CLI asks the daemon (secret.reveal) for the named values, over the daemon's unix socket. A name that is not there fails the command before anything runs, naming it.
  2. It starts the command with the values added to its environment under their names. Its stdin is the terminal's.
  3. Its stdout and stderr pass through a filter that replaces every value it was given with [secret:NAME]. A value cut in two by the pipe's chunks is still found: the filter holds back the end of a chunk that could be the start of a value until the next chunk tells. Values shorter than 4 characters are not looked for (they would turn up in ordinary text); exec warns about them.
  4. Its exit code is the command's (128 + the signal for one killed by a signal).

Why the value is safe on this path: it travels only over the daemon's unix socket (in $XDG_RUNTIME_DIR, which only the user can open — the same user who can read the keyring anyway), into the memory of the CLI process and the environment of the one command. It is never an argument, so it does not show in ps or in the agent's transcript of the command line; the daemon does not log it and the journal never sees it.

qcc secret ask NAME --prompt "<what it is for and where to get it>" [--project P | --global], run inside an agent's thread (or with --thread <id>):

  • The thread waits on a request, like a question to the user: it is "waiting" in the sidebar and qcc thread list --state waiting, and the notifications plugin says so.
  • The app shows a card with the agent's prompt, the scope, a password field and Save and Decline (in the timeline and the lineage view). From a terminal: qcc secret answer <thread> <interaction> reads the value like set does; --decline refuses. qcc interaction resolve … --cancel declines too, but a value cannot be given through interaction resolve, whose answer the timeline records.
  • The value goes to the store before the request is resolved. The timeline records only "secret NAME stored" or "declined" (the resolution {"type": "selected", "option_id": "stored"} or "declined").
  • The command blocks until then and prints only the outcome: stored as NAME (scope); use it with: qcc secret exec --env NAME -- <command> (exit code 0), or declined: … / cancelled: … (exit code 1).
  • The request is tied to the agent's turn: if the turn ends (interrupted, the session released, the thread archived) before the answer, it is cancelled, and so it is when the asking process goes away. Agents are told to run ask in the foreground with a long timeout.
  • Without --project/--global the secret is stored in the thread's project, or global outside projects.

Every value the daemon knows (all scopes, all projects) is replaced with [secret:NAME] in every event of every thread before the event is written to the journal, folded into the thread's projection or sent to a client: messages, reasoning, commands and their output, tool calls and results, approvals and questions, errors, the user's own messages and the thread's title. This happens in the core, after the provider bridge, so it holds for every agent. Streamed text is filtered per item like exec's output, so a value the agent writes across two chunks is caught; the finished item carries the whole redacted text. The agent itself still receives what the user sends it: a value typed into a message reaches the agent, only the timeline is cleaned.

Secrets are protected against accidental leaks: into the agent's context through a command's output, into the journal, the app, screenshots, transcripts, handoffs and summaries, the daemon's logs and RPC answers other than secret.reveal. They are not protected against someone set on reading them. Whoever can run commands as the user can call qcc secret exec with a command that prints the value encoded (base64), writes it to a file or sends it over the network, or read the values file or the keyring directly; the agent's skill tells it not to, which is a request, not a barrier. Values shorter than 4 characters are not redacted. A value the agent learned some other way (it read a .env file) is redacted in the timeline only if the same value is stored as a secret.

Method Params Result
secret.list — {backend: {kind: "keyring" | "file", detail}, secrets: [{name, scope, created_at, updated_at}]}
secret.set {name, scope, value} {secret}
secret.delete {name, scope} {}
secret.reveal {names, project?, thread_id?} {secrets: [{name, scope, value}]}
secret.ask {thread_id, name, prompt, scope?} {outcome: "stored" | "declined" | "cancelled", name, scope}, when the user answers
secret.answer {thread_id, interaction_id, value?} (no value: decline) {}

scope is {"kind": "global"} or {"kind": "project", "project": "<id>"}. Connections that watch threads get secrets.updated with the whole list (no values) when it changes. The request in a thread is an interaction of type secret ({"type": "secret", "name", "prompt", "scope"}).

A plugin reads a secret with the secrets import, and only names its manifest lists (secrets = ["GITLAB_*"]); the daemon resolves the scope by the thread's project like exec does. The bundled gitlab plugin reads its token this way (GitLab); how it works is in Writing a plugin.

A plugin's settings can name the secrets it needs (the secret kind, or a secret column of a list of rows, see Writing a plugin). The plugin's card in the app's settings then shows, for each name, whether a global value is set and which projects have their own, with buttons to set, replace or delete the global value: the same store and dialog as the "Secrets" section, values never shown. A project's own value is still set from the project or with --project, and wins in the project's threads.

The bundled secrets plugin gives every agent the qcc-secrets skill: how to use exec, list and ask, to never ask for a secret in the chat, and the limits above. Like any plugin it can be turned off (qcc plugin disable secrets).