---
description: Re-index doc folders in Grounded after you edit them
argument-hint: <absolute folder path> [scope]
allowed-tools: Bash(curl:*), Bash(jq:*)
---
Re-index these docs in Grounded: $ARGUMENTS

Grounded answers over HTTP at `$GROUNDED_URL` (default `http://127.0.0.1:7437`). If `GROUNDED_TOKEN` is set, the API wants `Authorization: Bearer $GROUNDED_TOKEN`; with no token configured the header is ignored.

Run this after docs change on disk, so recall and the brief see the new text. It is safe to repeat: unchanged files are skipped and changed files are replaced.

1. Use absolute folder paths **as the engine sees them**. Grounded reads the files itself, so the path must exist on the machine, or in the container, where Core runs. A Docker engine needs the folder mounted at the same path it has on the host. Only `.md`, `.markdown`, `.mdx` and `.txt` files are indexed.

```bash
jq -n --arg p '<absolute folder path>' --arg s 'global' '{paths: [$p], scope: $s}' |
  curl -s -X POST "${GROUNDED_URL:-http://127.0.0.1:7437}/docs/ingest" \
    -H 'content-type: application/json' \
    -H "authorization: Bearer ${GROUNDED_TOKEN:-}" \
    --data-binary @-
```

`paths` takes several folders at once. Optional fields: `scope` (the doc lane, default `global`), `project`, `source`, `machine`, `dryRun` (true reports what would change and writes nothing).

2. Read the reply:
   - `scanned` is how many files the engine found. **Check `scanned > 0`.** A `scanned: 0` with a 200 is not success: the engine reached a folder but found nothing it indexes. Usually it is looking at a different, empty folder (a Docker engine sees its own filesystem, not yours), or the files are not markdown or text.
   - A 400 with `INGEST_PATH_UNREADABLE` lists the paths the engine cannot see or read at all.
   - `added`, `updated`, `skipped`, `removed` count chunks (sections of files), not files. All skipped means nothing had changed.
   - `frontmatterOverrides` lists files whose own `scope:` or `project:` frontmatter won over the batch tag. Read it if docs land in a lane you didn't expect.

3. Report the counts. If `scanned` is 0, say so plainly and name the path to check; don't report it as done.

Ingest does not notice files you deleted. To clear those, `POST /docs/prune`: it marks rows whose file is gone as missing, or deletes them with `{"remove": true}`. If a call fails, read `GET /llms.txt` on the same base URL.
