#2056

feat: let agents suggest Memory rules that wait for the user to accept

Draft4pmtongwants to merge intofrom

Summary

When you tell Eigent how future work should be done, the agent can now suggest saving that as Memory. For example: "create a branch for every task", or "新建组件放在 src/components 下".

  • A suggestion appears on the Memory page next to the message it came from.
  • It has no effect on any task until you accept or edit it.
  • The agent decides whether a message states a lasting rule. Automatic Memory no longer guesses rules from phrases such as "for this project, …".

Stacked on #2055. Please review that one first.

What changes for users

  • Memory page. Each scope has a "Suggested" group. You can:
    • Accept a suggestion to start using it;
    • Edit it and save your own wording;
    • Dismiss it. A dismissed rule is not suggested again.
  • Explicit requests are unchanged. "Remember …", "I prefer …", "记住…" and "我喜欢…" still save right away, as before.
  • Auto Memory off means no suggestions. Turning off Auto Memory for a scope also stops suggestions there.
  • Suggestions never pause a task. The agent may mention in its reply that it suggested a rule.

How it works

  • New tool. Agents that have the Memory tools get propose_memory_rule(kind, scope, content, reason, source_event_ids).
    • It saves a preference or a constraint for the current Session, its Space, or all of the user's work.
    • It must cite the user's own message in this Session. Messages from tools, web pages, files and triggers are rejected.
    • It needs no approval prompt.
    • A retry returns the same suggestion.
  • What counts as a suggestion. It is an agent-written preference or constraint the user has not confirmed.
    • It never reaches the agent's context.
    • The agent's own Memory search shows it as pending, so the agent neither follows it nor suggests it again.
  • Limits.
    • Up to 300 characters per suggestion.
    • At most 5 suggestions per scope, using at most a quarter of that scope's Memory room.
    • An agent cannot edit, remove or promote a suggestion. Only the user handles it.
    • When duplicates are cleaned up, saved Memory is always kept over a suggestion with the same words.
  • Policy. Any agent-written preference or constraint must be marked as said by the user, with a citation. This is enforced where Memory entries are validated, not only in the tool.
  • Trust after accepting.
    • Accepting keeps the entry's source as user-stated.
    • Editing makes it user-confirmed.
  • Explicit-request patterns. The automatic extractor keeps them. The scope-phrase patterns and the one-off-request word lists are removed. Messages already processed are not scanned again, and saved Memory is unchanged.
  • Counts. Memory counts on the Memory page and in the Memory directory leave out suggestions.

Known limitation

Suggestions sync like other Memory entries. An older app version signed in to the same account shows them as ordinary Memory, not as suggestions.

Testing

  • Backend: tests/app/lightweight_memory, memory, agent/toolkit, controller, run_journal and workspace_runtime give 2,248 passed, 4 skipped.
    • test_memory_rule_proposal.py has 59 tests. They cover provenance, limits, deduplication, retries, Auto Memory off, prompt exclusion, accept/edit/dismiss, the policy rule, the no-approval safety class, and agents leaving suggestions to the user.
  • Frontend: SettingsMemory, MemoryScopeDirectory, MemorySettingsLayout and chatStore give 267 passed. npm run type-check, eslint, check:i18n (all 11 locales) and check:design-tokens pass.
  • ruff check and ruff format --check (0.14.3, as pinned by pre-commit) pass, and so does git diff --check.