Inside Acontext: How AI Agents Learn from Experience

Nov 18, 2025


🧩 Acontext Architecture: From Context to Skill

The diagram below captures the entire process — how Acontext takes raw LLM messages, turns them into structured tasks, distills knowledge, and builds reusable skills.

Let's walk through it step by step.


context data → extract patterns → create & store skills → apply & refine → agent improves

Every message, tool call, artifact, and user feedback is captured as context. Patterns are extracted into reusable skills, applied to new tasks, and refined through feedback, enabling the agent to learn continuously from its own experience.

Acontext organizes and manages this data flow, turning raw context into structured, self-improving behavior.


1️⃣ Multi-Modal Context: Capturing the Raw Stream

On the left, we have everything that happens inside an agent run:

user requests, plans, tool calls, Memories, and feedback.

A typical workflow looks like this:

  • User: "Make me a landing page."

  • Agent: "Here's the plan → Initialize → Build → Deploy."

  • Agent calls tools (list_dir, find_file, etc.) and reports progress.

  • The user intervenes: "Wrong stack, use Next.js."

  • The agent continues, completes the task, or fails in the attempt.

All of these steps, including messages, tool traces, generated artifacts, and memory, are saved to Acontext through a unified storage API.

This is the Store phase. It captures every relevant context, so nothing gets lost between runs.

2️⃣ Extract Tasks and Feedback: Making Behavior Observable

The middle section represents Acontext's Observer layer. Once data is stored, this layer automatically extracts tasks and feedback from the raw message stream.

Each task is represented as a structured record containing:

  • Objective: what the agent was trying to achieve

  • Progress: key execution steps

  • User Preferences: hints or corrections from users

  • State: pending / success / failed

  • Feedback: what worked and what didn't

For example:

  • Task 1 — pending: located the source folder but didn't build.

  • Task 2 — success: built components; user prefers Next.js.

  • Task 3 — failed: deployment attempted but hit compile errors.


By organizing the execution trace into task-level records, Acontext gives you a clear, context-aware, and task-level view of what the agent promised, what it did, and why it succeeded or failed.

This isn't token-level observability. It's behavioral observability.


3️⃣ Distill & Learn: Turning Execution into Experience

This is where Acontext begins to learn on its own.

Step 1: Structured Data Extraction: Converting Executions into Training Signals

Whenever a task is marked as successful, either because the agent achieved the goal or the user explicitly confirmed it, Acontext's background learner retrieves the complete semantic trace related to that task, including:

  • The conversation segment that established the goal and constraints

  • The agent's reasoning or planning (when available)

  • Tool calls, parameters, outputs, and intermediate state

  • User corrections, preferences, and approvals

  • The final result and the success signal


The key principle: Only validated successes are selected as learning samples.

Each sample is stored as a structured execution record that includes the goal, the reasoning chain, the operational steps, context conditions, and evidence of correctness.

This is not log scraping; it is targeted data extraction for learning.


Step 2: Semantic Grouping to Identify Successful Patterns Across Runs

Next comes semantic clustering. Acontext automatically groups similar successful tasks by intent and outcome.

It looks for recurring execution patterns, then identifies consistent behavioral patterns and filters out noise or partial runs.

Typical examples include:

  • Repeated workflows for project initialization

  • Recurring patterns in 'collect → analyze → report' tasks

  • Consistent resolution strategies after user corrections

  • Multi-step tool-call chains that reliably lead to success

Clustering allows Acontext to:

  • Surface what consistently worked

  • Filter out partial executions, noise, or one-off behaviors

  • Identify the underlying structure of a successful process

The result: clusters of tasks that consistently led to success form the foundation for new skills.


Step 3: Compress Successful Behavior into Reusable Skills

From each stable cluster, Acontext synthesizes a Skill: a distilled blueprint describing how to accomplish a goal effectively. There are four core elements which are drawn directly from the execution data:

• Procedures - the actionable steps

The sequence of operations or tool calls that repeatedly produced the desired outcome.

• Patterns - general strategies

How the agent approached the problem:

e.g., "search → filter → summarize," or "update plan after user correction."

• Context - when the skill applies

