# Playground (/docs/playground)

A playground is the real conciv panel, playing a scripted session in your browser. Nothing runs on a server. You need no
agent CLI. Each one also sits on the page that explains it.

## Available playgrounds [#available-playgrounds]

### First session [#first-session]

A question about the page, a change, and the agent checking the result.

<Playground page="vite-react" script="intro/first-session" caption="A first session, start to finish." />

### Ask about the page [#ask-about-the-page]

The agent reads the open page and names the file that renders it. From [Getting started](/docs/getting-started).

<Playground
  page="vite-react"
  script="getting-started/ask-about-page"
  look="poster"
  caption="Ask about the page you are on."
/>

### Send and queue [#send-and-queue]

A message sent while the agent works waits in the queue, then goes next.

<Playground page="vite-react" script="chat/send-and-queue" caption="Send a message, then queue another." />

### Point and change [#point-and-change]

Pin an element with the crosshair, then ask for a change to it.

<Playground page="vite-react" script="page-control/point-and-change" caption="Point at an element and change it." />

### Allow once [#allow-once]

A risky action asks first. Allow once answers it for this call only.

<Playground page="vite-react" script="approvals/allow-once" caption="A permission card, answered with Allow once." />

### Run the tests [#run-the-tests]

A test run streams into the Tests tab, then lands as a card in the thread.

<Playground page="vite-react" script="live-tests/run" caption="A live test run." />

### Quick terminal [#quick-terminal]

The hotkey opens the quick terminal, and a command runs in your project.

<Playground page="vite-react" script="quick-terminal/command" caption="A command in the quick terminal." />

### Build errors [#build-errors]

The agent reads the dev server's build errors and fixes the source.

<Playground page="vite-react" script="dev-server/build-errors" caption="Ask the agent about build errors." />

### Your first plugin's card [#your-first-plugins-card]

A tool call shows the generic card first, then the card your plugin draws. From
[Build your first plugin](/docs/plugins/first-plugin).

<Playground page="vite-react" script="plugins/first-plugin-card" caption="The generic card, then your card." />

### Direct call or code mode [#direct-call-or-code-mode]

The same tool, called directly and from inside a code-mode script. From
[Tools and code mode](/docs/tools-and-code-mode).

<Playground
  page="vite-react"
  script="plugins/tool-direct-vs-codemode"
  caption="A direct call next to a code-mode call."
/>

### A plugin's permission card [#a-plugins-permission-card]

A plugin tool asks for permission, and the card shows its question.

<Playground page="vite-react" script="plugins/permission-card" caption="The permission card a plugin tool raises." />

### A panel tab [#a-panel-tab]

A plugin adds its own tab to the panel.

<Playground page="vite-react" script="plugins/panel-tab" caption="A plugin's tab in the panel." />

## Local development [#local-development]

Prefer a real app? The conciv repo has two example apps with conciv already set up. Clone the repo and install:

```bash title="Terminal"
git clone https://github.com/conciv-dev/conciv.git
cd conciv
pnpm install
```

Then start an example:

```bash title="Terminal"
pnpm turbo run dev --filter=tanstack-start-example # <- or --filter=nextjs-app
```

- The repo pins its pnpm version. It needs Node 26 or newer.
- The first run builds the conciv packages the example uses. It then prints the address to open.
- These examples run a real agent CLI, so it must be installed and logged in.

Learn more in [Examples](/docs/examples).

## Write a playground [#write-a-playground]

A playground is one script file and one line of MDX. The script lists what the reader types and what the agent answers:

```ts title="apps/site/src/playground/scripts/chat/hello.ts"
import type {PlaygroundScript} from '../../script'

export default {
  title: 'Say hello',
  screen: 'panel', // <- or 'quick' for the quick terminal
  plugins: [], // <- browser parts to load, such as 'test-runner'
  turns: [
    {
      prompt: 'Rename the heading to Hello.', // <- typed into the real composer
      replies: [
        {
          kind: 'tool',
          name: 'page_settext',
          input: {selector: 'h1', text: 'Hello'},
          result: {ok: true},
          page: {heading: 'Hello'},
        },
        {kind: 'text', text: 'The heading says **Hello** now.'},
      ],
    },
  ],
} satisfies PlaygroundScript
```

Add it to `playground-scripts.ts`, then put it on a page:

```mdx title="content/docs/usage/chat.mdx"
<Playground page="vite-react" script="chat/hello" caption="Say hello." />
```

A few things to notice:

- A tool reply can ask first (`ask`), change the demo page (`page`), or run from code mode (`mode: 'code'`).
- The script is typed. A change to the widget's contract fails the site's typecheck, not the page.
- Under reduced motion, each step jumps to its end. On a narrow screen, the page shows the transcript only.

## Next steps [#next-steps]

- **Add it to your app**: [Getting started](/docs/getting-started).
- **Run an example**: [Examples](/docs/examples).
