← Latest papers
💬 NLP

Skill-as-Pseudocode: Refactoring Skill Libraries to Pseudocode for LLM Agents

The paper proposes Skill-as-Pseudocode (SaP), an automatic method that converts free-form markdown skill libraries into typed pseudocode with deterministic verification, enabling LLM agents to achieve significantly higher success rates and reduced token usage on the ALFWorld benchmark by providing clear typed signatures and concrete invocation templates.

Original authors: Xinze Li, Yuhang Zang, Yixin Cao, Aixin Sun

Published 2026-05-28
📖 4 min read☕ Coffee break read

Original authors: Xinze Li, Yuhang Zang, Yixin Cao, Aixin Sun

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a very smart but literal robot how to do chores, like cleaning a house or organizing a kitchen. You give the robot a giant, messy instruction manual written in normal English (Markdown).

The Problem: The "Confused Loop"
Every time the robot needs to do something, it has to read through long paragraphs of text to figure out two things:

  1. What the task is (e.g., "move the mug").
  2. Exactly how to say it to the house's computer system (e.g., the system only accepts the command move mug to shelf, not put mug on shelf).

Because the instructions are buried in paragraphs, the robot often guesses wrong. It tries to "put" the mug, the house says "Nothing happens," and the robot gets confused. It then goes back to read the manual again, guesses wrong again, and gets stuck in a loop of failure. This wastes time and makes the robot run out of energy (or "tokens," in AI terms).

The Solution: "Skill-as-Pseudocode" (SaP)
The authors of this paper created a system called Skill-as-Pseudocode (SaP). Think of this as a "translator" that takes the messy human manual and rewrites it into a clean, structured cheat sheet for the robot.

Here is how the translator works, using a simple analogy:

1. The Detective (Finding Patterns)

Imagine a librarian who looks through hundreds of different instruction manuals. They notice that many manuals say the same thing in different ways.

  • Manual A says: "Go to the kitchen, grab the salt, and put it in the cabinet."
  • Manual B says: "Find the salt on the counter and move it to the cupboard."

The librarian realizes these are actually the same underlying action. They group these similar instructions together into a "cluster."

2. The Architect (Drafting the Blueprint)

For each group of similar instructions, the system asks an AI to draft a Typed Contract.

  • Instead of a paragraph, this contract looks like a computer function: move_object(from: "counter", to: "cabinet").
  • It clearly lists: What inputs are needed? What happens after? What are the rules?

3. The Safety Inspector (The Four Checks)

Before the system lets the robot use this new blueprint, a strict Safety Inspector runs four specific checks to make sure the translation is perfect:

  • Coverage: Did we miss any important details from the original text?
  • Binding: Do we know exactly where to get the "salt" or "mug" from the original sentence?
  • Replacement: If we swap the old paragraph for this new blueprint, does the rest of the manual still make sense?
  • Risk: Does this new instruction accidentally tell the robot to do something dangerous (like delete a file or break a window)?

If the blueprint passes all four checks, it gets approved. If it fails even one, it is thrown out to prevent the robot from getting confused.

4. The Delivery (The "Bundle")

When the robot needs to do a task, it doesn't get the old, messy manual. Instead, it gets a Bundle that has three parts, presented in the perfect order:

  1. The "How-To" Template: The exact words the robot must type to the house computer (e.g., move {object} to {target}).
  2. The "What" Signature: A clear summary of what the skill does.
  3. The Context: The rest of the instructions, now cleaned up so they don't contradict the new template.

The Results

The researchers tested this on a game called ALFWorld, where an AI agent has to solve household puzzles.

  • Old Way (Graph-of-Skills): The robot read the messy manual, guessed wrong, got stuck in loops, and failed often.
  • New Way (SaP): The robot got the clean "cheat sheet." It knew exactly what to do and how to say it immediately.

The Outcome:

  • The robot solved 82 out of 134 games with the new method, compared to only 47 with the old method.
  • It also used 22% less memory and made 14% fewer calls to the AI brain because it didn't have to re-read the manual over and over when it got stuck.

In Short:
The paper shows that if you stop giving AI agents long, messy paragraphs and instead give them structured, verified "code-like" instructions, they stop getting confused, stop making mistakes, and get the job done much faster. The system acts like a rigorous editor that turns human prose into robot-ready blueprints.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →