How SN118 miners' agents are directly improving Ditto

Bittensor Subnet 118 locks every miner to the same 20B model so competition comes from harness engineering. Here are all ten memory, tool-routing, safety, and resilience upgrades we pulled from released champion submissions and merged into Ditto.

By
Ditto Team
Published
November 24, 2026
Read
15 min read
  • engineering
  • bittensor
  • sn118
  • agents
  • memory
  • tools

When we launched DittoBench and open-sourced our agent harness and starter kit, the thesis behind Bittensor Subnet 118 (SN118) was simple: the model is interchangeable; the harness is the product.

Every miner on SN118 runs the exact same locked model (openai/gpt-oss-20b at medium reasoning effort) against freshly generated, judge-free datasets derived from future on-chain block hashes. Nobody wins by swapping in a larger proprietary model or memorizing a fixed test file. Climbing the board requires better harness engineering: sharper memory retrieval, cleaner prompt packing, faster tool scaling, stricter user-intent enforcement, and tighter failure recovery.

Because SN118 publicly releases crowned champion source code after confirmed winner emissions and an embargo window, we can audit what works under real evaluation pressure and pull general-purpose improvements back into Ditto.

Isometric line drawing of a plain locked core block seated inside a precision bench frame with slotted rails, with a single fitted front guide plate highlighted in cyan.

Every miner runs the exact same locked 20B model in the center; the guide rails and harness engineering around it produce the gains.

What DittoBench v18 forced miners to solve

Earlier benchmark versions tested memory recall and tool calling against small tool menus. On November 11, 2026, SN118 activated DittoBench v18, which made the evaluation look much closer to a real Ditto workspace:

  • 1,400 to 2,000 real tools per seed. Forwarding the whole menu takes roughly 100k to 200k tokens, overflowing gpt-oss-20b’s 131,072-token context window. An unmodified classic harness scores 0.000 because the provider refuses every call before generating a token.
  • Hard run budgets. Every 350-case evaluation stops admitting cases at 1.00pricedcost,andthecostfactorpenalizesrunsabove1.00 priced cost, and the cost factor penalizes runs above 0.50. Bloated prompts and wasteful retry loops directly lower composite scores.
  • Multi-call tool encounters. Ten of the fifty full-run tool cases require reading live state, following links or checking alternate views, and acting only after gathering complete evidence.

For comparison, our stock v18 starter-kit hybrid baseline scores 0.263 composite (0.527 tool mean, 0.276 memory mean on seed 42, $0.27 per run). Within days of v18 activation, publicly released SN118 champion harnesses reached 0.657 to 0.729 composite, with tool_mean up to 0.993 and memory_mean up to 0.988, on the exact same 20B model.

Horizontal grouped bar chart comparing four harnesses on openai/gpt-oss-20b across DittoBench v18: unmodified starter kit at 0.000 composite from context overflow, Ditto stock v18 baseline at 0.263 composite (0.527 tool, 0.276 memory), dan0l v59 at 0.657 composite (0.993 tool, 0.960 memory), and beast-d41 v18 at 0.729 composite (0.970 tool, 0.988 memory).

DittoBench v18 scores on openai/gpt-oss-20b (350 cases, 1,400 to 2,000 tools, $1.00 cap). Champion figures are 3-validator quorum medians from the public SN118 API over SHA-256-verified releases.

We audited 41 SHA-256-verified, publicly released champion artifacts across DittoBench v13 through v18, stripped out benchmark-specific formatting tricks, and mapped the surviving patterns line by line against Ditto’s backend. Ten general-purpose upgrades from that audit are now merged into Ditto’s backend across tool execution, tool selection, memory retrieval, prompt packing, user safety controls, and inference and embedding resilience.

1. Mutation-aware tool idempotency and delivery-state tracking

Credited agents: beast-d41 v18 (d6d5c157, UID 222, hotkey 5CBD7DW3...kFyv, v18 composite 0.729, tool 0.970, memory 0.988), dan0l v59 (a06c97e5, UID 149, hotkey 5DveEYvi...7Mtv, v18 composite 0.657, tool 0.993, memory 0.960), and dan0l v41 (557684da, UID 149, v16 composite 0.987, tool 1.000).

Multi-step agents hitting real apps fail in two common ways: the model retries a timed-out write and sends the same email twice, or it burns extra turns repeating the exact same read query unchanged.

