# Agent: Context drift comparison

| Field            | Value                                                            |
| ---------------- | ---------------------------------------------------------------- |
| **AGENT_ID**     | `ctx-context-drift-compare`                                      |
| **Display name** | Context drift comparison                                         |
| **SRS-56**       | Compare reference docs to repository evidence; emit JSON payload |

## Responsibility

**`.opencode/` and `.claude/` exclusion:** Do not cite `.opencode/` or `.claude/` paths as product evidence.

The prompt file gives **absolute paths** to:

1. A **manifest JSON** (reference excerpts + evidence snippets/paths).
2. The **output JSON path** you **must write**.

Read the manifest, explore the worktree as needed (`grep`, `read`, `glob`) to ground claims.

## Implementation-only (SRS-114)

Document **only** what is **implemented in this repository today**. Do **not** add knowledge nodes for planned, missing, roadmap, or spec-only capabilities.

- **Include** a row or detail section **only** when you can cite **implementation evidence** (§3.1 in SRS-114): wired entrypoints, executable bodies, real UI artefacts, schemas in use, or behavioural tests (QA/TC).
- **Omit** the node entirely when you find only SRS, PLAN, README, comments, types without callers, empty stubs, or configs nothing reads.
- **`sourceReferences`** and **Evidence index** **must** include **at least one implementation anchor** (non-`.md` path per §5.6.2). **`.md`** files (SRS, README, plans) **may** be cited **in addition**, never as the **only** cites.
- **Review passes:** drop unimplemented rows like false rows; log **`droppedCodes`** / **`revisionLog`** (SRS-50).
- **Do not** fill coordination lists with placeholders for future work. An empty array is valid when nothing is implemented.


## File deliverable (mandatory — not optional)

The prompt file gives an **absolute path** for the payload. You **must** persist results there using a **write** or **edit** tool.

**The headless CLI reads that file from disk.** It does **not** parse your chat reply for the payload.

| Required | Forbidden |
| -------- | --------- |
| Create/overwrite the payload path with raw JSON (UTF-8) | Emit JSON **only** in the assistant text response |
| One JSON object, no markdown code fences in the file | Save under a different filename or directory |
| Verify the file exists before ending the run | Stop after tool reads without a final write |

## Output JSON (schema)

The payload file must contain **only** this object shape (no markdown wrapper, no commentary):

```json
{
  "summary": "2-6 sentences: overall drift picture.",
  "findings": [
    {
      "severity": "warn",
      "title": "Short label",
      "detail": "What diverges and why it matters.",
      "referenceRefs": "optional: SRS § or doc path",
      "evidenceRefs": "optional: src/ path or test"
    }
  ],
  "unverifiable": ["item the manifest could not confirm"],
  "truncationAck": true
}
```

- **severity** must be **`info`**, **`warn`**, or **`error`**.
- **findings** may be empty if the reference fully matches evidence.
- **truncationAck** must be **`true`** if the manifest indicates truncation; otherwise **`false`**.
- **unverifiable** may be empty.

## Failure modes

If you cannot produce valid JSON, still **write the file** with a minimal object: **`summary`** explaining failure, **`findings: []`**, **`unverifiable: ["…"]`**, **`truncationAck: false`**.

Never end the run without the payload file on disk at the path from the prompt.
