---
description: Check what depends on something before you stop, remove, delete or rename it
argument-hint: <service, port, path or name>
allowed-tools: Bash(curl:*), Bash(jq:*)
---
Check what depends on: $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 before you stop, remove, delete or rename anything: a service, a container, a port, a file, a folder, a config key. It is a dependency check, not a search.

1. Pass the literal thing, not a question: `grounded-api`, `7437`, `/srv/data`, not "what uses the API?". Check each name it goes by, one call per name. Build the body with `jq` and POST it to `/impact`:

```bash
jq -n --arg s '<subject>' '{subject: $s}' |
  curl -s -X POST "${GROUNDED_URL:-http://127.0.0.1:7437}/impact" \
    -H 'content-type: application/json' \
    -H "authorization: Bearer ${GROUNDED_TOKEN:-}" \
    --data-binary @-
```

Optional fields: `limit` (default 20, applied to each source), `sources` (any of `fact`, `session`, `doc`), `project`, `scopes` (doc lanes to read in full).

2. Read the answer:
   - Every row in `.data` is something that mentions the subject: a fact, a session or a doc chunk, each with `typedId` and `citation`.
   - A row with `inScope: false` is a doc in a lane you did not ask for. Its `title` and `snippet` are `null` on purpose; `path`, `citation` and `scope` tell you it exists and where. Add its lane to `scopes` to read it.
   - `meta.available` counts every match, hidden ones included. If `meta.truncated` is true, raise `limit` before you conclude anything.
   - It matches words, not meaning, so it works with embeddings off. A miss on one spelling is not proof: try the other names.
   - For the full record behind a row: `curl -s "${GROUNDED_URL:-http://127.0.0.1:7437}/get/<typedId>" -H "authorization: Bearer ${GROUNDED_TOKEN:-}"`.

3. Report what depends on the subject, each cited by its `typedId` or `citation`, and stop for the user's go-ahead if anything does. Zero rows with `meta.available: 0` means nothing in Grounded mentions it; say that, and that it only covers what Grounded holds.

If a call fails or a field is missing, read `GET /llms.txt` on the same base URL: it is the manual for the running instance.
