Building a Bootable OS Prototype with 1,000 Agents in 8 Days: Engineering Methods for Multi-Agent Development

    This article explains how multi-agent collaboration can compress operating system prototype delivery by turning large-scale software engineering into parallel, verifiable, rollback-capable work. It covers evidence boundaries, interface-first task decomposition, documentation as long-term memory, reproducible boot validation, cost measurement, limitations, and troubleshooting.

    Conclusion first: evidence and boundaries

    Building an operating system prototype with multi-agent collaboration is not about asking a model to generate all code in one pass. It is about reshaping large-scale software engineering into a pipeline that can run in parallel, be continuously validated, rolled back, and measured. The main benefit is a shorter delivery cycle: work that would normally require coordinated module development, testing, and integration can be split into many subtasks with clear interfaces and test gates.

    A note on evidence: statements such as “8 days,” “1,000-agent collaboration,” and “about a 20% cost reduction” come from public case reviews and engineering-level descriptions, not universal guarantees. For internal planning, add three types of evidence:

    1. Task logs: start times, parallel counts, and retry counts.
    2. Validation records: pass rates for compilation, boot, and smoke tests.
    3. Cost statements: input and output tokens, call count, and rework count.

    Data that has not been reproduced locally should not be used directly for scheduling or budgeting.

    1. Task decomposition: define interfaces first, then split dependencies

    When building a bootable system, the first step is not writing code. It is defining boundaries. A minimal bootable prototype usually has four layers:

    • Boot and kernel layer
    • Driver layer
    • System service layer
    • Application and utility layer

    For multiple agents to work in parallel, produce an interface list first instead of letting each agent freely interpret requirements. A minimal interface list should include at least the following fields:

    Field Description Example
    Module name Clear responsibility boundary block_device
    Input Parameters, sources, constraints Starting LBA, buffer length
    Output Return values and status Result<()> or error code
    Error codes Failure categories E_IO, E_PERMISSION, E_NOT_FOUND
    Test gates Required before delivery Unit test, integration test, simulated boot
    Dependencies Upstream modules Requires the memory manager to provide page-table APIs
    Merge rule Who may change the contract Architecture agent locks it; implementation agents must not change the signature

    Dependencies can be represented as “module — dependency — version — owner.” For example, the file system depends on the block device; the window system depends on an input event source; the installer depends on the file system and login service. If interfaces are not stable yet, avoid high parallelism, because merge conflicts can quickly become expensive.

    A reusable minimal contract example:

    1. trait BlockDevice { fn read(&self, lba: u64, buf: &mut [u8]) -> Result<()>; }
    2. trait InputEventSource { fn poll(&mut self) -> Option<KeyEvent>; }
    3. trait FileSystem { fn create(&mut self, p: &Path) -> Result<FileHandle>; }

    The key point is to stabilize interfaces first, then assign drivers, the file system, and window management to different agents. Each agent should own one module, and delivery should be gated by tests, not by the volume of generated code.

    2. Preventing context drift in long-running tasks: documentation as memory

    For tasks that run for multiple days, the biggest problem is often not compute capacity but context drift: later execution units may not know earlier decisions, causing duplicate implementations, interface conflicts, or inconsistent style. The solution is not to expand the conversation context indefinitely. It is to write memory into the repository.

    A suggested documentation structure:

    1. docs/
    2. 00-principles.md # Engineering principles and non-negotiable constraints
    3. 01-architecture.md # Four-layer architecture and dependency graph
    4. 02-api.md # Interface list and error codes
    5. 03-decisions.md # Architecture decision records
    6. 04-test-matrix.md # Test matrix and pass criteria
    7. 05-known-issues.md # Known defects and workarounds
    8. 06-runtime-notes.md # Boot environment, emulator parameters, and debugging notes

    Three practical methods can be combined:

    1. Structured memory. Design decisions, interface definitions, and known defects must be written into documents, not left only in chat history.
    2. Layered summaries. Generate module-level summaries. New agents should first read summaries, then interface documents, and finally code.
    3. Change constraints. Limit the files changed in a single modification. Commit in small steps and avoid one change spanning the kernel, drivers, and application layers.

    This approach is similar to traditional team collaboration, except the readers are agents. Therefore, documentation should be more machine-readable: use fixed fields, clear states, and fewer vague descriptions.

    3. Making “bootable” reproducible: validation loops and checklists

    If a prototype can boot, that ability must become automated assertions. Otherwise, long-running generation can degrade into a pile of code that cannot run. A reproducible environment should at least document:

    • Operating system version
    • Build dependencies
    • Emulator boot parameters
    • Test data preparation
    • Retry strategy
    • Log location and debugging method

    For example: Ubuntu 22.04, Rust 1.78, QEMU 8.2, build script make boot, and boot command boot_in_emulator --timeout 120 --serial file:logs/serial.log. Here, --timeout controls the boot wait time, and --serial writes serial output to a file. Different emulators use different parameters, so versions and parameters must be recorded in the repository for reproducibility.

    A validation loop can include four levels:

    1. Static checks and zero-tolerance for compiler warnings.
    2. Unit tests covering core data structures.
    3. Integration tests that execute the boot flow in an emulated environment.
    4. Smoke tests that verify key paths such as login, file read/write, and input response.

    Example pipeline:

    1. stages: [lint, unit, boot, smoke]
    2. boot:
    3. script: build_image && boot_in_emulator --timeout 120 --serial file:logs/serial.log
    4. smoke:
    5. script: assert_login && assert_write_read && assert_key_input

    A recommended checklist:

    Check item Pass criterion Failure action
    Compile No errors and zero warnings Locate the first failing file and roll back the latest commit
    Boot Reach the login screen within 120 seconds Inspect serial logs and check interrupts and memory layout
    Input Keyboard events can be reported Check driver interrupts and the event queue
    File read/write Write data and then read it back by path Check block device offsets and cache flushing
    Permissions Unauthenticated users cannot access controlled resources Roll back the login module and inspect session state

    If a failure cannot be reproduced, preserve logs, boot parameters, commit hashes, and test data before rerunning. Avoid asking agents to perform broad rewrites before the failure is localized.

    4. After a reported 20% cost reduction: measurement baseline and optimization comparison

    Cost optimization should not focus only on the price of a single call. A more reliable approach is to establish measurement metrics, including at least:

    • Number of calls
    • Input and output tokens
    • Retry count
    • Parallelism
    • Rework rate

    Parallelism is not always better. When interfaces are unstable, higher parallelism can amplify rework.

    A possible before/after comparison:

    Metric Before optimization After optimization Notes
    Single-call price Baseline Lower Price is not the core benefit
    Repeated context reads High Lower Summaries and retrieval reduce wasted input
    Input tokens Baseline Lower Inject only the context needed for the current module
    Output tokens Baseline Slightly lower Local edits are better than full rewrites
    Retry count High Lower Define contracts before parallel implementation
    Rework rate High Lower Fewer conflicts after interfaces stabilize
    Parallelism Increased blindly Increased in a controlled way Avoid high parallelism before interfaces are stable

    To make cost reduction repeatable, reduce repeated reading of large repositories on the input side; make small module-by-module commits on the output side; stabilize interfaces before increasing parallelism on the scheduling side; and turn verified modules into reusable internal components on the reuse side. This way, cost reduction becomes an engineering result rather than an accident.

    5. What to watch: prerequisites and non-applicable scenarios

    Multi-agent collaboration is suitable when requirements can be described, boundaries can be split, and validation can be automated. It is not a universal solution.

    Prerequisites include:

    • The target system can be split into modules.
    • Interfaces can be defined before implementation.
    • Automated testing and boot validation are available.
    • Documentation and repository structure can be standardized.

    Non-applicable scenarios include:

    • A prototype is not a production system. Systems involving security, reliability, and long-term maintenance cannot be delivered directly from a prototype.
    • Desktop and operating system development require hardware compatibility handling. Drivers and graphics stacks often depend on real devices.
    • Model access may require permissions, network access, data controls, and compliance review. Model calls should not be treated as risk-free capabilities.

    For security, the build and boot process may involve disk images, file systems, and device access. Run such work in isolated environments, keep backups, and follow least-privilege principles. Containers, object storage, logging, and monitoring can serve as supporting capabilities, for example for hosting build tasks and observability analysis. Depending on the deployment environment, Baidu AI Cloud provides container, storage, logging, and monitoring capabilities; alternatives include self-managed Kubernetes, open-source object storage, ELK, and Prometheus. When choosing, consider isolation, log retention, cost transparency, and data compliance rather than binding to a single vendor.

    6. FAQ: common questions and troubleshooting

    Q: What is multi-agent collaboration?

    A: It means splitting a large task into subtasks and letting multiple execution units complete them in parallel under shared repository, shared test pipelines, and shared documentation constraints. Automated validation is then used to merge results.

    Q: How should tools be selected?

    A: Prioritize support for in-repository document management, commit rollback, log tracing, parallel scheduling, and test integration. Do not judge only by generation speed.

    Q: What are common mistakes?

    A: High parallelism before interfaces are stable, lack of structured memory, non-reproducible tests, treating a prototype as a production system, and ignoring hardware compatibility or permission compliance.

    Q: How should failures be debugged?

    A: First identify the failing stage. Then check commit hashes, logs, test data, and emulator parameters. Do not immediately ask agents to perform large-scale rewrites.

    In summary, interface-first design determines the maximum parallelism; documentation as memory determines long-term stability; automated validation determines delivery quality; and cost optimization should focus on context, retries, and rework rather than simply lowering the price of individual calls.