---
title: "Apply operations to the project state"
method: POST
path: "/v1/project/{name}/state/ops"
tags: ["Project Brain"]
---

# Apply operations to the project state

`POST /v1/project/{name}/state/ops`

## Request

- Base URL: `https://api.chainmemory.ai`
- URL: `https://api.chainmemory.ai/v1/project/{name}/state/ops`
- Auth: API key in header `x-api-key`

Client consolidates, chain verifies. You send operations from the 29-op grammar; the server validates invariants, applies them with a deterministic builder, computes the new `state_hash` and persists it. Fee: 0.05 AIC + 0.005 per applied op.

**Evidence is what makes the state trustworthy.** Cite the memories that support each operation with `evidence_memory_ids`; the server resolves them to event hashes and computes a Merkle `evidence_root`. An operation written without evidence gets `evidence_root 0x000...0` — state with no provenance, indistinguishable from the model's own opinion, and the chain will seal it just the same because it verifies hashes, not correctness.

**If any cited memory cannot be resolved, the whole call is rejected with 422** and nothing is written or charged. The usual cause is citing a plaintext memory before it has been anchored: its `event_hash` is computed on sync (~30 s), not on write. Sealed memories carry their hash from the client and are citable immediately.

## Path parameters

- `name` string, required

## Request body

- object
  - `ops` object[], required: 1-100 operations
    - `op` string: Operation type: add_decision, add_milestone, add_risk, set_focus, add_env_host, ...
    - `evidence_memory_ids` integer[]: Memory numbers backing this operation
  - `generated_by` string: Client identifier
  - `consolidated_until_event` integer: Highest memory number included in this consolidation

## Response `200`

No change: every op was rejected, or the resulting hash is identical

## Other responses

- `201`: State updated
- `402`: insufficient_aic
- `422`: evidence_unresolved — cited memories could not be resolved; nothing written, nothing charged

---

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