# OpenCode
> What an OpenCode session materialises, the init flag that makes it the hall's provider, and how /ivar-discovery runs there.
Source: https://ivar.run/docs/providers/opencode

import { File, Files, Folder } from 'fumadocs-ui/components/files';

Setup is harness-agnostic — see the [quickstart](/docs/quickstart) for creating
a hall and opening your first session. This page covers what is specific to
OpenCode once you're there.

## What lands in `.opencode/`

An OpenCode session materialises a `.opencode/` directory at the view
directory's root, alongside the promoted repos:

<Files>
  <Folder name=".opencode" defaultOpen>
    <Folder name="command" defaultOpen>
      <File name="ivar-discovery.md" />
      <File name="ivar-plan.md" />
    </Folder>
    <Folder name="skills" />
    <Folder name="plugins" defaultOpen>
      <File name="ivar-execution-guard.ts" />
    </Folder>
  </Folder>
  <File name="AGENTS.md" />
  <File name="opencode.json" />
</Files>

`.opencode/skills/` carries the hall's skills, both hall-level and
repo-namespaced (`api--openapi-contract`, `web--openapi-contract`). `AGENTS.md`
is the provider-native instructions file OpenCode reads at startup.
`opencode.json` is OpenCode's general config — model, permissions — and `ivar`
adds its `$schema` key without touching the rest of it.

The read-only guard for repos you haven't promoted is enforced by
`.opencode/plugins/ivar-execution-guard.ts`. It's a real plugin plus a real
cleared write bit — not a prompt asking the agent to behave.

## Add it to an existing hall

The [quickstart](/docs/quickstart) covers `ivar init --provider opencode`. If
the hall already exists with a different provider, add OpenCode alongside it:

```sh
ivar provider add opencode
```

## Where `/ivar-discovery` comes from

It is materialised into OpenCode's command directory, so you type it in
OpenCode rather than in a shell.
