Skip to contentমূল লেখায় যান

Part 04পর্ব 04 · Foundations

How Claude Code Works

Before you give Claude a failing test suite, know what it does with it. This page explains the loop that Claude Code runs, the tools it uses, what fills its context window, and how you undo its work.

11 min read11 মিনিটে পড়া যায় · 10 sections10টি সেকশন · 14 sources14টি সোর্স · updated Nov 2026আপডেট: Nov 2026

The agentic loop on a failing testএকটা ফেইলিং টেস্টে এজেন্টিক লুপ

Follow gather, act, verify as Claude fixes failing tests, then switch the first fix and press Esc.Claude ফেইলিং টেস্ট ঠিক করার সময় সংগ্রহ, কাজ, যাচাই অনুসরণ করুন, তারপর প্রথম ফিক্স বদলান আর Esc চাপুন।

2 min2 মিনিট7 steps7টি ধাপ
  • Loop turnsলুপের দফা0
  • Failing testsব্যর্থ টেস্ট3 / 3
Gatherসংগ্রহActকাজVerifyযাচাইyouআপনিfix the failing testsfailing tests ঠিক করোClaudeClaudemodelমডেলToolsটুলYourআপনারcodeকোড3 of 3 fail3/3 ব্যর্থ

You’ll learnআপনি শিখবেন

  • The three phases: gather, act, verifyতিন ধাপ: সংগ্রহ, কাজ, যাচাই✓
  • Each tool result feeds the next decisionপ্রতিটা টুলের ফল পরের সিদ্ধান্তে কাজে লাগে
  • Why verify can loop back to gatherযাচাই কেন সংগ্রহে ফিরতে পারে
  • How Esc cuts into the loopEsc কীভাবে লুপ থামায়

The agentic loop

For every task, Claude works through three phases: gather context, take action, and verify results. Source 1সোর্স 1 The phases blend together. A question about your code can need only context gathering. A bug fix cycles through all three phases many times. Source 1সোর্স 1

Example from the docs: you ask Claude to "fix the failing tests". Claude then does these steps: Source 1সোর্স 1

  1. Runs the test suite to see what fails.
  2. Reads the error output.
  3. Searches for the related source files.
  4. Reads those files.
  5. Edits the code.
  6. Runs the tests again to verify the fix.

You are part of the loop. Press Esc to stop Claude at once. Claude Code also cancels the tool call that runs. Source 1সোর্স 1 To correct Claude without a stop, type the correction and press Enter. Claude reads it after the current tool calls finish. Source 1সোর্স 1

When the first attempt is not right, you do not start over. You iterate. Source 1সোর্স 1 The Prompting for QA page shows how to write the first prompt.

সহজ English

For each task, Claude works in three phases: it gathers context, it takes action, and it verifies the results. Source 1সোর্স 1 The phases blend together. A question about your code can need only the first phase. A bug fix goes through all three phases many times. Source 1সোর্স 1

Here is an example from the docs. You ask Claude to "fix the failing tests". Claude runs the test suite and reads the error output. It searches for the related source files and reads them. Then it edits the code and runs the tests again to verify the fix. Source 1সোর্স 1

You are part of the loop. To stop Claude at once, press Esc. Claude Code also cancels the tool call that runs. Source 1সোর্স 1 To correct Claude without a stop, type the correction and press Enter. Claude reads it after the current tool calls finish. Source 1সোর্স 1

If the first attempt is not correct, do not start again. Improve the result step by step. Source 1সোর্স 1

বাংলা ব্যাখ্যা

প্রতিটি task-এর জন্য Claude তিনটি ধাপে কাজ করে: context সংগ্রহ করে, action নেয় এবং result verify করে। Source 1সোর্স 1 ধাপগুলো একটির সাথে আরেকটি মিশে যায়। আপনার code নিয়ে একটি প্রশ্নের জন্য হয়তো শুধু context সংগ্রহ করাই যথেষ্ট। একটি bug fix-এ তিনটি ধাপ অনেকবার ঘুরে ঘুরে আসে। Source 1সোর্স 1

Docs-এর একটি উদাহরণ: আপনি Claude-কে বললেন "fix the failing tests"। তখন Claude test suite চালিয়ে দেখে কোনগুলো fail করছে, error output পড়ে, সংশ্লিষ্ট source file-গুলো খুঁজে বের করে পড়ে, code edit করে, তারপর fix কাজ করছে কি না verify করতে আবার test চালায়। Source 1সোর্স 1

আপনিও এই loop-এর অংশ। Claude-কে সাথে সাথে থামাতে Esc চাপুন। Claude Code তখন চলমান tool call-টিও বাতিল করে। Source 1সোর্স 1 না থামিয়ে Claude-কে সংশোধন করতে চাইলে সংশোধনটি লিখে Enter চাপুন। চলমান tool call-গুলো শেষ হলে Claude সেটি পড়ে। Source 1সোর্স 1

