Skip to content

feat(harness): add projectWorkspace for filesystem tools#1348

Open
kongweiguang wants to merge 4 commits into
agentscope-ai:harnessfrom
kongweiguang:harness
Open

feat(harness): add projectWorkspace for filesystem tools#1348
kongweiguang wants to merge 4 commits into
agentscope-ai:harnessfrom
kongweiguang:harness

Conversation

@kongweiguang
Copy link
Copy Markdown

AgentScope-Java Version

1.0.12-harness-SNAPSHOT

Description

This PR adds a code-level way to separate the Harness agent workspace from the project directory exposed to built-in filesystem tools.

Background:

  • workspace(...) is currently used for Harness state such as AGENTS.md, memory, sessions, skills, and workspace context.
  • The default local filesystem also applies the runtime userId namespace, so file tool paths may resolve under workspace/{userId}/....
  • For CLI-like or office/document assistant use cases, the agent state directory and the actual project/document directory often need to be different.

Changes:

  • Added projectWorkspace(Path) to HarnessAgent.Builder.
  • When projectWorkspace is configured, built-in file tools such as read_file, write_file, edit_file, list_files, grep_files, and glob_files operate on that directory.
  • projectWorkspace uses a virtual LocalFilesystem rooted at the configured project path, without applying the per-user namespace.
  • Existing behavior is preserved when projectWorkspace is not configured.
  • workspace(...) continues to manage Harness state and workspace context.

How to test:

  • Run focused compile:
mvn -pl agentscope-examples/harness-example -am compile -DskipTests

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 6, 2026

CLA assistant check
All committers have signed the CLA.

@LearningGp
Copy link
Copy Markdown
Collaborator

image

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...java/io/agentscope/harness/agent/HarnessAgent.java 83.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@LearningGp
Copy link
Copy Markdown
Collaborator

PTAL @chickenlj

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.

3 participants