The Persistence Layer of Combined Force
Why AI workflow memory needs three architectural tiers, not one
The Persistence Layer of Combined Force
Why AI workflow memory needs three architectural tiers, not one

The Persistence Layer of Combined Force.
Part 4 of the Combined Force Methodology series. Previous: The Combined Force Methodology, The Governance Layer of the Combined Force Methodology, and The Platform Layer.
Last month I spent forty minutes debugging why a GitLab MR comment ended up at the top of the merge request instead of inline on the diff. The glab API call looked correct. The position fields were there. The comment posted. But the comment was in the wrong place.
The cause, eventually: passing position[base_sha]=... as a form-encoded field through the -f flag silently drops the field. GitLab’s API requires a JSON body with an explicit Content-Type: application/json header. With form encoding, the position object never reaches the server. The note posts top-level by default.
I figured it out, fixed it, moved on.
A week later I would have made the same mistake again. Not because I forgot the diagnosis — I remembered the diagnosis. Because I forgot that the diagnosis applied to this situation. The cue I needed was: “when someone says ‘inline comment’, the form-encoded path fails silently.”
Without that cue, I would re-debug.
This is the problem of session amnesia. And it is solved — not by writing more prompts, but by building a persistence architecture underneath your AI workflow.
This article describes how. Three layers, each with a different cost-benefit profile. Together they prevent re-learning.
The architecture in one diagram

