---
title: "Manually (re-)run memory evolution for an existing context"
method: POST
path: "/api/contexts/{id}/evolve"
tags: ["Contexts"]
---

# Manually (re-)run memory evolution for an existing context

`POST /api/contexts/{id}/evolve`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/contexts/{id}/evolve`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

The create-time hook only fires once; this re-triggers it against current neighbors. Pass `dry_run: true` to preview proposals without writing.

## Path parameters

- `id` integer, required

## Request body

- object
  - `k_neighbors` integer
  - `dry_run` boolean

## Response `200`

Evolution result — `dry_run:true` shapes carry `proposed_links`/`proposed_archives`/`contradictions`; `dry_run:false` shapes carry the applied counts.

- object
  - `context_id` integer
  - `k_neighbors` integer
  - `neighbors_examined` integer
  - `dry_run` boolean
  - `proposed_links` object[]
  - `proposed_archives` object[]
  - `contradictions` object[]
  - `links_created` integer
  - `archived` integer
  - `held_for_review` integer

## Other responses

- `400`: Invalid id or validation failure.
- `401`: Missing or invalid credentials.
- `404`: Resource not found (or not visible to the caller).
- `503`: Memory evolution unavailable (no LLM provider, missing embedding, or feature disabled).

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
