Skip to content

fix(edge-worker): allowlist Claude Code auto-memory dir on session spawn (CYPACK-1253)#1260

Open
cyrusagent wants to merge 4 commits into
mainfrom
cypack-1253
Open

fix(edge-worker): allowlist Claude Code auto-memory dir on session spawn (CYPACK-1253)#1260
cyrusagent wants to merge 4 commits into
mainfrom
cypack-1253

Conversation

@cyrusagent

@cyrusagent cyrusagent commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds Claude Code's default auto-memory directory (~/.claude/projects/<encoded-cwd>/memory/) to the session's additionalDirectories on spawn, so the agent can Read a MEMORY.md it just wrote without hitting <tool_use_error>File is in a directory that is denied by your permission settings.
  • For multi-repo sessions, every repo path the session can switch into contributes its own encoded memory dir (one per repo).
  • New getProjectAutoMemoryDirectory(cwd) helper in cyrus-claude-runner replicates Claude Code's encoding rule (replace / and . with -, with path.resolve for trailing-slash/./.. normalization).
  • The encoded dir is also added to the sandbox filesystem.allowRead set so OS-level sandbox doesn't re-block it.

Closes CYPACK-1253.

Test plan

  • pnpm typecheck clean
  • pnpm lint no new errors (pre-existing warnings only)
  • 6 new unit tests for the path-encoding helper (trailing slash, ., .., dotfile dirs, .cyrus → --cyrus)
  • 3 new tests for RunnerConfigBuilder.buildIssueConfig (single-repo, multi-repo allowlist union, dedupe)
  • All 658 edge-worker tests + 120 claude-runner tests pass
  • Smoke-test in a live session: write a memory file, then re-read by absolute path — Read should succeed without a permission prompt

Notes

  • Worktree-vs-repo-level memory (each worktree gets its own encoded memory dir, so memory in worktree A is invisible from worktree B even for the same repo) is called out as a follow-up scope decision in the parent issue and intentionally not bundled here.

cyrusagent and others added 4 commits May 27, 2026 05:44
…awn (CYPACK-1253)

Adds the SDK's default auto-memory directory
(`~/.claude/projects/<encoded-cwd>/memory/`) to `additionalDirectories` so
sessions can Read memory files they (or a prior session) wrote without
hitting the "directory is denied by your permission settings" error. For
multi-repo sessions, every repo path the session can switch into
contributes its own encoded memory dir.
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.

2 participants