Skip to content

Create a module that orchestrates AI agents using SDD (Spec-Driven Development) workflow, optimizing token usage and #3

@MaximilianoAcri

Description

@MaximilianoAcri

Motivation

SDD (Spec-Driven Development) is an established pattern where:

  1. Specs come first - Define requirements before code
  2. Tasks break down specs - Decompose into implementable tasks
  3. Code satisfies specs - Implementation follows specs
  4. Verify against specs - Validation matches specifications

However, AI agents often:

  • Skip specs and jump to code
  • Use excessive tokens with verbose prompts
  • Don't validate against specifications
  • Create inconsistent implementations

Proposal

Create a sdd-orchestrator module that:

  1. Enforces SDD workflow - Agents must follow spec → tasks → code → verify
  2. Optimizes token usage - Efficient prompts, caching, context management
  3. Orchestrates sub-agents - Coordinates multiple AI agents efficiently

Token Optimization Strategies

Strategy Description Savings
Spec templates Reuse prompt templates instead of full prompts ~40% tokens
Context compression Compress historical context ~30% tokens
Delta specs Only process what changed, not full specs ~50% tokens
Caching Cache common operations Varies
Smart delegation Route to appropriate sub-agent ~20% tokens

Module Features

1. SDD Workflow Enforcement

sz sdd init          # Start new feature with spec
sz sdd propose      # Create proposal
sz sdd spec         # Write detailed spec
sz sdd tasks        # Break into tasks
sz sdd apply        # Implement tasks
sz sdd verify      # Validate against spec

2. Token Management

# Show token usage
sz tokens status

# Optimize current context
sz tokens compress

# Set budget
sz tokens budget --max 100000

3. Agent Orchestration

# Delegate to sub-agent
sz delegate --agent code-reviewer --task "Review PR #123"

# Orchestrate multi-agent
sz orchestrate --flow "spec → code → test → review"

Integration with Existing Modules

Module Integration
heartbeat Schedule SDD cycles
skill-library-ce Load SDD-specific skills
approval-gate Approve spec changes
context-assembler-ce Build context efficiently

Token Budget Example

Without optimization:

  • Full spec per tick: ~50,000 tokens
  • Daily: ~500,000 tokens

With optimization:

  • Delta specs only: ~25,000 tokens
  • Smart delegation: ~20,000 tokens
  • Total savings: ~70%

Why This Matters

SDD ensures:

  • ✅ Consistent development process
  • ✅ Specs are always current
  • ✅ No feature creep
  • ✅ Easier maintenance

Token optimization ensures:

  • ✅ Reduced costs
  • ✅ Faster responses
  • ✅ Better context management

Together: efficient, spec-driven AI development.


Looking to contribute this! Has experience with SDD workflows and token optimization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions