Skip to content

[upstream PR 935] f<!-- -->ix: scope git worktrees to shared project id #379

@wbugitlab1

Description

@wbugitlab1

Source: Source pull request number: 935 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: fix: scope git worktrees to shared project id
Author: wbugitlab1
State: open
Draft: no
Merged: no
Head: wbugitlab1/agentmemory:fix/worktree-project-scope-wbu @ 7f460bb
Base: main @ f6f9e3c
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-06-14T15:27:02Z
Updated: 2026-06-14T15:54:47Z
Closed: (not closed)
Merged at: (not merged)

Original PR body:

Summary

  • resolve project scope through a canonical git project id instead of raw cwd path
  • make linked worktrees for the same repository share the same git:<hash> project scope
  • preserve explicit AGENTMEMORY_PROJECT_ID / AGENTMEMORY_PROJECT_NAME overrides and non-git basename fallback
  • expose optional project arguments through MCP/REST memory operations

Verification

  • npm test -- test/hook-project.test.ts test/pre-tool-use-project.test.ts test/worktree-project-scope.test.ts test/api-memories-project.test.ts test/mcp-project-scope.test.ts test/mcp-standalone.test.ts test/mcp-standalone-proxy.test.ts test/remember-project-scope.test.ts test/context-injection.test.ts test/copilot-plugin.test.ts passed: 10 files, 97 tests
  • npm run build passed
  • npm run skills:check passed
  • gitleaks detect --source . --log-opts origin/main..HEAD --redact passed: 2 commits scanned, no leaks
  • semgrep scan --config p/default --error --metrics=off $(git diff --name-only origin/main..HEAD) passed: 39 files, 0 findings

Notes

  • This branch rebuilds the same code changes with consistent DCO metadata on both commits.
  • Full npm test previously failed only unrelated test/fs-watcher.test.ts tests outside this PR scope.
  • Vercel may report "Authorization required to deploy"; that is deployment authorization, not a code failure.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added project-scoped memory filtering via a new optional project parameter across tools and APIs.
    • Added AGENTMEMORY_PROJECT_ID / AGENTMEMORY_PROJECT_NAME environment variables for explicit project selection.
    • Added token_budget to memory_recall.
  • Improvements
    • Project IDs and cwd are now normalized consistently across hooks/observations, using deterministic Git-based hashing for stability across worktrees.
  • Documentation
    • Updated configuration and MCP/tool reference documentation for the new options.
  • Tests
    • Added coverage for project scoping, worktrees, and API filtering (including unscoped legacy memories).

Local branch:
Fork PR:
Fork decision:
Verification:
Notes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    decision-candidateFork decision has not been madeupstream-openUpstream pull request is openupstream-prTracks an upstream pull request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions