ambush 0.1.0

Task decomposition and plan mode for AI agents - planning the attack
Documentation
# ⚔️ Ambush

Task decomposition and plan mode for AI agents - planning the attack.

[![Crates.io](https://img.shields.io/crates/v/ambush.svg)](https://crates.io/crates/ambush)
[![Documentation](https://docs.rs/ambush/badge.svg)](https://docs.rs/ambush)
[![License](https://img.shields.io/crates/l/ambush.svg)](LICENSE)

## Overview

Ambush provides task decomposition and planning capabilities for AI agents, breaking complex requests into manageable steps with agent assignments.

## Features

- 📋 Task decomposition into sub-steps
- 🔍 Complexity analysis
- 👥 Agent role assignment
- 📊 Dependency graph generation
- 💰 Token usage estimation

## Installation

```toml
[dependencies]
ambush = "0.1"
```

## Usage

```rust
use ambush::{TaskPlanner, PlanConfig};

#[tokio::main]
async fn main() -> Result<(), ambush::PlannerError> {
    let config = PlanConfig::default();
    let planner = TaskPlanner::new(config);

    // Generate a plan from a user request
    let plan = planner.plan("Add user authentication to my app").await?;

    println!("Plan has {} steps:", plan.steps.len());
    for step in &plan.steps {
        println!("  - {} ({:?})", step.description, step.complexity);
    }

    println!("Estimated tokens: {}", plan.estimated_tokens);

    Ok(())
}
```

## Plan Granularity

```rust
use ambush::{TaskPlanner, PlanConfig};
use warhorn::PlanGranularity;

// Coarse-grained planning (fewer, larger steps)
let plan = planner.plan_with_granularity(
    "Refactor the database layer",
    PlanGranularity::Coarse
).await?;

// Detailed planning (more, smaller steps)
let plan = planner.plan_with_granularity(
    "Add login form",
    PlanGranularity::Detailed
).await?;

// Auto-detect based on request complexity
let plan = planner.plan_with_granularity(
    "Fix bug in parser",
    PlanGranularity::Auto
).await?;
```

## Agent Assignment

The planner automatically assigns agent roles based on the task domain:

```rust
use warhorn::AgentRole;

for (step_id, role) in &plan.agent_assignments {
    match role {
        AgentRole::DomainLead { domain } => {
            println!("Step {} assigned to {} lead", step_id, domain);
        }
        AgentRole::Worker => {
            println!("Step {} assigned to worker", step_id);
        }
        _ => {}
    }
}
```

## Part of the Goblin Family

- [warhorn]https://crates.io/crates/warhorn - Protocol types
- [trinkets]https://crates.io/crates/trinkets - Tool registry
- [wardstone]https://crates.io/crates/wardstone - Sandboxing
- [skulk]https://crates.io/crates/skulk - MCP connections
- [hutch]https://crates.io/crates/hutch - Checkpoints
- **ambush** - Task planning (you are here)
- [cabal]https://crates.io/crates/cabal - Orchestration

## License

MIT OR Apache-2.0