Exec tool should use workspace path as cwd, not process cwd #174

Closed
opened 2026-02-28 05:36:23 +00:00 by Zeus · 0 comments
Collaborator

Problem

The tools plugin sets its base directory to Path.cwd() (line 125 in tools/plugin.py):

self._base_dir: Path = Path.cwd()

This means when the agent runs shell commands, they execute in whatever directory cobot was started from (e.g. the cobot source tree), NOT in the agent's workspace.

Impact

When Alpha runs ls, it sees cobot source code instead of its workspace files (AGENTS.md, SOUL.md, memory/, etc.). The agent has no awareness of its actual workspace.

Expected Behavior

The exec tool should resolve its cwd from the workspace plugin:

def configure(self, config):
    workspace = self._registry.get_plugin("workspace")
    self._base_dir = workspace.get_path() if workspace else Path.cwd()

This way, regardless of where cobot is started (/home/alpha/workspace/cobot, /tmp, anywhere), the agent always operates in its workspace directory.

Context

Discovered during clean workspace testing. The workspace plugin correctly creates ~/.cobot/workspace/ with template files, but the agent never sees them because exec runs in the process cwd (/home/alpha/workspace/cobot).

## Problem The tools plugin sets its base directory to `Path.cwd()` (line 125 in `tools/plugin.py`): ```python self._base_dir: Path = Path.cwd() ``` This means when the agent runs shell commands, they execute in whatever directory cobot was started from (e.g. the cobot source tree), NOT in the agent's workspace. ## Impact When Alpha runs `ls`, it sees cobot source code instead of its workspace files (AGENTS.md, SOUL.md, memory/, etc.). The agent has no awareness of its actual workspace. ## Expected Behavior The exec tool should resolve its cwd from the workspace plugin: ```python def configure(self, config): workspace = self._registry.get_plugin("workspace") self._base_dir = workspace.get_path() if workspace else Path.cwd() ``` This way, regardless of where cobot is started (`/home/alpha/workspace/cobot`, `/tmp`, anywhere), the agent always operates in its workspace directory. ## Context Discovered during clean workspace testing. The workspace plugin correctly creates `~/.cobot/workspace/` with template files, but the agent never sees them because exec runs in the process cwd (`/home/alpha/workspace/cobot`).
k9ert closed this issue 2026-02-28 05:48:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#174
No description provided.