Chapter 2 of 8
Install and setup: from zero to a running system
Installing LifeOS is meant to be done with your AI, not around it. There is a one-line installer, and the important thing is what it protects. Before it writes anything it verifies your prerequisites (a runtime, version control, the coding harness) and it backs up your existing config to a timestamped copy, so an install never destroys what you already have. After the files land, it registers Pulse as a background service and hands you off to the interview. That interview is the real setup: four phases that walk you through TELOS (your mission, goals, beliefs, challenges), your ideal state, your preferences, and finally tuning your DA's identity. Without that, the system has nothing to optimize against. In this lab you simulate the installer's safety contract: check prerequisites on a sample environment, then prove the backup is taken strictly before the new install is written and that the original bytes survive.
The lab: read it, then run it
#!/usr/bin/env python3
"""
LAB LO2: Install preflight and backup-before-overwrite.
The LifeOS installer never clobbers what you have. It verifies prerequisites
first (Bun, Git, the coding harness), and before it writes anything it backs up
your existing config to a timestamped copy. In this lab you simulate that flow on
a sample environment: check prerequisites, then prove the backup exists BEFORE
the new install is written. Everything is a fictional in-memory sample.
Run: python3 modules/academy-content/labs/lifeos/lo2-install-preflight.py
"""
import sys
# STEP 1: preflight. the installer confirms each required tool is present.
required = ["bun", "git", "harness"]
sample_env = {"bun": "1.1.0", "git": "2.44", "harness": "installed"}
missing = [t for t in required if t not in sample_env]
print("STEP 1: preflight, verify prerequisites")
for t in required:
print(f" {t:10} -> {'found ' + sample_env[t] if t in sample_env else 'MISSING'}")
preflight_ok = (missing == [])
# STEP 2: a sample existing install on disk, represented as a dict of files.
disk = {"config": "v-old", "identity": "old-name"}
events = [] # order of operations, for the invariant
def backup(store):
snapshot = dict(store) # copy everything before touching it
events.append("backup")
return snapshot
def install(store):
store["config"] = "v5.0.0" # overwrite happens only after backup
events.append("write")
print("")
print("STEP 2-3: back up, THEN write the new install")
backup_copy = backup(disk)
install(disk)
print(f" operation order : {events}")
print(f" backup preserved: config={backup_copy['config']!r} identity={backup_copy['identity']!r}")
print(f" disk now : config={disk['config']!r}")
# INVARIANT: preflight passed, backup ran strictly before the write, and the
# backup still holds the original bytes (nothing was lost).
ordered = events == ["backup", "write"]
preserved = backup_copy["config"] == "v-old" and backup_copy["identity"] == "old-name"
ok = preflight_ok and ordered and preserved
print("")
print(f"SAFE INSTALL (preflight ok, backup before write, originals preserved): {'YES' if ok else 'NO'}")
if not ok:
sys.exit(1)
print("Prerequisites checked and your old config is safe. Next: capture your TELOS.")
Runnable lab
lo2-install-preflight.pyRun a sample preflight, then prove the installer backs up before it overwrites.
Proves: SAFE INSTALL (preflight ok, backup before write, originals preserved): YES
Runs in your browser via Pyodide. First run loads the runtime once; no install, no server.
The operation order was backup first, then write, and the backup still held the original values. That ordering is the whole promise: your existing work is never at risk. Notice what the lab did not do: it did not touch a network or any real file, it reasoned about the contract in pure logic. The real installer adds the interview on top, which is where the system learns your ideal state. Next you go deep on the artifact that interview produces, your TELOS.
Check your understanding
1. What does the installer do before writing any new files?
2. Why is the interview called the most important step?
3. In the lab, what proved the install was safe?