# Maintaining Context for a Context Project (https://powercontext.oceanbase.io/en/blog/maintaining-context-for-a-context-project/)

We have been building PowerContext for a few months now. It is a project built for agent context engineering, yet in day-to-day development, maintaining context for the project itself is something we deal with every day.

## Context that does not compound [#context-that-does-not-compound]

Most projects fall into one of two states when handling context.

One is putting historical docs, architecture decisions, and coding conventions into a retrieval service such as RAG or a memory store, and relying on recall when an agent gets to work. That approach assumes the retrieval system naturally understands how those pieces relate, so as long as you write materials in, it will pull back accurate results when needed. In practice, teams mostly write and rarely maintain it. Outdated design assumptions and current API contracts end up in the same index, and the more snippets get recalled, the more easily the agent gets tripped up by contradictory information.

The other is having team members maintain their own prompts and local skills: whoever gets good results shares them, and everyone else copies and tweaks them. In effect, this bets on a few strong individuals figuring out a good workflow and spreading it through copy-paste. That kind of know-how rarely stays with the project. Several people write their own versions of the same rule, and as soon as the project shifts, everyone's copy falls out of sync. Once someone hands off the work, or the person who curated the setup stops maintaining it, what was accumulated scatters with them.

Both approaches can help in the short run, but over a long-lived project they rarely compound. Over time, personal configs, retrieval services, and the code repository drift apart until nobody can tell which version actually counts.

## Keeping context next to the code [#keeping-context-next-to-the-code]

When building PowerContext, we took a fairly traditional route: instead of setting up a separate system outside the codebase, we keep shared docs and conventions right inside the repository and maintain them alongside everyday software engineering workflows.

The root `AGENTS.md` serves strictly as an entry point covering directory layout, common commands, and key constraints. Review guidelines, design proposals, and module-specific developer guides live separately, so you read what touches the area you are changing.

Several well-known open-source projects in the community follow a similar pattern:

- [Apache OpenDAL](https://github.com/apache/opendal) separates historical decisions from current contracts: once merged, RFCs stay immutable as a record of why a decision was made, while current architecture docs and cross-language specifications evolve with the code.
- [Lance](https://github.com/lance-format/lance) keeps trimming its root `AGENTS.md` as a large multi-language repository grows: the root holds only cross-language compatibility rules and a module map, while language- and subsystem-specific conventions live in their own directories to be read on demand.

The same holds for agent skills and configuration. When building [bubbuild/landing](https://github.com/bubbuild/landing), I did not ask repositories to maintain yet another config layer; instead, it reads the repository's existing `AGENTS.md`, CI checks, and Dependabot configuration directly, while skills live under a conventional directory alongside the code where projects can maintain or override them. Dependency declarations, linters, and CI are already the engineering facts daily maintenance depends on, so reusing them directly is the most practical option.

Writing RFCs and keeping discussions in public Issues and PRs are already standard practice in open-source projects. They may not always match the latest state of the code, but at least they preserve the design rationale from a given stage as a reference. Solid linting and CI checks help too: a static check that fails locally right away saves a lot of tokens compared to relying on a model to read through the codebase directly.

## Context takes design, and active maintenance against rot [#context-takes-design-and-active-maintenance-against-rot]

Putting docs into the repository is not the finish line, and you cannot just point a model at the codebase to generate a summary and call it done. Model generation rarely converges: each scan can turn up new findings, promote a local workaround into a global rule, and fail to clear out stale information.

Even hand-written static docs rot quickly once copied in multiple places or left detached from daily development. Especially when implementation details are written across different developer guides, every adjustment requires updating several places at once; miss one spot, and the leftover rule keeps misleading the next agent that picks up the work. Leaving one-off acceptance steps for a particular commit in long-lived docs causes the same issue, as subsequent commits can easily lead agents to fill in unintended noise.

Because static copies are expensive to maintain and quick to fall behind, tison retired the long-running Rust template repository [fast/template](https://github.com/fast/template) last month. He deleted the entire starter scaffold and template CI, leaving only a few lines of prompt in the README telling a coding agent to reference two actively maintained repositories, `apache/datasketches-rust` and `apache/asyncband`, when setting up a new project, instead of maintaining a static template that will inevitably go stale.

Beyond staleness, another problem is model-specific habits spreading across a project. Different models have their own tendencies: GPT / Codex, for instance, likes stacking layer after layer of defensive checks, and often treats intermediate branch states or old designs as compatibility obligations, piling on convoluted compatibility logic. If those habits slip into project docs early on, later agents will amplify the same bloat. Lance addresses this directly in its `AGENTS.md`: unstable formats and intermediate changes on a branch are not compatibility constraints, so do not compromise a cleaner design to preserve them.

Moreover, the code and tests themselves are the context agents read most, so accumulated code smells pollute future generation just as much as stale docs. Alongside keeping bad rules out, regular cleanup matters. Tison previously shared a pre-release Deslopify prompt on X for clearing out unnecessary code, and recently turned it into a repository skill, such as [deslopify](https://github.com/apache/asyncband/blob/b6b8adff/.agents/skills/deslopify/SKILL.md) in Asyncband, for periodically cleaning up rough edges and legacy clutter. Once testing expectations were spelled out clearly, [DataSketches Rust](https://github.com/apache/datasketches-rust/pull/419) and [OpenDAL](https://github.com/apache/opendal/pull/9424) also removed thousands of lines of redundant white-box tests in one sweep. Just like code, context does not get better simply by piling more on; clearing out what is no longer useful is what keeps the rest valuable.

Adding new rules to docs and workflows calls for a tight bar as well. In `REVIEW.md`, we split review feedback into two tiers: only a defect backed by a minimal reproducible counterexample proving broken correctness or a violated contract blocks a merge; alternative design preferences stay non-blocking suggestions, and mocks or directly invoked scripts do not count as real environment acceptance. Recording lessons follows the same discipline. When maintaining [LESSONS.md](https://github.com/yetone/magpie/blob/main/LESSONS.md), `yetone/magpie` skips activity logs and reviews only recently merged changes that needed rework or lacked sufficient verification; a pattern graduates into long-term standards only after recurring across multiple days. Being selective about adding rules is what keeps the remaining context genuinely useful.

## From generation and provenance to day-to-day maintenance [#from-generation-and-provenance-to-day-to-day-maintenance]

In the end, these practices come back to the principles of traditional software engineering, which I like to call baseline engineering.

A few days ago, some people in the community mentioned that when using a personal agent, they prefer pinning a few readable, editable notes rather than relying entirely on built-in automatic memory or context compaction. The reasoning is the same. Black-box compaction is hard to audit: once a temporary instruction gets compressed into a long-term bias, debugging it becomes painful. A few messages or notes that humans can collaboratively edit are at least visible and tangible. Even so, they cannot escape the same underlying problem: most context goes stale over time, and there is still no once-and-for-all answer to how to write it or when to prune it.

The community's focus in context engineering has kept shifting as well. Early on, most attention went to generation and recall, such as running an init command to scan a repository into rule files or chunking existing docs into a retrieval store, which quickly ran into staleness and contamination. Next came wider discussion around context provenance, separating artifacts by purpose, and background consolidation during idle time such as `dream`. Yet no matter how automated background distillation becomes, as long as a project keeps evolving, old conclusions will go stale. That is why approaches built on append-only logs with derived views and giving models their own search tools keep regaining ground, which is the exact approach I took in [Bub](https://github.com/bubbuild/bub) back in February.

Tools can help you store context, structure relationships, and provide recall mechanisms, but getting real value out of PowerContext or any similar context or memory product still requires careful context design and ongoing maintenance.
