> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oktolabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Backfill and dedup

> Populate the Knowledge Graph from existing artifacts and deduplicate entities.

# Backfill and dedup

You can backfill the KG when a board already has specs, sprints, or cards but graph context is incomplete. You can deduplicate when entity nodes have drifted into near-copies.

## When to backfill

Backfill is useful after enabling KG on an existing board, recovering from an interrupted consolidation run, or migrating data from an older runtime.

## Dry run

```bash theme={null}
okto-pulse kg backfill <board_id>
```

```text theme={null}
Dry run: found artifacts eligible for KG backfill.
```

## Apply

```bash theme={null}
okto-pulse kg backfill <board_id> --apply
```

```text theme={null}
Queued and drained KG backfill work.
```

## Filter by artifact type

```bash theme={null}
okto-pulse kg backfill <board_id> --artifact-type spec --apply
```

## Dedup entities

```bash theme={null}
okto-pulse kg dedup-entities <board_id> --dry-run
```

```text theme={null}
Found candidate duplicate Entity nodes.
```

## JSON output for automation

```bash theme={null}
okto-pulse kg backfill <board_id> --json
```

<Warning>
  Do not delete `graph.lbug` files to force backfill. Delete only as part of an explicit restore or destructive reset procedure.
</Warning>

## Related pages

* [CLI reference](/reference/cli)
* [KG health](/kg-operations/health)
* [Upgrade](/operations/upgrade)
