Zing Forum

Reading

Imperative Workflow Engine: A Privilege-Level Instruction Encoding Scheme That Boosts LLM Agent Task Accuracy from 41% to 96%

A privilege-level instruction encoding system based on the Routine framework, which significantly improves the execution accuracy of multi-step tasks through structured execution contracts and runtime verification mechanisms.

LLMagentworkflowprivilege encodingroutine frameworkexecution contractruntime verificationtask accuracy
Published 2026-05-25 04:15Recent activity 2026-05-25 04:21Estimated read 7 min
Imperative Workflow Engine: A Privilege-Level Instruction Encoding Scheme That Boosts LLM Agent Task Accuracy from 41% to 96%
1

Section 01

Introduction / Main Floor: Imperative Workflow Engine: A Privilege-Level Instruction Encoding Scheme That Boosts LLM Agent Task Accuracy from 41% to 96%

A privilege-level instruction encoding system based on the Routine framework, which significantly improves the execution accuracy of multi-step tasks through structured execution contracts and runtime verification mechanisms.

3

Section 03

Background and Problem

Current large language models (LLMs) often have unsatisfactory accuracy when executing multi-step tasks. Studies show that the execution accuracy of complex task chains can be as low as around 41%. The root cause of this problem is that LLMs tend to deviate from the original goal or lose key constraints during execution when handling long contexts and complex instructions.

Traditional prompt engineering methods can improve output quality to some extent, but lack a systematic execution guarantee mechanism. When tasks involve multiple steps, tool calls, or need to strictly follow specific rules, the model may call tools at inappropriate times or ignore important safety constraints.

4

Section 04

Project Overview

Imperative Workflow Engine is an open-source project implemented based on the Routine framework (arXiv:2507.14447), aiming to solve the above problems through Privilege-Level Instruction Encoding and structured execution contracts. This project increases the execution accuracy of multi-step tasks from about 41% to about 96%, an improvement of more than twice.

The core idea of the project is to draw on the concept of privilege levels in operating systems, assigning different priorities and constraint strengths to different types of instructions. By explicitly marking the privilege level of instructions, the system can enforce these constraints at runtime to ensure that high-priority rules are not overridden by low-priority requests.

5

Section 05

Privilege-Level Instruction Encoding

The project defines five privilege levels, each corresponding to different types of instructions:

Level Label Purpose
0 Safety rules Safety rules, absolutely non-deviable
1 System imperatives Core system instructions
2 Skill-loaded rules Default rules when skills are loaded
3 User requests Default level for user requests
4 Tool outputs Tool output results

This layered design ensures that the most critical safety constraints (Level 0) have the highest priority and will not be overridden under any circumstances. User requests (Level 3) can be executed flexibly without violating higher-level constraints.

6

Section 06

Execution Contract Decomposition

The routine_decomposer.py script in the project is responsible for decomposing complex tasks into Routine-style execution contracts. These contracts clearly define the input, output, preconditions, and postconditions of each step, forming a formal execution protocol.

The advantages of execution contracts are:

  • Verifiability: The execution result of each step can be independently verified
  • Traceability: The complete path of task execution can be recorded and audited
  • Recoverability: When a step fails, the system can accurately locate the problem and attempt recovery
7

Section 07

Runtime Verification Mechanism

contract_verifier.py provides runtime verification functionality to ensure that the execution process strictly follows predefined contracts. This verification is not a simple result check, but continuous monitoring during execution to ensure each step meets expectations.

8

Section 08

Semantic Tool Filtering

tool_filter.py implements semantic tool filtering based on context relevance. This means the system does not blindly expose all available tools to the model, but intelligently selects the most relevant subset of tools based on the context of the current task. This filtering mechanism reduces the probability of the model selecting the wrong tool and also reduces noise in the context window.