Lesson 15.06 · Phase 15 · Capstone: Your Own Agent Harness

Permissions & sandbox

Every tool call gets a decision before it runs: allow, ask, or deny. The ones that run, run in a box with fewer keys than you have.

Learning objectives

  • Build a permission hook with allow/ask/deny rules matched on the tool name and its main argument, three modes, and a pluggable approver.
  • Handle shell commands properly: every part of a compound command checked, and command substitution never approved automatically.
  • Build a shell tool that runs with a scrubbed environment, the workspace as its directory, a timeout that kills the whole process group, and CPU, memory and file-size limits.
  • Say clearly what this sandbox does not protect against, and when you need a container instead.

The bare loop in 15.01 ran rm -rf ~/ && git push --force because the model asked. Phase 12 built a permission system and a container sandbox as separate pieces. Now they go into the harness, and the details that make them hold up in practice matter:

Loading the full lesson…