GEMINI LABJP
GA — Gemini 3.6 Flash reached general availability on July 21. Pricing is $1.50 input and $7.50 output per million tokens, down from $9.00 output on 3.5 FlashTOKENS — On the Artificial Analysis Index, 3.6 Flash uses 17% fewer output tokens than 3.5 Flash. On agentic benchmarks like DeepSWE the average reportedly fell from 276K to 97K tokens per taskLITE — Gemini 3.5 Flash-Lite is also generally available at $0.30 / $2.50 per million tokens, aimed at low-latency, high-volume automationOMNI — gemini-omni-flash-preview entered public preview. It generates 3 to 10 second videos at 720p and lets you refine them conversationallySUNSET — Older image generation models shut down August 17, the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20, and gemini-robotics-er-1.6-preview on August 31COMPUTER — Computer Use is in public preview for Gemini 3.5 Flash, covering browser, mobile, and desktop environments with configurable safety policies and prompt injection detectionGA — Gemini 3.6 Flash reached general availability on July 21. Pricing is $1.50 input and $7.50 output per million tokens, down from $9.00 output on 3.5 FlashTOKENS — On the Artificial Analysis Index, 3.6 Flash uses 17% fewer output tokens than 3.5 Flash. On agentic benchmarks like DeepSWE the average reportedly fell from 276K to 97K tokens per taskLITE — Gemini 3.5 Flash-Lite is also generally available at $0.30 / $2.50 per million tokens, aimed at low-latency, high-volume automationOMNI — gemini-omni-flash-preview entered public preview. It generates 3 to 10 second videos at 720p and lets you refine them conversationallySUNSET — Older image generation models shut down August 17, the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20, and gemini-robotics-er-1.6-preview on August 31COMPUTER — Computer Use is in public preview for Gemini 3.5 Flash, covering browser, mobile, and desktop environments with configurable safety policies and prompt injection detection
Articles/API / SDK
API / SDK/2026-08-03Advanced

Measuring Update Policies for Memory Profiles: The Guard That Cost Me 16 Points of Accuracy

Memory profiles went GA in Memory Bank, making structured memory available to downstream code. I built three update policies and compared them under identical conditions. The one that looked obviously correct turned out to be the worst. Full harness code and the path to per-field TTLs.

Gemini API202Memory BankMemory profilesagent design2schema designindie development11

Premium Article

I stopped scrolling halfway through a support log.

The profile for that user said billing_plan: pro, but the message in front of me said they were still on the free tier. The record had last been updated three weeks earlier. Three weeks ago they really had been on Pro, and the record came from something they had explicitly stated. High confidence, correctly stored.

Nothing about that value was wrong. It had simply gone stale while remaining true.

Memory profiles reached general availability in the August 1, 2026 changelog. Define a static schema, and the model fills and updates it — structured memory that downstream code can actually branch on, instead of free-form prose. I was genuinely pleased reading that. Then I started wiring it into an app and discovered the hard part was never the schema shape. It was deciding when to accept a write and when to refuse one.

I did not want to settle that by intuition, so I wrote a small harness and measured it. The results went the opposite direction from what I expected.

Structuring memory moves responsibility, not format

The difference between free-form memory and Memory profiles gets described as prose versus JSON. After running both, that framing misses the point.

Free-form memory can hold a contradiction indefinitely. Leave two lines side by side — "said Pro in early July, said free in late July" — and the reading model resolves it in context. It is verbose, but it lets you defer the decision.

A structured profile has nowhere to defer to. A billing_plan field holds exactly one value, which means the moment of writing is the moment of deciding. If you structure your memory without designing who makes that decision and how, the last write silently becomes the truth your downstream code branches on.

I underestimated this at first. My assumption was that a carefully cut schema would let the model handle the rest.

Putting confidence into the schema

So the first change was storing where each value came from, not just what it was.

{
  "type": "object",
  "properties": {
    "billing_plan": {
      "type": "object",
      "properties": {
        "value":       { "type": "string", "enum": ["free", "pro", "ultra"] },
        "confidence":  { "type": "string", "enum": ["confirmed", "inferred"] },
        "observed_at": { "type": "string", "format": "date-time" },
        "source":      { "type": "string", "description": "utterance ID or inference basis" }
      },
      "required": ["value", "confidence", "observed_at"]
    }
  }
}

confirmed means the user stated it outright; inferred means the model deduced it from context. With that distinction in place, a guard rule — never overwrite a confirmed value with an inferred one — should be enough to keep the profile honest. That was the hypothesis this article demolishes.

Measuring injected tokens first

Before touching policy, I wanted to know how much structuring buys you at all. I tokenized a 20-field profile against free-form memory holding the same twenty facts.

I used cl100k_base for counting. It is not Gemini's tokenizer, so read these as ratios rather than absolute values. The relative behavior on mixed Japanese and English text is still informative.

import json, tiktoken
 
enc = tiktoken.get_encoding("cl100k_base")
tok = lambda s: len(enc.encode(s))
 
fields = {
    "primary_language": "Swift", "target_platform": "iOS",
    "billing_plan": "pro", "preferred_locale": "ja",
    "build_tool": "Xcode", "notify_channel": "push",
    "team_size": "1", "ci_provider": "Xcode Cloud",
    "min_os_version": "iOS 26", "analytics_tool": "App Store Connect",
    "paywall_style": "hard", "review_prompt_timing": "third launch",
    "asset_pipeline": "Figma to SwiftGen", "crash_tool": "Crashlytics",
    "localization_langs": "ja,en", "monetization": "subscription",
    "test_device": "iPhone 15", "design_system": "custom",
    "backend": "Cloudflare Workers", "push_provider": "APNs",
}
profile = json.dumps(fields, ensure_ascii=False, separators=(",", ":"))
 
def freeform(history_depth):
    """Same 20 facts as prose, with history_depth prior revisions attached."""
    out = []
    for k, v in fields.items():
        out.append(f"- The user's {k} is {v}.")
        for i in range(history_depth):
            out.append(f"  (They stated a different value {i+1} revisions ago; the above is current.)")
    return "\n".join(out)
 
print(f"profile: {tok(profile)} tok")
for h in (0, 1, 2, 3):
    f = tok(freeform(h))
    print(f"freeform(history={h}): {f} tok  ratio={f / tok(profile):.1f}x")
FormatTokensvs profile
Structured profile (20 fields)1371.0x
Free-form, no history2962.2x
Free-form, 1 revision8966.5x
Free-form, 2 revisions1,49610.9x
Free-form, 3 revisions2,09615.3x

Against history-free prose the gap is only 2.2x. Unremarkable. The spread opens up once revision history accumulates.

At Gemini 3.6 Flash input pricing of $1.50 per Mtok, 1,000 requests a day for 30 days works out to $6.17 a month at 137 tokens versus $67.32 at 1,496 tokens — roughly $61 apart. At indie developer scale that is not noise.

But this is not an argument that structure wins. Free-form memory closes the gap if you compact it regularly. The real reason I moved to Memory profiles is that I no longer have to operate that compaction myself.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A guard that refuses to overwrite confirmed values with inferred ones dropped accuracy from 68.9% to 52.5% on fast-changing fields — and why
Complete runnable comparison harness that lifted a mixed profile from 76.0% to 81.8% by switching to per-field TTLs
Token cost of structured profiles vs free-form memory: 137 vs 1,496 tokens, or $6.17 vs $67.32 per month at 1,000 requests a day
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API / SDK2026-08-02
Measuring a Guard in environment hooks: 46 Microseconds to Decide, 23 Milliseconds to Start
A record of building a destructive-command guard for Managed Agents environment hooks. A regex denylist let 9 of 20 dangerous commands through; argv parsing reached 100 percent detection. The startup cost turned out to be 500 times the decision cost.
API / SDK2026-07-19
Still image or short clip? Deciding feature placement from the cost gap between Nano Banana 2 Lite and Omni Flash
When I froze over whether a wallpaper app's hero asset should be a still image or a short moving loop, the deciding factor was not taste but the order of magnitude of the cost. Here is how to normalize Nano Banana 2 Lite and Omni Flash onto the same footing, down to a working decision function.
API / SDK2026-07-04
When Two Managed Agents Fight Over the Same Repo: External Leases and Fencing for Isolated Sandboxes
Every Managed Agents run gets its own isolated sandbox, so a local lock cannot stop two runs from touching the same repo or record. Here is how I serialize them safely with an external lease and a fencing token.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →