1/16/2026
Share this post:
Export:
If you've read the Zero to Hero guide, you know how to use Claude Code for building projects. This post goes deeper - into the architecture, the security model, and the power-user features that unlock new workflows.
What we'll cover:
You're at your desk, you start a complex refactoring task. Then you need to leave - pick up kids, walk the dog, grab lunch. With remote sessions, Claude keeps working in the cloud while you monitor from your phone.
/remote-env1. Fire off a task to the cloud:
# The & prefix sends work to a cloud VM
& Refactor the authentication module to use JWT tokens
Or explicitly:
claude --remote "Refactor the authentication module to use JWT tokens"
2. Monitor from anywhere:
Open claude.ai on your phone (or the Claude iOS app). Watch Claude work, ask questions, provide feedback - all while Claude executes autonomously in the cloud.
3. Pull it back when ready:
/teleport
This fetches the branch Claude created, loads the full conversation history, and you continue exactly where Claude left off.
Fire off multiple tasks simultaneously:
& Fix the flaky test in auth.spec.ts
& Update the API documentation
& Refactor the logger to use structured output
Each gets its own isolated VM. Check progress with /tasks. Press t to teleport into any completed session.
This is where it gets interesting. Anthropic built a sophisticated security model that lets Claude Code run autonomously without exposing your credentials.
When you send a task with &:
Key insight: Your session doesn't share infrastructure with anyone else's. Complete isolation.
Here's the clever part - your GitHub credentials never enter the sandbox:
┌─────────────────────────────────────────────────────────┐
│ SANDBOX VM │
│ ┌─────────────┐ │
│ │ Claude Code │ ──→ Scoped Credential (limited token) │
│ └─────────────┘ │ │
└───────────────────────────────│─────────────────────────┘
↓
┌───────────────────┐
│ GitHub Proxy │ ← Translates scoped
│ (Anthropic) │ credential to real token
└─────────┬─────────┘
↓
┌───────────────────┐
│ GitHub.com │
└───────────────────┘
How it works:
Why this matters: Even if the sandbox were compromised, an attacker couldn't exfiltrate your credentials. They never exist inside the sandbox.
The sandbox can't talk to arbitrary internet hosts. All traffic routes through a proxy with:
Domain allowlist (~200 approved domains):
Everything else is blocked unless you explicitly allow it via /remote-env.
Additional protections:
Even locally, Claude Code runs in a sandbox:
On Linux: Uses bubblewrap for containerization
On macOS: Uses Seatbelt (Apple's sandbox framework)
Write access: Current directory + subdirectories only
Read access: Broader, but with exclusions
Blocked: ~/.bashrc, system files, sensitive paths
Claude can't modify your shell config, read your SSH keys, or touch files outside your project.
When you /teleport a session back to your terminal:
One-way transfer: You can pull web→terminal, but can't push terminal→web. The & prefix creates a new cloud session with your current context.
You can create your own commands that expand into prompts.
Create .claude/commands/ in your repo:
<!-- .claude/commands/deploy.md -->
---
description: Deploy to staging environment
allowed-tools: Bash, Read
---
Deploy the current branch to staging:
1. Run the test suite first
2. Build the production bundle
3. Deploy using our deploy script: `./scripts/deploy-staging.sh`
4. Verify the deployment is healthy
5. Report the staging URL
Now anyone on your team can run /deploy.
Create ~/.claude/commands/ for commands available everywhere:
<!-- ~/.claude/commands/morning.md -->
---
description: Morning standup prep
---
Help me prepare for standup:
1. Show git log for my commits since yesterday
2. List any open PRs I created
3. Check for PRs where I'm requested as reviewer
4. Summarize what I should mention in standup
Run /morning in any project.
Arguments: Use $ARGUMENTS or $1, $2 for positional args:
<!-- .claude/commands/review-file.md -->
Review the file $1 for:
- Security vulnerabilities
- Performance issues
- Code style violations
Usage: /review-file src/auth/login.ts
Bash execution: Use ! prefix to include command output:
Current branch: !git branch --show-current
Recent commits: !git log --oneline -5
File references: Use @ prefix:
Follow the patterns in @src/components/Button.tsx
Hooks let you run commands automatically when Claude does certain things.
Add to .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "npm run lint:fix $CLAUDE_FILE_PATH"
}
]
}
]
}
}
This runs the linter automatically every time Claude writes or edits a file.
| Hook | When It Fires |
|---|---|
SessionStart | When Claude Code session begins |
PreToolUse | Before Claude uses a tool (can block) |
PostToolUse | After Claude uses a tool |
PostMessage | After Claude sends a message |
Auto-format on save:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "prettier --write $CLAUDE_FILE_PATH"
}
]
}
]
}
}
Install dependencies on session start:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "npm install"
}
]
}
]
}
}
Run tests after code changes:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "npm test -- --related $CLAUDE_FILE_PATH"
}
]
}
]
}
}
MCP (Model Context Protocol) lets you connect Claude Code to external tools and data sources.
Add to .claude/settings.json:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost/mydb"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
}
}
}
Once configured, Claude can use MCP tools naturally:
"Query the database for all users who signed up in the last week"
Claude will use the postgres MCP server to run the query.
The ecosystem is growing. Some popular ones:
@modelcontextprotocol/server-postgres - PostgreSQL access@modelcontextprotocol/server-filesystem - File system access@modelcontextprotocol/server-github - GitHub API@modelcontextprotocol/server-slack - Slack integration@modelcontextprotocol/server-memory - Persistent memoryCheck modelcontextprotocol.io for the full list.
MCP servers can expose their own slash commands:
/mcp__postgres__query SELECT * FROM users LIMIT 10
Or if there's no conflict, just:
/query SELECT * FROM users LIMIT 10
Claude Code can spawn specialized agents for specific tasks.
| Agent | Purpose |
|---|---|
Explore | Fast codebase exploration and search |
Plan | Architecture design and implementation planning |
Bash | Command execution specialist |
You can define custom agents in .claude/agents/:
<!-- .claude/agents/security-reviewer.md -->
---
name: Security Reviewer
description: Reviews code for security vulnerabilities
tools: Read, Grep, Glob
model: opus
---
You are a security expert. When asked to review code:
1. Check for injection vulnerabilities (SQL, command, XSS)
2. Look for authentication/authorization issues
3. Identify sensitive data exposure
4. Check for insecure dependencies
5. Review cryptographic implementations
Always cite specific line numbers and provide remediation steps.
Claude automatically uses appropriate agents, or you can be explicit:
"Use the security-reviewer agent to audit src/auth/"
For complex tasks, plan mode lets you design the approach before writing code.
/plan
Or start Claude Code in plan mode:
claude --permission-mode plan
In plan mode:
1. Enter plan mode: /plan
↓
2. Describe what you want to build
↓
3. Claude explores codebase, asks questions
↓
4. Claude proposes implementation plan
↓
5. You refine, ask questions, adjust
↓
6. Approve the plan
↓
7. Claude implements (now with write access)
The CLAUDE.md file gives Claude persistent context about your project.
/init
Or manually create CLAUDE.md in your project root.
# CLAUDE.md
## Project Overview
This is a Next.js e-commerce application with Stripe integration.
## Tech Stack
- Next.js 14 with App Router
- TypeScript (strict mode)
- Tailwind CSS
- PostgreSQL with Prisma ORM
- Stripe for payments
## Key Patterns
- All API routes use Zod for validation
- Use the `api` instance from ApiContext for authenticated requests
- Components go in `src/components/`, pages in `src/app/`
## Commands
- `pnpm dev` - Start development server
- `pnpm test` - Run tests
- `pnpm db:migrate` - Run database migrations
## Important Notes
- Never commit .env files
- All prices are stored in cents
- Use `formatPrice()` helper for display
Claude reads CLAUDE.md files from multiple locations:
# Start planning session in cloud
& I need to add user authentication. Let's discuss the approach first.
Monitor from phone, have the architecture discussion, then:
# From phone/web, tell Claude to execute
Now implement the plan we discussed.
Teleport back when complete to review and test.
Working on multiple independent features:
& Add dark mode support to the settings page
& Implement the export-to-CSV feature
& Write integration tests for the checkout flow
All three run simultaneously. Check /tasks, teleport the ones that finish, review and merge.
Set up a pre-commit hook:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "node scripts/security-check.js $CLAUDE_FILE_PATH"
}
]
}
]
}
}
Every file Claude writes gets security-scanned before it's saved.
With MCP postgres server configured:
"Look at the users table schema and create a TypeScript interface that matches it"
Claude queries the actual database, sees the real schema, generates accurate types.
/context
Shows a visual grid of context usage - helpful when Claude seems to be "forgetting" things.
/tasks
Lists all running and completed web sessions.
/doctor
Verifies Claude Code installation, shows available updates.
/export conversation.md
Saves the full conversation to a file for review or sharing.
Claude Code's advanced features enable workflows that weren't possible before:
The underlying philosophy: Give Claude Code the access it needs to be useful, but contain it securely so it can't cause damage. The proxy-based credential model, OS-level sandboxing, and network isolation all work together to make autonomous AI coding safe.
Claude Code is powerful for individual developers and small teams. But enterprise environments often need more:
What if your security team mandates AWS-only infrastructure? Or your legal team requires specific model providers? Claude Code is Claude-only. Enterprise teams need flexibility.
SOC 2? HIPAA? FedRAMP? Claude Code's security model is solid, but enterprises need complete audit trails, data sovereignty guarantees, and deployment in their own infrastructure.
Remote sessions are great for individual work. But what about:
This is why my team built B4M CLI - bringing enterprise capabilities to the command line.
What it adds:
| Capability | Claude Code | B4M CLI |
|---|---|---|
| AI Models | Claude only | 90+ models (OpenAI, Anthropic, Google, Meta, etc.) |
| Memory | Session-based | Persistent mementos across sessions |
| Deployment | Anthropic infrastructure | Your AWS account (optional) |
| Compliance | Anthropic's policies | SOC 2, HIPAA, FedRAMP (coming) |
| Collaboration | Remote sessions | Team workspaces, shared sessions, permissions |
| Autonomous Tasks | Background execution | Quest Master with multi-step planning |
The workflow is similar - you still work in your terminal, you still write prompts, you still build software. But with enterprise-grade infrastructure underneath.
Learn more at Bike4Mind Enterprise or try the B4M CLI.
This is a companion to the Zero to Hero: Building with Claude Code beginner's guide.
Have questions about advanced Claude Code usage? Reach out: erik at bike4mind dot com
Two Claude Codes, Two Repos, One Solution: A Multi-Agent Workflow Story
How two Claude Code instances collaborated across different repositories to solve a 500 error by mining proven patterns from production code. A meta-n...
Zero to Hero: Building with Claude Code
A complete beginner's guide to setting up your development environment and building your first project with Claude Code. Covers Mac and Windows, ...
The Control Plane: Maximizing the Human-Machine Interface
The paradigm shift as fundamental as mobile or cloud: humans commanding autonomous agent fleets. Not chatbots—control planes. Not UI-first—API-first. ...
Get notified when I publish new blog posts about game development, AI, entrepreneurship, and technology. No spam, unsubscribe anytime.