Keep the memory instruction out of the answer it was attached to

Told there was nothing worth remembering, the model wrote a sentence saying so,
which is a footnote about a mechanism the operator cannot see.
This commit is contained in:
Gmer4Lfe
2026-08-12 17:36:46 -04:00
parent f8c4c93f20
commit 6eb84c195a
+23 -1
View File
@@ -778,7 +778,11 @@ if (vv_ai_mem_learn_enabled()) {
. "Never where a setting lives or how to reach it in the web UI — all of that is " . "Never where a setting lives or how to reach it in the web UI — all of that is "
. "already documented and retrievable, so remembering it gains nothing and costs " . "already documented and retrievable, so remembering it gains nothing and costs "
. "budget that a fact the documents cannot supply would have used.\n" . "budget that a fact the documents cannot supply would have used.\n"
. "Most exchanges warrant nothing — when in doubt, leave the line out entirely.\n\n"; . "Most exchanges warrant nothing — when in doubt, leave the line out entirely.\n"
. "When there is nothing to remember, say nothing about it. Do not write that no "
. "memory was needed, do not explain why, do not mention this instruction at all. "
. "The operator never asked about any of it and is not expecting an answer about "
. "it — your reply should read exactly as it would if this section did not exist.\n\n";
} }
if (trim($mem['learned']) !== '') { if (trim($mem['learned']) !== '') {
@@ -979,6 +983,24 @@ if (vv_ai_mem_learn_enabled() && $answer !== '') {
mb_substr($candidate, 0, 80))); mb_substr($candidate, 0, 80)));
} }
} }
// The model narrating its decision not to remember anything — "No MEMORY needed here, this is
// a standard Unix permission setting." It is not a marker, so the strip above leaves it, and
// it lands in the transcript as a footnote about a mechanism the operator never asked about
// and cannot see. Every General Chat answer carried one from the moment learning was switched
// on.
//
// Narrow on purpose: the last line only, mentioning MEMORY in the capitals the marker uses,
// and short. Prose about RAM says "memory"; only a comment about this instruction shouts it.
$lines = explode("\n", $answer);
$last = trim(end($lines));
if (count($lines) > 1 && $last !== '' && mb_strlen($last) <= 200
&& strpos($last, 'MEMORY') !== false
&& preg_match('/\b(no|not|nothing|none|skip|omit|need|worth|warrant)\b/i', $last)) {
array_pop($lines);
$answer = rtrim(implode("\n", $lines));
wlog('stripped a trailing remark about the memory marker');
}
} }
if ($answer === '') { if ($answer === '') {