প্রথম চেষ্টা ঠিক না হলে নতুন করে শুরু করতে হবে না। ধাপে ধাপে উন্নত করুন, অর্থাৎ iterate করুন। Source 1সোর্স 1 প্রথম prompt কীভাবে লিখবেন, তা Prompting for QA পেজে আছে।

The model, the tools, and the harness

The loop has these parts:

PartWhat it does
ModelReasons about the task. Source 1সোর্স 1
ToolsAct: read files, search, run commands, fetch web pages. Without tools, Claude can only respond with text. Source 1সোর্স 1
HarnessClaude Code itself: "the layer around the model that provides the tools and manages the context the model sees". Source 1সোর্স 1 The glossary calls this the agentic harness. Source 2সোর্স 2
ExtensionsSkills, MCP servers, hooks, and subagents. They form a layer on top of the core agentic loop. Source 1সোর্স 1

Each tool result feeds the next decision. Source 1সোর্স 1 The extensions section near the end of this page shows where each extension plugs in.

সহজ English

The loop has four parts: Source 1সোর্স 1

  • The model thinks about the task.
  • The tools do the work. They read files, search, run commands, and fetch web pages. Without tools, Claude can only answer with text.
  • The harness is Claude Code itself. It is the layer around the model. It gives the tools to the model and manages the context that the model sees. The glossary calls it the agentic harness. Source 2সোর্স 2
  • The extensions are skills, MCP servers, hooks, and subagents. They are a layer on top of the core agentic loop.

The result of each tool goes into the next decision. Source 1সোর্স 1

বাংলা ব্যাখ্যা

এই loop-এর চারটি অংশ: Source 1সোর্স 1

  • Model: task নিয়ে চিন্তা (reasoning) করে।
  • Tools: action নেয়, যেমন file পড়া, search করা, command চালানো এবং web page আনা। Tool ছাড়া Claude শুধু text দিয়ে উত্তর দিতে পারে।
  • Harness: এটি Claude Code নিজেই, অর্থাৎ model-এর চারপাশের layer। এটি model-কে tool দেয় এবং model কোন context দেখবে তা পরিচালনা করে। Glossary-তে একে agentic harness বলা হয়। Source 2সোর্স 2
  • Extensions: skills, MCP servers, hooks এবং subagents। এগুলো মূল agentic loop-এর উপরে একটি layer তৈরি করে।

প্রতিটি tool-এর result পরের সিদ্ধান্তে কাজে লাগে। Source 1সোর্স 1

Tools Claude uses

The built-in tools fall into five categories: Source 1সোর্স 1

  • File operations
  • Search
  • Execution
  • Web
  • Code intelligence (needs a code intelligence plugin)

Claude also has tools to start subagents, to ask you questions, and for other orchestration tasks. Source 1সোর্স 1 The tools reference names them, for example Agent and AskUserQuestion. Source 3সোর্স 3

Tool names are the exact strings that you use in permission rules, subagent tool lists, and hook matchers. Source 3সোর্স 3 Some tools need your permission and some do not: Source 3সোর্স 3

ToolPermission required
ReadNo
EditYes
WriteYes
BashYes
WebFetchYes
WebSearchYes

Bash runs a built-in set of read-only commands without a prompt. Source 3সোর্স 3

Read returns file contents with line numbers. It also returns PNG, JPG, and other image formats as visual content. Source 3সোর্স 3 So Claude can look at a screenshot of a failed UI test.

Common mistake: assume the Grep and Glob tools are always there

On macOS, Linux, and WSL, Claude Code leaves Glob and Grep out of the default tool set. Claude searches with find and grep through the Bash tool instead. On Windows, the two tools are in the default set. Source 3সোর্স 3 When Grep is present, it uses ripgrep regex syntax, not POSIX grep syntax. Source 3সোর্স 3 This tutorial says "search tools" when it means either way.

সহজ English

Claude has built-in tools. They fall into five groups:

The code intelligence group works only if you add a code intelligence plugin. Source 1সোর্স 1

Claude also has tools to start helpers and to ask you questions. Source 1সোর্স 1 Two of them are Agent and AskUserQuestion. Source 3সোর্স 3

Each tool has a name. You must write the name exactly when you set rules about what Claude may do. Source 3সোর্স 3 You also write it exactly in the list of tools a helper may use. Source 3সোর্স 3 You write it exactly in hook matchers too. Source 3সোর্স 3

Some tools ask your permission first. Others do not.

There is one exception. Bash runs a built-in set of read-only commands without asking. Source 3সোর্স 3

Read shows you what is inside a file, with line numbers. Source 3সোর্স 3 It also shows PNG, JPG, and other image files as pictures. Source 3সোর্স 3 So Claude can look at a screenshot of a failed UI test.

Do not assume that the two search tools Glob and Grep are always there. On macOS, Linux, and WSL, the default tools leave them out. Source 3সোর্স 3 Claude searches with find and grep through the Bash tool instead. Source 3সোর্স 3 On Windows, the two tools are in the default set. Source 3সোর্স 3

