Welcome back!
In Chapter 1: Master Orchestrator, we hired a Project Manager. In Chapter 2: Specialized Agents, we hired individual workers like @dev. In Chapter 3: Synapse Engine, we gave them a brain to manage context.
But imagine you want to start a completely new department, like "Data Science" or "Video Production."
Do you really want to manually create every single agent, write every rule, and configure every tool from scratch? No. You want to hire a full team that already knows how to work together.
In aios-core, we call these teams Squads.
Think of aios-core like a video game. The core game lets you build basic software.
Squads are downloadable Expansion Packs (DLCs).
When you install a Squad, you don't just get one character. You get a bundle containing:
@data-engineer, @analyst).
Use Case:
You need to process 1,000 CSV files and put them into a database. Instead of teaching @dev how to do data engineering, you install the etl-squad. It comes with a @data-engineer agent who already knows Python, Pandas, and SQL optimization.
A Squad is a directory that lives in your ./squads/ folder. It is self-contained. Here are its three main components.
squad.yaml)This is the ID card of the squad. It tells the system who is in the team and what they can do. It follows a "Task-First" architecture—meaning it focuses on what needs to be done rather than just who does it.
In older AI systems, you pick an agent and hope they know what to do. In Squads, you pick a Task (e.g., process-data.md), and the Squad automatically assigns the right agent (@data-engineer) to do it.
Squads can be found in three places:
./squads/my-squad).Creating and using a squad is handled by a special built-in agent: @squad-creator.
Let's say we want to build a "Content Marketing" squad. We don't need to write code yet. We ask @squad-creator to help us design it.
Input (User):
# Activate the creator
@squad-creator
# Ask it to design a squad based on your requirements file
*design-squad --docs ./requirements/marketing-team.md
Output (AI):
🤖 Squad Creator: I have analyzed your requirements. I recommend a squad with:
1. Agent:
@copywriter(Writes blogs)
2. Agent:
@editor(Reviews grammar)
3. Task:
generate-newsletter
Once we like the design, we run the create command.
# Create the folder structure automatically
*create-squad content-team --from-design
Explanation: This generates a folder at ./squads/content-team/ with all the necessary YAML and Markdown files.
Before we use it, we must ensure the squad is valid (no missing files or syntax errors).
*validate-squad content-team
Output: ✅ Squad Valid. 2 Agents, 4 Tasks loaded.
How does aios-core know that putting files in a folder creates a new team?
It uses the Squad Loader and plugs into the Synapse Engine (from Chapter 3).
Remember the 8 Layers of the Synapse Engine? Layer 5 is reserved specifically for Squads.
The code below is a simplified version of .aios-core/core/synapse/layers/l5-squad.js. It runs every time you send a message to the AI.
// Inside l5-squad.js
class L5SquadProcessor extends LayerProcessor {
process(context) {
// 1. Find where the squads live
const squadsDir = path.join(context.projectRoot, 'squads');
// 2. Scan the folder for 'squad.yaml' files
const manifests = this._scanSquads(squadsDir);
// 3. If we are currently using a squad agent, load their rules
const activeSquad = context.session.active_squad;
if (activeSquad && manifests[activeSquad]) {
// Load specific rules (e.g., "Always use Python for ETL")
return this._loadSquadRules(activeSquad);
}
}
}
Explanation: This script checks if you are currently "wearing the hat" of a Squad member. If you are, it dynamically injects that Squad's expertise into the AI's brain.
The squad.yaml file controls everything. Here is what a simple one looks like:
# ./squads/etl-squad/squad.yaml
name: etl-squad
version: 1.0.0
description: "Data processing team"
# The "Task-First" components
components:
agents:
- agents/data-engineer.md
tasks:
- tasks/process-csv.md
# Configuration Inheritance
config:
extends: extend # Keep core rules, but ADD squad rules
Explanation:
components: Lists the files that make up the squad.extends: Crucial setting. It tells the system "Don't forget the main project rules, just add these new data rules on top."
You don't just install squads; you can upgrade them. The *extend-squad command allows you to add new capabilities to an existing team.
const { SquadExtender } = require('./scripts/squad-extender');
// Add a new task to an existing squad programmatically
await SquadExtender.addComponent('etl-squad', {
type: 'task',
name: 'clean-data',
agentId: 'data-engineer',
description: 'Removes null values from dataset'
});
Explanation: This script updates the squad.yaml manifest and creates a blank template file tasks/clean-data.md for you to fill in.
Squads are the ultimate modularity tool in aios-core.
Now we have a Master Orchestrator, Specialized Agents, a Synapse Brain, and Squads of workers. But there is one big risk: What if the Squad produces bad code?
We need a quality inspector.
Next Chapter: Quality Gate Manager
Generated by Code IQ