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

# Knowledge Patches

> The review queue — changes the agent wants to make to your company context, and the endpoints to apply or dismiss them.

```
GET   /v1/cofounder/knowledge-patches?status=pending&appId=&limit=
POST  /v1/cofounder/knowledge-patches/:id/apply
POST  /v1/cofounder/knowledge-patches/:id/reject
```

See [Knowledge Patches capability](../capabilities/knowledge-patches) for why the agent proposes instead of writing.

## GET

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://api.appeeky.com/v1/cofounder/knowledge-patches?status=pending" \
  -H "X-API-Key: $KEY"
```

```jsonc theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "data": {
    "count": 1,
    "pendingCount": 1,
    "patches": [
      {
        "id": "uuid",
        "appId": null,
        "targetType": "company_profile",
        "targetField": "icp",
        "targetPath": null,
        "targetSection": null,
        "currentValue": "Indie iOS developers",
        "proposedValue": "Indie iOS developers and small studios running 2–5 apps",
        "operation": "replace",
        "rationale": "Three of your last five reviews mention managing multiple apps.",
        "origin": "drift_audit",
        "runId": null,
        "confidence": 0.8,
        "status": "pending",
        "createdAt": "2026-07-27T06:02:00Z"
      }
    ]
  }
}
```

| Param    | Default   | Notes                                                       |
| -------- | --------- | ----------------------------------------------------------- |
| `status` | `pending` | `pending` · `applied` · `rejected` · `superseded` · `stale` |
| `appId`  | —         | Company-wide patches have `appId: null`                     |
| `limit`  | 50        | Max 200                                                     |

`pendingCount` is always the account-wide total regardless of the filter, so a nav badge stays correct whichever tab you're on.

### Field meanings

* **`targetType`** — `company_profile`, `app_profile`, or `document`.
* **`targetField`** — the profile field (`icp`, `doNotTouch`). Null for documents.
* **`targetPath`** / **`targetSection`** — for documents: the file and the heading inside it, so applying is surgery on that section rather than a rewrite.
* **`operation`** — `replace` or `append`. An append adds a line and can't destroy an edit, so it skips the conflict check.
* **`origin`** — `run` · `chat` · `drift_audit` · `fact_promotion` · `document_extraction`.
* **`currentValue`** — captured when the patch was written, so a review UI has a left-hand side. Compare it against the live value before applying blind.

## POST /:id/apply

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.appeeky.com/v1/cofounder/knowledge-patches/$ID/apply" \
  -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"value":"Indie iOS developers and studios running 2–5 apps"}'
```

| Field   | Notes                                                             |
| ------- | ----------------------------------------------------------------- |
| `value` | Apply a reworded version instead of the proposal. The common case |
| `force` | Apply anyway after a 409                                          |

Applying sets the row's `source` to `user` — you decided, so it's yours. Document patches record a revision under your name.

### 409 — the target moved

```jsonc theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "error": {
    "code": "PATCH_STALE",
    "message": "This changed after the suggestion was made. Review the current value before applying.",
    "currentValue": "Solo iOS developers",
    "patch": { /* … */ }
  }
}
```

Nothing was written and the patch stays `pending`. Show `currentValue`, then either drop it or retry with `force: true`.

## POST /:id/reject

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.appeeky.com/v1/cofounder/knowledge-patches/$ID/reject" -H "X-API-Key: $KEY"
```

`{"rejected": true}`. Returns 400 if the patch doesn't exist or was already reviewed. Rejected patches don't come back with the same fingerprint.

## Use cases

* **A review inbox** in your own dashboard, mirroring Settings → Business.
* **Auto-apply high confidence** — e.g. apply `fact_promotion` patches above `0.9` unattended, queue everything else. Consider this carefully for `constraints` and `doNotTouch`: those become blocking rules.
* **Audit what changed your context** by listing `status=applied` and diffing `currentValue` against `appliedValue`.

## Related

* [Company API](./company) — the fields patches target, plus `POST /company/extract` which queues them
* [Documents API](./documents) — document patches land here
