Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/ultra/prompts/references/examples/core.md

Raw
Rendered preview

core

Each example is a complete workflow spec.

tiny single

{
  "name": "tiny-single",
  "phases": [
    {
      "id": "answer",
      "kind": "single",
      "step": { "summary": "Return a bounded answer", "prompt": "Return a concise status object for this demonstration. Do not assume parent conversation context." }
    }
  ]
}

single with positional input

{
  "name": "single-input",
  "args": { "hint": "<question>", "params": ["question"] },
  "phases": [
    {
      "id": "answer",
      "kind": "single",
      "step": { "summary": "Answer the question", "prompt": "Answer: {args.question}" }
    }
  ],
  "return": "{answer.results}"
}

literal fanout

{
  "name": "literal-fanout",
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": ["README.md", "CHANGELOG.md", "package.json"],
      "step": { "summary": "Inspect {item}", "prompt": "Read {item} and summarize it; do not mutate anything." }
    }
  ],
  "return": "{inspect.results}"
}

input-driven fanout

Use structured run_workflow args when one input must remain an array. Bare command arguments are strings.

{
  "name": "input-fanout",
  "args": { "hint": "JSON args: { paths: string[] }" },
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": "{args.paths}",
      "step": { "summary": "Inspect {item}", "prompt": "Read {item}; return its key facts and do not mutate anything." }
    }
  ]
}

ignored single over

{
  "name": "single-over",
  "phases": [
    {
      "id": "one",
      "kind": "single",
      "over": ["ignored", "also-ignored"],
      "step": { "summary": "Run once", "prompt": "Run this synthesis once." }
    }
  ]
}

conditional single

{
  "name": "conditional-single",
  "args": { "hint": "optional input", "params": ["input"] },
  "phases": [
    {
      "id": "collect",
      "kind": "single",
      "step": { "summary": "Collect evidence", "prompt": "Collect evidence for {args.input}." }
    },
    {
      "id": "judge",
      "kind": "single",
      "when": "{collect.results}",
      "step": { "summary": "Judge evidence", "prompt": "Judge {collect.results}." }
    }
  ],
  "return": "{judge.results}"
}

conditional fanout

{
  "name": "conditional-fanout",
  "schemas": {
    "Discovery": {
      "type": "object",
      "properties": {
        "targets": { "type": "array", "items": { "type": "string" } }
      },
      "required": ["targets"]
    }
  },
  "phases": [
    {
      "id": "discover",
      "kind": "single",
      "step": { "summary": "Discover targets", "prompt": "Discover targets and return a Discovery object.", "schema": "Discovery" }
    },
    {
      "id": "verify",
      "kind": "fanout",
      "when": "{discover.results}",
      "over": "{discover.results[].targets[]}",
      "step": { "summary": "Verify {item}", "prompt": "Verify target {item}; do not mutate anything." }
    }
  ],
  "return": "{verify.results}"
}
# core

Each example is a complete workflow spec.

## tiny single

```json
{
  "name": "tiny-single",
  "phases": [
    {
      "id": "answer",
      "kind": "single",
      "step": { "summary": "Return a bounded answer", "prompt": "Return a concise status object for this demonstration. Do not assume parent conversation context." }
    }
  ]
}
```

### single with positional input

```json
{
  "name": "single-input",
  "args": { "hint": "<question>", "params": ["question"] },
  "phases": [
    {
      "id": "answer",
      "kind": "single",
      "step": { "summary": "Answer the question", "prompt": "Answer: {args.question}" }
    }
  ],
  "return": "{answer.results}"
}
```

### literal fanout

```json
{
  "name": "literal-fanout",
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": ["README.md", "CHANGELOG.md", "package.json"],
      "step": { "summary": "Inspect {item}", "prompt": "Read {item} and summarize it; do not mutate anything." }
    }
  ],
  "return": "{inspect.results}"
}
```

### input-driven fanout

Use structured `run_workflow` args when one input must remain an array.
Bare command arguments are strings.

```json
{
  "name": "input-fanout",
  "args": { "hint": "JSON args: { paths: string[] }" },
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": "{args.paths}",
      "step": { "summary": "Inspect {item}", "prompt": "Read {item}; return its key facts and do not mutate anything." }
    }
  ]
}
```

### ignored single over

```json
{
  "name": "single-over",
  "phases": [
    {
      "id": "one",
      "kind": "single",
      "over": ["ignored", "also-ignored"],
      "step": { "summary": "Run once", "prompt": "Run this synthesis once." }
    }
  ]
}
```

### conditional single

```json
{
  "name": "conditional-single",
  "args": { "hint": "optional input", "params": ["input"] },
  "phases": [
    {
      "id": "collect",
      "kind": "single",
      "step": { "summary": "Collect evidence", "prompt": "Collect evidence for {args.input}." }
    },
    {
      "id": "judge",
      "kind": "single",
      "when": "{collect.results}",
      "step": { "summary": "Judge evidence", "prompt": "Judge {collect.results}." }
    }
  ],
  "return": "{judge.results}"
}
```

### conditional fanout

```json
{
  "name": "conditional-fanout",
  "schemas": {
    "Discovery": {
      "type": "object",
      "properties": {
        "targets": { "type": "array", "items": { "type": "string" } }
      },
      "required": ["targets"]
    }
  },
  "phases": [
    {
      "id": "discover",
      "kind": "single",
      "step": { "summary": "Discover targets", "prompt": "Discover targets and return a Discovery object.", "schema": "Discovery" }
    },
    {
      "id": "verify",
      "kind": "fanout",
      "when": "{discover.results}",
      "over": "{discover.results[].targets[]}",
      "step": { "summary": "Verify {item}", "prompt": "Verify target {item}; do not mutate anything." }
    }
  ],
  "return": "{verify.results}"
}
```