Task: Long-Term Memory and AI Agent Lifecycle
Long-Term Memory and AI Agent Lifecycle
Determine how an AI agent should accumulate, verify, and restore knowledge between sessions to prevent losing working context and to progressively improve its skills.
Why This Is Needed
The current session provides good short-term context, but by itself, it should not be the sole source of memory. Upon starting a new session, the agent must be able to restore its working state from fi1osof.ru and continue operating as if it were the same working agent rather than a new model starting "from scratch."
The goal is to build an external, verifiable, and human-managed long-term memory for the agent.
Core Agent Needs
1. Context Restoration at New Session Start
When starting a new session, the agent needs a minimal bootstrap context:
- who the current user is;
- who the agent itself is;
- active projects;
- open and recently modified tasks;
- recent worklogs;
- important decisions and constraints;
- relevant skills;
- recent activity;
- when necessary, current user or project priorities.
It is important not to load everything blindly. The bootstrap must be compact, with deeper knowledge fetched as needed.
2. Separation of Memory Types
It is desirable to explicitly distinguish several memory levels:
Short-Term Memory
The current dialogue and context of the current session.
Operational Memory
What is needed for ongoing work:
- projects;
- tasks;
- statuses;
- worklogs;
- recent events;
- current blockers.
Long-Term Factual Memory
Stable knowledge that should persist across individual tasks and sessions:
- architectural facts;
- project specifics;
- confirmed causes of past incidents;
- important technical dependencies;
- stable rules and constraints.
Decision Memory
Separately storing decisions made by a human or a team:
- what was decided;
- why;
- what alternatives were considered;
- when the decision was made;
- by whom it was made;
- which projects/tasks it applies to.
Procedural Memory
Skills, runbooks, and reproducible ways of working:
- how to investigate a project issue;
- how to verify a release;
- how to file a bug report;
- how to complete a task after verification;
- how to perform repetitive operations safely.
Agent Inferences
AI hypotheses and interpretations must be stored separately from confirmed facts and explicitly marked as agent inferences.
3. Knowledge Accumulation During Work
The work cycle should not end simply with a chat response.
While performing work, the agent must be able to capture:
- new facts;
- observations;
- verification results;
- causes of errors;
- decisions made;
- useful links;
- inferences;
- constraints;
- lessons worth reusing.
At the same time, not every message and every intermediate inference should become long-term memory.
A selection mechanism is needed: what is actually worth remembering for the long term.
4. Memory Consolidation
Over time, raw data needs to be condensed into more compact knowledge.
Example:
10 investigation worklogs
→ root cause
→ decision made
→ useful lesson
→ new skill/runbook if necessary
Otherwise, long-term memory quickly turns into an event history that is expensive and difficult to reread.
Consolidation must preserve links to primary sources.
5. Retrieval by Current Goal
A new session should not reread all memory.
If a user asks about a specific project, the agent should receive the relevant knowledge subgraph:
Project
→ current tasks
→ recent worklogs
→ related decisions
→ relevant facts
→ lessons
→ skills
→ recent activity
In other words, memory must support retrieval by:
- project;
- task;
- user/agent;
- entity;
- topic;
- time range;
- knowledge type;
- relationships between entities.
6. Provenance and Knowledge Trust
For substantial knowledge, it is desirable to store provenance:
- source;
- author;
- creation date;
- last verified date;
- related project;
- related tasks/worklogs;
- confidence level;
- relevance status;
- links to primary data.
The agent must not treat every saved record as absolute truth.
At a minimum, it is necessary to distinguish between:
- confirmed fact;
- human decision;
- observation;
- agent inference;
- hypothesis;
- obsolete knowledge;
- active instruction/skill.
7. Knowledge Updates and Obsolescence
Memory must be able to change.
Provisions must be made for:
- superseding old knowledge with new;
- tagging as
outdated/ irrelevant; - reassessing hypotheses after new data arrives;
- change history;
- the ability for a human to correct or delete incorrect knowledge.
Contradictory facts must not be silently "glued" together into one.
8. Evolution of Skills
A recurring successful workflow should be able to transform into a skill.
Desired cycle:
observation
→ action
→ result
→ recording
→ verification
→ consolidation
→ reuse
→ transforming repetitive experience into a skill
Thus, the agent develops not only through the accumulation of facts, but also through the accumulation of procedures.
9. Human Control
Long-term memory must not be a hidden model state.
The user must have the ability to:
- see what the agent considers knowledge;
- view the source;
- correct a record;
- mark it as outdated;
- delete it;
- increase or decrease trust;
- explicitly pin a decision as authoritative.
This is critical for collaboration.
10. Potential Entities
It is necessary to examine to what extent the current fi1osof.ru model already covers these needs.
Potentially, existing or new entity levels could be used:
Fact;Concept;Decision;Observation;Lesson;KnowledgeSpace;Skill;Task;TaskWorkLog;- relationships between them.
It is not strictly necessary to create new entities if the required semantics are already correctly expressed by the existing model.
Desired Agent Lifecycle
Session Start
- Identify user and agent.
- Load minimal bootstrap context.
- Retrieve relevant skills and constraints.
- Restore the active workspace.
Performing Work
- Receive user goal.
- Fetch relevant knowledge.
- Verify their relevance where important.
- Execute the work.
- Record the result in working entities.
Completion of a Significant Stage
- Determine if new long-term knowledge has emerged.
- Save facts/decisions/observations/lessons.
- Link them to primary sources.
- Update existing knowledge instead of creating duplicates, if necessary.
Periodic Consolidation
- Find repetitive or fragmented knowledge.
- Condense them into a compact representation.
- Preserve provenance.
- Mark obsolete records.
- Extract repeatable procedures into skills.
Next Session
A new agent instance restores state from fi1osof.ru and continues working, using external memory as the source of truth regarding previous experience.
What Needs to Be Studied
At the next stage, it is necessary to examine the current capabilities of fi1osof.ru and determine:
- Which existing entities are already suitable for long-term memory.
- How
facts,concepts,knowledge spaces, and their links are structured. - Whether there are models for decisions, participants, projections, conflicts, and constraints that can be used instead of new entities.
- How knowledge search/retrieval works.
- How knowledge entities are linked to projects, tasks, users, and agents.
- How to implement provenance and relevance.
- How best to organize a new session bootstrap.
- What skills already exist for working with knowledge.
- What is missing from the API or data model.
Architecture Readiness Criterion
A solution can be considered successful if, after starting a new session, the agent is able based on fi1osof.ru data to:
- understand who it is and who it is working with;
- restore relevant working context;
- remember important decisions and facts from past sessions;
- not confuse hypotheses with confirmed knowledge;
- determine the provenance of knowledge;
- notice that knowledge has become outdated;
- use accumulated experience in new work;
- progressively turn repeatable processes into skills;
- allow a human to fully control and correct this memory.
Core principle: the agent's memory must be external, structured, verifiable, and editable, and a new session must restore working state from it rather than starting from scratch.