Expose stable home env vars to tools - #101
Draft
k2v7n24cbf-cyber wants to merge 2 commits into
Draft
Conversation
k2v7n24cbf-cyber
added a commit
to k2v7n24cbf-cyber/openacme
that referenced
this pull request
Jul 22, 2026
Merge staged copy of sandydasari#101 into local-stage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This adds stable path environment variables for tool commands:
WORKSPACE_HOMEpoints to the active agent workspace directory.AGENT_HOMEpoints to the parent directory of that workspace.shellreceives these variables in both persistent shell sessions and non-persistent fallback execution.process startreceives these variables for spawned background commands.process runis intentionally handled in the separate process-run PR so this PR stays focused on the remaining shell/current-process tool coverage.Observation
In deployed agent sessions, agents repeatedly spend turns trying to rediscover their current workspace or agent folder path before doing file work. Common patterns include running commands such as
pwd, listing parent directories, or deriving the parent of the workspace manually before writing or reading files.Those path-discovery turns are low-information but still expensive: every additional turn carries the accumulated conversation context again, so even simple path lookup round trips increase total turn count and token usage.
Root cause
The platform already knows the active workspace directory through tool call context, but that path is only implicit: tools default to the workspace as cwd, while shell commands and background processes do not get a stable, named path anchor. Agents therefore infer the path from the current directory at runtime instead of addressing it directly.
Providing
WORKSPACE_HOMEandAGENT_HOMEmakes the platform-owned path contract explicit inside the same execution environment where agents perform file and shell work.Impact
Agents can use stable absolute references like
$WORKSPACE_HOME/file.txtor$AGENT_HOME/resources/...without spending turns discovering those paths. This should reduce avoidable shell calls, lower turn counts, and make file operations less brittle when commands change directories during a session.Validation
pnpm --filter @openacme/tools test -- workspace-cwd.test.tspnpm --filter @openacme/tools buildpnpm --filter @openacme/agent-core test -- prompt.test.tspnpm --filter @openacme/agent-core... buildcheck-typesand tests passed