Local-first CLI for storing and retrieving code snippets in a SQLite vault.
codecache-cli is built for humans and coding agents that need a simple local snippet database with a stable CLI, machine-friendly output, and no hosted service dependency.
- store reusable code snippets in a local SQLite database
- search across code, title, notes, description, and tags
- attach local files to snippets
- script it from agents with JSON output
- keep everything in a user-controlled local vault
- SQLite-only local vaults
- snippet create, get, list, search, update, delete
- code-aware search with FTS5
- tag support
- file attachments stored alongside the vault
- stdin support for snippet creation
human,json, andjsonloutput modes- explicit
--yessafety for destructive deletes
After install, the command is cache.
Install paths:
brew tap tanRdev/homebrew-tap
brew install codecache-clicurl -fsSL https://raw.githubusercontent.com/tanRdev/codecache-cli/main/scripts/install.sh | bashThe installer downloads the latest GitHub release tarball and installs cache into ~/.local/bin by default.
Install the reusable skill for AI agents through skills.sh:
npx skills add https://github.com/tanRdev/codecache-cli --skill codecache-cliThis gives your coding agent native capabilities for storing, searching, and managing snippets in the local vault.
Initialize a vault and save it as the default:
cache init --vault ~/codecache --set-defaultAdd a snippet from a file:
cache add src/reducer.ts --title "Reducer helper" --tag react --tag formsAdd a snippet from stdin:
pbpaste | cache add - --title "Clipboard snippet" --language typescriptSearch snippets:
cache search createReducer
cache snippet list react --limit 5Get a snippet:
cache get <snippet-id>
cache get <snippet-id> --rawAttach a file:
cache attachment add <snippet-id> ./notes.md
cache attachment list <snippet-id>
cache attachment get <attachment-id> --output ./exported-notes.mdDelete safely:
cache attachment delete <attachment-id> --yes
cache rm <snippet-id> --yesA vault is a directory containing:
cache.sqliteattachments/
Vault resolution order:
--vault PATHCACHE_CLI_VAULT- saved default vault from local config
Read commands require an initialized vault. They do not create missing paths implicitly.
cache init --vault PATH [--set-default]
cache status [--vault PATH]
cache vault show
cache vault use PATH
cache snippet create [FILE|-] --title ... [--language ...] [--tag ...]
cache snippet list [QUERY] [--tag TAG] [--limit N]
cache snippet get ID [--raw]
cache snippet update ID [FILE|-] [--title ...] [--language ...] [--tag ...]
cache snippet delete ID --yes
cache add [FILE|-] ...
cache search [QUERY] ...
cache get ID ...
cache rm ID --yes
cache tags
cache attachment add SNIPPET_ID FILE
cache attachment list SNIPPET_ID
cache attachment get ATTACHMENT_ID --output PATH
cache attachment delete ATTACHMENT_ID --yes- TTY default:
human - non-TTY default:
json - optional:
--format jsonl
cache get --raw prints raw snippet code directly.
This CLI is designed to be agent-friendly.
Examples:
cache search "agentCacheValue" --format json
cache snippet list util --limit 10 --format json
cache get <snippet-id> --rawRecommended agent patterns:
- use
--format jsonfor structured reads - use
--rawwhen you need only snippet code - pass
--vault PATHexplicitly in multi-project automation
- Homebrew formula:
tanRdev/homebrew-tap/codecache-cli - GitHub releases: binary-installable tarball assets
MIT