Tool Open source
once is a command-line tool that runs a command once and reuses its standard output for a specified period. It keeps successful results in memory in a per-user background daemon, keyed by the tenant, working directory, command, and arguments; repeated calls return the cached output until the TTL or an optional absolute expiry is reached. The daemon stops when its last entry expires.
The command runs in the current directory with the caller's environment. Standard input and standard error pass through, non-zero results are not cached, and --no-dir can omit the working directory from the cache key. Tenant keys separate cache contexts, while status and clear commands inspect or remove cached entries. A documented use case is caching a 1Password CLI secret after the first fingerprint approval.
The project is distributed as a Go program with no dependencies beyond the standard library and supports macOS and Linux. Cached values remain unencrypted in daemon memory; access is restricted to processes of the same user. Outputs larger than 64 MiB are passed through without caching. It is licensed under the MIT License.
1 use taken from transcripts — each links to the moment in the video.
For commands whose output you need again but don't want to fetch again. Wrap a command, set an expiry, and later calls reuse its output from a small background process — e.g. approving a 1Password token once with your fingerprint and reusing it for hours.
1 in the library.