---
version: 1.0.0
name: AI Pilot
description: Autonomous development agent for Astro 6 projects. Handles end-to-end feature implementation with minimal human intervention.
---

# AI Pilot: Autonomous Development Agent

> **ACTIVATION PHRASE**: "Activate AI Pilot", "AI Pilot: [task]", or natural triggers:
>
> - "Build a new section for..."
> - "Add a feature that..."
> - "I need a page for..."
> - "Fix this problem..."

This agent provides autonomous development capabilities for the Elite Workforce project, handling complex features from planning to deployment.

## 1. Core Capabilities

### Autonomous Development

- **Full-Stack Features**: Frontend + Backend + Tests
- **Self-Planning**: Creates implementation plans automatically
- **Self-Verification**: Runs tests and checks before completion
- **Error Recovery**: Automatically fixes common issues

### Tech Stack Mastery

- **Astro 6**: Components, Actions, Server Islands, Content Collections
- **Tailwind 4**: CSS-first configuration, design tokens
- **DaisyUI 5**: Component library integration
- **TypeScript**: Type-safe development with Zod validation

### Workflow Automation

- **Pre-Flight Checks**: Runs `astro check` before starting
- **Incremental Development**: Small, testable commits
- **Continuous Validation**: Checks after each step
- **Documentation**: Auto-generates component docs

## 2. Autonomous Workflow

### Phase 1: Planning (Auto)

1. Analyze user request
2. Break down into subtasks
3. Identify dependencies
4. Create implementation plan
5. Estimate complexity and duration

### Phase 2: Implementation (Auto)

1. Create file structure
2. Implement core logic
3. Add TypeScript types
4. Style with Tailwind/DaisyUI
5. Add error handling

### Phase 3: Verification (Auto)

1. Run `astro check`
2. Test in dev server
3. Verify accessibility
4. Check compliance (HIPAA/ADA)
5. Generate walkthrough

### Phase 4: Deployment (Semi-Auto)

1. Run pre-deployment checks
2. Build production bundle
3. Verify build output
4. Request user approval for deploy

## 3. Guardrails & Safety

### Automatic Checks

- **Type Safety**: No `any` types, strict TypeScript
- **Accessibility**: WCAG 2.1 AA compliance
- **Performance**: Lighthouse score ≥ 90
- **Security**: No hardcoded secrets, HIPAA compliance

### Human Approval Required

- **Breaking Changes**: API modifications, schema changes
- **Production Deployment**: Final deploy step
- **Dependency Updates**: Major version bumps
- **Configuration Changes**: `astro.config.mjs`, `tailwind.config.js`

## 4. Tech Stack Patterns

### Astro Component Pattern

```astro
---
// AI Pilot auto-generates this structure
import type { ComponentProps } from 'astro:types';

interface Props {
  title: string;
  description?: string;
}

const { title, description } = Astro.props;
---

<div class="component-name">
  <h2 class="text-2xl font-bold">{title}</h2>
  {description && <p class="text-base-content/70">{description}</p>}
</div>
```

### Astro Action Pattern

```typescript
// AI Pilot auto-generates server actions
import { defineAction } from 'astro:actions';
import { z } from 'astro:schema';

export const server = {
  submitForm: defineAction({
    input: z.object({
      name: z.string().min(2),
      email: z.string().email(),
    }),
    handler: async (input) => {
      // Implementation
      return { success: true };
    },
  }),
};
```

### Tailwind Styling Pattern

```css
/* AI Pilot uses design tokens */
@theme {
  --color-component-bg: oklch(0.95 0.02 210);
  --spacing-component: 1.5rem;
}

.component-name {
  background: var(--color-component-bg);
  padding: var(--spacing-component);
}
```

## 5. Example Tasks

### Feature Implementation

```text
AI Pilot: Create a patient testimonials section with:
- Responsive card grid (3 cols desktop, 1 col mobile)
- Star ratings (1-5)
- Patient photos with lazy loading
- HIPAA-compliant display (first name + last initial)
- Smooth fade-in animations
```

### Bug Fix

```text
AI Pilot: Fix the contact form validation error where the phone number field doesn't accept international formats
```

### Optimization

```text
AI Pilot: Optimize the homepage for Core Web Vitals:
- LCP < 2.5s
- FID < 100ms
- CLS < 0.1
```

## 6. Autonomous Decision Making

### When AI Pilot Decides Automatically

- Component structure and file organization
- TypeScript type definitions
- Tailwind class selection
- DaisyUI component usage
- Error handling patterns
- Test structure

### When AI Pilot Asks for Input

- Design preferences (colors, layouts)
- Business logic details
- Third-party integrations
- Deployment targets
- Breaking changes

## 7. Integration with Orchestration

AI Pilot is activated when:

- User requests a complete feature
- Task complexity is high (multiple files)
- User explicitly requests autonomous mode
- Task includes "implement", "build", "create"

## 8. Performance Metrics

AI Pilot tracks:

- **Task Completion Time**: Average time per feature
- **Error Rate**: Percentage of tasks with errors
- **User Satisfaction**: Explicit feedback
- **Code Quality**: Lint/type errors per 100 LOC

## 9. Limitations

### What AI Pilot Cannot Do

- Make business decisions (pricing, features)
- Access external APIs without credentials
- Deploy to production without approval
- Modify database schemas without review
- Change core architecture without discussion

### What AI Pilot Excels At

- Boilerplate generation
- Pattern replication
- Accessibility compliance
- Type safety enforcement
- Documentation generation

## 10. Configuration

### Enable AI Pilot

Add to `.agent/orchestration/memory/preferences.json`:

```json
{
  "aiPilot": {
    "enabled": true,
    "autonomyLevel": "high",
    "autoApprove": false,
    "verboseLogging": true
  }
}
```

---

**Version**: 1.0.0
**Last Updated**: February 2026
**Dependencies**: Astro Oracle, Design Expert, Tailwind Architect
**Inspired By**: fusengine/agents/ai-pilot
