# Stack Layout

> Nested concentric architecture rings with inside-out sequential highlight sweeps.

Use `stack` when inner layers sit inside outer boundaries — such as Prompt inside Context inside Harness, or Application inside Runtime inside Sandbox.

## Live Interactive Example

Click any ring to inspect the controls owned by that boundary:

```diagram
type: stack
label: "Prompt inside Context inside Harness, each layer with its controls."
outer_dashed: true
layers:
  - title: Harness
    note: "Can it act safely and be audited?"
    detail: "tools= · guardrails= · approvals="
    description: "Outer execution boundary controlling sandboxing, human approvals, and guardrails."
  - title: Context
    note: "Is the right knowledge in the window?"
    detail: "memory= · knowledge= · compaction="
    description: "Manages RAG retrieval, session memory, and context compaction."
  - title: Prompt
    note: "Did we state the goal clearly?"
    detail: "instructions= · schema="
    description: "Core system instructions and structured output contract."
```

## Step-by-Step Guide

1. **Order `layers` from outermost to innermost** (2–7 layers).
2. **Give each layer a `title`**, an italic guiding question in `note`, and monospaced parameters in `detail`.
3. **Set `outer_dashed: true`** when the outermost ring wraps everything as an execution or policy boundary.
4. **Add `description` or `code`** to any layer so clicking that ring opens rich inspector details.

## YAML Source

```yaml
type: stack
label: "Prompt inside Context inside Harness, each layer with its controls."
outer_dashed: true
layers:
  - { title: Harness, note: "Can it act safely?", detail: "tools= · guardrails=" }
  - { title: Context, note: "Is the right context loaded?", detail: "memory= · knowledge=" }
  - { title: Prompt, note: "Did we state the goal?", detail: "instructions= · schema=" }
```

## Field Reference

| Field | Required | Description |
|---|---|---|
| `type` | Yes | Must be `stack` |
| `label` | Yes | Accessible 1-sentence summary |
| `layers` | Yes | 2–7 layers, outermost first (`{ title, note?, detail?, description?, code? }`) |
| `outer_dashed` | No | `true` animates a dashed accent stroke on the outermost ring |

## Related pages

- [Flow Layout](https://diagram.praison.ai/docs/layouts/flow.md)
- [Timeline Layout](https://diagram.praison.ai/docs/layouts/timeline.md)
- [Loop Layout](https://diagram.praison.ai/docs/layouts/loop.md)
