Video Summary

Every Claude Code Workflow Explained (& When to Use Each)

Simon Scrapes

Main takeaways
01

Claude Code includes three built-in sub-agents (explore, plan, general-purpose) that run automatically to keep conversations clean.

02

Pattern 1: Sequential flow builds tasks in one session but risks context rot as history grows.

03

Pattern 2: Operator runs multiple parallel Claude terminals (distinct workspaces) for independent tasks.

04

Pattern 3: Split & Merge uses concurrent sub-agents in one session (hub-and-spoke) to parallelize work.

05

Pattern 4: Agent teams enable richer inter-agent coordination for complex projects but cost more tokens and are experimental.

Key moments
Questions answered

What are Claude Code's built-in sub-agents and what does each do?

There are three: explore (a fast, read-only scout that searches files), plan (activates in /plan mode to research and propose a strategy, read-only), and a general-purpose agent (runs on a more capable model with read/write access for complex multi-step edits).

When should I use the sequential flow pattern?

Use sequential flow when tasks naturally build on one another in a single session (e.g., iterating a landing page). Be aware of context rot as the session grows and use skills, /clear, and /compact to manage context.

How does the operator pattern differ and when is it useful?

The operator pattern runs multiple parallel Claude terminals (separate workspaces) so independent projects don't interfere. It's ideal for parallel, unrelated tasks and can be simplified with the claude-w flag to create distinct work trees.

What is headless operation and what are its trade-offs?

Headless mode lets Claude run autonomously (triggered by a flag and schedulers) to perform tasks without supervision—great for batch jobs and scheduled reports. Trade-offs include needing trust in automation and adding safeguards for risky write actions.

When should I choose agent teams over sub-agents?

Use agent teams for genuinely complex projects that need agents to share state and challenge each other via a shared task list. They enable richer coordination but use more tokens and are experimental.

Understanding Claude Code's Built-in Agents 00:40

"Claude code utilizes built-in sub-agents that operate automatically without your input."

  • Claude Code operates with three built-in sub-agents that function behind the scenes to enhance user interaction.

  • The first sub-agent is called "explore," which serves as a read-only scout. It can search through files and folder structures but does not alter them. For example, if you inquire about user authentication in your project, the explore agent will read the relevant files and return a concise summary, keeping your main conversation streamlined.

  • The second sub-agent, "plan," activates specifically when in plan mode (triggered by typing "/plan" or hitting shift+tab twice). It conducts research on your codebase before suggesting a strategy, again maintaining a read-only context window.

  • The third sub-agent is a general-purpose agent that performs the heavy lifting, capable of both reading and writing. It is utilized for more complex multi-step tasks where changes are necessary across multiple files. These agents work automatically, determining their role based on the complexity of the given task and utilizing their own context windows to avoid cluttering the main conversation.

Sequential Flow in Claude Code 02:46

"Sequential flow implies that every task you provide builds upon the last one."

  • In a sequential flow setup, you begin a Claude Code session and assign tasks that incrementally build upon each other. For instance, starting with the request to build a landing page, each subsequent action, such as adding images or forms, is contingent upon the completion of previous tasks.

  • The context from each task accumulates and feeds into the next, allowing Claude Code to reference prior outputs effectively. However, inherent to this structure is a limitation known as "context rot," where ongoing tasks may lead to a loss of context due to the accumulation of data within the session window.

  • To mitigate this, properly structured skills and commands can be employed, helping Claude manage context effectively. Commands like "/clear" and "/compact" assist in maintaining a concise summary within ongoing conversations, yet eventually, users will face the need to transition to a different workflow pattern due to the constraints of sequential flow.

The Operator Pattern for Parallel Tasks 04:38

"The operator pattern allows you to orchestrate multiple Claude sessions in parallel."

  • In contrast to sequential flow, the operator pattern allows users to open multiple terminal windows, treating them as independent agents. Each terminal can be dedicated to a different task, thereby avoiding context interference. This is particularly useful when dealing with parallel projects that do not require dependencies.

  • For instance, a user could be simultaneously developing a new onboarding flow, fixing a checkout bug, and redesigning a user settings page across separate terminals, enabling a clean and organized workspace for each endeavor.

  • The newly implemented "claude-w" flag streamlines the creation of distinct work areas, leading to the establishment of multiple work trees for efficient project management. This structure facilitates coordination among various independent tasks while preserving the integrity and clarity of each task's context.

  • Moreover, Claude manages workspace cleanup automatically, enhancing user efficiency by removing unnecessary clutter when sessions are closed.

