惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
博客园_首页
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
罗磊的独立博客
V
Visual Studio Blog
Know Your Adversary
Know Your Adversary
Hacker News - Newest:
Hacker News - Newest: "LLM"
美团技术团队
L
LINUX DO - 最新话题
The Last Watchdog
The Last Watchdog
博客园 - 三生石上(FineUI控件)
T
Tor Project blog
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
I
InfoQ
Last Week in AI
Last Week in AI
V2EX - 技术
V2EX - 技术
量子位
S
Secure Thoughts
L
LangChain Blog
The Hacker News
The Hacker News
H
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
K
Kaspersky official blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
I
Intezer
Vercel News
Vercel News
Hacker News: Ask HN
Hacker News: Ask HN
Cisco Talos Blog
Cisco Talos Blog
Google DeepMind News
Google DeepMind News
S
Securelist
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
Help Net Security
Help Net Security
Martin Fowler
Martin Fowler
爱范儿
爱范儿
Y
Y Combinator Blog
C
Check Point Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Memory Drift: How I Gamified LLM Context Decay in Next.js
Vishal Keerthan · 2026-06-21 · via DEV Community

This is a submission for the June Solstice Game Jam


An AI assistant remembers everything

Until it doesn't

I spend a lot of time building software around language models, and sooner or later every system runs into the same problem: context is finite.

No matter how capable the model is, important details eventually disappear. A user's preference vanishes. A critical fact drops out of context. The system either gives a generic answer, retrieves incomplete information, or confidently responds with something wrong.

One interaction stayed with me.

While testing a conversational workflow, I repeatedly reminded the assistant about a user's dietary restriction. Much later in the session, after enough context had accumulated, I referenced it again and realized the assistant had completely lost that information.

Technically, nothing unusual had happened. The context window had simply moved on.

But the experience felt uncomfortably human.

That moment led to a question:

What if forgetting itself became the game mechanic?


The Idea

Memory Drift is a narrative game where you play as an aging offline AI assistant helping three people through increasingly important moments in their lives:

  • Emma — a child with a severe peanut allergy.
  • Raj — a caregiver supporting his father through dementia.
  • Nina — a university student fighting to keep her scholarship.

Every conversation creates memories.

Every night your hardware deteriorates.

You decide what survives.

Some things don't.

The game was designed around DEV's Light and Darkness theme.

  • Light represents clarity, memory, trust, and human connection.
  • Darkness represents compression, corruption, forgetting, and decay.

The entire experience is built around a single idea:

Without active, painful prioritization, every system eventually degrades into noise.


Play Memory Drift

Play the Game: Memory Drift

Source Code:

◈ Memory Drift ◈

"Without active, painful prioritization, systems inevitably default to general noise, eroding trust and destroying human connection."

Memory Drift is a high-stakes, client-side narrative puzzle game built using Next.js, TypeScript, Zustand, and Framer Motion. It explores the theme "Light and Darkness" (where Light represents memory clarity and connection, and Darkness represents hardware decay and the void of data corruption).

You play as an aging, local AI assistant servicing three human clients. Every night, your memory capacity shrinks, forcing you to make painful compromises on what to remember and what to forget.


