Secrets → ak secrets
Secrets → ak secrets
The web app no longer has a Secrets screen. Opening /secrets now shows a short notice that points here. Keep your secrets in AgentKit’s ak secrets instead.
What has not changed:
- Secrets you already stored stay in AgentWiki and stay readable through the API (
/api/secrets), the CLI (agentwiki secrets ...) and MCP. You can export them at any time. - Nothing was deleted. Only the web screen is gone.
Why
AgentWiki’s secrets are encrypted at rest, but the server holds the keys. Each workspace has its own data key, and that data key is wrapped with a master key (SECRETS_ENCRYPTION_KEY) set on the API server. The server can decrypt any secret: that is how reveal, export and agentwiki run work. Anyone who controls the server or its configuration could do the same.
ak secrets is local-first and end-to-end encrypted: the vault lives on your machine and is encrypted and decrypted there. Keys never leave your devices, so a sync service only ever stores ciphertext it cannot read (zero-knowledge). For values that agents and scripts need on your own machine, that is the safer default.
Use ak secrets
ak secretsak secrets manages the local vault. On several devices, ak secrets sync syncs the encrypted vault through ak-vault (preview).
See the AgentKit docs for the full command set (adding, reading, importing and injecting secrets).
Move your existing secrets
1. Prepare an API key
The agentwiki CLI signs in with an API key (agentwiki login --api-key aw_...). Exporting raw values needs, on that key:
- the scopes
secret:read,secret:exportandsecret:reveal, and - the agent flag
mcp:secret-export(an exact flag; no wildcard implies it).
Create or edit the key in Settings → API keys.
The key also needs a reveal grant that covers the secrets you export. Export stops with SECRET_GRANT_DENIED if one entry is not covered. A grant with key pattern * and path / covers a whole environment:
agentwiki secrets grants add \ --target-type api_key --target-id <api key id> --target-name "Move to ak secrets" \ --env dev --path / --key '*' --permissions reveal \ --reason "export secrets to ak secrets"Creating a grant needs secret:grant and the mcp:secret-grant flag on the key that runs the command. Granting access to your own key is a self-grant: in a workspace with one admin it is allowed with a reason of at least 10 characters (and a warning email is sent when email is configured); otherwise another admin has to create the grant.
2. Export each environment
agentwiki secrets export prints a .env file. Without --reveal the values are masked (KEY=***), which is useful to check what will be exported:
agentwiki secrets export --env devWith --reveal (a --reason is required) it prints the raw values. The export is recorded in the secret audit log.
agentwiki secrets export --env dev --reveal --reason "move to ak secrets" > dev.env| Flag | Meaning |
|---|---|
--env <environment> | Required. The environment to export, e.g. dev, staging, production. |
--path <path> | Only entries at exactly this path. Without it, every path in the environment is exported. |
--reveal | Export raw values instead of ***. |
--reason <reason> | Required with --reveal; stored in the audit log. |
Repeat for each environment. If the same key exists at several paths, export each path separately (--path /backend, --path /frontend, …) so one value does not hide another in a single .env file.
3. Import into ak secrets
Import each .env file with ak secrets (see the AgentKit docs for the import command), then delete the plaintext files:
rm dev.env4. Clean up in AgentWiki (optional)
When everything works from ak secrets:
- revoke the export grant:
agentwiki secrets grants revoke <grant id>(list grants withagentwiki secrets grants list); - remove the export scopes and flag from the API key, or delete the key;
- disable or destroy the old entries with
agentwiki secrets delete <id>(add--destroyto permanently purge the encrypted values; this cannot be undone).