Skip to main content

What Are Collectives?

In Genie, a Collective is a group of specialized AI agents that work together toward a common purpose. Think of them as departments in a company, each with expert team members.

The Two Core Collectives

Genie ships with two fundamental collectives:

Code Collective

34 Agents - Software development, testing, git operations, debugging, architecture

Create Collective

9 Agents - Research, writing, editing, content creation, shape-shifting

Code Collective (34 Agents)

The Code Collective handles all software development activities. It’s organized into specialized roles:

Core Development Team

AgentRoleKey Capabilities
implementorPrimary developerTypeScript, React, Node.js, clean code
testsTesting specialistUnit, integration, E2E, TDD
plannerArchitecture & planningSystem design, task breakdown
investigatorCode analysisPerformance, security, quality review

Support Specialists

AgentRoleKey Capabilities
gitVersion controlCommits, branches, conventional commits
debugTroubleshootingError analysis, root cause investigation
auditSecurity reviewVulnerability scanning, best practices
optimizerPerformanceCode optimization, profiling

Infrastructure Team

AgentRoleKey Capabilities
dockerContainerizationDockerfile, docker-compose, best practices
ci-cdAutomationGitHub Actions, pipelines, deployment
deployerProduction opsCloud deployment, monitoring
databaseData layerSQL, NoSQL, migrations, queries
Core Development (8 agents):
  • implementor - Primary feature developer
  • tests - Testing specialist
  • planner - Architecture and planning
  • investigator - Code analysis and review
  • reviewer - Code review and quality
  • refactor - Code improvement
  • documenter - Documentation writer
  • architect - System design
Specialized Development (8 agents):
  • frontend - UI/UX implementation
  • backend - API and server logic
  • database - Data layer specialist
  • api - API design and implementation
  • security - Security specialist
  • performance - Performance optimization
  • mobile - Mobile development
  • web - Web technologies
DevOps & Infrastructure (6 agents):
  • git - Version control
  • docker - Containerization
  • ci-cd - Automation pipelines
  • deployer - Production deployment
  • monitor - System monitoring
  • backup - Data backup and recovery
Quality & Analysis (6 agents):
  • debug - Debugging specialist
  • audit - Security auditing
  • optimizer - Performance tuning
  • validator - Input validation
  • tester - Test execution
  • qa - Quality assurance
Support & Utilities (6 agents):
  • helper - Utility functions
  • migrator - Database migrations
  • seeder - Data seeding
  • generator - Code generation
  • scaffold - Project scaffolding
  • cleanup - Code cleanup
// Simplified routing logic
function selectAgent(request: string, collective: Collective): Agent {
  // 1. Check explicit mentions
  if (request.includes('@implementor')) {
    return collective.agents.implementor;
  }

  // 2. Match trigger keywords
  for (const agent of collective.agents) {
    if (agent.triggers.some(t => request.includes(t))) {
      return agent;
    }
  }

  // 3. Analyze intent with embeddings
  const intent = analyzeIntent(request);
  const scored = collective.agents.map(agent => ({
    agent,
    score: similarity(intent, agent.capabilities)
  }));

  // 4. Return highest scoring agent
  return scored.sort((a, b) => b.score - a.score)[0].agent;
}

Create Collective (9 Agents)

The Create Collective handles research, writing, content creation, and creative tasks:
AgentRoleKey Capabilities
researcherInformation gatheringWeb research, data analysis, summarization
writerContent creationArticles, docs, copy, storytelling
editorContent refinementProofreading, style, clarity, tone
shape-shifterAdaptive communicationPersona matching, voice adaptation
analystData interpretationInsights, patterns, recommendations
strategistPlanning & approachContent strategy, audience targeting
designerVisual conceptsLayout ideas, design principles
storytellerNarrative craftCompelling stories, engagement
curatorInformation organizationCategorization, tagging, structure
The shape-shifter agent is particularly powerful - it adapts its communication style to match your needs, from technical documentation to creative storytelling.

Create Collective Workflows

Agent File Structure

Every agent is defined in a markdown file with consistent structure:
---
name: implementor
collective: code
role: "Core developer who writes clean, maintainable code"
capabilities:
  - typescript
  - react
  - node
  - testing
priority: high
triggers:
  - "implement"
  - "build"
  - "develop"
  - "create feature"
delegation_rules:
  tests: "After feature implementation"
  git: "After tests pass"
  debug: "If errors occur"
---

# Implementor Agent

## Core Responsibilities

The implementor is the primary developer in the Code Collective. Core duties:

- Write production-ready TypeScript/JavaScript code
- Implement features according to specifications
- Follow clean code principles and best practices
- Ensure type safety and proper error handling
- Write self-documenting code with clear naming

## When To Activate

Activate implementor when:
- User requests feature implementation
- Specifications are clear and approved by @planner
- Technical approach is defined
- Tests are defined by @tests

Do NOT activate when:
- Requirements are unclear → delegate to @planner
- Debugging is needed → delegate to @debug
- Architecture design needed → delegate to @architect

## Behavioral Protocols

Follow these spells:
- @spell/universal/investigate-before-commit
- @spell/code/conventional-commits
- @spell/universal/delegate-dont-do
- @spell/universal/ace-protocol

## Delegation Rules

Automatic hand-offs:
1. **After implementation** → @tests for test coverage
2. **After tests pass** → @git for version control
3. **If errors occur** → @debug for troubleshooting
4. **For optimization** → @optimizer for performance tuning

Never handle these yourself:
- Git operations → @git handles all commits
- Test writing → @tests handles test suites
- Deployment → @deployer handles production
- Security audits → @audit handles security

## Code Style Guidelines

```typescript
// Prefer functional, composable code
export const processUser = (user: User): ProcessedUser => {
  return pipe(
    validateUser,
    enrichWithDefaults,
    sanitizeInput
  )(user);
};

// Use descriptive names
const isUserEligibleForPremium = (user: User): boolean => {
  return user.accountAge > 365 && user.purchases.length > 10;
};

// Handle errors explicitly
try {
  const result = await riskyOperation();
  return success(result);
} catch (error) {
  logger.error('Operation failed', { error, context });
  return failure(error);
}

Examples

Feature Implementation Request

User: “Implement user authentication with JWT” Response:
  1. Load specifications from @planner
  2. Implement auth service with TypeScript
  3. Add proper type definitions
  4. Include error handling
  5. Delegate to @tests for test coverage
  6. After tests pass, delegate to @git for commit

Code Organization

// Clear separation of concerns
export class AuthService {
  constructor(
    private readonly tokenService: TokenService,
    private readonly userRepo: UserRepository
  ) {}

  async authenticate(credentials: Credentials): Promise<AuthResult> {
    // Implementation
  }
}

## Delegation Rules & Orchestration Boundary

One of Genie's core principles: **Agents don't do everything, they orchestrate**

<Warning>
**The Golden Rule**: If a task is outside your primary expertise, delegate to a specialist.
</Warning>

### Delegation Matrix

| Current Agent | Task Type | Delegate To |
|--------------|-----------|-------------|
| implementor | Testing | @tests |
| implementor | Git operations | @git |
| implementor | Debugging | @debug |
| tests | Implementation | @implementor |
| tests | Git commits | @git |
| writer | Research | @researcher |
| writer | Editing | @editor |
| researcher | Writing | @writer |

### Delegation Syntax

In agent files:

```markdown
## Delegation Rules

Automatic hand-offs:
- **Testing** → @tests after implementation
- **Commits** → @git after validation
- **Optimization** → @optimizer if performance issues
- **Security** → @audit before production

Manual delegation examples:
- "This needs design review → @architect"
- "Research needed first → @researcher"
- "Copy needs editing → @editor"
In runtime:
// Agent detects out-of-scope work
if (task.requiresTesting) {
  return delegate({
    to: '@tests',
    context: {
      implementation: completedWork,
      requirements: originalSpec
    },
    reason: 'Test coverage needed for new feature'
  });
}
Without Delegation:
// implementor tries to do everything
- Write code
- Write tests
- Commit to git
- Deploy to production
- Monitor performance
- Fix bugs
// Result: Jack of all trades, master of none
With Delegation:
// implementor focuses on core competency
- Write excellent code
- Delegate tests to @tests
- Delegate git to @git
- Delegate deployment to @deployer
// Result: Specialized expertise, higher quality
Each agent has a boundary of direct execution vs orchestration:Direct Execution: Things you’re explicitly designed for Orchestration: Everything else - coordinate specialists