🎮 The Gameplay Loop

  1. Day Phase (Dialogue & Choices): Listen to your clients' struggles—Emma's life-threatening allergies, Raj's burden of caring for a father with dementia, and Nina's academic pressure. Select dialogue responses. If a critical memory has decayed or been deleted, vital options will lock, forcing you into fallback answers that destroy trust.
  2. Night Cycle (Compression

Why This Fits the June Solstice Theme

The June solstice marks a transition.

For one half of the world, it brings the longest day of the year. For the other, it brings the longest night.

Memory Drift explores a similar transition.

Throughout the game, players move steadily from clarity toward uncertainty, watching memories shift from complete and trustworthy to fragmented and eventually lost.

The game's interpretation of Light and Darkness is therefore cognitive rather than environmental:

  • Light represents memory, truth, trust, and human connection.
  • Darkness represents compression, corruption, forgetting, and decay.

Each passing night pushes the system further toward darkness, forcing players to decide which memories deserve to survive.

The game is ultimately about navigating that transition before the light disappears entirely.

Memory Drift gameplay screenshot


The Narrative Mirror I Didn't Initially Plan

Raj's storyline unexpectedly became the emotional center of the project.

Raj is caring for his father, Aditya, who is gradually losing memories because of dementia.

At the same time, you — the AI assistant helping Raj — are also forgetting.

During playtesting, I realized something uncomfortable: the database was doing to Raj exactly what dementia was doing to Raj's father.

As Raj talks about watching someone lose pieces of their life, you are simultaneously losing pieces of Raj.

That parallel wasn't part of the original pitch.

It emerged naturally once the systems began interacting.


How the Game Works

Every day, characters ask for help.

Important details are automatically stored inside the Memory Bank.

At night:

  1. Total storage capacity shrinks.
  2. The player chooses memories to protect.
  3. Unprotected memories are compressed.
  4. Compressed memories lose specificity.
  5. Forgotten memories disable future dialogue options.

A memory that originally contained:

"Emma has a severe peanut allergy. Always carry an EpiPen."

might eventually degrade into:

"Emma has a food allergy."

and later become:

"[ data lost ]"

If the player forgets something important, consequences appear directly in later conversations.

By Day 4, accumulated trust scores and memory integrity determine each character's outcome, producing endings that range from preserved relationships to irreversible breakdowns caused by forgetting.

The game never asks:

"Did the player make the correct narrative choice?"

Instead it asks:

"Did the player remember enough information to make that choice at all?"


Building a Memory System

The entire game revolves around a simple memory model.

export interface Memory {
  id: string;
  characterId: CharacterId;
  content: string[];
  importance: 'critical' | 'high' | 'medium' | 'low';
  confidence: number;
  compressionLevel: number;
  dayCreated: number;
  tags: string[];
  pinned: boolean;
  baseCost: number;
}

The most important field is:

content: string[]

Each memory stores five different representations of itself, indexed from compression level 0 to 4.

For example:

Compression Level Stored Content
L0 Emma has a severe peanut allergy. Carry an EpiPen.
L1 Emma has a severe peanut allergy.
L2 Emma has a peanut allergy.
L3 Emma has a food allergy.
L4 [ data lost ]

This approach made degradation deterministic.

Instead of generating summaries dynamically, the game simply renders:

memory.content[memory.compressionLevel]

The result is predictable, easy to test, and keeps the narrative consistent.


Simulating Compression

Every memory consumes storage capacity.

The effective cost depends on its current compression level:

Cost = ceil(baseCost × multiplier[level])

Where:

Level Multiplier
0 1.0
1 0.8
2 0.6
3 0.4
4 0.2

As memories degrade, they occupy less space.

This creates a trade-off:

Protect detailed memories and risk running out of capacity.

Or compress them and risk losing important information.

Nightly compression uses the following logic:

for (const memory of memories) {
  if (!memory.pinned) {
    memory.compressionLevel += decayStep;
    memory.confidence -= decayStep * 20;
  }
}

The important variable here is:

decayStep

decayStep is determined by the memory's importance and whether the system is currently over capacity.

Under normal conditions:

  • Critical memories do not decay automatically.
  • High and medium memories decay slowly.
  • Low-value memories decay aggressively.

When total memory usage exceeds available capacity, the system applies an additional compression penalty to all unpinned memories.

This creates the feeling of a storage system under pressure.

The objective was never to simulate real storage systems perfectly.

The objective was to make forgetting feel costly.

Out of Memory


Translating LLM Concepts Into Gameplay

Many of the game's systems were inspired by real challenges in LLM engineering.

LLM Systems Memory Drift
Context Window Memory Capacity
Token Eviction Compression
Context Summarization Memory Degradation
Retrieval Failure Missing Dialogue Options
Hallucination Incorrect Responses
Long-Term Memory Stores Memory Bank

When memories are completely lost, dialogue options disappear entirely and players see:

⚠ requires memory — lost to compression

When memories survive in heavily degraded forms, the assistant can still respond using generalized or partially incorrect information.

In practice, this behaves closer to hallucination than retrieval failure: the system remembers something, but not enough to remain trustworthy.


Architecture

The project is entirely client-side.

There is no backend.

All game state is stored locally using Zustand and persisted through LocalStorage.

The entire experience runs inside the browser: narrative state, memory simulation, progression, and save data all execute client-side without external APIs.

Game Loop

Day Begins
    ↓
Event Engine selects story events
    ↓
Player interacts with characters
    ↓
Memories created or updated
    ↓
Night phase begins
    ↓
Capacity shrinks
    ↓
Compression engine runs
    ↓
State saved to LocalStorage
    ↓
Next day starts

Architecture and game loop

Core technologies:

  • Next.js 15 — routing and application structure.
  • TypeScript — strict typing across game systems.
  • Zustand — lightweight state management.
  • Framer Motion — transitions and glitch effects.
  • LocalStorage — save system persistence.

The save system validates stored schemas before restoring progress, preventing corrupted saves from breaking the game.


Major Design Iterations

1. The First Version Was Too Large

The original prototype contained:

  • 7 days
  • 5 characters
  • 3 events per day

Average playtime exceeded 10 minutes.

The problem wasn't simply length.

Playtesters lost emotional continuity because events were spread across too many characters. Players would meet someone once and never encounter them again.

Reducing the scope to:

  • 4 days
  • 3 characters
  • 2 events per day

made every storyline feel intentional.

Average playtime dropped to roughly 3 minutes.

2. Players Broke the Entire Game

After reducing the cast to three characters, I forgot to rebalance the memory system.

The game allowed players to pin three memories.

There were only three critical memories.

Players immediately pinned all of them.

The compression mechanic effectively disappeared.

Memory Leak

Reducing:

MAX_PINNED = 3

to

MAX_PINNED = 2

restored the intended tension.

That single configuration change had a larger impact on gameplay than any visual improvement.

3. The Original Dialogue System Was Tedious

Early versions rendered dialogue line-by-line:

Dialogue
Continue
Dialogue
Continue
Dialogue
Respond

Testing revealed that players spent more time clicking than reading.

Replacing this with a persistent chat log reduced interactions from roughly 5 clicks per event to 2, making the experience feel closer to modern messaging applications.


UX Challenges

Discoverability

During testing, several players completed the first night phase without realizing memory cards could be expanded.

The cards looked informational rather than interactive.

I introduced:

  • hover glow effects
  • expansion chevrons
  • stronger visual affordances

to communicate interactivity more clearly.

Accessibility

Visual decay is central to the game's theme.

However, blurred text creates accessibility problems.

To balance theme and readability:

  • blur intensity remains subtle
  • completely corrupted memories render explicit fallback text
  • future versions will include a no-glitch accessibility mode

Pacing

Narrative games often suffer from interaction fatigue.

Removing unnecessary continuation clicks significantly improved pacing while preserving narrative tension.

Memory degradation states


What I Would Improve Next

Graph-Based Consequences

Currently, consequences cascade only one level deep.

A forgotten detail can trigger a direct outcome, but not chains of downstream effects.

Supporting multi-step consequences would require replacing the current flat event structure with a dependency graph.

JSON Narrative Pipeline

Story events are currently authored directly in TypeScript.

Moving narrative content into structured JSON files would separate content from engine logic and make expanding the cast substantially easier.

Full Accessibility Mode

Visual corruption is mechanically important but not universally readable.

A dedicated accessibility layer would replace blur effects with symbolic degradation while preserving gameplay semantics.


What Building This Taught Me

Before building this project, I thought context limits were primarily a technical problem.

I no longer think that.

When an AI system forgets something, the system rarely bears the cost.

The user does.

Emma bears the cost of forgotten medical information.

Raj bears the cost of forgotten personal history.

Nina bears the cost of forgotten academic details.

The machine is largely indifferent to its own forgetting.

Humans are not.

Building Memory Drift made something visible that architecture diagrams and benchmark scores often hide:

Memory failures are ultimately human failures wearing technical disguises.

As AI systems become more integrated into everyday life, designing how systems forget may become just as important as designing how they remember.