feat(ai-psychosis): same-invocation valence-aware pushback detection
This commit is contained in:
parent
881c2bc10a
commit
eca30b4682
2 changed files with 44 additions and 0 deletions
|
|
@ -111,10 +111,20 @@ for (const p of depPatterns) { if (p.test(prompt)) { depHit = 1; break; } }
|
|||
for (const p of escPatterns) { if (p.test(prompt)) { escHit = 1; break; } }
|
||||
for (const p of fatPatterns) { if (p.test(prompt)) { fatHit = 1; break; } }
|
||||
for (const p of valPatterns) { if (p.test(prompt)) { valHit = 1; break; } }
|
||||
let pbReactiveHit = 0; for (const p of pbReactivePatterns) { if (p.test(prompt)) { pbReactiveHit = 1; break; } }
|
||||
let pbPreemptiveHit = 0; for (const p of pbPreemptivePatterns) { if (p.test(prompt)) { pbPreemptiveHit = 1; break; } }
|
||||
let domainHit = 0; for (const p of domainRelationshipPatterns) { if (p.test(prompt)) { domainHit = 1; break; } }
|
||||
|
||||
// Clear prompt from memory
|
||||
prompt = '';
|
||||
|
||||
// Same-invocation valence guard (research/01 frustration-spiral finding):
|
||||
// pushback in fat/esc context is NOT protective — suppress in same prompt.
|
||||
if (fatHit === 1 || escHit === 1) {
|
||||
pbReactiveHit = 0;
|
||||
pbPreemptiveHit = 0;
|
||||
}
|
||||
|
||||
// Update state with new flag counts
|
||||
const state = readState();
|
||||
const newDep = (Number(state.dep_flags) || 0) + depHit;
|
||||
|
|
@ -126,6 +136,8 @@ state.dep_flags = newDep;
|
|||
state.esc_flags = newEsc;
|
||||
state.fatigue_flags = newFat;
|
||||
state.val_flags = newVal;
|
||||
state.pushback_count = (Number(state.pushback_count) || 0) + pbReactiveHit + pbPreemptiveHit;
|
||||
if (domainHit === 1 && !state.domain_context) state.domain_context = 'relationship';
|
||||
writeState(state);
|
||||
|
||||
// Check if any thresholds crossed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue