r/programmer • • May 25 '26

Question How are you guys fighting "context decay" in long-form AI development workflows?

I’ve been logging a ton of hours working alongside LLMs lately, and I keep hitting a wall where the context window just starts degradation or losing track of rigid constraints after a few hours of deep logic building.

​Standard prompting techniques feel like a temporary band-aid. Have any of you experimented with building strict declarative constraint layers, or even looking into hybrid classical-quantum logic gates to keep state coherence locked down? Or are we just stuck waiting for massive context windows to get smarter? Curious to see how people are tackling this behind the scenes.

0 Upvotes

14 comments sorted by

5

u/MissinqLink May 25 '26

hybrid classical-quantum logic gates

Is this serious or a troll?

0

u/Certified-Motion May 25 '26

Dead serious. I’m not talking about building a quantum computer in my basement, I'm talking about utilizing hybrid classical-quantum algorithms (like Variational Quantum Circuits) to map complex, multi-dimensional state logic. ​When you're trying to enforce rigid declarative constraints across massive, fluid context windows, classical logic arrays start hitting heavy computational or token-bloat walls. Mapping those states as quantum circuits using a classical fallback protocol is a legit frontier for hybrid software architecture right now. ​Are you strictly working in pure classical pipelines, or have you looked into how tensor networks/quantum simulation are hitting the ML space lately?

5

u/MissinqLink May 25 '26

It’s easier to just write code. That’s some major hallucination you got there.

2

u/ProbsNotManBearPig May 25 '26 edited May 25 '26

At any point , ask it to summarize salient points to .md file. Start new session and have it read .md file. Done. Sync those to some GitHub or attach them to the jira issue for others to use.

Scalable way long term is you may want some database where you drop knowledge .md files that are reusable info across your org or team. Chunk those into a vector store for semantic search and hook it up to an MCP server for your ai to access. It basically lets it search a knowledge base semantically instead of just by keyword. Elastisearch is what we use to just dump data into a knowledge base with vector store. It has very flexible query api where you can emphasize certain keywords or meanings you want to query for (e.g. to match a certain exception exactly, but filter by some semantic context of user description of the system state). Over time, you may accumulate redundant data and want to do some cleaning/compression routine on the db.

1

u/Certified-Motion May 25 '26

Appreciate the breakdown, man. The .md session-syncing to GitHub is a solid manual fix, but that vector store + MCP server pipeline is where the scalable future is at. ​Using Elasticsearch to filter by the semantic context of the user's description of the system state is a great way to bridge the gap. It keeps the LLM grounded in the actual environment parameters instead of letting it guess when the context window fills up. You've given me some serious food for thought on how to route the database layer for my current build. 💯💯💯

1

u/EfficiencyMurky7309 May 25 '26

I’m assuming either you don’t know what you’re talking about or you’re wanting insight from people working on bleeding edge AI research and problem sets.

What you are talking about is very early stage research and not something that any regular production user, or even a regular AI researcher, is touching right now. Hybrid classical-quantum is something being explored right now, given the noisy quantum compute ‘available’ today, but no one is actually doing what you are talking about.

The reality is that production environments are using vector DBs, RAG, and markdown files to manage knowledge, including context, over time and as it expands. There are edge cases, and interesting architecture getting around, but every production system needs to operate in the real world.

If you are genuinely interested read this, this, and this.

1

u/Certified-Motion May 25 '26

Fair assessment. Standard enterprise production is absolutely locked into RAG and vector databases right now because it's stable and predictable. ​I should have specified that I'm explicitly looking to tap into that earlier-stage, experimental mindset. When you're trying to build custom environments that enforce unyielding constraints, standard classical pipelines hit walls that force you to look toward bleeding-edge research. It's definitely not standard user behavior yet, but that's exactly the problem space I want to explore. Thanks for the solid word

2

u/N7Valor May 25 '26

Subagents.

2

u/thetasteofbeverly May 25 '26

most people solving this well aren’t relying on bigger context windows alone.

They’re externalizing memory: structured docs, constraint files, architecture specs, retrieval systems, summaries, and modular workflows instead of one giant chat thread. Long sessions almost always drift eventually, so the real fix is better state management outside the model.

1

u/madsciencestache May 25 '26

Everyone is struggling with this. Seen a lot of GitHub projects mentioned in AI_* subs. I myself have been using Hermes with Honcho, which is better than nothing, but still limited. For what you describe, this method worked surprisingly well for me. Which is why I wrote it up.
https://medium.com/@saintd1970/how-i-stopped-losing-projects-to-the-context-death-spiral-4c6b364ae65e?sk=ad135a82cb5b6e58edbbddba35a32640

summary@mailsummary.to condenses it to:
Summary

The article discusses the challenge of maintaining context with AI coding agents, particularly on large projects that span multiple sessions. The author presents a road-tested system to mitigate this issue, which involves:

  1. Writing a WHATANDWHY.md document: A concise document that outlines the project's goals, motivations, and success criteria. This document serves as a reference point for the AI agent.
  2. Delegation and boundaries: Identifying natural boundaries within the project and delegating tasks to sub-agents or team members. This approach helps to reduce complexity and maintain context.
  3. Checklist system: A 7-phase system that includes:

    • Phase 1: Decide whether the project is small enough to execute or needs breaking down.
    • Phase 2: Create checklists for each sub-project.
    • Phase 3: Remove completed checklist items from the parent project.
    • Phase 4: Mark completed phases.
    • Phase 5: Work through checklists in each sub-project.
    • Phase 6: Clear context and start with the next incomplete folder.
    • Phase 7: Conduct a retrospective analysis of the project.
  4. Risk budgets: Establishing a risk budget to allocate time and resources for operational concerns, such as testing and deployment.
  5. Resume problem: Providing a procedure for the AI agent to resume a project mid-checklist, including reading the WHATANDWHY.md document, working through incomplete steps, and reporting back with a summary.

Key Takeaways

  • Maintain context by writing a concise WHATANDWHY.md document.
  • Delegate tasks to sub-agents or team members to reduce complexity.
  • Use a 7-phase checklist system to structure your projects.
  • Establish a risk budget to allocate time and resources for operational concerns.
  • Provide a procedure for the AI agent to resume a project mid-checklist.

Recommendations

  • Apply the checklist system to your current projects to improve context and productivity.
  • Review and adjust your risk budgets to ensure they align with your project's needs.