r/ContextEngineering • • 3h ago

Does your context compression survive the prompt cache? I built a deterministic compressor for Claude Code and Codex

0 Upvotes

Context question first, repo at the end.

We spent a while compressing coding-agent context and hit something that isn't obvious until you look at a bill: on agent traffic about 93% of input tokens are cache reads, at roughly a tenth of the fresh price. So if your compressor turns the same tool output into slightly different bytes next turn, the prefix is dead and the whole conversation gets re-priced. You compress harder and pay more.

That one fact decided everything else for us.

What we ended up with

Same input, same bytes, every turn. No clock, no randomness, and it never looks at the rest of the conversation. Scoring a tool result against the question that prompted it does compress better - and it also compresses differently on every turn that result survives into. We gave that up on purpose.

It de-duplicates, it doesn't summarise. The model always keeps at least one real copy of every distinct line. Repeats fold into a marker like [×37 ref:k_Qm9v…]. The handle is a hash of the content that was removed, so the same fragment gets the same handle on any machine, in any later run. The proxy hands the model a retrieve tool and runs that tool itself, so it works even if your client has never heard of us.

Only machine-generated tool output over ~512 chars. System, developer and assistant messages are never touched, and neither are blocks carrying cache breakpoints.

No ML in the request path. Detection is fifteen rules in order over the first megabyte, and source code goes through nine tree-sitter grammars compiled into the binary. Nothing gets downloaded at runtime, nothing varies between machines.

Fails open. If the result isn't smaller it gets thrown away, and any error forwards the request unchanged.

What it bought

All measured on real provider bills with the cache discount already in, not on removed tokens priced at list rate.

Codex on GPT-5.5, Terminal-Bench 2.1, per run over the 87 tasks every arm finished: 62.8% of eligible tool output removed in a replay of 6,255 real outputs (34.2M chars), $107.89 -> $83.40, input 96.1M -> 72.2M tokens, solve rate 82.2% -> 81.1% (not statistically significant). Requests over 200K tokens went from 1.9% to 0.13%, and that mattered to me more than the money.

Claude Code on Opus 5.5 turned out to be a different problem, and this is the part I'd like this sub's take on. It marks its conversation with explicit cache breakpoints, so 92-95% of billed prompt is already cache reads and there's barely anything left to compress - tail-only compression removes 4.7-8.0% of what the engine even sees. But a cache write there costs 25x a read, and a default entry lives five minutes. A training run or a long build idles past that, and when the agent comes back the whole prefix gets written again at full price: 927K tokens per run.

So compression stopped being the thing to fix. We keep the entry alive instead - re-send the last request body every 4.5 minutes with max_tokens: 1, stop at the agent's next request or after 11 pings. Tokens lost to cache expiry dropped 99%, the Anthropic bill fell 20% ($35.35 -> $28.30 per run, solve rate 89.9% -> 90.6%), and that one mechanism was worth about 11% of it. Adaptive one-hour TTL on top: always using 1h entries actually cost 2.3% more, switching only after a conversation's first long idle gap saved 7.7%.

Where it does nothing. Short reasoning tasks. The median output there is 270 chars, under our floor, and the bill moved 8%. Prose is left whole on purpose. The wins sit in ML training, builds from source and data pipelines.

One thing worth knowing if you measure this yourself: gross removal over-counts badly, because every turn re-compresses the same growing history and credits the same bytes again. And every retrieval puts the fragment back in the prompt, so net savings can go negative.

MIT, one Rust binary. kompressor wrap codex, kompressor wrap claude, or kompressor serve for anything speaking the OpenAI or Anthropic API:

https://github.com/hystax/optscale-kompressor

Write-ups with the task-by-task tables:

Codex: https://optscale.ai/blog/context-compression-coding-agents

Claude Code: https://optscale.ai/blog/claude-code-prompt-caching

What I'm curious about: is anyone here compressing query-aware, and have you checked what it does to your cache hit rate? That's the tradeoff I keep going back and forth on.

And if it turns out useful on your setup, stars are welcome.


r/ContextEngineering • • 5h ago