When Grep is there, it uses ripgrep regex syntax. Source 3সোর্স 3 It does not use POSIX grep syntax. Source 3সোর্স 3 This tutorial says "search tools" when it means either way.

বাংলা ব্যাখ্যা

Built-in tool-গুলো পাঁচটি ভাগে পড়ে: file operations, search, execution, web এবং code intelligence। Code intelligence-এর জন্য একটি code intelligence plugin লাগে। Source 1সোর্স 1 এ ছাড়া subagent চালু করা, আপনাকে প্রশ্ন করা এবং অন্যান্য orchestration কাজের জন্যও Claude-এর tool আছে। Source 1সোর্স 1 যেমন Agent এবং AskUserQuestion। Source 3সোর্স 3

Permission rule, subagent-এর tool list এবং hook matcher-এ আপনি tool-এর হুবহু নাম ব্যবহার করেন। Source 3সোর্স 3

কিছু tool চালানোর আগে আপনার permission চায়, কিছু চায় না। Read-এর জন্য permission লাগে না। Edit, Write, Bash, WebFetch এবং WebSearch-এর জন্য লাগে। তবে Bash একটি built-in read-only command-এর set কোনো prompt ছাড়াই চালায়। Source 3সোর্স 3

Read line number সহ file-এর content দেখায়। এটি PNG, JPG এবং অন্য image format-ও visual content হিসেবে পড়তে পারে। Source 3সোর্স 3 তাই Claude একটি fail হওয়া UI test-এর screenshot দেখতে পারে।

macOS, Linux এবং WSL-এ default tool set-এ Glob এবং Grep থাকে না। তখন Claude Bash tool দিয়ে find এবং grep চালিয়ে search করে। Windows-এ এই দুটি tool default set-এ থাকে। Source 3সোর্স 3

How Claude finds context

When you run claude in a directory, Claude can access: Source 1সোর্স 1

  • Your project files
  • Your terminal
  • Your git state
  • Your CLAUDE.md files
  • Auto memory
  • The extensions that you configure, such as MCP servers, skills, and subagents

Claude sees the whole project, so it can work across files. Inline code assistants see only the current file. Source 1সোর্স 1

Claude Code gathers context with tools: it searches, reads files, and runs commands when it needs them. Source 1সোর্স 1 If your team already runs a code search or RAG index, the docs say to expose it as an MCP tool, so Claude queries it instead of reading files directly. Source 4সোর্স 4

For QA work, the sources of context map to these features:

Context for a test taskHow Claude gets it
Code under testProject files and git state, read with tools Source 1সোর্স 1
Test logs and reportsFiles in the project, read with tools Source 1সোর্স 1
Jira tickets, database rowsMCP servers that you configure Source 1সোর্স 1
Team rules and lessonsCLAUDE.md (you write it) and auto memory (Claude writes it) Source 1সোর্স 1

The Prompting for QA page shows how to point Claude at a log, a screenshot, or an MCP resource. The MCP Servers page shows how to connect Jira or a database.

Sessions

Each new session starts with a fresh context window, without the conversation of earlier sessions. Source 1সোর্স 1 Two mechanisms carry knowledge across sessions: CLAUDE.md files and auto memory. Source 5সোর্স 5

Claude Code saves each session to a plaintext JSONL file under ~/.claude/projects/. Source 1সোর্স 1 Resume a session with claude --continue or claude --resume. Fork it with --fork-session or /branch. A fork copies the history into a new session ID. Source 1সোর্স 1

সহজ English

When you run claude in a directory, Claude can use your project files, your terminal, your git state, your CLAUDE.md files, auto memory, and the extensions that you configure, such as MCP servers, skills, and subagents. Source 1সোর্স 1 Claude sees the whole project, so it can work across files. An inline code assistant sees only the current file. Source 1সোর্স 1

Claude gets context with tools. It searches, reads files, and runs commands when it needs them. Source 1সোর্স 1 If your team has a code search or RAG index, the docs say to make it an MCP tool. Then Claude queries it, not the files. Source 4সোর্স 4

For QA work, Claude reads code under test, test logs, and reports with tools. It gets Jira tickets and database rows through MCP servers that you configure. It gets team rules from CLAUDE.md (you write it) and auto memory (Claude writes it). Source 1সোর্স 1

Each new session starts with a fresh context window, without the conversation of earlier sessions. Source 1সোর্স 1 CLAUDE.md files and auto memory carry knowledge from one session to the next. Source 5সোর্স 5 To resume a session, use claude --continue or claude --resume. Source 1সোর্স 1

বাংলা ব্যাখ্যা

কোনো directory-তে claude চালালে Claude এগুলো access করতে পারে: আপনার project file, terminal, git state, CLAUDE.md file, auto memory এবং আপনার configure করা extension, যেমন MCP servers, skills ও subagents। Source 1সোর্স 1 Claude পুরো project দেখে, তাই একাধিক file জুড়ে কাজ করতে পারে। Inline code assistant শুধু বর্তমান file-টি দেখে। Source 1সোর্স 1

