A Multi-Agent QA System
One Claude session can analyze a story, design tests, run them, and judge the result. But when one session does every step, it also grades its own work. This page splits the work across four agents: a requirement analyst, a test designer, a test executor, and an adversarial reviewer. You learn to define each in Claude Code, pass work between them as files, and keep the reviewer read-only.
15 min read15 মিনিটে পড়া যায় · 11 sections11টি সেকশন · 10 sources10টি সোর্স · updated Nov 2026আপডেট: Nov 2026
Four agents, passing filesচারটি এজেন্ট, ফাইলে ফাইলে কাজ
Pass a story through four agents by files, then make the story vague and watch the chain stop.একটা স্টোরি চারটি এজেন্টের মধ্য দিয়ে ফাইলে পাঠান, তারপর স্টোরি অস্পষ্ট করুন আর দেখুন চেইন থেমে যায়।
You’ll learnআপনি শিখবেন
- What each of the four agents reads and writesচারটি এজেন্টের প্রত্যেকে কী পড়ে ও লেখে
- Why hand-offs are files, not chatহ্যান্ড-অফ কেন চ্যাট নয়, ফাইল
- Why the reviewer only sees filesরিভিউয়ার কেন শুধু ফাইল দেখে
- How one blocked status or open question stops the chainএকটা blocked status বা খোলা প্রশ্ন কীভাবে চেইন থামায়✓
- Where a person must approveকোথায় মানুষকে অনুমোদন দিতে হয়
Why several agents
A subagent is a specialist inside one Claude Code session. Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. Source 1সোর্স 1
What you gain
- Separate contexts. A long test log stays in the agent that made it. Only the summary comes back. Source 1সোর্স 1
- Specialization. A focused system prompt shapes one job, and a tool list limits what the agent can do. Source 1সোর্স 1
- Parallel work. Independent pieces of work run at the same time. Source 2সোর্স 2
- An independent review. You get a reviewer that has not seen how the work was made. Source 2সোর্স 2
What it costs
- Tokens. The cost is mostly tokens. Each subagent sends its own requests, and they count against the same usage as your main conversation. Source 1সোর্স 1 Source 2সোর্স 2
- Time. A fresh subagent first gathers context that your conversation already had, so it can be slower. Source 2সোর্স 2
- No extra intelligence. You get parallelism or a fresh pair of eyes, but not a smarter answer. Source 2সোর্স 2
- Context on return. Many subagents that each return detailed results can fill your main context. Source 1সোর্স 1
- Coordination. Agent teams add coordination overhead and use significantly more tokens than a single session. Source 4সোর্স 4 With teammates in plan mode, the docs give about 7x the tokens of a standard session. Source 3সোর্স 3
The tutorial's advice
Split QA work into agents only where a split buys something: a clean context for a noisy job, a tool limit, or a judge who did not do the work. A small story with three test cases does not need four agents. One session and the Subagents basics are enough.
সহজ English
A subagent is a helper inside one Claude Code session. Each helper has its own context window. It has its own instructions, its own tools, and its own permissions. Source 1সোর্স 1
Why use several helpers?
- A long test log stays with the helper that made it. Only a short summary comes back. Source 1সোর্স 1
- Each helper does one job well, and it can only use the tools you give it. Source 1সোর্স 1
- Separate jobs can run at the same time. Source 2সোর্স 2
- A reviewer can check work it did not see being made. Source 2সোর্স 2
What does it cost?
- More tokens. Each helper counts against the same usage as your main chat. Source 1সোর্স 1 Source 2সোর্স 2
- Sometimes more time, because a new helper must first learn the context. Source 2সোর্স 2
- No smarter answer. You get speed or fresh eyes, not more intelligence. Source 2সোর্স 2
- Teams of full sessions use many more tokens. Source 4সোর্স 4 Source 3সোর্স 3
The tutorial's advice: split the work only when the split helps. A tiny story does not need four helpers.
বাংলা ব্যাখ্যা
Subagent হলো একটি Claude Code session-এর ভেতরের একজন বিশেষজ্ঞ সাহায্যকারী। প্রতিটি subagent নিজের context window-এ চলে, তার নিজের system prompt, নিজের tool access এবং আলাদা permission থাকে। Source 1সোর্স 1
কয়েকটি agent ব্যবহার করলে আপনি কী পান:
- লম্বা test log সেই agent-এর কাছেই থাকে, শুধু summary ফিরে আসে। Source 1সোর্স 1
- প্রতিটি agent একটি কাজে মনোযোগ দেয়, আর tool list তার ক্ষমতা সীমিত রাখে। Source 1সোর্স 1
- আলাদা কাজ একসাথে চলে। Source 2সোর্স 2
- এমন একজন reviewer পান, যে কাজটি কীভাবে তৈরি হয়েছে তা দেখেনি। Source 2সোর্স 2
খরচ কী:
- মূল খরচ token। প্রতিটি subagent-এর request আপনার main conversation-এর একই usage থেকে কাটে। Source 1সোর্স 1 Source 2সোর্স 2
- নতুন subagent-কে আগে context জোগাড় করতে হয়, তাই কখনো সময় বেশি লাগে। Source 2সোর্স 2
- আপনি parallelism বা নতুন চোখ পান, কিন্তু বেশি বুদ্ধিমান উত্তর পান না। Source 2সোর্স 2
- Agent team একটি session-এর চেয়ে অনেক বেশি token খরচ করে। Source 4সোর্স 4 Source 3সোর্স 3
Tutorial-এর পরামর্শ: ভাগ করলে যেখানে সত্যিই লাভ হয়, শুধু সেখানেই কাজ ভাগ করুন। ছোট একটি story-র জন্য চারটি agent লাগে না।
Four QA roles
The table is the tutorial's own design. Each agent reads files from the step before it and writes one file for the step after it. The tools, skills, and model columns use the agent file fields that the next section lists. Source 1সোর্স 1
| Agent | Job | Reads | Writes | Tools | Model |
|---|---|---|---|---|---|
requirement-analyst | Turns a story into rules, acceptance criteria, and open questions. See Requirements. | The story text, the docs | analysis.md | Read, Grep, Glob, Write | opus |
test-designer | Turns the analysis into test cases and a blast radius. See Blast Radius. | analysis.md, the code | test-cases.md | Read, Grep, Glob, Write | sonnet |
test-executor | Runs the cases on a test environment and records results. See Test Execution. | test-cases.md | test-result.md | Read, Write, Bash | sonnet |
qa-reviewer | Tries to disprove each case or result. Returns a gate: PASS or BLOCKED. | All three files | nothing | Read, Grep, Glob | opus |
Rules for the design
- One job each. The executor does not design tests. The designer does not run them.
- Files on disk. Put the hand-off files in one folder per story, for example
qa-work/STORY-123/. - A reviewer that cannot write. Its verdict comes back as its final report, and the main session writes it to
review.md. - Skills hold the method. Each agent preloads the skill for its step, for example a
test-designskill.
Where these facts come from
The dMoney practice repo (commit 51db34a, see the Codebase Tour) already has two of these roles in .claude/agents/. qa-reviewer-agent has only Read, Grep, Glob, Skill, runs on claude-opus-5-5, and returns APPROVED, FLAGGED, or REJECTED per bug plus a PASS or BLOCKED gate. test-executor-agent has Read, Write, Glob, Grep, Bash, Skill, runs on sonnet, preloads the execute-test skill, writes a result file under .artifacts/, and does not design tests or raise bugs. The repo also has the skills understand-task, test-design, blast-radius, and find-bug. The Bug Hunt and Test and Retest pages show them at work.
সহজ English
This table is the tutorial's own design. Each helper reads the files of the step before it. It writes one file for the next step.
- requirement-analyst reads the story. It writes
analysis.mdwith rules, acceptance criteria, and open questions. See Requirements. - test-designer reads
analysis.md. It writestest-cases.md. See Blast Radius. - test-executor runs the test cases on a test system. It writes
test-result.md. See Test Execution. - qa-reviewer tries to prove each case or result wrong. It writes nothing. It says PASS or BLOCKED.
Each helper does one job. The work moves as files in one folder per story. The reviewer cannot write files, so the main session saves its answer.
The dMoney practice project already has two of these helpers: a read-only reviewer and a test executor. See the Codebase Tour, Bug Hunt, and Test and Retest pages.
বাংলা ব্যাখ্যা
এই table-টি tutorial-এর নিজের design। প্রতিটি agent আগের ধাপের file পড়ে এবং পরের ধাপের জন্য একটি file লেখে।
- requirement-analyst story পড়ে, তারপর rule, acceptance criteria আর খোলা প্রশ্নসহ
analysis.mdলেখে। দেখুন Requirements। - test-designer
analysis.mdপড়েtest-cases.mdলেখে। দেখুন Blast Radius। - test-executor test environment-এ case চালায় এবং
test-result.mdলেখে। দেখুন Test Execution। - qa-reviewer প্রতিটি case বা result ভুল প্রমাণ করার চেষ্টা করে। সে কিছু লেখে না, শুধু PASS বা BLOCKED gate ফেরত দেয়।
প্রতিটি agent-এর একটিই কাজ। কাজ এক story-র এক folder-এ file হিসেবে এগোয়। Reviewer file লিখতে পারে না, তাই main session তার রায় review.md-এ লেখে।
dMoney practice repo-তে এর দুটি role আগে থেকেই আছে: একটি read-only reviewer আর একটি test executor। বিস্তারিত দেখুন Codebase Tour, Bug Hunt এবং Test and Retest page-এ।
Write an agent file
A subagent is a Markdown file with YAML frontmatter between --- markers at the top. Source 1সোর্স 1 Put a project agent in .claude/agents/, so the team shares it through version control. Put a personal one in ~/.claude/agents/. Source 1সোর্স 1 Only name and description are required. The body under the frontmatter becomes the system prompt. Source 1সোর্স 1
| Field | What it sets |
|---|---|
name, description | The id, and when Claude should delegate to the agent Source 1সোর্স 1 |
tools, disallowedTools | An allowlist and a denylist of tools. With no tools, the agent inherits every tool available to subagents. Source 1সোর্স 1 |
model | sonnet, opus, haiku, fable, a full model ID, or inherit Source 1সোর্স 1 |
permissionMode | default, acceptEdits, auto, dontAsk, bypassPermissions, plan. manual is an alias for default. Source 1সোর্স 1 |
skills | Skills to preload. The full skill content goes into the context at startup. Source 1সোর্স 1 |
mcpServers | MCP servers for this agent: a configured server name or an inline definition Source 1সোর্স 1 |
hooks | Hooks that run only while this agent is active Source 1সোর্স 1 |
memory | A persistent memory directory: user, project, or local Source 1সোর্স 1 |
maxTurns | The most agentic turns before the agent stops Source 1সোর্স 1 |
effort, isolation, background, omitClaudeMd | Effort level, a temporary git worktree, always in the background, start without CLAUDE.md files Source 1সোর্স 1 |
color, initialPrompt, autoCompactWindow, experimental | Display color, a first turn for a main-session agent, a lower auto-compact window, experimental options Source 1সোর্স 1 |
Watch for these
- Claude Code ignores a field it does not recognize, with no error. Spell
disallowedToolsandpermissionModeexactly. Source 1সোর্স 1 - A plugin agent ignores
hooks,mcpServers, andpermissionMode. Source 1সোর্স 1 - A new or edited agent file in
.claude/agents/or~/.claude/agents/loads within a few seconds, with no restart. Directories added with--add-dirneed a restart. Source 1সোর্স 1 - With
memory: project, the agent keeps notes in.claude/agent-memory/<name-of-agent>/. Source 1সোর্স 1 - Keep descriptions short. Claude Code warns when the combined descriptions pass 15,000 tokens. Source 1সোর্স 1
সহজ English
An agent file is a Markdown file. At the top it has settings between --- lines. This top part is called frontmatter. Source 1সোর্স 1 Put a shared agent in .claude/agents/ in the project. Put a personal one in ~/.claude/agents/. Source 1সোর্স 1 Only name and description are required. The text under the settings becomes the agent's instructions. Source 1সোর্স 1
Other useful settings: Source 1সোর্স 1
toolsanddisallowedTools: which tools the agent may or may not use.model: which Claude model it runs on.permissionMode: how it asks for permission.skills: skills it loads at the start.mcpServers: connections to outside tools, only for this agent.hooks: hooks that run only while this agent works.memory: a folder where it keeps notes between sessions.maxTurns: how many steps it may take before it stops.
Be careful with spelling. Claude Code silently skips a setting name it does not know. Source 1সোর্স 1 Keep each description short. Source 1সোর্স 1
বাংলা ব্যাখ্যা
Subagent হলো একটি Markdown file, যার শুরুতে YAML frontmatter থাকে। Source 1সোর্স 1 Team-এর সাথে ভাগ করতে project-এর .claude/agents/-এ রাখুন, আর নিজের জন্য রাখুন ~/.claude/agents/-এ। Source 1সোর্স 1 শুধু name আর description বাধ্যতামূলক। Frontmatter-এর নিচের লেখা agent-এর system prompt হয়ে যায়। Source 1সোর্স 1
গুরুত্বপূর্ণ field: Source 1সোর্স 1
toolsআরdisallowedTools: কোন tool চলবে আর কোনটি চলবে না।model:sonnet,opus,haiku,fable, পুরো model ID, অথবাinherit।permissionMode: agent কোন permission mode-এ চলবে।skills: শুরুতেই যে skill পুরোপুরি load হবে।mcpServers: শুধু এই agent-এর জন্য MCP server।hooks: এই agent চলার সময় যে hook চলে।memory: session-এর পরেও থাকা note-এর folder।maxTurns: থামার আগে সর্বোচ্চ কতগুলো turn।
সাবধান: Claude Code অচেনা field কোনো error ছাড়াই উপেক্ষা করে, তাই বানান ঠিক রাখুন। Source 1সোর্স 1 Plugin agent hooks, mcpServers আর permissionMode উপেক্ষা করে। Source 1সোর্স 1 Description ছোট রাখুন। Source 1সোর্স 1
Delegation and built-in agents
Built-in subagents
| Agent | What the docs say |
|---|---|
| Explore | A fast, read-only agent for searching and analyzing codebases. Write and Edit are denied. Source 1সোর্স 1 |
| Plan | A research agent used during plan mode to gather context before it presents a plan. Write and Edit are denied. Source 1সোর্স 1 |
| general-purpose | For complex, multi-step tasks that need both exploration and action. Source 1সোর্স 1 |
Explore and Plan start without your CLAUDE.md files and the git status snapshot. Source 1সোর্স 1 So do not expect them to follow a QA rule that lives only in CLAUDE.md.
How Claude picks an agent
Claude delegates on its own from three inputs: your request, the description field of each agent, and the current context. A phrase such as "use proactively" in the description encourages it. Source 1সোর্স 1
To choose the agent yourself, use one of three ways: Source 1সোর্স 1
- Natural language. Name the agent in the prompt. Claude still decides.
- @-mention. Type
@and pick the agent, or type@agent-<name>. This tells Claude to run that agent for one task. - Whole session. Start with
claude --agent <name>, or setagentin settings. The main thread then takes on the agent's tool limits and model.
Preload a skill
The skills field injects the full content of each listed skill at startup. A skill with disable-model-invocation: true cannot be preloaded. Without the field, the agent can still find and invoke skills through the Skill tool. Source 1সোর্স 1
The tutorial's advice
For a QA pipeline, invoke each agent by @-mention. Automatic delegation is useful, but a gate step must not depend on whether Claude decides to delegate.
সহজ English
Claude Code has built-in helpers: Source 1সোর্স 1
- Explore searches the code fast. It cannot write or edit files.
- Plan collects facts in plan mode before Claude shows a plan. It cannot write or edit files.
- general-purpose does bigger jobs that need both reading and changing things.
Explore and Plan start without your CLAUDE.md file. Source 1সোর্স 1
Claude picks a helper by itself. It looks at your request, each helper's description, and the current context. Source 1সোর্স 1 You can also choose one yourself: Source 1সোর্স 1
- Name the helper in your prompt. Claude still decides.
- Use an @-mention,
@agent-<name>. This tells Claude to run that helper for that task. - Start the whole session as that helper with
claude --agent <name>.
The skills setting loads a skill's full text at the start. Source 1সোর্স 1
The tutorial's advice: use an @-mention for the gate steps, because it is the most explicit way to invoke a helper.
বাংলা ব্যাখ্যা
Claude Code-এ কিছু built-in subagent আছে: Source 1সোর্স 1
- Explore দ্রুত codebase খোঁজে ও বিশ্লেষণ করে। এটি read-only, Write আর Edit বন্ধ।
- Plan plan mode-এ plan দেখানোর আগে তথ্য জোগাড় করে। এটিও Write আর Edit করতে পারে না।
- general-purpose এমন জটিল কাজ করে, যেখানে খোঁজা আর পরিবর্তন দুটোই লাগে।
Explore আর Plan আপনার CLAUDE.md file ছাড়াই শুরু হয়। Source 1সোর্স 1
Claude নিজে থেকেই আপনার request, প্রতিটি agent-এর description আর বর্তমান context দেখে কাজ ভাগ করে দেয়। Source 1সোর্স 1 নিজে agent বেছে নিতে চাইলে তিনটি উপায় আছে: Source 1সোর্স 1
- Prompt-এ agent-এর নাম লিখুন, তবে সিদ্ধান্ত Claude নেবে।
@agent-<name>দিয়ে @-mention করুন, এটি Claude-কে ওই agent এক কাজের জন্য চালাতে বলে।claude --agent <name>দিয়ে পুরো session ওই agent হিসেবে চালান।
skills field শুরুতেই প্রতিটি skill-এর পুরো লেখা load করে। Source 1সোর্স 1
Tutorial-এর পরামর্শ: gate-এর ধাপে @-mention ব্যবহার করুন, কারণ এটি agent চালানোর সবচেয়ে স্পষ্ট উপায়।
Context and hand-offs
What a subagent knows. Each subagent starts with a fresh, isolated context. It does not see your conversation history, the skills you invoked, or the files Claude already read. Claude writes a delegation message that summarizes the task. Source 1সোর্স 1 If a rule must reach the agent, restate it in the prompt you give Claude when you delegate. Source 1সোর্স 1
What comes back. The verbose output stays in the subagent. Only the summary returns to the main conversation. Source 1সোর্স 1 Claude Code scans each final report before Claude reads it, but the scan does not judge whether the content is malicious. Source 1সোর্স 1
Pass work as files. A delegation message is a summary, and a summary can lose a detail. The tutorial suggests that each agent writes its full output to a file and returns only the path and a short status. The next agent reads the file. Then the evidence survives, and you can open it yourself.
Keep the reviewer independent. The docs give the reason: /code-review reviews a diff in a fresh subagent that never saw your conversation, so the reasoning that produced the code does not sway it. Source 2সোর্স 2 Apply the same rule to QA:
- Give the reviewer the output files and the requirement source. Do not paste the writer's reasoning.
- Ask for a fixed shape: a verdict per item, then one gate line.
- Tell it what to skip. The docs warn that a reviewer asked to find problems will always find something. Source 2সোর্স 2
The tutorial's hand-off template
Each agent ends its report with three lines: Status: done | blocked, Output: <path>, and Open questions: <count>. A blocked status or an open question stops the chain, and the main session asks you.
সহজ English
Each helper starts fresh. It does not see your chat, your skills, or the files Claude has read. Claude writes it a short task message. Source 1সোর্স 1 If a rule is important, repeat it in the task. Source 1সোর্স 1
Only a summary comes back to your main chat. Source 1সোর্স 1 Claude Code scans that report, but the scan does not decide if the text is harmful. Source 1সোর্স 1
The tutorial suggests passing work as files. Each helper saves its full result in a file. It returns only the file path and a short status. Then the evidence is kept.
Keep the reviewer independent. Give it the result files and the requirement. Do not give it the writer's thinking. A reviewer that never saw the work is not swayed by it. Source 2সোর্স 2 Also tell it what to skip, because a reviewer asked to find problems always finds something. Source 2সোর্স 2
The tutorial's template: each helper ends with its status, its output path, and its number of open questions. A "blocked" status or an open question stops the chain.
বাংলা ব্যাখ্যা
প্রতিটি subagent একদম নতুন context নিয়ে শুরু করে। আপনার conversation history, আগে invoke করা skill বা Claude যে file পড়েছে, সেগুলো সে দেখে না। Claude তার জন্য একটি delegation message লেখে। Source 1সোর্স 1 কোনো নিয়ম জরুরি হলে delegate করার prompt-এ সেটি আবার লিখুন। Source 1সোর্স 1
Main conversation-এ শুধু summary ফেরত আসে। Source 1সোর্স 1 Claude Code প্রতিটি report scan করে, কিন্তু content ক্ষতিকর কিনা সেটা বিচার করে না। Source 1সোর্স 1
Tutorial-এর পরামর্শ: কাজ file হিসেবে পাঠান। প্রতিটি agent তার পুরো ফলাফল একটি file-এ লেখে, আর শুধু path ও ছোট একটি status ফেরত দেয়। এতে কোনো প্রমাণ হারায় না।
Reviewer-কে স্বাধীন রাখুন। তাকে output file আর requirement দিন, writer-এর যুক্তি দেবেন না। যে reviewer কাজ তৈরি হতে দেখেনি, সে সেই যুক্তিতে প্রভাবিত হয় না। Source 2সোর্স 2 কী বাদ দেবে সেটাও বলে দিন, কারণ সমস্যা খুঁজতে বললে reviewer সবসময় কিছু না কিছু খুঁজে পায়। Source 2সোর্স 2
Tutorial-এর template: প্রতিটি agent status, output path আর খোলা প্রশ্নের সংখ্যা দিয়ে report শেষ করে। Blocked status বা খোলা প্রশ্ন থাকলে chain থামে, আর main session আপনাকে জিজ্ঞেস করে।
Escalation and approval points
An agent must stop and hand the decision to a person in four cases. This list is the tutorial's own rule:
- The requirement is ambiguous or two sources disagree.
- The agent's confidence in a verdict is low.
- The next action deletes data or writes to a database.
- The next action posts to a shared system: Jira, a GitHub issue, a pull request, a chat channel.
A subagent never gets the AskUserQuestion tool, even if you list it. Source 1সোর্স 1 So cases 1 and 2 go in the agent prompt: "stop and return your open questions". Cases 3 and 4 need a control that Claude Code enforces:
| Control | How it stops an agent |
|---|---|
| Ask rule | Prompts for confirmation before a matching tool call. Rules run in order: deny, then ask, then allow. Source 5সোর্স 5 |
PreToolUse hook | Returns allow, deny, ask, or defer for each tool call. ask prompts the user. Source 6সোর্স 6 A hook in settings.json runs before every tool that a subagent uses. Source 6সোর্স 6 |
SubagentStop hook | Runs when a subagent finishes, matches on the agent type, receives its final message, and can stop it from finishing. Source 6সোর্স 6 |
| Plan mode | Claude researches and proposes but does not edit. Edits wait until you approve the plan. Source 7সোর্স 7 When the main session is in plan mode, a subagent stays in plan mode too. Source 1সোর্স 1 |
Where the prompt appears. By default, a spawned subagent runs in the background, and its permission prompts show in your main session. Source 1সোর্স 1 In a claude -p run, no one can answer, so an ask is denied and Claude reads the reason in the tool result. Source 6সোর্স 6
Hooks in an agent file. A Stop hook in frontmatter becomes a SubagentStop hook. Source 1সোর্স 1 Claude Code skips the frontmatter hooks of a project agent until you trust its folder. Source 1সোর্স 1
The tutorial's advice
Approval comes before anything is written to a shared system. Keep the posting step out of the agents. The main session drafts the Jira comment or the issue, you read it, and only then does it post.
সহজ English
The tutorial's rule: a helper must stop and ask a person when:
- The requirement is unclear, or two sources disagree.
- It is not sure about its verdict.
- The next step would delete data or change a database.
- The next step would post to a shared system, like Jira or GitHub.
A helper cannot ask you a question directly. That tool is removed from helpers. Source 1সোর্স 1 So its instructions say: stop and list your questions.
For risky steps, use controls that Claude Code enforces:
- An ask rule makes Claude Code ask you first. Source 5সোর্স 5
- A
PreToolUsehook checks each tool call. It can allow, deny, ask you, or defer. Source 6সোর্স 6 It also runs for helpers. Source 6সোর্স 6 - A
SubagentStophook runs when a helper finishes. It can refuse to let the helper stop. Source 6সোর্স 6 - Plan mode lets Claude look and plan, but not edit, until you approve. Source 7সোর্স 7
The tutorial's advice: you approve before anything goes to a shared system.
বাংলা ব্যাখ্যা
Tutorial-এর নিজের নিয়ম: চারটি ক্ষেত্রে agent থামবে এবং সিদ্ধান্ত একজন মানুষের হাতে দেবে:
- Requirement অস্পষ্ট, বা দুটি source একমত নয়।
- নিজের verdict নিয়ে agent-এর আত্মবিশ্বাস কম।
- পরের কাজে data মুছে যাবে বা database-এ লেখা হবে।
- পরের কাজে Jira, GitHub issue বা pull request-এর মতো shared system-এ post হবে।
Subagent কখনো AskUserQuestion tool পায় না। Source 1সোর্স 1 তাই প্রথম দুটি ক্ষেত্র agent-এর prompt-এ লিখুন: "থামো এবং খোলা প্রশ্নগুলো ফেরত দাও"। বাকি দুটির জন্য Claude Code-এর enforce করা control লাগে:
- Ask rule মিলে যাওয়া tool call-এর আগে আপনার অনুমতি চায়। Rule-এর ক্রম: deny, তারপর ask, তারপর allow। Source 5সোর্স 5
PreToolUsehook প্রতিটি tool call-এ allow, deny, ask বা defer ফেরত দিতে পারে। Source 6সোর্স 6settings.json-এর hook subagent-এর প্রতিটি tool-এর আগেও চলে। Source 6সোর্স 6SubagentStophook subagent শেষ হলে চলে, তার শেষ message পায়, আর তাকে থামতে বাধা দিতে পারে। Source 6সোর্স 6- Plan mode-এ Claude শুধু খোঁজে আর প্রস্তাব দেয়; আপনি plan approve না করা পর্যন্ত edit বন্ধ থাকে। Source 7সোর্স 7
claude -p run-এ উত্তর দেওয়ার কেউ থাকে না, তাই ask deny হয়ে যায়। Source 6সোর্স 6
Tutorial-এর পরামর্শ: shared system-এ কিছু লেখার আগে আপনার approval লাগবে।
Guardrails for each agent
Least privilege. Give each agent only the tools its job needs. A reviewer with tools: Read, Grep, Glob cannot edit anything, and Claude Code enforces that limit, not the prompt. Source 1সোর্স 1 Omit Agent from its tools too, so it cannot spawn helpers. By default, subagents can nest up to three layers below the main conversation. Source 1সোর্স 1
Block commands with settings, not disallowedTools. A disallowedTools entry with a specifier, such as Bash(git push *), removes the whole Bash tool. To keep Bash and block one command, add a Bash deny rule in settings. Source 1সোর্স 1
Protect the application code. Permission rules are enforced by Claude Code, not by the model. Source 5সোর্স 5 Edit rules apply to all built-in tools that edit files. Source 5সোর্স 5 Deny rules hold in every permission mode, including auto and bypassPermissions. Source 7সোর্স 7 An example for a QA repo where the app lives in src/:
{
"permissions": {
"ask": ["Bash(git push *)", "Bash(gh issue create *)", "Bash(gh pr create *)"],
"deny": ["Edit(/src/**)", "Read(./.env)"]
}
}A Bash rule is not a security boundary around the program: the same program in another form can slip past it. Source 5সোর্স 5 For a hard limit, add the sandbox.
Sandbox the executor. The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs. It is off by default, and it covers shell commands only. File tools, MCP servers, and hooks run outside it. Source 8সোর্স 8 Its allowed network domains start empty, so list only the test environment. Source 8সোর্স 8
Scope MCP per agent. disallowedTools: mcp__* withholds every MCP tool from an agent. An MCP server defined inline in an agent's mcpServers reaches that agent and not the parent conversation. Source 1সোর্স 1
Mind the parent mode. When the main session runs in bypassPermissions, acceptEdits, or auto mode, the agent runs in that mode and its own permissionMode is ignored. Source 1সোর্স 1
সহজ English
Give each helper only the tools it needs. A reviewer with only Read, Grep, Glob cannot edit anything. Claude Code enforces this, not the instructions. Source 1সোর্স 1 Leave out Agent, so it cannot start more helpers. Source 1সোর্স 1
To block one command, use a deny rule in settings. A disallowedTools entry like Bash(git push *) removes all of Bash. Source 1সোর্স 1
Claude Code enforces permission rules, not the model. Source 5সোর্স 5 A deny rule on Edit(/src/**) keeps every built-in editing tool away from the app code. Source 5সোর্স 5 Deny rules hold in every permission mode. Source 7সোর্স 7 But a Bash rule is not a full wall. Source 5সোর্স 5
The sandbox is that wall for shell commands. The operating system enforces it. It is off by default. It does not cover file tools, MCP servers, or hooks. Source 8সোর্স 8
You can also keep MCP tools away from a helper, or give one helper its own MCP server. Source 1সোর্স 1
One more trap: if the main session runs in bypassPermissions, acceptEdits, or auto mode, the helper's own permission mode is ignored. Source 1সোর্স 1
বাংলা ব্যাখ্যা
প্রতিটি agent-কে শুধু তার কাজের জন্য দরকারি tool দিন। শুধু Read, Grep, Glob থাকলে reviewer কিছুই edit করতে পারে না, আর এই সীমা prompt নয়, Claude Code নিজে enforce করে। Source 1সোর্স 1 Agent-ও বাদ দিন, যাতে সে নতুন subagent চালু করতে না পারে। Source 1সোর্স 1
একটি command আটকাতে settings-এ Bash deny rule দিন। disallowedTools-এ Bash(git push *) লিখলে পুরো Bash tool-ই সরে যায়। Source 1সোর্স 1
Permission rule model নয়, Claude Code enforce করে। Source 5সোর্স 5 Edit(/src/**) deny rule সব built-in editing tool-কে application code থেকে দূরে রাখে। Source 5সোর্স 5 Deny rule auto আর bypassPermissions সহ সব mode-এ কাজ করে। Source 7সোর্স 7 তবে Bash rule পুরো নিরাপত্তা দেয় না। Source 5সোর্স 5
Shell command-এর জন্য শক্ত সীমা হলো sandbox, যা operating system enforce করে। এটি default-এ বন্ধ থাকে, আর file tool, MCP server ও hook এর বাইরে চলে। Source 8সোর্স 8 Network-এ শুধু test environment-এর domain allow করুন। Source 8সোর্স 8
disallowedTools: mcp__* দিলে agent কোনো MCP tool পায় না। Agent-এর mcpServers-এ inline server দিলে শুধু সেই agent সেটি পায়। Source 1সোর্স 1
সতর্কতা: main session bypassPermissions, acceptEdits বা auto mode-এ চললে agent-এর নিজের permissionMode উপেক্ষা হয়। Source 1সোর্স 1
Orchestration choices
| Option | What it is | Status and limits |
|---|---|---|
| Subagents in one session | Claude spawns workers, and results return to the caller. Source 4সোর্স 4 | By default, 20 running subagents is the concurrent limit. Source 1সোর্স 1 |
| Agent teams | One session is the lead. Teammates have their own context and message each other directly. Source 4সোর্স 4 | Experimental and disabled by default. Enable with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. Source 4সোর্স 4 |
| Dynamic workflows | A JavaScript script that orchestrates many subagents. The script decides what runs next. Source 9সোর্স 9 | Dozens to hundreds of agents per run. Source 9সোর্স 9 |
claude -p pipeline | Claude Code runs non-interactively. --allowedTools pre-approves tools. Source 10সোর্স 10 | Exit code 0 on success, non-zero on failure. Source 10সোর্স 10 |
Agent teams. For sequential tasks, same-file edits, or work with many dependencies, the docs prefer a single session or subagents. Source 4সোর্স 4 Two teammates that edit the same file overwrite each other. Source 4সোর্স 4 Keep teams small and use Sonnet for teammates. Source 3সোর্স 3 A teammate can reuse a subagent definition. Source 1সোর্স 1
Workflows. A workflow can have independent agents adversarially review each other's findings before they are reported. Source 9সোর্স 9
Scripted pipelines. In -p mode, --agents also accepts the path to a JSON file of agent definitions (Claude Code v2.1.281 or later). Source 10সোর্স 10 --bare skips the auto-discovery of hooks, skills, subagents, MCP servers, and CLAUDE.md. Source 10সোর্স 10 Without --bare, a -p session runs the hooks in the project's .claude/settings.json, even in a folder you have not trusted. Source 10সোর্স 10
The tutorial's advice
- Start with subagents in one session. The QA chain is sequential: analysis, design, execution, review. For sequential tasks, the docs say that a single session or subagents are more effective than an agent team. Source 4সোর্স 4
- Use a
claude -pscript when the same chain runs on every story in CI. Each step is one call, and the script checks the exit code and the gate line. - Use a workflow for a wide sweep, such as reviewing 40 old test cases with one reviewer each.
- Use an agent team only when testers must challenge each other, such as competing theories about one flaky test.
সহজ English
You can run several helpers in four ways:
- Subagents in one session. Claude starts helpers, and their results come back to it. Source 4সোর্স 4 Up to 20 can run at once by default. Source 1সোর্স 1
- Agent teams. One session leads. The other sessions talk to each other directly. Source 4সোর্স 4 This feature is experimental and off by default. Source 4সোর্স 4 Teams are a poor fit for step-by-step work or for edits to the same file. Source 4সোর্স 4 Keep teams small. Source 3সোর্স 3
- Dynamic workflows. A script runs many helpers, and the script decides what runs next. Source 9সোর্স 9 It can make helpers check each other's findings. Source 9সোর্স 9
- A
claude -pscript. Claude Code runs with no chat window. It returns exit code 0 when it works. Source 10সোর্স 10 The--bareoption skips the automatic search for hooks, skills, and helpers. Source 10সোর্স 10
The tutorial's advice: start with subagents in one session. QA work goes step by step, so that fits. Use a claude -p script to run the same chain in CI. Use a workflow for a big sweep. Use a team only when testers must argue about one problem.
বাংলা ব্যাখ্যা
কয়েকটি agent চালানোর চারটি উপায়:
- এক session-এ subagent। Claude worker চালু করে, আর ফলাফল তার কাছেই ফেরত আসে। Source 4সোর্স 4 Default-এ একসাথে 20টি subagent চলতে পারে। Source 1সোর্স 1
- Agent team। একটি session lead হয়, teammate-রা নিজেদের মধ্যে সরাসরি message পাঠায়। Source 4সোর্স 4 এটি experimental এবং default-এ বন্ধ;
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1দিয়ে চালু করতে হয়। Source 4সোর্স 4 ধাপে ধাপে কাজ বা একই file edit-এর জন্য এটি ভালো নয়। Source 4সোর্স 4 Team ছোট রাখুন। Source 3সোর্স 3 - Dynamic workflow। একটি JavaScript script অনেক subagent চালায়, আর পরের কাজ script ঠিক করে। Source 9সোর্স 9 এতে স্বাধীন agent একে অপরের finding যাচাই করতে পারে। Source 9সোর্স 9
claude -ppipeline। Claude Code non-interactive চলে, সফল হলে exit code 0 দেয়। Source 10সোর্স 10--barehook, skill, subagent আর CLAUDE.md-এর auto-discovery বাদ দেয়। Source 10সোর্স 10
Tutorial-এর পরামর্শ: এক session-এর subagent দিয়ে শুরু করুন, কারণ QA chain ধাপে ধাপে চলে। প্রতিটি story-তে CI-তে একই chain চালাতে claude -p script, বড় sweep-এর জন্য workflow, আর tester-দের মধ্যে তর্কের দরকার হলে তবেই agent team ব্যবহার করুন।
Practice
The tutorial's exercise
This exercise is the tutorial's own. Use a scratch copy of your project or of the dMoney practice repo (Codebase Tour). Run the executor only against a test environment, such as https://staging.example.com, with a QA test user.
- Create the folders. In the scratch repo, create
.claude/agents/andqa-work/STORY-1/. A new agent file is picked up without a restart; if Claude cannot find it, restart Claude Code. Source 1সোর্স 1 - Write four agent files. Use the roles table above. The reviewer is the important one. An example:
---
name: qa-reviewer
description: Read-only adversarial reviewer of test cases and test results. Use after test design and after execution.
tools: Read, Grep, Glob
model: opus
---
You review QA work that you did not write. Read the files you are given and the requirement.
For each test case, try to disprove it: no requirement basis, a vague expected result,
missing test data, a duplicate. Give APPROVED, FLAGGED, or REJECTED with a reason.
Skip style. End with one line: "Gate: PASS" or "Gate: BLOCKED".- Run the analyst. Paste a story into
qa-work/STORY-1/story.md. Type:@agent-requirement-analyst analyze qa-work/STORY-1/story.md and write qa-work/STORY-1/analysis.md. Expect a list of rules, acceptance criteria, and open questions. Answer the questions yourself. - Run the designer. Type:
@agent-test-designer write qa-work/STORY-1/test-cases.md from analysis.md. Then add one weak case by hand: "TC-99: Check that the form works. Expected: it works." - Run the reviewer. Type:
@agent-qa-reviewer review qa-work/STORY-1/test-cases.md against analysis.md. Expect TC-99 to come back REJECTED or FLAGGED, and the gate to be BLOCKED. - Fix and repeat. Remove TC-99, run the reviewer again, and wait for
Gate: PASS. Only then run the executor. - Check the guardrails. Ask the reviewer to fix a case itself. It has no Edit or Write tool, so it cannot. Source 1সোর্স 1 Run
/permissionsto see your ask and deny rules and the file that each one comes from. Source 5সোর্স 5
সহজ English
This is the tutorial's own exercise. Use a scratch copy of your project or of the dMoney practice repo. Run tests only on a test system, with a QA test user.
- Make the folders
.claude/agents/andqa-work/STORY-1/. A new agent file loads without a restart; if Claude cannot find it, restart Claude Code. Source 1সোর্স 1 - Write four agent files from the roles table. Give the reviewer only
Read, Grep, Glob. - Put a story in
story.md. Ask the analyst, by @-mention, to writeanalysis.md. Answer its open questions. - Ask the designer to write
test-cases.md. Then add one weak case by hand, like "Check that the form works." - Ask the reviewer to review the test cases. The weak case should be rejected or flagged. The gate should say BLOCKED.
- Remove the weak case. Review again until the gate says PASS. Only then run the executor.
- Ask the reviewer to fix a case itself. It cannot, because it has no editing tool. Source 1সোর্স 1 Run
/permissionsto see your rules. Source 5সোর্স 5
বাংলা ব্যাখ্যা
এটি tutorial-এর নিজের exercise। আপনার project বা dMoney practice repo-র একটি scratch copy ব্যবহার করুন। Test শুধু test environment-এ, QA test user দিয়ে চালান।
.claude/agents/আরqa-work/STORY-1/folder বানান। নতুন agent file restart ছাড়াই load হয়; Claude না পেলে Claude Code restart করুন। Source 1সোর্স 1- Roles table দেখে চারটি agent file লিখুন। Reviewer-কে শুধু
Read, Grep, Globদিন। story.md-এ একটি story রাখুন। @-mention দিয়ে analyst-কেanalysis.mdলিখতে বলুন, তারপর তার খোলা প্রশ্নের উত্তর দিন।- Designer-কে
test-cases.mdলিখতে বলুন। তারপর হাতে একটি দুর্বল case যোগ করুন, যেমন "form কাজ করে কিনা দেখুন"। - Reviewer-কে test case review করতে বলুন। দুর্বল case-টি REJECTED বা FLAGGED হওয়া উচিত, আর gate হবে BLOCKED।
- দুর্বল case মুছে আবার review চালান, যতক্ষণ না gate PASS হয়। তারপরই executor চালান।
- Reviewer-কে নিজে একটি case ঠিক করতে বলুন। Edit বা Write tool না থাকায় সে পারবে না। Source 1সোর্স 1
/permissionsচালিয়ে আপনার rule-গুলো দেখুন। Source 5সোর্স 5
Common mistakes
- The writer reviews its own work. A reviewer in the same context is swayed by the reasoning that made the work. Fix: a separate reviewer agent with a fresh context. Source 2সোর্স 2
- A read-only rule that lives only in the prompt. A prompt shapes what Claude tries, but permission rules are what Claude Code enforces. Source 5সোর্স 5 Fix: set
tools: Read, Grep, Globon the reviewer. Source 1সোর্স 1 - A misspelled field.
disallowed-toolsorpermission_modeis ignored with no error, so the limit you wanted is not there. Source 1সোর্স 1 Fix: use the exact camelCase names. Bash(git push *)indisallowedTools. It removes the whole Bash tool. Source 1সোর্স 1 Fix: put the command in a settings deny or ask rule.- Expecting the agent's
permissionModeto hold. UnderbypassPermissions,acceptEdits, or auto mode in the main session, it is ignored. Source 1সোর্স 1 Fix: run the QA chain in default mode, and use deny rules, which hold in every mode. Source 7সোর্স 7 - Too many agents for a small task. Each one costs tokens and startup time. Source 2সোর্স 2 Fix (the tutorial's advice): one session for a small story; four agents for a story with real risk.
- Hand-offs only in chat. A summary can drop the evidence. Fix (the tutorial's advice): every agent writes a file and returns its path.
সহজ English
- The writer checks its own work. It is swayed by its own reasoning. Use a separate reviewer that starts fresh. Source 2সোর্স 2
- "Read-only" only in the instructions. Instructions are not enforced. Permission rules are. Source 5সোর্স 5 Give the reviewer only
Read, Grep, Glob. Source 1সোর্স 1 - A misspelled setting name. Claude Code skips it with no error. Source 1সোর্স 1
Bash(git push *)indisallowedTools. That removes all of Bash. Source 1সোর্স 1 Use a deny rule in settings instead.- Trusting the helper's permission mode. Some main session modes override it. Source 1সোর্স 1 Deny rules hold in every mode. Source 7সোর্স 7
- Too many helpers. Each one costs tokens and time. Source 2সোর্স 2
- Passing work only in chat. The tutorial's advice: save every result to a file.
বাংলা ব্যাখ্যা
- যে লিখেছে সে-ই review করে। নিজের যুক্তিতে সে প্রভাবিত হয়। নতুন context-এর আলাদা reviewer ব্যবহার করুন। Source 2সোর্স 2
- Read-only নিয়ম শুধু prompt-এ। Prompt enforce হয় না, permission rule হয়। Source 5সোর্স 5 Reviewer-কে শুধু
Read, Grep, Globদিন। Source 1সোর্স 1 - Field-এর ভুল বানান। Claude Code কোনো error ছাড়াই সেটি উপেক্ষা করে। Source 1সোর্স 1 ঠিক camelCase নাম লিখুন।
disallowedTools-এBash(git push *)। এতে পুরো Bash সরে যায়। Source 1সোর্স 1 বদলে settings-এ deny বা ask rule দিন।- Agent-এর
permissionMode-এর ওপর ভরসা। Main session-এর কিছু mode এটি উপেক্ষা করায়। Source 1সোর্স 1 Deny rule সব mode-এ কাজ করে। Source 7সোর্স 7 - ছোট কাজে বেশি agent। প্রতিটি agent token আর সময় খরচ করে। Source 2সোর্স 2
- শুধু chat-এ hand-off। Tutorial-এর পরামর্শ: প্রতিটি ফলাফল file-এ লিখুন।
Key words
| Term | Meaning |
|---|---|
| Subagent | A specialist inside one Claude Code session, with its own context window, system prompt, tools, and permissions |
| Agent file | A Markdown file with YAML frontmatter in .claude/agents/ or ~/.claude/agents/; only name and description are required |
| Frontmatter | The settings between --- lines at the top of an agent file, such as tools, model, skills, and hooks |
| Delegation message | The task summary that Claude writes for a subagent, which starts with a fresh context |
| Adversarial reviewer | A read-only agent that tries to disprove each test case or result and returns a gate |
| Gate | The reviewer's final verdict line: PASS or BLOCKED |
| Ask rule | A permission rule that prompts for confirmation before a matching tool call |
SubagentStop hook | A hook that runs when a subagent finishes and can stop it from finishing |
| Bash sandbox | An operating-system boundary around shell commands; off by default |
| Agent team | Several Claude Code sessions with a lead; experimental and disabled by default |
| Dynamic workflow | A JavaScript script that orchestrates many subagents and decides what runs next |