How Structured Memory Helps AI Agents Conquer Slay the Spire 2

Researchers have developed a new agentic architecture, AgenticSTS, that outperforms traditional LLM agents by replacing bloated chat logs with a sophisticated five-layer structured memory system. By moving away from the "growing transcript" model, this approach significantly reduces token costs while enabling agents to learn complex strategies across multiple playthroughs.

The Problem with Growing Chat Logs

Most current LLM agents, such as those using ReAct or Reflexion frameworks, rely on appending every past observation, tool call, and self-reflection to a continuous text log. As a session progresses, this context window expands until it either overflows or the model's attention becomes diluted by irrelevant historical data.

In testing against the complex deck-building roguelike Slay the Spire 2, this inefficiency was glaring. Competitors like STS2MCP and CharTyr, which utilize the classic growing-transcript pattern, saw single model calls balloon to approximately 527,000 tokens. This architectural flaw leads to massive latency and astronomical token costs, with competitors using 66 to 90 times more tokens than AgenticSTS to achieve similar scores.

The Five-Layer Memory Solution

AgenticSTS solves the context inflation problem by rebuilding each decision prompt from five organized, discrete memory slots. This ensures the prompt remains lean—averaging around 5,000 tokens—regardless of how long the game lasts. The layers are structured as follows:

  • L1 (Fixed Protocol): Core instructions for the agent.
  • L2 (State Schemas): Definitions of currently valid actions.
  • L3 (Retrievable Rules): Specific game rules fetched as needed.
  • L4 (Episodic Memory): Summaries of previous runs to provide long-term context.
  • L5 (Skill Library): Tactical rules triggered by specific situational patterns.

This modularity allows researchers to pinpoint exactly which component drives performance improvements. For example, enabling the L5 skill library alone doubled the agent's win rate from 3 in 10 games to 6 in 10 games at the A0 difficulty level.

Scaling Difficulty Through Learning

The real power of the structured approach lies in inter-run learning. While standard agents struggle to progress beyond the lowest difficulty levels, AgenticSTS leverages its L4 and L5 layers to ascend the game's difficulty ladder. Without active memory that updates between runs, the agent stalls at levels A2 through A4; however, with memory that persists across sessions, it successfully reaches the much harder A6 through A8 levels.

Interestingly, the researchers found that this memory is highly model-specific. When a memory stack generated by Gemini 3.1 Pro was transferred to Qwen 3.6-27B, the latter's score rose by 84.5%, but Deepseek V4-Pro's score actually dropped by 18.1%. This suggests that while structured memory is powerful, the "knowledge" contained within it is deeply tied to the reasoning patterns of the model that created it.

Why This Matters for the AI Industry

The success of AgenticSTS signals a shift in agentic design: the future of autonomous AI lies not in larger context windows, but in smarter, more structured memory management. For developers building long-running agents, this architecture offers a blueprint for reducing operational costs and latency while significantly improving the model's ability to perform complex, multi-step reasoning.

Key Takeaways

  • Efficiency Gains: AgenticSTS maintains a consistent 5,000-token prompt, using up to 90x fewer tokens than agents relying on growing chat logs.
  • Enhanced Performance: Utilizing a "Skill Library" (L5) can double an agent's win rate and enable progression to much higher difficulty tiers through inter-run learning.
  • Architectural Shift: Moving from unstructured transcripts to multi-layered memory solves the issues of attention dilution and skyrocketing model latency.