fix(tools): allow read_file to access CLI workspaces directory (#122)

- Add ~/.goclaw/cli-workspaces/ to read_file allowed paths
- Enables agents to read working files from CLI workspace sessions

Co-authored-by: Nam Nguyen Ngoc <namnn.0911@gmail.com>
This commit is contained in:
Nam Nguyen NgocandNam Nguyen Ngoc authored and GitHub committed 2026-03-10 20:58:10 +07:00
1 parent 33e75820e3
commit 9a0557c7a3
1 file changed
+3 -1
+3 -1
View File
@@ -510,14 +510,16 @@ func runGateway() {
toolsReg.Register(tools.NewMessageTool())
slog.Info("session + message tools registered")
// Allow read_file to access skills directories (outside workspace).
// Allow read_file to access skills directories and CLI workspaces (outside workspace).
// Skills can live in ~/.goclaw/skills/, ~/.agents/skills/, ~/.goclaw/skills-store/, etc.
// CLI workspaces live in ~/.goclaw/cli-workspaces/ (agent working files).
homeDir, _ := os.UserHomeDir()
if readTool, ok := toolsReg.Get("read_file"); ok {
if pa, ok := readTool.(tools.PathAllowable); ok {
pa.AllowPaths(globalSkillsDir)
if homeDir != "" {
pa.AllowPaths(filepath.Join(homeDir, ".agents", "skills"))
pa.AllowPaths(filepath.Join(homeDir, ".goclaw", "cli-workspaces"))
}
// Also allow the skills store directory (uploaded skill content).
if pgStores.Skills != nil {