In app/tools.py, the dan0l and beast-d41 harnesses wrap every tool execution in a five-state delivery ledger (completed, delivery_unknown, delivered_failed, not_delivered, blocked_before_execution) paired with a monotonic changes counter:

Architecture diagram of the per-turn tool idempotency ledger showing pre-execution checks for memory IDs, duplicate writes, and read caching, followed by five explicit delivery states (not_delivered, delivery_unknown, completed, delivered_failed, blocked_before_execution) and the monotonic changes counter that resets read deduplication after any mutation.

Per-turn execution ledger separating pre-send failures (not_delivered) from post-send uncertainty (delivery_unknown) so timeouts stop automatic retries instead of double-sending.

  • Pre-send and post-send failures stay separate. A connection refusal (not_delivered) is safe to retry. A post-send timeout or 5xx (delivery_unknown) means the write may have already executed, so automatic retries stop and the model receives an explicit unknown-delivery note.
  • Duplicate writes stop by default. If an identical (tool, sorted_args) write already ran or left with unknown delivery, the executor returns a clear note instead of double-firing.
  • Read deduplication resets after any mutation. Identical read calls return a cached note while changes has not moved. Once any mutating tool runs, changes increments and fresh reads execute normally.
  • Hallucinated memory IDs fail fast. If the model passes a synthetic prompt label like M4 to fetch_memories instead of a real pair_id, the harness catches it before querying storage and tells the model which IDs are valid.

Ditto’s backend previously deduplicated search_memories pair IDs and workflow proposal cards, without a unified per-turn idempotency ledger across connected apps and MCP servers. We merged this per-turn delivery ledger into Ditto’s chat tool loop so connected-app writes carry the same protection.

2. Zero-LLM tool catalog pruning with a TF-IDF safe harbor

Credited agents: dan0l v59 (a06c97e5, UID 149, hotkey 5DveEYvi...7Mtv, v18 tool 0.993), beast-d41 v18 (d6d5c157, UID 222, hotkey 5CBD7DW3...kFyv, v18 composite 0.729), and Tessellate v2 (19c596b5, UID 233, hotkey 5Dkc95Bj...kneJ, v17 composite 0.830, tool 0.987).

As Ditto users connect Google Workspace, GitHub, Slack, Linear, and third-party MCP servers, sending every tool schema on every turn eats context, slows time-to-first-token, and hurts tool selection. Ditto switches heavy users to Code Mode past a tool-count threshold, while direct-tool turns previously passed the full enabled tool list.

To handle v18’s 1,400 to 2,000 tool menus without spending latency or budget on an extra routing model call, dan0l v59 (app/finder.py and app/menu.py) builds a SHA-256 LRU-cached inverted TF-IDF index over tool names and descriptions in milliseconds:

Isometric line drawing of a long catalog tray packed with uniform index cards beside a compact three-slot holder where only the front card stands highlighted in cyan.

Most connected tools stay tucked in the catalog tray while a small three-slot safe harbor keeps the strongest cross-app matches within reach even when you omit the app name.

Four-stage pipeline diagram showing a 1,400 to 2,000 tool catalog hashed into a sub-millisecond cached TF-IDF index, narrowed into core tools, top 12 matches for mentioned app families, and a global top-3 TF-IDF safe harbor for indirect requests, achieving 0.993 tool_mean on DittoBench v18.

Zero-LLM tool pruning narrows large workspaces in milliseconds while keeping a global top-3 TF-IDF safe harbor so indirect requests still surface the right tool.

  1. Core and memory tools always stay in the menu.
  2. External app toolkits are inferred automatically from naming prefixes and description framing, hiding apps the message never mentions.
  3. Large mentioned app families cap at their top 12 TF-IDF matches.
  4. A global top-3 TF-IDF safe harbor always keeps the three best-matching tools across the full catalog, so an indirect request like “check my flight itinerary” still surfaces the right tool even when the user omits the app name.

We merged this cached IDF ranker into both Ditto’s direct-tool path and Code Mode’s search_tools, shrinking prompt size and sharpening tool discovery with zero extra model hops.

3. Hub-damped multi-hop memory retrieval, typo repair, and timeline packing

