Skip to content

Expose stable home env vars to tools - #101

Draft
k2v7n24cbf-cyber wants to merge 2 commits into
sandydasari:mainfrom
k2v7n24cbf-cyber:agent/shell-process-home-env
Draft

Expose stable home env vars to tools#101
k2v7n24cbf-cyber wants to merge 2 commits into
sandydasari:mainfrom
k2v7n24cbf-cyber:agent/shell-process-home-env

Conversation

@k2v7n24cbf-cyber

Copy link
Copy Markdown

What changed

This adds stable path environment variables for tool commands:

  • WORKSPACE_HOME points to the active agent workspace directory.
  • AGENT_HOME points to the parent directory of that workspace.
  • shell receives these variables in both persistent shell sessions and non-persistent fallback execution.
  • process start receives these variables for spawned background commands.
  • The workspace section in the system prompt documents the variables so agents can use them directly.

process run is 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_HOME and AGENT_HOME makes 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.txt or $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.ts
  • pnpm --filter @openacme/tools build
  • pnpm --filter @openacme/agent-core test -- prompt.test.ts
  • pnpm --filter @openacme/agent-core... build
  • Commit hook: repo check-types and tests passed
  • Push hook: full build and server e2e passed

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant