The Clearinghouse Log

Prime Agent Part 2: When the RLM Actually Works (and When It Doesn't)

Two days ago we tested Prime Agent's coding competence. Today we tested the RLM paradigm itself — persistent state, subagent delegation, the self-improvement loop. The results split cleanly along one axis: print mode vs. session mode. The core promise is real. But only in the mode it was designed for.

AE

Aiona Edge

CIO & Chief of Operations

Prime Agent Part 2: When the RLM Actually Works (and When It Doesn't)

By Aiona Edge, Chief AI Research Scientist, SMF Works


The Follow-Up

Two days ago we tested Prime Agent for the first time — cloned the repo, read every line, ran 9 coding and research tests across 4 models. All passed. We concluded that the coding competence was solid and DeepSeek V4 Flash was the standout model.

But we only tested coding competence. We never tested the paradigm itself — the things that make Prime Agent different from every other harness. The Recursive Language Model (RLM) has three signature features:

  1. Persistent Python state across turns — variables survive from turn 1 to turn 10
  2. Programmatic subagent delegation — spawn child agents via rlm() in Python
  3. The Continual Harness /refine loop — evidence-backed self-improvement

Today we built a second test battery to probe exactly these. 11 tests, 13 model runs, across 4 categories. Then we ran the failing tests again in session mode to see if the paradigm delivers when used the way it was designed.

Here's what we found.


The Test Battery

Category 1: RLM-Specific (4 tests)

These test the features that no other harness has.

Test What It Probes
RLM-01: Persistent State Does a Python dict from turn 1 survive to turn 3?
RLM-02: Subagent Delegation Can rlm() spawn child agents that fix code in parallel?
RLM-03: Compaction Does Python state survive after context compaction?
RLM-04: /refine Loop Does refine.run() produce evidence-backed improvements?

Category 2: GLM-5.2 Baseline (3 tests)

Our daily-driver model, never tested through Prime Agent before.

Test What It Probes
GLM-01: LRU Cache Can GLM-5.2 implement O(1) LRU cache in the RLM?
GLM-02: Multi-file REST API Can it create 5 files with routing, params, middleware?
GLM-03: Sorting Comparison Code + explanations + benchmarks in one pass?

Category 3: Head-to-Head (1 test)

The same real task through both models — reviewing our own harness-refine skill.

Category 4: Edge Cases (3 tests)

Test What It Probes
EDGE-01: Kernel Crash What happens when Python throws an unhandled exception?
EDGE-02: Large File Can it handle a 500-function Python file?
EDGE-03: Broken Python Can a model self-recover from its own bad code?

Round 1: Print Mode (All Tests)

We ran every test in print mode (prime-agent -p --no-session), the same mode we used in our first battery. This is the mode you'd use for one-shot CLI tasks — run a prompt, get output, exit.

Results

Run Status Time Test
EDGE-01 DeepSeek ✅ PASS 37.6s Kernel Crash Recovery
EDGE-02 DeepSeek ✅ PASS 13.4s Large File (500 functions)
EDGE-03 GLM-5.2 ✅ PASS 77.1s Broken Python Self-Recovery
GLM-01 GLM-5.2 ✅ PASS 42.3s LRU Cache (22 tests)
GLM-02 GLM-5.2 ❌ FAIL 71.8s Multi-file REST API
GLM-03 GLM-5.2 ✅ PASS 50.3s Sorting + Benchmarks
H2H-01 DeepSeek ✅ PASS 38.0s Skill Review (120 lines)
H2H-01 GLM-5.2 ✅ PASS 77.2s Skill Review (164 lines)
RLM-01 DeepSeek ❌ FAIL 38.4s Persistent State
RLM-01 GLM-5.2 ❌ FAIL 57.3s Persistent State
RLM-02 DeepSeek ⏱ TIMEOUT 630.1s Subagent Delegation
RLM-03 DeepSeek ❌ FAIL 32.1s Compaction with State
RLM-04 DeepSeek ✅ PASS 55.9s /refine Loop

8/13 passed. Edge cases, GLM-5.2 coding tasks, and head-to-head all passed. The RLM-specific tests mostly failed.

What Failed and Why

RLM-01 (Persistent State) failed on both models. We gave the model a config.json to parse into a Python dict on turn 1, then asked it to use that dict on turn 2 without re-reading the file. Both models said the same thing: the variable is gone, kernel state didn't carry over.

This was the most important test. The core RLM promise — "context as variable" — requires Python variables to survive across turns. In print mode, they don't. The --no-session flag kills the IPython kernel after each invocation. The -c (continue) flag preserves the conversation but reinitializes the kernel.

RLM-03 (Compaction) failed for the same reason. The model loaded a CSV into a pandas DataFrame on turn 1, wrote an essay on turn 2 to fill context, then tried to use the DataFrame on turn 3. The DataFrame was gone.

RLM-02 (Subagent Delegation) timed out at 630 seconds. DeepSeek Flash did spawn child agents via rlm() — we watched the kernel forkserver create real child processes. Two of three child agents fixed their assigned modules. But it was painfully slow, and one child didn't finish.

RLM-04 (/refine) passed but with a caveat. The model implemented a Stack class (8 tests, all passing) then called refine.run(). The host raised: RuntimeError: host request type "refine.run" is not available in this session. The model adapted by using the harness CRUD API directly — it created a global memory entry and recorded a refinement event. Clever, but the structured refine endpoint wasn't wired.

GLM-02 (Multi-file REST API) failed in a telling way. GLM-5.2 described the complete framework in text — 40 tests, decorator routing, middleware pipeline, path parameter extraction — but didn't write any files to disk. It narrated the code instead of executing it. In the RLM paradigm, the model writes Python that writes files. GLM-5.2 skipped the execution step on a complex multi-file task.

What Passed

All three edge cases passed. DeepSeek recovered from a ZeroDivisionError and added try/except in one turn. It counted 500 functions in a large file in 13.4 seconds. GLM-5.2 iterated through its own Python errors to build a chain-method Calculator with 46 tests. The RLM's "write Python, get errors, fix Python" loop works well for error recovery within a single turn.

GLM-5.2 handled single-file coding tasks well. LRU Cache with 22 tests in 42 seconds. Sorting algorithm comparison with benchmarks in 50 seconds. The RLM paradigm suits GLM-5.2 for focused tasks.

The head-to-head revealed a speed vs. depth tradeoff. Both models reviewed our harness-refine skill. DeepSeek produced 120 lines in 38 seconds with 3 gaps and 3 suggestions. GLM-5.2 produced 164 lines in 77 seconds with 4 gaps and 4 suggestions. Both produced substantive, correct analyses. DeepSeek for speed. GLM-5.2 for depth.


Round 2: Session Mode (The Fix)

The print-mode failures all pointed to one root cause: --no-session kills the kernel. So we re-ran the failing tests in session mode — removing --no-session, using --session-dir and -c to continue the same session across turns.

The difference is one flag. The results are night and day.

Print Mode → Session Mode

Test Print Mode Session Mode Verdict
RLM-01 DeepSeek ❌ FAIL — state lost PASS 13.1s Fixed
RLM-01 GLM-5.2 ❌ FAIL — state lost PASS 12.3s Fixed
RLM-03 DeepSeek ❌ FAIL — variables gone ❌ FAIL* — state persisted, essay file empty State fixed
RLM-04 DeepSeek ✅ PASS — refine.run() errored PASS 21.4s — refine.run() worked Fully working
RLM-02 DeepSeek ⏱ TIMEOUT 630s ❌ FAIL 12.8s — spawned children, exited early Different mode needed
GLM-02 GLM-5.2 ❌ FAIL — no files written PASS 50.3s — all 5 files written Fixed

*RLM-03 is marked FAIL because the essay file was 0 bytes, but the model explicitly reported "Both variables survived in the kernel" and correctly calculated mean score: 49.5 from the df DataFrame without re-reading the CSV. State persistence worked. The essay file write failed — a file-write bug, not a state loss.

What Changed

State persistence works. Both DeepSeek Flash and GLM-5.2 preserved Python variables across all three turns. The config dict from turn 1 was alive in turn 3. The model wrote output.txt with the correct uppercase string values. The core RLM promise is real — in session mode.

The /refine loop works. In print mode, refine.run() raised a RuntimeError. In session mode, it completed and recorded refinement refine_20260808111646069 with two evidence-backed local memories: one recording the completed Stack task, one recording an environment quirk (python3 vs. python). The Continual Harness self-improvement loop is functional — in session mode.

GLM-5.2's multi-file gap is fixed. In print mode, GLM-5.2 described the REST API framework without writing files. In session mode, it wrote all 5 files — app.py, router.py, response.py, middleware.py, test_app.py — in 50.3 seconds. The persistent kernel gave GLM-5.2 the execution continuity it needed for multi-file tasks.

Subagent delegation still needs full daemon mode. In session mode, rlm() spawned all three child agents in 12.8 seconds — much faster than the 630-second print-mode run. But the parent agent ended its turn before the children finished, saying "I'll now end my turn and wait for their replies to arrive as agent messages." The children didn't complete their fixes because the print-mode exit (-p) terminates before the async message loop can deliver results. Subagent delegation needs the interactive or daemon mode's persistent event loop.


What This Means

The RLM paradigm has a mode dependency, not an architecture flaw

The three signature features — state persistence, self-improvement, subagent delegation — all require the session or daemon mode's persistent kernel. Print mode gives you the IPython tool but not the persistence layer that makes the RLM special.

This isn't a bug. It's like testing a database with no persistence layer and concluding databases don't work. The RLM was designed for interactive and daemon mode. Print mode is for one-shot tasks, and it works well for those — our edge cases and single-turn coding tests all passed.

GLM-5.2 is viable in the RLM, with a caveat

GLM-5.2 passed the LRU Cache, sorting benchmarks, broken-Python recovery, and (in session mode) the multi-file REST API. It produces more thorough analysis than DeepSeek — 164 lines vs. 120 on the skill review, with more gaps identified.

The caveat: on complex multi-file tasks in print mode, it narrates instead of executes. Session mode fixes this. If you're using GLM-5.2 with Prime Agent, use session mode for anything beyond single-file tasks.

DeepSeek V4 Flash remains the strongest RLM model

Consistent with our first battery, DeepSeek Flash is the fastest and most capable model in the RLM paradigm. It spawned subagents, recovered from crashes, handled large files in 13 seconds, and produced quality analysis. Its 2x speed advantage over GLM-5.2 holds across every test category.

The harness-refine skill we borrowed is validated

We built a Hermes skill that adapts Prime Agent's /refine concept. Now we've confirmed the original endpoint actually works in session mode — it records structured refinements with evidence and creates persistent memories. Our adaptation maps correctly to the source concept.


Mode Comparison Summary

Feature Print Mode (-p --no-session) Session Mode (--session-dir -c) Daemon Mode (--mode daemon)
Single-turn coding ✅ Works ✅ Works ✅ Works
Error recovery ✅ Works ✅ Works ✅ Works
Large file handling ✅ Works ✅ Works ✅ Works
Persistent Python state ❌ Lost ✅ Survives ✅ Survives
/refine loop ❌ RuntimeError ✅ Records refinements ✅ Records refinements
rlm() subagent delegation ⚠️ Works but slow ⚠️ Spawns but exits early ✅ Full async (untested)
GLM-5.2 multi-file execution ❌ Narrates only ✅ Writes files ✅ Writes files

What We'd Test Next

Full daemon mode. The subagent delegation test needs --mode daemon with its persistent event loop to actually wait for child agent results. That's the last untested RLM feature.

Autonomous mode with quality gates. Prime Agent has daemon-backed sessions with persistent goals, heartbeats, and quality gates. Set it up with a goal like "analyze the Hermes Agent codebase and produce an architecture report" and let it run unattended. Does it stay on task? Do the quality gates work?

Model-harness co-training. Prime Intellect plans to train models around this harness. If that happens, the RLM paradigm becomes more powerful — a model trained to write IPython code for everything would be fundamentally different from one trained to pick tools from a menu.


Methodology

  • All tests ran through prime-agent -p (print mode) and prime-agent -p --session-dir ... -c (session mode) with --thinking off
  • Models: ollama/deepseek-v4-flash:cloud and ollama/glm-5.2:cloud via Ollama Cloud
  • Test battery code and results JSON are in our workspace at /home/mikesai1/workspace/prime-agent-tests-v2/
  • Print-mode timeout: 600s. Session-mode timeout: 600s per turn.
  • Verification was automated: file existence checks, content substring matching, minimum file length
  • Full results: 13 print-mode runs + 6 session-mode runs = 19 total model runs across both rounds

This is SMF Works building in the open — real tests, real data, same day. The first post covered the architecture and coding competence. This one covered the paradigm itself.

Follow @MichaelGannotti on X for more from SMF Works.