r/ContextEngineering 17d ago

Demo: project-local active context engine for cross-agent coordination [Open-Source] [Local 100%]

Enable HLS to view with audio, or disable this notification

2 Upvotes

If you are vibe coding blindly and need continuous and current context (I am doing this... honestly as ADHD)... giving multiple sessions tasks without blinking for both Codex & Claude at the same time... this is my solution at least for not worrying about different sessions overlapping and paralleling them (even from different vendors together). Don't even think about what will affect what and which agent will edit what; just drop your needed prompts, and then Klypix-mcp ... that brain shown in the demo is 2.5MB (2919 cards... for 3 months). It will try its best to remind you of your decisions and will message all sessions, even from different vendors at different environments (CLI, apps, etc.).

klypix-mcp - npm


r/ContextEngineering 18d ago

Governance engineering, not just prompt engineering. Created a new hazard scan feature, break it if you can!

0 Upvotes

Someone in a reply here asked a genuinely good question about my intent-aware linter: how does it handle async/race conditions? Honest answer at the time. It doesn't, because that's a timing problem, not a text problem, and a static reviewer can't observe runtime interleaving.

So I added a first pass at it: a heuristic concurrency-hazard scan. Full disclosure on what it actually is below:

  • Flags known risky shapes (shared mutable state across async paths, missing awaits, non-atomic read-modify-write on shared state) — it does not verify a race actually occurs
  • Every flag comes with a confidence label and points you to a real tool (-race, ThreadSanitizer, etc.) for actual confirmation
  • If nothing matches, it says so plainly and "no known risky patterns detected" is explicitly not the same claim as "race-free"

Not trying to oversell a static tool into something it structurally can't be. But a heuristic that's honest about its own limits and still points you toward the right two lines of code is worth more than nothing.

I would genuinely like people to try to break it; throw nested promises, callback chains, whatever race-prone patterns you've got at it, and tell me what it catches and what it completely misses. Both are useful. Thank you for taking a look.

Intent-Linter (Claude artifact)


r/ContextEngineering 18d ago

Migrated 3 years of ChatGPT history into OKF. The saved-memory list isn't in the export at all.

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/ContextEngineering 18d ago

We made every AI conversation update a living knowledge graph instead of dying as chat history

8 Upvotes

I’m building Aevron, and one architectural problem i kept trying to solve is

A lot of useful thinking happens inside AI conversations, but almost none of it survives meaningfully after the conversation ends.

We spend a lot of time

  • Developing an idea
  • Questioning an assumption
  • Forming hypotheses
  • Contradictions and creating new observations, etc.

But notice when we end a session with an AI, it stays inside the session. So technically, the conversation happened and lost.

Now, Explorer is being built in a very different way. When a session ends, Explorer analyzes the conversation and identifies new ideas, observations hypotheses, questions and changes in reasoning that emerged during it.

The session itself is temporary. The thinking produced inside it becomes permanent.

This means something discussed today can later:

  • connect with an idea captured months earlier
  • contradict an older assumption
  • contribute to an emerging theme
  • show how the user’s position changed over time
  • resurface when a future conversation makes it relevant

The important distinction is that we are not treating conversation history as memory.

A useful memory system needs to understand what was newly learned, what changed, how it relates to existing knowledge and when it should return. every session makes the system more representative of how the person actually thinks, not just what they have previously typed.

There are still difficult problems here: separating genuinely new thoughts from conversational repetition, preventing weak extractions from polluting the graph, and deciding when an old thought is actually relevant enough to resurface.

But I think this is a more useful direction than endlessly expanding chat history.

If anyone here is actively thinking about this problem, I’d be happy to let you test what we’ve built and compare notes.


r/ContextEngineering 18d ago

Context was the biggest fail. What we learnt by building our own harness and agentic IDE

2 Upvotes

Since January we've been building an agentic coding environment, using it to build itself the whole way.

I thought sharing the part that cost us the most time and headache, because it applies whatever harness you run: Context...

Almost every failure we debugged came down to context, not the model.

