Welcome to the Compound Engineering Plugin tutorial! In this series, we will explore how to turn AI from a simple chat bot into a powerful, automated engineering partner.
We start with the most important concept: The Compound Engineering Workflow.
In traditional software development, work often feels linear. You fix a bug, close the ticket, and move on.
This is Linear Engineering. Your knowledge doesn't accumulate; it resets.
The Compound Engineering Workflow operates like compound interest in finance. Every time you solve a problem, you invest a small amount of effort (automated by AI) to document the solution perfectly.
When that problemโor a similar oneโarises later, the AI solves it instantly using that "invested" knowledge.
Instead of just "Coding," this plugin enforces a cycle:
Let's look at a concrete example. You have a bug where your app is running too many database queries (an "N+1" error).
You use the standard workflow commands to fix it (we will cover these in later chapters).
/workflows:plan to analyze the error./workflows:work to apply the fix.Once the code works, you don't just close the terminal. You run one final command:
/workflows:compound "Fixed N+1 query in the dashboard"
What happens next? The AI doesn't just save a text file. It spins up a team of sub-agents to analyze why it broke, how it was fixed, and how to prevent it later. It creates a structured solution file in your project.
The Result:
Two weeks later, if you ask the AI to build a similar dashboard feature, it reads that file first. It warns you: "I see we had N+1 issues here before; I will use .includes(:users) to prevent that."
The workflow is built around four specific commands.
| Command | Phase | Description |
|---|---|---|
/workflows:plan |
Plan | Creates a detailed plan, checking past learnings. |
/workflows:work |
Work | Executes the plan, modifying your code. |
/workflows:review |
Review | Runs AI agents to critique the code. |
/workflows:compound |
Compound | The most important step. Captures the knowledge. |
Let's say you just finished fixing a bug. Here is how you use the abstraction:
# You just finished coding and verifying the fix.
# Now, capture the knowledge:
/workflows:compound
Output:
โ Context Analyzer: Identified performance_issue
โ Solution Extractor: Captured the code fix
โ Prevention Strategist: Suggested strict loading checks
โ File created: docs/solutions/performance-issues/n-plus-one-dashboard.md
The system automatically detects what changed, categories it (e.g., "Performance Issue"), and writes a specialized guide for the future.
How does /workflows:compound actually work? It uses an Agent Orchestration pattern. It's not one AI working; it's a manager AI directing several worker AIs.
When you run the command, an "Orchestrator" freezes the current state and delegates work to parallel sub-agents.
This workflow relies heavily on Agent-Native Architecture, which we will discuss in Chapter 2. Here is a simplified view of how the compound command is defined internally.
The command is defined using a YAML header. This tells the system how to interpret the user's input.
---
name: workflows:compound
description: Document a recently solved problem
argument-hint: "[optional: brief context about the fix]"
---
# /compound
Coordinate subagents to document a solved problem.
Explanation: This registers /workflows:compound as a slash command in your environment.
The Orchestrator is given a strict instruction to run sub-agents. Notice how it defines specific roles.
<parallel_tasks>
Launch these subagents IN PARALLEL:
1. **Context Analyzer**: Extracts conversation history & problem type.
2. **Solution Extractor**: Identifies root cause & working code.
3. **Prevention Strategist**: Develops strategies to avoid recurrence.
</parallel_tasks>
Explanation: This prompts the Large Language Model (LLM) to split its attention. Instead of generating one long stream of text, it simulates three distinct "experts" looking at your code.
The final step enforces a constraint: only the Orchestrator writes the file. This prevents the sub-agents from overwriting each other.
<sequential_tasks>
1. Collect all text results from Phase 1.
2. Validate YAML frontmatter against schema.
3. Write the SINGLE final file: docs/solutions/[category]/[filename].md
</sequential_tasks>
Explanation: This ensures the output is consistent. The file is saved into a docs/solutions/ folder, which acts as the "Long Term Memory" for the project.
The Compound Engineering Workflow changes the goal of development. The goal isn't just to "finish the task," but to finish the task and teach the system how to do it next time.
By using /workflows:compound, you are building a smarter engineering environment with every command you run.
In the next chapter, we will look at how the system actually understands these instructions using the Agent-Native Architecture.
Next: Agent-Native Architecture
Generated by Code IQ