Chapter 4 of 8
The Algorithm: how work actually gets done
The Algorithm is the gravitational center of LifeOS. Every non-trivial task runs through it, and it is modeled on the scientific method: a seven-phase loop that goes OBSERVE, THINK, PLAN, BUILD, EXECUTE, VERIFY, LEARN, in that exact order. The loop is driven by one artifact, the ISA, the Ideal State Artifact. The ISA articulates what done looks like and decomposes it into ISCs, Ideal State Criteria, which are atomic testable claims: each one is a single yes or no probe, so passing all of them proves the work is done. Effort tiers (from a fast lane to a comprehensive deep run) scale how much rigor the loop applies. The point of the fixed order is discipline: you cannot verify something you have not built, and you cannot learn from a run you have not verified. In this lab you implement the phase machine, prove it walks all seven phases in order, and prove it refuses to skip a phase.
The lab: read it, then run it
#!/usr/bin/env python3
"""
LAB LO4: The Algorithm as a seven-phase state machine.
Every non-trivial task in LifeOS runs through the Algorithm: OBSERVE, THINK,
PLAN, BUILD, EXECUTE, VERIFY, LEARN, in that order. The order is the discipline.
You cannot verify before you build, and you cannot learn before you verify. In
this lab you implement the phase machine, prove it walks all seven phases in the
correct order, and prove it REFUSES to skip a phase. All synthetic.
Run: python3 modules/academy-content/labs/lifeos/lo4-algorithm-phases.py
"""
import sys
PHASES = ["OBSERVE", "THINK", "PLAN", "BUILD", "EXECUTE", "VERIFY", "LEARN"]
class Algorithm:
def __init__(self):
self.i = 0 # index of the current phase
self.visited = []
def current(self):
return PHASES[self.i]
def advance(self, to):
# only the very next phase in the sequence is allowed.
expected = PHASES[self.i + 1] if self.i + 1 < len(PHASES) else None
if to != expected:
raise ValueError(f"cannot jump to {to}; next phase must be {expected}")
self.i += 1
self.visited.append(to)
# STEP 1: walk the whole loop in order, recording each phase entered.
a = Algorithm()
a.visited.append(a.current())
print("STEP 1: walking the phases in order")
for nxt in PHASES[1:]:
a.advance(nxt)
print(f" entered {nxt}")
order_ok = (a.visited == PHASES)
print("")
print(f"STEP 2: visited all seven phases in order: {order_ok}")
# STEP 3: prove a skip is rejected. from OBSERVE you cannot leap to VERIFY.
b = Algorithm()
skip_rejected = False
try:
b.advance("VERIFY") # illegal: THINK is next, not VERIFY
except ValueError as e:
skip_rejected = True
print("")
print(f"STEP 3: illegal skip rejected -> {e}")
ok = order_ok and skip_rejected
print("")
print(f"ALGORITHM ENFORCES PHASE ORDER (all seven, no skips): {'YES' if ok else 'NO'}")
if not ok:
sys.exit(1)
print("Order is the discipline: observe, think, plan, build, execute, verify, learn. Next: skills.")
Runnable lab
lo4-algorithm-phases.pyImplement the seven-phase state machine and prove it enforces order and rejects skips.
Proves: ALGORITHM ENFORCES PHASE ORDER (all seven, no skips): YES
Runs in your browser via Pyodide. First run loads the runtime once; no install, no server.
The machine walked all seven phases in order and threw when asked to leap from OBSERVE straight to VERIFY. That refusal is the whole idea: verification only means something if it comes after the build, and learning only compounds if it comes after real verification. In the real Algorithm each ISC must pass with actual tool evidence, a curl response, a screenshot, a file read, before the task can be called done. That is how LifeOS avoids the classic failure of claiming something works without checking. Next you meet the units that do the actual work inside these phases, skills.
Check your understanding
1. What are the seven phases of the Algorithm, in order?
2. What is an ISC?
3. Why does the Algorithm enforce phase order?