From 5318b42bd2e9eda43d60de4523c03fd540448ebf Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sun, 4 Jan 2026 19:01:35 +0100 Subject: [PATCH] docs: update CHANGELOG and hooks.md with missing items - tools.ts example hook - Multiple messages from before_agent_start - getSettingsListTheme/getSelectListTheme optional theme param - Hook error stack traces --- packages/coding-agent/CHANGELOG.md | 6 +++++- packages/coding-agent/docs/hooks.md | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index d8715504..52cb6529 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -5,9 +5,13 @@ ### Added - Hook API: `before_agent_start` handlers can now return `systemPromptAppend` to dynamically append text to the system prompt for that turn. Multiple hooks' appends are concatenated. -- New example hook: `pirate.ts` demonstrates using `systemPromptAppend` to make the agent speak like a pirate when `/pirate` mode is enabled +- Hook API: `before_agent_start` handlers can now return multiple messages (all are injected, not just the first) +- New example hook: `tools.ts` - Interactive `/tools` command to enable/disable tools with session persistence +- New example hook: `pirate.ts` - Demonstrates `systemPromptAppend` to make the agent speak like a pirate - Tool registry now contains all built-in tools (read, bash, edit, write, grep, find, ls) even when `--tools` limits the initially active set. Hooks can enable any tool from the registry via `pi.setActiveTools()`. - System prompt now automatically rebuilds when tools change via `setActiveTools()`, updating tool descriptions and guidelines to match the new tool set +- `getSettingsListTheme()` and `getSelectListTheme()` now accept optional theme parameter for use in hooks loaded via jiti +- Hook errors now display full stack traces for easier debugging ### Changed diff --git a/packages/coding-agent/docs/hooks.md b/packages/coding-agent/docs/hooks.md index d6baad04..b7ece86e 100644 --- a/packages/coding-agent/docs/hooks.md +++ b/packages/coding-agent/docs/hooks.md @@ -279,7 +279,7 @@ pi.on("before_agent_start", async (event, ctx) => { }); ``` -**message**: Persisted as `CustomMessageEntry` and sent to the LLM. +**message**: Persisted as `CustomMessageEntry` and sent to the LLM. Multiple hooks can each return a message; all are injected in order. **systemPromptAppend**: Appended to the base system prompt for this agent run only. Multiple hooks can each return `systemPromptAppend` strings, which are concatenated. This is useful for dynamic instructions based on hook state (e.g., plan mode, persona toggles).