Inspiration

Long-running coding-agent sessions accumulate more than useful knowledge. They also retain temporary hypotheses, abandoned approaches, superseded specifications, and decisions that were once relevant but are no longer valid.

Most retrieval systems ask: What looks relevant?

District Fabric asks an additional question:

What is still allowed to matter?

The project grew from a broader District Fabric research direction concerned with dynamic, overlapping context fields and semantic deallocation. For OpenAI Build Week, we deliberately isolated one narrow, reproducible application: preventing obsolete project decisions from silently re-entering active Codex workflows.

What it does

District Fabric for Codex is a local semantic context sidecar and Codex plugin.

It preserves project history while governing which memories may re-enter active agent context through three mechanisms:

  • Lazy decay evaluates effective memory weight only when an event becomes relevant to a task, without a global sweep.
  • Semantic release keeps historical records stored while removing their active semantic authority.
  • Epoch gating blocks events that belong to a superseded project era.

Every selected or blocked candidate receives an auditable reason.

The central demonstration begins with an AuthV1 architecture based on Redis sessions. AuthV2, using short-lived JWT access tokens and rotating refresh tokens, later replaces it. Both remain in stored history.

When asked to add refresh-token rotation:

  • full-history loading reactivates two obsolete AuthV1 memories;
  • simple top-k retrieval reactivates one;
  • District Fabric returns the current AuthV2 context and blocks the obsolete memories.

How we built it

The MVP is implemented in Python using the standard library and a local SQLite event store.

It includes:

  • weighted, overlapping district memberships;
  • access-time lazy decay;
  • semantic release and replacement links;
  • per-district epoch heads;
  • governed top-k retrieval;
  • an explainable audit trail;
  • a dependency-free local dashboard;
  • deterministic benchmarks and fixtures;
  • Codex lifecycle hooks for SessionStart, UserPromptSubmit, Stop, and PreCompact.

The hook integration uses the plugin's writable local data directory and emits selected developer context through supported lifecycle output. It does not modify Codex's internal context window.

Evidence

The main deterministic fixture produced:

Policy Estimated context Ghosts Current decision
Full history 396 tokens 2 Incorrect
Simple top-k 133 tokens 1 Incorrect
District Fabric 95 tokens 0 Correct

In this included fixture, District Fabric reduced estimated loaded context by 76.0% versus full history.

A second independent DeployV1 → DeployV2 fixture reproduced the intended stale-context blocking behavior using the unchanged retrieval core:

  • full history: 286 estimated tokens, 2 ghosts;
  • simple retrieval: 147 estimated tokens, 2 ghosts;
  • District Fabric: 90 estimated tokens, 0 ghosts, correct DeployV2 decision.

These token values are deterministic local estimates for relative comparison. They are not API billing data or production performance claims.

The repository also includes:

  • a mechanism ablation;
  • a second-domain generalization check;
  • a lifecycle hook contract trace;
  • an explicit limitations document;
  • a one-command reviewer evidence path.

Challenges

The main challenge was separating three concepts that are often conflated:

  1. information that is stored;
  2. information that is relevant;
  3. information that is still valid enough to exercise authority.

Another challenge was preserving reproducibility without overstating the result. We therefore used deterministic lexical retrieval, small inspectable fixtures, local measurements, explicit claim boundaries, and no remote services.

We also kept a strict IP boundary. This submission publishes a narrow application slice rather than the complete District Fabric formalism, deeper district-formation dynamics, or hardware-oriented scaling route.

What we learned

Lazy decay is useful for controlling when relevance work occurs, but it does not establish semantic validity by itself.

Semantic release can remove the authority of explicitly retired events.

Epoch gating adds a separate protection: it can block an obsolete, still-stored event even when that event was not individually deleted.

Together, these mechanisms allow project history to remain intact without allowing every historical decision to remain active.

What's next

The next research steps include larger independently evaluated repositories, richer semantic district formation, live activated-plugin traces, and broader scaling measurements.

Those extensions are intentionally outside this Build Week MVP.

The public claim stands entirely on the code, fixtures, and measurements included in the submission.

Memory preserves what happened. District Fabric governs what is still allowed to matter.

Built With

Share this project:

Updates