sisyphi 1.0.6 → 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.
@@ -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
- "hook": {
7
- "type": "command",
8
- "command": "bash hooks/intercept-send-message.sh"
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
- "hook": {
15
- "type": "command",
16
- "command": "bash hooks/require-submit.sh"
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
  }
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ # UserPromptSubmit hook: remind plan agent to delegate for large tasks.
3
+ if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
4
+
5
+ cat <<'HINT'
6
+ <planning-reminder>
7
+ For particularly large or multi-domain tasks, delegate sub-plans to specialist agents rather than planning everything solo:
8
+
9
+ - Spawn parallel Plan agents, each focused on a specific domain or layer
10
+ - Each sub-planner investigates deeply and saves their work to context/plan-{topic}-{slice}.md
11
+ - Synthesize their outputs into one cohesive master plan: resolve file ownership conflicts, fill gaps between slices, stress-test cross-cutting edge cases
12
+ - Then spawn review agents to critique the assembled plan before finalizing
13
+
14
+ Default toward delegation when in doubt — a round-trip for synthesis is cheaper than a shallow plan that misses edge cases. The cost of spawning sub-planners is low; the cost of a surface-level plan across too many concerns is high.
15
+ </planning-reminder>
16
+ HINT
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # UserPromptSubmit hook: remind spec agent to iterate with the user.
3
+ if [ -z "$SISYPHUS_SESSION_ID" ]; then exit 0; fi
4
+
5
+ cat <<'HINT'
6
+ <spec-reminder>
7
+ Iterate with the user — include them in the process before writing anything to disk:
8
+
9
+ - Present your findings and a concrete proposal with your reasoning
10
+ - Surface specific, substantive questions that need human input:
11
+ Bad: "What should happen on error?"
12
+ Good: "If the API returns a 429, should we retry with backoff or surface the rate limit to the user?"
13
+ - Share your perspective: what's clear, what's open, what you'd lean toward and why
14
+ - Wait for the user to respond and incorporate their answers before proceeding
15
+ - The spec is only written after user sign-off on the direction
16
+
17
+ Ambiguity can be technical, architectural, or design-related. Don't skip design questions just because they aren't code.
18
+ </spec-reminder>
19
+ HINT
@@ -2,10 +2,12 @@
2
2
  "hooks": {
3
3
  "UserPromptSubmit": [
4
4
  {
5
- "hook": {
6
- "type": "command",
7
- "command": "bash hooks/user-prompt-context.sh"
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
  }
@@ -1,5 +1,9 @@
1
1
  # Planning Phase
2
2
 
3
+ ## Planning Phase Flow
4
+
5
+ The natural sequence: **context → spec → roadmap refinement → detailed planning.** Context documents come first because they feed everything downstream — spec writers, planners, and implementers all benefit from not having to re-explore the codebase. After the spec is aligned, revisit the roadmap — that's when you actually understand scope well enough to flesh out phases honestly.
6
+
3
7
  ## Exploration
4
8
 
5
9
  Use explore agents to build understanding before making decisions. Each agent should save a focused context document to `.sisyphus/sessions/$SISYPHUS_SESSION_ID/context/` — these artifacts get passed to downstream agents so they don't have to re-explore the codebase themselves.
@@ -23,6 +27,10 @@ For significant features, spec refinement is iterative:
23
27
 
24
28
  Not every stage needs a standalone spec document — a well-defined stage might just be a detailed section in the implementation plan. Use judgment about how much formality each stage warrants.
25
29
 
30
+ ## Roadmap Refinement
31
+
32
+ Once you have context docs and an aligned spec, revisit the roadmap. This is the first point where you understand real scope — adjust phase boundaries, add phases you didn't anticipate, reorder for dependencies. Keep future phases at outline level; just make sure the shape is honest.
33
+
26
34
  ## Delegating to the Plan Lead
27
35
 
28
36
  Spawn **one plan lead** per feature. Point it at **inputs** (spec, context docs, corrections) — not a pre-made structure. Don't pre-decide staging, ordering, or design decisions. The plan lead has `effort: max` reasoning and handles its own decomposition: it will assess scope, delegate sub-plans to specialist agents if the feature is large enough, run adversarial reviews on the result, and deliver a synthesized master plan.
package/dist/tui.js CHANGED
@@ -720,7 +720,7 @@ function buildLines(session, planContent, goalContent, _logsContent, width, pane
720
720
  lines.push([
721
721
  seg(" "),
722
722
  seg(" \u2715 DEAD ", { color: "red", bold: true }),
723
- seg(" tmux window closed \u2014 kill or resume", { color: "red" })
723
+ seg(" tmux window closed \u2014 [w] reopen [R] resume", { color: "red" })
724
724
  ]);
725
725
  }
726
726
  if (conflicts.length > 0) {
@@ -2576,12 +2576,29 @@ function App({ cwd: cwd2 }) {
2576
2576
  },
2577
2577
  // kill moved to leader menu (space k)
2578
2578
  onGoToWindow: () => {
2579
- if (!session?.tmuxWindowId) {
2580
- notify("No tmux window");
2579
+ if (!session || !selectedSessionId) {
2580
+ notify("No session selected");
2581
+ return;
2582
+ }
2583
+ if (paneAlive && session.tmuxWindowId) {
2584
+ if (session.tmuxSessionName) switchToSession(session.tmuxSessionName);
2585
+ selectWindow(session.tmuxWindowId);
2581
2586
  return;
2582
2587
  }
2583
- if (session.tmuxSessionName) switchToSession(session.tmuxSessionName);
2584
- selectWindow(session.tmuxWindowId);
2588
+ void (async () => {
2589
+ try {
2590
+ const res = await send({ type: "reopen-window", sessionId: selectedSessionId, cwd: cwd2 });
2591
+ if (!res.ok) {
2592
+ notify(`Error: ${res.error}`);
2593
+ return;
2594
+ }
2595
+ const data = res.data;
2596
+ switchToSession(data.tmuxSessionName);
2597
+ selectWindow(data.tmuxWindowId);
2598
+ } catch (err) {
2599
+ notify(`Error: ${err.message}`);
2600
+ }
2601
+ })();
2585
2602
  },
2586
2603
  onEditGoal: () => {
2587
2604
  if (!selectedSessionId) {