Skip to content

Bug: Bundled hook handler files not compiled to dist (npm global install) #11348

@matthewpoe

Description

@matthewpoe

Summary

Bundled hook handler.ts files are not compiled or copied to dist during the build process. Even when the bundled hooks directory is correctly discovered, no hooks can load because only HOOK.md files exist in the published npm package — the actual handler code is missing.

This is Bug 2 from #11331. Bug 1 (path resolution) is addressed in #11339.

Symptoms

After fixing path resolution (or using the OPENCLAW_BUNDLED_HOOKS_DIR env var workaround), gateway logs show:

[hooks] Hook "session-memory" has HOOK.md but no handler file in .../dist/hooks/bundled/session-memory
[hooks] Hook "boot-md" has HOOK.md but no handler file in .../dist/hooks/bundled/boot-md
[hooks] Hook "command-logger" has HOOK.md but no handler file in .../dist/hooks/bundled/command-logger
[hooks] Hook "soul-evil" has HOOK.md but no handler file in .../dist/hooks/bundled/soul-evil

Root Cause

The source tree has both files:

src/hooks/bundled/session-memory/
├── HOOK.md
├── handler.ts
└── handler.test.ts

But the npm-published dist only contains the markdown:

dist/hooks/bundled/session-memory/
└── HOOK.md

The hook loader scans for handler.ts, handler.js, index.ts, or index.js and finds none.

In dev mode, tsx loads handler.ts directly from source. On npm global installs, no compiled handler.js is emitted by the build.

Impact

All four bundled hooks are non-functional on npm global installs:

  • session-memory: Memory files not created on /new command
  • boot-md: BOOT.md not executed on gateway startup
  • command-logger: No command audit logging
  • soul-evil: Soul swap feature inoperable

Environment

OpenClaw: 2026.2.6-3 (85ed6c7)
Node: v22.22.0
OS: Ubuntu 24.04 (DigitalOcean)
Install: npm install -g openclaw@latest

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions