Skip to content

refactor(hooks)!: remove 4 low-value hooks (P2.1) - #67

Merged
klpanagi merged 1 commit into
devfrom
refactor/p2.1-trim-hooks
Sep 8, 2026
Merged

refactor(hooks)!: remove 4 low-value hooks (P2.1)#67
klpanagi merged 1 commit into
devfrom
refactor/p2.1-trim-hooks

Conversation

@klpanagi

@klpanagi klpanagi commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Removes heaviness from the hook registry — 1 ghost schema entry + 3 low-value implementations.

BREAKING CHANGE: disabled_hooks entries for the 4 deleted names now fail Zod validation. Remove them from matrixx.jsonc.

Changes

  • HookNameSchema 65→61 (src/config/schema/hooks.ts): delete grep-output-truncator (ghost, 0 LOC, already covered by tool-output-truncator's TRUNCATABLE_TOOLS), question-label-truncator (63 LOC, PreToolUse hot path), mcp-startup-notification (37 LOC, startup toast), directory-readme-injector (122 LOC, duplicate README injection with FS access storm)
  • Deleted: src/hooks/question-label-truncator/, src/hooks/mcp-startup-notification/, src/hooks/directory-readme-injector/ (6 files) + 3 test dirs (~470 LOC) — 26 files -764/+22
  • Wiring cleaned: src/hooks/index.ts (3 exports), create-session-hooks.ts (un-gated truncator + gated mcp), create-tool-guard-hooks.ts, tool-execute-before/after.ts, event.ts, hook-mutation-classification.md, tool-execute-before.bench.ts (16→14 calls), src/hooks/AGENTS.md
  • Docs: docs/configurations.md enumeration 65→61, docs/features.md, docs/context-management.md
  • Schema: assets/matrixx.schema.json regenerated via bun run build:schema

Rationale

Hook Cost Value Decision
grep-output-truncator 0 runtime (ghost) pollutes schema/autocomplete pure delete
question-label-truncator PreToolUse on every tool call 30-char label slice for single tool delete, TUI handles overflow
mcp-startup-notification session.created once toast, failures already queryable via getMcpStartupFailures delete
directory-readme-injector PostToolUse + access/readFile per file read duplicates directory-agents-injector delete, factory kept

Verification

  • bun run typecheck — 0 errors
  • bun run lint — 960 files, 0 errors
  • bun run build — 1140 modules, ESM+CLI+schema green
  • grep -c hooks.ts → 61, orphan rg for 4 names → 0 matches in src/tests
  • ls 3 hook dirs → No such file, survivors intact

Follow-up

P2.2 (context-window consolidation), P2.3 (evolution gating), P2.4 (skill consolidation), P3 remain. manager.ts 1749 LOC deferred (needs Oracle facade plan).

Closes P2.1

@klpanagi
klpanagi force-pushed the refactor/p2.1-trim-hooks branch from 74c1c53 to 544d829 Compare September 8, 2026 17:17
BREAKING CHANGE: disabled_hooks entries for
grep-output-truncator, question-label-truncator,
mcp-startup-notification, directory-readme-injector
now fail Zod validation. Remove them from
matrixx.jsonc.

- HookNameSchema 65→61 (ghost + 3 low-value)
- Delete question-label-truncator (PreToolUse hot path),
  mcp-startup-notification (startup toast),
  directory-readme-injector (duplicate README injection,
  FS access storm) — 223 LOC src + 470 LOC tests
- Clean wiring in create-session-hooks,
  create-tool-guard-hooks, tool-execute-before/after,
  event, hook-mutation-classification, bench, AGENTS.md
- Update docs/configurations.md, features.md,
  context-management.md
- Regenerate assets/matrixx.schema.json via build:schema

Co-authored-by: Morpheus <morpheus@matrixx>
@klpanagi
klpanagi force-pushed the refactor/p2.1-trim-hooks branch from 544d829 to a19ff88 Compare September 8, 2026 17:20
@klpanagi
klpanagi merged commit 6fa7dd6 into dev Sep 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant