@yasaswy.nagavolu/agents 0.19.0 → 0.24.0
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/bin/cli.js +17 -0
- package/content/agents/execution-worker-subagent.md +3 -1
- package/content/agents/generic-purpose-subagent.md +3 -1
- package/content/agents/idea-agent/idea-council-subagent.md +1 -1
- package/content/agents/plan-agent/plan-council-subagent.md +1 -1
- package/content/agents/review-agent/architecture-diagram-council-subagent.md +1 -1
- package/content/agents/review-agent/review-council-subagent.md +1 -1
- package/content/agents/review-agent/visual-review-council-subagent.md +1 -1
- package/content/global/CLAUDE.md +6 -6
- package/content/global/hooks/project_hook.sh +79 -0
- package/content/global/keybindings.json +3 -1
- package/content/hooks/conclusion-scribe/conclusion_scribe_hook.py +8 -3
- package/content/hooks/tracker_proof_gate.py +7 -1
- package/content/manifest.json +38 -3
- package/content/manifest.schema.json +3 -3
- package/content/mods/handoff/.claude-plugin/plugin.json +7 -0
- package/content/mods/handoff/README.md +98 -0
- package/content/mods/handoff/hooks/hooks.json +4 -0
- package/content/mods/handoff/hooks/register.js +395 -0
- package/content/mods/handoff/lib/activework.mjs +15 -0
- package/content/mods/handoff/lib/auto.mjs +53 -0
- package/content/mods/handoff/lib/band.mjs +39 -0
- package/content/mods/handoff/lib/cache.mjs +40 -0
- package/content/mods/handoff/lib/clipboard.mjs +52 -0
- package/content/mods/handoff/lib/gitgate.mjs +42 -0
- package/content/mods/handoff/lib/keepwarm.mjs +191 -0
- package/content/mods/handoff/lib/policy.mjs +16 -0
- package/content/mods/handoff/lib/prep.mjs +30 -0
- package/content/mods/handoff/lib/sentinel.mjs +29 -0
- package/content/mods/handoff/lib/template.mjs +27 -0
- package/content/mods/handoff/lib/validate-cli.mjs +17 -0
- package/content/mods/handoff/lib/validate.mjs +43 -0
- package/content/mods/handoff/prompts/handoff-prep.md +12 -0
- package/content/mods/handoff/prompts/keepwarm-nudge.md +1 -0
- package/content/mods/handoff/tests/activework.test.mjs +26 -0
- package/content/mods/handoff/tests/auto.test.mjs +90 -0
- package/content/mods/handoff/tests/band.test.mjs +55 -0
- package/content/mods/handoff/tests/cache.test.mjs +45 -0
- package/content/mods/handoff/tests/clipboard.test.mjs +77 -0
- package/content/mods/handoff/tests/e2e/keepwarm_e2e.py +215 -0
- package/content/mods/handoff/tests/e2e/observer/.claude-plugin/plugin.json +1 -0
- package/content/mods/handoff/tests/e2e/observer/hooks/hooks.json +1 -0
- package/content/mods/handoff/tests/e2e/observer/hooks/register.js +33 -0
- package/content/mods/handoff/tests/e2e/run_e2e.py +191 -0
- package/content/mods/handoff/tests/e2e/run_real_prep.py +275 -0
- package/content/mods/handoff/tests/gitgate.test.mjs +150 -0
- package/content/mods/handoff/tests/keepwarm.test.mjs +340 -0
- package/content/mods/handoff/tests/policy.test.mjs +18 -0
- package/content/mods/handoff/tests/prep.test.mjs +40 -0
- package/content/mods/handoff/tests/register.test.mjs +1021 -0
- package/content/mods/handoff/tests/template.test.mjs +66 -0
- package/content/mods/handoff/tests/validate.test.mjs +121 -0
- package/content/proxy/README.md +3 -3
- package/content/proxy/agent_model_guard.py +1 -1
- package/content/proxy/handover_ledger_hook.py +3 -3
- package/content/proxy/headless_spawn_guard.py +142 -5
- package/content/proxy/route_lock.py +13 -0
- package/content/proxy/shared_worktree_revert_guard.py +12 -1
- package/content/proxy/switch_model.ps1 +2 -2
- package/content/skills/switch-model/README.md +2 -2
- package/content/skills/switch-model/SKILL.md +1 -1
- package/content/statusline/statusline-command.ps1 +63 -0
- package/content/statusline/subagent-statusline-command.ps1 +2 -3
- package/content/statusline/subagent-statusline-command.py +2 -3
- package/lib/fsutil.js +8 -2
- package/lib/install.js +22 -1
- package/lib/keybindingWiring.js +173 -0
- package/lib/modWiring.js +125 -0
- package/lib/uninstall.js +8 -0
- package/lib/update.js +19 -7
- package/lib/wiring.js +56 -10
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -296,6 +296,7 @@ function installOneBundle({ bundleKey, bundleTitle, targetDir, targetConfig, ite
|
|
|
296
296
|
if (result.hooksWired.length > 0) {
|
|
297
297
|
console.log(` ${mark('ok')} wired ${result.hooksWired.length} hook(s) into ${result.targetBase}/settings.json`);
|
|
298
298
|
}
|
|
299
|
+
printKeybindingReport(result);
|
|
299
300
|
if (result.settingsBackupFile) {
|
|
300
301
|
console.log(` ${mark()} backed up existing settings.json to ${result.settingsBackupFile} before this CLI's first write`);
|
|
301
302
|
}
|
|
@@ -347,6 +348,20 @@ function installOneBundle({ bundleKey, bundleTitle, targetDir, targetConfig, ite
|
|
|
347
348
|
* the only piece of the menu flow that isn't unit-testable without a TTY —
|
|
348
349
|
* everything it calls (planSelection, installBundle) is.
|
|
349
350
|
*/
|
|
351
|
+
function printKeybindingReport({ keybindingsWired = [], keybindingsKept = [], keybindingsSkipped = null, targetBase }) {
|
|
352
|
+
if (keybindingsWired.length > 0) {
|
|
353
|
+
const keys = keybindingsWired.map((r) => r.key).join(', ');
|
|
354
|
+
console.log(` ${mark('ok')} bound ${keys} in ${targetBase}/keybindings.json`);
|
|
355
|
+
}
|
|
356
|
+
for (const r of keybindingsKept) {
|
|
357
|
+
console.log(
|
|
358
|
+
` ${mark('skip')} kept your ${r.key} binding (${JSON.stringify(r.existing)}) in ${targetBase}/keybindings.json; ` +
|
|
359
|
+
`the bundle wants ${r.command}`
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
if (keybindingsSkipped) console.log(` ${mark('skip')} keybindings not wired: ${keybindingsSkipped}`);
|
|
363
|
+
}
|
|
364
|
+
|
|
350
365
|
/** "what landed where, what was skipped, next steps" — printed once after every
|
|
351
366
|
* requested bundle has been installed (or skipped/failed). */
|
|
352
367
|
function printFinalSummary({ installed, skipped, targetBase }) {
|
|
@@ -913,6 +928,8 @@ function summarizeBundleUpdate(b) {
|
|
|
913
928
|
if (b.unresolvedConflicts.length) parts.push(`${b.unresolvedConflicts.length} conflict(s) unresolved`);
|
|
914
929
|
if (b.hooksWired.length) parts.push(`${b.hooksWired.length} hook(s) rewired`);
|
|
915
930
|
if (b.mcpWired.length) parts.push(`${b.mcpWired.length} MCP server(s) rewired`);
|
|
931
|
+
if ((b.keybindingsWired || []).length) parts.push(`${b.keybindingsWired.length} keybinding(s) bound`);
|
|
932
|
+
if ((b.keybindingsKept || []).length) parts.push(`${b.keybindingsKept.length} keybinding(s) kept (yours differ)`);
|
|
916
933
|
return `Bundle "${b.bundle}": ${parts.join(', ') || 'no changes'}.`;
|
|
917
934
|
}
|
|
918
935
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: execution-worker-subagent
|
|
3
3
|
description: General-purpose worker subagent — handles any task (fix bugs, read docs, explore code, gather context, write files) with no domain restrictions.
|
|
4
|
-
model: claude-sonnet-5[1m]
|
|
4
|
+
model: claude-sonnet-5-5[1m]
|
|
5
|
+
effort: high
|
|
5
6
|
tools: ['Read', 'writeFile', 'Edit', 'Write', 'Bash', 'searchCode']
|
|
6
7
|
dispatch_tier: mandatory-review
|
|
7
8
|
user-invokable: false
|
|
@@ -62,4 +63,5 @@ reason: [specific blocker — missing file, ambiguous requirement, etc.]
|
|
|
62
63
|
- Never spawn sub-agents
|
|
63
64
|
- If files changed, always return `READY_TO_COMMIT`
|
|
64
65
|
- If only reading/researching, return `FINDINGS`
|
|
66
|
+
- After changing code that can be run, built, or type-checked, run a real check that exercises the change before reporting done
|
|
65
67
|
- Clean, minimal output — no padding, no repetition
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: generic-purpose-subagent
|
|
3
3
|
description: General-purpose Claude (Sonnet) worker subagent — writes code, docs, configs, and scripts; runs and fixes tests; does bulk edits and research gathering. Runs on the native Anthropic API.
|
|
4
|
-
model: claude-sonnet-5[1m]
|
|
4
|
+
model: claude-sonnet-5-5[1m]
|
|
5
|
+
effort: high
|
|
5
6
|
tools: ['Read', 'writeFile', 'Edit', 'Write', 'Bash', 'searchCode']
|
|
6
7
|
dispatch_tier: mandatory-review
|
|
7
8
|
user-invokable: false
|
|
@@ -66,4 +67,5 @@ reason: [specific blocker — missing file, ambiguous requirement, etc.]
|
|
|
66
67
|
- Never spawn sub-agents
|
|
67
68
|
- If files changed, always return `READY_TO_COMMIT`
|
|
68
69
|
- If only reading/researching, return `FINDINGS`
|
|
70
|
+
- After changing code that can be run, built, or type-checked, run a real check that exercises the change before reporting done
|
|
69
71
|
- Clean, minimal output — no padding, no repetition
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: idea-council-subagent
|
|
3
3
|
description: Five-panel idea council — fans out to four external LLM panels plus Claude's independent take, then synthesizes converging and diverging ideas.
|
|
4
|
-
model: claude-opus-5
|
|
4
|
+
model: claude-opus-5-5
|
|
5
5
|
tools: ['Bash']
|
|
6
6
|
dispatch_tier: safe
|
|
7
7
|
user-invokable: false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plan-council-subagent
|
|
3
3
|
description: Five-panel planning council — fans out to four external LLM planners plus Claude's independent plan, then synthesizes a consolidated implementation plan.
|
|
4
|
-
model: claude-opus-5
|
|
4
|
+
model: claude-opus-5-5
|
|
5
5
|
tools: ['Bash']
|
|
6
6
|
dispatch_tier: safe
|
|
7
7
|
user-invokable: false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: architecture-diagram-council-subagent
|
|
3
3
|
description: Reviews an architecture-diagram screenshot against the publish-article spec using external vision panels plus Claude's independent read, strict pass/fail verdict.
|
|
4
|
-
model: claude-opus-5
|
|
4
|
+
model: claude-opus-5-5
|
|
5
5
|
tools: ['Bash', 'Read']
|
|
6
6
|
dispatch_tier: mandatory-review
|
|
7
7
|
user-invokable: false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review-council-subagent
|
|
3
3
|
description: Five-panel code review council — fans out a diff to four external LLM reviewers plus Claude's independent review, then synthesizes critical/warning/nit findings and a verdict.
|
|
4
|
-
model: claude-opus-5
|
|
4
|
+
model: claude-opus-5-5
|
|
5
5
|
tools: ['Bash']
|
|
6
6
|
dispatch_tier: safe
|
|
7
7
|
user-invokable: false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: visual-review-council-subagent
|
|
3
3
|
description: Five-panel visual review council for 3D model decimation quality — strict before/after render comparison across external vision models plus Claude, rejecting on any major/critical finding.
|
|
4
|
-
model: claude-opus-5
|
|
4
|
+
model: claude-opus-5-5
|
|
5
5
|
tools: ['Bash', 'Read']
|
|
6
6
|
dispatch_tier: safe
|
|
7
7
|
user-invokable: false
|
package/content/global/CLAUDE.md
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
When making technical decisions, do not give much weight to development cost. Instead, prefer quality, simplicity, robustness, scalability, and long term maintainability.
|
|
4
4
|
When doing bug fixes, always start with reproducing the bug in an E2E setting as closely aligned with how an end user would experience it as possible. This makes sure you find the real problem so your fix will actually solve it.
|
|
5
5
|
Use git CLI for GitLab access, never glab — we use GitLab, not GitHub.
|
|
6
|
-
Always
|
|
7
|
-
Always track multi-step work with TaskCreate/TaskList/TaskUpdate (persistent across sessions), falling back to TodoWrite only if Task tools are unavailable — never printed markdown checklists.
|
|
6
|
+
Always track multi-step work with TaskCreate/TaskList/TaskUpdate (persistent across sessions), falling back to TodoWrite only if Task tools are unavailable — never printed markdown checklists. Maintain the TODO list and update the one PRD gitlab issue or the MR for that chat session.
|
|
8
7
|
When planning or modifying work, start a wayfinder map for anything too big for one session, and always mirror the TODO items in that work's PRD/issue ticket so it stays current.
|
|
9
8
|
Never `taskkill /F` or force-stop a shared daemon or another session's process — it can be serving other concurrent chats too (confirmed incident: killing the shared router mid-session broke every other active chat); restart it gracefully via its own scheduled task instead.
|
|
9
|
+
Never open a visible window or steal focus: every command, script, scheduled task, or browser I launch (PowerShell, cmd, terminals, `Start-Process`, `start`, `wt`, headed Playwright/Chrome) must run headless/hidden in the background (`-WindowStyle Hidden`/`-NoNewWindow`, `pythonw`, hidden task settings, headless browser) unless the founder explicitly asked to watch it; a popup that grabs focus is a defect (repeated, confirmed founder complaint).
|
|
10
10
|
Grill the operator once per new goal to lock scope and shared understanding; once scope is locked, execute autonomously end-to-end without re-confirming each step — grilling gates scope, not execution.
|
|
11
|
-
A new finding or one-off issue surfaced mid-task gets its own PRD/issue tracked separately — do not solve it inline in the same session; nudge the operator to open a new ticket instead.
|
|
12
11
|
Never open a git issue by yourself you need to explain the issue with complete context concisely in terms of customer facing functionality so user can take a decision if this is really an issue. User also want you to find out with thorough investigation if this is really an issue as the pending git issues spam is a real problem.
|
|
13
|
-
Default to plain, simple technical English (ASD-STE100 style) and concise bullets/tables/ASCII diagrams over prose paragraphs.
|
|
12
|
+
Default to plain, simple technical English (ASD-STE100 style) and concise bullets/tables/ASCII diagrams over prose paragraphs from the end user experience perspective for every response.
|
|
14
13
|
In any report to the user, state each result once — never repeat an item already covered earlier in the same response or session.
|
|
15
14
|
When a code bug/defect is mentioned or identified always update the description of the main PRD git issue of that chat session, with the entry in the TODO task list and the status of the fixes in the comments of the PRD git issue.
|
|
16
15
|
Always open a worktree from the latest code of the default branch into your own folder so the work does not clash with ongoing work and it is easy to maintain and push to the default branches. Before committing again make sure you pull the latest from default branch as well.
|
|
@@ -18,6 +17,7 @@ Keep code lean: no narrative comments in source (no dates, rulings, ticket refs,
|
|
|
18
17
|
Always clean up the idle agents after the agent reports or teammate finished and goes to idle state. Keep the TODO task list updated in the chat and PRD git issue.
|
|
19
18
|
The founder uses PowerShell (pwsh), not Git Bash. When giving the founder commands to run themselves, always write pwsh syntax and use the .ps1. This is the last resort if you can't execute and need help.
|
|
20
19
|
Always ship every code after test to the default branch and message other parallel chats in that repository to pull the latest this way code management is organized do not leave uncommitted files as you go along.
|
|
20
|
+
Be extremely proactive to take up the tasks from our pending list of tasks. Look for ways to wrap up the given task faster not staying with it for a while. Pick up another task parallely if you are waiting for an output from current task if it can be worked from our task list instead of waiting unless it is absolutely sequential.
|
|
21
21
|
|
|
22
22
|
## Model Routing (HARD RULE)
|
|
23
23
|
|
|
@@ -26,11 +26,11 @@ The main-loop model (Fable/Opus) is a scarce orchestration and planning resource
|
|
|
26
26
|
| Work | Who does it |
|
|
27
27
|
|---|---|
|
|
28
28
|
| Grilling, requirements, decisions, ADR judgments; architecture/planning/scaffolding/orchestration; adversarial review of subagent output | Fable/Opus, main loop |
|
|
29
|
-
| Writing code/HTML/docs/mocks/configs/scripts; running+fixing tests; bulk edits; research gathering | Sonnet subagent (`generic-purpose-subagent` / `execution-worker-subagent`, `model: "claude-sonnet-5[1m]"`) |
|
|
29
|
+
| Writing code/HTML/docs/mocks/configs/scripts; running+fixing tests; bulk edits; research gathering | Sonnet subagent (`generic-purpose-subagent` / `execution-worker-subagent`, `model: "claude-sonnet-5-5[1m]"`) |
|
|
30
30
|
|
|
31
31
|
Standalone non-Claude subagents (an agent whose entire multi-turn loop runs as a LiteLLM-routed model, e.g. old `litellm_glm`/`litellm_deepseek_flash` workers) are retired — see `docs/pure-claude-mode.md`. The only legitimate non-Claude LLM calls left are one-shot, Claude-wrapped: the idea/plan/review councils and the scribe's synthesis fallback shell out from Python to LiteLLM for a single completion, with Claude (main loop or the council subagent) driving the call and synthesizing the result — never a subagent whose own reasoning loop is a non-Claude model.
|
|
32
32
|
|
|
33
|
-
- Fan-out is the standing default, never a per-request instruction: anything not already in context (a new error, screenshot, log, file, ticket, git/AWS state) is looked up by a subagent that returns conclusions and saves them to one-brain; the main loop opens nothing itself except the one line a decision needs.
|
|
33
|
+
- Fan-out is the standing default, never a per-request instruction: anything not already in context (a new error, screenshot, log, file, ticket, git/AWS state) is looked up by a subagent that returns conclusions and saves them to one-brain; the main loop opens nothing itself except the one line a decision needs.
|
|
34
34
|
- Dispatch threshold: if the deliverable is > ~30 lines of file content, or > 2 mechanical steps (or any step whose raw output isn't needed verbatim for a decision), it goes to a worker subagent that returns conclusions only, never raw file dumps. Main loop holds only: reads needed for decisions, dispatch, review, and small edits to decision docs.
|
|
35
35
|
- On Agent/Task dispatch without a custom agent, always pass `model: "sonnet"` explicitly. The bare `model:` tool parameter is schema-restricted to `sonnet`/`opus`/`haiku`/`fable` for unregistered dispatch types (`Explore`, `general-purpose`, `claude`) — they have no agent-definition file for the harness to read a model from, so any non-Claude slug there fails tool-schema validation (confirmed in production 2026-07-05). To actually get GLM-5.2 (or another LiteLLM-routed model) running a generic-purpose-shaped dispatch, use a REGISTERED project-specific agent whose own frontmatter names that model (e.g. `generic-purpose-subagent`) — that path reads the model server-side from the agent file, not from this parameter. Custom agents that specify their own model override this table.
|
|
36
36
|
- Loop shape: Fable plans → a worker subagent executes → Fable adversarially reviews → return to user or re-instruct subagents.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Runs a project hook from the session cwd's repo, not the session-pinned CLAUDE_PROJECT_DIR.
|
|
3
|
+
# Usage: project_hook.sh <repo-relative or CLAUDE_PROJECT_DIR-absolute hook path> [args...]
|
|
4
|
+
payload="$(cat)"
|
|
5
|
+
|
|
6
|
+
find_python() {
|
|
7
|
+
for cand in python3 python py; do
|
|
8
|
+
cmd="$(command -v "$cand" 2>/dev/null)" || continue
|
|
9
|
+
"$cmd" -c "import sys" >/dev/null 2>&1 && { echo "$cmd"; return 0; }
|
|
10
|
+
done
|
|
11
|
+
return 1
|
|
12
|
+
}
|
|
13
|
+
py="$(find_python)"
|
|
14
|
+
|
|
15
|
+
hook_arg="$1"
|
|
16
|
+
shift
|
|
17
|
+
rel_hook="$hook_arg"
|
|
18
|
+
# Back-compat: an absolute path under CLAUDE_PROJECT_DIR reduces to its repo-relative part.
|
|
19
|
+
if [ -n "$CLAUDE_PROJECT_DIR" ]; then
|
|
20
|
+
case "$hook_arg" in
|
|
21
|
+
"$CLAUDE_PROJECT_DIR"/*) rel_hook="${hook_arg#"$CLAUDE_PROJECT_DIR"/}" ;;
|
|
22
|
+
esac
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
cwd=""
|
|
26
|
+
[ -n "$py" ] && cwd="$(printf '%s' "$payload" | "$py" -c 'import json,sys; print(json.load(sys.stdin).get("cwd",""))' 2>/dev/null)"
|
|
27
|
+
|
|
28
|
+
has_hook() { [ -n "$1" ] && [ -f "$1/$2" ]; }
|
|
29
|
+
|
|
30
|
+
target_dir=""
|
|
31
|
+
if [ -n "$cwd" ]; then
|
|
32
|
+
# A cwd inside a submodule resolves to its superproject, which owns .claude/hooks.
|
|
33
|
+
super="$(git -C "$cwd" rev-parse --show-superproject-working-tree 2>/dev/null)"
|
|
34
|
+
top="$(git -C "$cwd" rev-parse --show-toplevel 2>/dev/null)"
|
|
35
|
+
if has_hook "$super" "$rel_hook"; then target_dir="$super"
|
|
36
|
+
elif has_hook "$top" "$rel_hook"; then target_dir="$top"
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
[ -n "$target_dir" ] || { has_hook "$CLAUDE_PROJECT_DIR" "$rel_hook" && target_dir="$CLAUDE_PROJECT_DIR"; }
|
|
40
|
+
|
|
41
|
+
if [ -z "$target_dir" ]; then
|
|
42
|
+
echo "project_hook.sh: hook '$rel_hook' not found under cwd repo or CLAUDE_PROJECT_DIR; NOT executed" >&2
|
|
43
|
+
exit 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
hook_path="$target_dir/$rel_hook"
|
|
47
|
+
run_python_sh="$target_dir/.claude/hooks/run_python.sh"
|
|
48
|
+
|
|
49
|
+
case "$hook_path" in
|
|
50
|
+
*.py)
|
|
51
|
+
if [ -f "$run_python_sh" ]; then
|
|
52
|
+
printf '%s' "$payload" | sh "$run_python_sh" "$hook_path" "$@"
|
|
53
|
+
exit $?
|
|
54
|
+
fi
|
|
55
|
+
if [ -n "$py" ]; then
|
|
56
|
+
printf '%s' "$payload" | "$py" "$hook_path" "$@"
|
|
57
|
+
exit $?
|
|
58
|
+
fi
|
|
59
|
+
echo "project_hook.sh: no python interpreter to run '$hook_path'; NOT executed" >&2
|
|
60
|
+
exit 0
|
|
61
|
+
;;
|
|
62
|
+
*.sh)
|
|
63
|
+
printf '%s' "$payload" | sh "$hook_path" "$@"
|
|
64
|
+
exit $?
|
|
65
|
+
;;
|
|
66
|
+
*.ps1)
|
|
67
|
+
pwsh_cmd="$(command -v pwsh 2>/dev/null || command -v powershell 2>/dev/null)"
|
|
68
|
+
if [ -z "$pwsh_cmd" ]; then
|
|
69
|
+
echo "project_hook.sh: no pwsh/powershell to run '$hook_path'; NOT executed" >&2
|
|
70
|
+
exit 0
|
|
71
|
+
fi
|
|
72
|
+
printf '%s' "$payload" | "$pwsh_cmd" -NoProfile -File "$hook_path" "$@"
|
|
73
|
+
exit $?
|
|
74
|
+
;;
|
|
75
|
+
*)
|
|
76
|
+
printf '%s' "$payload" | "$hook_path" "$@"
|
|
77
|
+
exit $?
|
|
78
|
+
;;
|
|
79
|
+
esac
|
|
@@ -106,6 +106,11 @@ except ImportError:
|
|
|
106
106
|
def get_secret(name, default=None, base=None, project_root=None): # noqa: ARG001
|
|
107
107
|
return os.environ.get(name, default)
|
|
108
108
|
|
|
109
|
+
try:
|
|
110
|
+
from headless_process import headless_popen, headless_run # noqa: E402
|
|
111
|
+
except ImportError:
|
|
112
|
+
headless_run, headless_popen = subprocess.run, subprocess.Popen
|
|
113
|
+
|
|
109
114
|
# project_resolver.py (proxy/) is the shared GitLab-slug resolver -- see that
|
|
110
115
|
# module's docstring. Aliased back to this file's original underscored names
|
|
111
116
|
# so every call site below is unchanged; degrades to no-op fallbacks for the
|
|
@@ -261,7 +266,7 @@ def _head_sha(cwd: str | None) -> str | None:
|
|
|
261
266
|
if not cwd:
|
|
262
267
|
return None
|
|
263
268
|
try:
|
|
264
|
-
proc =
|
|
269
|
+
proc = headless_run(
|
|
265
270
|
["git", "-C", cwd, "rev-parse", "--short=12", "HEAD"],
|
|
266
271
|
capture_output=True, text=True, timeout=5,
|
|
267
272
|
)
|
|
@@ -810,7 +815,7 @@ def _haiku_summarize(text: str) -> tuple[str | None, str | None]:
|
|
|
810
815
|
fh.write('{"hooks":{}}')
|
|
811
816
|
env = os.environ.copy()
|
|
812
817
|
env["CLAUDE_HOOK_CHILD"] = "1"
|
|
813
|
-
proc =
|
|
818
|
+
proc = headless_run(
|
|
814
819
|
[claude_exe, "-p", "--model", HAIKU_MODEL, "--settings", tmp_settings],
|
|
815
820
|
input=prompt, capture_output=True, text=True,
|
|
816
821
|
timeout=HAIKU_TIMEOUT_SECONDS, env=env,
|
|
@@ -864,7 +869,7 @@ def _spawn_prose_worker(key: str, entry: dict, text: str, tags: list[str]) -> No
|
|
|
864
869
|
kwargs["creationflags"] = DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP
|
|
865
870
|
else:
|
|
866
871
|
kwargs["start_new_session"] = True
|
|
867
|
-
|
|
872
|
+
headless_popen(
|
|
868
873
|
[sys.executable, str(Path(__file__).resolve()), "--finish-worker", state_path],
|
|
869
874
|
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
|
870
875
|
close_fds=True, **kwargs,
|
|
@@ -37,6 +37,12 @@ import re
|
|
|
37
37
|
import subprocess
|
|
38
38
|
from pathlib import Path
|
|
39
39
|
|
|
40
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "proxy"))
|
|
41
|
+
try:
|
|
42
|
+
from headless_process import headless_run
|
|
43
|
+
except ImportError:
|
|
44
|
+
headless_run = subprocess.run
|
|
45
|
+
|
|
40
46
|
_BASE_ROOT = None
|
|
41
47
|
for _candidate in (Path(__file__).resolve().parent, Path(__file__).resolve().parent.parent):
|
|
42
48
|
if (_candidate / "proxy" / "project_resolver.py").exists():
|
|
@@ -144,7 +150,7 @@ def _repo_root() -> Path:
|
|
|
144
150
|
def _check_tasklist(slug: str, iid: int) -> dict:
|
|
145
151
|
"""Raises on any failure -- caller wraps this in the fail-open try/except."""
|
|
146
152
|
script = _repo_root() / "scripts" / "gitlab_api.py"
|
|
147
|
-
proc =
|
|
153
|
+
proc = headless_run(
|
|
148
154
|
[sys.executable, str(script), "check-tasklist", "--iid", str(iid), "--project", slug],
|
|
149
155
|
capture_output=True, text=True, timeout=20,
|
|
150
156
|
)
|
package/content/manifest.json
CHANGED
|
@@ -672,6 +672,12 @@
|
|
|
672
672
|
"command": "python ~/.claude/hooks/permission_mode_guard.py"
|
|
673
673
|
}
|
|
674
674
|
},
|
|
675
|
+
{
|
|
676
|
+
"path": "global/hooks/project_hook.sh",
|
|
677
|
+
"targetPath": "hooks/project_hook.sh",
|
|
678
|
+
"kind": "hook",
|
|
679
|
+
"note": "No wiring of its own -- a project's own settings.json calls it directly (e.g. `sh ~/.claude/hooks/project_hook.sh .claude/hooks/<hook>.py`) so a hook still runs after CLAUDE_PROJECT_DIR goes stale (worktree/EnterWorktree moves). See global/hooks/README.md."
|
|
680
|
+
},
|
|
675
681
|
{
|
|
676
682
|
"path": "global/rules/context7.md",
|
|
677
683
|
"targetPath": "rules/context7.md",
|
|
@@ -694,7 +700,8 @@
|
|
|
694
700
|
"wiring": {
|
|
695
701
|
"settingsKey": "statusLine",
|
|
696
702
|
"type": "command",
|
|
697
|
-
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File ~/.claude/statusline-command.ps1"
|
|
703
|
+
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File ~/.claude/statusline-command.ps1",
|
|
704
|
+
"refreshInterval": 30
|
|
698
705
|
}
|
|
699
706
|
},
|
|
700
707
|
{
|
|
@@ -778,7 +785,7 @@
|
|
|
778
785
|
{
|
|
779
786
|
"path": "proxy/headless_spawn_guard.py",
|
|
780
787
|
"kind": "infra",
|
|
781
|
-
"note": "Registered PreToolUse Bash|PowerShell hook in settings.json, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow)."
|
|
788
|
+
"note": "Registered PreToolUse Bash|PowerShell hook in settings.json, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow, -Verb RunAs, wt, GUI apps, non-headless browsers, playwright --headed/headless=False); escape hatch is ALLOW_VISIBLE_WINDOW=1 or the time-boxed ~/.claude/.allow_visible_window.json marker (--allow-visible CLI), html-mocker/mocker.py allowlisted."
|
|
782
789
|
},
|
|
783
790
|
{
|
|
784
791
|
"path": "proxy/headless_process.py",
|
|
@@ -1236,7 +1243,7 @@
|
|
|
1236
1243
|
"path": "global/keybindings.json",
|
|
1237
1244
|
"targetPath": "keybindings.json",
|
|
1238
1245
|
"kind": "rule",
|
|
1239
|
-
"note": "Unbinds shift+tab (chat:cycleMode) so a stray keystroke can never flip a bypassPermissions session into plan/default mode mid-session (exiting plan mode never restores bypass — incident 2026-08-25); deliberate mode cycling moves to the ctrl+x m chord."
|
|
1246
|
+
"note": "Unbinds shift+tab (chat:cycleMode) so a stray keystroke can never flip a bypassPermissions session into plan/default mode mid-session (exiting plan mode never restores bypass — incident 2026-08-25); deliberate mode cycling moves to the ctrl+x m chord. Also binds meta+h and ctrl+x h to command:handoff (the handoff mod's /handoff); the public handoff bundle merges the same two bindings, so a machine with both bundles reports no conflict."
|
|
1240
1247
|
}
|
|
1241
1248
|
],
|
|
1242
1249
|
"deps": [],
|
|
@@ -1302,6 +1309,33 @@
|
|
|
1302
1309
|
],
|
|
1303
1310
|
"deps": [],
|
|
1304
1311
|
"secrets": []
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
"key": "handoff",
|
|
1315
|
+
"title": "Handoff",
|
|
1316
|
+
"summary": "One-click session handoff mod: Alt+H, a band above the prompt or /handoff prepares the work, verifies a lean handoff file, clears the session and submits the handoff as the first message; auto-handoff at 65% context (toggle on the band, /handoff auto); a keep-warm nudge (/keepwarm) keeps an idle session's prompt cache warm. Needs Claude Code 2.1.287 or later (mods are early access)",
|
|
1317
|
+
"profile": "public",
|
|
1318
|
+
"advanced": false,
|
|
1319
|
+
"items": [
|
|
1320
|
+
{
|
|
1321
|
+
"path": "mods/handoff",
|
|
1322
|
+
"targetPath": "mods/handoff",
|
|
1323
|
+
"kind": "mod",
|
|
1324
|
+
"exclude": ["tests/"],
|
|
1325
|
+
"wiring": {
|
|
1326
|
+
"env": "CLAUDE_CODE_PLUGIN_DIRS",
|
|
1327
|
+
"keybindings": {
|
|
1328
|
+
"context": "Chat",
|
|
1329
|
+
"bindings": {
|
|
1330
|
+
"meta+h": "command:handoff",
|
|
1331
|
+
"ctrl+x h": "command:handoff"
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
],
|
|
1337
|
+
"deps": [],
|
|
1338
|
+
"secrets": []
|
|
1305
1339
|
}
|
|
1306
1340
|
],
|
|
1307
1341
|
"internal": [
|
|
@@ -1309,6 +1343,7 @@
|
|
|
1309
1343
|
"agents/lint_agent_tools.py",
|
|
1310
1344
|
"agents/test_lint_agent_tools.py",
|
|
1311
1345
|
"agents/README.md",
|
|
1346
|
+
"global/hooks/README.md",
|
|
1312
1347
|
"proxy/agent_env_inject_hook.py",
|
|
1313
1348
|
"agents/scribe-subagent.agent.md.retired",
|
|
1314
1349
|
"mcps/install.ps1",
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
},
|
|
102
102
|
"kind": {
|
|
103
103
|
"type": "string",
|
|
104
|
-
"enum": ["skill", "agent", "hook", "command", "mcp", "rule", "statusline", "infra", "setting"],
|
|
105
|
-
"description": "\"infra\" (added npx distribution slice #28) tags a self-profile-only proxy asset that is deployed but never registered as a settings.json hook event — a daemon script, PowerShell launcher, or config/asset directory (e.g. claude_router.py, litellm/config.yaml, portal/). \"hook\" stays reserved for items that either carry a wiring block or are a shared library a wired hook imports (see agents_env.py's existing convention). \"setting\" (added npx distribution slice #29) tags a declarative-only item that sets one plain top-level settings.json key ({settingsKey, value} wiring) with no file of its own to install — `path` typically points at a real file another item in the same bundle already claims/copies (e.g. the hook whose behavior the setting complements), purely to satisfy prepack.js's \"every claimed path must exist\" staging check; it is never independently copied (see install.js's file-copy loop, which skips kind:\"setting\" the same way it skips kind:\"mcp\")."
|
|
104
|
+
"enum": ["skill", "agent", "hook", "command", "mcp", "rule", "statusline", "infra", "setting", "mod"],
|
|
105
|
+
"description": "\"infra\" (added npx distribution slice #28) tags a self-profile-only proxy asset that is deployed but never registered as a settings.json hook event — a daemon script, PowerShell launcher, or config/asset directory (e.g. claude_router.py, litellm/config.yaml, portal/). \"hook\" stays reserved for items that either carry a wiring block or are a shared library a wired hook imports (see agents_env.py's existing convention). \"setting\" (added npx distribution slice #29) tags a declarative-only item that sets one plain top-level settings.json key ({settingsKey, value} wiring) with no file of its own to install — `path` typically points at a real file another item in the same bundle already claims/copies (e.g. the hook whose behavior the setting complements), purely to satisfy prepack.js's \"every claimed path must exist\" staging check; it is never independently copied (see install.js's file-copy loop, which skips kind:\"setting\" the same way it skips kind:\"mcp\"). \"mod\" tags a Claude Code mod (plugin with a hooks module) copied to targetPath like a skill directory; its deployed directory is also added to settings.json env.CLAUDE_CODE_PLUGIN_DIRS (packages/cli/lib/modWiring.js), the sideload path that loads while the installed-plugin rollout flag is off. A mod's wiring may also carry keybindings: {context, bindings:{<key>: <command>}}, merged into <target>/keybindings.json by packages/cli/lib/keybindingWiring.js (absent keys appended to the context block, existing user bindings kept and reported, uninstall removes only what was added)."
|
|
106
106
|
},
|
|
107
107
|
"wiring": {
|
|
108
|
-
"description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout]} mirroring the settings.json shape documented in proxy/README.md — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command}. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; statusline wiring
|
|
108
|
+
"description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout]} mirroring the settings.json shape documented in proxy/README.md — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command[, refreshInterval]} — the whole object minus settingsKey is the settings.json value, `command` resolved like a hook command. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; on kind:\"statusline\" items whose wiring carries {settingsKey, type, command} (same executor; an existing statusLine whose command runs a different script is left alone, and unrelated keys inside the object are preserved).",
|
|
109
109
|
"oneOf": [
|
|
110
110
|
{ "type": "object" },
|
|
111
111
|
{ "type": "array", "items": { "type": "object" }, "minItems": 1 }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "handoff",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "One-click session handoff: prepares the work, writes a lean handoff file, verifies it, clears the session and submits the handoff as the first message",
|
|
5
|
+
"author": { "name": "Yasaswy Nagavolu" },
|
|
6
|
+
"metadata": { "minClaudeCodeVersion": "2.1.287" }
|
|
7
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# handoff mod
|
|
2
|
+
|
|
3
|
+
One click hands the session off to a fresh one without losing the plan. A keep-warm nudge keeps
|
|
4
|
+
an unattended session's prompt cache warm. Needs Claude Code 2.1.287 or later (mods are early access).
|
|
5
|
+
|
|
6
|
+
## Handoff
|
|
7
|
+
|
|
8
|
+
- One line above the prompt always shows: `Alt+H to hand off` (dim), a `Handoff` button and an
|
|
9
|
+
`auto 65%: on` toggle button. No cache or context text: the status line already shows both.
|
|
10
|
+
While a turn runs the hint reads `Alt+H to hand off (waits for the current turn)`.
|
|
11
|
+
- Start it with one of these. All run the same flow.
|
|
12
|
+
|
|
13
|
+
| Input | Does |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `Alt+H` | Starts the handoff at once. No Enter. Needs the keybindings below |
|
|
16
|
+
| `Ctrl+X H` | Same as `Alt+H` (fallback for terminals that eat Alt+letter) |
|
|
17
|
+
| click `Handoff` | Same |
|
|
18
|
+
| `/handoff` | Same |
|
|
19
|
+
| `Ctrl+X Tab`, then `h` | Focus the band, then press the Handoff button |
|
|
20
|
+
| `Ctrl+X Tab`, then `a` | Focus the band, then flip the auto toggle |
|
|
21
|
+
| `/handoff auto on\|off\|status` | Auto-handoff setting |
|
|
22
|
+
|
|
23
|
+
- `Alt+H` and `Ctrl+X H` are Chat keybindings in `~/.claude/keybindings.json`: `"meta+h": "command:handoff"`, `"ctrl+x h": "command:handoff"`.
|
|
24
|
+
The `handoff` bundle merges them for you: it creates the file if missing, appends to your `Chat` block, never reorders or edits other bindings.
|
|
25
|
+
A key you already bind (even to `null`) is kept and reported; set a key to `null` to opt out. Uninstall removes only the lines it added and you did not change.
|
|
26
|
+
- macOS: Alt/Option must send Meta for `Alt+H` (Terminal: Use Option as Meta Key; iTerm2: Left Option = Esc+). Otherwise use `Ctrl+X H`.
|
|
27
|
+
- A half-typed prompt draft stays in the prompt box and is never sent. If a handoff already runs, the
|
|
28
|
+
chord shows the toast `handoff already running (<phase>)` and starts nothing.
|
|
29
|
+
- Busy chat (a turn runs, a user prompt waits, or a nudge is in flight): the handoff queues. The band reads
|
|
30
|
+
`Handoff queued: waiting for the current turn to finish...` with a `Cancel` button. The prep prompt is submitted
|
|
31
|
+
when the turn ends (or at the next keep-warm tick), after the running-work gate runs again.
|
|
32
|
+
- The prep prompt opens with `[Handoff prep - this is not the handoff itself]` and a one-line note, so the
|
|
33
|
+
chat shows it is not the handoff. The label is added by code (`lib/prep.mjs`), not by the prompt file.
|
|
34
|
+
- The prep reply is the turn whose start text carries that label and this session's handoff path; only its turn id
|
|
35
|
+
is scored, so an earlier queued message or nudge cannot cause "no HANDOFF_READY line". A prep that never starts aborts after 30 min.
|
|
36
|
+
- Phase A: `prompts/handoff-prep.md` syncs tasks and PRD, fixes docs, runs tests, commits and pushes,
|
|
37
|
+
writes `~/.claude/handoffs/<session_id>.md`, then prints `HANDOFF_READY <path>` or `HANDOFF_ABORT <reason>`.
|
|
38
|
+
- Phase B (turn complete): sentinel, `lib/validate.mjs`, git gate (`lib/gitgate.mjs`), running-work gate.
|
|
39
|
+
Only then: clipboard, `/clear`, submit the handoff. Any failed check keeps the session and the file.
|
|
40
|
+
- Git gate: no dirty tracked files, and nothing unpushed. With an upstream it counts `@{upstream}..HEAD`.
|
|
41
|
+
Without one (or on a detached HEAD) it counts commits not on the remote default branch (`origin/HEAD`,
|
|
42
|
+
else `origin/main`, else `origin/master`). A repo with a remote but no resolvable default branch aborts;
|
|
43
|
+
a repo with no remote, or no repo at all, passes.
|
|
44
|
+
- Running-work gate: before Phase A and again before `/clear`, the mod counts running subagents (`$.agent.list()`, live) and background
|
|
45
|
+
tasks (the `background_tasks` of the last `classic.Stop`, a snapshot: if stale, send any message and retry). Any running work aborts with a
|
|
46
|
+
toast and log line; it never stops anything. Step 0 of `prompts/handoff-prep.md` also tells the model not to go on.
|
|
47
|
+
|
|
48
|
+
## Auto-handoff
|
|
49
|
+
|
|
50
|
+
- On by default. When context is at 65% or more and the chat is idle, the mod runs the same flow as `Alt+H`
|
|
51
|
+
(same git gate, running-work gate and validator) and shows the toast `Auto-handoff: context is at N% ...`.
|
|
52
|
+
- Idle means: no running turn, no user prompt waiting, no nudge in flight, no handoff running, and an
|
|
53
|
+
empty prompt box. A busy chat defers to the next idle tick (15 s). Unknown context never fires.
|
|
54
|
+
- After an auto run aborts, auto waits until context has grown 5 points past the level at the abort. A new
|
|
55
|
+
session (context back under 65%) clears this. Manual `Alt+H` or a click always works. One run at a time.
|
|
56
|
+
- The toggle button or `/handoff auto on|off|status` flips it. The value is saved with `$.store` (key `auto`,
|
|
57
|
+
file `~/.claude/plugins/store/handoff_inline-*.json`), read at each session start.
|
|
58
|
+
|
|
59
|
+
## Keep-warm
|
|
60
|
+
|
|
61
|
+
- On by default each session. `/keepwarm on|off|status`. No status-bar marker.
|
|
62
|
+
- When the main chat is idle, no handoff runs, and the cache has 1 to 75 s left, the mod submits
|
|
63
|
+
`prompts/keepwarm-nudge.md`. Max 6 in a row; a real user prompt resets the count.
|
|
64
|
+
- A nudge is never sent while a user prompt waits for its turn to start, within 3 s of any turn end,
|
|
65
|
+
or while the prompt box holds text (checked again right before the submit).
|
|
66
|
+
- The nudge reply is the turn whose start text carries the nudge marker; its turn id is the only turn
|
|
67
|
+
scored. A user turn that ends while a nudge is in flight is never scored as the nudge reply.
|
|
68
|
+
- At context 90% or more it skips and toasts "hand off now".
|
|
69
|
+
- The reply ends with `KEEPWARM_STATUS: idle|working|blocked` (tolerant of case and markdown, last 5 lines).
|
|
70
|
+
Idle with no tool calls and nothing running pauses; blocked pauses with a toast; otherwise it continues.
|
|
71
|
+
A missing line pauses only when no tools ran and nothing is running. The cap is the final backstop.
|
|
72
|
+
|
|
73
|
+
## Platforms
|
|
74
|
+
|
|
75
|
+
Windows, macOS, Linux. Only the optional clipboard copy differs, and a missing tool never fails a handoff (file, `/clear`, submit still happen).
|
|
76
|
+
|
|
77
|
+
| Platform | Copy after the terminal copy (`$.ui.copy`) fails |
|
|
78
|
+
|---|---|
|
|
79
|
+
| Windows | PowerShell `Set-Clipboard` on the handoff file |
|
|
80
|
+
| macOS | `pbcopy` |
|
|
81
|
+
| Linux | `wl-copy`, then `xclip`, then `xsel` |
|
|
82
|
+
|
|
83
|
+
- Platform: `OS` variable (Windows), else `uname -s`. Home: `USERPROFILE`, else `HOME`. Process calls are argument vectors via the host (no shell except `sh -c` to silence Linux tools). Needs `git` and `node` on `PATH`.
|
|
84
|
+
- Keep-warm reads `~/.claude/.cache_state/<session>.json`, written only by a status line script (the mods API does not expose it); without it keep-warm stays inert, handoff still works.
|
|
85
|
+
|
|
86
|
+
## Files
|
|
87
|
+
|
|
88
|
+
| Path | Role |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `hooks/register.js` | The one hooks module (the loader allows one): command, band, keep-warm, flow |
|
|
91
|
+
| `lib/*.mjs`, `prompts/*.md` | Pure logic (policy, auto, cache, keepwarm, validate, sentinel, template, gates, prep, band, clipboard); prep and nudge prompts |
|
|
92
|
+
| `tests/` | `node --test "mods/handoff/tests/*.test.mjs"`; `tests/e2e/*.py` headless proof with `claude -p` |
|
|
93
|
+
|
|
94
|
+
## Notes
|
|
95
|
+
|
|
96
|
+
- Overrides: `HANDOFF_DIR`, `HANDOFF_AUTO_PERCENT` (auto threshold, test use), `KEEPWARM_CONFIG`, `KEEPWARM_CACHE_DIR`, `KEEPWARM_WINDOW_MS`, `KEEPWARM_TICK_MS`.
|
|
97
|
+
- The loader checks statically: one hooks module, no `$` passed across files, literal names in env reads.
|
|
98
|
+
- After a Claude Code upgrade: `claude plugin validate mods/handoff --strict`.
|