Class RemoteFilesystemSpec
This spec produces a CompositeFilesystem that blends:
- a plain
LocalFilesystem(no shell) for workspace-local, unmanaged files; - per-route
RemoteFilesysteminstances for cross-node paths (memory, skills, subagents, knowledge, sessions, tasks). Each route gets its own store namespace segment to prevent key collisions across routes.
Because the default backend is LocalFilesystem (not LocalFilesystemWithShell),
shell execution is intentionally not available in this mode — use a sandbox filesystem spec or
LocalFilesystemWithShell if shell is required.
Default shared routes (each gets an isolated store namespace segment):
AGENTS.md,MEMORY.md→ segmentrootmemory/→ segmentmemoryskills/→ segmentskillssubagents/→ segmentsubagentsknowledge/→ segmentknowledgeplans/→ segmentplansagents/<agentId>/sessions/→ segmentsessionsagents/<agentId>/tasks/→ segmenttasks
The store namespace for shared files is controlled by isolationScope(IsolationScope),
which mirrors the sandbox isolation semantics:
IsolationScope.SESSION— namespace per sessionIsolationScope.USER(default) — namespace per user, shared across sessionsIsolationScope.AGENT— namespace per agent, shared across all usersIsolationScope.GLOBAL— single global namespace
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a remote filesystem spec that defers store resolution toDistributedStore.baseStore().RemoteFilesystemSpec(BaseStore store) -
Method Summary
Modifier and TypeMethodDescriptionaddSharedPrefix(String prefix) Adds an extra workspace-relative prefix routed to the shared store.anonymousUserId(String userId) Sets the fallback user identifier when runtimeuserIdis absent/blank.booleanhasStore()Returns whether the store has been set (either via constructor or injection).voidinjectStoreIfAbsent(BaseStore store) Injects the store if not already set.isolationScope(IsolationScope scope) Sets the isolation scope that controls the store namespace for shared files.sharedLocalWorkspace(boolean shared) Whentrue, the default backend (everything not routed to a shared prefix) serves the workspace root directly: no per-user namespace prefix and sandboxed path resolution.store()Returns the configuredBaseStore, ornullif not yet set.toFilesystem(Path workspace, String agentId, NamespaceFactory localNamespaceFactory) Builds the composite filesystem described by this spec.workspaceIndex(WorkspaceIndex index) Sets the workspace index for accelerating remote filesystem reads (ls/glob/exists/grep).
-
Constructor Details
-
RemoteFilesystemSpec
public RemoteFilesystemSpec()Creates a remote filesystem spec that defers store resolution toDistributedStore.baseStore().When used with
HarnessAgent.builder().distributedStore(store), the store is injected automatically during build. Without a distributed store, anIllegalStateExceptionis thrown at build time. -
RemoteFilesystemSpec
-
-
Method Details
-
hasStore
public boolean hasStore()Returns whether the store has been set (either via constructor or injection). -
store
Returns the configuredBaseStore, ornullif not yet set.Used by coordination wiring (e.g.
PeriodicGate) when a remote filesystem is present without a fullDistributedStore. -
injectStoreIfAbsent
Injects the store if not already set. Called by the builder during auto-wiring. -
anonymousUserId
Sets the fallback user identifier when runtimeuserIdis absent/blank. -
isolationScope
Sets the isolation scope that controls the store namespace for shared files.Mirrors the sandbox
SandboxContextisolation semantics. Defaults toIsolationScope.USER.- Parameters:
scope- isolation scope- Returns:
- this spec
-
getIsolationScope
-
workspaceIndex
Sets the workspace index for accelerating remote filesystem reads (ls/glob/exists/grep). If not set, the remote filesystem falls back to full store scans. -
toFilesystem
public AbstractFilesystem toFilesystem(Path workspace, String agentId, NamespaceFactory localNamespaceFactory) Builds the composite filesystem described by this spec.- default backend:
LocalFilesystem(no shell), per-user namespaced - shared prefix routes (
memory/,skills/,subagents/,knowledge/,plans/,agents/<id>/sessions/,agents/<id>/tasks/, plus anyaddSharedPrefixextras): wrapped in anOverlayFilesystemwhere the upper layer is theRemoteFilesystem(per-user, persisted in theBaseStore) and the lower layer is a read-onlyLocalFilesystemrooted atworkspace.resolve(<routeDir>). So scaffolded template content under<workspace>/skills/,<workspace>/subagents/, etc. is visible as a baseline; per-user edits land in the remote store via copy-on-write and override the template on subsequent reads. AGENTS.md,MEMORY.md,tools.jsonexact-file routes: wrapped in anOverlayFilesystemwhere the upper is theroot-segmentRemoteFilesystemand the lower is a read-onlyLocalFilesystemrooted at the workspace, so the scaffolded template files at the workspace root are visible as the baseline.CompositeFilesystemdoes not recurse into exact-file routes when listing/globbing the tree; it performs a singleexistscheck against the overlay, which is satisfied by either layer.
- default backend:
-