repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

pi/agent/extensions/devil/README.md

Raw

devil

Structured debate tool for stress-testing ideas against a devil's advocate. Canonical names:

Quick Start

pi
/devil we should switch to microservices

Tool call:

devil({
  idea: "Use SQLite as primary database",
  context: {
    scale: "10k users",
    team_size: "5 devs",
    requirement: "ACID required"
  }
})

Behavior

Aspect Behavior
Session state Stateless. Each debate call is independent.
Conversation context Automatically includes working dir, recent conversation, current contents of recently touched files. Explicit context overrides/augments it.
Model Uses devil.model if configured, else current model. Tool model param overrides both.
UI /devil opens interactive progress UI, then result editor. Tool call streams round updates.
Results Tool result stored in conversation like normal tool output. /devil writes edited result into main editor for user submission.

Configuration

~/.pi/agent/settings.json:

{
  "devil": {
    "model": "zai/glm-5.1",
    "maxRounds": 5,
    "stoppingConditions": "consensus",
    "concessionThreshold": 0.7,
    "onBlocking": "surface"
  }
}

CLI flags:

pi --devil-max-rounds 3 --devil-stop max_rounds

Parameters

devil({
  idea: string,                    // required
  context?: Record<string,string>, // optional extra background
  model?: string,                  // optional provider/model override
  maxRounds?: number,              // 1-10
  stakeholder?: "security" | "cost" | "ux" | "implementation" | "ethics" | "skeptical",
  stoppingConditions?: "consensus" | "blocking_found" | "max_rounds",
  concessionThreshold?: number,    // 0.0-1.0
  onBlocking?: "surface" | "escalate" | "ignore",
  output?: "full" | "summary_only"
})

Output

Returns synthesis with:

When to Use

Good:

Not ideal:

Troubleshooting

"No model available"

Select model with /model, or configure devil.model.

"No API key"

Log in / configure key for selected or configured provider.

Irrelevant challenges

Add explicit context, choose stakeholder, make idea more specific.

Markdown source
File outline
# devil

Structured debate tool for stress-testing ideas against a devil's advocate. Canonical names:

- Slash command: `/devil <idea>`
- Tool: `devil`
- Settings key: `devil`
- Extension dir: `extensions/devil/`
- Shortcut: `ctrl+alt+d` starts `/devil` with current editor text

## Quick Start

```bash
pi
/devil we should switch to microservices
```

Tool call:

```javascript
devil({
  idea: "Use SQLite as primary database",
  context: {
    scale: "10k users",
    team_size: "5 devs",
    requirement: "ACID required"
  }
})
```

## Behavior

| Aspect | Behavior |
|--------|----------|
| Session state | Stateless. Each debate call is independent. |
| Conversation context | Automatically includes working dir, recent conversation, current contents of recently touched files. Explicit `context` overrides/augments it. |
| Model | Uses `devil.model` if configured, else current model. Tool `model` param overrides both. |
| UI | `/devil` opens interactive progress UI, then result editor. Tool call streams round updates. |
| Results | Tool result stored in conversation like normal tool output. `/devil` writes edited result into main editor for user submission. |

## Configuration

`~/.pi/agent/settings.json`:

```json
{
  "devil": {
    "model": "zai/glm-5.1",
    "maxRounds": 5,
    "stoppingConditions": "consensus",
    "concessionThreshold": 0.7,
    "onBlocking": "surface"
  }
}
```

CLI flags:

```bash
pi --devil-max-rounds 3 --devil-stop max_rounds
```

## Parameters

```javascript
devil({
  idea: string,                    // required
  context?: Record<string,string>, // optional extra background
  model?: string,                  // optional provider/model override
  maxRounds?: number,              // 1-10
  stakeholder?: "security" | "cost" | "ux" | "implementation" | "ethics" | "skeptical",
  stoppingConditions?: "consensus" | "blocking_found" | "max_rounds",
  concessionThreshold?: number,    // 0.0-1.0
  onBlocking?: "surface" | "escalate" | "ignore",
  output?: "full" | "summary_only"
})
```

## Output

Returns synthesis with:

- recommendation: `proceed`, `proceed_with_caution`, `revise`, `abandon`
- blocking issues
- addressable concerns
- survived claims
- conceded weaknesses
- next steps
- debate metadata: rounds, blocking challenges raised, unresolved blocking issues in final verdict

## When to Use

Good:
- Before architectural/impl decisions
- When responses feel too agreeable
- To surface blocking issues before committing
- To document concerns for stakeholders

Not ideal:
- Quick questions
- Already contested decisions
- Sensitive/personal topics

## Troubleshooting

### "No model available"

Select model with `/model`, or configure `devil.model`.

### "No API key"

Log in / configure key for selected or configured provider.

### Irrelevant challenges

Add explicit `context`, choose `stakeholder`, make `idea` more specific.