# WritersLogic Conversation Prune

> WritersLogic Conversation Prune is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-22).

Selects which messages to drop from a conversation to reach a token target, respecting cached prefixes, pinned messages, tool call/result pairing integrity, and recency guards.

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/conversation-prune?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-conversation-prune-464cfcc4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5y-eww6Z-kYAtsvzDqOU9

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability writerslogic-conversation-prune-464cfcc4 -d '<json body>'
```

Example prompt: My conversation has 120 messages and I need to get under 8000 tokens — prune it oldest-first, keep the last 4 messages, treat messages 0–30 as a cached prefix (cacheBreakpoint=30), and never drop pinned ones or break up tool call/result pairs.

## When to prefer this

Use this endpoint when you need deterministic, rule-based message eviction for LLM context window management and want strict guarantees: tool call/result pairs stay together, the provider's cached prefix is never touched, pinned messages are never evicted, and the most recent N messages are always kept. Prefer this over summarization-based approaches when byte-identical cache preservation is critical (e.g. Anthropic or OpenAI prompt caching). It is a pure selection oracle — it tells you what to drop without modifying or rewriting anything.

## Known failure modes

- Content exceeds 400000 character limit across all messages — returns 400
- More than 500 messages in the array — returns 400
- Unsupported tokenizer name when messages lack caller-supplied token counts — returns status 'unsupported' for affected items
- targetTokens already satisfied with no drops needed — returns empty drop list
- cacheBreakpoint out of range (> 499 or < -1) — returns 400
- Orphaned tool_result without matching tool_call — may be treated as undroppable or cause validation error
- Payment not provided or invalid x402 header — returns 402

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

Returns the set of message IDs selected for removal (whole tool_call+tool_result pairs counted together, plus individually droppable text messages), a digest of the cache prefix so the caller can verify byte-identity on future calls, and the projected token count after the proposed drops. No messages are actually deleted — the caller performs the deletion.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "messages": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "role"
    ],
    "properties": {
     "id": {
      "type": "string",
      "maxLength": 100
     },
     "kind": {
      "enum": [
       "text",
       "tool_call",
       "tool_result"
      ],
      "type": "string",
      "description": "tool_call: assistant message holding a tool call; tool_result: its output. Pairs are matched by toolCallId. Default text."
     },
     "role": {
      "type": "string",
      "maxLength": 32,
      "minLength": 1,
      "description": "user, assistant, tool, system, ..."
     },
     "pinned": {
      "type": "boolean",
      "description": "Never dropped."
     },
     "tokens": {
      "type": "integer",
      "maximum": 100000000,
      "minimum": 0,
      "description": "Caller-supplied token count; always accepted."
     },
     "content": {
      "type": "string",
      "maxLength": 100000,
      "description": "Message text, used only to count tokens when tokens is absent."
     },
     "droppable": {
      "type": "boolean",
      "description": "A text message that may be dropped (tool pairs are droppable by default)."
     },
     "toolCallId": {
      "type": "string",
      "maxLength": 200,
      "description": "Pairs a tool_call with its tool_result."
     }
    },
    "additionalProperties": false
   },
   "maxItems": 500,
   "minItems": 1,
   "description": "Up to 500; 400000 characters of content in total."
  },
  "strategy": {
   "enum": [
    "oldest-first",
    "largest-first"
   ],
   "type": "string",
   "description": "Order in which droppable units are removed. Default oldest-first."
  },
  "tokenizer": {
   "type": "string",
   "maxLength": 64,
   "description": "o200k_base or cl100k_base. Any other name (including Claude models) returns status unsupported for items that need counting; caller token counts are always accepted."
  },
  "keepRecent": {
   "type": "integer",
   "maximum": 100,
   "minimum": 0,
   "description": "Most recent messages that are never dropped. Default 4."
  },
  "targetTokens": {
   "type": "integer",
   "maximum": 100000000,
   "minimum": 0,
   "description": "Total tokens to get at or under."
  },
  "cacheBreakpoint": {
   "type": "integer",
   "maximum": 499,
   "minimum": -1,
   "description": "Index of the last message inside the cached prefix; -1 when nothing is cached."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-conversation-prune-464cfcc4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
