Summary
Currently, hashline_edit's execute function unconditionally rejects any path whose resolved real path (via realpathSync) doesn't fall within context.directory or context.worktree, using the isWithin boundary check. This applies both to existing files and to new files by checking their parent directory. There's no way for a user/agent to intentionally edit files outside the workspace (e.g. via a config file, and so on in trusted sandboxes).
Motivation
Some legitimate workflows require editing files outside the immediate project worktree — e.g., a ~/.config file, a monorepo sibling package not included in the worktree, or a shared library the agent has explicit permission to touch. Currently, all of these fail with Access denied: "<path>" resolves outside the project directory.
Proposed Solution
Add a new opt-in config flag, e.g., allowOutsideWorkspace: boolean (default false), to HashlineConfig. This would be threaded through resolveConfig and createHashlineEditTool(config, cache), similar to how other settings like maxFileSize and exclude are already resolved and passed.
When config.allowOutsideWorkspace === true, the isWithin check in execute would be bypassed (or simply short-circuited to true), while still preserving:
Acceptance Criteria
Security Considerations
This is an explicit trust escalation — documentation should clearly warn that enabling this flag allows the AI agent to write to arbitrary filesystem locations reachable by the process, similar in spirit to disabling a sandbox boundary.
Summary
Currently,
hashline_edit'sexecutefunction unconditionally rejects any path whose resolved real path (viarealpathSync) doesn't fall withincontext.directoryorcontext.worktree, using theisWithinboundary check. This applies both to existing files and to new files by checking their parent directory. There's no way for a user/agent to intentionally edit files outside the workspace (e.g. via a config file, and so on in trusted sandboxes).Motivation
Some legitimate workflows require editing files outside the immediate project worktree — e.g., a
~/.configfile, a monorepo sibling package not included in the worktree, or a shared library the agent has explicit permission to touch. Currently, all of these fail withAccess denied: "<path>" resolves outside the project directory.Proposed Solution
Add a new opt-in config flag, e.g.,
allowOutsideWorkspace: boolean(defaultfalse), toHashlineConfig. This would be threaded throughresolveConfigandcreateHashlineEditTool(config, cache), similar to how other settings likemaxFileSizeandexcludeare already resolved and passed.When
config.allowOutsideWorkspace === true, theisWithincheck inexecutewould be bypassed (or simply short-circuited totrue), while still preserving:realpathSyncfor accurate path reporting.maxFileSize) and hash/fileRev integrity checks.Acceptance Criteria
allowOutsideWorkspaceconfig option (defaultfalse, preserving current behavior).hashline_editno longer throwsAccess deniedfor out-of-workspace paths.Security Considerations
This is an explicit trust escalation — documentation should clearly warn that enabling this flag allows the AI agent to write to arbitrary filesystem locations reachable by the process, similar in spirit to disabling a sandbox boundary.