Chain commands to run automatically when events occur
Set up automated command chains that run when tools complete or tasks finish. Configure triggers like "tool:Edit" or "task:complete" with conditions to automatically execute follow-up actions like code reviews or test runs.
/plugin marketplace add standardbeagle/agnt/plugin install agnt@standardbeagle-toolsSet up command chains that execute automatically when specific events occur.
Chain commands to trigger on:
Chains are stored in .agnt/chains.json in your project:
{
"chains": [
{
"id": "review-after-edit",
"trigger": "tool:Edit",
"condition": "success",
"command": "/code-review",
"oneshot": false
}
]
}
Read the chains file to see what's configured:
Read .agnt/chains.json
Create or update the chains file:
Example: Code review after editing:
{
"chains": [
{
"id": "auto-review",
"trigger": "tool:Edit",
"condition": "success",
"command": "/code-review the changes I just made",
"oneshot": false
}
]
}
Example: Run tests after writing files:
{
"chains": [
{
"id": "auto-test",
"trigger": "tool:Write",
"condition": "success",
"command": "Please run the test suite to verify my changes",
"oneshot": false
}
]
}
Example: One-shot chain (runs once then removes itself):
{
"chains": [
{
"id": "deploy-check",
"trigger": "task:complete",
"condition": "success",
"command": "/schedule claude-1 5m 'Verify the deployment completed successfully'",
"oneshot": true
}
]
}
Edit the chains file to remove unwanted chains.
| Trigger | Description |
|---|---|
tool:Edit | After Edit tool completes |
tool:Write | After Write tool completes |
tool:Bash | After Bash tool completes |
tool:Task | After Task agent completes |
tool:* | After any tool completes |
task:complete | After a Task agent finishes |
| Condition | Description |
|---|---|
success | Only run if tool succeeded (default) |
failure | Only run if tool failed |
always | Run regardless of outcome |
| Property | Required | Description |
|---|---|---|
id | Yes | Unique identifier for the chain |
trigger | Yes | Event that triggers the chain |
command | Yes | Message/command to send to session |
condition | No | When to execute (default: "success") |
session | No | Target session code (default: current project) |
oneshot | No | Remove after first execution (default: false) |
{
"chains": [
{
"id": "review-edits",
"trigger": "tool:Edit",
"condition": "success",
"command": "Please review the code I just edited for any issues"
},
{
"id": "test-after-review",
"trigger": "tool:Task",
"condition": "success",
"command": "Run the relevant tests for the files I modified"
}
]
}
{
"chains": [
{
"id": "build-check",
"trigger": "tool:Bash",
"condition": "success",
"command": "/schedule claude-1 2m 'Check if the build completed and report any errors'"
}
]
}
.agnt/chains.json)