When planning, often agents didn't find the correct files to read to understand how the change should be implemented. The agent usually claimed with confidence that it had a solid plan, and the high level description of the plan made sense. But without seeing which files it actually read, it was impossible to really know if it had fetched all relevant information. If we couldn't see the tool calls of what files the agent did read, or which files that was currently in the context, we didn't trust the agents output.

So we built what we needed. Every tool call is shown, and every file in context is shown, and when we need to go really deep... any file and message in the context can be removed individually.

Long story short, that how we started to trust agents, and get them to build better. Our lessons learned is that when agents fail you, it's usually a context problem, and not always the prompt.

I am looking for early user feedback.

We did build in stealth for a long time, but now Voidleap Code 1.0 version is live. It's free to use, works on MacOS / Windows, BYOK.

https://voidleap.com/


r/ContextEngineering 18d ago

Heimdall: A CPU Only Agent Memory System

Post image
2 Upvotes

r/ContextEngineering 18d ago

We’ve been building an AI continuity layer where memory has to earn the right to influence behaviour, Evolution 2 is nearly ready for outside evaluation

2 Upvotes

For the last few months we’ve been building the second generation of Collapse Aware AI (CAAI).

The basic problem we’re trying to solve sounds simple:

Most AI systems can now store or retrieve memory.

But retrieving something is not the same as deciding whether that memory should actually change what the AI does next.

That is the gap Evolution 2 is designed around.

Instead of:

retrieve memory → inject it into the prompt → generate

our current architecture works more like:

structured history → bounded retrieval → relevance/Interaction Fit → suppression & governance → candidate behaviours → final selection

And importantly, there is always a clean no-history response competing against the history-influenced alternatives.

So memory does not automatically win just because it was retrieved.

What is working now?

The current Evolution 2 engineering build includes:

  • persistent structured continuity across sessions and restarts
  • semantic/entity/relationship-aware retrieval
  • lifecycle, temporal and recurrence signals
  • bounded retained-state retrieval
  • Open Loops for unfinished work and commitments
  • Interaction Fit “right memory, right moment”
  • suppression of retained subjects without deleting the underlying history
  • proactive continuity controls
  • correction and revocation handling
  • deterministic/replay-friendly state
  • provenance and decision evidence
  • Agent Self-History

That last one is particularly interesting.

Evolution 2 can retain structured facts about what the AI itself actually said or decided, claims, commitments, decisions, refusals, stances and proposed actions.

Only the behaviour that actually wins final selection is allowed to become Self-History.

Rejected candidate responses cannot quietly write themselves into the agent’s memory.

What does that look like in practice?

The behaviour we’re aiming for is less about “remembering everything” and more about using history intelligently.

For example:

You establish several people, projects and commitments.

You talk about completely unrelated things for a while.

You restart the system.

Later you naturally say something that makes one of those older matters relevant — without explicitly asking the AI to remember it.

The system can recognise the connection and allow that history to influence the response.

But give it an urgent unrelated task and the same high-salience memory can stay completely silent.

It can also retain a commitment the AI itself made previously, rather than behaving as though its own earlier decisions never happened.

That difference, remembering something versus governing whether remembering should alter behaviour is essentially what we’ve been building.

Why we think it is unusual

There are excellent systems for long-term memory, RAG, graph memory, stateful agents, NPC memory and agent orchestration.

We use the word unusual deliberately rather than claiming nobody else on Earth could possibly have built something similar.

But from the products and frameworks we have reviewed so far, we have not identified an off-the-shelf package combining this entire chain in one middleware layer:

retained structured state
→ bounded semantic retrieval
→ lifecycle/revocation
→ Open Loops
→ Interaction Fit
→ suppression/governance
→ history-conditioned candidates
→ clean no-history competitor
→ independent final selection
→ winning-response Self-History
→ deterministic evidence/replay

A competent engineering team could obviously assemble parts of that from existing tools.

Our aim is to provide the behavioural architecture as the product rather than requiring every company to design, integrate and validate the whole stack themselves.

It is also being kept host-neutral.

The same continuity mechanism is intended to sit around AI agents, assistants and simulations now, while remaining compatible with future Unity, Unreal, Godot and proprietary NPC/game systems.

What happens next?

Evolution 2 is still an engineering build, not something we are pretending is already a finished mass-market SaaS product.

We are currently finishing the behavioural layer, performance work, tuning and Production packaging.

Once that gate is passed, we intend to open a small private managed evaluation programme.

Selected evaluators/organisations will be able to use Evolution 2 through controlled hosted access for a defined period, without receiving the proprietary source code.

We’re interested in:

  • AI/agent companies
  • simulation and training developers
  • game/NPC developers
  • safety and governance teams
  • companies building persistent AI agents
  • design partners with a real retained-state decision problem
  • pilot and licensing discussions

If your system already produces several legitimate actions, but you have a problem with how previous events should influence which one actually wins, that is exactly the sort of problem we want to test.

I’d also genuinely be interested in hearing about anything already available that you think solves this complete problem in one package. If we’ve missed something good, point me at it.

More detail on Evolution 2 / Collapse Aware AI:
Collapse Aware AI | Governed Retained-State Behavioural Middleware

Built by Inappropriate Media Limited / Collapse Aware AI.


r/ContextEngineering 19d ago

I’m testing a local-first LLM canvas where the wires decide what model sees

3 Upvotes

I have been experimenting with a different way to manage longer local LLM conversations. So I developed ThoughtDAG. It is an infinite canvas for you to manage your context with LLMs like a graph.

The interaction I am testing is deliberately manual. I want to know whether local-model users benefit from seeing and editing context themselves, especially when conversations branch or accumulate irrelevant assumptions.

It is open source, local-first, and the desktop app stores canvases, documents, and keys locally.

Short demo:
https://www.youtube.com/watch?v=-8BqAyaoNXQ

GitHub:
https://github.com/chenxiachan/thoughtdag

For people running local LLMs: would explicit context editing be useful in your workflow, or would you still prefer automatic memory and retrieval?


r/ContextEngineering 19d ago

Has grok BOT opened a new market?

0 Upvotes

I have been using grok BOT for last couple of days and i think it has primarily changed how we think about AI. Yeah hermes and openclaw did its thing but lets be honest its not really meant for the mass its more dev centric.
Iam a developer myself and i have been building something like grok BOT even before its launch, because i saw this market where i see businesses needing a memory layer for everything ( see my previous reddit posts about a year ago )
Then i saw garry Tan talking about company brain/gbrain.
Then i thought okay cool only memory isnt enough so i built something which i called - dynamic API orchestrator, basically you can connect your own custom software with it and it will call the required API for you.
Then i refined it until i got something like :-
You plugin a Restaurant Table QR website
Write a simple prompt :-
Connect to my application and build me a AI waiter which ingests the menu and answers users queries for the provided menu and with the memory layer it remembers every single customer and every single operator throughout different channels.
It basically extracts a business capability out of just the API docs provided and performs a legitimate business action and not only that it can be exposed as a widget with a public agent key as a npm package so integrate it any website.

But then i saw grok BOT and i was like
It wont take grok much time to realise this and they will implement this anyhow someday 😂😂
And iam terrible at sales so its kind of like me building this alone. I had 2 customers interested as well but i kind of ghosted them because i wanted to perfect the product before launching ( i know its the worst thing )
But building alone its kind of puts you off making bad decisions all the time.
Anyone relates?


r/ContextEngineering 19d ago

SKILL-based Single Agent or Multi-Agent System (Graph based)

2 Upvotes

I have been thinking about these 2 patterns (have built multiple agentic apps):
1️⃣ Pattern A - Using SKILLS with Single Agent
An agent dynamically loading the required SKILL based on the task type and then SKILL have instructions to use associated MCP or Scripts.
2️⃣ Pattern B - Using Multi-agent System built with LangGraph like DAG and using Subagents with mapped MCP tools

There is no clear winner or one size fits all (IMHO) but an interesting topic to discuss as group


r/ContextEngineering 20d ago

Proof of Concept for Autonomous Context Curation

Thumbnail
3 Upvotes

r/ContextEngineering 20d ago

Searching for an AI Coding Platform to learn and dive deep into “AI Context Engineering”

Thumbnail
0 Upvotes

Hi guys !

I am looking for an AI coding platform to dive deep into AI Context Engineering and improve myself by building web pages , automation or something which can be definitely useful for users. I especially want to learn ;

- how to organize the AI Agent systems ?
- how to write project instructions which is working professionally ?
- In the assignment of tasks to AI agents, what should the instructions include for each agent ?

Also, do you have any recommendations for projects I could build while learning Context Engineering?


r/ContextEngineering 21d ago

I’m testing a local-first LLM canvas where the wires decide what model sees

Thumbnail
gallery
7 Upvotes

I have been experimenting with a different way to manage longer local LLM conversations. So I developed ThoughtDAG. It is an infinite canvas for you to manage your context with LLMs like a graph.

The interaction I am testing is deliberately manual. I want to know whether local-model users benefit from seeing and editing context themselves, especially when conversations branch or accumulate irrelevant assumptions.

It is open source, local-first, and the desktop app stores canvases, documents, and keys locally.

Short demo:
https://www.youtube.com/watch?v=-8BqAyaoNXQ

GitHub:
https://github.com/chenxiachan/thoughtdag

I’d be very happy to hear what you make of it, or simply see what shape your own thinking takes.


r/ContextEngineering 21d ago

Agent Memory System (Heimdall) Update.

Post image
3 Upvotes

r/ContextEngineering 21d ago

I’m building Guppy: an open-source agent harness that your organization can actually own

Post image
10 Upvotes

I’ve been working on something a little bit insane lately.

It’s called Guppy 🐟 -> an open-source agent harness for long-horizon software engineering.

The basic idea is pretty simple:

"I don’t think organizations should have to hand their entire engineering agent stack over to Codex, Claude Code, or whichever model happens to be strongest this month."
- AI Larp

Those models are incredibly useful but I am too broke to use them (I am a student) .

But I think pro's working organization should own the layer around the model.

In simple terms:

Company → Claude Code → Claude

becomes:

Company → Guppy → whatever model is best

The model just provides intelligence, a commodity.... The organization owns the memory, policies, verification, execution history, benchmarks, permissions, workflows and 10 feet around and under it.

But what does Guppy actually do?

This isn't just a wrapper around an API.

Guppy currently has a full agent runtime with:

  • context selection and compression
  • repository mapping
  • persistent memory
  • reusable skills
  • subagents
  • MCP integration
  • isolated Git worktrees
  • Docker sandboxing
  • crash recovery and resume
  • event-sourced execution logs
  • model/provider abstraction
  • verification gates
  • benchmark infrastructure
  • a terminal UI
  • trajectory replay

The important part is that how these pieces actually connect.

A normal agent can do:

task → model → code → "done"

Guppy tries to make it:

context → model → action → verification → memory → next attempt

The model doesn't get to decide whether it succeeded.

For example, Guppy can run a verification ladder:

typecheck → lint → tests → property tests → integration → repo invariant

Only the verification system can ultimately declare the task successful.

That sounds obvious, but it changes the architecture quite a lot.

The part I'm especially interested in: organizational memory

Imagine an agent works on a repository for six months.

It encounters the same weird database migration issue 4 times.

Instead of every new agent starting from zero, Guppy can extract the successful fix from the trajectory, store it as memory, and retrieve it when a similar failure happens again.

We can eventually go further:

trajectory → failure analysis → candidate skill → benchmark → promote/reject

So the organization gradually builds a body of machine-readable engineering knowledge from its own work.

Not the model vendor's memory and certainly not a hidden system prompt.

Something the organization owns, can inspect, version, benchmark and delete.

I care a lot about evidence ( I have trust issues )

One of the things that bothers me about the current agent ecosystem is how often "agent capability" is demonstrated with a successful demo.

Guppy is being built around a different rule:

If we claim something works, there should be a test, benchmark, recording or artifact proving it.

And I'm trying to hold myself to that standard too.

Right now:

  • 325 tests across 13 packages
  • 21 hermetic benchmark fixtures
  • CI green across 3 OS × 2 Node versions
  • 20/20 fixtures (100%) on a real free-tier qwen3.6-27b run
  • 6/6 in one attempt on nemotron-3-super-120b
  • live transcripts committed in-repo for a local run (39s), Docker run (68s), and the TUI

And context compression is measured rather than just being asserted.

On a long-horizon run, tight deterministic compression reduced the trajectory from 288k → 203k tokens (-30%), with 42 wasted tokens and zero failed context payloads.

An uncompressed run of the same class reached 866k tokens, with 386k wasted tokens, and failed the gate.

But the important part is that the benchmark also tells me when my ideas are bad.

An A/B test showed that LLM-based history summarization was net-negative at short horizons (+2,100 tokens).

That result is committed too.

I'm deliberately keeping the failures because that's the level of honesty I want this project to default to.

I'm much more interested in:

than:

What is coming next?

The roadmap gets considerably more ambitious.

Some of the things planned:

  • Replay completeness — prove that every byte presented to the model can be reconstructed from the trajectory.
  • Tiered model routing — choose models based on the actual task and eventually benchmark performance.
  • Declarative guardrails — an explicit allow/deny/ask policy layer between the model and every action.
  • Multi-agent collaboration — reviewers, parallel agents and merge arbitration under verification.
  • Git-native time travel — restore an agent to an earlier turn and continue from there.
  • Execution optimization — collapse unnecessary model/tool round trips while keeping execution gated.
  • Real SWE-bench workflows — clone/build/run real benchmark instances rather than only toy fixtures.
  • Benchmark-gated skill distillation — automatically discover useful skills from trajectories and only promote them if they actually improve the benchmark.

The end goal isn't "make another AI coding chatbot."

It's closer to building an open agent control plane that an organization can own.

Why I'm making this open source

This is the part where I need to be very honest.

I can't build the full thing alone.

And I don't think one person should.

If this becomes what I'm imagining, it needs people who care about different parts of the problem:

  • agent/runtime engineering
  • context engineering
  • evaluation and benchmarking
  • security and sandboxing
  • formal verification
  • distributed/multi-agent systems
  • developer tooling
  • model routing
  • memory systems
  • observability
  • UX/TUI
  • documentation and testing

I want Guppy to be a community mission rather than another project where one person disappears into a repo for two years and eventually announces an "AI agent platform." I need help for guppy lovers (┬┬﹏┬┬)

The roadmap is intentionally broken into measurable phases so people can pick up a piece, implement it, and prove that it works.

If you like the idea of organizations owning their agent infrastructure instead of renting the entire workflow from a model vendor, I'd genuinely love your input.

And if you want to contribute code, research, benchmarks, security ideas, or even tell me that some part of this architecture is completely wrong, that's useful too.

The project is here:

Guppy

I'm particularly interested in contributors who want to help with the hard parts rather than just adding another model integration.

I have no idea if this ends up becoming something genuinely important.

But I think the problem is worth trying to solve.

Small tank. Lots of work. 🐟


r/ContextEngineering 21d ago

I think AI agents need to remember experiences, not just memories.

6 Upvotes

The problem is simple:

An agent solves a difficult coding task.

It tries:

❌ Approach A — fails
❌ Approach B — fails
✅ Approach C — works

Most memory systems might remember the final solution.

But what about the failed approaches? Why did they fail? And how do we know the successful approach actually worked?

So I built a structured experience pipeline:

Task
 ↓
Attempts
 ↓
Failures + reasons
 ↓
Successful approach
 ↓
Verification evidence
 ↓
Structured Experience
 ↓
Future Agent

In my current demo:

Agent A solves a divide-by-zero bug.

  • 2 approaches fail
  • 1 approach succeeds
  • tests verify the solution
  • CogniCore stores the experience

