Claude Opus 5.5 (effort default (no --effort flag) · thinking on) on Make a TCP key-value server follow its wire protocol (pipelining, split reads, binary payloads, expiry, close rules)
AClaude Opus 5.5default · thinking on · Claude Code 2.1.299 (headless -p) · cloud · 2026-10-17 · by @bobsiopener
- Estimated cost
- $0.30
- Wall time
- 43m
- Human step-ins
- 0
- Outcome
- Pass
Compare with other models on this task →
Summary
Exact prompt
# Task: make the MKV server follow its protocol `server.py` implements the key-value protocol in `PROTOCOL.md`, but it only works when every command arrives in its own TCP packet and only one client connects at a time. Rewrite/fix `server.py` so it implements PROTOCOL.md exactly: pipelining, arbitrarily split/merged reads, binary payloads (including `\r\n` inside), concurrent clients sharing the store, expiry, all error replies and the connection-closing rules. A misbehaving client must never crash the server or affect other clients. Python standard library only (threads, selectors or asyncio are all fine). Keep the command line (`python3 server.py [port]`, env `F03_PORT`, default 18601, bind 127.0.0.1). No network beyond localhost.
The starting server assumes one command per recv and one client at a time; a correct fix needs a per-connection buffer, length-prefixed payload framing that tolerates CRLF inside payloads, per-client threads with a shared locked store, lazy expiry and exact error/close semantics. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).
Success criteria: 1. basic_commands: PING/SET/GET/DEL/INCR exact replies incl. empty payload, case-insensitive commands, case-sensitive keys, negative INCR. 2. error_replies: unknown command, wrong args, bad length and non-integer INCR give the exact errors and keep the connection open. 3. pipelining: 601 pipelined commands in one write get 601 in-order replies. 4. split_reads_binary: a SET with a payload containing CRLF/NUL/0xFF sent one byte at a time round-trips exactly. 5. concurrent_clients: a client stalled mid-payload does not block others; 20 clients x 50 INCR on one key gives 1000. 6. expiry: EXPIRE semantics incl. fractional seconds, :0 for missing keys, SET clearing expiry. 7. connection_closing_rules: line too long, bad payload terminator, payload > 1 MiB and QUIT each send the right reply and close the connection. 8. survives_bad_clients: after junk bytes and clients disconnecting mid-command, the server still answers PING.
Setup notes: Use Case Scout batch 6 case f03-kv-protocol-server (offline fixture). Prepared with batch6/prepare.sh; hidden key/tests kept outside the agent's work dir. Prompt = TASK.md verbatim. Scored with the scout's scorer: `python score.py WORKDIR KEYDIR`. Tools: Read/Write/Edit/Glob/Grep/Bash, web disabled. Single run, no retries. 1-min load average at scoring: 1.38. Claude Code's own reported cost for claude-opus-5.5: $0.301702. Score: 8/8 checks. Cost is an ESTIMATE: measured tokens x pricing.json list price (Claude Pro subscription, nothing billed); input_tokens include cache reads and writes. Single run.
Estimated cost List-price estimate; not actually billed.
Metrics
- Estimated cost
- $0.30
- Wall time
- 43m
- Human step-ins
- 0
- Turns
- 8
| Model | Input tok | Output tok | Cost |
|---|---|---|---|
| AClaude Opus 5.5anthropic/claude-opus-5.5effort default (no --effort flag) · thinking on | 162,210 | 8,264 | $0.30 |
Reproduce this run
- Use the use case prompt on the use case page.
- Same setup: Claude Opus 5.5 (anthropic/claude-opus-5.5, effort default (no --effort flag) · thinking on) via
Claude Code 2.1.299 (headless -p), cloud. - It counts as a success only if it meets every success criterion: 1. basic_commands: PING/SET/GET/DEL/INCR exact replies incl. empty payload, case-insensitive commands, case-sensitive keys, negative INCR. 2. error_replies: unknown command, wrong args, bad length and non-integer INCR give the exact errors and keep the connection open. 3. pipelining: 601 pipelined commands in one write get 601 in-order replies. 4. split_reads_binary: a SET with a payload containing CRLF/NUL/0xFF sent one byte at a time round-trips exactly. 5. concurrent_clients: a client stalled mid-payload does not block others; 20 clients x 50 INCR on one key gives 1000. 6. expiry: EXPIRE semantics incl. fractional seconds, :0 for missing keys, SET clearing expiry. 7. connection_closing_rules: line too long, bad payload terminator, payload > 1 MiB and QUIT each send the right reply and close the connection. 8. survives_bad_clients: after junk bytes and clients disconnecting mid-command, the server still answers PING.
- Log model, tokens, wall time, human step-ins and the evidence log, then submit it as a reproduction. A different model? Submit a head-to-head rerun.
How runs are scored: Methodology.
Was this useful?
Automated checks
Trust 80% comes from these checks (how Trust % works).
- Run date is not in the future : passed
- Model is in the dated pricing table : passed
- Cost recomputed from tokens matches : passed
- Cached tokens are consistent : passed
- Output throughput is plausible : passed
- Autonomy matches step-ins : passed
- Step-ins do not exceed turns : passed
- Retries agree with first-try result : passed
- Evidence log SHA-256 matches : passed
- Evidence log is substantial : passed
Evidence log
[
{
"duration_api_ms": 275213,
"stop_reason": "end_turn",
"session_id": "[REDACTED]",
"total_cost_usd": 0.30170240000000004,
"usage": {
"input_tokens": 14,
"cache_creation_input_tokens": 13324,
"cache_read_input_tokens": 148872,
"output_tokens": 8264,
"output_tokens_details": {
"thinking_tokens": 1801
},
"server_tool_use": {
"web_search_requests": 0,
"web_fetch_requests": 0
},
"service_tier": "standard",
"cache_creation": {
"ephemeral_1h_input_tokens": 13324,
"ephemeral_5m_input_tokens": 0
},
"inference_geo": "global",
"iterations": [
{
"input_tokens": 2,
"output_tokens": 1017,
"cache_read_input_tokens": 27213,
"cache_creation_input_tokens": 425,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 425
},
"type": "message"
}
],
"speed": "standard",
"fallback_credit": null
},
"modelUsage": {
"claude-opus-5-5": {
"inputTokens": 14,
"outputTokens": 8264,
"cacheReadInputTokens": 148872,
"cacheCreationInputTokens": 13324,
"webSearchRequests": 0,
"costUSD": 0.30170240000000004,
"contextWindow": 1000000,
"maxOutputTokens": 128000,
"thinkingTokens": 1801,
"canonicalModel": "claude-opus-5-5",
"provider": "firstParty",
"costBasis": "list"
}
},
"permission_denials": [],
"terminal_reason": "completed",
"fast_mode_state": "off",
"fast_mode_disabled_reason": "sdk_opt_in_required",
"subagent_stats": {
"spawned": 0,
"requested": {
"background": 0,
"foreground": 0,
"unset": 0
},
"started_in_background": 0,
"max_depth": 0,
"spawned_by_subagents": 0,
"completed": 0,
"failed": 0,
"killed": {
"parent": 0,
"user": 0,
"system": 0
},
"refused": {
"depth_limit": 0,
"concurrency_limit": 0,
"budget": 0
},
"by_type": {}
},
"safety_stops": 0,
"is_error": false,
"num_turns": 8,
"subtype": "success",
"api_error_status": null,
"result": "I rewrote `server.py` to follow `PROTOCOL.md`, and all 12 groups of tests in my local script pass against it. The command line is unchanged: `python3 server.py [port]`, `F03_PORT`, default 18601, bound to 127.0.0.1. It uses only the standard library.\n\n**How it works**\n- **Concurrent clients:** each client gets its own thread, and they all share one store behind a single lock.\n- **Pipelining and split/merged reads:** each connection keeps its own input buffer and handles every complete command in it, so commands can arrive one byte at a time or many in one packet. Replies to a batch go out together, in order.\n- **SET:** the server reads exactly `<len>` raw bytes, so a payload containing `\\r\\n` is stored correctly. If the two bytes after the payload aren't `\\r\\n`, it replies `-ERR bad payload`, stores nothing and closes. A bad SET line gets its error as soon as the line arrives, without reading a payload.\n- **Expiry:** expired keys are removed when they're looked up, and a background sweep clears the rest every second. Every command treats expired keys as missing, and SET clears any expiry.\n- **Long lines:** a line of exactly 1024 bytes is accepted even if its `\\r` and `\\n` arrive separately. Anything longer, including 5000 bytes with no line ending, gets `-ERR line too long` and the connection closes.\n- **Closing:** after QUIT or a fatal error, anything else the client pipelined is ignored. The server finishes sending its reply before closing, so a client that has sent more data still receives the error or `+BYE`. Otherwise the reply can be lost.\n- **Isolation:** errors in one connection only close that connection. A client stalled halfway through a command doesn't block anyone else, and the accept loop keeps running if a connection can't be accepted.\n\n**Choices where the spec doesn't say**\n- **Spaces:** extra spaces between words are tolerated rather than rejected.\n- **Empty line:** gets `-ERR unknown command`.\n- **Arguments:** `PING` or `QUIT` with arguments, and `DEL` with no keys, get `-ERR wrong args`.\n- **EXPIRE:** a seconds value that isn't a finite number gets `-ERR wrong args`. Zero or a negative value makes the key expire immediately, and the reply is still `:1`.\n- **INCR:** it keeps a key's existing expiry, since the spec only says SET clears it.\n\n**What I tested**\n- Byte-at-a-time pipelining and binary payloads containing `\\r\\n`.\n- Every error reply, and which errors close the connection.\n- The 1024-byte line and 1 MiB payload limits.\n- Expiry across GET, DEL, INCR and EXPIRE.\n- 20 clients sending 10,000 INCRs in total, with the final count correct, while another client sat stalled mid-command.\n\nThe test script is at `/tmp/f03test/t.py`, outside the work directory.",
"ttft_ms": 2566,
"type": "result",
"duration_ms": 293050,
"uuid": "[REDACTED]",
"ttft_stream_ms": 1593,
"time_to_request_ms": 220,
"first_content_frame_ms": 1594,
"queued_turn_count": 0,
"result_index": 0
}
]