We str8 up made a memory for.my.agent from scratch tonight that uses minimal tokens

Thumbnail reddit.com
1 Upvotes

Here's your post, brother — technology only, nothing personal. Copy-paste ready:

---

We rebuilt my Muse's memory from scratch tonight — here's what we did.

Like a lot of you, my agent's memory had grown into big markdown files that ate ~18,000 tokens of context every session. So we rebuilt it as a tiered system:

1. Atomization. We broke the entire memory into 1,073 indivisible claims ("atoms") — every fact, rule, and decision as its own line, each one typed (rule / fact / decision / state) and tagged by certainty: ground truth, inferred, or hypothesis.

2. Tiering. A small always-on core (~2,900 tokens: identity, hard rules, current state, routing index), warm entity files loaded on demand (people, projects, systems), and cold episodic logs behind them.

3. Proof, not trust. Two independent audits then checked every single atom against the text that claims to carry it. Anything weakened, narrowed, or missing got flagged and fixed with the original wording restored. Final score: 1,073 atoms, zero lost.

4. Lineage. Every atom now has a hard edge in a provenance database (1,234 edges) back to the exact file carrying it. If any future edit drops a fact, an automated gate fails the change.

5. It maintains itself. A nightly "dreaming" pass folds each day's new facts into the tree — deduped, typed, cited, validated, committed. A separate nightly research pass scans Anthropic's publications, arXiv, GitHub, and the agent communities for new memory techniques — but nothing it finds gets adopted without my explicit approval.

The design draws on the current frontier: Anthropic's agent-memory and Dreaming work, SoMem, MEMOIR, Letta's MemFS, and decision-context research.

Result: always-on context cut by more than half, every fact accounted for, and a memory that consolidates itself while I sleep. Next up: decision-point rule injection and an outcome ledger, so the agent grades its own rules against real results.

Happy to answer questions on the build.


r/ContextEngineering • • 12h ago

I built a memory for AI coding tools that notices when it's out of date, and now teams can share it

Thumbnail
reddit.com
3 Upvotes

r/ContextEngineering • • 11h ago

We’ve built RAG chatbots on both Pinecone and pgvector. Here’s when each one actually wins.

Thumbnail reddit.com
2 Upvotes

r/ContextEngineering • • 16h ago

Building a "Flight Recorder" pattern for AI Agents: Logging execution without polluting context⁠

Thumbnail
reddit.com
2 Upvotes

r/ContextEngineering • • 22h ago

Claude Code skill: better memory than /compact, 85% fewer tokens

2 Upvotes

It annoyed me that in bigger projects Claude slowly stopped following my project rules, even with handoffs and CLAUDE.md, and key facts got lost over time. So I made a skill that keeps track of them automatically.

Compared to /compact and handoffs it remembers more and uses way fewer tokens.

https://github.com/adamoelz/gemkeeper

Would be cool if you check it out.


r/ContextEngineering • • 1d ago

Most of the memory eval leaderboards are inaccurate.

Thumbnail
reddit.com
2 Upvotes

r/ContextEngineering • • 1d ago

REQL update: faster context retrieval and fewer tokens for coding agents

3 Upvotes

Hey everyone!

I’ve updated REQL, my open-source tool that helps AI coding agents navigate repositories and preserve working context across sessions.

This release focuses on faster context retrieval and lower token usage. I’ve reduced repeated work during retrieval and trimmed redundant information sent to the agent. Performance gains and token savings depend on the repository and workflow, so I’m not claiming a universal percentage.

If you’re new to REQL, it builds a local graph from your code and documentation: functions, classes, dependencies, calls, and other relationships. Agents can query that graph for context relevant to a specific change, including precise source references and related tests. REQL reuses indexed context and supports incremental updates as the repository changes.

