PlanForge: A Compiler Architecture for AI Task Orchestration

Original Corben Sorenson paper published as part of The ASI Stack source and lineage library.
Author

Corben Sorenson — original collaborator credits preserved in the manuscript

Published

Invalid Date

← Corben Papers and Architecture Sources

ImportantOriginal paper, not rewritten book prose

This page publishes Corben Sorenson’s original source manuscript so readers can inspect the ideas that preceded or informed the living book. The text may contain historical terminology, claims, confidence, citations, or implementation status that the book later narrows, revises, tests, or rejects. Publication here establishes provenance and access—not correctness, novelty, replication, or support-state promotion.

Publication and provenance

Field Record
Source ID planforge_compiler_arch
Source class author paper
Library class research_paper
Manuscript date Date not normalized
Inventory updated Not separately recorded
Exact published-source SHA-256 5cb241085015bb7f85b9a1d7bc453b5cf00207837bd03e615e3e398d515a6793
Exact published-source bytes 18,745
Exact source text Download/view the tracked Markdown source
Book’s source note Read the bounded mining note
Authorship and collaborator credits Preserved from the exact original manuscript; this library wrapper does not replace or simplify them.
Rights No new license grant. Corben Sorenson’s rights are reserved; collaborator, quotation, source-title, and third-party rights remain with their holders.

Current publication boundary. Archived author paper; its claims retain the status and limits stated in the paper and do not inherit the living book’s current evidence state.

HTML presentation note. The HTML page normalizes line endings and trailing whitespace, preserves explicit Markdown hard breaks, and demotes manuscript headings beneath the page title. The digest above applies to the linked exact source text, not to this presentation wrapper.

Where this paper enters the living book

Planning as a Control Layer: DAGs and Intelligence Arbitrage, Cognitive Compilation and Semantic IR


Original manuscript

