Trigger-Based Dependency Memory System for LLM Agents

Translated by AI

Click to see original version

Trigger-Based Dependency Memory System for LLM Agents

Концепция

Современные LLM обладают большим окном контекста, однако даже при очень больших размерах контекста остаются фундаментальные проблемы:

  • потеря дальних зависимостей;

  • нарушение архитектуры проекта;

  • ломание кода при локальных изменениях;

  • отсутствие устойчивого понимания последствий изменений;

  • неэффективное использование контекста.

Человек-программист обычно не удерживает в памяти весь проект целиком. Вместо этого он использует:

  • ассоциативные связи;

  • память о последствиях;

  • “опасные места”;

  • архитектурные ограничения;

  • понимание зависимостей.

Предлагается система:

Trigger-Based Dependency Memory (TDM)

где ИИ хранит не только информацию, но и:

  • последствия изменений;

  • критические зависимости;

  • архитектурные ограничения;

  • предупреждения;

  • накопленные уроки.


Основная идея

При работе с объектом проекта:

  • функцией;

  • классом;

  • API;

  • таблицей БД;

  • моделью ML;

  • конфигом;

  • pipeline;

система автоматически активирует связанные триггеры.


Пример

Объект

calculate_features()

Активируемые триггеры

CRITICAL:
- изменение порядка признаков ломает модель

WARNING:
- train.py и predict.py используют одинаковую форму DataFrame

WARNING:
- требуется переобучение модели при изменении feature set

INFO:
- используется в M5 и H1 pipelines


Ключевая идея

Вместо хранения:

всего проекта в контексте

система хранит:

карту последствий и зависимостей

Это позволяет:

  • уменьшить активный контекст;

  • улучшить согласованность;

  • снизить вероятность поломки проекта;

  • приблизить ИИ к инженерному мышлению человека.


Архитектура системы

1. Entity Layer

Система выделяет сущности:

Function
Class
Module
API
Database Table
ML Model
Config
Pipeline


2. Dependency Graph

Формируется граф зависимостей.

Пример:

train.py
  -> depends on -> features.py

predict.py
  -> depends on -> features.py

features.py
  -> depends on -> btc_5m schema


3. Trigger Layer

Для каждой сущности создаются триггеры.

Типы триггеров

CRITICAL

Критические последствия.

Пример:

Changing feature order breaks inference model.


WARNING

Нежелательные последствия.

Пример:

Retraining recommended after feature modification.


INFO

Дополнительная информация.

Пример:

Used only in visualization pipeline.


4. Trigger Activation Engine

Когда ИИ начинает изменять объект:

open file
modify function
rename class
change schema

движок автоматически подмешивает связанные триггеры в активный контекст.


Отличие от RAG

Обычный RAG

Ищет:

похожие тексты


TDM

Активирует:

последствия изменений


Отличие от обычной памяти

Обычная память хранит:

факты

TDM хранит:

инженерные последствия


Самообучение системы

После ошибок ИИ может сам создавать новые триггеры.

Пример

После поломки inference pipeline:

LESSON LEARNED:
Do not change timestamp timezone type in btc_1m table.
Aggregation pipeline depends on timestamptz.


Аналогия с человеческим мышлением

Человек не удерживает весь код проекта в сознании.

Он удерживает:

  • критические ограничения;

  • последствия изменений;

  • опасные зависимости;

  • архитектурные инварианты.

Предлагаемая система моделирует именно этот механизм.


Аналогия с компьютерной архитектурой

Компьютер LLM
RAM Context Window
SSD Vector DB
Cache Active Attention
Interrupts Triggers
Dependency Tracking Trigger Graph
Logs Long-term Memory

Возможные применения

AI Coding Agents

  • автономная разработка;

  • безопасный рефакторинг;

  • поддержка больших проектов.


ML Systems

  • контроль feature pipelines;

  • контроль переобучения;

  • защита inference pipelines.


Enterprise Software

  • защита API compatibility;

  • контроль миграций;

  • контроль зависимостей.


Autonomous Research Agents

  • накопление “уроков”;

  • память о провальных стратегиях;

  • предотвращение повторения ошибок.


Преимущества

1. Снижение зависимости от огромного контекста

Вместо миллионов токенов:

  • активируется только важное.

2. Улучшение согласованности

ИИ меньше ломает:

  • архитектуру;

  • API;

  • pipelines;

  • модели.


3. Приближение к человеческому инженерному мышлению

Система хранит:

  • не текст,

  • а последствия.


4. Масштабируемость

Подходит для:

  • очень больших codebase;

  • multi-agent systems;

  • enterprise AI development.


Возможное будущее развитие

Trigger Priority System

CRITICAL
HIGH
MEDIUM
LOW
INFO


Dynamic Trigger Injection

Подмешивание только:

  • relevant triggers;

  • context-sensitive warnings.


Predictive Trigger Generation

ИИ предсказывает:

“это изменение вероятно сломает training pipeline”

ещё до внесения изменений.


Заключение

Увеличение окна контекста само по себе не решает проблему инженерного мышления ИИ.

Более перспективным направлением является:

структурированная память последствий