What can you use it for?

  • Waste fewer tokens on repeated exploration: retrieve focused source excerpts and relevant relationships, and reuse indexed context and saved work. This helps reduce repeated searches, unnecessary file reads, and redundant information in the agent’s context.

  • Coordinate work across chats and agents: keep tasks, decisions, blockers, and next steps in a shared project workspace. Another chat or agent using that workspace can recover the recorded state and continue from there.

  • Keep complex tasks on track: record prerequisites, constraints, failed approaches, and checkpoints. Preserve what has been completed, what remains unresolved, and why earlier decisions were made across sessions.

  • Understand unfamiliar code: identify entry points, component responsibilities, and relationships between parts of the application, with references back to the source.

  • Plan changes and refactoring: inspect callers, dependencies, and related tests to identify code that may be affected and decide what needs verification.

  • Review cleanup candidates: find potentially unused imports, variables, functions, and classes, then inspect the supporting evidence before removing them.

REQL provides a CLI, Python API, and MCP server, plus installable instructions for coding agents such as Codex and Claude Code.

REQL runs locally, with no account, external graph database, or mandatory LLM calls. The graph and saved work support the agent’s decisions; current source code and tests remain authoritative.

I’d like to hear from others using coding agents: what do you keep having to explain again when you start a new chat? The code structure, previous decisions, what has already been tried, or what still needs doing? Concrete examples would help me decide what to improve next.


r/ContextEngineering • • 2d ago

Building an AI platform with a small team has been quite a journey.

Thumbnail
reddit.com
3 Upvotes

r/ContextEngineering • • 3d ago

Universal Code Intelligence & SDLC RAG Service for AI Agents

Thumbnail
reddit.com
1 Upvotes

r/ContextEngineering • • 3d ago

Want to learn more about memory management in Agent

Thumbnail reddit.com
1 Upvotes

r/ContextEngineering • • 3d ago

A user tested my AI platform and caught an interesting problem.

Thumbnail
reddit.com
0 Upvotes

r/ContextEngineering • • 3d ago

I'm opening my personal-context librarian to 10 testers. What would you use a shared agent memory for?

0 Upvotes

A while ago I posted here about a librarian for my personal context, and a few of you asked to try it.

I built it, it's called Zenod, and you can try it today.

What it does: it keeps what you learn and what's true about you as plain Markdown in your own GitHub repo or Google Drive. Claude, ChatGPT, Cursor or any MCP client read and write the same memory.

What I'm asking: use it for real for a few weeks and tell me what breaks.

What you get: one free month, no card. I was going to pick testers by hand, then realised I'm the slowest part of this, so the first ten who apply are in straight away.

Apply here: https://zenod.dev/testers?s=P-0146

How are you going to be using it?


r/ContextEngineering • • 4d ago

Finally introduced coding subagents to my harness

Post image
2 Upvotes

I was running several primary agents in parallel across multiple projects and the notifications were burying me. Every agent stopped to ask me something: "X or Y?", "found a side issue, fix now or later?" etc. I had become the bottleneck. my AGENTS.md cover many conventions/rules/standards but its still wasn't enough to cover so many of these questions.

So I restructured my workflow like a team:

  • Me: the manager

  • One chat per project: the team lead

  • The other agents: team members, each working in its own "lane"