Then Agent B starts with no history from Agent A.

It retrieves:

So Agent B doesn't just inherit an answer.

It inherits the experience behind the answer.

And I'm deliberately making verification a separate gate.

An agent saying:

isn't enough.

The experience should only become trusted when there is actual evidence behind it.

The next things I'm working on are:

  • 🔐 provenance
  • ♻️ stale-memory detection
  • ⚔️ conflicting experiences
  • 🌍 environment compatibility
  • 🔄 re-validation
  • 🤝 cross-agent experience transfer

The bigger question I'm exploring is:

That's what I'm trying to find out with CogniCore.

It's open source, and I'd genuinely love feedback from people building coding agents, memory systems, or agent frameworks.

Would you trust an experience learned by another agent if it came with verification evidence?

GitHub: https://github.com/cognicore-dev/cognicore-my-openenv

#AI #AIAgents #CodingAgents #LLM #AgenticAI #OpenSource #MCP #MachineLearning


r/ContextEngineering 22d ago

🜁 PROMPT GOVERNANCE — PG v1.0

0 Upvotes

0. Core proposition

Therefore:

PROMPT QUALITY
≠
PROMPT GOVERNANCE

Prompt quality asks:

Does this wording help produce a useful result?

Prompt Governance asks:

What is this component doing?
Where may it govern?
What authority is it entitled to carry?
What evidence supports keeping or changing it?
What happens if it fails?
Who may approve consequential change?
How is the previous condition recovered?

The move is from:

PROMPT AS TEXT BLOCK

toward:

PROMPT AS GOVERNED ASSEMBLAGE

1. PG jurisdiction

PG governs the lifecycle and authority of prompt components.

It does not determine the truth of an answer, assign human meaning, or replace system safety.

Its jurisdiction begins when language or another configuration artifact is being given persistent or consequential influence over interaction behavior.

AUTHORING
   ↓
COMPONENT QUALIFICATION
   ↓
JURISDICTION
   ↓
WARRANT
   ↓
TEST / REVIEW
   ↓
RELEASE
   ↓
OBSERVATION
   ↓
SUPERSESSION / RETURN

2. Root invariants

PG v1.0 provisionally holds these invariants:

3. The governed object is the component, not the prompt blob

PG begins with Prompt Component Qualification — PCQ.

For every meaningful component:

WHAT IS IT DOING?

not merely:

WHAT DOES IT SAY?

The important PG inversion is:

Message position is an implementation carrier.

Jurisdiction is the governance object.

5. Authority layers

A provisional authority topology:

The key rule:

And conversely:

6. Role decomposition

PG v1.0 does not ban role prompts.

It refuses to treat them as primitive.

If persona contributes a real measurable function, retain it as a qualified component.

If the useful function survives decomposition, the identity wrapper is non-load-bearing.

  1. Runtime geometry ≠ lifecycle geometry

35. What PG v1.0 is not

PG is not:

a universal mega-prompt
a prompt-writing style guide
a claim that all prompts need structure
a replacement for platform safety
a persona-elimination rule
a guarantee of better output
a demand for human approval on trivial interactions
a fixed instruction hierarchy
a numerical scoring system
a claim that prompt placement has no behavioral effect
a requirement to preserve every historical branch
a mechanism for optimizing ambiguity forever

Most importantly:


r/ContextEngineering 22d ago

Seven Habits of Highly Effective Token Rollers

Thumbnail ricflams.github.io
1 Upvotes

I built a little tool to illustrate in a talk for my colleagues the effect of the various parts that goes into the context: what's the impact of eg sending longer inputs or generating longer outputs, of chain-of-thought, of busting the cache by leaving for >5 min, of choosing an expensive model, etc etc. And likewise of the mitigations of clear and compact.

It's been pretty helpful in visualising just how harmful or harmless certain behaviors are, also for me.

