Prompt Saver (pmsv) is a fast and convenient CLI utility for saving, managing, and searching your AI prompts.
The utility supports a hierarchical topic structure, tags, usage history, and powerful interactive search via fzf.
- Saving and Management: Easily save, edit, and delete prompts.
- Topic Hierarchy: Organize prompts into a tree-like topic structure (e.g.,
java/testing/junit). - Interactive Search: Instant fuzzy search by names and content using fzf.
- Copy to Clipboard:
- History:
- JDK (Java 21+).
- GraalVM (for native compilation).
fzf(for interactive searchpmsv find).
-
Clone the repository:
git clone <repository_address> cd prompt-saver
-
Compile the native executable: Gradle and the GraalVM plugin are used for building. Run the following command:
./gradlew nativeCompile
This process may take several minutes.
-
Install to PATH: After successful compilation, the executable will be located in
build/native/nativeCompile/prompt-saver.For ease of use, move it or create a symbolic link in a directory that is in your system's
PATH.# Example for Linux/macOS sudo mv build/native/nativeCompile/prompt-saver /usr/local/bin/pmsvAfter this, you can call the utility from anywhere simply by its name
pmsv.
All commands use the alias pmsv.
# Save a simple prompt from a string
pmsv save my-prompt "Это мой первый промпт" --topic "general"
# Save a prompt with tags and a nested topic
pmsv save stream-api-example "Пример использования Java Stream API для фильтрации..." \
--topic "java/core" --tags "stream,api,java8"
# Save a prompt by reading its content from a file (via stdin)
cat my_prompt_file.txt | pmsv save file-prompt --topic "files"# Output the prompt content to stdout
pmsv get my-prompt
# Get the prompt and immediately copy it to the clipboard
pmsv get stream-api-example --copyThis command opens the content of the specified prompt in your system's text editor ($EDITOR).
pmsv edit my-promptAfter saving the file and closing the editor, the changes will be written to the database.
# Delete a prompt by name
pmsv rm file-promptShows recently used prompts (via get or find commands).
pmsv history# Show the hierarchy of all topics with the number of prompts in each
pmsv treeOutput example:
.
├── general (1)
├── git (1)
└── java (1)
└── core (1)
The most powerful function for quick access to prompts.
pmsv findThis command launches fzf for interactive search. By default, pressing Enter copies the content of the selected prompt to the clipboard and outputs its name to stdout.
You can fine-tune fzf's behavior through the utility's configuration file (by default ~/.prompt_saver/config.yaml).
Example config.yaml:
---
active_profile: "default"
profiles_path: "/home/michaelos/.prompt_saver/profiles"
fzf_command_args:
- "fzf"
- "--prompt='Find Prompt> '"
- "--height=35%"
- "--layout=reverse"
- "--preview='pmsv get {}'"
- "--preview-window=right:60%"
- "--bind='enter:execute(pmsv get {} --copy > /dev/null)+accept'"Explanation of fzf_command_args parameters:
--prompt='Find Prompt> ': Sets the input prompt text infzf.--height=35%: Limits the height of thefzfwindow to 35% of the terminal height.--layout=reverse: Displays the list of results at the top, and the input field at the bottom.--preview='pmsv get {}': Enables the preview window.fzfexecutes thepmsv getcommand for each selected item ({}is replaced by the prompt name), showing its content.--preview-window=right:60%: Places the preview window on the right, occupying 60% of the width.--bind='...': Allows overriding key actions. This is the most interesting flag:enter:: Defines the action for theEnterkey.execute(pmsv get {} --copy > /dev/null): Execute an external command. Here we get the selected prompt and immediately copy it to the clipboard (--copy), and hide the command's standard output (> /dev/null) to avoid cluttering the terminal.+accept: After executingexecute, also perform the default action forEnter(in this case - terminatefzfand output the selected item tostdout).
./gradlew javadoc
# doc : build/docs/javadoc/index.html