Moving Beyond the Operator Pattern 07:22

"Managing a limited number of terminals can be challenging; the goal is to enhance Claude's capability to handle tasks independently."

  • While the operator pattern allows for orchestration of multiple tasks, the need for effective management of several terminals may lead to difficulties in monitoring and executing tasks. This prompts a consideration of advancing capabilities further.

  • The next proposed pattern, not fully explored in this segment, aims to leverage Claude's inherent abilities to split and merge tasks autonomously, optimally managing parallel workflows in a streamlined manner. The shift focuses on maximizing Claude's potential rather than relying solely on user oversight of multiple terminal sessions.

Single Session Parallelization 07:37

"Within a single Claude code session, one terminal can split work across multiple sub agents that run in parallel."

  • Claude has the capability to execute tasks in parallel within a single session by using multiple sub agents. This allows for faster task completion as it can spin off sub agents to tackle parts of a task simultaneously.

  • For example, Claude can be tasked with researching five different competitors for a client proposal and can handle all five queries at once by assigning each to a sub agent.

  • Each sub agent works independently on its specific task, and upon completion, the main agent compiles all findings into a single report.

  • The framework supports creating custom sub agents beyond the built-in ones, and these can all operate concurrently as long as the limit of 10 sub agents running at the same time is respected.

Hub and Spoke Methodology 09:22

"Sub agents can only report back to the main agent; they can't communicate with each other."

  • The interaction between sub agents is structured in a hub and spoke model where each sub agent reports findings back to the main agent, but they cannot share information directly among themselves.

  • This method ensures that the primary agent is in control, managing the flow of information and results from sub agents, but it may cause bottlenecks in complex tasks requiring coordination between sub agents.

  • For efficient project management, similar frameworks like "Get Stuff Done" (GSD) exist to assist in breaking down projects into manageable subtasks while maintaining an organized workflow.

Agent Teams for Complex Coordination 11:46

"An agent team is effectively a team of agents that can share findings, challenge each other, and adapt together."

  • Agent teams are designed for more complex projects where agents can communicate and share information via a shared task list, enhancing teamwork capabilities.

  • This newest feature allows multiple agents to understand each other’s tasks, enabling enhanced collaboration and efficiency compared to traditional sub agents.

  • However, agent teams should only be employed for genuinely complex projects due to their higher token usage stemming from the detailed interactions involved.

  • To activate this feature, users must enable an experimental setting, and explicitly state the use of an agent team when setting up tasks.

Headless Operations for Autonomous Workflows 14:31

"This is the dream of autonomous workflows where you don’t need to be in the loop."

  • Claude can operate in a headless mode, enabling it to run tasks independently without human supervision, allowing for complete autonomy.

  • The process is initiated by running Claude with a specific flag that signals it to perform tasks without requiring further interaction or approvals.

  • This mode becomes particularly powerful when integrated with scheduling systems, allowing Claude to execute predefined tasks automatically at set times, providing seamless workflow management.

  • The ultimate goal of headless operation is to streamline processes, allowing users to return later for results without the need for continuous oversight.

Automating Workflows with Claude 15:31

"You set a task, you walk away, and you come back for the results."

  • Claude can execute tasks daily by running a command in the terminal, fetching reports, and sending them back automatically, making it a game-changer for workflow automation.

  • Users can set Claude to review previous work and write a summary report automatically, allowing for a seamless transition in morning productivity without manual input.

  • For businesses, Claude can automate content creation by pulling video transcripts and generating social media posts that are saved to a file for easy scheduling, showing its adaptability for various business needs.

Limitations and Best Practices 16:24

"You're giving Claude autonomy to do things on your behalf."

  • A major limitation in using Claude autonomously is the need for trust, as the user is not checking each step in the process.

  • This approach is suited for tasks where verifying the output is straightforward, as the user should be cautious with complex actions that are hard to undo.

  • It is recommended to incorporate safeguards, such as restricting Claude's ability to write when certain tasks are executed, thus maintaining control over outputs.

Advanced Automation Techniques 16:55

"Claude can iterate on its own work until it gets it right."

  • The Ralph loop is an example of advanced usage within the community, where Claude repeatedly processes the same prompt until the output meets specific quality criteria.

  • Users have successfully leveraged this feature to launch entire projects overnight, demonstrating the effectiveness of autonomous processing in productivity.

  • Batch processing is emphasized as the best context for using these patterns, especially where output verification is easy, underlining the potential of Claude as a highly efficient collaborator.