Filtering what gets captured (.shmemignore)
Hooks capture entire conversations, which may include API keys, passwords, or other sensitive data. shmem filters content through .shmemignore rules before it's stored.
Credentials are the most important use, but not the only one — .shmemignore is also how you keep repetitive noise out of the store in the first place. See capture hygiene below.
Credential filters are built in. shmem redacts common credential shapes on every capture and every share, whatever your files say: Anthropic, OpenAI (modern + classic), OpenRouter, Google/Gemini, AWS access key IDs (long-term and temporary), GitHub tokens (classic and fine-grained), Slack tokens, private key blocks (PEM, OpenSSH, PGP), shmem bearer tokens, and a fallback for other providers' sk-<label>-<token> keys. New patterns arrive with upgrades. ~/.shmem/.shmemignore is for rules of your own; shmem install writes it empty, ready to edit, and replaces an untouched copy of the defaults older versions wrote.
Signed in, your rules belong to your account. Each sync uploads your .shmemignore files when you've edited them and downloads edits made on your other machines, so a rule added anywhere filters what you share, what your connectors save, and what every machine captures. Edit the files directly. If two machines change a file between syncs, shmem keeps the rules from both and says so.
# Sync, then show the rules that apply and where they come from
shmem ignore
# Print the built-in credential rules
shmem ignore defaults
Locations (loaded and merged in this order):
- Per-project:
~/.shmem/projects/<tag>/.shmemignore - Global:
~/.shmem/.shmemignore - The built-in credential rules, always
Format — three rule types, inspired by sed:
# Bare pattern — redact matched text to empty string
sk-ant-api03-[A-Za-z0-9_-]+
AKIA[A-Z0-9]{16}
# Substitution — replace matches with specific text
s/Bearer [A-Za-z0-9_.-]+/Bearer [REDACTED]/g
s/password=\S+/password=[REDACTED]/g
# Drop — reject the entire fact if the pattern matches
d/BEGIN.*PRIVATE KEY/
d/-----BEGIN CERTIFICATE/
- Lines starting with
#and blank lines are ignored - Rules are applied in order; drop rules short-circuit — if a drop matches, the fact is rejected immediately
- A drop rule only sees what earlier rules left. The defaults replace private key blocks with
[REDACTED-PRIVATE-KEY], so to drop those facts instead, putd/BEGIN.*PRIVATE KEY/above the defaults in the global file, or in the per-project file, which runs first
Capture hygiene
Automated capture picks up repetitive traffic along with the useful material: health checks, smoke tests, CI chatter, status polls. This is worth filtering — not because of store size, but because it dilutes retrieval.
Filter at capture time, with a drop rule. This is the supported answer, and it's the only one that keeps the noise out of the store rather than working around it later:
# Drop whole facts matching noise you never want to retrieve
d/^GET /healthz/
d/smoke-test-runner/
d/^\[CI\] nightly/
Some things shmem deliberately does not do, so you don't go looking for them:
- No retroactive dedup. Nothing collapses duplicates in an existing store. A small share of exact duplicates is normal and harmless — they compete with each other for the same retrieval slot rather than crowding out unrelated facts.
- No retention or compaction. The store is append-only by design; that's what makes it an auditable record of what actually happened rather than a summary you have to trust. Facts are immutable — insert or delete, nothing in between.
dedup_keyis not for this. It exists for sync idempotency between a local store and a remote one, so the same fact pushed twice doesn't land twice. It does not deduplicate local writes.
If you need to remove something already stored, shmem delete takes explicit fact IDs — find them with shmem query --ids first.