feat(agentic): scope file/command tools to an agent workspace root #23
Reference in New Issue
Block a user
Delete Branch "feat/agent-tool-workspace-scope"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Scopes the agentic file/command tools to a configurable agent workspace root:
read_file,write_file,list_files,grep— confined to the root subtree by a lexical path check (rejects..,~, and absolute paths outside root; resolves relative paths against root).run_command— executes with cwd set to the root (cd <root> && ( ... )).agent_workspace_root, else envNEURON_AGENT_ROOT.Why
dispatch_toolran every file/command tool with no path scoping —run_command → exec_capture(cmd),write_file → fs_write(path), etc. The agent-workspace feature (Copilot-style, user-chosen folder) needs the agent's file actions to stay inside the chosen folder.⚠️ FLAGGED FOR WILL — please review the design decision
This is defense-in-depth, not a hard boundary, and I want it checked against your intended sandbox/runtime design before merge:
run_commandcan stillcdout of the root. Real confinement needs runtime support (cwd-locked exec /sandbox-exec/ chroot) inel_runtime.c, which is your domain. Is that the right split, or do you want the enforcement to live entirely in the runtime?agent_workspace_rootstate key /NEURON_AGENT_ROOTenv. Aligns with how config should flow?cd <root> && (...)wrapping forrun_command— acceptable as the.el-layer mitigation, or should run_command be runtime-scoped only?Verification status (honest)
elc(darwin arm64), exit 0.elbis unavailable here (wrong arch); same toolchain state that's currently reddening CI atelb: link failed. Needs a soul build + smoke test before merge.🤖 Generated with Claude Code
@will.anderson - review request. Scopes the agentic file/command tools (read_file, write_file, list_files, grep, run_command) to a configurable workspace root (state key agent_workspace_root or env NEURON_AGENT_ROOT). IMPORTANT: this is a lexical .el guard, defense-in-depth, NOT a hard boundary - no symlink resolution, and an arbitrary shell command can still cd out of the root. Your design call: (1) keep enforcement at the .el layer vs. move it into el_runtime.c (cwd-locked exec / sandbox-exec) which is your domain; (2) default-allow-when-unset (current, backward-compatible) vs. default-deny; (3) config source. Compile-checked with elc (exit 0); NOT link/run-gated locally (darwin elb is wrong-arch here) - needs your build + smoke test before merge.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.