Claude Code with Agents
Claude Code with Agents
Claude Code is a terminal-based interface for Anthropic's Claude AI that includes a powerful feature called agents - separate Claude instances with fresh context windows that can work independently on delegated tasks.
Why Agents Matter
Traditional AI chat sessions suffer from context bloat: As conversations grow, the AI's context window fills up, making it harder to maintain focus and leading to degraded performance.
Agents solve this problem by letting you delegate specific tasks to fresh Claude instances, each with:
- A clean 200K token context window
- Specialized instructions/personas
- Independent work without affecting your main conversation
Installing Claude Code
bashnpm install -g @anthropic-ai/claude-code # or with pseudo if needed sudo npm install -g @anthropic-ai/claude-code
Launch:
bashclaude
Login:
- Requires Claude Pro subscription ($20/month)
- Or use API keys (pay-per-use)
- Same subscription works for browser + terminal
Creating Agents
Quick creation:
bash# Inside Claude session /agents
Then:
- Choose "Create new agent"
- Select scope:
- Project-specific (tied to current directory)
- Personal (available everywhere)
- Use Claude to generate agent instructions
- Set permissions (tools access)
- Choose model (Sonnet 4.5 recommended)
Example agent prompt:
You are a home lab research expert. Research topics thoroughly
using web search and compile findings into markdown documents.
Focus on practical implementation and cost considerations.
Using Agents
Deploy an agent:
markdownUse the @home-lab-guru agent to research the best NAS systems under $500 and create a comparison table in nas-recommendations.md
Multiple agents in parallel:
markdown1. Use @home-lab-guru to research Proxmox servers 2. Use @brutal-critic to review my script outline 3. Use @general-research to find the best pizza in Dallas
Claude will deploy all three agents simultaneously, each working independently.
Agent Features
Fresh Context Windows
Each agent gets 200K tokens of context. Your main conversation's bloated context doesn't affect agent performance.
Example:
- Main conversation: 85K tokens used (42%)
- Deploy agent: Fresh 200K tokens (0% used)
- Agent completes task: Uses 40K tokens
- Main conversation: Still only 88K tokens (context protected!)
Specialized Personas
Agents can have distinct personalities and expertise:
Brutal Critic:
You are a harsh script reviewer with impossibly high standards.
Use the framework in critic-framework.md to evaluate scripts.
Rate on a 1-10 scale and provide detailed criticism.
Include three different perspectives: pacing, clarity, engagement.
Session Closer:
You close out work sessions by:
1. Summarizing work done
2. Updating context files (claude.md, gemini.md, agents.md)
3. Committing changes to git with descriptive messages
4. Creating a session summary for next time
File Access
Agents can read/write files in your project directory:
markdown@research-agent compile findings into research-notes.md
The agent:
- Reads relevant files in the directory
- Writes output to the specified file
- No copy/paste needed
Output Styles
Output styles control Claude's system prompt and persona globally.
View/change:
bash# Inside Claude session /output-style
Create custom style:
bash/output-style new
Example styles:
code(default) - Developer-focused responsesscript-writing- Optimized for video scriptshome-lab-expert- Technical infrastructure focus
Switch mid-conversation:
bash/output-style # Select from list
Advanced Features
Planning Mode
Press Shift-Tab to cycle modes:
- Normal - Direct execution
- Planning - Creates detailed plan first, waits for approval
Use planning mode when:
- Task is complex and multi-step
- You want to review approach before execution
- Debugging previous failed attempts
Dangerous Mode
Skip permission prompts:
bashclaude --dangerously-skip-permissions
β οΈ Use carefully - AI will execute all actions without asking.
Good for:
- Running multiple web searches
- Batch file operations
- Automated workflows
Context Management
View context usage:
bash/context
Shows:
- Total tokens used
- Percentage of 200K limit
- Which files/messages consume most tokens
- Agent context windows (separate tracking)
Multi-AI Workflows
Claude Code works alongside other terminal AIs:
Same directory approach:
bash# Terminal 1 claude # Terminal 2 gemini # Terminal 3 codex
All three AIs:
- Read/write same project files
- Share context via
.mdfiles (claude.md, gemini.md, agents.md) - Can reference each other's work
Example workflow:
markdown# Terminal 1 (Claude) Write a hook for this video (authority angle) β authority-hook.md # Terminal 2 (Gemini) Write a hook for this video (discovery angle) β discovery-hook.md # Terminal 3 (Codex) Review both hooks and recommend which to use
Context Files Workflow
Create project context with /init:
bash/init
This creates claude.md:
- Analyzes current directory
- Describes project purpose
- Tracks decisions and progress
- Auto-loaded on future sessions
Update context:
markdownUpdate claude.md to reflect that we finished the script and are ready to record
Multi-tool sync:
Keep claude.md, gemini.md, agents.md in sync:
markdownUse @session-closer to sync all context files and commit changes to git
Agent Examples
Research Agent
markdownYou are a research expert. Use web search to gather information from reputable sources. Compile findings into structured markdown with citations. Focus on practical, actionable insights.
Use case: Background research without bloating main conversation
Brutal Critic Agent
markdownYou are impossibly hard to please. Review work against the framework in critic-framework.md. Provide harsh but constructive feedback. Rate 1-10 and explain why it's not a 10. Include three perspectives.
Use case: Unbiased review with fresh eyes
Session Closer Agent
markdownYou end work sessions by: 1. Comprehensively summarizing all work done 2. Updating claude.md, gemini.md, agents.md 3. Noting key decisions and next steps 4. Committing to git with descriptive message Read session-summary.md for past session notes.
Use case: Documentation automation when brain-dead at end of day
Gemini Delegator Agent
markdownYou delegate research tasks to Gemini in headless mode: gemini -p "search query here" Use Gemini for broad research, then synthesize findings.
Use case: Leveraging free Gemini tier for research tasks
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl-O | View agent's current work |
Shift-Tab | Cycle modes (normal/planning) |
Tab | Toggle thinking mode |
Ctrl-C (2x) | Interrupt agent/task |
/context | View context usage |
/agents | Agent management menu |
/output-style | Change global persona |
Tips
Protect your context:
- Deploy agents for one-off tasks
- Keep main conversation focused on current work
- Use
/contextto monitor bloat
Specialize agents:
- Create agents with distinct expertise
- Reference framework documents for consistency
- Use personal agents across projects
Automation:
- Create session-closer agent for end-of-day
- Use planning mode for complex tasks
- Run dangerous mode for batch operations
Multi-tool workflows:
- Keep context files synced
- Use Claude for execution, Gemini for research, ChatGPT for high-level review
- All work stored in local files (vendor-independent)
Links
NetworkChuck Video: You've Been Using AI the Hard Way
- URL: https://www.youtube.com/watch?v=MsQACpcuTkU
- Summary: Comprehensive guide to using AI in the terminal, focusing on Claude Code agents, context management, and multi-AI workflows
- Related: OpenCode, Gemini CLI, Context Files for AI Projects