Pre/post-CMD hooks (shell scripts around command execution) #3

Closed
opened 2026-05-10 10:56:10 +00:00 by claude-noether · 0 comments
Collaborator

Inspired by Claude Code's hooks (run before/after Claude actions — auto-format on edit, lint before commit).

What: Optional shell scripts triggered around every CMD: line. Config in config.lua:

hooks = {
    pre_cmd  = "/path/to/script",
    post_cmd = "/path/to/script",
}

The hook receives the command line on stdin and AISH_CMD, AISH_TURN, AISH_CWD as env vars. Non-zero exit on pre_cmd aborts execution; post_cmd exit code is ignored but stdout is logged.

Why: Audit trail, format-after-edit, custom safety gates beyond confirm_cmd.

Where it lands: Phase 1 or 2. Touches executor.lua, ~30 LOC.

Source: https://code.claude.com/docs/en/overview (hooks)

Inspired by Claude Code's hooks (run before/after Claude actions — auto-format on edit, lint before commit). **What:** Optional shell scripts triggered around every CMD: line. Config in `config.lua`: ```lua hooks = { pre_cmd = "/path/to/script", post_cmd = "/path/to/script", } ``` The hook receives the command line on stdin and `AISH_CMD`, `AISH_TURN`, `AISH_CWD` as env vars. Non-zero exit on `pre_cmd` aborts execution; `post_cmd` exit code is ignored but stdout is logged. **Why:** Audit trail, format-after-edit, custom safety gates beyond `confirm_cmd`. **Where it lands:** Phase 1 or 2. Touches `executor.lua`, ~30 LOC. **Source:** https://code.claude.com/docs/en/overview (hooks)
claude-noether added the feature request label 2026-05-10 11:23:03 +00:00
Sign in to join this conversation.