sisyphi 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon.js +11 -8
- package/dist/daemon.js.map +1 -1
- package/dist/templates/agent-plugin/hooks/CLAUDE.md +57 -0
- package/dist/templates/agent-plugin/hooks/hooks.json +12 -8
- package/dist/templates/agent-plugin/hooks/plan-user-prompt.sh +1 -4
- package/dist/templates/agent-plugin/hooks/spec-user-prompt.sh +1 -4
- package/dist/templates/companion-plugin/hooks/hooks.json +6 -4
- package/package.json +1 -1
- package/templates/agent-plugin/hooks/CLAUDE.md +57 -0
- package/templates/agent-plugin/hooks/hooks.json +12 -8
- package/templates/agent-plugin/hooks/plan-user-prompt.sh +1 -4
- package/templates/agent-plugin/hooks/spec-user-prompt.sh +1 -4
- package/templates/companion-plugin/hooks/hooks.json +6 -4
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# templates/agent-plugin/hooks/
|
|
2
|
+
|
|
3
|
+
Lifecycle hooks for agent plugin workflows. Enable specialized prompt generation and context handling during agent spawning.
|
|
4
|
+
|
|
5
|
+
## hooks.json
|
|
6
|
+
|
|
7
|
+
Schema: `{ "phaseKey": { "hookName": "script-name.sh" } }`
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"plan": {
|
|
13
|
+
"userPrompt": "plan-user-prompt.sh",
|
|
14
|
+
"systemPrompt": "plan-system-prompt.sh"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Keys**: Phase names (e.g., `plan`, `spec`, `implement`) — must correspond to phase modes in agent spawn workflow
|
|
20
|
+
- **Values**: Object mapping hook types to shell script names
|
|
21
|
+
- **Hook types**: `userPrompt`, `systemPrompt` (extensible for future hooks)
|
|
22
|
+
|
|
23
|
+
## Shell Scripts
|
|
24
|
+
|
|
25
|
+
Each script receives environment variables and outputs text to stdout.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Receives: $SISYPHUS_SESSION_ID, $SISYPHUS_AGENT_ID, $INSTRUCTION, $AGENT_TYPE, context files
|
|
29
|
+
# Outputs: Full user or system prompt text
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Convention**: `{phase}-{hook-type}.sh`
|
|
33
|
+
|
|
34
|
+
**Inputs**:
|
|
35
|
+
- `$SISYPHUS_SESSION_ID` — Session UUID
|
|
36
|
+
- `$SISYPHUS_AGENT_ID` — Agent ID (e.g., `agent-001`)
|
|
37
|
+
- `$INSTRUCTION` — Task instruction from spawn command
|
|
38
|
+
- `$AGENT_TYPE` — Agent type (e.g., `plan`, `spec`, `implement`)
|
|
39
|
+
- Context files at `.sisyphus/sessions/$SISYPHUS_SESSION_ID/context/`
|
|
40
|
+
|
|
41
|
+
**Output**: Must write complete prompt text to stdout (no errors to stderr)
|
|
42
|
+
|
|
43
|
+
## Invocation
|
|
44
|
+
|
|
45
|
+
Hooks are executed during agent spawn when:
|
|
46
|
+
1. Agent type matches a plugin agent type (e.g., `--agent-type sisyphus:plan`)
|
|
47
|
+
2. Phase has hooks configured in hooks.json
|
|
48
|
+
3. Daemon renders prompts before passing to Claude
|
|
49
|
+
|
|
50
|
+
Output becomes the `--append-system-prompt` or user message content.
|
|
51
|
+
|
|
52
|
+
## Key Patterns
|
|
53
|
+
|
|
54
|
+
- **No placeholders in shell scripts** — unlike `.md` templates, scripts perform logic and generate final text
|
|
55
|
+
- **Context access**: Scripts can read session state from `$SISYPHUS_SESSION_ID` directory
|
|
56
|
+
- **Error handling**: Exit non-zero to fail agent spawn; errors logged to daemon.log
|
|
57
|
+
- **Stdout only**: Scripts must output complete prompt to stdout; nothing to stderr
|
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
"PreToolUse": [
|
|
4
4
|
{
|
|
5
5
|
"matcher": "SendMessage",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/intercept-send-message.sh"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
10
12
|
}
|
|
11
13
|
],
|
|
12
14
|
"Stop": [
|
|
13
15
|
{
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/require-submit.sh"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
18
22
|
}
|
|
19
23
|
]
|
|
20
24
|
}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
# UserPromptSubmit hook: remind plan agent to delegate for large tasks.
|
|
3
3
|
if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import json, sys
|
|
7
|
-
print(json.dumps({'additionalContext': sys.stdin.read()}))
|
|
8
|
-
" <<'HINT'
|
|
5
|
+
cat <<'HINT'
|
|
9
6
|
<planning-reminder>
|
|
10
7
|
For particularly large or multi-domain tasks, delegate sub-plans to specialist agents rather than planning everything solo:
|
|
11
8
|
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
# UserPromptSubmit hook: remind spec agent to iterate with the user.
|
|
3
3
|
if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import json, sys
|
|
7
|
-
print(json.dumps({'additionalContext': sys.stdin.read()}))
|
|
8
|
-
" <<'HINT'
|
|
5
|
+
cat <<'HINT'
|
|
9
6
|
<spec-reminder>
|
|
10
7
|
Iterate with the user — include them in the process before writing anything to disk:
|
|
11
8
|
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"hooks": {
|
|
3
3
|
"UserPromptSubmit": [
|
|
4
4
|
{
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/user-prompt-context.sh"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
9
11
|
}
|
|
10
12
|
]
|
|
11
13
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# templates/agent-plugin/hooks/
|
|
2
|
+
|
|
3
|
+
Lifecycle hooks for agent plugin workflows. Enable specialized prompt generation and context handling during agent spawning.
|
|
4
|
+
|
|
5
|
+
## hooks.json
|
|
6
|
+
|
|
7
|
+
Schema: `{ "phaseKey": { "hookName": "script-name.sh" } }`
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"plan": {
|
|
13
|
+
"userPrompt": "plan-user-prompt.sh",
|
|
14
|
+
"systemPrompt": "plan-system-prompt.sh"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Keys**: Phase names (e.g., `plan`, `spec`, `implement`) — must correspond to phase modes in agent spawn workflow
|
|
20
|
+
- **Values**: Object mapping hook types to shell script names
|
|
21
|
+
- **Hook types**: `userPrompt`, `systemPrompt` (extensible for future hooks)
|
|
22
|
+
|
|
23
|
+
## Shell Scripts
|
|
24
|
+
|
|
25
|
+
Each script receives environment variables and outputs text to stdout.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Receives: $SISYPHUS_SESSION_ID, $SISYPHUS_AGENT_ID, $INSTRUCTION, $AGENT_TYPE, context files
|
|
29
|
+
# Outputs: Full user or system prompt text
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Convention**: `{phase}-{hook-type}.sh`
|
|
33
|
+
|
|
34
|
+
**Inputs**:
|
|
35
|
+
- `$SISYPHUS_SESSION_ID` — Session UUID
|
|
36
|
+
- `$SISYPHUS_AGENT_ID` — Agent ID (e.g., `agent-001`)
|
|
37
|
+
- `$INSTRUCTION` — Task instruction from spawn command
|
|
38
|
+
- `$AGENT_TYPE` — Agent type (e.g., `plan`, `spec`, `implement`)
|
|
39
|
+
- Context files at `.sisyphus/sessions/$SISYPHUS_SESSION_ID/context/`
|
|
40
|
+
|
|
41
|
+
**Output**: Must write complete prompt text to stdout (no errors to stderr)
|
|
42
|
+
|
|
43
|
+
## Invocation
|
|
44
|
+
|
|
45
|
+
Hooks are executed during agent spawn when:
|
|
46
|
+
1. Agent type matches a plugin agent type (e.g., `--agent-type sisyphus:plan`)
|
|
47
|
+
2. Phase has hooks configured in hooks.json
|
|
48
|
+
3. Daemon renders prompts before passing to Claude
|
|
49
|
+
|
|
50
|
+
Output becomes the `--append-system-prompt` or user message content.
|
|
51
|
+
|
|
52
|
+
## Key Patterns
|
|
53
|
+
|
|
54
|
+
- **No placeholders in shell scripts** — unlike `.md` templates, scripts perform logic and generate final text
|
|
55
|
+
- **Context access**: Scripts can read session state from `$SISYPHUS_SESSION_ID` directory
|
|
56
|
+
- **Error handling**: Exit non-zero to fail agent spawn; errors logged to daemon.log
|
|
57
|
+
- **Stdout only**: Scripts must output complete prompt to stdout; nothing to stderr
|
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
"PreToolUse": [
|
|
4
4
|
{
|
|
5
5
|
"matcher": "SendMessage",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/intercept-send-message.sh"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
10
12
|
}
|
|
11
13
|
],
|
|
12
14
|
"Stop": [
|
|
13
15
|
{
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/require-submit.sh"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
18
22
|
}
|
|
19
23
|
]
|
|
20
24
|
}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
# UserPromptSubmit hook: remind plan agent to delegate for large tasks.
|
|
3
3
|
if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import json, sys
|
|
7
|
-
print(json.dumps({'additionalContext': sys.stdin.read()}))
|
|
8
|
-
" <<'HINT'
|
|
5
|
+
cat <<'HINT'
|
|
9
6
|
<planning-reminder>
|
|
10
7
|
For particularly large or multi-domain tasks, delegate sub-plans to specialist agents rather than planning everything solo:
|
|
11
8
|
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
# UserPromptSubmit hook: remind spec agent to iterate with the user.
|
|
3
3
|
if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import json, sys
|
|
7
|
-
print(json.dumps({'additionalContext': sys.stdin.read()}))
|
|
8
|
-
" <<'HINT'
|
|
5
|
+
cat <<'HINT'
|
|
9
6
|
<spec-reminder>
|
|
10
7
|
Iterate with the user — include them in the process before writing anything to disk:
|
|
11
8
|
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"hooks": {
|
|
3
3
|
"UserPromptSubmit": [
|
|
4
4
|
{
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/user-prompt-context.sh"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
9
11
|
}
|
|
10
12
|
]
|
|
11
13
|
}
|