# WritersLogic Edit Anchor Check

> WritersLogic Edit Anchor Check 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-19).

Counts and locates all occurrences of a literal string in a file, returning match offsets, line/column positions, and context lines so an agent can safely verify a replace-in-file edit target before applying it.

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/edit-anchor-check?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-edit-anchor-check-b6d5543c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_g7qQoQHGQsZYl_NGhWPsM

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-edit-anchor-check-b6d5543c -d '<json body>'
```

Example prompt: Before you apply the replacement, check how many times the string 'def calculate_total(items):' appears in this file and show me 3 lines of context around each match — I need to confirm it's unambiguous.

## When to prefer this

Use this endpoint when an AI agent is about to issue a replace-in-file or patch operation and needs to confirm that the target string (oldString) exists exactly once in the file. It is specifically designed as a pre-flight check for edit tools, providing richer diagnostic fallbacks (whitespace-tolerant and typographic-folded matching) than a plain string search. Prefer it over generic grep or search tools when you need structured offset/line/column metadata and a clear pass/unknown/fail signal suitable for agent decision-making.

## Known failure modes

- No literal match found — endpoint returns whitespace-tolerant and typographic-folding fallback matches to aid diagnosis
- File exceeds 524,288 bytes or 100,000 lines — request rejected
- oldString is empty — validation error
- Multiple matches found — status is 'unknown' with all match contexts returned; agent must extend the search string
- Overlapping match — status is 'unknown' even if count appears to be one

## How this service works

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

## Output

Returns a status of 'pass' (exactly one match), 'unknown' (multiple or overlapping matches), or 'fail' (no literal match). For each match found: byte offset, line number, column number, and configurable surrounding context lines. On failure, also returns whitespace-tolerant line matches and typographic-quote/dash-folded matches to explain why the literal search failed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "file": {
   "type": "string",
   "maxLength": 524288,
   "description": "File text, at most 524288 UTF-8 bytes and 100000 lines."
  },
  "oldString": {
   "type": "string",
   "maxLength": 65536,
   "minLength": 1
  },
  "contextLines": {
   "type": "integer",
   "maximum": 10,
   "minimum": 0,
   "description": "Lines of context before and after each listed match. Default 2."
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-edit-anchor-check-b6d5543c/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)