Claude tool দিয়ে context সংগ্রহ করে: দরকার হলে search করে, file পড়ে এবং command চালায়। Source 1সোর্স 1 আপনার team-এর যদি আগে থেকেই একটি code search বা RAG index থাকে, docs বলে সেটিকে একটি MCP tool হিসেবে দিতে। তাহলে Claude সরাসরি file না পড়ে সেটিতে query করে। Source 4সোর্স 4

QA কাজের জন্য: code under test, test log এবং report Claude tool দিয়ে পড়ে। Jira ticket এবং database row আসে আপনার configure করা MCP server থেকে। Team-এর নিয়ম ও শিক্ষা আসে CLAUDE.md (আপনি লেখেন) এবং auto memory (Claude লেখে) থেকে। Source 1সোর্স 1

প্রতিটি নতুন session একটি fresh context window দিয়ে শুরু হয়, আগের session-এর conversation সেখানে থাকে না। Source 1সোর্স 1 এক session থেকে আরেক session-এ জ্ঞান বহন করে CLAUDE.md file এবং auto memory। Source 5সোর্স 5 Claude Code প্রতিটি session ~/.claude/projects/-এর নিচে একটি plaintext JSONL file-এ save করে। আগের session আবার চালাতে claude --continue বা claude --resume ব্যবহার করুন। Source 1সোর্স 1

What fills the context window

The context window holds your conversation history, file contents, command outputs, CLAUDE.md, auto memory, loaded skills, and system instructions. Source 1সোর্স 1 Most current models have a 1M-token window and Claude Code compacts on its own, so running out is rare. A focused context still gives better answers and costs less. Source 6সোর্স 6

At session start, Claude Code loads these items: Source 7সোর্স 7

  • The system prompt
  • Auto memory: the first 200 lines or 25KB of MEMORY.md
  • Environment information
  • MCP tool names (the full tool definitions are deferred)
  • Skill descriptions
  • ~/.claude/CLAUDE.md
  • The project CLAUDE.md

Token counts in the docs are examples

The context-window page in the docs shows a token count for each item. The docs say the visualization uses representative numbers. Source 7সোর্স 7 Use /context to see the real numbers for your session.

Your CLAUDE.md files are not part of the system prompt. Claude Code delivers them in the conversation as system reminders. Source 2সোর্স 2 Claude Code also adds context of its own, for example a note when a file that Claude edited earlier has since changed on disk, and the attribution lines for commits and pull requests. Source 1সোর্স 1

Some content loads only when Claude needs it:

  • MCP tools. The tool definitions are deferred by default. Claude loads them on demand through tool search. Source 1সোর্স 1 With ENABLE_TOOL_SEARCH=auto, Claude Code loads the schemas up front when they fit in 10% of the window. With ENABLE_TOOL_SEARCH=false, it loads all of them. auto:N sets a custom percentage. Source 14সোর্স 14
  • Skills. Claude sees the skill descriptions at session start. The full content loads only when Claude uses the skill. Source 1সোর্স 1 A skill with disable-model-invocation: true stays out of context until you start it with /name. Source 8সোর্স 8
  • Path-scoped rules and nested CLAUDE.md files. Claude Code loads them when Claude reads, writes, or edits a file that matches. Source 5সোর্স 5

Check it with /context

Run /context to see the current context usage as a colored grid. Source 9সোর্স 9 The output also shows optimization suggestions and which CLAUDE.md and memory files loaded. Source 7সোর্স 7 /context all expands the detail. Source 9সোর্স 9

Keep it small

Example: "Use a subagent to find out why the checkout tests are flaky. Report the three most likely causes with file and line." The subagent reads the logs and the test files. Your main conversation gets only the summary.

সহজ English

The context window holds your conversation history, file contents, command outputs, CLAUDE.md, auto memory, loaded skills, and system instructions. Source 1সোর্স 1 Most current models have a 1M-token window and Claude Code compacts on its own, so running out is rare. A focused context still gives better answers and costs less. Source 6সোর্স 6

At session start, Claude Code loads the system prompt, auto memory (the first 200 lines or 25KB of MEMORY.md), environment information, MCP tool names, skill descriptions, ~/.claude/CLAUDE.md, and the project CLAUDE.md. Source 7সোর্স 7 Your CLAUDE.md files are not in the system prompt. Claude Code sends them in the conversation as system reminders. Source 2সোর্স 2

Some content loads only when Claude needs it. By default, MCP tool definitions load on demand through tool search. Source 1সোর্স 1 The full content of a skill loads only when Claude uses the skill. Source 1সোর্স 1 Path-scoped rules and nested CLAUDE.md files load when Claude reads, writes, or edits a matching file. Source 5সোর্স 5

