Advanced (अपडेट: 1/6/2026)

Claude Code Context Management: /context, /compact, CLAUDE.md और Obsidian का सही उपयोग

Claude Code sessions को focused रखने के लिए /context, /compact, memory, CLAUDE.md और notes workflow.

Claude Code Context Management: /context, /compact, CLAUDE.md और Obsidian का सही उपयोग

Claude Code में लंबी sessions अक्सर इसलिए कमजोर होती हैं क्योंकि पुराने logs, file reads और temporary decisions context भर देते हैं। Context management का मतलब है कि अभी क्या चाहिए और क्या notes में रह सकता है।

/context current usage दिखाता है, /compact conversation summarize करता है, /clear fresh start देता है, और /memory loaded files दिखाता है.

Practical aim है main session focused रहे और long research, raw notes, old logs active window से बाहर रहें.

Think of the context window as the working desk

Context window में history, file reads, tool output, CLAUDE.md, auto memory, rules और skills आते हैं. Window भरने पर important constraints old output से compete करते हैं.

What enters contextWhy it gets heavyPractical response
ConversationLong discussion and side questsCut by task boundary
FilesReading huge files wholeSearch first, then read narrow ranges
Tool outputLong logs and repeated failuresSummarize into a note
MemoryOversized CLAUDE.mdMove details to rules or docs

Use /context, /compact, /clear, and /memory differently

/context usage दिखाता है. /compact summary बनाकर continue करता है. /clear real task boundary पर fresh start देता है. /memory CLAUDE.md और auto memory दिखाता है.

/context all
/compact focus on files changed, failing tests, and next command
/clear
/memory

Set a context budget before the task

Task start पर objective, scope, out-of-scope, done criteria और verification commands दें. Whole repo पढ़वाने से पहले rg और selected files use करें.

# narrow discovery before asking Claude to read files
rg -n "getUserById|User not found|auth middleware" src tests
git diff --stat
npm test -- --runInBand

Copy-paste runbook for long work

यह runbook refactor, security fix, long article और conversion experiment में काम आता है. Session छोटा रहता है और receipt बचती है.

## Task brief
- Objective:
- In scope:
- Out of scope:
- Files likely involved:
- Done when:
- Verification commands:

## Handoff receipt
- Changed files:
- Commands run:
- Result:
- Remaining risk:
- Next best action:

What survives compaction

/compact के बाद root CLAUDE.md और auto memory वापस आते हैं. Nested CLAUDE.md और path-scoped rules matching file पढ़ने पर लौटते हैं.

# CLAUDE.md

## Compact Instructions
- Keep the current business objective and monetization hypothesis.
- Keep changed files, verification commands, deploy state, and blockers.
- Drop raw logs unless a line explains the root cause.
- If article work is in progress, preserve slug, locale list, and quality gaps.

Three use cases: code, content, conversion

  1. Large refactor में broad research subagent या separate session को दें.
  2. Publishing में raw research Obsidian, editorial rules CLAUDE.md और final MDX repo में रखें.
  3. Conversion में metric, hypothesis, change और verification result को small ticket रखें.

Common failures and fixes

  1. /compact full transcript backup नहीं है; durable constraints files में रखें.
  2. Massive discovery के बाद पहले short note बनाएं, फिर implement करें.
  3. Auto memory shared team docs नहीं है. Shared rules committed CLAUDE.md में रखें.

How Obsidian fits in

This workflow works with CLAUDE.md best practices, token optimization, prompt engineering, and Obsidian workflow. Team setup can start from consultation page.

PlaceBest information
CLAUDE.mdShort rules needed every session
ObsidianLong research, hypotheses, article ideas
MDX / docsPublished content, specs, handoff notes
Auto memoryLocal preferences and repeated learnings

What was verified

Article को official context window, commands और memory docs के आधार पर update किया गया. Official references: context window, commands, memory, and common workflows.

#claude-code #कॉन्टेक्स्ट प्रबंधन #टोकन अनुकूलन #उत्पादकता
मुफ़्त

मुफ़्त PDF: Claude Code cheatsheet

Email डालें और commands, review habits तथा safe workflow वाली एक-page PDF पाएँ.

हम आपका data सुरक्षित रखते हैं और spam नहीं भेजते.

Masa

लेखक के बारे में

Masa

Claude Code workflow और team adoption पर काम करने वाला engineer.