Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

`⚙️ SYSTEM` line never reports edits to `hooks/handlers/*.ts`: `classifySurface()` has no rule for that folder

Open corobis opened this issue 2 months ago • 2 comments

hooks/lib/system-surfaces.ts classifySurface() labels hooks/*.hook.ts and hooks/lib/*.ts as machinery. It has no rule for hooks/handlers/, so those paths fall through and return null. SystemChangeSurface.hook.ts then records nothing, and the turn's reply carries no ⚙️ SYSTEM line for the edit.

The folder ships nine handlers (SystemIntegrity, RebuildArchSummary, VoiceNotification and others). They run at SessionEnd and Stop, so they are machinery by the system prompt's own definition ("hooks, skills, settings, TOOLS"). An edit to one is a self-modification that goes unreported.

Repro: in a main session, edit any file under hooks/handlers/. No ⚙️ SYSTEM line appears. Edit a file under hooks/lib/ the same way and the line does appear.

Fix that works here, placed right after the hooks/lib/ rule:

if (/^hooks\/handlers\/[^/]+\.ts$/.test(rel)) {
  return { tier: "machinery", label: `hooks/handlers/${base.replace(/\.ts$/, "")}` };
}

The pattern matches one level only, like the hooks/lib/ rule, so nested paths, tests and non-.ts files stay unreported.

Caveat: covered by a unit test on classifySurface() here. I have not yet seen the line render live for a handler edit.

Environment: Linux (WSL2), Bun, Claude Code 2.1.278, LifeOS 7.40.4.

corobis avatar Sep 21 '26 03:09 corobis

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed — classifySurface() had no rule for hooks/handlers/ (9 real files on our install), so edits there produced no SYSTEM line. Added a handlers rule to both the live copy and the shipped install payload.

Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.

waveman2020-sudo avatar Sep 23 '26 19:09 waveman2020-sudo

Thanks @corobis. Confirmed: classifySurface() had no rule for hooks/handlers/. It now labels those files as machinery, matching one level deep like the hooks/lib/ rule, with a test (hooks/lib/system-surfaces.ts). Next release carries it.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler