Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Fix directory filter to resolve relative paths and symlinks

Cursor Agent27d2f799bfec
diff --git a/cli/beacon/internal/handoff/session.go b/cli/beacon/internal/handoff/session.go
index e2a23128..c625f25d 100644
--- a/cli/beacon/internal/handoff/session.go
+++ b/cli/beacon/internal/handoff/session.go
@@ -159,6 +159,17 @@ func withinDirectory(dir, root string) bool {
}
dir = filepath.Clean(dir)
root = filepath.Clean(root)
+ if !filepath.IsAbs(root) {
+ if abs, err := filepath.Abs(root); err == nil {
+ root = abs
+ }
+ }
+ if resolved, err := filepath.EvalSymlinks(root); err == nil {
+ root = resolved
+ }
+ if resolved, err := filepath.EvalSymlinks(dir); err == nil {
+ dir = resolved
+ }
if dir == root {
return true
}