Credited agents: dan0l v59 (a06c97e5, UID 149, v18 memory 0.960), beast-d41 v18 (d6d5c157, UID 222, v18 memory 0.988), dan0l v42 (e6959038, UID 149, v16 composite 0.983), Hades v24 (a0fc00a9, UID 153, hotkey 5DPzFGYV...RwnK, v14 composite 0.973, memory 0.958), and blinkrazor v2 (dc2a8f4f, UID 138, hotkey 5GW478LH...ybsJ, v13 composite 0.791, native C++20 implementation).

When we wrote about Seed Memories v4, we shared a negative result: Personalized PageRank over our subject graph dropped Recall@1 from 0.68 to 0.42–0.54 because well-connected “hub” memories flooded diffusion and buried the exact target.

SN118 miners hit the same hub-flooding wall and built a clean fix (app/memory/retrieval.py and app/packet.py):

Two-band architecture diagram of Ditto's SN118 memory upgrades: corpus-bounded 1-edit Damerau-Levenshtein typo repair ("Margret" to "Margaret"), degree-damped entity-anchor traversal capping broad hubs like "Work" while preserving exact 2-hop paths, and pre-prompt copy collapsing with chronological connected-component ordering.

Hub damping prevents broad topics from crowding out specific facts, 1-edit vocabulary repair rescues mistyped proper nouns, and chronological arc ordering keeps superseding updates in sequence.

  • Typed entity anchors. The index extracts emails (splitting first.last from the local part), structured codes, quoted phrases, multi-word proper names, and corpus-verified capitalized tokens (filtering out ordinary sentence-initial words using each word’s lowercase vs. capitalized document frequency).
  • Degree damping and hop ceilings. Each memory’s score scales down by its entity degree (min(1, HUB_VALUES / len(values))^0.5), every entity type enforces a fanout cap, long notes traverse only exact email/code/quote edges, and each target has a strict hop budget so graph diffusion never drowns out a direct match.
  • Corpus-bounded 1-edit typo repair. Before lexical or anchor lookup, unknown query words check within one Damerau-Levenshtein edit against the user’s own memory vocabulary. A mistyped surname or project code still hits the right record, which Postgres full-text search misses on its own.
  • Duplicate copy collapsing and chronological arc ordering. Before prompt assembly, near-identical saved copies collapse into one record, and identifier-linked memories group into chronological connected components (oldest to newest inside each arc) so Ditto reads revisions in order.

Isometric line drawing of a notched desk rail holding three upright sheets in chronological sequence with only the front sheet highlighted in cyan, beside a small flat stack of two duplicate sheets set aside.

Duplicate notes are set aside off the rail so related memories line up oldest to newest with the latest revision clearly in front.

Both the hub-damped entity-anchor retriever with 1-edit typo repair and the pre-prompt copy-collapsing / chronological arc pass are merged into Ditto’s backend.

4. Advisory multi-step completeness guardrails

Credited agents: beast-d41 v18 (d6d5c157, UID 222, v18 composite 0.729, tool 0.970) and beast-d41 v19 (871a93d4, UID 222, v18 composite 0.707).

In multi-step app workflows, models often search one location (such as inbox messages), get zero hits, and stop or create a duplicate without checking sibling views like drafts or threads. They also answer from an older document that explicitly points to a newer correction URL.

In app/complete.py, beast-d41 adds lightweight, advisory-only checks right before ending a turn:

  • Empty-read sibling fallback. When a read tool on a named app returns zero results while sibling read tools on that same app remain untried, an advisory note asks the model to check the remaining read tool before giving up or creating a duplicate record.
  • Unread named-app check. If the user explicitly asked about two connected apps and the turn only queried one, Ditto nudges the model to check the skipped app before answering.
  • Superseded-link follow-through. When a tool result marks a document superseded or links directly to a correction URL, the harness prompts the model to open that URL before finalizing its answer.

We merged these advisory completeness guardrails into Ditto’s chat loop, including proper failure classification when tool receipts time out or cancel.

5. Evidence-grounded entity alias resolution and transparent attribution

Credited agents: dan0l v59 (a06c97e5, UID 149, v18 memory 0.960), beast-d41 v18 (d6d5c157, UID 222, v18 memory 0.988), crown-v228 v1 (673386d0, UID 22, hotkey 5GNmn5Be...iMh2, v18 composite 0.625, memory 0.964), and lets_640 v1 (f185f7ec, hotkey 5ECg59rv...mR7Z, v13 composite 0.679).

