# Shell Memory CLI A CLI tool that learns from your terminal command patterns to automate repetitive workflows. It records command sequences, detects patterns, suggests time-saving shortcuts, and can generate shell scripts from natural language descriptions. ## Features - **Command Recording**: Save frequently used commands with descriptions and tags - **Pattern Detection**: Automatically detect repeated command sequences and workflows - **Command Library**: Personal searchable command library with tagging system - **Session Recording**: Record terminal sessions for replay - **Script Generation**: Generate shell scripts from natural language descriptions ## Installation ```bash # Clone the repository cd shell-memory-cli # Install dependencies pip install -r requirements.txt # Install the package pip install -e . ``` ## Quick Start ### Record a Command ```bash # Add a command to your library shell-memory cmd add "git status" -d "Check repository status" -t git -t vcs # List all commands shell-memory cmd list # Search for commands shell-memory cmd search git ``` ### Detect Patterns ```bash # Detect patterns in your command history shell-memory pattern detect # View workflow statistics shell-memory pattern stats # Get suggestions for shortcuts shell-memory pattern suggestions ``` ### Record Sessions ```bash # Start recording a session shell-memory session start my-workflow # Record commands during the session shell-memory session record "cd /path/to/project" shell-memory session record "npm install" shell-memory session record "npm test" # Stop recording shell-memory session stop # List all sessions shell-memory session list # Replay a session shell-memory session replay 1 # Export session as shell script shell-memory session export 1 -o workflow.sh ``` ### Generate Scripts ```bash # Generate a shell script from natural language shell-memory script generate "deploy application to production" # List available templates shell-memory script templates # Add a custom template shell-memory script add-template deploy production "#!/bin/bash\necho deploying..." ``` ## Configuration Set environment variables to customize behavior: | Variable | Description | Default | |----------|-------------|---------| | `SHELL_MEMORY_DB` | Path to SQLite database file | `~/.shell_memory/shell_memory.db` | | `SHELL_MEMORY_HOME` | Base directory for data | `~/.shell_memory` | | `SHELL_MEMORY_VERBOSE` | Enable verbose output | `false` | | `SHELL_MEMORY_FORMAT` | Output format (table, json, plain) | `table` | ## Commands Reference ### Command Management (`cmd`) - `shell-memory cmd add ` - Add a command to library - `shell-memory cmd list` - List all commands - `shell-memory cmd search ` - Search commands - `shell-memory cmd delete ` - Delete a command - `shell-memory cmd similar ` - Find similar commands ### Pattern Detection (`pattern`) - `shell-memory pattern detect` - Detect patterns in command history - `shell-memory pattern suggestions` - Get workflow shortcuts - `shell-memory pattern stats` - View workflow statistics ### Session Recording (`session`) - `shell-memory session start [name]` - Start recording - `shell-memory session record ` - Record a command - `shell-memory session stop` - Stop and save session - `shell-memory session list` - List all sessions - `shell-memory session replay ` - Replay a session - `shell-memory session export ` - Export as script ### Script Generation (`script`) - `shell-memory script generate ` - Generate script - `shell-memory script templates` - List templates - `shell-memory script add-template