Skip to content

feat(memory): restore read-only file controls - #3616

Open
sarahwooders wants to merge 2 commits into
mainfrom
letta/restore-memory-read-only-7db6b057
Open

feat(memory): restore read-only file controls#3616
sarahwooders wants to merge 2 commits into
mainfrom
letta/restore-memory-read-only-7db6b057

Conversation

@sarahwooders

Copy link
Copy Markdown
Contributor

Summary

  • restore pre-commit protection for memory files marked read_only: true, including edits, deletion, and renames
  • add letta memory read-only <path> <true|false> as the narrow authorized path for toggling the protected field
  • force every agent invocation of that command through an unpersistable alwaysAsk permission decision
  • preserve existing frontmatter/body formatting and reject unsafe or out-of-scope paths

Validation

  • bun test src/cli/subcommands/memory-read-only.spec.ts src/agent/memory-git.precommit.*.ts src/permissions/permissions-checker.*.ts src/permissions/permissions-mode.*.ts
  • bun test src/tools/memory-tool.*.ts src/tools/memory-apply-patch.*.ts
  • bun run check

Generated with Letta Code

Protect read-only memory from edits, deletion, and renames while providing an explicitly approved CLI path for user-controlled toggles.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Remove bespoke Git plumbing and fold hook coverage into the existing pre-commit suite so the restoration stays focused on read-only behavior.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
const command = extractShellCommand(toolArgs);
if (
!command ||
/(?:^|[\s;&|'"])(?:[^\s;&|]*\/)?letta(?:\.js)?['"]?\s+(?:memory|memfs)\s+read-only(?:\s|$)/.exec(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The alwaysAsk gate only matches letta memory read-only in the command string, but the pre-commit hook bypass is the env var LETTA_APPROVED_READ_ONLY_CHANGE=1. An agent in unrestricted mode can edit a read-only file then run LETTA_APPROVED_READ_ONLY_CHANGE=1 git commit -m "..." to bypass both this permission check and the pre-commit hook.

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