PlanForge: A Compiler Architecture for AI Task Orchestration ##### Abstract As agentic AI systems grow in capability, they expose a critical “Orchestration Gap,” a set of profound inefficiencies rooted in the “Uniformity Fallacy”—applying expensive models to every task—and the “Linearity Trap,” which needlessly serializes independent work. This paper introduces PlanForge, a novel “Cognitive Compiler” architecture that addresses this gap by transforming unstructured, natural-language intent into a fully optimized, heterogeneous execution graph. By decoupling high-level reasoning from low-level execution, PlanForge systematically applies a paradigm of “Intelligence Arbitrage,” routing each sub-task to the most cost-effective worker capable of completing it. Synthetic benchmarks validate this approach, demonstrating a 60-85% reduction in token costs for routine tasks and a significant decrease in latency through massive parallelism, establishing a new standard for efficient and scalable AI task orchestration. ——————————————————————————– ##### 1. The Orchestration Gap in Modern Agentic AI As the capabilities of individual AI models have expanded, the primary bottleneck in achieving complex, multi-step goals has shifted from task execution to task orchestration . This has created a significant “Orchestration Gap” where the logic connecting individual actions is managed inefficiently, leading to wasted resources and poor performance. The current generation of AI agents, while impressive, often fails to bridge this gap, treating complex workflows as a linear series of high-level prompts rather than an optimized, parallelizable plan. While this paper details the PlanForge architecture as a standalone concept, its ultimate expression is as the core intelligence-native scheduling layer for a new class of operating system. Within the broader BeastBrain OS ecosystem, the PlanForge orchestrator functions as the kernel-level task scheduler, responsible for compiling high-level system goals into concrete, resource-optimized execution plans for the entire platform. This reframes PlanForge not merely as an agent framework, but as fundamental infrastructure for the next generation of autonomous systems. Contemporary agent frameworks, including those based on simple loops (e.g., AutoGPT) or state graphs (e.g., LangGraph-based crews), exhibit several systemic weaknesses that contribute to this inefficiency: * Redundant Sub-task Generation: Agents frequently generate and execute identical or semantically equivalent tasks multiple times within a single workflow, lacking a mechanism to recognize and consolidate this duplicated effort. * Sequential Bottlenecks: Due to poor dependency modeling, these systems often force independent tasks that could be run in parallel to execute sequentially, artificially inflating total completion time. * Uniform Capability Application: High-capability, expensive frontier models are wastefully applied to simple, low-level sub-tasks—a fallacy of uniformity that ignores the vast cost and performance differences between model tiers. * Lack of Pre-Execution Refinement: Plans are typically executed as they are generated, with no discrete optimization or verification phase to detect inconsistencies, remove redundancies, or improve the overall strategy before resources are committed. * Tight Coupling of Planning and Execution: The agent’s planning logic is intrinsically tied to the specific capabilities of its executor, resulting in brittle, inflexible systems that cannot easily adapt to a heterogeneous workforce of different models, tools, or even human actors. These weaknesses collectively result in excessive token consumption, prolonged execution times, and fragile failure modes. This establishes a clear need for a new architectural layer designed specifically to optimize the orchestration of intelligent work, a need that PlanForge is designed to fill. ##### 2. The Compiler Paradigm: Decoupling Planning from Execution The core philosophical shift introduced by PlanForge is to move away from the fragility of the standard agentic loop and embrace the reliability of a modern compiler. Where current agents engage in a continuous, probabilistic prompting process, PlanForge treats planning as a discrete compilation of a high-level goal (the source code) into a deterministic, optimized execution graph (linked machine code) . This compiler-centric approach fundamentally addresses the Orchestration Gap by separating the logic of the plan from the mechanics of its execution. The central principle guiding this compilation is Intelligence Arbitrage . This is the practice of systematically analyzing each primitive task within a plan and routing it to the lowest-cost, “Minimum Viable Intelligence” (MVI) worker capable of successfully completing it. An expensive frontier model might be required to design a complex software architecture, but a small, local model or a simple script is sufficient to write a configuration file. This deliberate decoupling of a plan’s reasoning from its labor is the key to unlocking massive economic and temporal efficiencies. This compiler-centric, executor-agnostic approach yields several key advantages: * Executor Agnosticism: The compiled plan is an abstract representation of work, allowing it to be executed by any backend system—heterogeneous models, scripts, robots, or humans—that exposes the required primitive action schema. * Cost Efficiency: By reserving expensive frontier models exclusively for tasks that demand their advanced reasoning, the system dramatically reduces overall operational costs. * Scalability: The architecture unlocks massive parallelism by enabling the distribution of low-tier, independent tasks across a large pool of inexpensive workers. * Reliability: By performing systematic plan verification and semantic deduplication before execution begins, PlanForge identifies and resolves potential failures and inefficiencies, significantly reducing error propagation. This philosophy is realized through a multi-phase compilation stack that transforms an abstract goal into a concrete, optimized execution schedule. ##### 3. The PlanForge Compilation Stack The PlanForge architecture mirrors a modern compiler stack, consisting of a Front-End for parsing high-level intent, a Middle-End for optimization and refinement, and a Back-End for scheduling and final code generation. This structured process ensures that a simple natural language goal is methodically transformed into a highly efficient, parallelized execution plan. ###### Phase 1: Front-End - Recursive Semantic Decomposition The goal of the Front-End is to transform an unstructured, natural-language goal G into a raw, hierarchical task tree (T_raw). The system recursively prompts a capable Large Language Model (LLM) to break down the high-level goal into progressively smaller sub-tasks. This process continues until every leaf node in the tree represents an atomic action defined in a predefined primitive action schema P. While the schema includes mundane I/O operations, it is grounded in a frozen, immutable set of ~300 abstract atoms that form the assembly code of cognition, inspired by the Aletheia architecture: | Category | Example Primitives | | —— | —— | | Causality | CAUSE, PREVENT, ENABLE | | Epistemics | KNOW, BELIEVE, VERIFY | The resulting raw tree is a complete but unrefined representation of the work required, often containing redundancies and suboptimal structures that are systematically addressed in the next phase. ###### Phase 2: Middle-End - Optimization and Verification The purpose of the Middle-End is to transform the raw task tree (T_raw) into a verified, consistent, and optimized Directed Acyclic Graph (DAG_{opt}). This phase acts as the compiler’s “optimization pass,” applying a series of transformations to improve the plan’s structure and efficiency. Key operations include: * Semantic Deduplication: This critical step identifies and merges primitive actions that are either identical or semantically equivalent. Using an embedding model, the system calculates a semantic hash for each action. If the cosine similarity between two actions exceeds a defined threshold (e.g., cos(H_s(A), H_s(B)) > 0.92), they are collapsed into a single node in the graph, eliminating redundant work. * Sub-tree Merging: The optimizer identifies and merges entire branches of the tree that represent overlapping or identical sub-goals. * Consistency Checking: The plan is verified for logical integrity. This process detects contradictions, such as attempting to write to a file before it is created, and eliminates potential loops to ensure the final graph is executable. ###### Phase 3: Back-End - Intelligence Tier Annotation This phase is the core of the Intelligence Arbitrage model. Each primitive node in the optimized graph (DAG_{opt}) is annotated with a Minimum Viable Intelligence (MVI) score. This score represents the lowest (and thus most cost-effective) tier of worker that can reliably execute the task. A lightweight classifier or an embedding-based similarity search is used to assign each task to a tier based on its cognitive demand. An example 4-tier intelligence schema is presented below: | Tier | Cognitive Demand | Typical Workers | Cost Factor* | | —— | —— | —— | —— | | T1 | Reflexive (I/O, Formatting, Regex) | Quantized 7B, Scripts | 1x | | T2 | Procedural (Summary, Classification) | Llama-70B, GPT-3.5 | 10x | | T3 | Analytical (Reasoning, Code Gen) | GPT-4, Claude 3 Opus | 100x | | T4 | Creative (Novelty, Strategy) | o1-preview, Human | 500x | ###### Phase 4: Back-End - Dependency Inference and Scheduling This phase represents the final step of compilation, where the annotated DAG is used to generate an optimal execution schedule. The scheduler solves a multi-objective assignment problem to minimize the total completion time (makespan) and total cost, while respecting the MVI tier constraints and task dependencies. To achieve this, the scheduler employs the Critical Path Method (CPM) to identify the longest sequence of dependent tasks in the graph. Nodes on this critical path have zero slack (delay tolerance) and are prioritized for assignment to high-speed workers to minimize the overall project duration. Conversely, nodes that are off the critical path have positive slack. This is a key enabler of Intelligence Arbitrage, as it creates explicit opportunities to substitute low-cost, high-latency workers without impacting the final deadline. Standard heuristic schedulers, such as Heterogeneous Earliest Finish Time (HEFT), can be used to generate this final schedule. ###### Phase 5: Execution Hand-off The final output of the compilation process is a serialized (e.g., JSON or YAML) timed assignment schedule S. This schedule is a concrete execution plan that maps each primitive action to a specific worker and a designated start time. This plan is then dispatched to a separate execution runtime, which is responsible for managing the actual execution of the tasks. This end-to-end flow transforms a high-level, ambiguous goal into a fully optimized, tiered, and parallelized execution plan, ready to be carried out by a heterogeneous workforce in the runtime environment. ##### 4. Execution and Resilience: The Watchdog Runtime A compiled plan, no matter how optimized, requires a robust runtime environment to manage its execution in a dynamic and uncertain world. The “Watchdog” module serves as this dynamic runtime supervisor, responsible for dispatching tasks according to the schedule, monitoring their progress, and intelligently handling failures. Architecturally, the Watchdog runtime is a pragmatic implementation of the rigorous “Popperian Falsification” philosophy embodied by Aletheia’s Judicial Tribunal, adapted for dynamic, real-time execution. The Watchdog runtime implements several core resilience mechanisms to ensure the plan completes successfully even when individual tasks fail: 1. Schema Validation: The Watchdog acts as a strict type checker for all task inputs and outputs. It enforces the primitive action schema, ensuring that workers return data in the correct format (e.g., structured JSON instead of raw text). If a worker returns malformed data, the Watchdog immediately flags a “Type Error” and can trigger a retry or escalation. 2. Tier Escalation: When a task fails, the Watchdog initiates a retry loop with an intelligent escalation policy. If a low-tier worker (e.g., T1) fails to complete a task, the Watchdog re-issues that same task to a worker from the next-highest tier (e.g., T2). Crucially, it provides the error context from the initial failure to the new worker, increasing the probability of a successful second attempt. 3. Speculative Execution: For high-priority tasks on the critical path, the Watchdog can employ a speculative execution strategy. It assigns the task to both a cheap, fast Tier 1 worker and a more capable Tier 3 worker simultaneously. To prevent cost overruns, the Tier 3 worker is initiated with a ‘Lazy Start’—a strategic delay, typically set to a fraction of the Tier 1 worker’s expected completion time (e.g., 50% P50 latency). If the cheaper worker succeeds quickly, the Tier 3 task is canceled before it incurs significant cost; if it fails, the Tier 3 worker is already primed to take over with minimal delay. These runtime features transform PlanForge from a static planner into an adaptive and reliable orchestration system capable of navigating the inherent uncertainty of real-world execution. ##### 5. Quantitative Analysis: Validating the Intelligence Arbitrage Model To provide empirical validation for the architectural claims of PlanForge, we conducted a series of synthetic benchmarks. These tests were designed to quantify the cost and latency improvements delivered by the Intelligence Arbitrage model compared to a baseline approach that uses a uniform, high-tier model for all tasks. The results, detailed below, demonstrate the practical impact of strategic tiering and parallelization. ###### Benchmark Results: PlanForge vs. Uniform Baseline | Scenario | Metric | Baseline (Uniform T3) | PlanForge (Arbitrage) | Improvement | | —— | —— | —— | —— | —— | | A: “The Grunt Work” (Market Research Report) | Cost | 50 tasks × $0.03 = $ 1.50 | (30× \(0.0005) + (15×\) 0.003) + (5× $0.03) = $ 0.21 | 86% | | | Time | 300s (serial execution) | 65s (parallel execution) | 78% | | B: “The Architect”(Complex Refactoring) | Cost | 20 tasks × $0.03 = $ 0.60 | (2× \(0.0005) + (18×\) 0.03) = $0.541 | 9.8% | | | Time | 120s (serial execution) | ~115s (parallel execution) | ~4% (via parallelization) | Assumptions: Costs are based on projected API rates. Parallelism assumes N=50 workers with no API rate-limiting bottlenecks. These results clearly illustrate the power of the Intelligence Arbitrage model. The savings are most dramatic in scenarios with a high volume of “grunt work” (e.g., web scraping, data formatting), where delegating tasks to low-cost workers yields massive cost and time reductions. However, even on complex, reasoning-heavy tasks, PlanForge provides measurable benefits by optimizing the “glue code” steps (like configuration updates) and parallelizing independent work branches to improve latency. This quantitative evidence supports the architectural premise of PlanForge and provides a foundation for comparing its unique approach to other systems in the field. ##### 6. Architectural Differentiation and Related Work PlanForge is not a monolithic invention but rather a synthesis and extension of several foundational paradigms from computer science and artificial intelligence. Its unique contribution lies in combining these ideas with a compiler-centric optimization layer that has been largely absent from the agentic AI landscape. By formalizing task planning as a compilation process, it introduces a level of rigor and efficiency that distinguishes it from contemporary frameworks. | Feature | PlanForge | LangGraph | AutoGen | MetaGPT | | —— | —— | —— | —— | —— | | Core Paradigm | Compiler / Orchestrator | Graph Construction | Multi-Agent Chat | Role-Playing SOPs | | Tiering | Native & Automatic | Manual | Manual | Role-Based | | Scheduling | Critical Path (CPM) | Sequential / Custom | Async Chat | Sequential Phases | | Optimization | Semantic Deduplication | None | None | None | | Failure Mode | JIT Escalation | Custom Logic | Conversational | Human Feedback | Beyond current agent frameworks, PlanForge’s architecture builds upon more established academic concepts: * Hierarchical Task Networks (HTN): PlanForge adopts the core HTN paradigm of decomposing abstract tasks into a hierarchy of simpler actions. However, it modernizes this approach by replacing traditional, hand-crafted decomposition methods with learned recursive prompting, allowing for greater flexibility and adaptability. * Task and Motion Planning (TAMP): The architecture mirrors the TAMP philosophy of separating high-level symbolic planning from low-level grounded execution. PlanForge generalizes this concept, extending its application from the domain of robotics to any form of digital or cognitive work. PlanForge’s unique contribution is the introduction of a systematic, tier-aware optimization and scheduling layer. While other systems focus on agent interaction or state management, PlanForge provides the critical middleware that translates strategic intent into an efficient, executable reality. ##### 7. Conclusion: Compiling Intent into Optimized Reality PlanForge is not merely another agent framework; it represents a critical infrastructure layer essential for building the next generation of autonomous and efficient AI systems. It addresses the fundamental Orchestration Gap by introducing a new level of discipline, reliability, and performance to a field that has, until now, been characterized by brittle, monolithic, and inefficient designs. The paradigm shift it represents is profound: a move away from the fragility and waste of probabilistic, looped prompting and toward the robust, high-performance world of deterministic, compiled systems. By formalizing the translation of human intent into optimized action, PlanForge provides the architectural foundation for AI systems that are not only intelligent but also economically and operationally efficient. It enables a future where AI systems are judged not only by the quality of their reasoning but by their ability to achieve goals with minimal cost and time— delivering the right intelligence, at the right time, for the right price.