-
Notifications
You must be signed in to change notification settings - Fork 216
Description
TLDR: Using ADR files (reading index only) instead of decisions-log.md to improve efficiency and reduce noise.
The current implementation of project memory relies on a single, append-only file located at .opencode/context/project/decisions-log.md. While simple to implement, this approach may present significant scaling issues for AI agents and collaborative development.
The Problem
Context Window Bloat: As a project matures (e.g., reaching 100+ decisions), the log consumes an increasing number of tokens. Forcing the agent to read the entire log to understand one specific decision is inefficient and costly.
"Lost in the Middle" Bias: Large language models often lose focus on information buried in the middle of long documents. A single massive log decreases the agent’s ability to accurately retrieve specific architectural constraints.
Template Corruption: There is a risk of agents overwriting the structural boilerplate of the single file during long-form append operations.
The Proposal: ADR Index + Granular Files
Shift to an Architectural Decision Record (ADR) pattern similar to standard industry practices (e.g., ), optimized for RAG (Retrieval-Augmented Generation).
Proposed Structure:
.opencode/context/project/decisions-index.md: A lightweight "Registry" containing a table or list of decision titles, dates, and tags (e.g., #auth, #database, #ui).
.opencode/context/project/adr/NNNN-name.md: Individual, numbered files for each decision.
Benefits for AI Agents:
Efficiency: Agents can scan the small decisions-index.md to identify which specific ADR file is relevant to their current task, loading only that file into memory.
Precision: By isolating decisions, the agent receives a higher "signal-to-noise" ratio, leading to more accurate code generation that respects project constraints.
Immutability: Once an ADR is written, it is rarely changed unless superseded by a new file, protecting the integrity of the project's "long-term memory."