Skip to content

πŸ› fix(user-memory): strengthen anti-bloat rules with HARD RULE blocks and concrete examples#3

Closed
LoveS0ph1e wants to merge 1 commit into
EverMind-AI:mainfrom
LoveS0ph1e:fix/user-memory-anti-bloat-hard-rule
Closed

πŸ› fix(user-memory): strengthen anti-bloat rules with HARD RULE blocks and concrete examples#3
LoveS0ph1e wants to merge 1 commit into
EverMind-AI:mainfrom
LoveS0ph1e:fix/user-memory-anti-bloat-hard-rule

Conversation

@LoveS0ph1e

Copy link
Copy Markdown

Summary

The previous anti-bloat rule (UPDATE rule 6, added in an earlier server-side patch) was a single prose paragraph β€” no examples, no decision logic, no self-check. In production with deepseek-v4-flash, 62% of implicit_traits descriptions still contained specific dates after UPDATE cycles, because the model treated the rule as advisory rather than mandatory.

This PR rewrites the anti-bloat rules using techniques already proven effective in the same prompt file: the CRITICAL LANGUAGE RULE achieves near-perfect compliance via a HARD RULE label and bookend repetition (appears at both the top and bottom of the prompt). The anti-bloat rules now use the same pattern.

Changes

Two sections in prompts/en/profile.py:

UPDATE rule 6 (rewritten)

  • Upgraded from prose paragraph to **Durable abstraction β€” HARD RULE (anti-bloat)** block
  • IF/THEN logic: the model is told exactly when to rewrite vs append β€” "IF the new conversation is another instance of a pattern already covered… THEN you MUST re-synthesise"
  • Two WRONG/RIGHT example pairs:
    1. Simple appended instance (napping example)
    2. The real-world failure mode: an already-bloated description mixing multiple sub-topics with dates, receiving a third dated instance β€” the model must rewrite the entire description, not patch the new instance onto the end
  • Self-check: "Before finalizing… re-read every description… if any contains a date/weekday/clock-time token, rewrite that description now"

INIT principle 3 (rewritten)

  • Same HARD RULE upgrade with IF/THEN structure and WRONG/RIGHT example
  • Self-check: "Before finalizing: check every description for date/weekday/clock-time tokens; rewrite any that contain one"

Verification

Tested against a real bloated production profile (26 implicit_traits, 62% dated):

  • Baseline (old prose rule): 0/3 clean
  • Candidate (this PR): 3/3 clean β€” zero dates, new information correctly folded into generalizations
  • Also verified through the default production path (prompt=None, no test-only override)

Scope

  • Only the English prompt file is modified; the Chinese (zh/profile.py) prompts are not imported by the current ProfileExtractor paths
  • No schema changes, no code changes β€” pure prompt text
  • Backward compatible: the prompt structure is unchanged; only rule 6 and principle 3 wording differs

… and concrete examples

Profile descriptions accumulate dated instances over successive UPDATE
cycles β€” the previous prose-only anti-bloat rule (rule 6) saw ~62%
non-compliance from deepseek-v4-flash, with implicit_traits descriptions
routinely embedding calendar dates and growing into enumerated logs.

Rewrite UPDATE rule 6 and INIT principle 3 as HARD RULE blocks with:
- IF/THEN decision logic so the model knows exactly when to rewrite vs append
- WRONG/RIGHT contrasting examples, including the real-world failure mode
  (an already-bloated multi-topic description that receives a third dated
  instance β€” the model previously appended to the end of the mess)
- A closing self-check instruction ("re-read every description…rewrite it
  now") that mirrors the bookend technique already proven effective by
  CRITICAL LANGUAGE RULE in the same prompt

Verified on production with a real bloated profile: baseline 0/3 clean,
candidate 3/3 clean (zero dates, new information correctly folded in).
LoveS0ph1e added a commit to LoveS0ph1e/EverAlgo that referenced this pull request Jul 2, 2026
Replace the earlier prose anti-bloat rule with the HARD RULE version from
PR EverMind-AI#3, so the two changes compose cleanly without merge conflicts on rule 6.

No other changes β€” targeting code and prompts are unchanged.
LoveS0ph1e added a commit to LoveS0ph1e/EverAlgo that referenced this pull request Jul 2, 2026
… copying the first fact

Rebased onto targeting + HARD RULE anti-bloat (PRs EverMind-AI#2 + EverMind-AI#3).

Profile.summary was a verbatim copy of the first explicit_info description: the
extraction prompts never requested a summary, and _build_summary just returned
explicit_info[0]. With this change the prompts request a short paragraph summary,
_resolve_summary prefers it, and _build_summary returns "" as the intentional
empty fallback β€” downstream synthesis handles the true holistic portrait.

Additive and backward-compatible: callers and prompt overrides that omit summary
keep the previous behaviour, and all existing tests pass with updated assertions.
LoveS0ph1e added a commit to LoveS0ph1e/EverAlgo that referenced this pull request Jul 2, 2026
… copying the first fact

Rebased onto targeting + HARD RULE anti-bloat (PRs EverMind-AI#2 + EverMind-AI#3).

Profile.summary was a verbatim copy of the first explicit_info description: the
extraction prompts never requested a summary, and _build_summary just returned
explicit_info[0]. With this change the prompts request a short paragraph summary,
_resolve_summary prefers it, and _build_summary returns "" as the intentional
empty fallback β€” downstream synthesis handles the true holistic portrait.

Additive and backward-compatible: callers and prompt overrides that omit summary
keep the previous behaviour, and all existing tests pass with updated assertions.
@LoveS0ph1e

Copy link
Copy Markdown
Author

Superseded by #4, which consolidates the target-aware and anti-bloat changes into one minimal PR. The anti-bloat HARD RULE from this PR is included verbatim in #4 (now also mirrored in the zh prompt, with a test and CHANGELOG entry). Closing in favor of #4.

@LoveS0ph1e LoveS0ph1e closed this Jul 5, 2026
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.

1 participant