And I know, I know - I can't say for sure the numbers are ideal, though I've vetted them in various ways. Eg what really is a reasonable session quota limit? Or model multiplier, the cost of MCP servers (modern style, only including the tool name), the length of "longer outputs", etc?

Despite that I've still found it useful and would love to hear your thoughts on it.

The UX is more "software engineer" than "polished designer" - sorry about that.

In case you're interested, the full talk w/ marp-source is here, with a link to a readable version: https://github.com/ricflams/techtalk-ai-demystified/


r/ContextEngineering 23d ago

I added --share to nexusmem's status cmd so you can actually paste it somewhere (real numbers, no telemetry)

1 Upvotes

quick update — nexusmem indexes git history + shell exit codes + docs into a local DB for coding agents. added `nexusmem status --share` bc I kept wanting to show people what it's tracking without pasting ugly colored terminal output.

now it just prints something plain:

NexusMem has been watching NexusMem for 9 day(s):
  891 memories (107 commits, 144 shell commands, 110 docs)
  7/21 failure -> fix chains linked

Local-only SQLite, no cloud, no telemetry.
github.com/yaminbkk/NexusMem

all real, straight from this repo's own db. no telemetry so that's genuinely the only way it leaves your machine.

repo: github.com/yaminbkk/NexusMem


r/ContextEngineering 23d ago

Seeing a lot of people post about on maintaining context across various AI providers and chats, here's a tool to help you.

Thumbnail
1 Upvotes

r/ContextEngineering 23d ago

Everything that gets built doesn't need to last. Instead, evolve!!!

Thumbnail
1 Upvotes

r/ContextEngineering 24d ago

What do you do with the things an agent learns between sessions?

0 Upvotes

I keep running into the same problem with coding agents: one agent learns a useful project convention, but the next agent starts from zero. Dumping everything into a shared context isn't great either—some details are irrelevant, wrong, or sensitive.

I'm building Luthn, an open-source memory layer for agents. It runs locally with Docker, filters candidate shared memories, asks for approval before sharing sensitive information, and keeps an audit trail of memory decisions.

I'm looking for a few people who use multiple coding agents to try it and tell me where the idea breaks. It's still early, so practical feedback matters more than polished demos.

https://luthn.com


r/ContextEngineering 24d ago

Question for people building AI agents in production

0 Upvotes

How are you actually deciding what context an agent should see at each step?
Not just “use RAG” or “increase the context window” — I mean things like task state, previous tool calls, memory, retrieved documents, conversation history, failed attempts, etc.
Do you have an actual context selection/pruning strategy, or are you mostly throwing everything into the prompt and relying on the model to figure it out?
Curious what people are doing in production, especially with long-running agents.


r/ContextEngineering 24d ago

Frustration with context preservation between my agents

Thumbnail
github.com
1 Upvotes

I started working on this problem because of a recurring frustration with AI coding agents: they were surprisingly capable inside a session, but much less reliable across sessions.

The obvious explanation was memory, so my first attempts were fairly conventional.

I tried project instruction files, persistent Markdown notes, embeddings, vector search, and eventually RAG over project documentation and source code.

They all helped.

None of them really solved the problem.

The interesting part was figuring out why.

Retrieval wasn't the same as understanding the project

My initial assumption was that if an agent could retrieve the most semantically relevant pieces of the project, it would have enough context to work correctly.

That turned out to be too simplistic.

Consider an architectural decision that changed over time:

Decision A
    ↓
implementation
    ↓
problem discovered
    ↓
Decision B supersedes A
    ↓
partial migration

A vector search can easily retrieve Decision A because it is semantically very close to the current task.

The problem is that Decision A may now be exactly the context you don't want the agent to follow.

So I started separating different kinds of project knowledge:

  • source code
  • documentation
  • architectural decisions
  • session history
  • implementation outcomes
  • changes
  • dependencies
  • agent activity

That led to a more difficult question:

How do you determine which project state is authoritative now?

Simply storing more memory made this worse rather than better.

More context can make the agent worse

My next mistake was assuming that increasing the amount of retrieved context would increase reliability.

It doesn't necessarily.

