Background
While trying to implement automatic Slack thread context injection for our AI agents, we consulted the hooks documentation (docs/hooks.md). The doc lists message:received under "Future Events", which led us to believe this functionality was not available.
However, after reverse-engineering the implementation (dist/loader-n6BPnYom.js), we discovered that many hooks are already implemented but not documented:
Implemented but Undocumented Hooks
| Hook Name |
Type |
Status in Code |
Status in Docs |
before_agent_start |
modifying |
✅ Implemented |
❌ Not documented |
agent_end |
void |
✅ Implemented |
❌ Not documented |
message_received |
void |
✅ Implemented |
Listed as "Future" |
message_sending |
modifying |
✅ Implemented |
❌ Not documented |
message_sent |
void |
✅ Implemented |
Listed as "Future" |
before_tool_call |
modifying |
✅ Implemented |
❌ Not documented |
after_tool_call |
void |
✅ Implemented |
❌ Not documented |
session_start |
void |
✅ Implemented |
Listed as "Future" |
session_end |
void |
✅ Implemented |
Listed as "Future" |
Key Discovery: before_agent_start Hook
This hook is particularly powerful:
async function runBeforeAgentStart(event, ctx) {
return runModifyingHook("before_agent_start", event, ctx, (acc, next) => ({
systemPrompt: next.systemPrompt ?? acc?.systemPrompt,
prependContext: ...
}));
}
Capabilities:
event.prompt — User's message
event.messages — Session conversation history
ctx.sessionKey — Session key (can identify channel/thread)
ctx.agentId — Agent ID
ctx.workspaceDir — Workspace directory
ctx.messageProvider — Message provider (e.g., "slack")
- Returns
prependContext to inject context before the prompt
- Returns
systemPrompt to modify system prompt
This allows fetching external context (e.g., Slack thread history) and injecting it before the agent processes the message.
Request
Please update docs/hooks.md to document these implemented hooks. Other users may be giving up on features that are actually available.
Environment
- OpenClaw version: 2026.2.6-3
- Installation: npm global (homebrew)
Background
While trying to implement automatic Slack thread context injection for our AI agents, we consulted the hooks documentation (
docs/hooks.md). The doc listsmessage:receivedunder "Future Events", which led us to believe this functionality was not available.However, after reverse-engineering the implementation (
dist/loader-n6BPnYom.js), we discovered that many hooks are already implemented but not documented:Implemented but Undocumented Hooks
before_agent_startagent_endmessage_receivedmessage_sendingmessage_sentbefore_tool_callafter_tool_callsession_startsession_endKey Discovery:
before_agent_startHookThis hook is particularly powerful:
Capabilities:
event.prompt— User's messageevent.messages— Session conversation historyctx.sessionKey— Session key (can identify channel/thread)ctx.agentId— Agent IDctx.workspaceDir— Workspace directoryctx.messageProvider— Message provider (e.g., "slack")prependContextto inject context before the promptsystemPromptto modify system promptThis allows fetching external context (e.g., Slack thread history) and injecting it before the agent processes the message.
Request
Please update
docs/hooks.mdto document these implemented hooks. Other users may be giving up on features that are actually available.Environment