← Reddit

I built a /close skill for Claude Code that solved my terminal sprawl problem

Reddit · cinooo1 · April 22, 2026
A developer created a "/close" skill for Claude Code to manage terminal sprawl by automating session management tasks including scanning chat context, committing files to git, and suggesting chat renames while storing all exchanges to disk. For persistent workflows requiring continuous context such as daily investment monitoring, the skill auto-generates compact instructions that preserve key decisions and critical files while explicitly listing what will be dropped. This approach eliminated the need to mentally context switch between multiple terminals while maintaining complete conversation history.

Detailed Analysis

A developer working with Anthropic's Claude Code terminal tool has documented a custom workflow solution — a `/close` skill — designed to address what they describe as "terminal sprawl," the accumulation of multiple open terminal sessions each holding partial, interrupted context from different tasks. Rather than simply killing or abandoning sessions, the skill performs a structured shutdown sequence: it scans the active conversation context, determines which memories need updating, commits modified or new files to git, and appends a summary entry to a rolling timeline log with pointers to more detailed specification files. It also surfaces a suggested `/rename` command for the session, enabling the developer to label and retrieve past terminals with precision. A parallel hook writes the full raw chat — inputs, outputs, debugging loops, and all — to disk, ensuring no conversational history is silently discarded.

The deeper engineering insight embedded in this workflow is the distinction between two fundamentally different session archetypes: discrete tasks with clean endings versus continuous, cyclical workloads. For the former, a full close and context reset makes sense. For the latter — the developer cites morning investment signal reviews and recurring content queues — yesterday's context is not overhead to be discarded but operative knowledge that directly shapes today's decisions. Forcing a clean restart on these workflows imposes a recurring re-explanation cost. To address this, the developer extended the `/close` skill to auto-generate a compact instruction, explicitly enumerating what is being retained, what is being dropped, and what files should be re-read upon resumption. This gives the user a reviewable decision point before compaction occurs, rather than delegating the keep/discard logic entirely to the model.

This approach engages directly with one of the most structurally underappreciated challenges in agentic AI tooling: context lifecycle management. Claude Code's skills system — built around `SKILL.md` files stored in global or project-specific directories with YAML metadata — is specifically designed to support exactly this kind of user-defined procedural extension. Skills support progressive disclosure (loading metadata first, then instructions only as needed to minimize token consumption), auto-invocation based on context pattern matching, and subprocess isolation via `context: fork`. The `/close` skill as described operates well within this architecture, functioning as a meta-skill that manages the session itself rather than any particular coding task within it.

Situating this development within the broader trajectory of AI-assisted development tools reveals a recurring tension: as models become more capable within a single session, the friction points increasingly migrate to the boundaries between sessions. Tools like Cursor and GitHub Copilot have largely competed on in-session intelligence; Claude Code's extensibility through skills opens a distinct competitive surface around session orchestration and memory persistence. The developer's solution is essentially a hand-crafted state management layer sitting atop the model's native context window, compensating for the absence of native persistent memory with explicit, auditable serialization routines. That this solution was user-built rather than platform-provided points to a gap Anthropic has not yet fully closed in the Claude Code product.

The community appetite surfaced by this post — soliciting similar workflows and refinements — reflects a broader pattern among power users of agentic coding tools: the most sophisticated users are increasingly building around the model rather than simply with it. Workflow primitives like session closing, context compaction, and memory routing are becoming first-class engineering concerns, not afterthoughts. As context windows expand and multi-session agent patterns become more common, the design of these lifecycle transitions — what to keep, what to compress, what to discard, and how to make that legible to the next session — is likely to become a formal area of both tooling development and AI product design. This developer's `/close` skill is an early, pragmatic artifact of that emerging discipline.

Read original article →