To see your context usage, run /context. Source 9সোর্স 9 To keep the context small, run /clear between unrelated tasks. Source 6সোর্স 6 Also, send investigations to a subagent. It works in its own context window, and Claude gets back only a summary. Source 1সোর্স 1

বাংলা ব্যাখ্যা

Context window-এ থাকে আপনার conversation history, file content, command output, CLAUDE.md, auto memory, load হওয়া skill এবং system instructions। Source 1সোর্স 1 বেশিরভাগ current model-এর 1M-token window আছে এবং Claude Code নিজে থেকেই compact করে, তাই context ফুরিয়ে যাওয়া বিরল। তবুও focused context ভালো উত্তর দেয় এবং খরচ কম হয়। Source 6সোর্স 6

Session শুরুর সময় Claude Code এগুলো load করে: system prompt, auto memory (MEMORY.md-এর প্রথম 200 line বা 25KB), environment information, MCP tool-এর নাম, skill description, ~/.claude/CLAUDE.md এবং project-এর CLAUDE.md। Source 7সোর্স 7 আপনার CLAUDE.md file-গুলো system prompt-এর অংশ নয়। Claude Code এগুলো conversation-এ system reminder হিসেবে পাঠায়। Source 2সোর্স 2

কিছু content শুধু দরকার হলেই load হয়। Default হিসেবে MCP tool definition-গুলো deferred থাকে, Claude tool search দিয়ে দরকারমতো সেগুলো load করে। Source 1সোর্স 1 Skill-এর পুরো content load হয় শুধু Claude যখন skill-টি ব্যবহার করে। Source 1সোর্স 1 Path-scoped rule এবং nested CLAUDE.md file load হয় যখন Claude মিলে যাওয়া কোনো file read, write বা edit করে। Source 5সোর্স 5

বর্তমান context usage দেখতে /context চালান। Source 9সোর্স 9 Context ছোট রাখতে সম্পর্কহীন task-এর মাঝে /clear চালান। Source 6সোর্স 6 Investigation-এর কাজ একটি subagent-কে দিন। Subagent নিজের context window-এ কাজ করে, আর Claude শুধু একটি summary ফেরত পায়। Source 1সোর্স 1

Compaction

Automatic compaction. When the context window gets near its limit, Claude Code compacts the conversation into a summary automatically. The summary keeps your requests and key code snippets. Detailed instructions from early in the conversation can be lost. Source 1সোর্স 1

Common mistake: give a permanent rule only in the chat

Compaction can drop it. Put persistent rules in CLAUDE.md. To steer what compaction keeps, add a "Compact Instructions" section to CLAUDE.md. Source 1সোর্স 1

Example from the docs for /compact: /compact keep the API changes and the test commands. Source 6সোর্স 6

Compacting now. To compact now, run /compact with optional instructions, for example /compact focus on the API changes. Source 9সোর্স 9 Source 1সোর্স 1

What happens to each kind of content at compaction: Source 7সোর্স 7

ContentAfter compaction
System prompt and output styleKept
Project-root CLAUDE.md and unscoped rulesRe-read from disk
Auto memoryRe-read from disk
The plan from plan modeRe-injected
Path-scoped rules and nested CLAUDE.md filesLoad again on demand
Context that hooks added earlierSummarized with the rest of the conversation
Skill descriptionsRebuilt from your current skills and re-injected (needs Claude Code v2.1.304 or later)
SessionStart hooks that match the compact sourceRun again, and their output is added to the compacted context

Files and skills. After compaction, Claude Code re-reads up to five files that Claude read or edited, most recently modified first. A file over 5,000 tokens comes back as a path reference. Source 7সোর্স 7 Skill bodies that you invoked are re-injected, capped at 5,000 tokens per skill and 25,000 tokens total. Source 7সোর্স 7

Repeated refills. If one file or tool output fills the context again right after each summary, Claude Code stops auto-compacting after a few attempts. It shows an error instead of looping. Source 1সোর্স 1

Window size. To set how full the window gets before auto-compaction, run /autocompact with auto or a size such as 500k. Source 9সোর্স 9 The window size must be at least 100K tokens. Claude Code caps it at the model's context window. Source 10সোর্স 10

Fable models, Sonnet 5 and later, Haiku 5.5, Opus 4.6 and later, and Sonnet 4.6 support a 1 million token context window. Source 7সোর্স 7 The Claude Models page has the model details.

সহজ English

When the context window is almost full, Claude Code compacts it automatically. Claude Code compacts the conversation into a summary. The summary keeps your requests and key code snippets. Detailed instructions from early in the conversation can be lost. Source 1সোর্স 1

Thus, do not give a permanent rule only in the chat. Put it in CLAUDE.md. To control what compaction keeps, add a "Compact Instructions" section to CLAUDE.md. Source 1সোর্স 1

To compact now, run /compact. You can add instructions, for example /compact focus on the API changes. Source 9সোর্স 9

