Running AI Agents as Actual Employees in Real Workflows
Running AI Agents as Actual Employees in Real Workflows
Right now I am running multiple Claude Code instances in parallel on the same codebase. Each one gets a discrete task - one handles social media engagement, another does PR reviews, a third is refactoring a module. This is not a demo or a proof of concept. This is the actual daily workflow.
The shift in how to think about this: it is not "using AI to help me code." It is "managing a team where the team members happen to be Claude instances."
The Task Assignment Pattern
Treat each agent like a junior employee. Give it a clear, scoped task with explicit success criteria. "Review the three open PRs and leave comments on code quality issues, focusing on error handling and test coverage" is a good task. "Help with the project" is not.
The key insight is that agents work best on tasks that are parallelizable and have clear completion criteria. Social media engagement does not depend on the PR review. The refactoring does not block the social media work. Each agent operates independently in its own context.
Claude Code's official Agent Teams documentation recommends starting with 3-5 teammates, giving each 5-6 tasks to keep them productive without excessive context switching. That matches real-world experience - more than five parallel agents and the coordination overhead starts eating the gains.
Setting Up Git Worktrees for Isolation
The biggest operational problem with parallel agents is merge conflicts. Two agents editing the same file simultaneously creates chaos. Git worktrees solve this:
# Create isolated worktree for each agent task
git worktree add /tmp/agent-social-media -b agent/social-media-$(date +%s)
git worktree add /tmp/agent-pr-review -b agent/pr-review-$(date +%s)
git worktree add /tmp/agent-refactor -b agent/refactor-$(date +%s)
# Launch agents in their isolated contexts
cd /tmp/agent-social-media && claude "Handle today's social media responses..."
cd /tmp/agent-pr-review && claude "Review PRs #47, #48, #49..."
cd /tmp/agent-refactor && claude "Refactor the auth module to use the new token format..."
Each agent gets its own branch and working directory. Claude Code supports this natively - when you run parallel subagents with worktree isolation, each gets its own temporary branch and repo copy automatically. No setup, no merge conflicts, no coordination overhead on the filesystem level.
A Coordination Rule That Actually Works
The simple rule: if two tasks might touch the same file, they run sequentially, not in parallel. Everything else is fair game.
In practice, categorize tasks into buckets:
- Always parallelizable: research, writing, PR review (comments only), social media, documentation
- Conditionally parallelizable: code changes in separate modules, tests for separate features
- Always sequential: changes to shared configuration, database migrations, package.json updates
A lockfile approach handles the conditional cases:
import fcntl
import os
def acquire_file_lock(filepath: str) -> bool:
"""Return True if we got the lock, False if another agent holds it."""
lock_path = f"{filepath}.agent.lock"
try:
fd = os.open(lock_path, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
os.write(fd, str(os.getpid()).encode())
os.close(fd)
return True
except FileExistsError:
return False
Social Media as an Agent Task
Social media engagement is surprisingly well-suited for AI agents. The agent reads relevant threads, drafts thoughtful responses, and posts them. It understands context from your CLAUDE.md about your product, your voice, and your positioning.
The agent's CLAUDE.md for social media tasks looks something like this:
## Social Media Context
Product: Fazm - open source macOS AI agent
Voice: Direct, technical, not salesy. Share what we've learned.
Tone: Peer-to-peer, not brand-to-user.
Avoid: Marketing speak, superlatives, promotional language.
When responding to threads:
1. Read the full thread context, not just the top post
2. Only respond if you have something genuinely useful to add
3. Link to relevant blog posts only when directly applicable
4. Never respond to threads with more than 500 comments - signal/noise too low
This is not automated spam. The responses are genuine, relevant, and add value to conversations. The agent is doing what you would do if you had three extra hours in the day.
PR Reviews as an Agent Task
Code review is a natural fit for parallel agents. The agent reads the diff, understands the project context from CLAUDE.md, checks for common issues, and leaves meaningful comments. It catches things like missing error handling, inconsistent naming, and potential performance issues.
A good PR review task prompt:
Review PR #47. Focus on:
1. Error handling - are all error paths handled?
2. Test coverage - are there tests for the new code paths?
3. Consistency - does it follow the patterns in the rest of the module?
4. Performance - any obvious N+1 queries or unnecessary allocations?
Leave inline comments. Do NOT approve or merge. Summary comment with overall assessment.
The important constraint: a human still merges. The agent reviews and comments - a human makes the final call. This is not about removing humans from the loop. It is about making the human's review faster and more focused on decisions rather than mechanics.
Orchestrator Pattern for Complex Workflows
For workflows where tasks have dependencies, use an orchestrator agent that coordinates the others:
ORCHESTRATOR TASK:
Today's workflow:
1. First: have Agent A review PRs #47 and #48
2. While A is reviewing: have Agent B draft this week's blog post outline
3. After A finishes: review A's PR comments, approve or flag for human review
4. After B finishes: review outline, expand the top section with Agent C
5. Final: compile summary of what each agent completed
The orchestrator does not do the work itself - it assigns tasks, monitors completion, and synthesizes results. This maps directly to how Claude Code Agent Teams work: one session acts as team lead, assigns to teammates, tracks progress.
What Changes When Agents Are Teammates
The mental model shift is real. You stop thinking "what can I ask the AI to help me with" and start thinking "what can I delegate and forget about until it is done."
The bottleneck is no longer coding speed. It is task clarity - knowing exactly what "done" means for each piece of work before you assign it. This turns out to be a skill that makes you a better engineer regardless of whether you are delegating to humans or agents. Clear success criteria, explicit constraints, defined scope. The discipline that makes agents productive is the same discipline that makes teams productive.
- Five Agents Same Codebase - Coordination Lessons
- Automate Social Media Engagement with AI Agent
- Multi-Agent Parallel Development
This post was inspired by a discussion on r/AI_Agents by u/voss_steven.
Fazm is an open source macOS AI agent. Open source on GitHub.