{"uid":"cap_g7qQoQHGQsZYl_NGhWPsM","slug":"writerslogic-edit-anchor-check-b6d5543c","name":"WritersLogic Edit Anchor Check","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/edit-anchor-check?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_VDDqhiDL5fToI5qDsIDoE","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Pre-edit uniqueness check for code patch","prompt":"I'm about to replace the function signature 'public void processOrder(Order order)' in this Java file. Can you verify it appears exactly once and show me the surrounding 2 lines so I know the edit target is unambiguous?"},{"title":"Debugging a failed string replacement","prompt":"My replace-in-file tool said it couldn't find 'const API_URL = \"https://api.example.com\"' in this config file — can you check if maybe there's a whitespace or quote difference causing the mismatch and tell me what it actually looks like?"},{"title":"Locating overlapping pattern occurrences","prompt":"Check how many times the string 'end end' appears in this Ruby file and give me the offset and line number for each match — I need to know if the pattern overlaps itself before I decide how to extend my search string."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:37:33.180Z","isFirstParty":false,"canonicalSlug":"writerslogic-edit-anchor-check-b6d5543c"}