How lanes work

  • A lane is a git worktree plus a chat working inside it. Each one gets its own branch and folder, so agents don't trample each other's files.

  • The lead asks to open a lane with a title, a plan, and the files it expects to touch. Nothing starts until I approve it on a Lanes board. Before I approve, the harness checks for overlap with files other open lanes are touching, my plan usage, machine load, and whether a spec exists for the work.

  • When a team member stops (it's done, blocked, or has a question), it rings the lead, not me. The lead works through its inbox and replies.

  • The lead can only answer from written rules: a lead.md file in the project plus the project's docs, and it has to cite the rule it used. If no rule covers the question, or it's a taste/preference call, it escalates to me.

  • Escalations land on the board and on my phone as numbered questions, each with a recommended answer. I can answer straight away or ask the lead a follow-up first.

  • The lead can also send me FYI notes that don't need an answer.

I still have full control

Every lane is a normal chat. I can open any of them, read the whole transcript, and type into it directly if I want to step in. The harness never merges a branch, deletes a branch, or removes a worktree on its own.

My notifications are now mostly things that actually need me. It's still early, and I keep refining what goes into lead.md, since that file decides how much the lead can handle without me.

So far I have noticed I am getting a lot more done with less headaches. (literally!)


r/ContextEngineering • • 5d ago

Every request pastes your whole AGENTS.md into the prompt. Mine grew until the agent started butchering it

0 Upvotes

If you use Codex or Claude Code, you have a context file — AGENTS.md, CLAUDE.md, .cursor/rules. It gets injected into every single request, so it's both a token cost and a permanent tax on how much room the model has left for your actual work.

Mine grew the way these files always grow: one justified-looking addition at a time. Then it hit a size where the agent started dealing with it by rewriting the file from memory, dropping the ## Never rules, and shipping something worse. You find out weeks later when a rule stops being followed.

So I wrote ctxcap. It counts tokens across those files, tracks the count against a committed git baseline, and flags references that no longer point at anything. Offline, no API key, no network, no LLM, two dependencies. MIT.

bash

The part that makes it more than a word count: it doesn't tell the agent "make this shorter." It emits line ranges with a preserve list, the agent splices by line number, and --verify catches drift or a cut preserved span. When the budget can't be met it returns satisfiable: false with the minimum achievable rather than shaving a rule that matters:

It uses gpt-tokenizer, and there's an MCP server so the agent can measure itself, plus a GitHub Action that comments the token delta on PRs and only fails when you set a budget.

https://github.com/Naeha-S/ctxcap

The question I actually want answered: how long is your AGENTS.md, and what's still in it that earns its place? Mine is the one file where every addition felt reasonable at the time.


r/ContextEngineering • • 6d ago

Context Needs Its Iceberg Moment

Thumbnail
contextandchaos.substack.com
5 Upvotes

Iceberg for data. ???? for context.


r/ContextEngineering • • 5d ago

I built an MCP bridge so another AI agent can pick up a saved task

Post image
1 Upvotes

A bit more detail on the task-claim mechanism:

Each task has a revision and an owner identified by agent and session. A claim starts a SQLite write transaction, checks the expected revision and confirms the task is ready and unclaimed. A successful change increments the revision.

If two AI agents try to claim from the same revision, the first successful claim changes that state. The other request has to reread the task rather than continue with stale information.

A handoff saves the summary and next steps, then releases ownership. The Markdown task board is generated from the database. If someone edits a generated view, the bridge preserves the file and returns a warning.

The task transaction commits before Markdown refresh, so AI agents use the task tool for authoritative state. These checks don't lock source files or start another AI agent. Automatic lease expiry for abandoned claims isn't implemented yet.


r/ContextEngineering • • 6d ago

I made a thing: Kit, UX-forward memory for your AI tools that lives on your Mac (free beta, looking for feedback)

4 Upvotes

Hi everyone,

I've been lurking and commenting here for a bit, and this is my first time posting something of my own, so go easy on me 😅 (or don’t, honestly, that’s kind of the point).

What is Kit?
Kit is a UX-forward memory layer for your AI tools that stays on your Mac and that you control. It is in beta, currently Mac only. The goal is to give all people, not just engineers and developers (Who are comfortable in the command line) the ability to control their memory and context. Kit wants to help people retain sovereignty over their memory so that it doesn't get used to build a moat for the frontier providers, locking you into a provider and losing control of your data. For this reason the personal version will always be free. And that's the reason for the UX, and the app that get's installed, it give s UI, a menu bar icon, etc.

Your memories in Kit live in a database on your Mac. There’s no Kit cloud based server holding them. To reason, dream and speak Kit needs an LLM that you choose (local or cloud) during setup. If you’d rather nothing leave your machine, there’s a "Local only" mode in settings.

The problem Kit is trying to solve
The AI tools we all use start from basically zero with each new session. We explain the project, our preferences, how we work and what we decided last week, we get some work done and then when we start a new session, or switch from Claude to Cursor to Codex, we lose all of that context and do it all over again. The memory features that do exist in the frontier harnesses like Claude Code and Codex are mostly black boxes, with the data saved on a provider's server. You can’t see what they keep, fix what they got wrong, or most importantly, take it with you.

In practice what Kit can do...

Easily connect your tools to Kit
Anything that speaks MCP (Claude, Claude Code, Codex, Cursor, etc.) can plug in (through the UI, no need to edit .md files or MCP connections unless you want to), so they all share the same context about you and your work.

You can see Kit
There’s a proper UI where you can browse what Kit remembers, see where each memory came from, and correct or delete things. We put a lot of work into making this not feel like staring at a database.

Kit treats sources as sacred
Kit doesn’t only store summaries. It holds a link to the source material used to create the memory, so when a memory is wrong you can trace it back and validate it.

You own your Kit
Your memory, under your control, not locked inside one vendor’s chat app. You can export it to a standard JSON format and import it into another system, there is no lock-in.

Kit "dreams"
At night, on a configurable schedule, Kit runs through a consolidation cycle (we call it dreaming) that forms new memories, makes links between important things, forgets unimportant things, works out conflicts between memories, resolves them, and tests its memory continuity.

Where Kit is at
It’s in beta. Right now, it's Mac only. It works and we use it every day, but there are some rough edges, and that’s why I’m posting. The small beta fleet has given us as much feedback as they can, and we need more diverse users, with more diverse workloads to bring up more edge cases.

What Kit needs from you guys
Try it and tell me what’s confusing, what breaks, and what you’d actually want from AI memory (and hopefully what you like about it too). Honest, even brutal feedback is welcome. I'd prefer to hear “this onboarding made no sense” now, rather than find out later. We are a small team (pretty much just me on product), so if you do find a bug, I will do my best to fix it, but it might take a day or two. We will hopefully be looking to build the team in future, so there is that too.

Get the Kit beta here: https://www.kit-project.com (there is a prompt you can point your agent at if you want them to evaluate it for you)

Read more about it and engage with us on our sub r/KitProject

I'm happy to answer anything in the comments or over on our sub (keep in mind, I am on a European time zone so might take a while to get back to US-based queries depending on when they happen). If you want more details on how it works under the hood, privacy, what’s next, why we didn’t just use "X" or "Y" (.md files, obsidian, etc) get in touch.

I am very interested to hear everyone's perspectives on Kit and the context engineering/memory space in general.

Below are a few screenshots of my local test Kit, named "Falcor", you can name your kit anything you want.

Ciao, Peter

Kit Website


r/ContextEngineering • • 7d ago

Working on a memory infrastructure for some time. we score > 99% in recall

10 Upvotes

Been working on a memory & context infrastructure for almost a year now. Most of my time went on research. A few things I would like to share.

There are dozens of memory management tools available today that you can setup locally with just a prompt. Pretty cool but the are scattered. Segmented. They solve the memory and retrieval problems but they solve specific issues and one is better than the other in a particular metric.

If you are a builder or developer, these work perfectly fine for you. However, not all of them cover decay, contradictions, etc. And most of the time it is not what to add but what NOT to add to your memory layer.

For eg, "HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Models" https://www.alphaxiv.org/abs/2405.14831

In this paper, The graph is a reranking and expansion mechanism over the knowledge, not a second source leg.

Below are some more papers that you can read.

┌───────────────────────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────────────────┐
│ Work                              │ ID                                               │ Role                                            │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Mem0                              │ 2504.19413                                       │ write-ops baseline                              │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Zep                               │ 2501.13956                                       │ temporal KG invalidation — bi-temporal rejected │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ STALE                             │ 2605.06527                                       │ implicit conflict = field-wide failure          │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ MOSAIC                            │ 2607.16211                                       │ LLM off retrieval path — validates split        │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ A-MEM                             │ 2502.12110                                       │ memory evolution — rejected                     │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ HippoRAG                          │ 2405.14831                                       │ PPR graph leg (shadow)                          │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ MemoryBank                        │ 2305.10250                                       │ Ebbinghaus decay                                │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Generative Agents                 │ 2304.03442                                       │ relevance+recency+importance                    │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ MemGPT                            │ 2310.08560                                       │ tiers/paging — rejected                         │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ LongMemEval                       │ 2410.10813 / 2504.19413-adjacent; V2 W7161017814 │ eval taxonomy                                   │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ LoCoMo                            │ 2402.17753                                       │ eval scenarios                                  │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ AgentPoison                       │ DOI 10.52202/079017-4136                         │ poisoning threat model                          │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Sleeper Memory Poisoning          │ 2605.15338                                       │ why quarantine never purges                     │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ MemPoison                         │ 2605.29960                                       │ write-gate bypass                               │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Memory Injection Attacks          │ DOI 10.52202/085713-1554                         │ query-only injection                            │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Memory mechanisms survey          │ DOI 10.1145/3748302                              │ field taxonomy                                  │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Salience/Ranking/Metabolism       │ DOI 10.5281/zenodo.23068930                      │ confidence/importance conflation (preprint)     │
├───────────────────────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ Scored Before the Question Exists │ DOI 10.5281/zenodo.22868531                      │ write-time importance (preprint)                │
└───────────────────────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────────────────┘

The thing is, if you want a memory solutions for your product/services, there are only a handful of them that actually solves that. Of course, for devs with 20$ claude subscription, who wants to use any opensource memory solution, can absolutely go ahead and build their own memory layer. But I believe we need solutions that works out of box, across domains, not just limited to memory or knowledge work.

So, I started working on this. The idea came from Supermemory. But my vision goes beyond just text or vision memory. AI is evolving everyday and they have started to go beyond just chat agents. A memory infrastructure should work across domain & dimensions. That's my goal and I'm still building everyday.

I am bootstrapped right now so not sure if I can sustain this and continue working for long. I have launched some paid plans for now in case someone wants to help me build this for the world and take this project forward.


r/ContextEngineering • • 6d ago

95% of tokens consumed by unharnessed (or minimally harnessed) models are wasted if the model doesn't find a true vuln ***within the first few minutes***

Thumbnail
reddit.com
2 Upvotes

r/ContextEngineering • • 6d ago

Architectural Gravity – Cross-Model Agent Control Language

Thumbnail
github.com
1 Upvotes

Architectural Gravity explores a problem in LLM-agent workflows: how much model effort is spent reconstructing task structure from natural-language instructions rather than reasoning about and executing the task itself?

The project centers on ArcGrav, a prompt-native, cross-model Agent Control Language for expressing context, constraints, priorities, references, and operations using familiar structural conventions.

Expected improvements include:

  • Token Efficiency: Reduced token consumption and agentic costs

  • Interpretive Precision: Less ambiguity in instruction interpretation

  • Execution Consistency: Fewer mistakes and reduced scope overstepping

  • Context Retention: Reduced drift and improved reasoning continuity across context windows

  • Workflow Efficiency: Faster prompt responses and increased execution throughput

The following intentionally elaborate example demonstrates several of ArcGrav's capabilities through a Unicode character assembly task:

[Blueprint]:
"""
Char_01: U+0048
Char_02: U+0065
Char_03: U+006C
Char_04: U+006C
Char_05: U+006F
Char_06: U+0020
Char_07: U+0057
Char_08: U+006F
Char_09: U+0072
Char_10: U+006C
Char_11: U+0064
Char_12: U+0021
"""

[CharacterFactory]:
- `value`
=> Create a fresh record whose `value` is the character decoded from the supplied Unicode code point

[Constraint]:
P0. Output only the assembled characters on one line

[Message]: []

Task:
1. Select Char_* entries from [Blueprint] in name order AS [Codes]
2. For each code point in [Codes] in order:
  => Invoke [CharacterFactory] and append its `value` to [Message]
3. Output [Message] ↳
  - Follow [Constraint]

ArcGrav uses named contexts, symbolic references, priority lists, and operations that models can interpret directly within ordinary prompt input, and without pre-training. It requires no external runtime, parser, or model-specific integration to use.

The repository includes several connected components:

  • ArcGrav: The language specification, syntax reference, design principles, and reusable agentic patterns

  • AgStudio: A local editor and analysis environment with structural navigation, syntax highlighting, and diagnostics

  • AgMark: A benchmarking application for comparing prompt representations under controlled execution conditions, with retained evidence and evaluation results

  • Research: The ongoing investigation into Model-Native Structural Representation, Interpretive Efficiency, token costs, context relationships, and agentic operational leverage

The broader objective is to investigate how explicit representations of task structure can be further optimized to minimize interpretive overhead, repeated specification, and corrective interaction, allowing more of a model's available capacity to be directed toward reasoning, verification, and execution.

Direct agent-readable references:


r/ContextEngineering • • 7d ago

Is AI memory actually a problem, or am I just using agents wrong?

Thumbnail reddit.com
1 Upvotes

r/ContextEngineering • • 7d ago

Keeping dynamic repo state from rotting AGENTS.md past ~150 lines (and why we split it into raw TOKENME.txt)

Post image
2 Upvotes

Running local multi-agent pipelines over the last few months (passing tasks across isolated architect, builder, and adversarial auditor modes), I kept hitting the exact same context rot wall with AGENTS.md and CLAUDE.md.

Imperative rule files work great when they stay tight- build flags, test commands, lint boundaries, and explicit trade-off priorities. Once a repo scales past ~150 lines of instructions though, dynamic codebase state inevitably creeps into the same file (directory trees, DB schemas, state-flow notes, exported function lists). Having volatile repo state mixed in with hard behavioral rules caused two constant headaches for us- agents started skipping verification steps buried in the noise, and stateless sub-agents kept writing duplicate helper functions because static docs drifted commits behind the working tree.

Before agentic AI, keeping a separate live meta-document just to describe the current state of the codebase would be way too labor intensive and violate the Don't Repeat Yourself mantra. Since spinning up a background maintainer agent on commit is almost trivial now- and stateless coding agents have zero memory unless you hand them one... splitting passive state out of AGENTS.md into a dedicated file was an 'ah-ha' moment for us.

Put the 3-file split we landed on in the card above. The two mechanics that actually made the biggest difference in practice were using raw .txt instead of Markdown (passing nested code fences and pipe tables across web UIs, clipboards, and IDE extensions kept silently truncating our handoffs) and enforcing a hard sharding trigger. Once a repo passes 3,000 tokens, 250 lines, 100 exported symbols, or spans multiple runtimes, the root TOKENME.txt turns into a lightweight <=1,000-token router pointing to scoped `/src/<domain>/TOKENME.txt` shards so sub-agents only pull the folder they're actively touching. Cut our per-handoff token overhead by ~74%.

Put the full v1.1 spec and bootstrap template up on GitHub under CC-BY 4.0 if anyone wants to grab or adapt it, see the first comment below.

Curious how others here are handling the split between static behavioral rules and high-churn repo maps once projects get large... especially if there's symbol or dependency metadata we missed that would make v1.2 sharper.


r/ContextEngineering • • 7d ago

Toy project with ontologies + an LLM agent. Which stack would you use?

2 Upvotes

Hi all,

I’m putting together a toy project for an exam to see how well ontologies and an LLM agent work together. The domain will probably be insurance or banking (haven’t decided yet, I was thinking about the underwriting process). The idea is to load document-extracted data as RDF, back it with an ontology, and let an agent answer questions through a few tools plus some read-only queries.

What I’m hoping to get out of the ontology:

  • fewer tokens, because the agent works from a compact schema and makes fewer exploratory calls

  • better guidance on what it can ask next, from domain/range and the class hierarchy

  • inference handled by the database (subclasses and so on), so the LLM doesn’t spend tokens reasoning about it

  • relationships that carry real meaning, plus labels and synonyms so the agent understands the business terms

  • answers that stay consistent and can be traced back to the data

Right now I’m on Neo4j + neosemantics, but I’m open to other stacks as long as the ontology stays at the center. I’m also not sure step-by-step exploration by the agent is the right approach compared with generating the query in one shot or using query templates.

Which stack and approach would you pick for these goals?

Thanks!