Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
# hooks
A hook is asked as each turn goes and may steer it. Any extension
contributes one through its managed plugin, `Managed(..extension.empty(),
hook: Some(ask))`, where `ask: fn(hook.Event) -> hook.Verdict`
([`hook.gleam`](../src/albedo/harness/hook.gleam)). The installed `hooks`
extension builds Claude Code compatible command hooks on it; an exporter of
traces, a policy, or an audit log is an extension of the same shape.
[docs/extensions.md](../docs/extensions.md#hooks) has the human-facing
version with examples.
## events
| event | when | a verdict can |
| --- | --- | --- |
| `Prompted(text)` | a turn's newest input is a user message, before the first model call | block (the turn ends without a model call, the user is told why), add context |
| `Calling(call)` | a tool call is about to run | block (the call's result is the refusal), rewrite its JSON `arguments`, add context |
| `Called(call, output, started_ms, finished_ms)` | once the call has a result, a refusal included | add context; a block is context too, since the call already ran |
| `Stopping(reply, held)` | the model ended its turn without a tool call | block or add context, which continues the turn, at most 8 times |
Any verdict can carry `notes` (shown to the user, never the model) and `halt`
(the turn ends with that reason; after `Called`, once its result is
committed). Context is committed as user input ahead of the next model call.
`call` is a model tool call (`name` is the tool, `arguments` its JSON), or a
call made inside a cell, whose `within` is the model call that ran the cell:
| name | arguments |
| --- | --- |
| `run` | `command`; `host` too for `rem.run`/`rem.shell` in ssh command mode |
| `files.edit` | `file_path`, `old_string`, `new_string` |
| `files.write` | `file_path`, `content`; `host` too for `rem.write` |
| `mcp.call` | `name`, `arguments` (also `mcp.<server>.<tool>(...)`) |
| `mail.submit` | `to`, `body` |
| `agents.spawn`, `.cancel`, `.close`, `.cancel_all`, `.delete` | what the daemon is asked |
| `web_search` | `qu…