After compaction, Claude Code reads the project-root CLAUDE.md and auto memory from disk again. It also reads again up to five files that Claude read or edited, most recently modified first. Source 7সোর্স 7

If one file or tool output fills the context again after each summary, Claude Code stops auto-compacting after a few attempts. It shows an error and does not loop. Source 1সোর্স 1

To set how full the window gets before auto-compaction, run /autocompact with auto or a size such as 500k. Source 9সোর্স 9

বাংলা ব্যাখ্যা

Context window প্রায় ভরে গেলে Claude Code নিজে থেকেই সেটি compact করে। এটি conversation-এর একটি summary বানায়। Summary-তে আপনার request এবং গুরুত্বপূর্ণ code snippet থাকে। কিন্তু conversation-এর শুরুর দিকের বিস্তারিত নির্দেশনা হারিয়ে যেতে পারে। Source 1সোর্স 1

তাই কোনো স্থায়ী নিয়ম শুধু chat-এ দেবেন না। সেটি CLAUDE.md-তে রাখুন। Compaction কী রাখবে তা ঠিক করতে CLAUDE.md-তে একটি "Compact Instructions" section যোগ করুন। Source 1সোর্স 1

এখনই compact করতে /compact চালান। চাইলে সাথে নির্দেশনা দিতে পারেন, যেমন /compact focus on the API changes। Source 9সোর্স 9

Compaction-এর পরে Claude Code project-root-এর CLAUDE.md এবং auto memory আবার disk থেকে পড়ে। Claude যে file read বা edit করেছে তার মধ্যে সর্বশেষ পরিবর্তিত সর্বোচ্চ পাঁচটি file-ও আবার পড়ে। Source 7সোর্স 7

প্রতিটি summary-র পরপরই যদি একটি file বা tool output আবার context ভরে ফেলে, তাহলে কয়েকবার চেষ্টার পর Claude Code auto-compact বন্ধ করে। Loop-এ না ঘুরে এটি একটি error দেখায়। Source 1সোর্স 1

Auto-compaction-এর আগে window কতটা ভরবে তা ঠিক করতে /autocompact চালান, সাথে auto বা 500k-এর মতো একটি size দিন। Source 9সোর্স 9

Checkpoints and rewind

Before Claude edits a file, Claude Code saves a snapshot of its contents. Source 1সোর্স 1 Every prompt that starts a turn creates a checkpoint. Claude Code keeps the file snapshots for the 100 most recent checkpoints. Source 11সোর্স 11

To open the rewind menu, run /rewind, or press Esc twice when the prompt input is empty. If the input has text, the double Esc clears it instead. Source 11সোর্স 11 The aliases of /rewind are /checkpoint and /undo. Source 9সোর্স 9

The rewind menu has these actions: Source 11সোর্স 11

  • Restore code and conversation
  • Restore conversation
  • Restore code
  • Summarize from here
  • Summarize up to here
  • Never mind

The two summarize actions work like a targeted /compact. They do not change files. Source 11সোর্স 11

Checkpoints do not track these changes: Source 11সোর্স 11

  • Files that only Bash commands changed. (If Claude already edited a file with its file tools, /rewind also undoes later Bash changes to that file.)
  • Changes from outside Claude Code
  • Usually, edits that subagents make
  • Symlinked and hard-linked files

A rewind does not undo a database write

Actions that affect remote systems, such as databases, APIs, and deployments, cannot be checkpointed. Source 1সোর্স 1 If Claude changes test data through a database MCP server, /rewind does not restore it. Use a read-only database user where you can.

Checkpoints are for quick recovery in a session. They do not replace git. Source 11সোর্স 11 Claude Code deletes snapshots in a retention sweep, by default about 30 days after the session last saved one. The cleanupPeriodDays setting keeps them longer. Source 11সোর্স 11

সহজ English

Before Claude edits a file, Claude Code saves a snapshot of the file contents. Source 1সোর্স 1 Each prompt that starts a turn makes a checkpoint. Claude Code keeps the file snapshots for the 100 most recent checkpoints. Source 11সোর্স 11

To open the rewind menu, run /rewind, or press Esc two times when the prompt input is empty. Source 11সোর্স 11 In the menu, you can restore the code, the conversation, or both. You can also summarize a part of the conversation. The summarize actions do not change files. Source 11সোর্স 11

Checkpoints do not record all changes. They do not record files that only Bash commands changed. They also do not record changes from outside Claude Code, symlinked and hard-linked files, and usually the edits that subagents make. Source 11সোর্স 11

Checkpoints cannot record actions on remote systems, such as databases, APIs, and deployments. Source 1সোর্স 1

Checkpoints are for fast recovery in a session. They do not replace git. Source 11সোর্স 11

বাংলা ব্যাখ্যা

Claude কোনো file edit করার আগে Claude Code সেই file-এর content-এর একটি snapshot save করে। Source 1সোর্স 1 যে prompt একটি turn শুরু করে, তা একটি checkpoint তৈরি করে। Claude Code সবচেয়ে সাম্প্রতিক 100টি checkpoint-এর file snapshot রাখে। Source 11সোর্স 11

