Cache and recall CLI command results with a TTL.
recall is a command wrapper for avoiding repeated execution of slow, rate-limited, or expensive commands.
To use it, simply place recall -- in front of an existing command. The first invocation runs normally and stores the result. Identical invocations from the same working directory return the cached result until the TTL expires.
$ time recall -- gh api user
{"login":"octocat","id":1,"type":"User",...}
real 0m0.31s
$ time recall -- gh api user
{"login":"octocat","id":1,"type":"User",...}
real 0m0.01sCached results preserve stdout, stderr, and the exit status of the original command.
recall requires no daemon or configuration file and does not require changing the command it wraps.
- TTL-based caching with configurable expiration
- Replays stdout, stderr, and exit status
- Concurrent duplicate calls collapse into a single execution
- Optional environment variables for cache-sensitive commands
- Optional execution timeouts and output limits
- Cache pruning for removing old results
- User-private cache storage
- One static binary with no runtime dependencies
- Runs on Linux, macOS, FreeBSD, and Windows
$ brew tap hastefui/tap
$ brew install --cask recallDownload and extract the latest release for your platform from the repository's Releases page.
Release binaries are available for Linux, macOS, FreeBSD, and Windows on amd64 and arm64.
recall requires Go 1.27 or newer.
$ go install go.hasteful.org/recall@latestClone this repository, and then:
$ go build -o recall .
$ go install .$ recall --versionOr run a command through recall:
$ recall -- echo recalled
recalledPut recall -- in front of a command:
$ recall -- kubectl get pods -o jsonRun the same command again and recall returns the stored result.
The default TTL is 30 seconds. Use --ttl to change it:
$ recall --ttl=10s -- kubectl get pods -o jsonOnce the TTL expires, the command executes again and replaces the cached result.
recall [flags] -- <command> [args...]
--ttl how long a cached result stays valid (default 30s)
--force ignore any cached result and re-run (default false)
--env add a variable to the cache key (repeatable)
--timeout kill the command if it runs longer (default 0, disabled)
--max-output skip caching results larger than this (default 1MiB)
--prune delete old cached results, then exit (default false)
--max-age age at which --prune deletes a result (default 24h)
--version print version and exitCache a GitHub API response for 10 minutes:
$ recall --ttl=10m -- gh api userRepeated calls return the same result without another API request.
Use a short TTL for frequently requested cluster state:
$ recall --ttl=10s -- kubectl get pods -o jsonUse --env when the result of a command depends on an environment variable:
$ recall --ttl=10m --env=GH_TOKEN -- gh api userMultiple variables can be provided as a comma-separated list:
$ recall --ttl=5m --env=AWS_PROFILE,AWS_REGION -- \
aws sts get-caller-identity--env is also repeatable:
$ recall --env=AWS_PROFILE --env=AWS_REGION -- \
aws sts get-caller-identityIgnore an existing cached result and execute the command again:
$ recall --force -- gh api userStop a command that runs longer than expected:
$ recall --timeout=30s -- some-expensive-commandTimed-out commands are not cached.
Skip caching when command output exceeds a configured size:
$ recall --max-output=5242880 -- some-commandThe command still runs normally, but oversized output is not stored.
- CI pipelines that repeat the same API requests across steps
- Development scripts that repeatedly execute slow commands
- Rate-limited APIs and CLI tools
- Commands backed by billed APIs or compute
- Kubernetes and infrastructure status queries
- Build tooling and code generation
- Short-lived API and metadata lookups
Build the image:
$ docker build -t recall .The image runs as an unprivileged user and caches results under /tmp/recall.
recall can only execute commands that exist inside the container. For CI use, create a derived image containing the tools that need to be cached:
FROM recall
USER root
RUN apk add --no-cache github-cli jq
USER recallBuild the derived image:
$ docker build -t ci-tools .Mount a volume over /tmp/recall to persist the cache between containers:
$ docker run --rm \
-v recall-cache:/tmp/recall \
-e GH_TOKEN \
ci-tools \
--ttl=10m --env=GH_TOKEN -- gh api userIf an existing image already contains the required tools, copy recall into it instead:
FROM your-existing-tools-image
COPY --from=recall /usr/local/bin/recall /usr/local/bin/recall
ENTRYPOINT ["recall"]Licensed under the MIT License. See LICENSE for details.
Copyright (c) 2026-present hasteful
