smith-ctx-claude

Enforce a /clear workflow and stop-hook guardrail in Claude Code.

1|Updated Nov 25, 2025
One-click install
npx skills add https://github.com/tianjianjiang/smith --skill smith-ctx-claude
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: smith-ctx-claude
Source: https://github.com/tianjianjiang/smith/tree/main/smith-ctx-claude
Command: npx skills add https://github.com/tianjianjiang/smith --skill smith-ctx-claude

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill requires jq, and includes scripts (resource) components.

What problem does it solve?

Claude Code context management with a pragmatic stop-hook and persistence strategy to prevent context-loss during long sessions.

Core Features & Use Cases

  • Enforces a /clear workflow when context usage surpasses configured thresholds to prevent uncommitted work loss.
  • Persists state to CLAUDE.md and Serena memory, enabling seamless resume via read_memory.
  • Provides a one-shot stop-hook to balance safety with operability in multi-session environments.

Quick Start

Activate this skill in Claude Code to automatically enforce a context-safe /clear workflow when your context approaches the configured thresholds.

Frequently Asked Questions about smith-ctx-claude

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent context loss in Claude Code during long sessions?โ–ผ

To prevent context loss in Claude Code during long sessions, use a stop-hook guardrail to enforce a context-safe /clear workflow when usage approaches critical thresholds, persisting state to Serena memory before clearing.

How does Serena memory persistence work with the Claude Code clear workflow?โ–ผ

Serena memory persistence works with the Claude Code clear workflow by saving session state to CLAUDE.md and Serena memory before executing /clear, enabling seamless work resumption via read_memory after the context is cleared.

Do I need jq to manage Claude Code context thresholds with a stop-hook?โ–ผ

Yes, you need jq installed as a dependency to manage Claude Code context thresholds with a stop-hook, as the skill scripts require jq to parse context usage data and evaluate configured critical limits.

What is the best way to safely clear context in Claude Code without losing uncommitted work?โ–ผ

The best way to safely clear context in Claude Code without losing uncommitted work is applying a one-shot stop-hook guardrail that automatically persists state to memory before enforcing the /clear command at critical thresholds.

When should I not use an automated context clear workflow in Claude Code?โ–ผ

You should not use an automated context clear workflow in Claude Code for single-session, short-duration tasks where context limits are never approached, as the stop-hook guardrail and memory persistence overhead provides no operational benefit.