E
Engram
Integrations

Terminal Genie

A shell function that intercepts your last failed command, sends it to the local Engram API (localhost:8000), and prints a corrected version using Llama 3.1 — no copy-pasting, no browser tab required. Type ??.


Setup

To enable the ?? alias, you need to add a hook to your shell configuration.

01Locate the Script

Ensure you know the path to your Engram installation. The magic script lives at:

bash
path/to/engram-os/cli/genie.py

02Configure your Shell

Add the following function to your ~/.zshrc (macOS) or ~/.bashrc (Linux):

bash
# --- Engram Terminal Genie ---
function terminal_genie() {
    # 1. Grab the last command from history
    LAST_CMD=$(fc -ln -1)
    
    # 2. Send it to Engram
    # REPLACE THIS PATH with your actual project path
    python3 ~/path/to/engram-os/cli/genie.py "$LAST_CMD"
}

# 3. Create the alias
alias '??'='terminal_genie'

03Apply Changes

Restart your terminal or source your configuration file:

bash
source ~/.zshrc

Troubleshooting

Connection Refused?

If the Genie cannot connect, ensure Ollama is running and allowing external connections. You may need to set the host environment variable:

launchctl setenv OLLAMA_HOST "0.0.0.0"