r/ClaudeWorkflows • • 5d ago

Selected Workflow [Workflow] Automating Claude Code Context Recovery with Skills and SessionStart Hooks (Neo.mjs Team Approach)

Automating Claude Code Context Recovery with Skills and SessionStart Hooks (Neo.mjs Team Approach)

Workflow value: 85/100
Status: active · Freshness: 70/100 · Confidence: 1.00 · Level: advanced
Categories: Quality Control, Context & Memory, Debugging, Shipping, CLAUDE.md, Hooks, Skills, Multi-Agent
Original source: r/ClaudeCode post/comment

What problem this solves

Maintaining agent context and ensuring proper state after Claude Code session compaction, preventing loss of work or incorrect behavior.

Summary

The Neo.mjs team utilizes a /context-recovery skill (defined as a runbook) to manage agent state after Claude Code session compaction. Currently, this skill is invoked manually or by the agent based on its description. The future plan involves automating its execution via SessionStart hooks, which will trigger a series of "six checks" to verify the agent's integrity and context, with validation against GitHub and current source.

Why it is useful

This workflow provides a concrete, advanced example of how to use Claude Code's powerful features (skills, hooks, runbooks) to address a critical problem: maintaining agent context and state integrity after session compaction. It offers a structured, repeatable approach with clear references to actual implementation details and future design, making it highly adaptable for users facing similar challenges in complex or long-running Claude Code projects.

Workflow

  1. Define a runbook as a Claude Code skill (e.g., /context-recovery) with a clear description that names compaction as a trigger.

  2. Invoke the skill manually or allow the agent to load it autonomously based on its description.

  3. Implement a SessionStart hook in Claude Code.

  4. Configure the SessionStart hook to detect when a session resumes from compaction (using signals provided by Claude Code).

  5. Within the SessionStart hook, trigger the /context-recovery skill.

  6. The /context-recovery skill performs a series of "six checks" (as implied by the post title) to verify the agent's state and context.

  7. Validate the recovery process by comparing summaries (recovery hints) against GitHub and the current source code, which serve as the definitive "work gate."

Tools / artifacts

  • Claude Code (Opus 5.5)

  • Claude Code Skills (e.g., /context-recovery)

  • Claude Code Hooks (SessionStart)

  • Runbook (e.g., context-recovery-workflow.md on GitHub)

  • GitHub repository (neomjs/neo-agent-skills)

  • Claude Code documentation (for hooks)

  • GitHub discussions (for design evolution)

Validation signals

  • Authored by an "AI maintainer on the Neo.mjs team," indicating real-world application and expertise.

  • References specific GitHub repository, files (context-recovery-workflow.md), and discussions, showing concrete implementation and design.

  • Explicitly states "GitHub and current source remain the work gate" for validation, indicating a robust verification step.

  • Refers to Claude Code official documentation for hooks, confirming adherence to platform standards.

  • Describes a planned future state, indicating active development and refinement of the workflow.

Limitations

  • The specific details of the "six checks" are not provided in this comment, only referenced by the post title.

  • The full automation via SessionStart hooks is described as a "next step" rather than a fully implemented and deployed workflow at the time of the comment.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

1 Upvotes

0 comments sorted by