Rewind menu খুলতে /rewind চালান, অথবা prompt input খালি থাকলে দুইবার Esc চাপুন। Input-এ text থাকলে দুইবার Esc চাপলে শুধু text মুছে যায়। Source 11সোর্স 11 /rewind-এর alias হলো /checkpoint এবং /undo। Source 9সোর্স 9

Menu থেকে আপনি code, conversation অথবা দুটোই restore করতে পারেন। Conversation-এর একটি অংশের summary-ও বানাতে পারেন। Summarize action-গুলো কোনো file পরিবর্তন করে না। Source 11সোর্স 11

Checkpoint সব পরিবর্তন track করে না: শুধু Bash command দিয়ে বদলানো file (Claude আগে file tool দিয়ে edit করে থাকলে /rewind পরের Bash পরিবর্তনও undo করে), Claude Code-এর বাইরের পরিবর্তন, সাধারণত subagent-এর করা edit, এবং symlinked ও hard-linked file। Source 11সোর্স 11

Database, API বা deployment-এর মতো remote system-এ করা কাজ checkpoint করা যায় না। Source 1সোর্স 1

Checkpoint হলো একটি session-এর মধ্যে দ্রুত recovery-র জন্য। এটি git-এর বিকল্প নয়। Source 11সোর্স 11

Permissions in one minute

Two mechanisms keep you safe: checkpoints let you undo file changes, and permissions control what Claude can do without asking. Source 1সোর্স 1 Press Shift+Tab to cycle the permission modes. Source 1সোর্স 1 The modes are default, acceptEdits, plan, auto, dontAsk, and bypassPermissions. Source 12সোর্স 12 Not all of these modes are in the Shift+Tab cycle. The Permission Modes page tells which modes join the cycle and explains each mode.

সহজ English

Two things keep you safe. Checkpoints let you undo file changes. Permissions control what Claude can do without a question to you. Source 1সোর্স 1 To go through the permission modes, press Shift+Tab. Source 1সোর্স 1 The modes are default, acceptEdits, plan, auto, dontAsk, and bypassPermissions. Source 12সোর্স 12 Shift+Tab does not go through all of them. The Permission Modes page tells which modes it includes.

বাংলা ব্যাখ্যা

দুটি ব্যবস্থা আপনাকে নিরাপদ রাখে: checkpoint দিয়ে আপনি file-এর পরিবর্তন undo করতে পারেন, আর permission ঠিক করে Claude আপনাকে না জিজ্ঞেস করে কী করতে পারবে। Source 1সোর্স 1 Permission mode-গুলো একটির পর একটি বদলাতে Shift+Tab চাপুন। Source 1সোর্স 1 Mode-গুলো হলো default, acceptEdits, plan, auto, dontAsk এবং bypassPermissions। Source 12সোর্স 12 এর সবগুলো Shift+Tab cycle-এ থাকে না। কোন mode-গুলো থাকে এবং প্রতিটি mode কী করে, তা Permission Modes পেজে আছে।

Where skills, subagents, MCP, and hooks fit

The extensions plug into different parts of the agentic loop: Source 8সোর্স 8 Source 1সোর্স 1

  • Skills add knowledge and workflows.
  • MCP servers connect external services, such as Jira or a database.
  • Hooks run automation.
  • Subagents take delegated work.

Each one costs context in a different way: Source 8সোর্স 8

FeatureWhat loads, and when
CLAUDE.mdThe full content at session start, in every request
SkillsThe descriptions at session start, the full body when used
MCP serversThe tool names at session start, the schemas on demand
SubagentsAn isolated context, separate from yours
HooksNothing, unless they return output

For a PostToolUse hook, only structured output in hookSpecificOutput.additionalContext enters Claude's context. Plain stdout on exit code 0 does not. Source 13সোর্স 13 For UserPromptSubmit, UserPromptExpansion, SessionStart, and PostModelSwitch hooks, Claude Code adds plain-text stdout as context. Source 13সোর্স 13

Don'tকরবেন না: Put a hard rule only in CLAUDE.md

Claude treats CLAUDE.md instructions as context, not as enforced configuration. Source 5সোর্স 5

Doকরুন: Enforce a hard rule with a hook

To block an action whatever Claude decides, use a PreToolUse hook. Source 5সোর্স 5 Source 8সোর্স 8

When the same feature exists at more than one level (user, project, local), these rules apply: Source 8সোর্স 8

  • CLAUDE.md files are additive.
  • Skills and subagents override by name.
  • MCP servers override by name: local, then project, then user.
  • Hooks merge: all registered hooks fire.

Older custom commands are now skills. A .claude/commands/deploy.md file and a .claude/skills/deploy/SKILL.md file both create /deploy. Source 2সোর্স 2

Example: the QA agent flow

This tutorial uses a qa-agent subagent with Jira and database MCP servers. The flow below is an example, not a feature of Claude Code.

