AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.4.0-beta.1). Features may change before the next stable release.Switch to stable →

secrets

ak secrets revoke

Remove an agent's grants on a secret, or all of them

Use ak secrets revoke for the operation described below. The command help records its arguments, effects, and options.

Revoke a repository-wide grant

From AgentKit CLI v3.2.0-beta.12, use ak secrets revoke <ref> --agent sha256:<hash> --repo from a worktree of the repository. If the checkout is gone, use --project with the exact repo: slot from ak secrets grants. Worktree-specific grants are separate. Combining --repo and --all exits 2.

Command contract

Remove an agent's grants on a secret, or all of them

Synopsis

Delete the grants an agent binary holds. Without --all this removes every decision — allow and block alike — on one exact scope, which is also how a block is cleared. --all is the panic button: it removes every grant that fingerprint holds, across all secrets, projects, and purposes.

--agent takes a sha256:<64 hex> fingerprint or a pinned adapter name such as claude, which resolves to the adapter's current pin. A grant recorded before a re-pin keeps the old fingerprint; revoke it by the fingerprint ak secrets grants lists. --all takes only a fingerprint.

An exec grant is revoked by naming it the way it was granted, with --exec and --env; any program hash matches, so a grant to a program that has since changed or been removed can still be cleared; pass the program by the path ak secrets grants prints if it is gone. An ordinary revoke leaves exec grants on the same secret in place and says how many remain. --all removes exec grants too.

--repo revokes the grant recorded with --repo on the repository-wide slot of the project containing the current directory (or --project); the per-worktree grants are separate rows and stay. A repository-wide slot can also be named exactly as ak secrets grants prints it, with --project repo:<git dir>, after the repository itself is gone.

This revokes grants, not secrets. The stored values are untouched and any copy the agent already read is still out there, so treat a panic revoke as the first step and ak secrets rotate <ref> as the second.

Effects: Removes matching rows from the grants file under AGENTKIT_HOME. The stored secret values are untouched, and so is any copy an agent already read.

Exit status: 0 success, 1 command failure, 2 invalid flags or arguments

ak secrets revoke [<ref>] [flags]

Examples

  ak secrets revoke ${REF} --agent claude                  # one scope, the pinned claude binary
  ak secrets revoke ${REF} --agent sha256:${HASH} --repo   # the repository-wide grant
  ak secrets revoke --agent sha256:${HASH} --all           # panic button

Options

      --agent string     Agent to match: a pinned adapter name such as claude, or its full sha256:<64 hex> fingerprint (required)
      --all              Revoke every grant this agent holds, across all secrets
      --env string       Environment variable the program receives the secret in (needs --exec)
      --exec string      Program the secret is revoked for, by name on PATH or by path; makes this an exec scope (needs --env)
  -h, --help             help for revoke
      --json             Emit machine-readable JSON (implies --no-interactive)
      --no-interactive   Disable interactive prompts (CI-safe)
      --project string   Project slot; defaults to the AK project containing the current directory
      --purpose string   Purpose label of the grant to remove; matched literally
  -q, --quiet            Suppress non-error output on stderr
      --repo             Revoke the repository-wide grant recorded with --repo instead of this worktree's
  -V, --verbose          Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes              Assume yes for all prompts

SEE ALSO

  • ak secrets - Manage named secret values (API keys, tokens)