Index
hooks
Hook base types for AXM lifecycle hooks.
Provides :class:HookResult and :class:HookAction, the shared
contracts used by all hook implementations across the ecosystem.
HookAction
Bases: Protocol
Protocol for hook implementations.
All hook actions receive a context dict with session info: - session_id: str - protocol_name: str - phase_name: str - task_name: str | None - working_dir: str | None - artifacts_path: str | None
Source code in packages/axm/src/axm/hooks/base.py
execute(context, **params)
Execute the hook action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict[str, Any]
|
Session context dictionary |
required |
**params
|
Any
|
Hook-specific parameters |
{}
|
Returns:
| Type | Description |
|---|---|
HookResult
|
HookResult indicating success/failure with metadata |
Source code in packages/axm/src/axm/hooks/base.py
HookResult
dataclass
Result of a hook execution.
Attributes:
| Name | Type | Description |
|---|---|---|
success |
bool
|
Whether the hook succeeded |
error |
str | None
|
Error message if failed |
metadata |
dict[str, Any]
|
Optional execution metadata |
text |
str | None
|
Pre-rendered text representation of the result |
Source code in packages/axm/src/axm/hooks/base.py
fail(error, *, text=None, **metadata)
classmethod
Create a failed result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
str
|
Human-readable error message. |
required |
text
|
str | None
|
Pre-rendered text representation of the result. |
None
|
**metadata
|
Any
|
Arbitrary key-value pairs stored in metadata. |
{}
|
Source code in packages/axm/src/axm/hooks/base.py
ok(*, text=None, **metadata)
classmethod
Create a successful result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Pre-rendered text representation of the result. |
None
|
**metadata
|
Any
|
Arbitrary key-value pairs stored in metadata. |
{}
|
Source code in packages/axm/src/axm/hooks/base.py
| Python | |
|---|---|
skip(reason='condition not met')
classmethod
Create a skipped result (success, hook intentionally not run).