← Back to PRs

#2884: fix: Create memory directory and symlink identity files during workspace setup

by webdevtodayjason open 2026-01-27 17:26 View on GitHub →
agents
## Summary - Creates `memory/` directory during workspace setup when `ensureBootstrapFiles` is true - Symlinks identity files (SOUL.md, USER.md, AGENTS.md, IDENTITY.md) into `memory/` so they are indexed by memory search - Gracefully handles symlink failures on Windows and preserves existing files ## Problem The memory search system looks for files in `~/clawd/memory/` but workspace setup only created identity files at the workspace root. This caused: - `clawdbot memory status` to report "no memory files found" - The AI to incorrectly claim "I have no memories" despite having identity files - Users having to manually create the `memory/` directory and copy/symlink files ## Solution During `ensureAgentWorkspace()` with `ensureBootstrapFiles: true`: 1. Create `memory/` subdirectory 2. Symlink identity files into it so memory search can index them 3. Skip if files already exist (preserves user customizations) 4. Gracefully handle symlink failures (e.g., Windows without privileges) ## Test plan - [x] Added unit tests for memory directory creation - [x] Added test for symlink creation - [x] Added test for not overwriting existing files - [x] All 6 workspace tests pass - [x] Lint passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates workspace bootstrapping (`src/agents/workspace.ts`) to create a `memory/` subdirectory during `ensureAgentWorkspace({ ensureBootstrapFiles: true })` and attempts to symlink the identity/bootstrap files (SOUL/USER/AGENTS/IDENTITY) into that directory so the memory search subsystem can index them. It also adds unit coverage in `src/agents/workspace.test.ts` for directory creation, symlink creation, and non-overwrite behavior. Overall, the change aligns workspace setup with other parts of the codebase (e.g., the memory CLI and internal scanner) which look for `memory/` under the workspace directory. The main risks are around cross-platform symlink behavior and the fact that the new `memory/` directory is created unconditionally whenever `ensureBootstrapFiles` is enabled. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but has cross-platform test fragility and some silent-failure behavior worth addressing. - Core logic is straightforward (mkdir + best-effort symlinks) and scoped to workspace bootstrapping, but the new tests assume symlinks always work and the implementation suppresses all symlink-related errors, which can hide real failures and cause CI issues on Windows or restricted environments. - src/agents/workspace.test.ts (symlink assertions on Windows), src/agents/workspace.ts (error swallowing / unconditional mkdir behavior) <!-- greptile_other_comments_section --> <sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs