← Latest papers
🤖 AI

Formal Skill: Programmable Runtime Skills for Efficient and Accurate LLM Agents

This paper introduces "Formal Skill," a runtime-native abstraction that replaces informal natural-language instructions with executable state machines and JSON schemas to enhance the efficiency, accuracy, and enforceability of LLM agents, as demonstrated by the open-source FairyClaw framework's superior performance on the Harness-Bench.

Original authors: Xi Zhang, Meijun Gao, Yuntian Zhao, Xinyu Tan, Yilun Yao, Feiyu Wang, Yanshu Wang, Dingsiyi, Tong Yang

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

Original authors: Xi Zhang, Meijun Gao, Yuntian Zhao, Xinyu Tan, Yilun Yao, Feiyu Wang, Yanshu Wang, Dingsiyi, Tong Yang

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 hiring a very smart, very fast intern (the AI agent) to fix a complex problem in your office, like repairing a broken piece of software.

The Old Way: The "Wall of Text" Manual

Currently, most AI agents work like this: You give them a massive, detailed instruction manual written in plain English (a "Prompt Skill"). It says things like, "First, look at the error log. Then, try to fix the code. Make sure you don't delete the test files. If you fail, try again. Once you're done, write a report."

The paper calls this an "Informal Skill." It has three big problems:

  1. It's expensive: The AI has to read this huge manual every single time it takes a step. This costs a lot of "tokens" (the currency of AI computing power).
  2. It's vague: The AI has to guess what "try again" or "don't delete" really means. It's like telling a human, "Be careful," without defining what "careful" looks like.
  3. It's fragile: If the AI makes a mistake, it has to look back through the whole conversation history to remember where it was. It doesn't have a built-in "checklist" to know if it's finished or if it needs to go back a step.

The New Way: The "Formal Skill"

The authors propose a new way called "Formal Skill." Instead of giving the AI a long text manual, they give it a programmable toolkit.

Think of it like upgrading from giving a chef a 50-page recipe book to giving them a smart kitchen with built-in safety features:

  • The Recipe is Code, Not Text: Instead of reading paragraphs, the AI interacts with specific buttons (tools) and follows a strict flowchart (state machine).
  • The "Hook" System: Imagine a bouncer at a club (the "Hook"). Depending on what stage of the job the AI is in, the bouncer decides which doors are open.
    • Stage 1 (Investigation): The bouncer only opens the door to the "Search Tools." The "Delete" door is locked.
    • Stage 2 (Fixing): The bouncer opens the "Patch Tool" but locks the "Delete" door again.
    • Stage 3 (Verification): The bouncer won't let the AI leave the room until it shows a "Pass" certificate from the testing machine.
  • The State Machine: The AI doesn't have to remember the whole story. It just has a small digital badge that says, "I am currently in the 'Fixing' phase." If it tries to skip to "Reporting" before "Fixing" is done, the system automatically stops it.

The "FairyClaw" Engine

To make this work, the authors built a new engine called FairyClaw. You can think of FairyClaw as the smart manager that runs the show.

  • It doesn't just chat with the AI; it actively manages the AI's tools and rules.
  • It breaks big jobs into smaller sub-tasks and assigns the right "Formal Skill" to each one.
  • It keeps a running log of exactly where the AI is, what it has done, and what it still needs to do, so the AI never gets lost.

The Results: Faster, Cheaper, and Safer

The authors tested this system (FairyClaw) against other popular AI agent systems using a tough test called Harness-Bench.

  • The Score: FairyClaw performed just as well, or better, than the other systems at actually getting the job done.
  • The Cost: This is the big win. FairyClaw used 48% fewer tokens (money/computing power) than the average of the other systems.
    • Analogy: If the other systems were like a delivery truck driving around the city reading a massive map out loud to the driver at every turn, FairyClaw is like a GPS that only shows the driver the next turn and keeps the rest of the map hidden until needed.
  • The "Code Repair" Test: On a specific task involving fixing buggy code, FairyClaw was the clear winner. Because the "Formal Skill" forced the AI to verify its work before finishing, it didn't make the silly mistakes that other agents made.

Summary

The paper argues that we should stop treating AI skills like long, fuzzy instruction manuals and start treating them like strict, executable software protocols. By moving the rules from "text the AI reads" to "code the AI runs," we get agents that are cheaper to run, harder to trick, and better at following complex procedures.

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 →