Resolved

Claude chat context not persisting across fresh sessions

Claude
AI
Chatbot
Context Management
Automation
Dev
CLI

Custom context files in `.claude/commands/` directory not automatically loading in new chat sessions | Requires manual `/CONTEXT` command invocation to activate

Claude’s chat system lacked automatic loading of custom context files stored in the .claude/commands/ directory. Users had to manually invoke the /CONTEXT command in each new session to load persistent context, leading to inconsistent context availability and repetitive manual intervention.

Issue

Custom context files, such as CONTEXT.md, were not automatically loaded at the start of new chat sessions. Users were required to manually execute the /CONTEXT command to parse and inject the context into the session, resulting in a lack of seamless continuity across conversations.

Culprit

Claude’s chat system did not include a built-in mechanism to detect or load custom context files during session initialization. This required explicit user action to activate the context, creating dependency on manual intervention for each new session.

Solution

Manual Context Injection Workflow

Users manually triggered context loading by invoking the /CONTEXT command in-chat, which parsed and injected the content from the designated context file. The file structure relied on a directory-based approach:

  • File Structure: A .claude/commands/ directory containing the CONTEXT.md file.
  • Content Format: The CONTEXT.md file used Markdown headers and bullet points for easy parsing by Claude.

Automation Proposal

To eliminate manual intervention, a Python wrapper script was proposed to pre-process new sessions:

  • Automatic Injection: The script automatically prepended the context content to new sessions.
  • Low Overhead: File reads were minimal (<1KB context size) and completed in milliseconds.

The proposed solution reduced manual context loading from 100% of sessions to 0% when using the wrapper script, ensuring consistent context availability without user interaction.