Conversation
Add repository-local memory alongside user-wide memory, including natural-language scope inference and explicit scope controls. Load both scopes into context, search separate qmd collections together, and report scoped status and recovery data. Update tests and documentation for the new behavior. Closes #33 Signed-off-by: Marcus Kazmierczak <marcus@mkaz.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1958729d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const longTerm = readFileSafe(MEMORY_FILE); | ||
| if (longTerm?.trim()) { | ||
| for (const paths of pathsInPriorityOrder) { | ||
| const longTerm = readFileSafe(paths.memoryFile); |
There was a problem hiding this comment.
Reject symlinked repository memory before injection
When an untrusted checkout contains .pi/agent/memory/MEMORY.md as a symlink outside the repository, this read follows the link during automatic context construction, and before_agent_start subsequently appends the target's contents to the system prompt sent to the model. Because Git preserves symlinks, merely opening such a repository can disclose local files such as SSH keys; canonicalize repository-memory paths and require regular, non-symlink files contained beneath the canonical memory root before reading them.
AGENTS.md reference: AGENTS.md:L10-L10
Useful? React with 👍 / 👎.
| const candidatePaths = params.scope | ||
| ? [selectedMemoryPaths(params.scope, ctx)] | ||
| : [...(repoPaths ? [repoPaths] : []), getUserMemoryPaths()]; |
There was a problem hiding this comment.
Locate repo recovery records independently of current cwd
For repository-scoped deletions, this lookup searches only the recovery directory derived from the current ctx.cwd plus user-scope recovery. If the user changes repositories, renames or moves the repository, or invokes the recovery ID from another working directory, the derived hash changes and memory_restore reports that the durable record is missing even though its JSON still exists. Persist enough repository identity to locate the original target, or search the private recovery/repos directories by the globally unique recovery ID before deciding the record is absent.
Useful? React with 👍 / 👎.
Follow-up to #36. Repository markdown remains git-friendly, but complete recovery payloads now live in user-private recovery storage keyed by repository identity, preventing forgotten content from being committed or retained in Git history.