Free · WaitlistJoin the waitlist for the free 2-day Vibecoding & AI Agents Intensive (autonomous Hermes + DeepSeek agent · led by Jemal Hamidun, Head of AI at Alpina Digital & MIPT)Join the waitlist →
ReleaseInsight · On RadarHabr AI→ original

K2Tech Built an AI Agent Inside 1C and Cut Repeated Context Processing by 50–70%

The K2Tech team embedded an AI agent directly into 1C. External tools like Cursor and OpenCode did not let them control what goes to the model, and on deep analysis they could burn through up to a million tokens. So the team wrote the agent loop itself. By the team's estimates, its cache optimization cut repeated context processing by 50–70%. The agent acts on behalf of the user and cannot see data the user has no access to. For enterprise agents, control over context and permissions matters more than the choice of model.

AI-processed from Habr AI; edited by Hamidun News
K2Tech Built an AI Agent Inside 1C and Cut Repeated Context Processing by 50–70%
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Full indexing of an ERP takes 4–6 hours; the delta from Git takes minutes
Key metric #2Risky skills are checked by a reviewer agent, an expert, and an architect
Key metric #3The agent pulled equipment specifications from the internet to fill in equipment cards

Imagine this: after a 1C update, you go to "Cashless Payments" to check a payment under a contract and end up in "NSI and Administration." The interface has moved again, and you have to search for the data from scratch. An assistant that knows not abstract 1C but your specific configuration, with all the customizations, would come in handy here.

Andrey Khashkin, senior business transformation consultant at K2Tech (a Russian IT integrator), described on Habr how his team built such an agent inside 1C itself. The key figure from the article: the team's own cache handling, by its estimates, reduces repeated context processing by 50–70%. Put simply, the model doesn't have to "re-read" the same material at every step, so tasks cost less.

As a reminder, tokens are units of text that you pay for when calling a model.

Why Not Cursor or OpenCode

First, the team connected MCP (a standard way to give a model access to external systems) to Cursor and added a configuration graph so the AI could understand the specific database. It worked, but the approach had limitations. You can't put users in Cursor, and most 1C developers work in the configurator, not VS Code. Consultants need a familiar interface even more: they need to quickly see what changed in a project, which objects are linked, and where to find the relevant logic.

The first idea was to draw the entire agent interface as a web page inside the 1C window. That didn't work: the platform has its own HTML renderer and JavaScript, which differ from Chrome, and the more complex the interface became, the more workarounds it required. The team had to find a compromise between HTML and the platform's native components.

The second idea was to keep the agent loop in an external OpenCode instance and use 1C only to display what it was doing. But then the team wouldn't control what information the agent passes to the language model, or in what form. For 1C this is critical: the request has to assemble the configuration context, the user's current request, and the dialogue history. In the team's scenarios, their own context-handling logic performed an order of magnitude better than OpenCode's out-of-the-box version. In addition, an external agent can consume tens or even hundreds of thousands of tokens on a simple task, and on deep cash-flow analysis with recommendations, consumption reaches a million.

Another inconvenient detail: an external agent usually saves a table or report to a separate file. A 1C user would rather get the table, a chart, or a clickable link to the document right in the working window. So the agent loop moved inside 1C, while MCP remained the way to connect external sources such as the 1C:ITS website, email, and others. The author "vibe-coded" the first version for a demo. The architect spent a couple of days trying to refactor it and said it would be simpler to rewrite. Only the concept, the visual part, and the main approaches survived from the prototype; everything else was rebuilt from scratch, with access control and a security architecture.

How the Agent Knows the Configuration

The model was not fine-tuned for 1C. Instead, with each request it receives a system prompt, the current task, and data, including data from the configuration graph. The graph is an MCP server with a vector-graph database built on a modified open source component. It indexes metadata, reference material, standard and customized code, and the relationships between objects.

By estimate, full indexing of a large configuration such as an ERP or "Holding Management" takes four to six hours. Running it after every customization is too expensive, so the team added incremental indexing: changes go into Git or the repository, only the delta is pushed to the graph, and the update takes minutes. The graph was built into the standard CI/CD process for 1C development.

The subtlety is that a request like "show receivables" is ambiguous. The data can live in accounting and operational records, in settlements by organization, and in separate VAT histories, and the set of options depends on the configuration. The agent looks at the context: when closing a month it needs one set of data, and when checking a reconciliation statement it needs detail down to the settlement documents. If the context is unclear, it asks. It can assemble receivables from both the ERP and a connected "1C:Accounting" and match counterparties.

Permissions, Tools, and Skills

The agent always acts on behalf of the user: whatever you cannot see yourself, you cannot get through it either. Tools (creating reports, executing arbitrary code, internet access, individual skills) are granted per user or per group. In one project, the agent was given internet access, and it filled in equipment cards with technical specifications from the manufacturer's documentation.

Repeatable scenarios are packaged as skills. An expert discusses with the agent, for example, creating a sales document from an invoice with a check of the contract and the client's latest revenue. If the result is satisfactory, the expert issues the command "Create a skill!" A skill consists of a text instruction and procedure code. If it modifies data, a specialized agent first reviews the code and looks for dangerous operations, such as direct deletion. Then an expert confirms its use, and if there are concerns, a technical architect analyzes the code. Only after that does the skill become available to other users.

From the available fragment of the article, it is unclear how the other ways of modifying data are described: it is only known that there are three, and the first is safe modification. The figures in the material are the team's own estimates; there are no independent measurements. The practical takeaway for anyone building enterprise agents: the value rests on control over context, user permissions, and skill verification, not just on the choice of model.

Story

Key Questions Answered

Why Not Cursor or OpenCode?

First, the team connected MCP (a standard way to give a model access to external systems) to Cursor and added a configuration graph so the AI could understand the specific database. It worked, but the approach had limitations. You can't put users in Cursor, and most 1C developers work in the configurator, not VS Code. Consultants need a familiar interface even more: they need to quickly see what changed in a project, which objects are linked, and where to find the relevant logic.

How the Agent Knows the Configuration?

The model was not fine-tuned for 1C. Instead, with each request it receives a system prompt, the current task, and data, including data from the configuration graph. The graph is an MCP server with a vector-graph database built on a modified open source component. It indexes metadata, reference material, standard and customized code, and the relationships between objects. By estimate, full indexing of a large configuration such as an ERP or "Holding Management" takes four to six hours.

What are the key details on Permissions, Tools, and Skills?

The agent always acts on behalf of the user: whatever you cannot see yourself, you cannot get through it either. Tools (creating reports, executing arbitrary code, internet access, individual skills) are granted per user or per group. In one project, the agent was given internet access, and it filled in equipment cards with technical specifications from the manufacturer's documentation. Repeatable scenarios are packaged as skills.

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.
✦ Free · Waitlist · Hermes + DeepSeek

Free 2-Day Vibecoding & AI Agents Intensive

Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.

Join the waitlist →Nomad AI Workspace
What do you think?
Loading comments…