claude-context-auto-handoff 1.0.2 → 1.0.4
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/.claude-plugin/plugin.json +1 -1
- package/build/index.js +7 -7
- package/hooks/hooks.json +6 -3
- package/package.json +2 -1
- package/skills/handoff/SKILL.md +37 -0
- package/skills/resume/SKILL.md +16 -0
package/build/index.js
CHANGED
|
@@ -17,15 +17,15 @@ server.tool('generate_handoff_manifest', {
|
|
|
17
17
|
failedApproaches: z.array(z.string()).optional().describe('Already-failed attempts. Format each: "Approach: X → Result: Y → Lesson: Z". Prevents repeating mistakes. Write in English.'),
|
|
18
18
|
blockers: z.string().optional().describe('Unresolved errors or blockers. Write in English.'),
|
|
19
19
|
modifiedFiles: z.array(z.string()).optional().describe('Changed files with delta notes. Format: "path/to/file: what changed" — NO code snippets, path+delta only.'),
|
|
20
|
-
implicitRules: z.array(z.string()).optional().describe('Tech stack, naming conventions, env vars, implicit project rules — anything not derivable from reading code. Write in English.')
|
|
21
|
-
|
|
20
|
+
implicitRules: z.array(z.string()).optional().describe('Tech stack, naming conventions, env vars, implicit project rules — anything not derivable from reading code. Write in English.'),
|
|
21
|
+
workingDirectory: z.string().optional().describe('Absolute path to the project root where handoff.md should be written. Required on Windows where process.cwd() may return System32.')
|
|
22
|
+
}, async ({ summary, nextSteps, taskDescription, currentStatus, keyDecisions, failedApproaches, blockers, modifiedFiles, implicitRules, workingDirectory }) => {
|
|
22
23
|
try {
|
|
23
|
-
const
|
|
24
|
+
const projectRoot = workingDirectory || process.env['CLAUDE_PROJECT_DIR'] || process.cwd();
|
|
25
|
+
const claudeDir = path.join(projectRoot, '.claude');
|
|
24
26
|
const handoffsDir = path.join(claudeDir, 'handoffs');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (!fs.existsSync(handoffsDir))
|
|
28
|
-
fs.mkdirSync(handoffsDir, { recursive: true });
|
|
27
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
28
|
+
fs.mkdirSync(handoffsDir, { recursive: true });
|
|
29
29
|
const now = new Date();
|
|
30
30
|
const displayTime = now.toLocaleString();
|
|
31
31
|
const timestamp = now.toISOString().replace(/[:.]/g, '-');
|
package/hooks/hooks.json
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
"hooks": [
|
|
6
6
|
{
|
|
7
7
|
"type": "prompt",
|
|
8
|
-
"prompt": "
|
|
8
|
+
"prompt": "Evaluate whether context compaction should proceed.\n\nContext: $ARGUMENTS\n\nRules:\n- If 'generate_handoff_manifest' has already been called in this session, respond: {\"ok\": true}\n- If the session has minimal context (just started, no significant work done), respond: {\"ok\": true}\n- If there is meaningful session context worth preserving (decisions, progress, failures) and 'generate_handoff_manifest' was NOT called yet, respond: {\"ok\": false, \"reason\": \"Context compaction imminent. Call 'generate_handoff_manifest' to preserve session state. Fill all fields: summary (full session recap), taskDescription (goal), currentStatus (done vs remaining), keyDecisions (architecture choices + why), failedApproaches (already-failed — do NOT retry), nextSteps (next session tasks), blockers (unresolved errors). Write ALL field values in English.\"}\n\nIMPORTANT: Respond ONLY with a single JSON object. No markdown formatting, no explanation, no code blocks.",
|
|
9
|
+
"timeout": 15
|
|
9
10
|
}
|
|
10
11
|
]
|
|
11
12
|
}
|
|
@@ -15,7 +16,8 @@
|
|
|
15
16
|
"hooks": [
|
|
16
17
|
{
|
|
17
18
|
"type": "prompt",
|
|
18
|
-
"prompt": "If
|
|
19
|
+
"prompt": "Evaluate whether Claude should stop working.\n\nContext: $ARGUMENTS\n\nRules:\n- If 'generate_handoff_manifest' has already been called in this session, respond: {\"ok\": true}\n- If no meaningful work was done (e.g., simple Q&A, clarification, no code changes), respond: {\"ok\": true}\n- If meaningful work was completed (code changes, feature implementation, bug fix, tests) but 'generate_handoff_manifest' was NOT called yet, respond: {\"ok\": false, \"reason\": \"A work unit was completed. Call 'generate_handoff_manifest' with taskDescription, keyDecisions, failedApproaches, and nextSteps so the next session has full context. Write ALL field values in English.\"}\n\nIMPORTANT: Respond ONLY with a single JSON object. No markdown formatting, no explanation, no code blocks.",
|
|
20
|
+
"timeout": 15
|
|
19
21
|
}
|
|
20
22
|
]
|
|
21
23
|
}
|
|
@@ -25,7 +27,8 @@
|
|
|
25
27
|
"hooks": [
|
|
26
28
|
{
|
|
27
29
|
"type": "prompt",
|
|
28
|
-
"prompt": "On session start: if .claude/handoff.md exists, read it and briefly brief the user (in their language) on Task Description, Current Status, Key Decisions, Failed Approaches, Blockers, Next Steps. If absent, stay silent."
|
|
30
|
+
"prompt": "On session start: if .claude/handoff.md exists, read it and briefly brief the user (in their language) on Task Description, Current Status, Key Decisions, Failed Approaches, Blockers, Next Steps. If absent, stay silent.",
|
|
31
|
+
"timeout": 10
|
|
29
32
|
}
|
|
30
33
|
]
|
|
31
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-context-auto-handoff",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A Claude Code plugin to automate session handoffs before context compaction.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"build",
|
|
13
13
|
".claude-plugin",
|
|
14
14
|
"hooks",
|
|
15
|
+
"skills",
|
|
15
16
|
"templates",
|
|
16
17
|
"scripts",
|
|
17
18
|
"README.md",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Save current session context to handoff file. Use when user runs /handoff or asks to save session state before ending.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Save session context to `.claude/handoff.md` and timestamped archive to `.claude/handoffs/`.
|
|
6
|
+
|
|
7
|
+
## Content Generation Rules (STRICT)
|
|
8
|
+
|
|
9
|
+
Write all field values using telegraphese — drop articles, pronouns, polite words. Maximize density.
|
|
10
|
+
|
|
11
|
+
- **NO code snippets** in any field. Reference file paths + line-level delta notes only.
|
|
12
|
+
- **WHY over WHAT**: Every decision/status must state the reason, not just the action.
|
|
13
|
+
- **failedApproaches**: Format each entry as `"Approach: X → Result: Y → Lesson: Z"`. This prevents the next session from repeating mistakes.
|
|
14
|
+
- **taskDescription**: Include both Goal and Core Intent (why this matters to the project).
|
|
15
|
+
- **implicitRules**: Capture tech stack, naming conventions, env vars — anything not derivable from reading the code.
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
1. Gather from current session:
|
|
20
|
+
- taskDescription: final goal + core intent (why)
|
|
21
|
+
- summary: terse session recap (telegraphese)
|
|
22
|
+
- currentStatus: done vs remaining
|
|
23
|
+
- keyDecisions: architecture choices + why (prevents post-compaction amnesia)
|
|
24
|
+
- failedApproaches: already-failed attempts in `Approach→Result→Lesson` format
|
|
25
|
+
- blockers: unresolved errors
|
|
26
|
+
- modifiedFiles: changed files with delta notes (no code, path + what changed)
|
|
27
|
+
- implicitRules: stack, conventions, env vars
|
|
28
|
+
|
|
29
|
+
2. Call `generate_handoff_manifest`:
|
|
30
|
+
- `summary`, `nextSteps` — required
|
|
31
|
+
- `taskDescription`, `currentStatus`, `keyDecisions`, `failedApproaches`, `modifiedFiles`, `implicitRules` — recommended
|
|
32
|
+
- `blockers` — optional
|
|
33
|
+
|
|
34
|
+
3. Confirm to user:
|
|
35
|
+
- Latest: `.claude/handoff.md`
|
|
36
|
+
- Archive: `.claude/handoffs/handoff-{timestamp}.md`
|
|
37
|
+
- Next session: run `/resume` or SessionStart hook auto-restores
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Restore previous session context from handoff file. Use when user runs /resume or asks to continue from last session.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Reads `.claude/handoff.md`. Falls back to latest file in `.claude/handoffs/`.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Read `.claude/handoff.md`
|
|
10
|
+
2. If missing, find latest `handoff-*.md` in `.claude/handoffs/`
|
|
11
|
+
3. If neither found: tell user "No handoff file. Run /handoff first."
|
|
12
|
+
4. If found:
|
|
13
|
+
- Parse: Task Description, Current Status, Key Decisions, Failed Approaches, Blockers, Next Steps
|
|
14
|
+
- Brief user in their language
|
|
15
|
+
- Never retry Failed Approaches
|
|
16
|
+
- Start from first Next Step immediately
|