Why agents need a why layer, not only the code layer
Agents can read the code layer and still miss why the team chose X. Treat decisions, rationales, and outcomes as queryable memory—not a full ADR re-read.
By Trellis

The agent can open the right file and still fail the useful question: why did we choose this? Symbols, imports, and the last diff show what shipped. The motivation — constraints, rejected alternatives, the consequences the team accepted — lives in ADRs, PR debates, and ticket threads the model re-reads every session, or invents when those records never enter context.
Code answers what shipped. Why lives one layer up
The code layer is necessary. It is also incomplete for orientation. A function signature tells you the contract that exists today. It does not tell you that the team rejected a queue, accepted a weekly rotation policy for signing keys, or that extending a shortcut will break an invariant nobody wrote into a type.

Industry writing on an architectural decision layer for agents puts the gap plainly: agents read code and still miss the reasoning layer above it. Code shows what was decided in the tree. It does not show why, or which constraints still follow from that choice. On many teams that rationale never hardens into anything queryable — it stays in Slack, buried review comments, or someone’s head.
Architectural decision records exist for the same reason Michael Nygard named years before agents: one of the hardest things to track is the motivation behind decisions. Without it, people either accept the status quo blindly or reverse it blindly. An ADR captures a single decision and its rationale; the collection is the project’s decision log. That vocabulary — decision, rationale, consequences — is the why the code layer does not store.
The useful split for agent memory is therefore two strata, not one bigger dump of files. Below: what shipped. Above: the why that shaped it.

ADRs and ticket threads still leave the agent re-reading
Writing better ADRs helps humans and helps agents that can read them. Guides that treat ADRs as agent memory are right that without institutional record of why, agents drift — wrong stack choices, extra ORMs, “helpful” refactors that undo constraints. Structure (Status, Context, Decision, Consequences) makes those records easier to parse. Optional CI rules that enforce decisions go further still.
None of that, by itself, is a queryable why layer.
Session-time practices inject decision snippets into context each open so the model sees the latest architectural notes. Living-documentation practice keeps a summarized Architectural Decisions section with pointers back to ADRs so the agent starts from the summary and opens the full record only if needed. One practitioner report is concrete: answering “Why did we switch to Neon?” used to mean scanning on the order of 155 ADRs; a living summary reduced that re-read. Their hybrid consensus still says the “what” can be auto-generated while the “why” stays human-written docs.
Those fixes improve briefings and documentation hygiene. They still treat the why as prose the agent must find, paste, or skim again next session. Durable memory for a coding agent is different: the decision is a first-class thing the agent can retrieve without re-opening the whole corpus.
What a why layer holds — decisions, rationales, and outcomes
Trellis names this content the Context layer: decisions, rationales, and outcomes — the “why” behind the code. That is not a slogan for “more markdown.” It is a claim about what belongs in agent memory as entities, not only as files the model might re-read.
In product terms, memory for your agent is a queryable graph of code, docs, decisions, PRs, and work items. Decisions sit with the rest of the system map, not in a parallel wiki the agent never joins. The graph side is typed entities and typed edges linking those things together — so a decision can sit next to the modules and work it still constrains, with its own short summary and reasons instead of a wall of ADR text.
Prose still matters. Markdown, PDFs, and design notes can be chunked, embedded, and cited; connectors and files bring in GitHub, Jira, PRs, and work items where decision trail often starts. Feeding the graph from ADRs and tickets is not the same as being the why layer. The why layer is the durable, queryable deposit of decisions, rationales, and outcomes once they are memory — not the pile of source documents alone.
In the product framing, explore results can surface a decision node (for example a weekly key-rotation choice tied to an ADR path) alongside functions and PRs, with edges you can follow from a commit toward the decision that shaped it. Treat that as the shape of first-class decision memory, not as a measured retrieval score.

How the agent answers “why did we choose X?” from memory
The job-to-be-done is not “generate another architecture essay.” It is mid-session questions a tech lead already knows how to answer by hunting:
- Why do we rotate signing keys weekly?
- Why this store instead of the alternative the PR debated?
- What consequence still forbids extending this shortcut?
When decisions live in queryable memory, the agent retrieves the decision node and its summarized context — status, rationale, outcomes — instead of grepping the wiki and hoping the right ADR title ranks. Coding hosts such as Claude Code, Cursor, and Codex can query that local graph of code, docs, decisions, PRs, and work items so the model stops re-learning institutional choices every session.
Decisions can also sit linked to work items, PRs, and code. That grounding matters: “why weekly rotation?” is more trustworthy when the answer is not a floating note but something connected to the change trail. The full walk of decision → ticket → PR → symbol is a correlation story of its own. Here the point is narrower: the why content has to exist as memory first, or there is nothing honest to join.
Summaries make the why layer queryable, not just stored
Storing every ADR as a raw blob inside a graph still leaves the agent stuffing long decision text into the window. Product framing for the stack is explicit: not a pile of embeddings, but a connected graph in which the configured model summarizes code symbols and extracts decisions, their reasons, and how they connect, so retrieval is both connected and semantic.
That is what turns a decision log into agent memory. A summary and reasons on each decision node, and typed edges toward code and docs, let the agent pull a compact neighborhood: what was chosen, why, what follows, and what nearby symbols or work still relate — without replaying the full ADR corpus for every “why?”
A codebase knowledge graph is the map underneath. The why layer is the part of that map that holds motivation, not only structure. Keep the index honest as the tree moves — stale memory is a different failure — but do not confuse freshness of code nodes with presence of decision nodes. If the why never entered memory, no re-index invents it.

If your agent keeps editing the right files while reversing last year’s constraints, you do not need a larger context window first. You need a why layer — decisions, rationales, and outcomes as queryable memory — so “why did we choose X?” is an answer from the graph, not another full corpus scan.
Want this for your team?
Trellis builds local-first knowledge graphs for coding agents, and the Free plan runs on your own machine.