The persistence layer uses three tiers so critical rules stay always visible while detailed memory loads only when relevant.
Three layers. One problem solved at three different cost-benefit points.
The naive solutions and why they fail
Before describing the architecture, it’s worth being explicit about what fails.
Naive solution A: dump everything into the global rules file.
This is the obvious first move. You learn something, you add it to CLAUDE.md. After three months, your CLAUDE.md is 5,000 lines. Critical doctrine is mixed with debugging anecdotes. The model that loads this file at every session start now has to process all of it just to make a single decision. Context window pressure increases. Important rules get lost in the noise.
Naive solution B: keep nothing, re-derive on demand.
This is the path of least resistance. Every session starts fresh. The model gets confused about phrasing it should know. You spend time re-explaining context that was painfully earned in previous conversations. The cost is distributed across every session instead of concentrated at the moment of writing, but it is paid every time.
Naive solution C: write everything to a single memory file.
You create notes.md and dump everything there. It grows organically. After six months, finding anything requires grep. The model has no way to surface the right entry at the right time because there is no index. Information exists but is undiscoverable.
The three-layer architecture solves all three failure modes simultaneously.
Layer 1 · Global doctrine
The first layer is the file that loads at every session start, in every repository, across every conversation. For me this is ~/.claude/CLAUDE.md. For other AI tools it might be a system prompt, a .cursorrules file, or custom instructions.
The constraint that matters: this file is expensive. Every session pays its cost in tokens. Every decision the model makes has to incorporate it. So the contents must justify that cost.
The question I ask before adding anything to layer 1: would missing this rule cause silent failure?
If yes — for example, “never push to remote without explicit user permission” — it goes in layer 1. The cost of paying tokens to enforce this rule every session is dramatically less than the cost of one accidental push.
If no — for example, “here’s a full debug history of a one-time issue” — it goes in layer 2. Putting it in layer 1 would dilute the high-priority rules.
What lives in layer 1 in my system:
- Operating doctrine (TDD discipline, Clean Architecture rules)
- Hard permissions (never push, never create MRs without permission)
- Tool selection rules (use
glabnotWebFetchfor GitLab URLs) - Phrase-to-method mappings (“inline comment” maps to specific posting method)
- Bypass protocol (how to handle explicit user override of doctrine)
The file is approximately 700 lines. Every one of those lines has earned its place through a specific past mistake or a specific principle worth enforcing.
The recent addition: when a user says “inline comment”, that phrase must map unambiguously to the JSON-body method. Not the -f flag method. The mapping is in a table. The full working code snippet is in the file. The mistake takes ten seconds to look up instead of forty minutes to re-debug.
Layer 2 · Auto-memory
The second layer is detailed context that surfaces only when relevant.
For me, this is individual .md files in ~/.claude/projects/.../memory/. Each file is one self-contained note: a debugging history, a project state, a reference, a piece of personal context. Files are loaded when grep finds them relevant to the current prompt.
The constraint that matters: layer 2 entries can be verbose. Because they only load when relevant, the per-session cost is low. You can write the full chronicle: the bug, the failed attempts, the working solution, the verification steps, the cleanup commands.
What lives in layer 2 in my system:
- Debugging chronicles (the full glab inline comment investigation)
- Reference materials (specific Jira workflows, GitLab API patterns)
- Conversational memory (insights from prior conversations that might recur)
- Domain-specific knowledge (e.g., my interview rubrics, my methodology details)
The contents are richer than layer 1 allows. A layer 2 entry can be 500 lines describing the full debugging path that led to a single layer-1 rule. The depth informs the rule without polluting it.
Layer 3 · The index
The third layer is the smallest and most overlooked. It is the index that ensures layer 2 entries are discoverable.
For me, this is MEMORY.md — a file that is always loaded (like layer 1) but contains only one-line pointers to layer 2 entries. Each line is approximately 150 characters: a name, a brief description, and the relationship to other entries.
The constraint that matters: this file is also expensive (always loaded) but must stay small. If it grows past 200 lines, it loses its function. The cure for an oversized index is moving entries to layer 2 with cross-references, not deleting them.
The reason layer 3 exists, even though it duplicates information from layer 2: discoverability.
Without an index, layer 2 entries exist but are not surfaced. Grep can find them only if the prompt happens to contain the right keywords. The index makes them discoverable through concepts, not just keywords.
In my system, the index entry for the glab inline comments memory note says:
“reference-glab-inline-mr-comments — Full debugging history of why
-f position[xxx]=valfails for GitLab inline MR comments. Working JSON body pattern + verification + cleanup.”
When the model loads MEMORY.md at session start and sees a prompt about GitLab comments, this index entry tells it: there is a detailed entry available, and here is approximately what it contains. The full entry then loads on demand.
Without layer 3, the model would not know layer 2 had the answer.
Why three layers, not one
The three layers exist because they have different cost-benefit profiles. A single-layer approach forces a single tradeoff. Three layers allow three tradeoffs.
Layer 1: always paid, must be terse, holds the most critical rules.
Layer 2: paid only when relevant, can be verbose, holds detailed context.
Layer 3: always paid, must be brief, surfaces layer 2 to attention.
The tradeoffs map cleanly to the kinds of knowledge you accumulate working with AI:
- Some knowledge is critical at every decision (layer 1)
- Some knowledge is irrelevant most of the time but expensive to re-derive when needed (layer 2)
- Some knowledge is the pointer that turns layer 2 from invisible to accessible (layer 3)
Building only layer 1 produces an overloaded CLAUDE.md that becomes hostile to read. Building only layer 2 produces invisible knowledge. Building layers 1 and 2 without 3 produces knowledge that exists but is not consistently discovered.
The three-layer split is the same architectural decomposition you would apply to any system where you have different categories of data with different access patterns. Hot data, warm data, cold data. Critical rules, contextual chronicles, indexable pointers.
The decision tree
When I learn something new working with AI, the question is: where does this belong?
The decision tree I use:
Is this a rule that, if missed, causes silent failure or violation of intent?
├── Yes → Layer 1 (global doctrine)
└── No
├── Is this detailed enough to warrant 100+ lines?
│ ├── Yes → Layer 2 (memory note) + Layer 3 (index entry)
│ └── No → Layer 2 only (if recurring) or session-discardable
└── Is this a pointer that helps future-me notice
a related layer 2 entry exists?
└── If yes → Layer 3 only
In practice, the glab inline comments lesson produced entries in all three layers:
- Layer 1: a phrase-mapping table in
CLAUDE.md§ 4 saying “inline comment” maps to the JSON body method - Layer 2: a memory note titled
reference-glab-inline-mr-comments.mdwith the full forty-minute debug chronicle - Layer 3: an index entry in
MEMORY.mdpointing to the memory note
The Layer 1 entry is what prevents the mistake. The Layer 2 entry is what justifies the Layer 1 rule with full debugging history. The Layer 3 entry ensures Layer 2 is discovered when relevant.
Three layers, one lesson, encoded three times at three different specificity levels.
Patterns that emerge
After running this architecture for a year, patterns crystallize.
Cross-references are critical. Layer 1 rules should link to Layer 2 entries that justify them. Layer 2 entries should link to other related Layer 2 entries. Layer 3 entries should hint at Layer 2 cross-links. Without cross-references, each layer becomes an island.
Names matter. Layer 2 file names are searchable. A note titled notes-2026-04-23.md is useless. A note titled reference-glab-inline-mr-comments.md surfaces immediately when relevant.
Trim Layer 1 quarterly. The temptation is always to add to global doctrine. Resist. Every quarter, audit. Move anything that has not been activated to Layer 2. The discipline keeps the file from becoming the dump.
Don’t write Layer 2 directly into Layer 3. A common mistake: writing detailed content into the index. The index should never contain content; only pointers. If you need detail, write a Layer 2 file and link it.
Use the architecture for projects, not just for tools. I have Layer 2 entries for personal projects (my interview frameworks, my Combined Force methodology), each with its own debugging history. The architecture generalizes beyond technical tooling.
Beyond personal: teams
Everything described so far is personal. One human + their AI tools.
The same architecture works at team scale, with these substitutions:
- Layer 1 → team-wide governance document committed to a shared repository
- Layer 2 → team-wide notes directory, with consistent naming conventions, also committed
- Layer 3 → team-wide index, owned by a designated maintainer
A team adopting this pattern collectively persists what no individual could persist alone. The team’s debugging chronicles compound. New hires inherit the corpus instead of re-deriving it.
This is also where the persistence layer connects to the platform layer from the previous article. A team platform that distributes governance + memory + index is genuinely shared cognition. The team is not just sharing tools — it is sharing accumulated lessons.
The deeper insight
Combined Force, in its first article, was about how a disciplined individual amplifies their work with AI. Governance, in the second, was about preventing AI from replacing judgment in the moment. Platform, in the third, was about scaling the methodology to a team.
Persistence, in this fourth article, is about something different: making the methodology self-improving over time.
A workflow without persistence can only be as good as the lessons the operator remembers in any given session. With persistence, the workflow accumulates. Lessons from session 1 inform session 2, and session 2 informs session 3. After a year of disciplined accumulation, the workflow is dramatically smarter than it was at start — not because the AI got smarter, but because the system around the AI did.
This is how methodology becomes capital. Each lesson encoded into the persistence stack is a fractional asset that compounds. The compound interest is real. After enough time, you stop re-debugging things you debugged once.
That is the architecture of expertise made executable.
Where this fits in the series
In the broader picture of Combined Force methodology:
- Article 1 answered what
- Article 2 answered how
- Article 3 answered where (across team)
- This article answers when (across time)
- Article 5, coming soon, will answer who operates the stack — the human-machine interface that emerges when the layers compose
Five layers, one architecture, one methodology. Each layer is independently usable. Together they describe a complete operating system for AI-augmented engineering practice.
The persistence layer is the one that makes the other four sustainable. Without it, every session re-learns. With it, the work accumulates.
That difference, multiplied across the years of an engineering career, is the difference between practicing with AI and being made obsolete by it.
This essay is part 4 of the Combined Force Methodology series.
Previous: Combined Force at Scale: The Platform Layer. Next: The Operator Layer of Combined Force.
Octavio Rojas Topete is Lead iOS Engineer and Multi-Platform Mobile Architect at AgileEngine. He writes about engineering methodology, AI-augmented development, and technical hiring. Previously at Pluto TV, New York Post, Globant, and Disney. Find him on LinkedIn or at github.com/tattva20.
메타데이터
- post_id
- 96ce12f5abc0
- slug
- the-persistence-layer-of-combined-force-96ce12f5abc0
- url
- https://medium.com/@tattva20/the-persistence-layer-of-combined-force-96ce12f5abc0
- canonical_url
- https://medium.com/@tattva20/the-persistence-layer-of-combined-force-96ce12f5abc0
- author_url
- https://medium.com/@tattva20
- status
- ok
- fetched_at
- 2026-07-22 07:45:57