> ## Documentation Index
> Fetch the complete documentation index at: https://specs.md/llms.txt
> Use this file to discover all available pages before exploring further.

# Operations Agent

> Deploys, verifies, and monitors systems in production

## Overview

> [!WARNING]
>
> The Operations Agent is in alpha and has known issues that are currently being fixed. Some commands may not work as expected. We're actively looking for feedback - if you encounter an error, please [report it here](https://github.com/fabriqaai/specsmd/issues).

The **Operations Agent** handles the third phase of AI-DLC. It takes constructed features to production, verifies they work correctly, and sets up monitoring.

## Invocation

> [tab] Claude Code
>
> ```bash theme={null}
> /specsmd-operations-agent
> ```

> [tab] Cursor
>
> ```
> /specsmd-operations-agent
> ```
>
> Or use the `@` prefix:
>
> ```
> @specsmd-operations-agent
> ```

> [tab] GitHub Copilot
>
> ```
> /specsmd-operations-agent
> ```

## Commands

| Command | Purpose |
| - | - |
| `build` | Build the project |
| `deploy` | Deploy to environment |
| `verify` | Verify deployment |
| `monitor` | Set up monitoring |

## build

Builds the project for deployment:

```
> build
```

The agent will:

**1. Check Prerequisites**

Verify all construction bolts are complete

**2. Run Build**

Execute build commands from tech stack

**3. Run Tests**

Execute full test suite

**4. Create Artifacts**

Package for deployment

### Example Session

```
User: build

Operations Agent: Starting build process...

## Prerequisites Check
✓ All construction bolts complete
✓ No uncommitted changes
✓ On main branch

## Build
Running: npm run build
✓ TypeScript compilation successful
✓ Bundle created (245KB gzipped)

## Tests
Running: npm test
✓ 47 unit tests passed
✓ 12 integration tests passed
✓ 5 e2e tests passed

## Artifacts
✓ Docker image built: myapp:1.2.0
✓ Image pushed to registry

Build complete. Ready for deployment.
```

## deploy

Deploys to a target environment:

```
> deploy staging
```

Or for production:

```
> deploy production
```

The agent will:

**1. Environment Check**

Verify target environment configuration

**2. Pre-deployment**

Run database migrations, cache warming

**3. Deploy**

Deploy using configured strategy

**4. Health Check**

Verify services are healthy

### Deployment Strategies

The agent supports common strategies based on your infrastructure:

| Strategy | Description |
| - | - |
| **Rolling** | Replace instances gradually |
| **Blue-Green** | Switch between two environments |
| **Canary** | Route percentage of traffic to new version |

> [!WARNING]
>
> Production deployments require explicit confirmation. The agent will show you exactly what will happen before proceeding.

## verify

Runs verification after deployment:

```
> verify staging
```

The agent will:

**1. Smoke Tests**

Run quick sanity checks

**2. Health Endpoints**

Check all service health endpoints

**3. Integration Check**

Verify integrations are working

**4. Performance Baseline**

Ensure response times are acceptable

### Example Output

```
User: verify staging

Operations Agent: Running verification for staging...

## Smoke Tests
✓ Homepage loads (234ms)
✓ API responds (45ms)
✓ Authentication works

## Health Endpoints
✓ /health - OK (12ms)
✓ /health/db - OK (23ms)
✓ /health/cache - OK (8ms)

## Integration Check
✓ Database connection
✓ Redis connection
✓ Email service

## Performance
✓ p50 latency: 45ms (target: <100ms)
✓ p95 latency: 123ms (target: <500ms)
✓ p99 latency: 234ms (target: <1000ms)

Verification passed. Staging is healthy.
```

## monitor

Sets up or checks monitoring:

```
> monitor setup
```

Or check current status:

```
> monitor status
```

The agent helps with:

> [card] Logging
>
> Structured logging configuration

> [card] Metrics
>
> Key performance indicators

> [card] Alerts
>
> Alert rules and thresholds

> [card] Dashboards
>
> Visualization of system health

### Key Metrics

The agent suggests monitoring:

| Category | Metrics |
| - | - |
| **Availability** | Uptime, error rate, success rate |
| **Performance** | Latency (p50, p95, p99), throughput |
| **Resources** | CPU, memory, disk, connections |
| **Business** | Active users, transactions, conversions |

## Human Checkpoints

The Operations Agent has **4 human checkpoints** aligned with environment progression:

```mermaid actions={false} theme={null}
flowchart TB
    P{{Prerequisites}}:::build -->|Construction complete?| A(Build Artifacts):::build
    A --> G1{{"✋ Gate 1"}}:::check
    G1 -->|User approves| B(Deploy to Dev):::plan
    B --> C(Deploy to Staging):::plan
    C --> G2{{"✋ Gate 2"}}:::check
    G2 -->|User approves| D(Verify Staging):::plan
    D --> E(Deploy to Production):::warn
    E --> G3{{"✋ Gate 3"}}:::check
    G3 -->|User approves| F(Verify Production):::warn
    F --> G(Setup Monitoring):::build
    G --> G4{{"✋ Gate 4"}}:::check
    G4 -->|User approves| H((Complete)):::done
    classDef plan fill:#fff,stroke:#6366F1,color:#4338CA,stroke-width:1.5px,rx:8,ry:8
    classDef build fill:#fff,stroke:#0EA5E9,color:#0369A1,stroke-width:1.5px,rx:8,ry:8
    classDef done fill:#fff,stroke:#10B981,color:#047857,stroke-width:1.5px,rx:8,ry:8
    classDef check fill:#fff,stroke:#EC4899,color:#BE185D,stroke-width:2px,rx:8,ry:8
    classDef warn fill:#fff,stroke:#F59E0B,color:#B45309,stroke-width:1.5px,rx:8,ry:8
```

| Gate | Location | Purpose |
| - | - | - |
| **Gate 1** | After build | Approve build artifacts before deployment |
| **Gate 2** | Before staging deploy | Confirm ready for staging environment |
| **Gate 3** | Before production deploy | Critical approval for production |
| **Gate 4** | After monitoring setup | Confirm operations complete |

> [!WARNING]
>
> Production deployment (Gate 3) requires explicit confirmation. The agent will show exactly what will happen before proceeding.

## Artifacts

Operations artifacts are stored in:

```
memory-bank/operations/
├── environments.md      # Environment configurations
├── runbooks/           # Operational procedures
│   ├── deployment.md
│   ├── rollback.md
│   └── incident.md
└── monitoring/
    ├── alerts.md
    └── dashboards.md
```

## Runbooks

The agent generates runbooks for common operations:

> [accordion] Deployment Runbook
>
> Step-by-step deployment procedure:
>
> 1. Pre-deployment checklist
> 2. Deployment commands
> 3. Verification steps
> 4. Rollback procedure

> [accordion] Incident Response
>
> What to do when things go wrong:
>
> 1. Detection and triage
> 2. Escalation matrix
> 3. Communication template
> 4. Post-mortem process

> [accordion] Scaling Runbook
>
> How to handle increased load:
>
> 1. Signs of scaling needs
> 2. Horizontal vs vertical
> 3. Scaling commands
> 4. Verification

## Best Practices

> [accordion] Always Verify
>
> Never skip verification after deployment. Automated checks catch issues humans miss.

> [accordion] Stage Environments
>
> Deploy to staging before production. Test the deployment process itself.

> [accordion] Monitor Proactively
>
> Set up alerts before you need them. Don't wait for production issues.

> [accordion] Document Runbooks
>
> Keep runbooks updated. They're essential during incidents.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.