> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> Claude Code, Cursor, Codex, Windsurf: your agent does the work once, Nika keeps the workflow. Two commands wire any of them.

Your agent already does the work: a PR review in Claude Code, a research
brief in Codex, a triage pass in Cursor. Then the chat scrolls away and the
procedure is gone. Nika's job is to keep it: the agent writes the workflow
**as a `.nika` file**, you review it, the runtime enforces it, and it
runs again next week without re-prompting.

Two commands wire any agent:

```sh theme={"system"}
nika init            # agent guides + authoring skill + editor schema + project MCP configs + Claude Code and Cursor hooks
nika wire <client>   # adds Nika's read-only MCP oracle to one agent client's own configuration
```

Driving Nika from an app instead of an editor? Install
`@supernovae-st/nika@0.124.1`, write `hello.nika`, call `run()`, then
`run.result()` — [TypeScript quickstart](https://docs.nika.sh/sdk/start/quickstart.md). The
agent loop below is for the editor/CLI door.

## `nika init`: teach the repo

`nika init` founds a repository for agents and editors. Existing files are
skipped (`.gitignore` is the one file it updates in place, adding its ignore
lines); `--force` overwrites. On a terminal it asks a few questions;
`--yes` accepts every default, and pipes and CI never prompt. In an empty
folder, `nika init --yes` writes these files:

| File | What it is for |
| - | - |
| `AGENTS.md` | The agent operating guide: the four verbs, the authoring loop (`nika compile` → answer the questions → `nika check` → repair), and the rules that keep generated workflows valid. Read natively by Codex, Claude Code, Cursor and other AGENTS.md-aware tools |
| `CLAUDE.md` | Claude Code's entry point, pointing at `AGENTS.md` |
| `NIKA.md` | A guide for people: the first workflow, team settings and what to commit |
| `.github/copilot-instructions.md` | The same guidance for GitHub Copilot |
| `.agents/skills/nika-authoring/` | An [agent skill](https://agentskills.io) (`SKILL.md` and its references) that `.agents`-aware clients such as Codex discover and invoke as `$nika-authoring` |
| `.cursor/rules/nika.mdc` · `.cursor/rules/nika-delegation.mdc` | Cursor rules, attached whenever the agent touches a `.nika` file |
| `.cursor/agents/nika-{author,debugger,migrator}.md` | Three Cursor subagents |
| `.mcp.json` · `.cursor/mcp.json` · `.agents/mcp_config.json` | Project MCP configurations that start Nika's read-only oracle (`nika mcp`) |
| `.claude/settings.json` · `.claude/hooks-nika/*.sh` | Claude Code hooks: session context at start, a native-strict check after each edit, and a guard before shell commands |
| `.cursor/hooks.json` · `.cursor/hooks-nika/*.sh` | The same three hooks for Cursor |
| `.vscode/settings.json` | Maps `*.nika` to YAML and to the workflow JSON Schema |
| `nika.yaml` | The [project file](https://docs.nika.sh/sdk/project/nika-yaml.md), its settings commented until you edit them |
| `workflows/01-hello.nika` · `workflows/README.md` | A starter workflow and an index |
| `.gitignore` | Adds `.nika/traces/` (run records hold the data a run read), `.nika/serve.token` (the `nika serve` HTTP token, a credential) and `.nika/serve/` (its job state). A repository founded before 0.123.1 keeps its old section: add the two `serve` lines by hand |

> [!WARNING]
>
> The hooks are shell scripts that Claude Code and Cursor run inside your
> repository: `session-context.sh` at session start, `check-on-edit.sh` after
> an edit, and `guard-run.sh` before the agent runs a shell command (it asks
> `nika guard` to judge the command). Read them before you commit them, as you
> would any script an agent executes. The project MCP files make those clients
> start `nika mcp` in this repository.

Flags shape the scaffold: `--recipe agentic|starter|ship|content|minimal`
chooses a workflow set, `--example <slug>` founds the project from one
embedded example (any slug from bare `nika try`) together with what its lesson
reads: the fixtures under `examples/fixtures/` and the children it invokes,
beside it in `workflows/`, each listed as a `created` row and never written
over an existing file. `--wire <clients>` also runs `nika wire` for those
clients afterwards.

## Or: install the plugin (Codex · Claude Code)

Codex and Claude Code users can skip per-repo setup entirely: the
[nika-plugins](https://github.com/supernovae-st/nika-plugins) repository
publishes one plugin (version 0.124.1) for both ecosystems: 4 skills, 3
subagents, 2 rules, 6 slash commands (`check` · `compile` · `doctor` ·
`explain` · `permits` · `trace`), 3 hooks (one dialect: Codex speaks Claude
Code's hook contract) **and** the read-only MCP oracle:

```sh theme={"system"}
# Codex
codex plugin marketplace add supernovae-st/nika-plugins
codex plugin add nika@nika

# Claude Code
claude plugin marketplace add supernovae-st/nika-plugins
claude plugin install nika@nika
```

One install: the `nika-authoring` skill lands (invoke it explicitly, or
let it auto-trigger on `.nika` work), and the read-only oracle is
wired (9 tools: `nika_check` + `nika_explain` + the authoring surface).
The plugin expects the `nika` binary on your PATH (`brew install supernovae-st/tap/nika`).

## `nika wire`: give the agent the real oracle

`nika wire` patches your client's MCP config to add Nika's **read-only**
oracle: the agent can *check* and *explain*, never execute (`nika run`
stays in your hands):

| Client | Command | What it patches |
| - | - | - |
| Detected on this machine (recommended) | `nika wire detected --dry-run`, then `nika wire detected` | only the clients this machine shows |
| Claude Code | `nika wire claude` | `~/.claude.json` → `mcpServers.nika` |
| Claude Desktop | `nika wire claude-desktop` | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) |
| Cursor | `nika wire cursor` | `~/.cursor/mcp.json` |
| Windsurf | `nika wire windsurf` | `~/.codeium/windsurf/mcp_config.json` |
| VS Code | `nika wire vscode` | `.vscode/mcp.json` (project-local) |
| Codex CLI | `nika wire codex` | `~/.codex/config.toml` → `[mcp_servers.nika]` |
| Gemini CLI | `nika wire gemini` | `~/.gemini/settings.json` |
| Qwen Code | `nika wire qwen` | `~/.qwen/settings.json` |
| Kimi Code | `nika wire kimi` | `~/.kimi-code/mcp.json` |
| OpenCode | `nika wire opencode` | `opencode.json` |
| Hermes | `nika wire hermes` | `~/.hermes/config.yaml` |
| Zed | `nika wire zed` | `~/.config/zed/settings.json` |
| Continue | `nika wire continue` | `~/.continue/mcpServers/nika.json` |
| Cline | `nika wire cline` | `~/.cline/data/settings/cline_mcp_settings.json` |
| LM Studio | `nika wire lmstudio` | `~/.lmstudio/mcp.json` (resolved) |
| Junie | `nika wire junie` | `.junie/mcp/mcp.json` |
| Grok Build | `nika wire grok` | `~/.grok/config.toml` |
| Antigravity | `nika wire antigravity` | `~/.gemini/config/mcp_config.json` |
| Kiro | `nika wire kiro` | `~/.kiro/settings/mcp.json` |
| GitHub Copilot CLI | `nika wire copilot` | `~/.copilot/mcp-config.json` |
| Amp | `nika wire amp` | `~/.config/amp/settings.json` |
| Everything | `nika wire all` | previewed, then confirmed (or `--yes`) |

Whatever the harness, the payloads an agent parses are the same
versioned wires — envelopes, exit codes, and evolution rules are
documented in [Machine surfaces](https://docs.nika.sh/reference/machine-surfaces.md).

Any other MCP client takes the same stanza — a stdio server,
`command: nika`, `args: ["mcp"]`. Gemini CLI also accepts
`gemini mcp add nika nika mcp`. Per-client files:
[MCP clients](https://docs.nika.sh/integrations/mcp-clients.md).

The server exposes two tool families — **validate** and **learn**:

* **`nika_check`**: the full static audit (plan · cost ceiling · secret
  flows · types · tool args · schema) as structured JSON. The agent fixes
  its own file before you ever see it.
* **`nika_explain`**: any `NIKA-XXX` error code, explained.
* **`nika_schema` · `nika_examples` · `nika_template` · `nika_canon` ·
  `nika_catalog` · `nika_tools` · `nika_inspect`**: the authoring
  surface — the JSON Schema, the runnable examples, the skeletons, the
  canon SSOT, the provider + builtin catalogs, and the typed DAG, as
  versioned machine projections, so the agent follows the
  template→fill→check→repair path instead of guessing structure. All
  read-only, all served from the embedded pack.

> [!NOTE]
>
> `nika wire codex` patches `~/.codex/config.toml` (`[mcp_servers.nika]` ·
> `command = "nika"` · `args = ["mcp"]`, comments preserved). Codex also
> reads `AGENTS.md` natively, so `nika init` alone already teaches it the
> authoring loop.

## The loop

```text theme={"system"}
agent writes review.nika        (from AGENTS.md + a template)
  → nika check --native-strict       (agent self-repairs from the findings)
  → nika run --model mock/echo       (shape proof · zero keys)
  → you read the file                (it's YAML, review it like code)
  → nika run review.nika        (you, or your CI, not the agent)
```

The model extracts facts. `nika:jq` or `nika:decide` is the law — do
not pay a second infer to pick a level. Numeric facts are
`type: integer`. The teaching file is `nika try 13-extract-then-law`.

The division of labor is the point: the **agent authors**, the **file is
the contract**, the **human approves**, the **runtime enforces**.

<video autoPlay muted loop playsInline controls poster="/images/posters/agent-plugin.png" aria-label="A coding agent writes release-notes.nika from one request with the plugin's nika-authoring skill; nika check refuses nika:read_file (NIKA-BUILTIN-001), the agent repairs it to nika:read, the re-check says run ready, and a mock/echo rehearsal writes release-notes.md" alt="A coding agent writes release-notes.nika from one request with the plugin's nika-authoring skill; nika check refuses nika:read_file (NIKA-BUILTIN-001), the agent repairs it to nika:read, the re-check says run ready, and a mock/echo rehearsal writes release-notes.md">
  <source src="https://mintcdn.com/supernovae-acdf3706/3tG2rJOQxMP3h2LO/videos/agent-plugin.webm?fit=max&auto=format&n=3tG2rJOQxMP3h2LO&q=85&s=cb71f000da9cbda39e20453eadaedbce" type="video/webm" />

  <source src="https://mintcdn.com/supernovae-acdf3706/3tG2rJOQxMP3h2LO/videos/agent-plugin.mp4?fit=max&auto=format&n=3tG2rJOQxMP3h2LO&q=85&s=1eaa0b14953a7bf70490568c23974b5e" type="video/mp4" />
</video>

**The loop, once through.** Asked to turn `CHANGELOG.md` into release notes, the agent drafts a workflow that calls `nika:read_file`. `nika check --native-strict` refuses it (`NIKA-BUILTIN-001`), the agent repairs it to `nika:read`, and the re-check says run ready. A `mock/echo` rehearsal then writes `release-notes.md`. *The checks and the run are captured from the real CLI on nika 0.121.0; the agent session is an illustration.*

## Editor surface

`nika lsp`, the language server built into the binary, gives any editor
check-as-you-type diagnostics and quick fixes. The
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=supernovae.nika)
adds a DAG view and trace replay on top. The editor extension, frozen at 0.120 and not qualified with 0.124: use `nika lsp` and the JSON Schema; if you keep it,
set its `nika.server.path` to your installed `nika` and trust `nika check` if
the two disagree. See [Editors](https://docs.nika.sh/getting-started/editors.md).

## Read next

> [card] [Agent authoring protocol](https://docs.nika.sh/guides/agent-authoring.md)
>
> The deterministic path: template → fill → check → repair.

> [card] [Templates](https://docs.nika.sh/guides/templates.md)
>
> The valid skeletons `nika compile --list` names.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.