Live Nov 18 · Cohort 3Nov 18, 19:00 MSK — free hands-on AI agents live workshop · Live Cohort 3 starts Nov 23Join Nov 18 Live →Cohort 3 (Nov 23)
ReleaseAPI / Product · ActionableHabr AI→ original

Kub Tri gave an AI agent project memory: reviews get easier, but the model costs almost a third more

An AI agent starts every workday as if for the first time: Claude wrote an endpoint but duplicated an authorization function that already existed. For a year and a half, the Kub Tri team has been building AI Council, a project memory made of a code graph, decisions and rules. With it, code passes review more easily, but the model's work costs almost a third more. The takeaway: you have to feed knowledge to the agent yourself.

AI-processed from Habr AI; edited by Hamidun News
Kub Tri gave an AI agent project memory: reviews get easier, but the model costs almost a third more
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1The agent checked the rules on its own in only 16% of 12 thousand working sessions
Key metric #2Before its first code edit, rules were requested in 13% of sessions with edits
Key metric #3A knowledge entry is tied to a file and enters the context when that file is opened

An AI agent that writes code starts each morning with a blank slate: it does not remember yesterday's conversation, and decisions the team made six months ago simply are not in the code. In early 2025, developers at the Kub Tri studio asked Claude to add an API endpoint to a project. The code came out fast and tidy, but code review (colleagues checking code before it is merged into the project) found three problems: business logic sat in the controller, though the project does not do that; the authorization function had been written from scratch, though one already existed; and a method was named getUser instead of the accepted get_user.

The next day, with a different task, it all happened again. Over a year and a half, the team built a "project memory" for the agent, the AI Council platform. In a direct comparison, the agent with it wrote code that is easier to accept in review, but the model's work cost almost a third more: that is how much spending on AI calls grew.

If you are rolling out agents in team development, this comparison shows where to look for the benefit and what you will have to pay for.

What the agent doesn't know

The team went through review comments in its own projects and identified three kinds of gaps. The first is structure: which modules exist, who calls whom, where a needed function lives. A parser or search can derive it from the code, although the agent itself does this slowly and expensively. The second is decisions: why payments go through a queue, which option was already rejected. Only the outcome remains in the code, while the reasons live in chats, closed merge requests and people's heads. The third is team rules: layers, naming, prohibitions. A linter checks only a small part of them, and only after the code is written.

The endpoint story involved two of the three kinds. The agent wrote a second authorization function because it did not know the structure, while the logic in the controller and getUser appeared because it did not know the rules.

Time adds another layer. Documentation that has fallen behind the code is harmful: the agent believes it. And if five agents work in five branches, a decision made in one must not affect the others until that branch is merged into main.

Free tools cover part of these tasks. The CLAUDE.md and AGENTS.md files provide rules as advice and quietly go stale. Serena, claude-context, CodeGraph and TeaRAGs know the code structure, but not decisions and rules. Memory servers store notes that are not linked to code. AI review tools (CodeRabbit, Greptile, Qodo) come in when the code is already written. For a small project with one or two developers, the authors advise getting by with CLAUDE.md and Serena or claude-context.

How AI Council works

The platform is built from three connected layers. The code graph is built by static analysis, without a model. Vector search handles search by meaning. A separate layer stores what cannot be derived from code: knowledge entries and rules. An entry explains how and why something is built the way it is, and is tied to classes, modules or files. A rule has the force of MUST (mandatory) or SHOULD (recommended) and a scope. The agent takes an entry into account; it is obliged to follow a rule.

The most practical observation concerns delivery. The team looked at 12 thousand working sessions: the agent launched the rule check through an MCP tool on its own in only 16% of them, and before its first code edit in only 13% of sessions with edits. That means in roughly 87% of such sessions it started working on code without asking for the rules.

So the team made Claude Code hooks the main channel: handlers that fire at set moments, which the model cannot skip. At the start, the project rules arrive; when a file is opened, the rules and entries tied to it arrive; and at the end of a response, a checklist of checks. MCP remained as a fallback for agents without hooks.

An example from a client project: in a CRM, "unknown" contacts from incoming emails had to be merged with known ones. The standard merge overwrote fields. A developer spent a day and found a scheme (move the links to the known contact, delete the unknown one) and tied an entry to the contact model. The next time the agent opened the model file, the entry arrived in the context on its own, and the agent did not reinvent the merge.

Cost and caveats

Assembling context for one question takes from 9 to 18 thousand characters, a few thousand tokens, roughly the size of one file of 300–500 lines. The entries from Keycloak tickets, of which there were more than three thousand, were also processed by a model, so the team paid for the model's work instead of people's time. That is where the increase of almost a third comes from.

The caveats are obvious. The product is commercial, and the numbers were collected by the team itself on its own production, not by an independent measurement. Entry bindings have to be chosen carefully: a binding that is too broad (in the example, the name matched 357 entities) is discarded. The hint, which is keyed to the agent's wording, stays silent if the agent calls a thing by other words.

The practical takeaway does not depend on the product. Do not expect the agent to go looking for the rules on its own: build in delivery through hooks and tie knowledge to specific code. And decide in advance whether you are ready to pay about a third on top for a lighter review load. The industry studies the authors cite show that the bottleneck has already moved from writing code to checking it.

Story

Key Questions Answered

What the agent doesn't know?

The team went through review comments in its own projects and identified three kinds of gaps. The first is structure: which modules exist, who calls whom, where a needed function lives. A parser or search can derive it from the code, although the agent itself does this slowly and expensively. The second is decisions: why payments go through a queue, which option was already rejected. Only the outcome remains in the code, while the reasons live in chats, closed merge requests and people's heads.

How AI Council works?

The platform is built from three connected layers. The code graph is built by static analysis, without a model. Vector search handles search by meaning. A separate layer stores what cannot be derived from code: knowledge entries and rules. An entry explains how and why something is built the way it is, and is tied to classes, modules or files. A rule has the force of MUST (mandatory) or SHOULD (recommended) and a scope. The agent takes an entry into account; it is obliged to follow a rule.

What are the key details on Cost and caveats?

Assembling context for one question takes from 9 to 18 thousand characters, a few thousand tokens, roughly the size of one file of 300–500 lines. The entries from Keycloak tickets, of which there were more than three thousand, were also processed by a model, so the team paid for the model's work instead of people's time. That is where the increase of almost a third comes from. The caveats are obvious.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…