fix: PreToolUse guard — allow formula agents to access FACTORY_ROOT from worktrees (#487)
- Add session name as third arg to guard hook (passed from agent-session.sh) - Detect formula sessions (supervisor-*, gardener-*, planner-*, predictor-*) - Guard 6: block filesystem access to factory root from worktrees, exempt formulas - Guard 7: restrict system commands (kill, docker, tmux) to supervisor only - Guard 2: allow formula agents rm -rf within factory root Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e050f79153
commit
f6dd91389f
2 changed files with 56 additions and 3 deletions
|
|
@ -165,7 +165,7 @@ create_agent_session() {
|
|||
if [ -x "$guard_hook_script" ]; then
|
||||
local abs_workdir
|
||||
abs_workdir=$(cd "$workdir" 2>/dev/null && pwd) || abs_workdir="$workdir"
|
||||
local guard_hook_cmd="${guard_hook_script} ${PRIMARY_BRANCH:-main} ${abs_workdir}"
|
||||
local guard_hook_cmd="${guard_hook_script} ${PRIMARY_BRANCH:-main} ${abs_workdir} ${session}"
|
||||
if [ -f "$settings" ]; then
|
||||
jq --arg cmd "$guard_hook_cmd" '
|
||||
if (.hooks.PreToolUse // [] | any(.[]; .hooks[]?.command == $cmd))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue