Class LocalFilesystemSpec
java.lang.Object
io.agentscope.harness.agent.filesystem.spec.LocalFilesystemSpec
Specification for the local filesystem mode (with shell execution).
This spec produces a LocalFilesystemWithShell whose root is the agent workspace and
whose shell runs directly on the host as sh -c <command>. Long-term memory
(MEMORY.md, memory/) and session logs live on the same local disk.
Suitable for single-process deployments (personal assistants, CLI tools, local dev loops) where distributed sharing is not required and the agent is trusted to run host shell commands.
For distributed deployments where long-term memory must be shared across replicas, prefer
RemoteFilesystemSpec (no shell) or a sandbox filesystem spec (shell via sandbox).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadditionalRoots(Collection<Path> roots) Replaces the list of extra host directories.Adds an extra host directory the agent is allowed to access by absolute path underLocalFsMode.ROOTED.Adds an environment variable that will be set for every shell command.executeTimeoutSeconds(int seconds) Sets the default command execution timeout in seconds.Snapshot of configured extra roots.Returns the configured isolation scope, ornullto use the default.getMode()Currently configured path-resolution policy mode.Project root explicitly configured, ornullto fall back to${user.dir}.inheritEnv(boolean inherit) Controls whether the parent process environment is inherited by shell commands.isolationScope(IsolationScope scope) Sets the isolation scope controlling how file paths are namespaced per user, session, or agent.booleanReturns whether project-writable mode is enabled.maxOutputBytes(int bytes) Sets the maximum number of output bytes captured from any single shell command.mode(LocalFsMode mode) Sets the path-resolution policy for the upperLocalFilesystemWithShell.Sets the user project root used as the lower layer of the resultingOverlayFilesystem.projectWritable(boolean writable) Enables or disables project-writable mode.sharedLocalWorkspace(boolean shared) Enables or disables the shared workspace root for non-routed paths; see the field javadoc.toFilesystem(Path workspace, NamespaceFactory localNamespaceFactory) virtualMode(boolean virtual) Deprecated.
-
Constructor Details
-
LocalFilesystemSpec
public LocalFilesystemSpec()
-
-
Method Details
-
executeTimeoutSeconds
Sets the default command execution timeout in seconds.- Parameters:
seconds- timeout (must be positive)- Returns:
- this spec
-
maxOutputBytes
Sets the maximum number of output bytes captured from any single shell command.- Parameters:
bytes- byte cap (must be positive)- Returns:
- this spec
-
env
Adds an environment variable that will be set for every shell command.- Parameters:
name- variable namevalue- variable value- Returns:
- this spec
-
inheritEnv
Controls whether the parent process environment is inherited by shell commands. Whenfalse(default), only variables added viaenv(String, String)are visible.- Parameters:
inherit- whether to inherit parent env- Returns:
- this spec
-
virtualMode
Deprecated.usemode(LocalFsMode)for the full three-way selectionLegacy:truemaps toLocalFsMode.SANDBOXED,falsetoLocalFsMode.UNRESTRICTED. Prefermode(LocalFsMode)soLocalFsMode.ROOTEDis also reachable.- Parameters:
virtual- whether to enable virtual mode- Returns:
- this spec
-
mode
Sets the path-resolution policy for the upperLocalFilesystemWithShell. Defaults toLocalFsMode.ROOTED.- Parameters:
mode- policy mode- Returns:
- this spec
-
isolationScope
Sets the isolation scope controlling how file paths are namespaced per user, session, or agent. Defaults toIsolationScope.USER(consistent withRemoteFilesystemSpecand sandbox specs).- Parameters:
scope- isolation scope- Returns:
- this spec
-
getIsolationScope
Returns the configured isolation scope, ornullto use the default. -
addRoot
Adds an extra host directory the agent is allowed to access by absolute path underLocalFsMode.ROOTED.nullentries are ignored.- Parameters:
root- extra root to allow- Returns:
- this spec
-
projectWritable
Enables or disables project-writable mode. Whentrue, the agent's file-write operations for non-workspace paths are routed to the project directory.- Parameters:
writable- whether non-workspace writes go to the project directory- Returns:
- this spec
-
isProjectWritable
public boolean isProjectWritable()Returns whether project-writable mode is enabled. -
additionalRoots
Replaces the list of extra host directories. SeeaddRoot(Path).- Parameters:
roots- extra roots (nullclears)- Returns:
- this spec
-
project
Sets the user project root used as the lower layer of the resultingOverlayFilesystem. Reads ofAGENTS.md,knowledge/,skills/etc. fall back to this directory when the agentworkspacedoes not contain them; shellexecute()runs withpwdset to this directory.Defaults to
System.getProperty("user.dir")when not set.- Parameters:
project- project root path- Returns:
- this spec
-
getProject
Project root explicitly configured, ornullto fall back to${user.dir}. -
getMode
Currently configured path-resolution policy mode. -
getAdditionalRoots
Snapshot of configured extra roots. -
toFilesystem
-
mode(LocalFsMode)for the full three-way selection