Skip to content

fix: make PawWork memory silent and automatic - #527

Merged
Astro-Han merged 4 commits into
devfrom
codex/i526-memory-v1
May 10, 2026
Merged

fix: make PawWork memory silent and automatic#527
Astro-Han merged 4 commits into
devfrom
codex/i526-memory-v1

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Removed the session-end memory confirmation panel and its proposal accept API.
  • Kept Memory Settings as the user control surface for raw edit, reset, and enable/disable.
  • Simplified Archive to freeform markdown while preserving Profile as the only section injected at session start.
  • Updated the system prompt so agents maintain MEMORY.md silently, grep/read Archive only on demand, and avoid writing sensitive data.

Why

Issue #526 redefines PawWork Memory v1 as silent, AI-maintained local memory. The old SessionMemoryReview flow asked the user whether to save memory at session idle, which is the wrong product behavior: memory should not interrupt the user with a confirmation surface.

Related Issue

Closes #526

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

  • packages/opencode/src/session/prompt.ts: memory instructions must stay lean and match the v1 product boundary.
  • packages/opencode/src/memory/*: Profile remains the startup-injected section, while Archive accepts freeform markdown and no longer safe-modes on metadata.
  • packages/app/e2e/settings/settings-memory.spec.ts: old confirmation UI coverage was replaced with absence coverage.

Risk Notes

  • This removes the only explicit session-end proposal accept path. Automatic AI maintenance is currently prompt-driven through MEMORY.md, not a new UI or structured write protocol.
  • Archive is no longer structured by enforced metadata. Existing structured entries remain readable as ordinary markdown.
  • SDK generated files changed because /memory/review-state and /memory/proposal/accept were removed.
  • Spec accepted a v1 soft disable constraint. The implementation is stricter at prompt-injection time: when memory is disabled, the <pawwork-memory> block is not injected, so the assistant is not given memory read/write instructions.

How To Verify

Memory tests: bun --cwd packages/opencode test test/memory/pawwork-memory.test.ts -> 15 pass, 0 fail
App unit tests: bun --cwd packages/app test:unit -- src/shell-frame-contract.test.ts src/components/settings-memory.test.ts -> 1043 pass, 0 fail
Settings memory E2E: bun --cwd packages/app test:e2e -- e2e/settings/settings-memory.spec.ts -> 2 passed
Opencode typecheck: bun --cwd packages/opencode typecheck -> passed
App typecheck: bun --cwd packages/app typecheck -> passed
SDK typecheck: bun --cwd packages/sdk/js typecheck -> passed
SDK generation: bun --cwd packages/sdk/js build -> generated v2 SDK, removed old memory review/proposal methods
Diff check: git diff --check -> no whitespace errors
Review follow-up: bun --cwd packages/opencode test test/memory/pawwork-memory.test.ts && bun --cwd packages/opencode typecheck && git diff --check -> 15 pass, typecheck passed, no whitespace errors

Screenshots or Recordings

Not included. This PR removes an obsolete UI panel rather than introducing a new visible surface; the absence is covered by the settings memory E2E test.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

Release Notes

  • Feature Removals

    • Removed the memory review dialog that appeared during idle session memory operations
    • Removed automatic memory proposal generation and sensitive content detection/redaction features
  • Changes

    • Simplified memory handling: Profile data automatically loads at session start; Archive is searched only when explicitly needed
    • Updated memory file format to streamline storage and retrieval

@Astro-Han Astro-Han added enhancement New feature or request P1 High priority app Application behavior and product flows harness Model harness, prompts, tool descriptions, and session mechanics labels May 10, 2026
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 342a106f-4eb1-43aa-82f4-836bdd614a10

📥 Commits

Reviewing files that changed from the base of the PR and between ac1b4ec and 39e5394.

📒 Files selected for processing (3)
  • packages/opencode/src/memory/service.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/memory/pawwork-memory.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/opencode/test/memory/pawwork-memory.test.ts
  • packages/opencode/src/session/prompt.ts

📝 Walkthrough

Walkthrough

Removes the SessionMemoryReview UI and its server/client proposal endpoints, simplifies memory parsing to return raw Profile/Archive, eliminates redaction/proposal logic, updates injected memory prompt text, and adjusts tests to use raw save/read/delete behavior.

Changes

Memory Review Feature Removal

Layer / File(s) Summary
Component Deletion
packages/app/src/components/memory/session-memory-review.tsx
Removed the SessionMemoryReview component implementation, state, resource wiring, and UI.
Internationalization
packages/app/src/i18n/en.ts, packages/app/src/i18n/zh.ts
Removed memory.review.* translation keys and updated settings.memory.raw.description.
UI Integration
packages/app/src/pages/session/session-main-view.tsx, packages/app/src/pages/session.tsx, packages/app/src/shell-frame-contract.test.ts
Removed SessionMemoryReview import and render from SessionMainView; removed memoryReviewVisible prop wiring from session page; added anchor and session callbacks; removed contract test assertion.
E2E Tests / Wiring
packages/app/e2e/settings/settings-memory.spec.ts
Updated imports and replaced idle-session review tests with assertion that session-memory-review is not rendered; removed prior review/save/redaction cases.

Backend Memory Architecture Simplification

Layer / File(s) Summary
ParseResult Type Simplification
packages/opencode/src/memory/memory.ts
MemoryFile.ParseResult now returns profile, raw archive, and profileTooLarge; removed entries/invalidEntries and stopped parsing archive entries.
Archive Entry Helpers Removal
packages/opencode/src/memory/memory.ts
Removed exported helper types (Scope, Entry, InvalidEntry), formatEntry, and internal archive parsing helpers (parseEntries, parseHeading, makeID).
Proposal Redaction Module Removal
packages/opencode/src/memory/proposal.ts
Deleted MemoryProposal namespace including SENSITIVE_PATTERNS, redact, and fromText.
Memory Service API
packages/opencode/src/memory/service.ts
Removed appendAcceptedProposal from returned API; removed MemoryProposal import and workspacePath wiring; updated deleteEntry to use read() state.status and a simplified section-boundary regex.
Server Endpoint Removal
packages/opencode/src/server/instance/memory.ts
Removed MemoryProposalInput schema and the GET /review-state and POST /proposal/accept routes.
Memory Test Coverage
packages/opencode/test/memory/pawwork-memory.test.ts
Removed proposal/redaction tests; updated archive parsing tests to assert raw markdown preservation; added saveRaw save/read/delete smoke tests and concurrency/delete-edge-case tests.

Session & Prompt Updates

Layer / File(s) Summary
Memory Instruction Template
packages/opencode/src/session/prompt.ts
Updated injected <pawwork-memory> instructions to clarify Profile is auto-loaded while Archive is local-only and not injected; adjusted search guidance and writer rules for auto-updates and privacy constraints.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

  • #519: Overlaps with this PR's removal and simplification of SessionMemoryReview, MemoryProposal, archive entry parsing, and review endpoints.

Possibly related PRs

Poem

🐰 Away with the review, away with the ask,
Silent AI whispers now do the task,
Archive sleeps local while Profile stands tall,
No dialogs, no redactions—just memory for all! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: make PawWork memory silent and automatic' accurately describes the main change: removing the session-end memory confirmation UI and shifting to prompt-driven, automatic AI maintenance.
Description check ✅ Passed The PR description covers all required template sections including Summary, Why, Related Issue, Human Review Status, Review Focus, Risk Notes, How To Verify, Screenshots/Recordings, and Checklist with substantive detail.
Linked Issues check ✅ Passed All major coding requirements from #526 are met: SessionMemoryReview removed, prompt-driven memory maintenance implemented, Profile-only injection at session start, Archive as freeform markdown, memory disable via prompt injection omission, and Settings controls preserved.
Out of Scope Changes check ✅ Passed All changes align with #526 requirements: SessionMemoryReview removal, prompt updates, Archive/Profile simplification, and API cleanup are all in-scope objective work.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/i526-memory-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added the task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work label May 10, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes the structured session memory review UI and its associated backend logic, transitioning to a model where the agent manages the MEMORY.md file directly as freeform markdown using file editing tools. The system prompt has been updated with instructions for memory management, including guidelines on data sensitivity and persistence. Feedback suggests refining the system prompt by adding character truncation to the memory retrieval example to prevent context bloat and providing an English acknowledgement example to ensure consistent behavior across locales.

Comment thread packages/opencode/src/session/prompt.ts Outdated
Comment thread packages/opencode/src/session/prompt.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/opencode/src/memory/service.ts`:
- Line 127: The current RegExp used in deleteEntry (new RegExp(`\\n?###
[^\\n]*\\bid:${escaped}(?:\\s|$)[\\s\\S]*?(?=\\n### |$)`)) will prematurely stop
at any "###" heading inside an entry body; tighten the lookahead so it only
stops at the next entry header that contains an "id:" field. Replace the
trailing lookahead (?=\\n### |$) with one that asserts the next "###" line
includes an "id:" token, e.g. (?=\\n### [^\\n]*\\bid:|$), and ensure the RegExp
flags (multiline) are correct for line anchors so deleteEntry targets full entry
boundaries only.

In `@packages/opencode/src/session/prompt.ts`:
- Around line 1848-1853: The memory prompt is missing an explicit rule mandating
a single onboarding sentence on the first automatic memory write; add a line to
the pawwork-memory instructions (the same array that currently ends with
"</pawwork-memory>") that tells the assistant: "On the very first automatic
write to MEMORY.md include exactly one concise onboarding sentence for the user
(once only); do not include this onboarding sentence on subsequent updates."
Place this rule among the other bullet strings before the closing
"</pawwork-memory>" entry so the model deterministically performs a one-time
onboarding write and never repeats it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e6ddfd9a-f3af-4a1b-9947-c8a54dba03dd

📥 Commits

Reviewing files that changed from the base of the PR and between 7953110 and ac1b4ec.

⛔ Files ignored due to path filters (2)
  • packages/sdk/js/src/v2/gen/sdk.gen.ts is excluded by !**/gen/**
  • packages/sdk/js/src/v2/gen/types.gen.ts is excluded by !**/gen/**
📒 Files selected for processing (13)
  • packages/app/e2e/settings/settings-memory.spec.ts
  • packages/app/src/components/memory/session-memory-review.tsx
  • packages/app/src/i18n/en.ts
  • packages/app/src/i18n/zh.ts
  • packages/app/src/pages/session.tsx
  • packages/app/src/pages/session/session-main-view.tsx
  • packages/app/src/shell-frame-contract.test.ts
  • packages/opencode/src/memory/memory.ts
  • packages/opencode/src/memory/proposal.ts
  • packages/opencode/src/memory/service.ts
  • packages/opencode/src/server/instance/memory.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/memory/pawwork-memory.test.ts
💤 Files with no reviewable changes (7)
  • packages/app/src/pages/session.tsx
  • packages/opencode/src/server/instance/memory.ts
  • packages/app/src/shell-frame-contract.test.ts
  • packages/app/src/pages/session/session-main-view.tsx
  • packages/opencode/src/memory/proposal.ts
  • packages/app/src/components/memory/session-memory-review.tsx
  • packages/opencode/src/memory/memory.ts

Comment thread packages/opencode/src/memory/service.ts Outdated
Comment thread packages/opencode/src/session/prompt.ts
@Astro-Han
Astro-Han merged commit 002fcab into dev May 10, 2026
22 checks passed
@Astro-Han
Astro-Han deleted the codex/i526-memory-v1 branch May 10, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows enhancement New feature or request harness Model harness, prompts, tool descriptions, and session mechanics P1 High priority task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Memory v1: silent AI-maintained background memory

1 participant