Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions docs/BMAD_BOOT_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# BMAD Boot MVP POC Implementation

## Quick Start

To boot Promptware OS with a BMAD bundle:

```yaml
version: "0.1"
root: "https://raw.githubusercontent.com/ShipFail/promptware/main/os/"
kernel: "/kernel.md"
init: "https://raw.githubusercontent.com/bmadcode/bmad-method/main/bundle/init.txt"
```

The OS will automatically:
1. Load the kernel from the OS root
2. Detect that `init` points to a different repository
3. Derive application root: `https://raw.githubusercontent.com/bmadcode/bmad-method/main/`
4. Call `os_chroot()` to switch VFS root
5. Load init from the BMAD repository

## Key Features

### 1. `os_chroot(new_root)` - New Kernel Primitive

Change the VFS root mount during boot handoff:

```
Before chroot: / → https://raw.githubusercontent.com/ShipFail/promptware/main/os/
After chroot: / → https://raw.githubusercontent.com/bmadcode/bmad-method/main/
```

### 2. GitHub-First Loading

No installation required. Just provide a GitHub raw URL:

```yaml
# Load any agent, bundle, or application by URL
init: "https://raw.githubusercontent.com/<org>/<repo>/<ref>/<path>/init.md"
```

### 3. fstab Support

Mount additional libraries and modules:

```yaml
# os/fstab.yaml
version: "0.1"
mounts:
- mount: "/modules/bmad/"
url: "https://raw.githubusercontent.com/bmadcode/bmad-method/main/"
- mount: "/lib/utils/"
url: "https://raw.githubusercontent.com/myorg/common-libs/main/utils/"
```

## Files

- `os/kernel.md` - Kernel with os_chroot and fstab support
- `os/bootloader.md` - 17-step boot sequence with chroot logic
- `os/fstab.yaml.example` - Example mount table
- `os/validate-boot.js` - Validation script (run with `node os/validate-boot.js`)
- `docs/bmad-boot-example.md` - Detailed examples
- `docs/implementation-summary.md` - Complete technical summary

## Testing

Run the validation script:

```bash
node os/validate-boot.js
```

Expected output: 3/3 test cases passing

## Security

- ✅ 0 vulnerabilities (CodeQL scan)
- ✅ HTTPS-only URLs enforced
- ✅ Fail-fast on mount conflicts
- ✅ Immutable kernel laws
- ✅ Read-only ingests (no local writes)

## Philosophy

Following Unix principles:
- **Microkernel**: Keep OS small (~105 lines)
- **Mechanism, not policy**: OS provides "how", not "what"
- **Fail-fast**: Panic on errors, don't guess
- **Separation of concerns**: OS layer vs Application layer
- **Do more by doing less**: Minimal features, maximum power

## What's Next

See `docs/implementation-summary.md` for future milestones:
- Milestone A: fstab becomes real (test multi-mount VFS)
- Milestone B: Friendly names (optional sugar)
- Milestone C: Dependency-aware systems (if needed)

## Proof of Concept

This implementation proves:

✅ Promptware OS can boot reliably from an OS root
✅ Promptware OS can os_chroot into an application root
✅ Promptware OS can ingest arbitrary text as init
✅ BMAD can be booted by URL without installation

**This is the "cloud-native agent OS" proof.**
18 changes: 14 additions & 4 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ The system mimics the classic Linux boot process: `Bootloader -> Kernel -> Init`
* **Analogy**: Linux Kernel + VFS.
* **System Calls (Primitives)**:
* **`os_resolve(path)`**: Maps Virtual Paths to Real URLs (VFS).
* **`os_chroot(new_root)`**: Changes the VFS root mount to a new URL (boot-time handoff).
* **`os_invoke(url, args)`**: Executes remote tools ephemerally (Zero-Footprint).
* **`os_ingest(library_path)`**: Ingests and Activates a Skill Library into the active context.
* **Design**: It is "stateless" regarding the persona. It does not know *who* it is, only *how* to operate.
* **MVP Features**: Supports fstab for VFS mount tables, enabling cloud-native module composition.

### 2.3 The Init Process (User Space)
* **Role**: The First User Program (PID 1).
Expand All @@ -54,12 +56,20 @@ The system mimics the classic Linux boot process: `Bootloader -> Kernel -> Init`

1. **Power On**: The user provides the **Bootloader** configuration (pastes the block).
2. **Kernel Load (Ingest and Adopt)**: The LLM fetches the **Kernel** from the remote URL and immediately adopts its laws as the operating physics.
3. **Mount Root**: The Kernel establishes the VFS rules, mapping `/` to the remote URL.
4. **Exec Init**:
* The Kernel resolves the `init` path (e.g., `/agents/powell.md`) using the VFS.
3. **Mount OS Root**: The Kernel establishes the VFS rules, mapping `/` to the OS root URL.
4. **Load OS fstab** (optional): Process OS-level mounts if `/fstab.yaml` exists at OS root.
5. **Determine Application Root**:
* If `init` is a full GitHub raw URL to a different repo/ref, derive the application root.
* Call `os_chroot(Application Root)` to switch VFS root.
* Rewrite `init` to be relative to the new root.
6. **Load Application fstab** (optional): Process application-level mounts if `/fstab.yaml` exists at current root.
7. **Exec Init**:
* The Kernel resolves the `init` path using `os_resolve`.
* It reads the file's content.
* It performs a **Context Switch**, adopting the Agent's persona while retaining the Kernel's laws as background constraints.
5. **User Space**: The system is now "up," and the Agent (PID 1) handles all subsequent user interactions.
8. **User Space**: The system is now "up," and the Agent (PID 1) handles all subsequent user interactions.

