Back to projects

CmdVault: Command, Prompt & Secrets Vault

Your commands, prompts and secrets, one tray click away.

Overview

CmdVault is a terminal-native vault for everything you copy-paste all day. It opens from the system tray as a small window, copies what you need with a single key, and gets out of the way. Built and used daily on CachyOS with KDE Plasma on Wayland.

The problem

People who live in the terminal (developers, pentesters, sysadmins, AI power users) keep re-typing or hunting for the same things all day:

  • long shell commands used once a week and never remembered (hashcat masks, xfreerdp connection strings, virsh snapshots)
  • AI prompts reused across chats
  • throwaway values for the task at hand (IPs, paths, tokens for one project)
  • credentials that need to be pasted somewhere right now

That usually ends up spread across shell history, sticky notes, a notes app, a password manager and random text files. Shell history is noisy and per-machine, notes apps are slow to reach from the keyboard, and password managers are built for websites, not for pasting a command into a terminal.

Three modes

One app, three modes, each with its own color so you always know where you are.

CMD mode · the permanent library

Save commands, snippets and prompts, multi-line supported. Categories show as tabs, optional labels give long commands a short name, and live search plus Enter or a click copies instantly.

Focus mode · the per-project scratchpad

Named sessions, one per project or task. Dump temporary values while working, delete instantly, undo anything, search across all sessions, and mask sensitive entries on screen.

Secure mode · the encrypted vault

Password-manager-style entries with username, password and any extra fields (PIN, recovery code, URL). Click a field's marker to copy exactly that field. Encrypted on disk with a master password, and auto-locks on leaving the mode or after 5 minutes idle.

Architecture

Two Python components: a curses terminal UI and a tray daemon. The UI is frame-based, with one shared state object and one render-and-handle function per mode. The tray daemon is a native KDE StatusNotifierItem implemented directly over DBus, including the dbusmenu protocol for the right-click menu, with a pystray fallback for other desktops.

CMDVAULT ARCHITECTURE One tray click opens the vault. Three modes, one local file, nothing leaves the machine. TRAY DAEMON System tray icon KDE StatusNotifierItem over DBus · flock single-instance TERMINAL UI · CURSES keyboard-first · mouse support · undo everywhere · clipboard auto-clears after 45 s CMD MODE Permanent library commands, snippets, AI prompts category tabs · live search · one-key copy FOCUS MODE Per-project scratchpad named sessions · temporary values search all sessions · mask on screen SECURE MODE Encrypted vault Fernet + scrypt master password auto-locks after 5 min idle LOCAL VAULT FILE atomic saves · 10 rotating backups · owner-only 0600 · corrupted-file guard
Tray daemon, terminal UI, three modes, one local vault file.

Security

Real encryption

Secure mode uses Fernet (AES-128-CBC + HMAC-SHA256) with a key derived from the master password using scrypt, a memory-hard KDF with a random salt per vault.

Secrets only in memory

Secrets are decrypted only while unlocked. Locking re-encrypts and wipes them, including the undo history.

Search can't leak

Search in Secure mode never looks inside passwords, so a typed guess can't reveal password contents.

Clipboard hygiene

Copied secrets are flagged sensitive so clipboard managers like KDE Klipper don't keep them, copied values clear after 45 seconds, and secrets never appear in the status bar.

Owner-only files

The data file and backups are owner-only (0600 files, 0700 folders), and lock files live in the per-user private runtime directory instead of the shared /tmp.

Reliability

Atomic saves

Write to a temp file, then rename, so a crash or power cut can't leave a half-written vault.

Rotating backups

One backup per launch, last 10 kept, scrubbed of plaintext once the vault is encrypted.

Corrupted-file guard

If the vault can't be read, the app refuses to start rather than overwrite it, and prints the exact restore command from the latest backup.

Kernel-level single instance

flock locks for both the tray and the UI: no duplicate tray icons, no two windows fighting over one file, and locks never go stale because the OS releases them when a process dies.

Terminal engineering

  • Raw-mode input: Ctrl+C/X/V copy, cut, paste
  • Bracketed paste + burst draining
  • No escape-code leaks in text fields
  • Near-zero Esc latency
  • 256-color with 8-color fallback
  • Width-aware hint bars

Tech stack

  • Python 3
  • curses
  • cryptography (Fernet, scrypt)
  • DBus · StatusNotifierItem
  • dbusmenu
  • PyGObject
  • wl-clipboard / xclip

Roadmap

  • Change master password, temporary reveal and encryption for masked Focus entries
  • Packaged installers (AUR, .deb, Flatpak) and a one-command setup
  • Support for GNOME, other desktops and macOS
  • Import and export (shell history, JSON, password manager CSV)
  • Optional encrypted sync between machines
  • Variables in saved commands (fill in host, user, port on copy)
  • Shared vaults for pentest and ops teams