Diagram of four read-only enforcement layers for a production debugging agent: the agent's tool policy is only its own promise, while the credential scope, the database read-only transaction and the runtime expression guard refuse writes outside the model. The footer records the local fixture run of 9 scripted calls, 4 allowed and 5 refused.

Production Debugging Agents: What “Read-Only” Really Protects

An agent that can look at a production incident is useful. An agent that can also change production is a second incident waiting for a bad day. Most teams resolve that tension by choosing one extreme: hand the agent the same credentials an on-call engineer uses, or keep it out of the incident entirely and go back to kubectl and grep. The direct answer to the middle path is this: “read-only” is not one control, it is four, and they do not fail together. The agent’s tool selection is advisory. The other three — the credential or API scope the call travels over, the database transaction mode, and the runtime guard on evaluated expressions — are enforced somewhere outside the agent’s goodwill. A session is only as safe as the outermost enforced layer, and it is only auditable if the enforcement decision is recorded per call. ...

November 16, 2026 · 13 min · baeseokjae
Conceptual checklist for tool-call repeatability: Fixed request + seed, then Repeated tool calls, then Semantic vs byte match. Compare meaning separately from serialized bytes.

Ollama Tool Calls: Same Seed, Different Bytes

A team re-runs its agent eval after a one-line prompt change and the pass rate moves five points. They revert the prompt; the number does not come back. They blame the harness, then the model vendor, and eventually pin temperature=0 and seed=42 everywhere — and the number still moves. Nobody in that loop can answer the question that comes before all of it: at the sampling settings the harness already uses, is the emitted tool call even the same object twice? ...

November 15, 2026 · 11 min · baeseokjae
Conceptual checklist for memory chunk granularity: a question that needs two facts, the chunk boundaries that separate them, and the retrieved evidence — smaller chunks can split a multi-fact answer. Conceptual diagram, not measurement data.

Agent Memory Chunking: When Smaller Chunks Lose the Answer

An agent memory store is usually built by a chunker that nobody re-examines after the first week. One vector per conversation turn, per note, or per fixed block of text. The store looks healthy, because the questions used to check it are single-fact questions about a short note, and those pass at almost any granularity. Then a user asks a two-part question — “how do access-token and signing-key lifetimes compare?”, “who owns the deploy key and how often does it rotate?” — and the retriever returns one half of the answer with no error at all. The other half is in a different chunk and did not fit in the top-k. ...

November 15, 2026 · 12 min · baeseokjae
Conceptual three-step chain for an agent memory write: 01 Write acknowledged, 02 Store becomes visible, 03 Next read.

Why Your Agent Reads Old Facts After a Memory Update

Turn 18 of a support-agent transcript. The operator says staging moved from db-08 to db-09. The agent calls its memory tool, gets a success response, and answers “noted — staging now points at db-09”. Turn 19, a different question that touches the same fact. The agent answers db-08. Nothing errored. The record store accepted the write, the embedding call was queued behind it, and the vector index had not committed when the next retrieval ran. The acknowledgement the agent trusted (“write succeeded”) came from the source-of-truth store. The capability it depended on (“my next search returns this value”) belongs to the derived index, which acknowledged nothing and was never asked. ...

November 15, 2026 · 11 min · baeseokjae
Three-stage checklist for scoped memory retrieval: 1 Tenant filter, 2 Candidate ranking, 3 Returned top-k. Filtering on the tenant before ranking fills the requested top-k; filtering after a global ranking can only keep whichever of the k rows belong to the caller.

Agent Memory Filters: Why Top-k Returns Too Few Results

A team keeps every user’s or tenant’s memories in one vector collection and enforces isolation in application code. The search returns the nearest neighbours, then a list comprehension keeps the rows that belong to the caller: rows = store.search(query, k=5) rows = [r for r in rows if r["tenant_id"] == caller] That reads as correct. It is also the pattern this page measures, and on a synthetic 12-tenant store it produced two failures that raise nothing and log nothing. The caller received 1.80 of the 5 rows requested, on average, across 168 queries - minimum 1, and 98.2% of queries came back short. In the same fixture, 3.20 of the 5 rows in the unfiltered top-5 belonged to other tenants, which means any code path that assembles the prompt before filtering, or simply loses the filter in a refactor, hands other customers’ facts to the model. ...

November 14, 2026 · 12 min · baeseokjae
Conceptual checklist for similarity cutoffs: Constraint query, then Similarity score, then Threshold decision. Check whether a cutoff hides a required constraint.

Agent Memory Cutoffs Can Hide Constraints: Test Before You Tune

Your memory pipeline ends with a score gate: keep rows at or above 0.7 cosine similarity, drop the rest. You tuned that number on topical questions and it looked fine. Then someone asks “May I deploy to production on Friday?” and the agent retrieves nothing — not the wrong thing, nothing — because the one stored sentence that should have stopped the deploy scored 0.660. That is the measurement in this article, scoped to what was actually run. On a 12-fact synthetic fixture with two local Ollama embedders, the prohibition “Deployment to production on Fridays is prohibited for all teams.” scored 0.660 against “May I deploy to production on Friday?” under all-minilm:latest. The two descriptive facts in the same fixture scored 0.764 and 0.773 for their own questions. A 0.7 gate therefore keeps the descriptions and deletes the rule, and the ordering reverses on the second embedder — the same prohibition scores 0.949 under snowflake-arctic-embed:33m. The safe cutoff is a property of the encoder, not of your application. ...

November 14, 2026 · 11 min · baeseokjae
Conceptual checklist for prompt-prefix reuse: Stable prefix, then First changed line, then Reuse boundary. Inspect changes near the beginning of the prompt.

Ollama Prompt Cache Misses: Check the First Changing Line

Two consecutive turns of a local agent loop can differ by more than an order of magnitude in prefill time while the model, the output length and - within 31 tokens - the prompt size stay nearly the same. On the host used for this article, an append-only second turn prefilled 962 tokens in 2.4711 s. The same second turn, with one line regenerated at the top of the system block, prefilled 993 tokens in 36.8326 s. Nothing errored, nothing was truncated, and no tokens-per-second figure on either turn would have told you which one you were looking at. ...

November 14, 2026 · 13 min · baeseokjae
Bar chart of lost-update writes per 1,000 attempts from this article's own SQLite run: guarded UPSERT 0, client read-modify-write 0 to 1, delete-then-insert replace 365 to 503, read-modify-write without a unique index 0 to 3. Caption notes four processes, 25 keys and a single 2-vCPU host, and that every lost update was a client ordering pattern, not a store fault.

Two Writers, One Memory: What Concurrent Agent Writes Actually Lose (2026)

Your planner and two worker subagents write observations into the same memory table. Nobody sees a problem, because the recall test runs one writer at a time and every assertion passes. Then a decision recorded at step 40 is silently replaced by the version from step 12, the same preference appears three times and occupies the top-k slots that should have surfaced the one fact that mattered, or a worker exits with sqlite3.OperationalError: database is locked and the harness records the write as completed because it never checked. ...

November 12, 2026 · 14 min · baeseokjae
Conceptual checklist for ACP installation checks: Package identifier, then Registry + artifact, then Ordered pre-flight. A generic error token does not identify the failing step.

JetBrains ACP Install Failed? Seven Checks Before Reinstalling

You clicked Install in the AI Assistant agent list, the agent never appeared in AI Chat, and the log shows one line: WARN - #c.i.a.a.r.r.acpagentinstallationstate - Agent installation failed for acp.registry.claude-acp: package_install_failed That line is what a reader pasted into a search engine on 2026-11-06, and it is the entire failure report: a package id, a colon, and a token that says “package install failed”. It does not say which step failed, what the HTTP status was, or whether anything was downloaded at all. ...

November 12, 2026 · 12 min · baeseokjae

Ollama Tool Definitions Are Not Free: The Measured Prompt-Token Cost of Every Tool You Register

You register twelve tools on a local agent, send a six-word message, and prompt_eval_count comes back at 764 instead of 18. Nothing is wrong: the definitions you sent are part of the prompt, and on a 4k default context that registry has already spent 746 of your 4096 tokens before the conversation starts — and it re-pays that cost on every turn. This article measures the cost instead of estimating it. One model, one fixed message, one local server, tool sets of 0, 1, 3, 6 and 12 definitions in a deliberately terse form, and sets of 1, 3 and 6 in a deliberately verbose form, three repeats per cell, with the raw request and response records published next to the script. ...

November 12, 2026 · 11 min · baeseokjae