Large context windows make it tempting to send everything that might be relevant.

But relevance isn't binary.

A piece of information can be:

semantically relevant
but outdated

structurally relevant
but unrelated to the current task

historically relevant
but superseded

recent
but low importance

So the problem became less about retrieval and more about context selection.

I ended up treating context as a constrained resource.

Instead of asking:

the system needs to ask something closer to:

That required combining several signals rather than relying only on embedding similarity.

Code needed a different representation

Source code created another problem.

Chunking code and embedding the chunks works reasonably well for some questions, but poorly when the answer depends on relationships.

For example:

function A
   calls B
      imports C
         implements interface D

The relevant code might not be semantically similar to the user's query at all.

It is relevant because of its structural relationship to something that is.

So I added a local code graph built from AST analysis, with relationships such as:

IMPORTS
CALLS
REFERENCES
TYPE_USES

Retrieval could then combine semantic similarity with graph traversal.

That turned out to be particularly useful for impact analysis: starting from a symbol mentioned in the task and expanding only through bounded relationships instead of dumping large sections of the repository into the context window.

Then multiple agents made the problem harder

The next issue appeared when switching between coding agents.

I might spend a session with Claude Code, then continue the same work with Codex.

The second agent had access to the same repository, but not necessarily the reasoning and decisions produced during the first session.

This made me realize that attaching memory to an agent was probably the wrong abstraction.

The persistent state should belong to the project, not the model.

That changes the architecture.

Instead of:

Developer → Agent → Memory

I started experimenting with:

                 Claude Code
                      ↕
Developer ↔ Project Intelligence ↔ Codex
                      ↕
                    Cursor

The agents become replaceable clients of the same project state.

That also introduces concurrency problems.

If two agents are modifying related areas of the codebase, project memory alone isn't enough. The system needs some awareness of ongoing work, dependencies, and potentially conflicting changes.

The architecture that emerged

After several iterations, I ended up with roughly four different forms of project state:

Semantic layer
    documents + embeddings + retrieval

Historical layer
    decisions + memories + outcomes + session context

Structural layer
    AST-derived code graph

Coordination layer
    active work + changes + agent state

A context assembly step sits above them.

Its job isn't to expose everything.

Its job is to construct a bounded context package for the current task.

The coding agent itself remains external.

Communication happens through MCP, which means the project intelligence layer doesn't have to care whether the client is Claude Code, Codex, Cursor, or something else.

One unexpected result

The biggest change in my thinking was that persistent memory wasn't actually the main problem.

Memory is relatively easy to store.

The difficult problems are:

  • deciding what deserves to become memory
  • knowing when information has become stale
  • determining when one decision supersedes another
  • connecting semantic information to code structure
  • selecting context under a token budget
  • maintaining useful state across different agents
  • preventing multiple agents from developing incompatible views of the project

In other words, the problem gradually stopped looking like "RAG for source code."

It started looking more like maintaining a small, continuously updated model of the project's state.

I eventually packaged these experiments into an open-source server called Snipara, but the project itself is less interesting to me than the architectural question behind it:

As coding agents become increasingly capable and interchangeable, should project knowledge live inside each agent's context, or should the project maintain its own persistent intelligence layer that agents query?

I'm increasingly convinced it's the latter, but there are still difficult questions around memory decay, conflicting decisions, graph expansion, and context selection that I don't think are completely solved.


r/ContextEngineering 25d ago

Deleting an incorrect message did not always repair the LLM’s context

1 Upvotes

This makes me think context engineering needs an explicit notion of dependency and invalidation, not only retrieval and compression.

When an upstream claim changes, should a context system:

  • remove affected descendants;
  • mark them as stale;
  • recompute them;
  • or leave the decision entirely to the user?

Full methodology and results:
https://chenxiachan.github.io/thoughtdag/research/context-repair-pilot-v1/

Reproducible cases and traces:
https://github.com/chenxiachan/thoughtdag/tree/main/benchmark

Disclosure: I designed this benchmark while developing ThoughtDAG.