From claude-code-hermit
Start or resume a work session with full context loading and work tracking. Use at the beginning of work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-code-hermit:sessionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Start or resume a session with full context loading. This is the generic session workflow — hermits may provide specialized versions.
Start or resume a session with full context loading. This is the generic session workflow — hermits may provide specialized versions.
Invoke /claude-code-hermit:session-start to check session state and load context.
TaskList to see current plan stepsblocked: suggest running /debug to diagnose tool/hook failures before re-attemptingOnce I know what to work on:
TaskCreate) for each stepTaskCreateWork through tasks using whatever tools, skills, and agents are available:
TaskUpdate) when starting each step, completed when done.claude-code-hermit/sessions/SHELL.md Progress Log after each significant stepWhen the work is done, or the operator decides to move on (even if partial or blocked):
Completion notification is the final step of this flow, not a substitute for it. Skipping the idle transition (step 6 below) leaves the session in_progress, which triggers stale-session heartbeat alerts and delays report archival until the time-based backstops kick in.
Compile final session data in context — do NOT write to SHELL.md at this point. session-archive.ts owns the final write. Gather:
Status: one of completed | partial | blockedBlockers: one line each, enough context for a cold startLessons: only genuinely useful onesChanged: list of files modifiedVerify quality in-context before archiving:
completed | partial | blockedCreate proposals for any high-leverage improvements discovered during work
Reflect (with debounce). Read state/reflection-state.json for last_reflection. Only invoke the claude-code-hermit:reflect skill if last_reflection is null or older than 4 hours. For quick tasks (no tasks created, under 5 minutes), skip entirely — progress log is sufficient.
4b. Session-triggered scheduled checks. For each scheduled_checks entry (from config already loaded) with trigger: "session" and enabled: true, invoke the skill. If a skill is unavailable or errors, skip it and continue — never block session finalization on a scheduled check failure. For each check that completed successfully, read-modify-write state/reflection-state.json: update only scheduled_checks.<id>.last_run to today's ISO date, preserving all other keys. Do not update last_run for failed checks.
If native Tasks exist: call TaskList, format as a markdown table. Then TaskUpdate(status=deleted) for all tasks (idle = clean slate).
Run scripts/session-archive.ts to perform an idle transition (finalize SHELL.md, archive report, reset task-scoped sections, set session_state to idle).
Before invoking: read session_id from .claude-code-hermit/state/runtime.json. Run bun ${CLAUDE_PLUGIN_ROOT}/scripts/session-cost.ts <session_id> via Bash and parse the JSON output to get cost_usd and tokens for this session. If the script fails or returns zeros, omit the Cost: line (session-archive.ts falls back to .status.json).
Pipe the following compact structured payload on stdin — keep it brief, no freeform prose:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/session-archive.ts archive --mode=idle --state-dir=.claude-code-hermit <<'HERMIT_PAYLOAD'
Status: <completed|partial|blocked>
Blockers: <one line each, or none>
Lessons: <one line each, or none>
Changed: <file list, or none>
Cost: $X.XXXX (N tokens)
## Plan
<task table, if native Tasks were created>
HERMIT_PAYLOAD
Parse the single line of JSON the script prints to stdout. Gate every following step on the returned ok field. ok === true → the transition succeeded, continue to step 7. ok === false → the archive did NOT happen — do not proceed as if it did. Append the returned reason to SHELL.md ## Findings and retry once; if it fails again, notify the operator and leave the session in_progress rather than silently losing the report.
If heartbeat.enabled is true in config and heartbeat is not already running: start it (/claude-code-hermit:heartbeat start)
7b. Compaction boundary marker. After the idle transition (step 6) succeeds: write state/compact-requested.json with {"requested_at": "<now ISO>", "reason": "session-work-done"} (singleton — overwrite unconditionally). The arc that just archived is fully on disk, so this is a safe moment for the watchdog's routine-hygiene compactor (maybeContextCompact) to waive its interval cooldown on the next tick. Skip if step 6 failed. Run this step unchanged regardless of step 8's branch below; the marker is self-reaping. Its primary reaper is the watchdog's maybeContextCompact, which consumes it when the compaction fires and deletes it stale-on-read once it ages past COMPACT_MARKER_TTL_SECS — so even the conservative branch (where no session-start runs next) never leaks it. The next session-start step 3 unconditionally deletes any survivor on boot as a backstop: immediate in the auto-start branch, later otherwise.
After the idle transition (step 6) succeeds (ok === true), check .claude-code-hermit/sessions/NEXT-TASK.md and read escalation from config:
Delivery-moment voice rule for both branches below: compose the notification in owner language — no S-NNN, no internal IDs, no file paths, no slash commands. Lead with what was delivered. If this task produced a durable compiled/ output (you already know this from your own context — it's whatever you just wrote this task, the same thing session-archive.ts is about to cite in ## Artifacts), name it plainly in one clause (e.g. "Done — investigated the login bug. Prepared: a summary of what's causing it."). If the task produced no compiled/ deliverable, state the one-line outcome instead (e.g. "Done — fixed the login redirect bug.").
escalation is balanced or autonomous: notify the operator: "Done — [task]. [Prepared: | ]. Starting on [NEXT-TASK.md summary] next." Then, as the terminal action of this flow, invoke /claude-code-hermit:session-start (no --task flag — it consumes NEXT-TASK.md itself via its own step 6). Do not perform any further steps of this invocation's flow after invoking it. Under autonomous, once that drained task completes, re-run this Work-done flow on it in turn (same as heartbeat's existing autonomous NEXT-TASK pickup) — never leave it silently in_progress with only a bare notification.escalation is conservative): notify the operator: "Done — [task]. [Prepared: | ]." Append "Ready for what's next." only when no task is queued — omit that tail under conservative with a task queued, since a task IS pending and the tail would falsely imply an empty queue. Under conservative with a task queued: leave NEXT-TASK.md in place — do not auto-start it, do not mention the queued task here, and do not write to runtime.json from this flow (session_state/waiting_reason writes belong to session-archive.ts/heartbeat/channel-responder, not this skill). The existing heartbeat Idle Agency drain owns the single operator-facing queue notice: on its next tick its conservative branch notifies about the queued task and sets waiting.Once the operator says what's next (or, in the auto-start branch above, once the drained task's own plan is underway): go to step 4 (plan the work)
To close the session entirely, the operator runs /claude-code-hermit:session-close at any time.
/claude-code-hermit:proposal-create./claude-code-hermit:watch./claude-code-hermit:brief.npx claudepluginhub p/gtapps-claude-code-hermit-plugins-claude-code-hermitInitializes or resumes a work session by loading context from OPERATOR.md and SHELL.md, orienting the agent, and establishing the task to work on.
Manages Claude Code session lifecycle: load project context, save checkpoints, and reflect on task progress with validation evidence. Use when starting, resuming, or concluding a session.
Manages session context across long development sessions using tiered summarization and checkpoints. Enables seamless resume after breaks.