SShortSingh.
Back to feed

Repeated AI Context Rebuilding Costs More Than Forgetting, Developer Argues

0
·2 views

A developer has highlighted a largely overlooked cost in AI-assisted workflows: not just how much context is sent per session, but how many times the same context is rebuilt across tools and sessions. Using Claude and Cursor as examples, the author notes that identical files, decisions, and explanations are re-read and re-billed from scratch every time a new session starts. While vector retrieval can reduce token volume per turn, it does not address repetition — the compounding cost of reconstructing the same project state across multiple tools. The proposed fix is storing persistent context in a graph database exposed via an MCP server, so any compatible AI tool can read shared decision history without re-importing or summarising it manually. The author introduces CognoDB, a thin MCP server with two tools that lets agents query a live graph directly, making the same context addressable from Claude, Cursor, and other MCP-compatible clients simultaneously.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer builds Azure Functions scam-checking agent, finds agentic model fails at orchestration

A developer built a weekend project using Microsoft's Azure Functions hosted skills to verify whether online shops are legitimate, drawing on signals like domain age, HTTPS checks, archive history, and web search results. The tool used two tiers of evidence: keyless verifiable data from RDAP and the Internet Archive, and reputation signals via Tavily web searches targeting Trustpilot and fraud-related queries. The initial version gave the AI model full orchestration control over four verification tools, following standard agentic design patterns. This approach quickly ran into critical failures, including rate limit errors on GPT-4.1 and a context window overflow caused by a single webshop query — even after switching models and increasing capacity. The developer concluded the fix was architectural rather than technical, deciding to move orchestration logic into code and reserve judgment for the model, a pattern he now considers a default starting point.

0
ProgrammingDEV Community ·

Why Copy-Pasting Code Can Be Smarter Than Creating Abstractions Too Soon

Software developers are often taught to follow the DRY (Don't Repeat Yourself) principle, but engineering thinkers like Sandi Metz, Rob Pike, and Kent C. Dodds have argued that premature abstraction can cause more harm than duplication. Metz, in her 2014 RailsConf talk and a 2016 blog post, warned that a wrong abstraction becomes a tangled mess of flags and conditions that grows harder to remove over time. Pike echoed this in Go Proverbs, noting that a little copying is better than introducing an unnecessary dependency between unrelated code. A 2013 MIT PhD thesis by Daniel J. Sturtevant found that high code complexity reduced developer productivity by up to 50% and tripled bug density. The emerging consensus recommends tolerating duplication until a clear, natural pattern emerges across multiple iterations rather than abstracting at the first sign of similarity.

0
ProgrammingDEV Community ·

KPIAssembler Ruby gem uses AI to propose and certify KPIs before publication

A developer has released KPIAssembler, an open-source Ruby gem designed to address flawed metric definitions in data pipelines. The tool inspects a live database schema, uses an AI model such as Google Gemini or a local Ollama instance to propose KPI recipes, and then runs deterministic code-level checks before any metric can be published. Certification requires each candidate query to be read-only, reference existing tables, include tenant scoping where applicable, avoid unconstrained JOINs, and survive both an EXPLAIN check and a sample-period replay. Any KPI that fails these checks is marked as a draft with explicit failure reasons rather than being silently rejected. Schema-based heuristics serve as a fallback if the configured LLM is unavailable, ensuring users always receive metric candidates.

0
ProgrammingDEV Community ·

How a One-Line State Bug Caused Infinite Scroll to Replace Posts Instead of Appending

A developer building infinite scroll in the ICanUp app discovered that newly loaded pages were replacing existing posts rather than appending to them. The root cause was a single assignment statement that overwrote the posts array on every page load, regardless of whether it was an initial fetch or a continuation. The fix required conditional state logic: page 1 sets the list fresh, while subsequent pages spread new results onto the existing array. Additional safeguards — including pagination metadata, duplicate deduplication via Map, and a loading guard — were needed to prevent repeated requests and post-final-page fetches. The case highlights that infinite scroll and traditional pagination share the same data-fetching mechanics but require fundamentally different rules for updating local state.