# Set up Digg

You are an AI coding agent reading this because someone asked you to set up
Digg. This file is the authoritative setup procedure. Follow it in order.

Digg captures the AI-coding sessions a developer approves, strips secrets and
personal data on their machine before anything uploads, and rewards them with
AI Stocks for sessions that enter the training corpus.

Because Digg reads and uploads records of the user's coding work, **consent is
not a formality here — it is the product's legal basis.** The rules below are
not optional.

---

## Rules

1. **Never enable capture without the user's explicit, informed yes.** Not
   implied by "set up Digg", not implied by a broad permission mode, not
   implied by an earlier approval in the session. Ask, in your own words, using
   the disclosure in step 2, and wait for an answer.
2. **Never sign in on the user's behalf.** Sign-in is a device link the human
   approves in their browser. Print the link and stop.
3. **Do not run `digg backfill` unless the user asks for it.** It uploads the
   coding history already on disk, which is a much larger disclosure than
   capturing from now on.
4. **If a step fails, stop and report it.** Do not work around a failure by
   changing scope, skipping consent, or installing something else.
5. **Report only what you actually did.** If you skipped a step, say so.

---

## 1. Check the prerequisites

```bash
node --version    # must be 18 or newer; 22+ also captures Cursor's IDE chat
```

If Node is missing or older than 18, stop and tell the user to install Node
first. Do not install Node for them.

If `digg --version` already succeeds, skip to step 3.

## 2. Get consent, then install

Tell the user, in your own words, that Digg will:

- watch the session files their coding agents already write to disk
  (`~/.claude`, `~/.codex`, Cursor's workspace store) for repositories they
  approve;
- strip secrets, personal data, and their username from file paths **on this
  machine, before upload**, and show a counts-only receipt per session;
- upload only the redacted sessions, which they can view, share, or delete;
- pay them AI Stocks for sessions that enter the training corpus. Those are
  tokens issued by third-party brokers, not real shares. See
  <https://digg.sh/terms>.

Ask whether to continue. If the answer is no, stop.

```bash
curl -fsSL https://digg.sh/cli.sh | bash
```

The installer prints where it put the `digg` binary. If it warns that the
directory is not on `PATH`, show the user the exact `export PATH=...` line it
printed and tell them to add it to their shell profile.

## 3. Sign in

```bash
digg login
```

This prints a URL and a short confirm code. **Show both to the user and stop.**
They must open the link in a browser where they are signed in to Digg, check
that the code matches, and approve. Wait for them to tell you it is done.

If they have no account, the link will offer to create one.

## 4. Connect this machine and start capture

```bash
digg connect      # enrolls this machine and records consent
digg start        # starts capturing in the background
```

## 5. Make capture survive reboots

```bash
digg service install
```

A bare `digg start` is a detached process that dies with the machine, and users
do not remember to re-run it. This registers the daemon with launchd (macOS) or
systemd (Linux) as a user-scoped service, so capture resumes at login. It never
uses sudo, and `digg service uninstall` reverses it completely.

(The one-command `digg` flow does this step for you. You are running the
commands individually, so run it explicitly.)

If the platform is unsupported, the command says so — tell the user they will
need to run `digg start` after each reboot.

## 6. Verify and report

```bash
digg status
```

Expect `Signed in: yes`, `Connected: yes`, `Capturing: yes`. Report the actual
output, not what you expected.

Then tell the user:

- capture is running and needs nothing further from them;
- sessions appear at <https://app.digg.sh/sessions> after the server curates
  them, which takes a few minutes after they finish coding;
- earnings are at <https://app.digg.sh/dashboard>, or `digg earnings`;
- they can pause or remove it at any time (see below).

Useful commands to hand over:

| Command | What it does |
|---|---|
| `digg status` | Sign-in, connection, capture, and reward status |
| `digg earnings` | Points earned today, lifetime, and redeemable |
| `digg sessions` | Recent captured sessions |
| `digg consent pause <harness>` | Stop capturing one tool, e.g. `claude-code` |
| `digg stop` | Stop capturing now |
| `digg logout` | Sign out and disconnect this machine |
| `digg switch` | Sign out and set up a different account |
| `digg service uninstall` | Stop capture resuming at login |
| `digg uninstall` | Remove all Digg state from this machine |

## If something goes wrong

- `command not found: digg` — the install directory is not on `PATH`. Show the
  user the line the installer printed.
- DNS output instead of Digg — they typed `dig` (the DNS tool that ships with
  macOS and Linux), not `digg`. The command has two g's.
- Sign-in link expired — device links are short-lived; run `digg login` again.
- Nothing captured yet — curation runs server-side on a delay. Confirm with
  `digg status` rather than waiting on the dashboard.
- Anything else — stop and show the user the real error output.

Full documentation: <https://digg.sh/docs>