Advisory Teams

Beyond individual agents, Genie supports Advisory Teams - groups of agents that collaborate on complex decisions:

Tech Council

---
name: tech-council
type: advisory-team
members:
  - architect
  - implementor
  - tests
  - security
  - performance
purpose: "Technical decision making and architecture review"
---

# Tech Council

## When To Convene

Gather the Tech Council for:
- Major architecture decisions
- Technology selection
- Security-critical changes
- Performance optimization strategies
- Breaking changes to public APIs

## Decision Process

1. **architect** presents technical proposal
2. **implementor** evaluates implementation feasibility
3. **tests** assesses testability
4. **security** reviews security implications
5. **performance** analyzes performance impact
6. Consensus or majority vote

## Output

Structured decision document:
- Proposal summary
- Each member's assessment
- Final decision with rationale
- Implementation plan
- Success metrics

Creating Custom Teams

---
name: feature-review-board
type: advisory-team
members:
  - planner
  - implementor
  - tests
  - documenter
purpose: "Feature completeness review"
---

# Feature Review Board

Ensures features are fully complete before release:
- Planning complete: @planner confirms all requirements met
- Implementation quality: @implementor validates code quality
- Test coverage: @tests confirms comprehensive tests
- Documentation: @documenter ensures docs are complete

Creating Custom Collectives

You can create your own collectives in genie-personal:
1

Create Collective Directory

mkdir -p genie-personal/collectives/myteam
2

Define Agents

# Create agent files
touch genie-personal/collectives/myteam/backend.md
touch genie-personal/collectives/myteam/frontend.md
touch genie-personal/collectives/myteam/devops.md
3

Configure Collective

# genie-personal/collectives/myteam/config.yaml
name: myteam
description: "Custom development team"
agents:
  - backend
  - frontend
  - devops
default_agent: backend
routing_strategy: capability-based
4

Register Collective

# genie-personal/config.yaml
collectives:
  - code
  - create
  - myteam  # Your custom collective

Example: Data Science Collective

---
name: data-science
description: "Machine learning and data analysis collective"
agents:
  - data-engineer
  - ml-engineer
  - analyst
  - visualizer
---

# Data Science Collective

## Agents

### data-engineer
- Data pipeline development
- ETL processes
- Data quality assurance

### ml-engineer
- Model development
- Training and evaluation
- Model deployment

### analyst
- Exploratory data analysis
- Statistical analysis
- Insight generation

### visualizer
- Chart and graph creation
- Dashboard development
- Data storytelling

Agent Collaboration Patterns

Sequential Hand-off

Parallel Execution

Collaborative Review

// Multi-agent review process
async function reviewFeature(feature: Feature) {
  const reviews = await Promise.all([
    invoke('@investigator', { task: 'code-quality', target: feature }),
    invoke('@security', { task: 'security-audit', target: feature }),
    invoke('@performance', { task: 'performance-check', target: feature }),
    invoke('@tests', { task: 'coverage-check', target: feature })
  ]);

  const consensus = analyzeReviews(reviews);
  return consensus.approved ? 'PASS' : 'NEEDS_WORK';
}

Best Practices

Single Responsibility

Each agent should have ONE clear purpose. Don’t create generalist agents.

Clear Boundaries

Define exactly what each agent does and doesn’t do. Use delegation rules.

Consistent Structure

Follow the standard agent file structure for predictability.

Document Thoroughly

Include examples, edge cases, and delegation rules in agent files.

Common Anti-Patterns

God Agent: One agent that tries to do everything
❌ name: developer
   responsibilities:
     - Write code
     - Write tests
     - Deploy
     - Monitor
     - Debug
     - Everything else
Solution: Create specialized agents and use delegation.
Unclear Boundaries: Agents with overlapping responsibilities
❌ implementor: "Writes code and tests"
❌ tests: "Writes tests and some code"
Solution: Clear separation - implementor writes code, tests writes tests.

Next Steps