# Quickstart

Run the San Francisco demo on your own machine: fetch public data, ask a question, read the cited answer and run an eval. You need [Deno](https://deno.com) 2 and [uv](https://docs.astral.sh/uv/), and every command runs from the root of the Groundwork repository. Everything runs locally except the written answer, which goes through a local Claude subscription.

## 1. Fetch and ingest

```sh
deno task sf fetch
deno task sf ingest
```

`fetch` downloads public San Francisco data into `tmp/sf/raw`, and `ingest` indexes it into `tmp/sf/groundwork.db`. Both skip work already done. [Sources](/docs/sources) lists the data and its options.

## 2. Ask a question

```sh
deno task sf ask "What is planned at 150 Hayes Street?" --path auto --answer
```

`--path auto` lets the router pick one of the three answer paths. `--answer` writes an answer with `claude/inline`. Without it, Groundwork returns the evidence and canonical fields with no generated text, which is useful for checking retrieval on its own.

The default output is a terminal rendering: the question, the path taken, the written answer, the canonical entities it touched, every piece of evidence with its id and how it was found, and the trace of steps. The last line names the audit command for this question:

```sh
Audit: deno task gw audit edf3b647-069e-4615-8dae-2a29b98ecba7
```

See [Ask and search](/docs/ask) for every option.

## 3. Read the cited answer as XML

```sh
deno task sf ask "What is planned at 150 Hayes Street?" --path entities --answer --format xml
```

`--format xml` prints the answer document that products consume. Each claim cites a source with a `[^s1]` marker, and each source is declared once with its kind, title, address and a short excerpt. The citation check result goes to standard error.

```xml
<answer id="ans_802be77c" path="entities" run="edf3b647-069e-4615-8dae-2a29b98ecba7" at="2026-11-07T02:12:45.070Z">
  <body>
A permit filed on 2026-10-29 would convert the office building at 150 Hayes St into a
106-unit residential building [^s1].
  </body>
  <field entity="address.150-hayes-st" name="street" source="s2">hayes st</field>
  <source id="s1" kind="row" title="Permit 202610149441 at 150 Hayes St: filed" href="gw://permits/175834582073">Table: permits ...</source>
  <source id="s2" kind="row" title="Liberty Park Management Inc at 150 Hayes St" href="gw://businesses/0377938-29-001-0377938">Table: businesses ...</source>
  <entity key="address.150-hayes-st" type="address" />
</answer>
Citations: {"ok":true,"markers":1,"unresolved":[],"uncited":[],"badFields":[]}
```

`--format json` prints the full answer object, including evidence, entities, trace and run id. The format is described in [Answer format](/docs/answer-format).

## 4. Trace an answer

Every question gets an audit run id. The audit command prints each adapter call behind it, in order, with input and output hashes.

```sh
deno task gw audit edf3b647-069e-4615-8dae-2a29b98ecba7
```

| # | Step | Adapter | Version | Input | Output | Ok | Ms |
|---|---|---|---|---|---|---|---|
| 1 | route | rules/keywords | 1 | fffb5057 | 4ebf5e60 | yes | 6 |
| 2 | generate | claude/inline | 1 | 4ed067d1 | 16d44b22 | yes | 4127 |

Run `deno task gw audit` with no id to list the latest runs. The ledger lives at `tmp/sf/audit.db`; pass `--ledger <path>` to read another.

## 5. Run an eval

```sh
deno task sf eval
```

The golden set at `evals/sf/golden.json` holds 22 questions, each with the records or meeting moments a good answer should cite and the facts it should state.

By default the eval runs every row through the search, agent and entities paths and prints a table per path: recall, the share of questions where every needed source was found, and the share of facts present in the evidence. Add `--answer` (or `--model <id>`) to also score the written answers, and `--path auto` to score the router. Each run is saved to `tmp/sf/evals/<time>-<settings>.json`. See [Evals and golden sets](/docs/evals).

## 6. Build the scorecard

```sh
deno task scorecard
```

This reads the newest eval runs and benchmark files and writes `tmp/scorecard.json` and `tmp/scorecard.md`: one row per dimension, one column per use case, each cell green, amber or red against a stated threshold. See [Scorecard](/docs/scorecard).

## 7. Open the demo

```sh
deno task web
```

This builds the page and serves it at `http://localhost:8641`. The page asks questions against the datasets the command line built and shows the scorecard. Use `deno task web:serve` to serve without rebuilding.

## The hosted API

The demo serves an API over the files you upload there. Make a key on the Use step of [get started](/demo/start). It is shown once and opens only your uploads.

```sh
export GW_KEY=gwd_…
curl -X POST https://<demo>/v1/ask \
  -H "Authorization: Bearer $GW_KEY" \
  -H "content-type: application/json" \
  -d '{"question": "What does the warranty cover?"}'
```

| Endpoint | Body | Returns |
|---|---|---|
| `POST /v1/ask` | `{ "question" }` | `answer` in Markdown with `[^s1]` markers, `sources`, `run` |
| `POST /v1/search` | `{ "query", "k" }` | `passages`, best first, with no model call |
| `POST /v1/sources` | `{ "from" }`, a link or `notion`, `slack` or `drive` | `added`, or `wait` with a `signIn` link |
| `PUT /v1/files?name=` | The file's bytes | `added` |
| `POST /mcp` | MCP over streamable HTTP | The `ask`, `search` and `add` tools |

[Try your own files](/docs/your-files) walks through it, including adding the MCP server to Claude Code.

Projects with their own sources and keys are planned rather than running. The API reference describes them, starting at [Ask](/docs/api/ask), and [Projects and keys](/docs/projects-and-keys) covers how they will work.
