feat(ai-psychosis): add pushback_count + domain_context state fields

This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 17:06:09 +02:00
commit 080f2414ad
4 changed files with 14 additions and 0 deletions

View file

@ -128,6 +128,8 @@ export const THRESHOLD_SOFT_DEP_FLAGS = 2;
export const THRESHOLD_HARD_DEP_FLAGS = 5;
export const COOLDOWN_SOFT = 1800;
export const COOLDOWN_HARD = 3600;
// v1.1.0 — counting threshold; tier-reduction logic is v1.2 scope
export const THRESHOLD_PUSHBACK_FLAGS = 2;
// --- Session counting ---

View file

@ -38,6 +38,8 @@ const state = {
esc_flags: 0,
fatigue_flags: 0,
val_flags: 0,
pushback_count: 0,
domain_context: null,
last_warning_epoch: 0
};
writeState(state);

View file

@ -11,6 +11,7 @@ function freshState() {
tool_count: 0, edit_count: 0,
last_event_epoch: 0, burst_count: 0,
dep_flags: 0, esc_flags: 0, fatigue_flags: 0, val_flags: 0,
pushback_count: 0, domain_context: null,
last_warning_epoch: 0,
};
}

View file

@ -46,4 +46,13 @@ describe('session-start', () => {
assert.equal(out.continue, true);
assert.ok(!out.hookSpecificOutput);
});
it('initializes pushback_count and domain_context fields (v1.1.0)', () => {
dir = setupTestDir();
runHook('session-start.mjs', { session_id: 's4', cwd: '/tmp' }, dir);
const state = readState(dir, 's4');
assert.ok(state);
assert.equal(state.pushback_count, 0);
assert.equal(state.domain_context, null);
});
});