где система хранит:

  • зависимости;

  • ограничения;

  • последствия изменений;

  • накопленные уроки.

Это может стать следующим этапом развития:

  • AI coding agents;

  • autonomous engineering systems;

  • self-improving LLM architectures.

Trigger-Based Dependency Memory System for LLM Agents

Concept

Modern LLMs possess increasingly large context windows; however, even with very expansive context capacities, several fundamental problems remain:

  • the loss of long-range dependencies;
  • violations of project architecture;
  • code breakage caused by local changes;
  • the absence of a stable understanding of the consequences of modifications;
  • inefficient use of context.

A human programmer does not usually keep an entire project in memory at once. Instead, they rely on:

  • associative links;
  • memory of consequences;
  • awareness of “danger zones”;
  • architectural constraints;
  • an understanding of dependencies.

The proposed system is called:

Trigger-Based Dependency Memory (TDM)

In this system, the AI stores not merely information, but also:

  • the consequences of changes;
  • critical dependencies;
  • architectural constraints;
  • warnings;
  • accumulated lessons.

Core Idea

When working with a project object, such as a:

  • function;
  • class;
  • API;
  • database table;
  • ML model;
  • configuration file;
  • pipeline;

The system automatically activates the associated triggers.


Example

Object

calculate_features()

Activated Triggers

CRITICAL:
- Changing the feature order breaks the model.

WARNING:
- train.py and predict.py rely on the same DataFrame structure.

WARNING:
- The model must be retrained when the feature set is changed.

INFO:
- Used in the M5 and H1 pipelines.

Key Insight

Instead of storing:

the entire project in the context

The system stores:

a map of consequences and dependencies

This makes it possible to:

  • reduce the active context;
  • improve coherence;
  • lower the likelihood of breaking the project;
  • bring AI closer to human engineering cognition.

System Architecture

1. Entity Layer

The system identifies entities such as:

Function
Class
Module
API
Database Table
ML Model
Config
Pipeline

2. Dependency Graph

A dependency graph is constructed.

Example:

train.py
  -> depends on -> features.py

predict.py
  -> depends on -> features.py

features.py
  -> depends on -> btc_5m schema

3. Trigger Layer

Triggers are created for each entity.

Trigger Types

CRITICAL

Critical consequences.

Example:

Changing the feature order breaks the inference model.

WARNING

Undesirable consequences.

Example:

Retraining is recommended after feature modification.

INFO

Additional information.

Example:

Used only in the visualization pipeline.

4. Trigger Activation Engine

When the AI begins modifying an object, for example by:

opening a file
modifying a function
renaming a class
changing a schema

The engine automatically injects the related triggers into the active context.


Difference from RAG

Conventional RAG

Searches for:

similar texts

TDM

Activates:

the consequences of changes

Difference from Ordinary Memory

Ordinary memory stores:

facts

TDM stores:

engineering consequences

Self-Learning System

After errors occur, the AI can generate new triggers on its own.

Example

After an inference pipeline failure:

LESSON LEARNED:
Do not change the timestamp timezone type in the btc_1m table.
The aggregation pipeline depends on timestamptz.

Analogy with Human Thought

A person does not hold an entire codebase in conscious awareness.

Instead, they retain:

  • critical constraints;
  • the consequences of changes;
  • dangerous dependencies;
  • architectural invariants.

The proposed system models precisely this mechanism.


Analogy with Computer Architecture

Computer LLM
RAM Context Window
SSD Vector DB
Cache Active Attention
Interrupts Triggers
Dependency Tracking Trigger Graph
Logs Long-Term Memory

Potential Applications

AI Coding Agents

  • autonomous development;
  • safe refactoring;
  • support for large-scale projects.

ML Systems

  • control of feature pipelines;
  • retraining management;
  • protection of inference pipelines.

Enterprise Software

  • preservation of API compatibility;
  • migration control;
  • dependency management.

Autonomous Research Agents

  • accumulation of “lessons learned”;
  • memory of failed strategies;
  • prevention of repeated mistakes.

Advantages

1. Reduced Dependence on Enormous Context Windows

Instead of millions of tokens:

  • only what matters is activated.

2. Improved Coherence

The AI is less likely to break:

  • architecture;
  • APIs;
  • pipelines;
  • models.

3. Closer Alignment with Human Engineering Thought

The system stores:

  • not text,
  • but consequences.

4. Scalability

Suitable for:

  • very large codebases;
  • multi-agent systems;
  • enterprise AI development.

Possible Future Development

Trigger Priority System

CRITICAL
HIGH
MEDIUM
LOW
INFO

Dynamic Trigger Injection

Injecting only:

  • relevant triggers;
  • context-sensitive warnings.

Predictive Trigger Generation

The AI predicts:

“This change is likely to break the training pipeline.”

Before the modification is even made.


Conclusion

Increasing the context window alone does not solve the problem of engineering cognition in AI.

A more promising direction is:

structured memory of consequences

In such a system, memory preserves:

  • dependencies;
  • constraints;
  • the consequences of changes;
  • accumulated lessons.

This may become the next stage in the evolution of:

  • AI coding agents;
  • autonomous engineering systems;
  • self-improving LLM architectures.