The AI coding
context layer.
A context layer indexes a team's memories, rules and skills by path and delivers only the slice that applies to the agents the team uses, before the first tool call. Here are the five ways teams do it, and how to tell which one fits.
Without a context layer
- The assistant opens the order module, reads the schema, follows imports into pricing and tax, and reads the discount handler to infer where a coupon attaches.
- It writes a plausible change that attaches the discount to the order total. The diff compiles. It is wrong in the way the team already knows about.
- A reviewer catches it, explains the line-item convention again, and the loop repeats. The knowledge stays in one person's head.
- Many files read, many tool calls, a long input window, and a wrong turn that costs a review cycle.
With a context layer
- The matching slice for the order path arrives at hook time, before the first tool call. The model already knows coupons live on the line item.
- It applies the discount to the line item on the first pass, because the rule was in context before it started.
- A strict rule can block a change that attaches the discount to the wrong place before it lands, so the correction happens before review, not after.
- A short, focused context window and a targeted change, because only the rules for this path were injected.
Five ways to give an agent context.
- Instruction files
- choose it when
- One person, one repository, few conventions
- knowledge arrives
- Every turn, all of it
- survives a tool change
- No, each tool reads its own file
- breaks
- At the second person or the second agent: each tool wants its own copy.
- Memory API
- choose it when
- You are building memory into your own product
- knowledge arrives
- When something queries it
- survives a tool change
- Yes, if you own the call site
- breaks
- Quiet by design. A constraint nobody asked about never arrives.
- Vector search
- choose it when
- The answer is written down, location unknown
- knowledge arrives
- When something queries it
- survives a tool change
- Yes, though the index is yours to run
- breaks
- It cannot return a decision that is in no file at all.
- Agent workspace
- choose it when
- Parallel agents are the bottleneck
- knowledge arrives
- Per session, not per path
- survives a tool change
- Not the point: it is the tool
- breaks
- A second checkout does not decide which knowledge belongs where.
- Path-scoped layer
- choose it when
- One person across several engines, or a team on one repository
- knowledge arrives
- Before the first tool call, scoped to the path
- survives a tool change
- Yes, the knowledge lives outside every tool
- breaks
- Overkill for one person running one agent.
Two of these are not competitors. A memory API inside your own product and a context layer for your agents can both be true at the same time.
When you do not need one.
One person, one repository, one agent, and conventions that fit on a page: a checked-in CLAUDE.md is the right answer and a context layer is overhead. The break point is not repository size, and it is not team size either. It is the second agent or the second person, whichever arrives first. A single developer running Claude Code and Codex on the same repository already has the problem: whatever you teach one of them, the other one does not know, and each reads a different file.
What a context layer carries
- MemoriesWhat the team has learnedThe "we tried that, it did not work" facts that disappear when the engineer who learned them moves on. Attached to the path where they apply. More: persistent memory for AI coding agents.
- RulesWhat to do or avoidAdvisory and strict constraints. The hard guardrails (no
console.login/apps/web) and the soft preferences (prefer named exports in/packages/ui). More: rules for AI coding agents. - SkillsMulti-step playbooksProcedures the team has worked out: how to add a migration, how to ship a feature flag, how to run the security review. Invokable by name. More: skills for AI coding agents.
- Path-indexedKnowledge lives near its workEvery memory, rule and skill is attached to a path. A rule for
/services/billingnever fires when the model is working in/apps/mobile.
Single file vs context layer
- Native instruction files can be scoped by path and shared through version control.
- Token cost grows linearly with team rules.
- One assistant per file. Tool churn loses team knowledge.
- Editable by anyone with push. No structured review.
- Knowledge passed along by tribal memory.
- Path-scoped slice for the directory the model is working in.
- Token cost scales with the relevant slice, not the whole rule set.
- One layer, many assistants. Tool churn does not reset the team.
- Reviewable knowledge graph with server-enforced workspace access and a stale-rule detector.
- Knowledge written once, delivered automatically to the next teammate's session.
Supported AI coding assistants
Questions.
What is an AI coding context layer?
The routing layer between a team's typed knowledge (memories, rules and skills) and the AI coding assistants the team uses. It indexes that knowledge by path and delivers only the relevant slice to the model at hook time, before the first tool call.
How is a context layer different from CLAUDE.md or AGENTS.md?
CLAUDE.md and AGENTS.md are flat files that ship every instruction on every turn. A context layer is one level higher: it stores knowledge in a path-indexed graph and routes only the matching subtree into the model, so each instruction the model sees is load-bearing for the current path.
Is a context layer an AI coding tool?
No. A context layer does not generate code, run inference or replace your IDE. It is the layer between your team and whichever AI coding assistant you choose, making each session smarter without locking the team to a single tool.
What does a context layer carry?
Three kinds of typed team knowledge: memories (what you have learned), rules (what to do or avoid) and skills (multi-step playbooks). It does not carry your source code or an index of your repository.
How does Pathrule implement the AI coding context layer?
Pathrule stores team knowledge in a path-indexed graph, exposes one MCP server, and reaches each agent the way it allows: hooks including a prompt hook for Claude Code and Codex, session and tool hooks for Cursor and GitHub Copilot, and a rules file for Windsurf. Only the slice that matches the current working directory is delivered to the model.
Does a context layer see source code?
It does not need to. Pathrule does not automatically upload your repository source code. In cloud mode, Pathrule Cloud stores the memories, rules and skills the team writes, the start of each prompt is sent to rank what applies, and pathrule snapshot, when you or your agent run it, uploads the file tree, manifests, short doc samples and recent git metadata. In local mode there is no account. Full breakdown on the Security page.
Which context tool should I choose?
It depends on which problem you actually have. One person running one agent on one repository is served by a checked-in CLAUDE.md. Memory inside your own product is a memory API. Knowledge that is written down but hard to locate is vector search. Parallel agents in isolated checkouts are an agent workspace. A path-scoped context layer is for the moment a second engine or a second person enters the picture, which for most people is the second engine. The five approaches, and where each one breaks, are set out above.
What is the difference between a context layer and a memory API?
Delivery timing. A memory API answers when it is queried, so a constraint the agent never thought to ask about never arrives. A context layer reads the path the agent is about to work in and delivers the matching knowledge before the first tool call, whether or not the agent would have asked for it.
Is vector RAG a context layer?
No. Vector retrieval finds text that is already written down, ranked by similarity to a query. A context layer carries decisions that are in no file, keyed to the path they govern, and it can enforce them: a rule has a scope, a priority and an enforcement level where a store returns text. Similarity is a guess about relevance; a path is a fact about it. Long-form: Vector RAG vs path-scoped context.
Do I need a context layer if I work alone?
Working alone is not really the question. How many agents you run is. One person with one agent and a page of conventions is exactly what an instruction file is good at. One person running Claude Code, Codex and Cursor on the same repository already has the problem a context layer solves: what you teach one of them stays inside it, and each one reads a different file. Pathrule is free for individual use for that reason.