This design enables **zero-installation** loading of any GitHub-hosted agent, bundle (like BMAD), or application by simply providing its URL as `init`.

## 4. Directory Structure

Expand Down
88 changes: 88 additions & 0 deletions docs/bmad-boot-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# BMAD Boot Example

This document demonstrates how to boot a BMAD bundle using Promptware OS.

## Example 1: Boot with Relative Init (Default OS Agent)

```yaml
version: "0.1"
root: "https://raw.githubusercontent.com/ShipFail/promptware/main/os/"
kernel: "/kernel.md"
init: "/agents/jekyll.md"
```

**Result**:
- No chroot occurs
- Init loaded from: `https://raw.githubusercontent.com/ShipFail/promptware/main/os/agents/jekyll.md`
- Agent runs with OS root as VFS root

## Example 2: Boot BMAD Bundle (Full URL with Chroot)

```yaml
version: "0.1"
root: "https://raw.githubusercontent.com/ShipFail/promptware/main/os/"
kernel: "/kernel.md"
init: "https://raw.githubusercontent.com/bmadcode/bmad-method/main/bundle/init.txt"
```

**Result**:
- Kernel detects full GitHub raw URL to different repo
- Application Root derived: `https://raw.githubusercontent.com/bmadcode/bmad-method/main/`
- Kernel calls: `os_chroot("https://raw.githubusercontent.com/bmadcode/bmad-method/main/")`
- Init rewritten to: `/bundle/init.txt`
- Init loaded from: `https://raw.githubusercontent.com/bmadcode/bmad-method/main/bundle/init.txt`
- Agent runs with BMAD root as VFS root

## Example 3: Boot with fstab Mounts

**OS fstab** (`https://raw.githubusercontent.com/ShipFail/promptware/main/os/fstab.yaml`):
```yaml
version: "0.1"
mounts:
- mount: "/modules/bmad/"
url: "https://raw.githubusercontent.com/bmadcode/bmad-method/main/"
```

**Application fstab** (after chroot, at `https://raw.githubusercontent.com/myorg/myapp/main/fstab.yaml`):
```yaml
version: "0.1"
mounts:
- mount: "/lib/utils/"
url: "https://raw.githubusercontent.com/myorg/common-libs/main/utils/"
```

**Bootloader config**:
```yaml
version: "0.1"
root: "https://raw.githubusercontent.com/ShipFail/promptware/main/os/"
kernel: "/kernel.md"
init: "https://raw.githubusercontent.com/myorg/myapp/main/init.md"
```

**Boot sequence**:
1. Load kernel from OS root
2. Process OS fstab → mount `/modules/bmad/` to BMAD repo
3. Detect full URL init → derive app root
4. Call `os_chroot("https://raw.githubusercontent.com/myorg/myapp/main/")`
5. Process application fstab → mount `/lib/utils/` to common libs
6. Load init from `/init.md` (resolved against app root)

**Final VFS state**:
- `/` → `https://raw.githubusercontent.com/myorg/myapp/main/` (application root)
- `/modules/bmad/` → `https://raw.githubusercontent.com/bmadcode/bmad-method/main/`
- `/lib/utils/` → `https://raw.githubusercontent.com/myorg/common-libs/main/utils/`

## Key Benefits

1. **Zero Installation**: Just provide a URL to any GitHub-hosted agent/bundle
2. **Cloud-Native**: Everything loads from GitHub raw URLs
3. **Isolation**: OS layer and application layer are cleanly separated
4. **Composability**: Use fstab to mount multiple libraries and modules
5. **Unix-Like**: Familiar chroot concept adapted for cloud-native prompt loading

## Security Notes

- All URLs must be HTTPS
- Mount conflicts cause kernel panic (security by fail-fast)
- Kernel laws remain immutable regardless of chroot
- Application cannot override OS-level mounts
Comment on lines +97 to +102
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential ambiguity in mount conflict detection: The documentation states that "Application cannot override OS-level mounts" (line 88), but Example 3 shows OS fstab mounting "/modules/bmad/" before chroot. The kernel.md states at line 69 that mount conflicts cause panic, but it's not clear whether this applies only to exact path matches or also to overlapping paths (e.g., would mounting "/modules/" conflict with "/modules/bmad/"). The specification should clarify the exact matching rules for mount conflict detection.

Copilot uses AI. Check for mistakes.
Loading
Loading