Two AI includes documented themselves under names nothing else uses

This commit is contained in:
Gmer4Lfe
2026-08-25 16:31:43 -04:00
parent 2c3c88d067
commit 1be259b66d
2 changed files with 80 additions and 54 deletions
+42 -20
View File
@@ -8,31 +8,53 @@
// the prompt on its own. A proposal is filed; the operator accepts or dismisses it; accepted
// text lands in the learned memory slot, which the prompt explicitly ranks BELOW retrieval.
//
// WHY IT IS A PROPOSAL AND NOT A WRITE
// Memory is injected into every future prompt. A model that writes its own memory writes its
// own mistakes, and then reads them back as established fact — growing more confident on each
// turn while the actual source code says otherwise. The cost of a bad proposal has to be one
// dismissal, not a permanently poisoned prompt. This is the same two-gate shape the repair
// system uses, for the same reason: whether something should be remembered is intent, and a
// model cannot prove intent.
// DESIGN PRINCIPLES
// It is a proposal, never a write.
// Memory is injected into every future prompt. A model that writes its own memory writes
// its own mistakes, and then reads them back as established fact — growing more confident
// on each turn while the actual source code says otherwise. The cost of a bad proposal has
// to be one dismissal, not a permanently poisoned prompt. This is the same two-gate shape
// the repair system uses, for the same reason: whether something should be remembered is
// intent, and a model cannot prove intent.
//
// WHY DEDUP IS NOT THE MODEL'S JOB
// "Do I already know this" is a semantic comparison, and a 14B at IQ4_XS is confidently wrong
// at it often enough to matter — with every miss costing budget permanently. So dedup here is
// deterministic: normalise, then reject on exact match or containment in either direction
// against assisted memory, learned memory, and everything previously dismissed. It will let
// through a reworded duplicate; it will never silently drop something new, and that is the
// right way round for a store the operator reviews anyway.
// Dedup is deterministic, not the model's job.
// "Do I already know this" is a semantic comparison, and a 14B at IQ4_XS is confidently
// wrong at it often enough to matter — with every miss costing budget permanently. So
// dedup here is deterministic: normalise, then reject on exact match or containment in
// either direction against assisted memory, learned memory, and everything previously
// dismissed. It will let through a reworded duplicate; it will never silently drop
// something new, and that is the right way round for a store the operator reviews anyway.
//
// GATES
// AI_MEMORY_LEARN_ENABLED false — nothing is proposed, and the prompt gains nothing
// AI_MEMORY_LEARN_AUTO_ACCEPT false — accepted writes happen only when the operator says so
// The second cannot outrank the first: auto-accept with proposing off does nothing at all.
// OPERATIONAL SAFEGUARDS
// Two gates, and the second cannot outrank the first.
// AI_MEMORY_LEARN_ENABLED off means nothing is proposed at all, so auto-accept with
// proposing off does nothing. Neither defaults to on.
//
// Dismissed rows are kept, not deleted.
// They are the only thing that stops the same suggestion arriving again every night. A
// store that forgot its refusals would re-propose what the operator has already judged.
//
// Nothing here reaches the prompt directly. Accepted text lands in the learned memory slot,
// which the prompt ranks BELOW retrieval — so even an accepted mistake cannot outrank the
// source code it contradicts.
//
// EXPORTS
// Gates vv_ai_mem_learn_enabled(), vv_ai_mem_learn_auto()
// Dedup vv_ai_mem_norm(), vv_ai_mem_known(), vv_ai_mem_is_dup(), vv_ai_mem_is_ui_fact()
// Store vv_ai_mem_dir(), vv_ai_mem_propose(), vv_ai_mem_list(), vv_ai_mem_remove(),
// vv_ai_mem_append(), vv_ai_mem_write_row()
// Operator vv_ai_mem_action()
// — accept or dismiss one proposal. The only entry that changes what a future
// prompt will contain.
//
// CONFIGURATION
// master.conf
// AI_MEMORY_LEARN_ENABLED propose at all. Default false.
// AI_MEMORY_LEARN_AUTO_ACCEPT write accepted text without asking. Default false.
//
// STORE
// data/ai/mem_proposals/<id>.json — one file per proposal, mirroring the findings store.
// States: open | accepted | dismissed. Dismissed rows are KEPT, because they are what stops
// the same suggestion arriving again every night.
// States: open | accepted | dismissed.
// ═══════════════════════════════════════════════════════════════════════════════════════════════
require_once __DIR__ . '/ai.php';