ela
Contents

ManualAgents

The hook

In the terminalela --spec the-hook

The hook keeps Claude Code's Bash tool on ela. It refuses a command that is not ela, and its reason holds the ela that does the job, ready to run:

ela --agent hook: this shell runs ela, and the command is bash: run it as ela, as below ela <<'EOF'cd sitemake ci 2>&1 | tail -3EOFela --lint - checks it before it runs; ela --agent prints the guide.

ela --agent --hooks [folder] writes <folder>/.claude/settings.json with a hook that sends every command of the Bash tool through ela --agent hook:

{  "hooks": {    "PreToolUse": [      {        "matcher": "Bash",        "hooks": [          {            "type": "command",            "command": "ela --agent hook"          }        ]      }    ]  }}

A settings file that is there already is never edited. ela prints the hook to merge into it by hand, says so and exits 1.

How the hook decides:

  • Before each Bash call, Claude Code hands the hook the call as JSON on stdin: its command in tool_input.command and its folder in cwd.
  • The hook reads the command with the parsers of bash and of ela.
  • A command that is ela throughout, each of its commands an ela with no bash around it, goes through with nothing printed. The agent's own permissions then decide on it.
  • Any other command is refused. The hook prints permissionDecision deny and a reason, which the agent reads.
  • A call of another tool goes through. So does one the hook can't read as JSON, with a line on stderr that says so: a fault in the hook's input never stops a session.

What a refusal holds:

  • bash: ela --translate bash's translation of it. A line the translation leaves for hand stays a # bash: comment in the script, and its message follows the script: line 1: bash's shopt has no ela form: rewrite it by hand.
  • python -c, perl -e, awk and jq: the script that does their job, with the procs named: json.decode for jq, str.fields for awk '{print $2}', re.replace for perl -pi -e 's/a/b/g'. The script uses the input the command names.
  • A job with no ela form, such as Python that imports neither json, yaml, csv nor re: a plain refusal.