FishmemDocs

Move keys out of .zshrc, .env and notes

A step-by-step migration from shell profiles, .env files, notes, password managers, browsers and KeePass, without breaking the scripts that use them, and how to export everything.

Most people's keys live in four places: export lines in a shell profile, .env files in each repository, a notes app, and maybe an older password manager. This guide moves each of them into Fishmem and keeps every script working.

Plan for about 30 minutes for a typical laptop. Nothing below deletes anything until you do it yourself.

1. Find what you have

fishmem scan looks for known key formats (OpenAI, Anthropic, GitHub, Stripe, AWS, Slack, private keys and more) in any files you give it:

fishmem scan ~/.zshrc ~/.bashrc ~/.profile ~/.config/fish/config.fish
fishmem scan ~/code          # every file under a folder

It prints the file, line and kind of key, never the full value. Once a key is in your vault, the scan also recognises its exact value anywhere, whatever its format.

2. Shell profiles

Coming soon: fishmem shell migrate (built and in review) will do this step for you: it finds keys in ~/.zshrc, ~/.bashrc, fish and PowerShell profiles, moves them into the vault, and replaces each line with a loader so every script still sees the same variables. Inside an AI agent's shell, the same line sets only fm:// references. fishmem shell undo puts the lines back. Until it ships, do it by hand:

Copy the export lines into a temporary file, import them, then delete the temporary file:

fishmem secrets create shell
grep -E '^export [A-Z_][A-Z0-9_]*=' ~/.zshrc | sed 's/^export //' > keys.env
fishmem secrets import keys.env -p shell --dry-run    # check first
fishmem secrets import keys.env -p shell
rm keys.env

Then remove those lines from ~/.zshrc. Tools that need a key get it at the moment they run:

fishmem run -p shell -- ./deploy.sh

If you call a tool many times a day, a small wrapper keeps it short:

# ~/.zshrc — no secrets, just a wrapper
aider() { fishmem run -p shell --only-refs -- command aider "$@"; }

With --only-refs nothing is injected except fm:// references already in the environment, so you can choose exactly which keys a tool sees: OPENAI_API_KEY=fm://shell/OPENAI_API_KEY aider.

3. .env files

For each repository:

fishmem secrets create my-app                      # production goes in a second vault, my-app-prod
fishmem secrets import .env -p my-app
echo '{"vault": "my-app"}' > .fishmem.json

Replace the values in a copy of .env with references and commit that instead:

# .env.example
DATABASE_URL=fm://DATABASE_URL
STRIPE_KEY=fm://STRIPE_KEY

Run as before, with fishmem run -- npm run dev, or fishmem run --env-file .env.example -- npm test. When everything works, delete .env. See Vaults, references and run.

4. Password managers and browsers

Export from the other app, import, then delete the export file if it's plain text (everything below except KeePass and Fishmem's own export).

FromExport asCommand
1Password.1pux (preferred) or CSVfishmem secrets import 1PasswordExport.1pux
BitwardenUnencrypted JSON (preferred, includes passkeys) or CSVfishmem secrets import bitwarden_export.json
Chrome, Edge, BravePassword Manager › Settings › Export passwordsfishmem secrets import "Chrome Passwords.csv"
FirefoxPasswords › ⋯ › Export passwordsfishmem secrets import logins.csv
Apple Passwords, SafariPasswords app › File › Export All Passwords (Mac), or Settings › Apps › Passwords › Export (iPhone)fishmem secrets import Passwords.csv
LastPassAdvanced options › Export (CSV)fishmem secrets import lastpass_export.csv
KeePass, KeePassXCNothing: use the .kdbx itself (asks for its password), or a CSV exportfishmem secrets import Passwords.kdbx
Fishmemfishmem secrets export-allfishmem secrets import fishmem-export-2026-11-18.fmexport
Any .envfishmem secrets import .env -p VAULT
  • Each vault (1Password), folder (Bitwarden, LastPass) or top-level group (KeePass) becomes a Fishmem vault. Browser exports go into one vault named after the browser. A Fishmem export keeps its own vaults. Pass -p VAULT to put everything in one vault instead.
  • 2FA secrets go straight into each login's 2FA field, from every source that has them (1Password, Bitwarden, Apple Passwords, LastPass, KeePassXC and KeePass 2.47+). Formats Fishmem can't generate codes for (such as Steam) are kept in the note and listed at the end of the import.
  • Cards, identities and custom fields come along from 1Password (.1pux), Bitwarden (JSON), LastPass (card and address notes) and KeePass (custom attributes).
  • Passkeys come along from Bitwarden's JSON export and from KeePassXC databases. 1Password, Apple Passwords and the browsers don't put passkeys in their exports.
  • Format detection is automatic. If a CSV isn't recognised, name the source with --from chrome|edge|firefox|apple|lastpass|keepass-csv|1password-csv|bitwarden-csv.
  • KeePass databases that also need a key file or a hardware key can't be opened; export them as CSV from KeePassXC instead. For scripts, put the password in FISHMEM_IMPORT_PASSWORD.
  • Names that already exist in a vault are kept side by side (NAME (imported)) unless you pass --overwrite. Running the same import twice doesn't create duplicates. Imported items whose value matches an item you already have are listed at the end; fishmem secrets duplicates can merge them into one linked item.
  • Add --dry-run to see what would happen first.

The desktop, phone and web apps have the same import under Secrets › Import.

Export everything

fishmem secrets export-all writes every vault and item (passwords, API keys, notes, 2FA keys, passkeys, SSH keys) to one file, as a backup or to move elsewhere:

--formatWhat you get
fishmem (default)Encrypted with a password you choose. Imports back into Fishmem with every field.
kdbxA KeePass database protected by the password. Opens in KeePassXC and KeePass, with 2FA keys in the otp field and passkeys in KeePassXC's passkey fields.
csvLogins only (name,url,username,password,note,totp,folder), unencrypted, for Chrome, Edge, Firefox, Bitwarden or 1Password. Passkeys, notes and keys are listed as left out.
jsonEverything, unencrypted, for scripts.

Add -p VAULT (repeatable) to export only some vaults, and -o FILE to choose the file name. The password can't be recovered. The apps have the same under Developer tools › Export everything, and the website under Import & export.

5. Notes

There is no reliable way to parse free-form notes, so do this one by hand. For each key or password, create a secret in the app, or:

fishmem secrets set NAME -p Personal          # hidden prompt
fishmem secrets set Bank --kind password --username me --url https://bank.example -p Personal
fishmem secrets set "Wi-Fi recovery codes" --kind note -p Personal

Then delete the note, and empty your notes app's "recently deleted" folder.

6. Keep it clean

Install the pre-commit hook in each repository. It checks only the lines a commit adds, and blocks the commit if one of them contains a known key format or any value stored in your vault:

fishmem scan --install-hook

Existing hooks are kept and run first. To allow a line on purpose, add fishmem:allow to it, or list the path under "scan": {"ignore": [...]} in .fishmem.json.

7. Rotate what was exposed

Moving a key doesn't un-leak it. If a key sat in a public repository, in a file an AI tool could read, or in a synced notes app you no longer trust, create a new key at the provider, update it in Fishmem with fishmem secrets set, and revoke the old one. Set reminders for the rest:

fishmem secrets remind OPENAI_API_KEY -p shell --every 90d
fishmem secrets due

Something missing or wrong? Tell us at support@fishmem.com