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

推荐订阅源

F
Fortinet All Blogs
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
宝玉的分享
宝玉的分享
T
Tenable Blog
WordPress大学
WordPress大学
K
Kaspersky official blog
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hacker News - Newest:
Hacker News - Newest: "LLM"
P
Palo Alto Networks Blog
Help Net Security
Help Net Security
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com
A
Arctic Wolf
Forbes - Security
Forbes - Security
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
H
Hacker News: Front Page
W
WeLiveSecurity
博客园 - 【当耐特】
G
Google Developers Blog
Martin Fowler
Martin Fowler
TaoSecurity Blog
TaoSecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
N
Netflix TechBlog - Medium
C
Cisco Blogs
I
Intezer
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
L
Lohrmann on Cybersecurity
Engineering at Meta
Engineering at Meta

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
Why Context Window Is Not Enough for AI Character Memory
David · 2026-05-31 · via DEV Community

When I started building AI characters, I thought memory was mostly a context-length problem.

If the model could see more previous messages, the character would remember more.
If the context window was larger, the conversation would feel more continuous.
If we could fit enough history into the prompt, the problem would be solved.

That assumption was wrong.

A larger context window helps, but it does not create real memory.

For AI character products, users do not only want the model to see more tokens. They want the character to feel like the same character tomorrow.

They want continuity.

They want the character to remember the tone of the relationship, the current roleplay world, the user’s preferences, the previous emotional state, and the small details that make the conversation feel personal.

That is not the same as dumping chat history into a prompt.

A context window gives the model temporary visibility.

Memory gives the product persistent relevance.

The quick version

A context window helps an AI character stay coherent inside the current conversation.

Long-term memory helps the character preserve useful information across sessions.

A practical memory system for AI characters usually needs several layers:

session context;
user profile memory;
character state;
relationship state;
semantic retrieval;
summary memory;
safety and privacy filters.

The hard part is not storing everything.

The hard part is deciding what should be remembered, retrieved, updated, ignored, or forgotten.

Context window vs memory

A context window is the amount of information the model can see at generation time.

Memory is a product-level system that decides which information should survive beyond the current prompt.

They are related, but they are not the same thing.

You can have a huge context window and still have bad memory.

You can also have a smaller context window and still create a good memory experience if you retrieve the right information at the right moment.

Here is the difference:

Context window:
"What can the model see right now?"
Memory:
"What should the product preserve and reuse later?"
For a simple chatbot, a larger context window may be enough.

For an AI character, it usually is not.

Why dumping history into the prompt fails

The naive approach looks like this:
Take the full chat history

Append it to the prompt

Ask the model to continue
This works for short conversations.

Then it starts to break.

1. It becomes expensive

Long prompts cost more.

They also increase latency, which matters a lot in conversational products. If every reply becomes slower because the product keeps inserting more and more history, the experience starts to feel heavy.

For AI companions and character chats, response speed is part of the emotional experience.

A delayed answer can break the rhythm.

2. It becomes noisy

More context is not always better context.

If the prompt contains too many old messages, the model may focus on irrelevant details.

The user mentioned a random movie once three weeks ago.
The model suddenly brings it up at the wrong moment.
The user feels watched, not understood.

Bad memory can be worse than no memory.

Good memory is selective.

3. It does not rank importance

Raw chat history does not tell the model what matters.

A user may say:

"I prefer slow, quiet conversations when I'm tired."
That is probably important.

The same user may also say:

"I had pasta today."
That is probably not important unless it becomes a recurring preference.

A context dump treats both as just text.

A memory system should not.

4. It does not handle cross-session continuity well

Users do not always talk in one long uninterrupted thread.

They return tomorrow.
They switch devices.
They open Telegram, then continue in the browser.
They talk to different characters.
They start a new roleplay world.

A context window alone does not solve this.

Memory has to exist outside one prompt and one session.

What AI character memory actually needs to preserve

When people hear “memory,” they often think of fact recall.

Things like:

User's name
User's favorite movie
User's city
User's pet's name
These can be useful, but AI character memory is broader than facts.

A character should also remember patterns.

For example:

User prefers short replies when tired.
User likes slow-burn fantasy roleplay.
User dislikes overly energetic responses.
User is practicing Spanish casually.
User and this character are in a cautious but warm relationship dynamic.
The current story arc is set in an abandoned library.
For AI characters, the most useful memory is often not a fact.

It is a preference, a dynamic, or a narrative state.

A practical memory stack

Here is a simplified architecture that I find useful:

User message

Input moderation / safety checks

Session context

Memory retrieval query

Relevant memories from vector database

User profile + character state + relationship state

Prompt assembly

LLM response

Memory extraction / summarization

Store / update / ignore / delete
This is not the only possible architecture, but it separates the main responsibilities.

Let’s break it down.

1. Session context

Session context is the short-term state of the current conversation.

It includes:

recent messages;
current topic;
active scene;
temporary instructions;
immediate user request.

It answers the question:

What is happening right now?
This layer usually lives directly in the prompt.

It is necessary, but it is not long-term memory.

If session context is your only memory layer, the character may feel coherent for one conversation and then reset later.

2. User profile memory

User profile memory stores relatively stable preferences about the user.

Examples:

User prefers concise replies.
User likes calm conversations.
User is practicing Japanese.
User prefers being called Alex.
User dislikes pushy motivational language.
This memory should be handled carefully.

It directly affects trust.

If the system stores incorrect preferences, the user should be able to correct them. If the system stores sensitive information, the user should understand how memory works.

For consumer AI, memory is not only an engineering problem.

It is also a trust problem.

3. Character state

AI characters also need memory about themselves.

This is where many products fail.

They remember something about the user, but the character drifts.

Character state can include:
Character personality
Backstory
Speaking style
Emotional range
Relationship constraints
Visual identity
Voice style
Current character arc
Example:

Character state:

  • Reserved and calm.
  • Uses dry humor.
  • Trust develops slowly.
  • Avoids sudden emotional intensity.
  • Replies in short, thoughtful sentences unless asked for detail. For character products, consistency is part of the product contract.

If the user chooses or creates a character, they expect that character to remain recognizable.

4. Relationship state

Relationship state is different from global user memory.

The same user may want different dynamics with different characters.

With one character, the tone may be playful.
With another, it may be mentor-like.
With another, it may be slow-burn roleplay.
With another, it may be language practice.

If everything is flattened into one global user profile, you lose this nuance.

Relationship state answers:

What is the current dynamic between this user and this character?
Example:

Relationship state:

  • User and character are building a slow-burn fantasy dynamic.
  • Current tone is cautious but warm.
  • Character should not act overly familiar yet.
  • They are gradually building trust. This layer matters a lot in roleplay and AI companion products.

A roleplay arc is not just chat history.

It is a shared state.

5. Semantic retrieval

This is where vector search becomes useful.

The goal is not to retrieve memories by exact keyword match.

The goal is to retrieve by meaning.

If the user says:

"I'm tired today. Can we do something quiet?"
A keyword-based system may not retrieve much.

A semantic system might retrieve:
User prefers calm, low-pressure conversations.
User likes quiet fantasy settings.
User often responds well to short, gentle replies.
User previously enjoyed an abandoned library scene.
That is the difference between literal memory and semantic memory.

A useful AI character memory system should retrieve meaning, not just words.

The exact vector database is an implementation detail. It could be ChromaDB, pgvector, Qdrant, Pinecone, Weaviate, or something else.

The product principle is the same:

Retrieve the context that helps the next response feel continuous.

6. Summary memory

Raw chat logs are usually not the best long-term memory format.

They are too verbose and too noisy.

A better approach is to summarize important sessions, scenes, or patterns.

Instead of storing twenty messages, store something like:

Summary:
User and character started a quiet fantasy scene in an abandoned library.
User preferred slow pacing, subtle tension, and gradual trust-building.
The scene ended with the character offering to show a hidden archive.
This is much more useful than blindly storing every line.

Summary memory helps with:

lower token usage;
clearer retrieval;
better prompt assembly;
less noise;
easier memory management.

But summaries must be updated carefully.

A bad summary can distort the relationship, the story, or the user’s preference.

7. Safety and privacy filters

Memory should not store everything.

This is one of the most important parts.

Some information should be ignored.
Some should be summarized.
Some should expire.
Some should require explicit user control.
Some should never become personalization memory.

Examples:

Do not store:

  • sensitive personal identifiers unless truly needed;
  • crisis messages as normal personalization memory;
  • unsafe content;
  • random one-off details with no future value;
  • private information that the user did not intend as a preference.
    Store carefully:

  • communication preferences;

  • boundaries;

  • language-learning goals;

  • recurring story state;

  • character-specific relationship dynamics.
    The more personal the product feels, the more careful memory needs to be.

Bad memory vs good memory

Here is a simple example.

User says:

I like slower conversations. I’m into quiet fantasy settings, abandoned libraries, and characters who reveal themselves gradually.
Bad memory:

User likes fantasy.
Better memory:

