Klef docs
Commands

Command reference

Every Klef CLI command at a glance, grouped by what it does.

Every command accepts --help for its full description, arguments, and flags. Most commands that touch secrets accept -e, --env <name> to override the project's default environment for that run.

Status

CommandWhat it does
klef statusAccount, linked project + environment, agent state, and sync. No password prompt.

Details

Authentication

CommandWhat it does
klef loginSign in via browser and unlock your encryption password.
klef logoutSign out and clear the local session token.
klef whoamiPrint the signed-in email, or exit non-zero if not signed in.
klef recoveryRegenerate your recovery code.

Details

Projects and workspaces

CommandWhat it does
klef init [name]Create a new project in the current directory.
klef link <project>Link the current directory to an existing project.
klef projects listList your projects across workspaces.
klef workspace ...Manage workspaces (list, create, rename, delete).

Details

Sync

CommandWhat it does
klef pushEncrypt the local .env.local and upload it.
klef pullFetch, decrypt, and merge into .env.local.
klef diffCompare local .env.local against the server.

Details

Environments

CommandWhat it does
klef env ...Create, list, use (switch default), rename, delete, and copy environments.

Details

Secrets

CommandWhat it does
klef set <key> <value>Create or update a single secret.
klef get <key>Print the decrypted value of a single secret.
klef unset <key>Remove a single secret.
klef rename <old> <new>Rename a secret.
klef listList the keys (not values) in the environment.
klef history <key>Show the change timeline for a secret.
klef restore <version-id>Roll a secret back to a specific version.

Details

Running commands

CommandWhat it does
klef run <command> [args...]Run a command with secrets injected as env vars.

Details

Agent

CommandWhat it does
klef agent ...Manage the background agent (start, status, lock, stop).
klef lockClear the cached unlock. Alias for klef agent lock.

Details

On this page