Tencent Hyra 2.0: a framework that preserves accumulated experience across sessionsArticle · digest for November 7
Hy-Memory long-term memory architecture preserving rules across sessions
Article4 sections≈ 5 min

Tencent Hyra 2.0: a framework that preserves accumulated experience across sessions

Think about how any modern language assistant behaves in regular work. Yesterday you spent two hours explaining the structure of your project to it, patiently fixing syntax errors in a web server config, and teaching it the right table export format. Then morning comes, you open a new chat window—and you see a blank slate. The model remembers nothing again, cheerfully suggests the exact same broken commands, and steps on the exact same rakes you spent hours fixing yesterday.

This ailment is called "agent amnesia." Trying to cure it by simply inflating the context window to a million tokens doesn't end well: context becomes outrageously expensive, and the model's attention degrades (the attention rot effect). Tencent Hunyuan's research division proposed a fundamentally different architectural solution: the Tencent Hyra 2.0 framework and the open-source Hy-Memory 2.0 long-term memory stack, enabling agents to continuously accumulate experience and carry it across weeks of work.

Agent amnesia: why a million-token context won't save you from repeating mistakes

When we feed a model a giant wall of raw chat logs from last week, we force it to hunt for a needle in a haystack. In an archive of dialogues, 95% of the text consists of boilerplate phrases, intermediate reasoning, and failed attempts.

The Hyra 2.0 architecture relies on a fundamentally different approach: a Lesson Reflection phase. After completing any work task—whether successful or failed—the agent doesn't close the session silently. It runs a short self-analysis loop:

  1. What goal was set for the task?
  2. Where did a failure or delay occur?
  3. What specific abstract rule will prevent this mistake from happening again in the future?

The resulting lesson is packed into a compact three-field structure: situation trigger, condition, and corrective action. This rule is written to a persistent Books knowledge base, becoming available not only to the current agent, but to any other assistant in the ecosystem.

Hy-Memory 2.0 architecture and the 30B MoE memory model

Spending pricey flagship models like Claude Opus or GPT-4o on routine memory-note packing makes no economic sense. That's why Tencent trained a specialized open model, Hy-Memory-30B-A3B.

It uses a Mixture-of-Experts (MoE) architecture with 30 billion total parameters, but only 3 billion Active Parameters are triggered per token. The model is narrowly tuned for entity extraction, resolving semantic contradictions, and experience compression. Thanks to its compact active parameter count, it runs at lightning speed, and vector search across a base of 50,000 accumulated precedents via Qdrant or ChromaDB takes under 60 milliseconds. According to the developers' benchmarks, introducing the reflection phase reduces repeated mistakes of the same type by 84% after just the second work session.

Three knowledge domains: from user profile to diff-patch chains

In Hy-Memory 2.0, memory is strictly structured into three independent domains:

  • Chat Memory: stores the user's profile—preferred speech style, professional background, response language, and terminology specifics.
  • Working Memory: the state of open tasks, list of involved services, and intermediate analytics conclusions.
  • Coding Memory: a specialized diff-chain of patches. The agent remembers not just the current code, but the history of its changes and the reasons why a particular architectural decision was made.

To connect memory with external environments, the cross-application MemHub gateway is used, allowing IDEs, CLI utilities, and browser plugins to plug into a single unified store.

Programmatic integration and the reflection phase in Python

The package installs with a single command from the open repository:

pip install hy-memory

Below is a Python implementation of the reflection engine that extracts lessons and injects them into new prompts:

from dataclasses import dataclass
from typing import Dict, Any, List

@dataclass
class JobOutcome:
    job_id: str
    target_action: str
    status: str
    diagnostic_output: str

class HyraMemoryController:
    def __init__(self):
        self.lessons_catalog: List[Dict[str, Any]] = []

    def reflect_on_outcome(self, outcome: JobOutcome) -> Dict[str, Any]:
        # Extract an invariant rule from the failure
        if outcome.status == "failed":
            lesson = {
                "scope": outcome.target_action,
                "error_trigger": "nginx_reload_fail",
                "remedy_rule": "Always run 'nginx -t' syntax check before calling systemctl restart",
                "confidence": 0.95
            }
        else:
            lesson = {
                "scope": outcome.target_action,
                "error_trigger": "none",
                "remedy_rule": "Use the clean-build directive to prevent artifact conflicts",
                "confidence": 0.85
            }
        self.lessons_catalog.append(lesson)
        print(f"[HY-MEMORY] Lesson saved to Books: {lesson['remedy_rule']}")
        return lesson

    def enrich_prompt_with_experience(self, action_type: str, base_query: str) -> str:
        matched_rules = [item['remedy_rule'] for item in self.lessons_catalog if item['scope'] == action_type]
        if not matched_rules:
            return base_query
            
        advice_block = "\n".join([f"- Past experience: {rule}" for rule in matched_rules])
        return f"{base_query}\n\n[RELEVANT HY-MEMORY EXPERIENCE]\n{advice_block}"

The Tencent Hyra 2.0 concept closes the main gap between disposable demo bots and reliable enterprise assistants: AI finally starts learning from its own mistakes, growing smarter and more experienced with every working day.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3