Basic usage¶
asksh runs as an inline TUI inside your terminal, preserving your prompt and scrollback. You can invoke it from a shell keybinding or directly as a CLI command.
Opening the TUI¶
With shell integration loaded:
- Press ? at an empty prompt to start a blank request.
- Press ? after a space or
?at the end of a partial command, or press Alt+? anywhere in your line buffer, to askaskshto complete, fix, or explain what you typed so far. - Run
asksh "your prompt"directly from the command line.
Press Shift+Enter or Ctrl+J inside the input box to insert a newline, and Up / Down to recall prior prompts. See Keybindings and slash commands for all editing shortcuts.
Acting on a suggested command¶
When the model calls suggest_command, asksh shows the command, a short explanation, its confidence level, and its danger rating (low, medium, or high).
- Run it: clear or leave the input box empty and press Enter. When launched through the shell hook,
askshputs the command on your shell line and executes it. - Edit it first: leave the input box empty and press Tab.
askshplaces the command on your shell line without running it. - Refine it: type follow-up instructions in the input box and press Enter.
- Cancel: press Esc to exit and restore whatever buffer you had before pressing ? or Alt+?.
Danger ratings and dry-run checks¶
Every suggested command is checked locally with a Bash AST preflight analyzer (internal/permissions/preflight.go). The analyzer can raise a command's danger rating to medium or high (for example for rm -rf, git reset --hard, kubectl delete, or piped curl ... | sh), and never lowers a rating set by the model.
When a suggested command is rated medium or high:
- Pressing Enter on an empty input box arms a confirmation prompt that lasts 5 seconds. Press Enter again within 5 seconds to execute, or type any character or press Esc to disarm.
- Pressing
son an empty input box runs the command inside an ephemeral dry-run sandbox and prints the exit code, modified files, and output in the conversation before you decide whether to run it for real.
Fixing failed commands¶
When shell integration is active, asksh records the commands you run and their exit codes. If your last command failed, diagnose and fix it with:
Inside an open TUI session, run /fix (optionally followed by extra context, such as /fix why did the linker fail?). asksh looks up the most recent failed shell event scoped to your current repository (or directory outside a repository).
Multi-step plans¶
For complex tasks, the model can propose a structured plan (propose_plan) listing ordered steps with optional verification (verify_command) and rollback (rollback_command) commands.
In the plan review view:
- Press Up / Down (or
k/j) to move between steps. - Press Space to toggle skipping the selected pending step.
- Press Enter to run the selected pending step (or the next pending step). If a step succeeds and has a
verify_command,askshruns the check automatically. - Press Esc to discard the plan.
Reviewing and reverting file edits¶
When asksh modifies local files with edit_file or write_file (overwrite), it snapshots the original file bytes once per session in ~/.local/share/asksh/snapshots/<session-id>/.
Inside the TUI:
/diff [path]prints unified diffs for modified files in the current session./undo [path]restores one file or all snapshotted files from the current session.
From the CLI, use asksh diff [--session id] and asksh undo [--session id] [--file path]. Snapshots cover local overwrites and edits only; newly created files and remote target edits are not snapshotted.
Session continuation and history¶
By default, interactive runs resume the most recent unarchived session in the same repository (or working directory) if it was updated within session_continue (default 1h). A notice at startup tells you how long ago the session was active and reminds you that /new starts a clean session.
Useful session commands:
- In the TUI:
/new,/sessions,/resume [id],/fork,/export [md|sh], and/cost. - On the CLI:
asksh sessions,asksh search <query>,asksh export <id>, andasksh stats. See sessions reference.