Skip to content

Fix #36 private recovery storage for repository memory - #44

Open
jayzeng wants to merge 5 commits into
mainfrom
review/fix-pr36
Open

jayzeng wants to merge 5 commits into
mainfrom
review/fix-pr36

Conversation

@jayzeng

@jayzeng jayzeng commented Sep 21, 2026

Copy link
Copy Markdown
Owner

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.

mkaz and others added 4 commits August 27, 2026 09:16
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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread index.ts
const longTerm = readFileSafe(MEMORY_FILE);
if (longTerm?.trim()) {
for (const paths of pathsInPriorityOrder) {
const longTerm = readFileSafe(paths.memoryFile);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread index.ts
Comment on lines +2400 to +2402
const candidatePaths = params.scope
? [selectedMemoryPaths(params.scope, ctx)]
: [...(repoPaths ? [repoPaths] : []), getUserMemoryPaths()];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@jayzeng
jayzeng changed the base branch from main to review/base-pr36 September 21, 2026 02:06
@jayzeng jayzeng closed this Sep 21, 2026
@jayzeng jayzeng reopened this Sep 21, 2026
@jayzeng
jayzeng changed the base branch from review/base-pr36 to main September 21, 2026 02:13
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