The input conditions or environment under which the procedure is valid.

e.g., "This workflow is more efficient when the user favors Next.js."

• Preferences - user's implicit rules

Individual user preferences extracted from interactions, such as:

"Always report before executing," or "Use pnpm instead of npm."

Acontext transforms these elements into a structured Skill object, which is ready to be stored and retrieved.


Skill Space: Organize, Retrieve, Reuse

On the right of Architecture Diagram, these learned skills are saved in a Notion-style workspace.

Each Skill Space acts as a dynamic, structured memory layer for your agents, organized by domain or capability, such as:

  • frontend_preferences

  • github_operations

  • linkedin_operations

Skill Space is dynamic and continuously maintained by Acontext, forms a living library of what consistently works, tailored to each individual user or agent.

Skills are automatically created from new successful runs

  • Overlapping skills are merged

  • Stale or redundant skills are pruned

Skill Retrieval

When a new task arrives, Acontext searches the Skill Space to surface relevant past experience.

It supports two modes:

  • Semantic Search:quickly find skills that match the task's intent

  • Agentic Search:combine multiple skills when the task is more complex

Retrieved skills are provided back to the agent as context or guidance, allowing it to start with learned experience instead of a blank slate.


4️⃣Act Smarter and Start the Next Loop

At the bottom, the arrow labeled "Improve the Agent next time" represents Acontext's continuous learning loop.

With learned skills in place, the agent begins each new run with:

  • better defaults

  • clearer workflows

  • personalized preferences

  • fewer mistakes

In short:

Act = the agent behaving smarter because it has learned.

And once the run finishes, its execution trace flows back into the same loop:

Store → Observe → Learn → Act → …

This continuous cycle empowers a self-improving agent: each action generates new data, each success becomes new skillset, and every skill enables better actions in the next iteration.


The Data Model in Acontext

Under the hood, Acontext operates on those object types:

Object

Description

Session

A conversation thread that stores all messages with multi-modal support (message, tool calls, artifacts). Acontext automatically tracks what tasks the agent plans and executes.

Trace

The granular execution timeline within a session: every plan, tool call, state transition, and response captured in sequence.

Task

A step of the agent’s plan, extracted automatically from conversation. Tasks transition through: pending → running → success/failed. Represents intent, progress, and outcome.

Disk

File storage for agent-generated artifacts (e.g., code, images, documents). Used to preserve outputs that tasks produce.

Space

A knowledge repository (like a Notion workspace) where learned skills are stored. Connecting sessions to a Space enables automatic skill learning from completed tasks.

Skill Block

A learned SOP (Standard Operating Procedure) derived from complex tasks. Includes use_when conditions, user preferences, and tool_sops patterns. Only sufficiently complex and validated tasks become skills.

Skill / Skill Space

A distilled, reusable representation of successful behavior. Skills inside a Skill Space are searchable, versioned, and continuously refined. Each skill contains: • Procedures: the step-by-step approach that worked • Patterns: recurring strategies or action flows • Context: where the skill applies • Preferences:user-specific requirements or constraints

Experience Agents

Background AIs that automatically extract tasks, group patterns, and synthesize Skill Blocks. They run continuously and require no direct interaction.

This model turns context from "raw logs" into structured experience data that's both searchable and reusable.


⚙️ Key Design Principles


  • Unified Context Storage: Handle messages, sessions, plans, and artifacts through one API.

  • Task-Level Observability: Focus on what the agent did, not just how long it took.

  • Automatic Experience Learning: Experience extraction runs continuously in the background.

  • Personalized Skill Library: Each end user accumulates their own adaptive skill set.

  • Framework-Agnostic: Works with OpenAI, Anthropic, LangChain, and more.


🌍 Join the Community

Acontext is open source, and we need your feedback to help it grow.

  • 💻 GitHub: github.com/memodb-io/Acontext If you find it useful, give it a ⭐️ , it will help others discover it.

  • 💬 Discord: Join the Acontext Community Share integrations, feedback, or ideas for what to build next.

Follow us on

© 2025 Acontext, Inc.

Follow us on

© 2025 Acontext, Inc.

Follow us on

© 2025 Acontext, Inc.