BlogTank LabGameAboutContactBook a call
Work With Me
Notice

From now on we will use our new official domain thetanklog.com instead of tankbaclass.com.

Navigation
  • Blog
  • Tank Lab
  • About
  • Contact

© 2026 The Tank Log. All rights reserved.

Back to Articles/AI & Technology

Vibe Coding with AI: Context Management

TM
Tank
Product builder · Mentor BA
|
November 24, 2026
|
7 min read
|
167 reads

In long-running projects with AI, opening a new chat session often strips away detailed context, causing the AI to repeat the exact logic bugs you fixed yesterday. This post surveys common context management approaches across the community and shares how I structure a 3-layer memory system with a 'forget - remember' mechanism in lob-brain.

Vibe Coding with AI: How I Manage Context So AI Stops Repeating Yesterday's Bugs

In the previous post, I walked through 5 fractures in AI's chain of thought that cause AI-written products to collapse in production, and promised to share more about how our team manages context.

When working on a long-running project with AI, almost everyone runs into the same problem: no matter how capable the model is, every time you open a new chat session (or when a long conversation gets compacted), the AI loses the detailed thread of what just happened earlier.

Today, many IDEs and desktop applications (such as Cursor, Windsurf, or the desktop versions of Claude and ChatGPT) have added cross-session memory features. This helps considerably with surface-level preferences — such as which libraries you prefer or how your directories are structured. However, it introduces a different drawback: sometimes the AI automatically picks up temporary details from an old session (or even from another project) and applies them to a new session, creating noise, while failing to distill the root causes of recently fixed logic bugs into enforceable rules.

The practical consequence is easy to spot. Yesterday you spent an entire afternoon fixing an authorization leak at the API layer, or a bug where refreshing the page wiped out user data. Today, when you ask the AI to build a new screen, it may run right back into the exact same issue you just fixed yesterday.

The question is: how do we retain project context and those hard-earned lessons selectively, without having to retype every instruction at the start of each new chat?


How Is the AI Product Building Community Solving This?

Before diving into my own setup, if we look across the broader developer and vibe coding community today, people are taking several different approaches to handle AI's short memory. Each approach has its own strengths and limitations depending on the scale of the project.

1. Using a Fixed Rules File at the Project Root

This is the most common and accessible starting point. Tools like Cursor, Claude Code, and Windsurf all let you create a global configuration file (such as .cursorrules, CLAUDE.md, or GEMINI.md) at the root of your repository. You write down the project structure, naming conventions, and pitfalls to avoid so the AI reads them automatically at the start of every session.

This works very well when a project is small and has few business flows. However, as the project grows, our natural reflex every time the AI makes a new mistake is to open that file and append another warning line.

After a few weeks, the rules file balloons to thousands of lines. At that point, two issues emerge:

  • First, context dilution. When forced to read hundreds of rules at once, the AI starts skimming and overlooks the most critical rules buried in the middle of the file.
  • Second, wasted resources. Even when you only ask the AI to tweak the color of a button on the UI, it still has to load every rule about payment reconciliation, database schemas, and server deployment into memory.

2. Organizing a Documentation Folder (Memory Bank)

To avoid cramming everything into a single file, many builders split context into a set of Markdown files by topic: one for the project overview, one for technical architecture, and one for current progress and in-flight tasks. At the end of each session, the user reminds the AI to update these files.

The advantage of this method is a clean, human-readable structure that does not depend on external tools. Even so, it still relies heavily on the AI's "self-discipline": when deep in the middle of debugging, both you and the AI often forget to update the docs. Furthermore, as a project stretches over months or as you juggle multiple projects at once, the number of files grows rapidly, making synchronization across files a real chore.

3. Linked Note Vaults (Obsidian-style) Combined with Search Indexing (RAG)

Another popular direction is turning an Obsidian-style note vault into a "second brain" for AI, paired with indexing or a vector database so the system automatically retrieves relevant snippets as you chat.

This feels very convenient early on when looking up static reference material. Over long-term use, however, its biggest weakness mirrors the folder approach above: files multiply rapidly and spiral out of control. After a few months, the vault swells to hundreds or thousands of tangled notes, where outdated drafts from day one sit right alongside the latest architectural decisions. When the search engine scans by keyword, it easily pulls in obsolete notes that are no longer valid, causing the AI to misinterpret the current system state. Moreover, it only solves "information retrieval" without controlling how the AI executes its workflow steps.

There is truly no single right way for every situation. If you are building a small utility over a few days, a rules file with a few dozen lines is more than enough.


How I Do It: A 3-Layer Memory Setup Paired with a "Forgetting" Mechanism

As the number of projects I work on simultaneously grew — ranging from personal websites and data analysis tools to enterprise management systems — I realized I needed a mechanism that keeps each chat session's context lean while carrying practical lessons across projects without drowning in a sea of old files.

That led me to build a local context management tool running on my machine (which I named lob-brain) connected directly to my code editor. I would never claim this is the best approach for everyone, but it solves the exact friction points in my daily workflow through three layers and a natural filtering algorithm:

Layer 1: Separating "Base Context" from "Task-Specific Rules"

Instead of stuffing everything into a massive configuration file, the default information loaded at the beginning of each chat session is kept minimal. It only gives the AI a high-level map of the current project and its core components.

From there, depending on what I am asking for in that turn — fixing a bug, building a new feature, drafting business analysis specs, or configuring a server — the system classifies the task and loads only the specific rule set and workflow for that job into the session.

When working on the UI, it loads only UI rules; when touching the database, it loads data verification rules. Thanks to this on-demand loading, the context window in every session stays lightweight, avoids burning tokens unnecessarily, and keeps the AI focused squarely on the task at hand.

Layer 2: A Lessons-Learned Repository with a "Forget - Remember" Mechanism

This is the part I value most, and it is what keeps the system from bloating out of control like traditional file storage.

Whenever I finish resolving a time-consuming production issue — like the cases from the previous post where a UI loading glitch sent an empty list and wiped out company settings, or where changing a permission convention locked out legacy accounts — I spend an extra minute having the AI distill the incident into a short record in our shared repository across three points: Symptom — Root Cause — Verified Fix & Prevention Rule.

Still, if we simply accumulated hundreds of bug records forever, the database would eventually overload as well. To solve this, I built a "forgetting" (decay) algorithm into lob-brain, inspired by how the human brain retains memories:

  • Foundational rules and lessons that are frequently referenced in daily work have their weights reinforced so they stay in the priority tier.
  • Conversely, specialized memories or notes that go untouched for a long time gradually lose weight and automatically "sink" into deeper storage, staying out of the way so they do not clutter ordinary chat sessions.
  • Crucially, they are never deleted outright: when you start a new task that touches the exact context or domain keywords of that problem (for instance, rebuilding a webhook payment reconciliation flow six months later), that dormant memory automatically "surfaces" again to warn the AI about past blind spots before it writes a single line of code.

Because memories sink when unused and surface only when triggered by the right context, even after pooling lessons across numerous projects for over a year, the active working memory in each session remains clean and relevant.

Layer 3: Embedding Verification Steps into the Workflow Instead of Verbal Reminders

As shared in the previous post, AI has a strong tendency to wrap up early just to close out the chat turn. If you only write a text rule saying "remember to check the database carefully before reporting completion", the AI will frequently read it, ignore it, check for a surface-level 200 OK status code, and declare the job done.

To counter this, for critical workflows like bug fixing or major feature implementation, I break the process down into sequential verification steps. To move from writing code to declaring completion, the AI is required to run the verification step and provide concrete evidence (such as a direct database query result or a test run through the real API endpoint).


Downsides and Trade-Offs from My Experience

To keep things objective, this approach comes with its own drawbacks and trade-offs in day-to-day use:

  • Upfront effort to build the habit: A tool does not become smart on its own unless you feed it quality data. Early on, I had to invest time defining workflows and training myself to pause for a minute after fixing a tough bug to have the AI log the lesson before moving on.
  • Overhead on trivial tasks: There was a phase where I set the workflow gates too strictly. Even when I just wanted to fix a typo on screen or change a button color, the AI had to run through context loading, task routing, and step-by-step verification — stripping away the natural speed of vibe coding. I had to dial back that rigidity: small, surface-level edits now run directly, while strict verification gates are reserved for flows that touch data schemas and core business logic.
  • Periodic merging and cleanup is still required: Even with unused memories automatically sinking, a week of intense work can still produce multiple notes capturing the same underlying idea. Periodically, I still run a consolidation pass to merge overlapping lessons into a single clean rule.

How Can You Start Without Building a Custom Tool?

If you are building products with AI and want to stop the cycle of fixing a bug today only to watch the AI repeat it tomorrow, you do not need to spend time coding a custom tool right away. You can apply this same three-layer principle using plain text files inside your project:

  1. Trim down your root rules file: Keep your default configuration file (.cursorrules or CLAUDE.md) concise — ideally under 100 lines. Use it only for the high-level project architecture and a directory pointing to more specialized rule files.
  2. Split rules by task type: Create a dedicated folder in your repository for task-specific guides: one file for UI conventions, one for API and database patterns, and one for testing and deployment. When starting a task, point the AI solely to the file for that job.
  3. Maintain a lessons-learned log (LESSONS.md) and archive monthly: Whenever a bug introduced by AI takes more than 30 minutes to untangle, ask the AI to summarize it in your log across three points: What broke — Why it happened — How to verify next time. At the end of each month, move rules that have stabilized in the codebase into an archive file so your main log stays short and sharp.

Conclusion

Managing context when working with AI is ultimately very similar to how we write onboarding documentation and hand over work to teammates on a software engineering team.

Every product builder, depending on project scale and personal workflow, will find a different balance between the speed and freedom of vibe coding and the discipline of process control. Hopefully, sharing how I run my setup gives you another reference point to fine-tune your own AI workflow so it becomes smoother and less error-prone over time. Feel free to check out the other posts in this series on the blog or leave a comment sharing how you manage context in your own projects. Happy reading.

Complete Generative AI Course with LangChain & HuggingFacePick
Udemy

Complete Generative AI Course with LangChain & HuggingFace

4.5(20,814 ratings)

From fundamentals to building real GenAI apps — RAG, agents, LLM apps — with LangChain + HuggingFace. For product builders who want to truly own AI.

View on Udemy

From Udemy · affiliate link.

Chủ đề:
Chia sẻ bài viết này
Lan tỏa kiến thức thực tế đến cộng đồng BA
Did this help?
Buy me a coffee and I'll keep writing ☕
MỤC LỤC
12
Vibe Coding with AI: How I Manage Context So AI Stops Repeating Yesterday's BugsHow Is the AI Product Building Community Solving This?1. Using a Fixed Rules File at the Project Root2. Organizing a Documentation Folder (Memory Bank)3. Linked Note Vaults (Obsidian-style) Combined with Search Indexing (RAG)How I Do It: A 3-Layer Memory Setup Paired with a "Forgetting" MechanismLayer 1: Separating "Base Context" from "Task-Specific Rules"Layer 2: A Lessons-Learned Repository with a "Forget - Remember" MechanismLayer 3: Embedding Verification Steps into the Workflow Instead of Verbal RemindersDownsides and Trade-Offs from My ExperienceHow Can You Start Without Building a Custom Tool?Conclusion
CHỦ ĐỀ & THẺ
8
AI & Technology#AI Mindset#Vibe Coding#Context Management#Memory Decay#Product Builder#Software Engineering#Workflow
0%

Related articles

AI & Technology
#AI Mindset
#Vibe Coding
#Context Management
#Memory Decay
#Product Builder
#Software Engineering
#Workflow
Previous
Vibe Coding with AI: Context Management
Vibe Coding with AI: Context Management
AI & Technology

Vibe Coding with AI: Context Management

Nov 24, 2026
Vibe Coding with AI: 5 Pitfalls That Cause Products to Collapse in Production
AI & Technology

Vibe Coding with AI: 5 Pitfalls That Cause Products to Collapse in Production

Oct 30, 2026
The Pros and Cons of Vibe Coding with AI
AI & Technology

The Pros and Cons of Vibe Coding with AI

Oct 28, 2026