Building a Compatible OS Kernel in 11 Days: The Boundaries of Human-Agent Collaboration

    In recent years, the consensus in the tech community has been that while generative agents can write functions, complete tests, and modify scripts, they struggle to independently build system-level software like operating system kernels. However, a recent experimental project challenged this notion. A maintainer with extensive experience in enterprise-grade open-source distributions used a "human-led agent engineering" approach to build an independent, compatible OS kernel comprising approximately 139,000 lines of code in just 11 days. This article analyzes the technical significance of this achievement, the unique challenges of kernel verification, and the reusable methodology involving executable gates and feedback loops. It also provides engineering best practices and insights for developers looking to integrate AI agents into complex system software development.

    For the past few years, a common judgment in the tech community regarding the upper limits of generative agents was that while they could write functions, complete tests, and modify scripts, they would struggle to independently complete system-level software like an operating system kernel. The reason is no mystery: a kernel is not an isolated piece of code, but a complex system composed of hardware, memory, scheduling, processes, file systems, networks, device drivers, and binary interfaces working together. Any semantic deviation in any layer could be amplified into an untraceable failure during the boot chain.

    A recent experimental project provides a new sample for this discussion. A maintainer with long-term involvement in building enterprise-grade open-source distributions adopted a “human-led agent engineering” method to produce an independent, compatible kernel of about 139,000 lines of code in approximately 11 days. This kernel was not forked from an existing mainstream kernel; instead, it independently implemented memory management, a scheduler, a process model, a file system, networking, and device support. It also implemented the ABI of a mainstream OS kernel, allowing existing user-space binaries to run without modification. The experiment even successfully booted a major version of an enterprise-grade open-source distribution and ran its system initialization and service management programs. The value of this result lies not in a “line-count myth,” but in demonstrating a verifiable path for agent engineering: domain experts define the boundaries, agents generate and correct in batches, executable gates provide continuous feedback, and ultimately an end-to-end runnable system is formed.

    I. Technical Implications: From “Generating Code” to “Verifiable Systems”

    If we only understand this event as “an agent wrote 139,000 lines of code,” we underestimate the difficulty and misread the conclusion. What is truly noteworthy lies in three aspects.

    First, the project goal was an independent kernel, not patching an existing one. Independent implementation means re-establishing the minimal bootable path: bootloader, early memory initialization, page tables and address spaces, interrupts and exceptions, clock, scheduling, process creation, system call entry, root filesystem mounting, device enumeration, and basic networking. There are strong dependencies among these modules; any sequence error could cause the system to freeze at a black screen or stall at an early serial log stage.

    Second, the project emphasized binary compatibility. Compatibility is not about “interfaces looking similar,” but about ensuring that compiled programs yield consistent results regarding system call numbers, parameter passing, struct layout, error codes, signal semantics, and process and file descriptor behaviors. The ABI is the contract between the kernel and user space. Once this contract becomes unstable, user-space programs will crash in ways that are difficult to reproduce.

    Third, the acceptance criterion was end-to-end booting and running real workloads. Compiler-type projects can be verified using test suites, reference implementations, and extensive I/O comparisons. Kernel projects, however, must deal with long boot chains, hardware diversity, complex concurrency paths, and scattered failure modes. Being able to boot an enterprise-grade distribution and pull up the service management program indicates that the project successfully bridged the critical path from boot to user space, which holds more engineering significance than isolated code generation.

    II. Why Kernels Are Harder to Verify Than General Software

    The difficulty of kernel development lies in designing “executable gates.” A standard business service can be verified through layered unit, interface, and integration tests. Kernel failures, however, often span multiple layers. For instance, a memory allocation error might manifest as scheduling latency; a file descriptor semantic deviation might appear as a service startup timeout; a signal handling error might cause the process manager to restart repeatedly.

    Therefore, such projects must answer three questions:

    • Capability: Can agent engineering produce an independent kernel and run some unmodified user-space workloads?
    • Methodology: What documents, bootstrapping methods, executable gates, and feedback loops are required to keep the work moving forward?
    • Scope: Which conclusions can be generalized, and which only apply to controlled experimental environments?

    These three questions correspond to three types of engineering assets. The capability question requires a minimal bootable path and ABI contract. The methodology question requires specification documents, task decomposition, sandbox execution, log return, and human review. The scope question requires a clear test matrix, compatibility boundaries, and security audit conclusions. Missing any of these, the project easily degrades into a demo that “looks like a lot of code but cannot be stably reproduced.”

    III. Human-Led Agent Engineering: A Reusable Methodology Breakdown

    The method used in this experiment can be abstracted as “human-led agent engineering.” It does not involve tossing requirements to a model and waiting for results. Instead, domain experts continuously define goals, constraints, and acceptance gates, while agents execute highly repetitive, verifiable engineering tasks within a closed loop.

    1. Domain Experts Define Boundaries and Acceptance Criteria

    Domain experts must first answer “what counts as done?” For a compatible kernel, done is not “compilation passes,” but “boots to user space and runs specified services.” Acceptance criteria should be as executable, observable, and rollback-able as possible, such as the boot log reaching a certain stage, system calls returning agreed error codes, consistent filesystem read/writes, and no deadlocks under concurrency stress. Experts must also define non-goals to prevent agents from losing focus through infinite expansion.

    2. Specifications and Documentation First

    Agents need stable context. System call tables, struct layouts, error code conventions, boot stage descriptions, device initialization order, and test case specifications should all be formed into retrievable documents. Documentation is not decoration; it is the common basis for agents to generate code and for humans to review. The closer documents are to “contracts,” the less likely agents are to break global semantics during localized patches.

    3. Executable Gates Replace Subjective Judgment

    Every stage should have gates. For example: the boot stage gate checks if control is transferred; the memory stage gate checks page tables and allocators; the scheduling stage gate checks multi-task switching; the ABI stage gate runs system call consistency tests; the user space stage gate starts the service manager and checks exit codes. When a gate fails, the feedback must be structured logs, metrics, and minimal reproduction steps, rather than just “run failed.”

    4. Agent Loop and Feedback Closed-Loop

    A simplified loop is as follows, representing engineering logic rather than a specific product interface:

    1. spec = expert.write_contract()
    2. plan = expert.decompose(spec)
    3. feedback = empty
    4. while not gates.all_passed():
    5. task = planner.next(plan, feedback)
    6. patch = agents.generate(task, context=spec)
    7. result = sandbox.run(patch, gates)
    8. feedback = result.logs + result.metrics + result.repro
    9. plan = expert.adjust(plan, feedback)
    10. audit = expert.review(merge(patch_history))

    The key to this loop is “sandbox execution” and “structured feedback.” Agents cannot directly pollute the main branch; all changes should run gates in an isolated environment. Failure logs must be able to locate the stage, module, and minimal input. Experts adjust plans based on feedback rather than allowing agents to retry indefinitely.

    5. Parallelism and Merging Require Stronger Constraints

    Multi-agent parallelism can increase throughput but will amplify merge conflicts and semantic drift. A feasible approach is to split tasks by contract boundaries: ABI tables, filesystem paths, network protocol stacks, and device models are handled by different agents, but all share the same interface documents and test gates. Before merging, interface consistency checks and regression tests must be conducted to avoid “passing locally, failing globally.”

    6. Observability and Rollback

    Kernel projects must treat logging, tracing, assertions, and fault injection as first-class capabilities. Without observability, agents can only guess; without rollback, erroneous changes will quickly accumulate. Teams should retain pass records, failure samples, and fix diffs for each gate, forming an auditable engineering trail.

    IV. Engineering Essentials for a Compatible Kernel

    First, ABI contract stability must be prioritized. System call entry, parameter validation, error codes, struct alignment, time semantics, signals, and process states all require explicit testing. Compatibility is not a one-time adaptation but continuous regression.

    Second, the minimal bootable path should be established as early as possible. Do not initially pursue complete device support; instead, first implement boot, memory, scheduling, root filesystem, and service manager startup. Once the end-to-end path is clear, subsequent modules will have real feedback.

    Third, the test matrix should be layered. It should at least include boot tests, ABI consistency tests, filesystem read/write tests, concurrency and scheduling stress tests, fault injection tests, and regression tests. Each layer must have clear pass criteria and failure archiving.

    Fourth, security and licensing cannot be deferred. An independent kernel involves memory safety, permission boundaries, system call attack surfaces, and license compliance. Agent-generated code must pass manual security reviews, and critical paths should use stricter static checks, fuzzing, and formal constraints.

    V. Insights for Developers and Teams

    The insight from such experiments for ordinary teams is not to “immediately let agents write kernels,” but to hand over highly repetitive, verifiable, and clearly bounded engineering tasks to agent closed loops. Suitable scenarios include interface adaptation, test completion, log analysis, regression fixing, documentation synchronization, and sandbox-based verification. Unsuitable scenarios include those lacking acceptance criteria, heavily reliant on implicit experience, or where security responsibilities cannot be transferred.

    Teams can leverage general capabilities provided by cloud platforms like Baidu AI Cloud, such as container platforms, logging services, monitoring alerts, and object storage, to host the build and verification pipeline. However, the core of the methodology remains the gates, contracts, and audits defined by domain experts. Agents are responsible for scaled execution, while humans are responsible for architectural judgment, risk assumption, and final acceptance.

    VI. Boundaries and Conclusions

    It must be emphasized that producing a compatible kernel with 139,000 lines of code in 11 days does not equate to the maturity of a production-grade kernel. Compatibility scope, hardware coverage, concurrency correctness, security audits, and long-term maintenance costs all require continuous verification. Agents may generate hallucinatory patches or break global semantics while passing local tests. Human leadership is not a formality, but a boundary of responsibility.

    However, this experiment proves at least one thing: under the guidance of strong domain experts, clear contracts, executable gates, and closed-loop feedback, agent engineering can compress the exploration cycle of system-level software to previously unimaginable degrees. For developers, the real takeaway is not “letting models write more code,” but breaking engineering problems down into verifiable gates and placing agents into observable, rollback-able, and auditable closed loops. Whoever can design this loop well will be the first to touch the true boundaries of agent engineering.