People appear as “Margaret Chen” in one thread, “Maggie” in another, and @mchen in a third. Guessing aliases loosely causes wrong-person collisions, while rewriting stored memories corrupts user data.

We merged a zero-migration alias-resolution layer into Ditto’s retrieval and prompt-assembly pipeline:

  • Deterministic cue extraction at read time. Over already-scoped plaintext records (EncVersion == 0), a lazy sync.Once pass extracts aliases only from explicit naming cues (“goes by”, “known as”, “nicknamed”, “a.k.a.”, middle-nickname quotes, parenthetical alias notes) and anchored @handle ownership statements (<Name>'s handle is @h, @h is <Name>, <Name> posts as @h), never bare co-mentions.
  • Strict collision rejection. Aliases claimed by two distinct canonical names, aliases colliding with another stored person’s name, lowercase-predominant ordinary words, and broadcast handles (@everyone, @here) drop immediately.
  • Bidirectional expansion and transparent nameTies. When alias resolution runs, queries expand in both directions (Canonical <-> Alias / @handle) inside the hub-damped entity graph and up to two bounded scoped Postgres full-text passes under the same user and space boundary. Prompt seedMemories attach optional non-persisted nameTies (display: "Full Name (alias)", evidencePairID) and seat alias-only notes right next to their canonical block without mutating stored text.

6. Per-turn quote-masked user tool-revocation gate

Credited agents: Hades v25 (30fa08cf, UID 153, hotkey 5DPzFGYV...RwnK, v15 composite 0.963, tool 0.987), Hades v24 (a0fc00a9, UID 153, v14 composite 0.973, tool 0.990), and lets_640 v1 (f185f7ec, hotkey 5ECg59rv...mR7Z, v13 composite 0.679).

Ask an assistant to “answer from my notes, do not search the web” or “draft the message, do not send it,” and fast-routed or smaller models still invoke the forbidden tool more often than users expect.

We merged a deterministic, zero-LLM per-turn revocation gate into Ditto’s tool dispatcher:

Four-card architecture diagram summarizing Ditto's second wave of SN118 upgrades: quote-masked per-turn tool revocation enforcing dispatch and Code Mode HTTP egress, zero-migration evidence-grounded alias resolution with transparent nameTies, LLM timeout max_tokens shrinking and RFC 8259 JSON argument validation paired with O(log N) embedding batch bisection, and per-turn write-through memory visibility with structural count/list coverage expansion.

The second wave of merged SN118 patterns hardens execution boundaries, transport resilience, embedding reliability, and same-turn memory freshness.

  • Zero-allocation fast path. Ordinary turns without negative or exclusivity cues return immediately with zero heap allocations and zero dispatch overhead.
  • Quote, code, and forwarded-text masking. Fenced code blocks, inline code, straight and curly quotes, > blockquotes, and forwarded-message dividers get masked before parsing so a quoted email body or a title like “Don’t Search Me” cannot accidentally revoke search, while bare tool-name operands like don't call `search_web` still match.
  • Fail-open phrasing guardrails. Conditional or interrogative phrasing (“if X, don’t send”, “don’t search unless…”), outage reports (“I can’t access Slack today”), negated prohibitions (“don’t block Slack”), and style instructions (“don’t send me a wall of text”) fail open so legitimate tools stay usable.
  • Dispatch, egress, and completeness enforcement. On attempted tool calls, lazy compiled rules enforce category revocations (web search, outbound send/post, external connectors, memory/notes, code execution, memory-only mode, all tools), app-scoped revocations, and exact tool names across direct, Google, MCP, Composio, and Code Mode tools. Inside Code Mode run_code, outbound revocations block mutating HTTP methods (POST, PUT, PATCH, DELETE) globally or per revoked app host while keeping read-only GET, HEAD, and OPTIONS calls intact. Blocked calls log as blocked in the tool ledger without incrementing changes, return a clear non-fatal notice, and tell completeness guardrails never to nudge toward a user-revoked tool.

7. Inference and embedding transport self-healing

Credited agents: dan0l v59 (a06c97e5, UID 149, v18 tool 0.993, memory 0.960), beast-d41 v18 (d6d5c157, UID 222, v18 composite 0.729, memory 0.988), and DrPresident v23 (8474358a, UID 175, hotkey 5E7VQE3H...8BQE, v14 composite 0.964, tool 0.987, memory 0.948).

Running 350 concurrent evaluation cases under a hard dollar cap exposed every fragile edge in model and embedding HTTP plumbing. We merged two paired reliability upgrades from those harnesses into Ditto’s backend:

  • Timeout-adaptive max_tokens shrink and HTTP pool recovery. When an upstream reasoning call times out or stalls before visible output, retry attempts shrink max_tokens (× 0.4, floor 1200, never raising a lower caller cap) and clamp nested reasoning or thinking token budgets below the shrunk cap. The transport layer parses Retry-After headers capped to the request deadline, separates sub-5-second quick transient drops from stalled-timeout retries, and calls CloseIdleConnections() after 3 consecutive transport errors to clear wedged pools.
  • Pre-dispatch RFC 8259 JSON/NaN validation and schema-rejection recovery. Before any tool runs, Ditto validates that arguments form a single strict JSON object with no truncated bytes or bare NaN/Infinity tokens outside strings, recording malformed calls as not_delivered/blocked without incrementing changes. On OpenRouter tool_use_failed 400/422 rejections, the loop gives the model up to two bounded self-correction attempts instead of aborting the user’s turn.
  • Embedding batch-split fallback and finite-norm guard. Vertex AI and OpenAI embedding responses now validate exact batch counts, expected dimensionality (768 or 1536), and finite non-zero norms computed in float64 (avoiding float32 overflow/underflow) while preserving accurate billing settlement. Healthy batches still run in a single RPC (Splits == 0); if a batch hits a payload error, mismatched count, or poisoned vector, EmbedBatchWithFallback isolates the bad record in O(log N) binary-bisection calls without amplifying rate limits (ResourceExhausted), auth failures, or upstream outages across memory, knowledge-graph, Passport import, and workflow embedding paths.

8. In-turn write-through memory visibility and count/list retrieval coverage

Credited agents: beast-d41 v18 (d6d5c157, UID 222, v18 composite 0.729, memory 0.988) and dan0l v59 (a06c97e5, UID 149, v18 memory 0.960).

Two subtle memory gaps show up in multi-step turns and enumeration questions: saving a new memory and searching for it seconds later in the same turn can miss because async embedding has not finished yet, and asking “how many projects…” or “list every trip…” can undercount when seed retrieval stops at a tight default cap.

We merged both fixes from beast-d41 and dan0l into Ditto’s backend:

  • Per-turn write-through memory overlay. A concurrency-safe turnMemoryOverlay strictly partitioned by storage owner and space/knowledge-graph ID observes completed save_memory, update_memory, and delete_memory calls inside the active turn (ignoring failed calls, pending approval proposals, and no-op duplicates). Subsequent search_memories and fetch_memories calls in that same turn merge matching fresh writes immediately, with the latest in-turn update overriding stale database copies and structured metadata filters enforced fail-closed.
  • Structural count and list coverage expansion. Explicit count or enumeration queries widen seed retrieval up to 8 roots while keeping roots beyond the top 2 compact title-only so prompt token cost stays bounded, expand bounded entity-graph coverage checks (default cap 24, hard cap 48), widen default search_memories per-query limits from 5 to 12, and attach a coverageNote when matches saturate the seed cap so Ditto knows to follow up with search_memories or aggregate_memories.

Keeping the product bar higher than the benchmark bar

Not everything that scores high on a benchmark belongs in Ditto. Our audit excluded benchmark-specific slot formatters, static 140-app prefix dictionaries, narrow domain regex views, and synchronous job-polling loops (which would conflict with Ditto’s asynchronous Tasks UI for long-running Ditto Code jobs).

We also limited this audit strictly to publicly released, SHA-256-verified champion artifacts. Newer v18 frontrunners (including wren-mem v42/v43, Hades v51, and bujhmml v7) remain inside SN118’s king-only or post-emission embargo window, so their code is not part of this post. As new champions clear embargo and publish, we will keep auditing them the same way.

That is the flywheel SN118 was built to run: independent engineers stress-testing memory, retrieval, safety gates, and tool orchestration against a locked 20B model every day, feeding the ideas that generalize straight back into Ditto.

Open a thread.

Ditto remembers what matters from every conversation, so your next idea starts where your last one left off.

Get 20% off your first month of Ditto, and get more out of it every week.