---
title: "Inspect and correct"
description: "Inspect and correct memidex knowledge from the CLI or MCP: list, show, diff and explain records, then accept, reject, forget, roll back or purge them safely."
canonical_url: "https://vostride.com/docs/agent-qa/memory/inspect"
md_url: "https://vostride.com/docs/agent-qa/memory/inspect.md"
last_updated: "2026-10-24T01:12:08+05:30"
---

> [Documentation index](https://vostride.com/docs.md) · [Site index](https://vostride.com/llms.txt)
> Follow the Markdown links to read individual pages; the indexes list the available documentation.

# Inspect and correct

> Inspect and correct memidex knowledge from the CLI or MCP: list, show, diff and explain records, then accept, reject, forget, roll back or purge them safely.

Read knowledge through agent-qa rather than by opening files. Trust, status and validity are worked out when you ask, so a raw `record.md` can be out of date or already superseded.

Every command below takes `--json` and then prints exactly what the matching MCP tool returns. Text output masks secrets the same way.

## Read
| Question | Command | MCP tool |
| --- | --- | --- |
| Which records exist, with their trust? | `agent-qa knowledge bundles` | `agent_qa_list_knowledge_bundles` |
| Records by product, kind, status or anchor | `agent-qa knowledge inspect` | `agent_qa_inspect_knowledge_records` |
| One record and where it came from | `agent-qa knowledge show <recordId>` | `agent_qa_show_knowledge_record` |
| What changed since a run count or build tag | `agent-qa knowledge diff <ref>` | `agent_qa_diff_knowledge_records` |
| Which checks did a record pass? | `agent-qa knowledge gates <recordId>` | `agent_qa_list_knowledge_gates` |
| What did a run use and learn? | `agent-qa runs knowledge <runId>` | `agent_qa_get_run_knowledge` |
| Why did a step's brief say what it said? | `agent-qa knowledge brief-why <runId> --step <n>` | `agent_qa_explain_brief` |
| Find a record from a few words | `agent-qa entities resolve "<words>"` | `agent_qa_get_entity` |

`knowledge inspect` filters with `--product`, `--scope`, `--kind fact|procedure|caution|unknown|policy`, `--status active|candidate|superseded|deprecated`, `--anchor`, `--record`, `--as-of-build <n>` and `--unresolved` (open unknowns only).

`knowledge diff` takes a run count, or a build tag with `--product`. `knowledge brief-why` also takes `--test <testId>` for runs with several tests and `--record <id>` to follow one record.

```text
$ npx agent-qa knowledge bundles
Knowledge bundles (2)

caution-error-timeout-checkout-spinner-never-set-f36fe70ffa80f011
  product: komazon
  kind: caution
  status: candidate
  trust: 0.750
  counters: confirmed=1 contradicted=0 helpful=0 harmful=0
  validity: 2..open
  …
```

## Correct
The best correction is feedback on a run. When a verdict was wrong, [mark it](https://vostride.com/docs/agent-qa/self-improvement/feedback.md), and agent-qa works out which record or test to fix.

To act on one record directly, use these three operations. Each applies at once.

| Operation | What it does |
| --- | --- |
| `knowledge.accept` | Confirms a record as a person, then checks it for promotion again. Accepting a policy record appends the rule to your policies. |
| `knowledge.reject` | Retires a record. A reason is required. |
| `knowledge.forget` | Retires a record and removes it from search, so it stops being found at all. |

There is no CLI command for them. Use the MCP tool `agent_qa_change_knowledge`, ask in [chat](https://vostride.com/docs/agent-qa/guides/chat.md), or call the function directly:

```bash
npx agent-qa fn knowledge.forget --input '{"target":{"grain":"bundle","shortId":"MEM-001"}}'
```

## Roll back a batch
`agent-qa knowledge rollback` undoes everything one curation job did, or a whole campaign, by appending events that cancel the originals. It prints what it will undo, then applies it.

```bash
npx agent-qa knowledge rollback --job <jobId>
npx agent-qa knowledge rollback --from-build 12 --to-build 15 --origin-class agent-verified
```

A campaign can also be narrowed with `--anchor-cluster <key>`. Records it created are retired, and records it superseded come back.

## Purge a record
`agent-qa knowledge purge <record-id>` deletes a record from this machine for good: its folder, its queue entries and its index rows. It leaves a small receipt with no content in `memory/receipts/`, so the removal is visible in review. Purging does not rewrite git history. If the record held something sensitive that was already committed, you also need to rewrite the history; the command prints guidance.

## Maintenance
| Command | What it does |
| --- | --- |
| `agent-qa knowledge rebuild-index` | Rebuilds the search index from the records. Safe at any time. |
| `agent-qa knowledge drain` | Finishes queued curation now, without a model. `--status` only reports what is left. |
| `agent-qa doctor` | Reports the index, the embedding model, the search level and the learning mode. |

These commands need the writer lease. While a [daemon](https://vostride.com/docs/agent-qa/daemon.md) holds it, they refuse or hand the work to the daemon.

## Rules of thumb
- Never edit files under `agent-qa-knowledge/memory/` by hand. A changed file no longer matches its record's hashes, and the record stops being served.
- Commit knowledge like code: read the diff, keep what is right, revert what is not.
- `agent-qa doctor` warns when an old v0.1 `agent-qa-memory/` folder is still around. It is not used and is safe to delete.

## Documentation navigation

- [All documentation](https://vostride.com/docs.md)
- Parent: [memidex](https://vostride.com/docs/agent-qa/memory.md)
- Previous: [How knowledge is learned](https://vostride.com/docs/agent-qa/memory/learning.md)
- Next: [Policies](https://vostride.com/docs/agent-qa/memory/policies.md)
