Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Valkey CLI

$ valkey-cli Official High Risk
Valkey (Linux Foundation) · Database & Data · BSD-3-Clause · macos / linux / windows

valkey-cli is the official CLI for Valkey (the open-source Redis fork under the Linux Foundation). It supports direct --json and --csv command serialization, cursor-safe --scan key iteration instead of blocking KEYS *, and secure auth via VALKEYCLI_AUTH.

FCRS-1.0 Score
85 /100
Good
Medium Confidence
Zero-Friction Install
brew install valkey
CLI vs MCP Decision CLI Preferred vs MCP

Prefer valkey-cli --json and --scan over Valkey/Redis MCP servers for direct sub-millisecond debugging and zero schema overhead.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports --json, --csv, --raw, and --scan for single-shot non-interactive commands, though raw-text commands like INFO bypass --json and interactive mode opens if no command is supplied.

  • --json serializes RESP3 replies into JSON
  • --scan --pattern avoids blocking KEYS *
Trust & Safety 19 / 25

VALKEYCLI_AUTH keeps secrets out of process lists, but dangerous server commands (FLUSHALL, FLUSHDB, SHUTDOWN) have no confirmation prompt or client read-only flag.

  • VALKEYCLI_AUTH env var avoids -a CLI leakage
  • Destructive commands (FLUSHDB) execute immediately
Setup & Portability 14 / 15

Fast C binary distributed via Homebrew (brew install valkey) and Linux packages, plus Windows builds/WSL.

  • Lightweight compiled binary with zero runtime dependencies
Utility & Efficiency 13 / 15

Covers key inspection, --stat, --bigkeys, --latency, and cluster/TLS flags (--tls) in one binary.

  • Built-in diagnostics (--bigkeys, --hotkeys, --stat)
Maintenance & Lineage 10 / 10

Official Linux Foundation Valkey project (valkey-io/valkey) with broad industry backing and BSD-3-Clause licensing.

  • Linux Foundation official Valkey distribution
Docs & Verifiability 8 / 10

Clear CLI guide on valkey.io and structured --help output.

  • Official CLI reference at valkey.io/topics/cli

Security, Auth & Guardrails

Auth Modes
No Auth Env API Key
Credential Storage

Supports VALKEYCLI_AUTH (and REDISCLI_AUTH fallback) environment variables, or --user / --askpass.

Side Effects
Read-Only Remote Write Destructive
Cost & Quotas

BSD-3-Clause open-source Linux Foundation project; free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Valkey CLI Agent Rules
- Always use `--scan --pattern` instead of `KEYS *` on production or large datasets.
- Never run `FLUSHALL`, `FLUSHDB`, or `CONFIG SET` without explicit user confirmation.
- Pass passwords via `VALKEYCLI_AUTH` env var instead of `-a <password>` on the command line.

Agent-Ready Command Recipes

Safe Read-Only Queries

Safely scan matching keys without blocking
valkey-cli -h 127.0.0.1 -p 6379 --scan --pattern "session:*" | head -n 50

Iterates keys incrementally using cursor-based SCAN instead of blocking the server with KEYS *.

Read a hash or list directly as JSON
valkey-cli -h 127.0.0.1 -p 6379 --json HGETALL user:1001

Serializes the RESP3 response of HGETALL into valid JSON.

Controlled Writes & Previews

Set a bounded TTL key non-interactively
valkey-cli -h 127.0.0.1 -p 6379 --json SET cache:probe "ok" EX 60

Writes a test key with a 60-second expiration (EX 60) and outputs JSON confirmation.

Strengths for Agents

  • + Native --json and --csv flags format structured RESP3 key/hash/list values cleanly.
  • + --scan --pattern provides non-blocking key discovery.
  • + VALKEYCLI_AUTH keeps passwords out of shell history and process listings.

Caveats & Pitfalls

  • ! Diagnostic commands like INFO or CLIENT LIST still emit raw text even with --json.
  • ! No client-side --dry-run or confirmation gate on destructive commands like FLUSHALL or DEL.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI