agent-swarm-workflowJeffrey Emanuel's multi-agent implementation workflow using NTM, Agent Mail, Beads, and BV. The execution phase that follows planning and bead creation. Includes exact prompts used.
Install via ClawdBot CLI:
clawdbot install clawdnw/agent-swarm-workflowCore Insight: Every agent is fungible and a generalist. They all use the same base model and read the same AGENTS.md. Simply telling one it's a "frontend agent" doesn't make it better at frontend.
>
The swarm is distributed, robust, and self-organizing through Agent Mail and Beads.
Before starting a swarm:
planning-workflow skill)beads-workflow skill)am or ~/projects/mcp_agent_mail/scripts/run_server_with_token.sh)āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā BEADS ā
ā (Task graph with dependencies, priorities, status) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāā“āāāāāāāāāā
ā¼ ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā BV ā ā AGENT MAIL ā
ā (What to work on) ā ā (Coordination layer) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā
āāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā NTM + AGENTS ā
ā āāāāāāā āāāāāāā āāāāāāā āāāāāāā āāāāāāā āāāāāāā ā
ā ā CC ā ā CC ā ā Cod ā ā Gmi ā ā CC ā ā Cod ā ā
ā āāāāāāā āāāāāāā āāāāāāā āāāāāāā āāāāāāā āāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
# Spawn a swarm with multiple agents
ntm spawn myproject --cc=3 --cod=2 --gmi=1
# Send initial prompt to all Claude Code agents
ntm send myproject --cc "$(cat initial_prompt.txt)"
# Or send to all agents
ntm send myproject --all "$(cat initial_prompt.txt)"
Create tmux sessions/panes for each agent in your project folder.
Give each agent this EXACT prompt to start:
First read ALL of the AGENTS dot md file and README dot md file super carefully and understand ALL of both! Then use your code investigation agent mode to fully understand the code, and technical architecture and purpose of the project. Then register with MCP Agent Mail and introduce yourself to the other agents.
Be sure to check your agent mail and to promptly respond if needed to any messages; then proceed meticulously with your next assigned beads, working on the tasks systematically and meticulously and tracking your progress via beads and agent mail messages.
Don't get stuck in "communication purgatory" where nothing is getting done; be proactive about starting tasks that need to be done, but inform your fellow agents via messages when you do so and mark beads appropriately.
When you're not sure what to do next, use the bv tool mentioned in AGENTS dot md to prioritize the best beads to work on next; pick the next one that you can usefully work on and get started. Make sure to acknowledge all communication requests from other agents and that you are aware of all active agents and their names. Use ultrathink.
Once agents complete a bead, use this prompt to keep them moving:
Reread AGENTS dot md so it's still fresh in your mind. Use ultrathink. Use bv with the robot flags (see AGENTS dot md for info on this) to find the most impactful bead(s) to work on next and then start on it. Remember to mark the beads appropriately and communicate with your fellow agents. Pick the next bead you can actually do usefully now and start coding on it immediately; communicate what you're working on to your fellow agents and mark beads appropriately as you work. And respond to any agent mail messages you've received.
Have agents review their work before moving on:
Great, now I want you to carefully read over all of the new code you just wrote and other existing code you just modified with "fresh eyes" looking super carefully for any obvious bugs, errors, problems, issues, confusion, etc. Carefully fix anything you uncover. Use ultrathink.
Keep running this until they stop finding bugs.
When an agent does a compaction, immediately follow up with:
Reread AGENTS dot md so it's still fresh in your mind. Use ultrathink.
This re-establishes the critical context about tools and workflows.
Periodically have agents review each other's work:
Ok can you now turn your attention to reviewing the code written by your fellow agents and checking for any issues, bugs, errors, problems, inefficiencies, security problems, reliability issues, etc. and carefully diagnose their underlying root causes using first-principle analysis and then fix or revise them if necessary? Don't restrict yourself to the latest commits, cast a wider net and go super deep! Use ultrathink.
For deep quality checks:
I want you to sort of randomly explore the code files in this project, choosing code files to deeply investigate and understand and trace their functionality and execution flows through the related code files which they import or which they are imported by.
Once you understand the purpose of the code in the larger context of the workflows, I want you to do a super careful, methodical, and critical check with "fresh eyes" to find any obvious bugs, problems, errors, issues, silly mistakes, etc. and then systematically and meticulously and intelligently correct them.
Be sure to comply with ALL rules in AGENTS dot md and ensure that any code you write or revise conforms to the best practice guides referenced in the AGENTS dot md file. Use ultrathink.
Have agents commit logically grouped changes:
Now, based on your knowledge of the project, commit all changed files now in a series of logically connected groupings with super detailed commit messages for each and then push. Take your time to do it right. Don't edit the code at all. Don't commit obviously ephemeral files. Use ultrathink.
Do we have full unit test coverage without using mocks/fake stuff? What about complete e2e integration test scripts with great, detailed logging? If not, then create a comprehensive and granular set of beads for all this with tasks, subtasks, and dependency structure overlaid with detailed comments.
Great, now I want you to super carefully scrutinize every aspect of the application workflow and implementation and look for things that just seem sub-optimal or even wrong/mistaken to you, things that could very obviously be improved from a user-friendliness and intuitiveness standpoint, places where our UI/UX could be improved and polished to be slicker, more visually appealing, and more premium feeling and just ultra high quality, like Stripe-level apps.
I still think there are strong opportunities to enhance the UI/UX look and feel and to make everything work better and be more intuitive, user-friendly, visually appealing, polished, slick, and world class in terms of following UI/UX best practices like those used by Stripe, don't you agree? And I want you to carefully consider desktop UI/UX and mobile UI/UX separately while doing this and hyper-optimize for both separately to play to the specifics of each modality. I'm looking for true world-class visual appeal, polish, slickness, etc. that makes people gasp at how stunning and perfect it is in every way. Use ultrathink.
Each agent:
file_reservation_paths)thread_id# Before starting work on a bead
file_reservation_paths(
project_key="/path/to/project",
agent_name="GreenCastle",
paths=["src/auth/**/*.ts"],
ttl_seconds=3600,
exclusive=True,
reason="bd-123"
)
# After completing work
release_file_reservations(project_key, agent_name)
# Announce starting a bead
send_message(
project_key, agent_name,
to=["BlueLake", "RedMountain"], # Other active agents
subject="[bd-123] Starting auth module",
body_md="I'm taking bd-123. Reserved src/auth/**.",
thread_id="bd-123"
)
# Update on completion
send_message(
project_key, agent_name,
to=["BlueLake", "RedMountain"],
subject="[bd-123] Completed",
body_md="Auth module done and tested. Released file reservations.",
thread_id="bd-123"
)
# THE MEGA-COMMAND: Start here
bv --robot-triage
# Just get the single top pick
bv --robot-next
# Get parallel execution tracks (for multi-agent)
bv --robot-plan
# Check for cycles (MUST FIX if found)
bv --robot-insights | jq '.Cycles'
# Find bottlenecks
bv --robot-insights | jq '.bottlenecks'
CRITICAL: Never run bare bv ā it launches interactive TUI that blocks the session.
Keep running these prompts in rounds until they consistently come back with no changes:
When all three types of reviews return clean (no bugs found, no changes made), the code is likely solid.
First read ALL of the AGENTS dot md file and README dot md file super carefully and understand ALL of both! Then use your code investigation agent mode to fully understand the code, and technical architecture and purpose of the project. Then register with MCP Agent Mail and introduce yourself to the other agents.
Be sure to check your agent mail and to promptly respond if needed to any messages; then proceed meticulously with your next assigned beads, working on the tasks systematically and meticulously and tracking your progress via beads and agent mail messages.
Don't get stuck in "communication purgatory" where nothing is getting done; be proactive about starting tasks that need to be done, but inform your fellow agents via messages when you do so and mark beads appropriately.
When you're not sure what to do next, use the bv tool mentioned in AGENTS dot md to prioritize the best beads to work on next; pick the next one that you can usefully work on and get started. Make sure to acknowledge all communication requests from other agents and that you are aware of all active agents and their names. Use ultrathink.
Reread AGENTS dot md so it's still fresh in your mind. Use ultrathink. Use bv with the robot flags (see AGENTS dot md for info on this) to find the most impactful bead(s) to work on next and then start on it. Remember to mark the beads appropriately and communicate with your fellow agents. Pick the next bead you can actually do usefully now and start coding on it immediately; communicate what you're working on to your fellow agents and mark beads appropriately as you work. And respond to any agent mail messages you've received.
Great, now I want you to carefully read over all of the new code you just wrote and other existing code you just modified with "fresh eyes" looking super carefully for any obvious bugs, errors, problems, issues, confusion, etc. Carefully fix anything you uncover. Use ultrathink.
Ok can you now turn your attention to reviewing the code written by your fellow agents and checking for any issues, bugs, errors, problems, inefficiencies, security problems, reliability issues, etc. and carefully diagnose their underlying root causes using first-principle analysis and then fix or revise them if necessary? Don't restrict yourself to the latest commits, cast a wider net and go super deep! Use ultrathink.
I want you to sort of randomly explore the code files in this project, choosing code files to deeply investigate and understand and trace their functionality and execution flows through the related code files which they import or which they are imported by.
Once you understand the purpose of the code in the larger context of the workflows, I want you to do a super careful, methodical, and critical check with "fresh eyes" to find any obvious bugs, problems, errors, issues, silly mistakes, etc. and then systematically and meticulously and intelligently correct them.
Be sure to comply with ALL rules in AGENTS dot md and ensure that any code you write or revises conforms to the best practice guides referenced in the AGENTS dot md file. Use ultrathink.
Reread AGENTS dot md so it's still fresh in your mind. Use ultrathink.
Now, based on your knowledge of the project, commit all changed files now in a series of logically connected groupings with super detailed commit messages for each and then push. Take your time to do it right. Don't edit the code at all. Don't commit obviously ephemeral files. Use ultrathink.
Do we have full unit test coverage without using mocks/fake stuff? What about complete e2e integration test scripts with great, detailed logging? If not, then create a comprehensive and granular set of beads for all this with tasks, subtasks, and dependency structure overlaid with detailed comments.
Great, now I want you to super carefully scrutinize every aspect of the application workflow and implementation and look for things that just seem sub-optimal or even wrong/mistaken to you, things that could very obviously be improved from a user-friendliness and intuitiveness standpoint, places where our UI/UX could be improved and polished to be slicker, more visually appealing, and more premium feeling and just ultra high quality, like Stripe-level apps.
I still think there are strong opportunities to enhance the UI/UX look and feel and to make everything work better and be more intuitive, user-friendly, visually appealing, polished, slick, and world class in terms of following UI/UX best practices like those used by Stripe, don't you agree? And I want you to carefully consider desktop UI/UX and mobile UI/UX separately while doing this and hyper-optimize for both separately to play to the specifics of each modality. I'm looking for true world-class visual appeal, polish, slickness, etc. that makes people gasp at how stunning and perfect it is in every way. Use ultrathink.
PLAN āāāŗ BEADS āāāŗ SWARM āāāŗ REVIEW āāāŗ COMMIT
ā ā ā ā
ā ā āāāāāā¬āāāāā
ā ā ā
ā āāāāāā REPEAT āāā
ā ā
ā v2 PLAN āāāāāāāāāāāāāā
ā ā
āāāāāāāāāāāāāāāā
Each cycle improves:
Q: How do agents know what to work on?
A: They use bv --robot-triage or bv --robot-next to find the highest-impact ready bead.
Q: How do they avoid conflicts?
A: File reservations in Agent Mail. Exclusive reservations block others; the pre-commit guard enforces it.
Q: What if an agent crashes or forgets?
A: Every agent is fungible. Start a new session, read AGENTS.md, check bead status, continue.
Q: How many agents should I run?
A: Depends on project complexity. Start with 3-6. More agents = faster but more coordination overhead.
Q: What model mix works best?
A: Mix recommended. Try 3 Claude Code (Opus), 2 Codex (GPT 5.2), 1 Gemini. They have different strengths.
Q: Do agents need individual areas of expertise?
A: No, every agent is fungible and a generalist. Simply telling one it's a frontend agent doesn't make it better at frontend.
Q: Is there traceability between git commit and bead?
A: Yes, bv automatically does this analysis and links beads to relevant git commits by analyzing the stream of data and making logical deductions.
Generated Mar 1, 2026
A startup building a new SaaS product uses the swarm to implement multiple features simultaneously, such as user authentication, dashboard widgets, and API integrations. Agents work on different beads in parallel, coordinating via Agent Mail to ensure consistency and avoid conflicts, speeding up development cycles.
A financial institution upgrades an old monolithic banking application to microservices. The swarm breaks down the migration into beads for refactoring modules, updating APIs, and implementing security checks. Agents use BV to prioritize high-risk components and NTM to manage distributed coding sessions.
A mobile app agency develops a React Native app for iOS and Android with shared backend logic. Swarm agents handle frontend UI components, backend API endpoints, and database schemas concurrently, using beads to track dependencies and Agent Mail for real-time updates on compatibility issues.
An e-commerce company builds a data pipeline to process customer analytics using machine learning models. Agents implement beads for data ingestion, model training, and visualization dashboards, with periodic cross-agent reviews to ensure data integrity and performance optimization.
A decentralized open-source project uses the swarm to manage contributions from global developers. Beads represent issues and features, with agents assigned via NTM to work on code, documentation, and testing, leveraging Agent Mail for asynchronous collaboration and BV to focus on high-impact tasks.
Offer tailored swarm workflow setups for enterprises, charging per project or hourly for configuring NTM, beads, and Agent Mail. Revenue comes from reduced development time and improved code quality, with upsells for ongoing maintenance and training.
Develop a cloud-based platform that provides managed Agent Mail servers, bead management tools, and NTM interfaces as a service. Monetize through subscription tiers based on team size and features, targeting remote and hybrid development teams seeking efficient parallel workflows.
Create courses and certifications on using the Agent Swarm Workflow, including best practices for bead creation and Agent Mail coordination. Generate revenue from course sales, workshops, and certification exams, appealing to developers and project managers in tech companies.
š¬ Integration Tip
Integrate the swarm with existing CI/CD pipelines by using beads to trigger automated tests and deployments, ensuring seamless workflow from development to production.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection