A CLI-first application that learns from your shell configuration and helps you optimize your command-line productivity by tracking command usage and suggesting better alternatives.
- Multi-shell support: Works with Bash and Zsh shells
- Automatic alias discovery: Scans and learns from your existing shell configuration files
- Command monitoring: Tracks command usage and suggests aliases when available
- Configurable actions: Choose between notices (suggestions) or blocking (prevent execution) when aliases are available
- Smart file watching: Automatically relearns aliases when configuration files change
- User alias management: Add, list, and remove custom aliases through the CLI
# Install latest version
pip install git+https://github.com/yaronneuman/lazysloth.git
# Install specific version
pip install git+https://github.com/yaronneuman/[email protected]- Go to Releases
- Download the latest
.whlfile - Install:
pip install lazysloth-1.0.0-py3-none-any.whl
git clone https://github.com/yaronneuman/lazysloth.git
cd lazysloth
pip install -e .After installing LazySloth, you need to integrate it with your shell:
# Auto-detect shell and install
sloth install
# Or specify a shell explicitly
sloth install --shell bash
sloth install --shell zshThen restart your shell or source your configuration:
# For bash
source ~/.bash_profile
# For zsh
source ~/.zshrc
View current monitoring settings:
sloth monitor statusConfigure monitoring behavior:
# Set action type: none (disabled), notice (suggestions), or block (prevent execution)
sloth monitor config --action notice
# Set thresholds for notifications and blocking
sloth monitor config --notice-threshold 2 --block-threshold 5
# Enable/disable monitoring entirely
sloth monitor config --enabled trueView LazySloth status and configuration:
sloth status-
Installation: LazySloth integrates with your shell by adding hooks:
- Bash: Uses a
trap 'DEBUG'hook to monitor commands before execution - Zsh: Creates a custom ZLE widget that intercepts commands on Enter/Return
- Bash: Uses a
-
Alias Discovery: Automatically scans and learns from your shell configuration files:
.bash_profile,.bash_aliases,.zshrc,.zsh_aliases- Custom
.slothrcfile for user-defined aliases
-
Command Monitoring: Tracks command usage and matches against known aliases:
- Configurable thresholds for notices and blocking
- Smart filtering to avoid self-monitoring LazySloth commands
-
File Watching: Monitors configuration files for changes and automatically relearns aliases when they're modified
LazySloth stores its configuration in ~/.config/lazysloth/:
config.yaml- Main configurationaliases.yaml- Discovered aliasesstats.yaml- Command usage statistics
monitoring:
enabled: true
notice_threshold: 1 # Show notice after N command uses
blocking_threshold: 5 # Block command after N uses
blocking_enabled: true # Whether to block commands
ignored_commands: [] # Commands to never monitor
monitored_files:
bash:
- ~/.bash_profile
- ~/.bash_aliases
- ~/.slothrc
zsh:
- ~/.zshrc
- ~/.zsh_aliases
- ~/.slothrcAfter installation and running a few commands:
$ git status
💡 LazySloth: You can use 'gs' instead of 'git status'
$ ls -la
⚠️ LazySloth: Command blocked! Use 'll' instead of 'ls -la'
# (if blocking is enabled and threshold reached)You can add, list, and remove custom aliases:
# Add a new alias
$ sloth alias add gs "git status --porcelain"
✅ Added alias: gs -> git status --porcelain
# List all known aliases
$ sloth alias list
📁 .slothrc:
gs → git status --porcelain (user_defined)
📁 /home/user/.bash_profile:
ll → ls -la (bash)
.. → cd .. (bash)
# Remove an alias (only works for .slothrc aliases)
$ sloth alias rm gs
✅ Removed alias: gs
💡 Alias removed from ~/.slothrcAdd or remove files from the monitoring list:
# View monitored files
sloth monitor files
# Add a file to monitor (for a specific shell)
sloth monitor files --shell bash --add ~/.bash_custom
# Remove a file from monitoring
sloth monitor files --shell bash --remove ~/.bash_customLazySloth is designed with a modular architecture:
- Core: Configuration management, installation logic, auto-learning, and file watching
- Collectors: Extract aliases from various shell configuration files
- Monitors: Command monitoring hooks and suggestion logic
- CLI: Click-based command-line interface for all user interactions
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0+). See the LICENSE file for details.
Created by Yaron Neuman