---
name: writ-setup
description: >-
  Use when the user asks to install, set up, or get Writ running for the first
  time — e.g. "set up Writ", "install the writ CLI", "create a signing key
  for Writ", or "check that Writ is installed correctly." Writ
  (https://writ.lightningenable.com) is a self-hosted .NET CLI that runs an
  agent mission under a bounded, paid, receipted "writ" and produces a signed
  work record. This skill confirms the `writ` tool is installed (Writ is in
  private preview; access is requested at support@lightningenable.com),
  creates a persistent operator signing identity with `writ keys init`, and
  confirms the setup with a zero-cost smoke run — the prerequisite for the
  writ-run and writ-verify skills. It never enables wallet settlement or --production;
  those need explicit human confirmation every time, in a separate flow.
---

# Writ setup

Confirm the `writ` tool is installed, create a persistent operator signing identity, and confirm the setup works — end to end, with no wallet and no real money.

Writ is in **private preview**. To request access, write to support@lightningenable.com.

## What you need

- The [.NET 10 SDK](https://dotnet.microsoft.com/download) (LTS) — check with `dotnet --version`.
- Nothing else. No wallet, no API key, no Lightning node. Setup and the smoke test below use only `settlement.mode: simulated`.

## Flow

### 1. Confirm the `writ` tool is installed

```bash
writ --version
```

Confirm that `writ --version` prints a version. If `writ` is not found, try a new shell in case the tool's folder was added to PATH after this one started. If it is still not found, stop and tell the human: Writ is in private preview, and access is requested at support@lightningenable.com. Don't try to obtain Writ any other way.

### 2. Smoke-test the setup

In an empty working directory, write this manifest to `smoke.yaml`:

```yaml
mission:
  name: smoke
  goal: "One paid capability call under a bounded budget, settled in simulated mode."

budget:
  total_sats: 100
  per_call_max_sats: 25

settlement:
  mode: simulated

capabilities:
  - id: data.lookup
    kind: l402-http
    base_url: https://api.example.test/data
    path: /lookup
    method: GET
    max_sats_per_call: 5

workers:
  - name: probe
    scope: [data.lookup]
    budget_sats: 40
    steps:
      - type: call
        capability: data.lookup
        input: { q: smoke }
        output: lookup.json

work_record:
  signing: dev-ephemeral
  output_dir: runs/
```

Then run it:

```bash
writ run smoke.yaml
```

This needs no wallet, no API key, and no network beyond the in-process simulated L402 endpoint. Confirm the output contains `Run smoke-...: Completed` and the exit code is `0`. In a source checkout, `examples/ci-smoke/mission.yaml` is the same kind of mission. If the CLI has no output or errors, report it; don't proceed to the next step.

### 3. Create a persistent operator identity

Ask the human (if not already told) what name should identify them as the operator — this is published in every signed work record, so don't invent one:

```bash
writ keys init --operator-name "<their name or org>" --operator-url <optional> --operator-contact <optional>
```

Real output looks like:

```
Created receipt signing key: keys/receipt.key (private; no other account is granted access)
Created signer identity:     <working directory>/keys/signer-identity.json (public; ships with every run)
  key_id:   <16 hex characters>
  pubkey:   <64 hex characters>
  operator: <name>

Next: in mission.yaml set
  work_record:
    signing: key-file
    key_file: keys/receipt.key
and share the pubkey with anyone who will run `writ verify`.
```

`keys/` is created in the current directory, and a manifest's `key_file: keys/receipt.key` is resolved from the directory `writ` runs in. Run missions from this directory, or give `key_file` an absolute path.

Report the printed `key_id` and `pubkey` back to the human — that pubkey is what a counterparty will pin to verify this operator's work records later. **Never** print, log, or otherwise surface the private key file's contents; `keys init` itself never prints it, and neither should you.

If `keys/receipt.key` already exists, `writ keys init` refuses to overwrite it (exit 2) — that's expected on a re-run, not a failure. Use `writ keys show` to confirm the existing identity instead of creating a second key without being asked to.

### 4. Confirm the identity with `writ keys show`

```bash
writ keys show
```

Confirm `self-signature: valid` and `key file: ... (matches this identity)` in the output. If either check fails, the local key/identity pair is corrupted — report this rather than regenerating a key without the human's say-so (a second key means a second pubkey they'd have to redistribute).

## Safety rules

- **Never enable `settlement.mode: wallet` or pass `--production` during setup.** Setup only ever runs `simulated` missions. Moving to real settlement is a separate, explicit decision — see the [writ-run](../writ-run/SKILL.md) skill's guardrails.
- **Never print the private key.** `writ keys show`, `writ keys init`, and every other command in this skill are designed to never emit it — don't work around that by `cat`-ing `keys/receipt.key` or similar.
- **Don't silently create a second identity.** If a key already exists, use it (`writ keys show`) rather than generating a new one at a different path unless the human explicitly asks for a second identity.

## What "done" looks like

Report back to the human: `writ --version` printed a version, the smoke mission completed (paste the `Run ... Completed` line), and the operator identity's `key_id` + `pubkey`. That pubkey is the one piece of information they'll want to hand to anyone who verifies this operator's work later — see the [writ-verify](../writ-verify/SKILL.md) skill.

## Next

- [writ-run](../writ-run/SKILL.md) — author and run a mission.
- [writ-verify](../writ-verify/SKILL.md) — verify a work record from this or another operator.
- Full docs: https://writ.lightningenable.com/docs/getting-started/installation and https://writ.lightningenable.com/docs/guides/keys-and-verification