User prefers slow-paced fantasy scenes, quiet atmosphere, abandoned-library settings, gradual emotional reveal, and low-pressure dialogue.
Why is the second better?

Because it preserves the pattern, not just the noun.

The useful memory is not “fantasy.”

The useful memory is the user’s preferred interaction style.

That difference matters a lot in AI character products.

Prompt assembly example

Once the memory layers exist, the next step is prompt assembly.

A simplified prompt may look like this:

System:
You are the selected AI character. Stay consistent with the character profile.
Character state:

  • Reserved, calm, dry humor.
  • Trust develops slowly.
  • Avoids sudden emotional intensity. Relationship state:
  • User and character are building a slow-burn fantasy dynamic.
  • Current tone: cautious but warm.
  • Continue from the abandoned library arc if relevant. Relevant user memories:
  • User prefers slow-paced scenes.
  • User dislikes overly energetic replies.
  • User is practicing Spanish casually.
  • User prefers short replies when tired. Current session: User: "I'm tired today. Can we do something quiet?" The response should not simply list the memories.

That would feel robotic.

The model should use memory to choose a better response.

For example:

Of course. We can keep it quiet tonight.
Maybe we return to the old library — not the dangerous part yet, just the upper floor where the rain taps against the glass roof. I can show you one small secret, and we do not have to rush.
Of course. We can keep it quiet tonight.

Maybe we return to the old library — not the dangerous part yet, just the upper floor where the rain taps against the glass roof. I can show you one small secret, and we do not have to rush.
The user does not need to see the memory system.

They just need to feel continuity.

Memory extraction

After the model replies, the system needs to decide whether anything should be stored or updated.

This is where many products over-store.

Not every message deserves memory.

A memory extraction step can classify information like this:

Should this message create or update memory?
Categories:

  • stable preference
  • temporary preference
  • character-specific relationship state
  • roleplay world state
  • language-learning goal
  • safety boundary
  • no memory needed Example:

User: Actually, I prefer shorter replies when I'm tired.

This should probably update memory:

Memory update:

User prefers shorter replies when tired.

Another example:

User: I had pasta today.

This usually should not become long-term memory.

Unless it becomes a repeated preference or relevant part of the current story, it can be ignored.

The hard part is knowing the difference.

A simple memory extraction prompt

A simplified extraction prompt could look like this:

You are a memory extraction system.
Given the conversation, extract only information that will likely improve future conversations.
Do not store sensitive personal data unless the user clearly intends it as a preference.
Do not store one-off details unless they are important for an ongoing story or relationship.
Do not store unsafe content.
Return JSON:
{
"should_store": boolean,
"memory_type": "stable_preference | temporary_preference | relationship_state | story_state | language_goal | safety_boundary | none",
"memory": "short memory text",
"reason": "why this is useful or not useful"
}
Example output:

{
"should_store": true,
"memory_type": "stable_preference",
"memory": "User prefers shorter replies when tired.",
"reason": "This preference can improve future response style."
}
This is not enough for production by itself, but it shows the idea.

Memory extraction should be explicit, structured, and conservative.

Common mistakes

Here are the mistakes I would avoid.

Mistake 1: Storing too much

More memory is not always better.

Too much memory creates noise and can make the character bring up irrelevant details.

Mistake 2: Storing facts instead of patterns

Facts are useful, but patterns are often more valuable.

User likes fantasy.

is weaker than:

User prefers slow-paced fantasy scenes with gradual trust-building.

Mistake 3: Mixing global user memory with character-specific state

A user may want different dynamics with different characters.

Do not flatten everything into one profile.

Mistake 4: Making memory creepy

If the character constantly says:

I remember that you told me...

the experience can become uncomfortable.

Good memory should be felt, not announced every time.

Mistake 5: No user control

Users should understand that memory exists.

They should have reasonable ways to correct, manage, or clear it.

Memory without control damages trust.

Mistake 6: Treating safety as an afterthought

Safety rules should be part of the memory pipeline.

Not something added later.

Where HoneyChat fits

This is the direction we are building toward in HoneyChat: AI characters for Telegram and web with long-term memory, voice messages, AI photos, short videos, and character consistency.

The hard part is not making the first message impressive.

The hard part is making the next session feel connected.

A user should be able to start in Telegram, continue in the browser, return later, and still feel like the same character remembers the important parts.

That is the product goal.

Not infinite chat history.

Not a bigger prompt for the sake of it.

Continuity.

Final takeaway

The next generation of AI character products will not be judged only by model quality.

They will be judged by continuity.

Context windows make chats longer.

Memory makes characters persistent.

That is the real difference between a chatbot and a companion.