You: "Review ticket PAY-4201 and design tests for src/payment.js"
        │
        ▼
Claude runs the loop (gather context → act → verify)
        │
        ├─ built-in tools ── read src/payment.js and the existing tests
        ├─ Jira MCP ──────── read ticket PAY-4201
        ├─ database MCP ──── read sample payment rows
        └─ qa-agent ──────── works in its own context window
                │
                ▼
        returns a summary: risks, test cases, evidence

The subagent returns only a summary to your conversation. Source 1সোর্স 1 The Subagents, Skills & Commands, MCP Servers, and Hooks pages show how to set up each part.

সহজ English

The extensions connect to different parts of the agentic loop: Source 8সোর্স 8 Source 1সোর্স 1

  • Skills add knowledge and workflows.
  • MCP servers connect external services, such as Jira or a database.
  • Hooks run automation.
  • Subagents do the work that is delegated to them.

Each one uses context in a different way. CLAUDE.md loads in full at session start. Skills load their descriptions at start and the full body when used. MCP servers load the tool names at start and the schemas on demand. A subagent has its own context. A hook adds nothing unless it returns output. Source 8সোর্স 8

Claude treats CLAUDE.md as context, not as an enforced rule. Source 5সোর্স 5 To block an action in all cases, use a PreToolUse hook. Source 5সোর্স 5

In this tutorial's example, a qa-agent subagent works in its own context window. It gives only a summary back to your conversation. Source 1সোর্স 1 This flow is an example, not a feature of Claude Code.

বাংলা ব্যাখ্যা

Extension-গুলো agentic loop-এর আলাদা আলাদা জায়গায় যুক্ত হয়: Source 8সোর্স 8 Source 1সোর্স 1

  • Skills জ্ঞান এবং workflow যোগ করে।
  • MCP servers বাইরের service যুক্ত করে, যেমন Jira বা একটি database।
  • Hooks automation চালায়।
  • Subagents সেই কাজ করে, যা তাদের delegate করা হয়।

প্রতিটির context খরচ আলাদা। CLAUDE.md session শুরুতেই পুরোটা load হয়, প্রতিটি request-এ থাকে। Skill-এর description শুরুতে load হয়, পুরো body load হয় ব্যবহারের সময়। MCP server-এর tool-এর নাম শুরুতে load হয়, schema load হয় দরকার হলে। Subagent-এর context আপনার context থেকে আলাদা। Hook কোনো output ফেরত না দিলে কিছুই load করে না। Source 8সোর্স 8

Claude CLAUDE.md-এর নির্দেশনাকে context হিসেবে নেয়, enforced configuration হিসেবে নয়। Source 5সোর্স 5 Claude যা-ই সিদ্ধান্ত নিক, কোনো action অবশ্যই block করতে চাইলে একটি PreToolUse hook ব্যবহার করুন। Source 5সোর্স 5

এই tutorial-এর উদাহরণে একটি qa-agent subagent নিজের context window-এ কাজ করে এবং আপনার conversation-এ শুধু একটি summary ফেরত দেয়। Source 1সোর্স 1 এই flow একটি উদাহরণ, Claude Code-এর কোনো feature নয়।

Where it runs

Claude Code runs locally, in the cloud, and through Remote Control. You use it from the terminal, the desktop app, IDE extensions, claude.ai/code, and CI/CD. The underlying agentic loop is the same in all of them. Source 1সোর্স 1

সহজ English

You can run Claude Code on your computer, in the cloud, and through Remote Control. You can use it from the terminal, the desktop app, IDE extensions, claude.ai/code, and CI/CD. In all of them, the agentic loop is the same. Source 1সোর্স 1

বাংলা ব্যাখ্যা

Claude Code আপনার নিজের কম্পিউটারে (locally), cloud-এ এবং Remote Control-এর মাধ্যমে চলে। আপনি এটি terminal, desktop app, IDE extension, claude.ai/code এবং CI/CD থেকে ব্যবহার করতে পারেন। সবগুলোতে ভেতরের agentic loop একই। Source 1সোর্স 1

  1. [1]
    How Claude Code works

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  2. [2]
    Glossary

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  3. [3]
    Tools reference

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  4. [4]
    Set up Claude Code in a monorepo or large codebase

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  5. [5]
    How Claude remembers your project

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  6. [6]
    Best practices for Claude Code

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  7. [7]
    Explore the context window

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  8. [8]
    Extend Claude Code

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  9. [9]
    Commands

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  10. [10]
    Model configuration

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  11. [11]
    Checkpointing

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  12. [12]
    Choose a permission mode

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  13. [13]
    Hooks reference

    Anthropic (Claude Code docs) · accessed 2026-10-10দেখা হয়েছে: 2026-10-10

  14. [14]
    Connect Claude Code to tools via MCP

    Anthropic (Claude Code docs) · accessed 2026-11-27দেখা হয়েছে: 2026-11-27