Dedicated jailed actions directory separate from internal workspace
Summary
Coding and shell tools today treat config.workspace_dir (~/.openhuman/users/<user_id>/workspace/) as the agent's working directory. That path is also where the core stores internal product state — memory DBs, sessions, skills, vault, approval store, transcripts, agent prompts, and more. Agent file/shell actions therefore run in the same tree as config and persistence, which is risky, confusing, and hard to reason about for users and security review.
We should introduce a dedicated actions directory (coding, clones, shell scripts, artifacts) that is jailed by default, and reserve workspace/ for internal OpenHuman state only.
Problem
Who it hurts: Anyone using code_executor, filesystem tools (file_read / file_write / edit / apply_patch / grep / git_operations), shell / node_exec / npm_exec, codegraph_*, or agents prompted to "work in the workspace."
Layout today (authenticated user):
| Path | Role |
|---|---|
~/.openhuman/users/<user_id>/ |
User-scoped config dir (config.toml, credentials, encryption, etc.) — resolved as openhuman_dir |
~/.openhuman/users/<user_id>/workspace/ |
Config.workspace_dir — single bucket for everything |
What already lives under workspace/ (non-exhaustive):
memory/,memory_tree/— conversation + chunk storessessions/,session_raw/— agent transcriptsvault/,approval/,subconscious/,task_sources/,mcp_clients/skills/,codegraph/,agent/prompts/,PROFILE.md,MEMORY.md- Downloads / curl dest subdirs, screenshots, workflow markers (
.openhuman/)
How tools use it:
SecurityPolicyresolves relative paths againstworkspace_dirand enforcesworkspace_only+trusted_roots(src/openhuman/security/policy.rs).shellexecutes with CWD =security.workspace_dir(src/openhuman/tools/impl/system/shell.rs).- Filesystem tools join paths to
workspace_dir(file_write,edit_file,git_operations, etc.). code_executorand other coding agents are documented/prompted to operate in a "sandboxed" environment but inherit the same root.
Partial mitigation that does not solve the model:
~/OpenHuman/projects(OPENHUMAN_PROJECTS_DIR,default_projects_dir()) is injected as a trusted root at startup (channels/runtime/startup.rs) — visible user projects live there.cwd_jail(src/openhuman/cwd_jail/) can OS-jail spawned children, but it is a separate layer from the logical workspace root most tools use today.
Why this is a problem:
- Safety — A mistaken
rm -rf, broadgit clean, or runaway script can touch OpenHuman's own databases and session files, not just a clone. - Clarity — Users cannot see a clean "where my code lives" vs "where the app stores state."
- Policy —
workspace_onlyis supposed to contain agents; containing the app's memory vault inside that same jail defeats the purpose. - Onboarding — Docs already describe
~/OpenHuman/projectsas the coding home (CLAUDE.md/default_projects_dir), but the default tool CWD still points at the internal workspace unless autonomy grants or prompts steer elsewhere.
Solution (optional)
Target layout
~/.openhuman/users/<user_id>/
config.toml # config dir (unchanged)
workspace/ # INTERNAL ONLY — memory, sessions, skills, vault, …
actions/ # NEW — default jail root for coding + shell (or name TBD)
projects/ # optional mirror of ~/OpenHuman/projects semantics
scratch/ # ephemeral agent output
Alternative: keep workspace/ internal and default all shell/file tools to default_projects_dir() (~/OpenHuman/projects) with cwd_jail mandatory — but still need a distinct path under the user tree for E2E / multi-tenant consistency.
Behaviour changes
- Config — Add
actions_dir(oragent_sandbox_dir) toConfig/ autonomy schema, defaulting touser_dir.join("actions")(created at init). Document vsOPENHUMAN_PROJECTS_DIR. - Tool routing — Filesystem + shell + git + codegraph tools use
actions_diras default CWD and relative-path root; reads of internal state (memory RPC, session resume) continue to useworkspace_dironly through dedicated domains — not viafile_read("memory/...")from agents unless explicitly allowlisted. - Agents — Update
code_executor,tool_maker, and coding-harness prompts to reference the actions root; orchestrator delegates with explicit working directory when spawning repo work. - Jail by default — Wire
cwd_jail::spawnforshell/node_exec/npm_execwithJail::new(actions_dir, …)on supported platforms; noop backend with strict path policy elsewhere. - SecurityPolicy — Split concepts:
internal_workspace_dir— read/write for core domains only (not exposed as generic agent write root).actions_dir— agent read/write withworkspace_onlysemantics scoped here.- Retain
trusted_rootsfor user-visible~/OpenHuman/projects.
- Migration — One-time move or symlink policy for existing user trees; marker file to avoid re-running; E2E uses isolated
OPENHUMAN_WORKSPACEtemp dirs (already supported).
Non-goals (initial cut)
- Moving every internal store out of
workspace/in one PR (can be phased: stop new tool writes intoworkspace/first). - Replacing Landlock/Seatbelt with a new sandbox product — use existing
cwd_jail+ policy.
Acceptance criteria
- [ ] Separate roots — Config exposes a distinct actions/sandbox path; coding/shell tools default to it, not
users/<id>/workspace/. - [ ] Internal state protected — Agent
file_write/shellcannot create or delete undermemory/,vault/,sessions/, etc., without an explicit break-glass allowlist (ideally none in v1). - [ ] Jailed execution — Shell-family tools run inside
cwd_jail(or documented noop + path hardening on unsupported OS) with root = actions dir. - [ ] Projects alignment —
~/OpenHuman/projects(trusted root) and per-useractions/relationship is documented; Settings → Agent access reflects both. - [ ] Agent prompts —
code_executor(and related) prompts reference the actions directory, not "the workspace" for clones/builds. - [ ] Tests — Rust tests: path policy blocks writes to
workspace/memory/from tools rooted at actions; shell CWD assertion. JSON-RPC or harness E2E: runshellwithpwdand assert actions path. - [ ] Migration — Existing installs get a safe default (create
actions/, no data loss inworkspace/). - [ ] Diff coverage ≥ 80% — implementing PR meets the changed-lines coverage gate.
Related
- User dir resolution:
src/openhuman/config/schema/load.rs(users/<id>/workspace) - Security policy:
src/openhuman/security/policy.rs - Shell CWD:
src/openhuman/tools/impl/system/shell.rs - OS jail:
src/openhuman/cwd_jail/ - Projects trusted root:
default_projects_dir(),channels/runtime/startup.rs - Agent access UI:
app/src/components/settings/panels/AgentAccessPanel.tsx
Audit of merged PR #3074 against this issue's 8 acceptance criteria:
| # | Criterion | Verdict |
|---|---|---|
| 1 | Separate roots | MET — Config.action_dir defaults to ~/OpenHuman/projects; all acting tools resolve CWD there (shell.rs:237, node_exec.rs:233, file_write.rs:72, etc.) |
| 2 | Internal state protected | MET — SecurityPolicy::is_workspace_internal_path() (policy.rs:1097-1132) blocks 16 dirs + 7 secret files, fail-closed via is_path_string_allowed() |
| 3 | Jailed execution | PARTIAL — cwd_jail:: not invoked from any tool (zero hits under src/openhuman/tools/); path-hardening fallback only, undocumented |
| 4 | Projects alignment | PARTIAL — AgentAccessPanel.tsx:322-363 shows the split but hard-codes path strings (ignores OPENHUMAN_ACTION_DIR); CLAUDE.md not updated |
| 5 | Agent prompts | NOT MET — zero prompt files changed in PR #3074; code_executor/prompt.md still says generic "sandboxed environment" |
| 6 | Tests | PARTIAL — policy_tests.rs:2465-2540 covers path policy, but no shell pwd-asserts-action_dir test and no JSON-RPC E2E entry |
| 7 | Migration | MET — startup create_dir_all(action_dir), no workspace/ move, no data loss |
| 8 | Diff coverage ≥ 80% | MET — Coverage Gate job 78894464975 passed |
Net: 4 MET, 3 PARTIAL, 1 NOT MET. Filed six follow-ups to close the gaps:
- #3235 — Wire
cwd_jailinto shell, node_exec, and npm_exec tools (criterion 3) - #3236 — Update coding-agent prompts to reference action sandbox (criterion 5)
- #3237 —
AgentAccessPanelshould display liveaction_dir/workspace_dirvia RPC (criterion 4) - #3238 — Add
pwd-asserts-action_dirtest for shell-family tools (criterion 6) - #3239 — Document action sandbox vs internal-workspace split in
CLAUDE.md(criterion 4) - #3240 — Make
action_direditable in Settings UI (beyond strict criteria but called out in PR #3074 body)
Leaving this issue open until the criterion-3 / criterion-5 gaps are closed; the rest are quality-of-life and documentation follow-ups.
https://github.com/tinyhumansai- - [ ] /openhuman/pull/3194**[]# # ()**
All six follow-ups from the 2026-06-02 audit are now closed:
| # | Title | Closed |
|---|---|---|
| #3235 | Wire cwd_jail into shell, node_exec, npm_exec (criterion 3) |
2026-06-04 |
| #3236 | Update coding-agent prompts to reference action sandbox (criterion 5) | 2026-06-03 |
| #3237 | AgentAccessPanel shows live action_dir / workspace_dir via RPC (criterion 4) |
2026-06-03 |
| #3238 | pwd-asserts-action_dir test for shell-family tools (criterion 6) |
2026-06-03 |
| #3239 | Document action sandbox vs internal-workspace split in CLAUDE.md (criterion 4) |
2026-06-02 |
| #3240 | Make action_dir editable in Settings UI |
2026-06-04 |
Both gating criteria (3 and 5) are resolved. Closing as completed.