An AI agent knows about a solution only what is written down for it. The AI context therefore stands on two places: the project directory, which holds everything important about one solution, and the common knowledge, rules and skills shared by the whole organization. This guide shows how to set up and maintain both. What the AI context is and why it matters is explained on the page AI context.
1. The procedure in brief
- Choose the project directory and put it under version control.
- Write the agent rules into it.
- In NET Genium, give forms and fields understandable names and add help texts and notes for administrators to them.
- Keep the documentation of the solution, the decision memory and the source code in the directory.
- Decide which rules stay in the project only and which the whole organization will share.
- Add to the context after every agent error.
2. The project directory
The basis is one directory that holds all the important information about the project. The agent reads and writes in it. What is not in the directory does not exist for the agent.
Every piece of work starts the same way. The developer opens the AI tool, for example Claude Code or Codex, and chooses the project directory to work in. The AI tool loads the whole context from it: the agent rules, the configuration of the MCP servers and everything else the directory holds. From the first message the agent therefore knows which solution it is working on and which instance to connect to, and nothing has to be explained to it again.
The project directory holds:
- the agent rules – the file “CLAUDE.md” for Claude Code or “AGENTS.md” for Codex, in the root of the directory,
- the configuration of the MCP servers – which instances the agent connects to, for Claude Code the file “.mcp.json” in the root of the directory,
- the documentation of the solution – a description of the processes, roles and operation,
- the decision memory – what is intended and what has already been rejected,
- the source code – external functions, APIs and services,
- the source materials – assignments, analyses and notes the solution is based on.
A directory under version control is called a repository. Version control is strongly recommended. Thanks to it the agent sees all changes over time: what changed when, who changed it and what it looked like before. Every change, including one made by the agent, can be traced and reverted.
Tokens and passwords do not belong in the directory. They are stored in environment variables, and the configuration of the MCP servers only refers to them (see Claude Code, Codex and other tools).
Details
- One project has one directory. A directory shared by several projects confuses the agent just as a project split into several directories does.
- In Claude and ChatGPT without a developer tool, the role of the directory is played by a project with instructions and uploaded files. It does not, however, keep a history of changes over time.
3. Common knowledge, rules and skills of the organization
Custom rules, knowledge and skills can stay in the project directory only. They then apply to that project and to whoever works in it. Where several people work on the solutions, or there are several projects, it pays to have, next to the project directories, one common place for what applies across the whole organization. Whether to share, and what, is the decision of the organization. The common place holds:
- knowledge – how the organization works, its terms, systems and habits,
- rules – how code is written, named and documented in the organization, and what the agent must not do in any project,
- skills – recurring procedures the organization does in its own way, for example setting up a project or a check before handing work over.
The point of sharing is that all employees always have the same, up-to-date rules and knowledge. What is written down in one project only is missing in the next one. Without a common place every developer teaches the agent the same things again, and each a little differently. The common place therefore has a single copy, preferably also under version control, which everyone connects to their AI tool. A change is made once and from that moment applies to everybody.
The division is simple: what applies to one project only belongs to its directory, what applies everywhere belongs to the common place. A rule that shows up in a second project belongs to the common place.
NetGenium works the same way. The Agent Kit is the common place for everything that concerns the platform. The common place of an organization adds what concerns the organization itself.
4. Which layers are created by the developer
The framework knowledge, the basic rules of the platform, the implementation model, the data and the diagnostics are served to the agent by the MCP server of the instance automatically (see How agentic development works). The other layers are built by whoever develops the applications:
| Layer | Where it is written | When the agent reads it |
| Agent rules | the file “CLAUDE.md” or “AGENTS.md” in the project directory | at the start of every piece of work |
| Descriptions in the applications | names, help texts and notes for administrators of applications, edit forms and controls | with the implementation model, every time it reads an application |
| Documentation of the solution | text files in the project directory | when the task concerns the described area |
| Decision memory | a text file in the project directory | before it marks anything as an error or proposes a fix |
| Source code | the project directory | when working with external functions, APIs and services |
| Knowledge, rules and skills of the organization | the common place of the organization | depending on what the task concerns |
5. Building layer by layer
The AI context is not created by a one-off project. It is built layer by layer, starting with the cheapest one:
- Agent rules. They must exist before the agent is connected for the first time. They define which instance is the production one and which the development one, what the agent may do in production, what it must never do and when it has to ask. What the rules should contain is described in the guide Introducing agentic development.
- Descriptions directly in the applications. Understandable names of forms and controls, help texts of fields and notes for administrators. The agent reads the implementation model during every piece of work, so a description written in the application is context that never drifts away from reality.
- Documentation of the solution. A description of the processes, roles and operation – what cannot be read from the application model: why the solution is built the way it is and how its parts relate to each other. The agent finds it in the project directory and can maintain it as well.
- Decision memory. A list of intended behaviour and rejected proposals. Without it the agent proposes to fix what is correct and returns to what has already been turned down once.
- Source code. External functions, APIs and services in the same directory in which the agent works. The existing code is the agent’s model of style and structure.
In NET Genium Online and for solutions without custom code the first two steps are usually enough. The other layers come with the size of the solution and with the number of people working on it.
6. Maintaining the AI context
- Every agent error ends in an addition to the context. A new rule, a more precise description or a record in the decision memory. A fix made only in the conversation means the error will happen again.
- The agent’s uncertainty is solved by writing things down, not by another instruction. If the agent keeps asking about the same thing, the answer is missing in the context.
- The context changes together with the solution. A change of an application that is not reflected in the documentation creates context that confuses the agent more than none at all.
- The context should be short and precise. The agent reads everything it gets. Outdated or wordy text takes the place of what matters.
7. How to tell that the AI context is missing
- the same instruction has to be repeated in every conversation,
- the agent names new elements differently from the existing ones,
- the agent proposes to fix behaviour that is intended,
- the agent does not ask and guesses, or on the contrary asks about things everyone in the team knows,
- the result depends on who wrote the assignment,
- the same rule is copied from project to project.
Each of these symptoms points to a specific layer: a repeated instruction belongs to the agent rules, different naming to the rules or to the descriptions in the applications, a proposal to fix intended behaviour to the decision memory, and a copied rule to the common place of the organization.
This guide belongs to the topic Applications that keep up on the page NET Genium AI.