What it does
Size of the whole system, counted from the repository. 22,203 lines of Python and, by the method in SCALE.md, 13,060 lines of application code in 52 files and 9,324 lines of tests in 37 files; 422 test cases; 843 lines of HTML; 14,869 lines of Markdown and YAML; a shared library, 31 pipeline programs, 6 programs in the client folder that build its pages and run its board, 3 retained build programs from the first build (build_notion.py, build_org_page.py, build_mermaid_chart.py), 6 proof programs and the gate-proof script under scripts/, 88 Python files in all, 37 test files; 8 scheduler job definitions, a CI workflow that runs the gate; 36 recorded learnings; 122 commits on the main line, 199 across all branches. Counting every tracked Python file gives 22,203 lines in 88 files; the SCALE.md method gives 13,060 lines of application code and 9,324 lines of tests, 22,384 together.
The workspace and the data behind it
- The mining of the company's records. The organisation chart, the 35 role seats, their job descriptions and the 193 recurring tasks were not typed in and not invented by a model. They were mined by parallel AI agents, each held to citing primary files, out of three sources: a copy of the company file server (at least 18,000 files, about 30 GB, with a job-queue "command center" built first so that each copy ran as a queued, logged, time-limited and resumable job), a pull of 554 customers and 5,145 work orders from the company's live field-service system, and a 47-table legacy business database covering 1999 to 2020 (11,521 invoices, 10,049 jobs, 8,534 sites, 1,124 clients and an 81-code service catalogue). The company had no procedures manual, no handbook and exactly one written job description, so every role and duty was reconstructed from how the company actually works: service mix, the certifications people hold, which crew members are assigned together, and the company's own workflow documents. The work-order system's role field turned out to be an access tier, not a job title, so roles were rebuilt one layer down. For the real-estate holding companies and the event venue, where the archive holds no task-level records, research agents built role sets from industry sources, with citations.
- Every duty graded against the archive. An AI drafted the duty text for 193 recurring tasks, and each was then graded against the archive as Proven by current records, Likely or Unproven, with the Unproven ones kept, flagged and put in a review view for the administrator.
- The workspace. The company's organisation and accountability board, moved from Airtable in one afternoon: five companies, 35 seats and 193 recurring duties, an organisation page with one main chart and five company charts, colour-coded boards, the guide, and a Staff table so that a person is a record and not typed text.
- The generic build pipeline (
pipeline/build_workspace.py,export_spec.py,orgchart.py). It reads a specification and applies databases, properties, relations and option colours deterministically, snapshots a live workspace back into a specification, and draws the Mermaid chart and the clickable seat tree from a neutral organisation shape. The first build for a new client goes into a scratch page before the real one. - The validated reader (
pipeline/orgload.py). Every generator reads the live roles and companies tables through it. A blank or malformed row becomes one line in an anomaly report and the chart is still drawn; a field whose type a person has changed stops the run. - The live chart generator (
regenerate_org_chart.py,regen_lib.py,org_page_v3.py). Rebuilds the organisation page from the roles table, writes nothing when nothing changed, and reads the page back before it reports success. - Start Here (
start_here_v3.py). The administrator's guide inside the workspace, generated with 14 automatic checks on its content, including three that stop specific false promises from appearing. - The recurrence engine (
pipeline/recurrence.py,test_recurrence_spec_binding.py). Returns a finished recurring task to the list on its cadence, checks the task table's shape (including Status) against the specification on every run, and stops with an alarm if a person has changed it. Switching it on is reserved for a human decision, because it changes what the administrator may do with her own list. - The projects board (System 2) (
project_sync.py,pipeline/board_checks.py,check_board_reminders.py). Projects, milestones and an append-only project log holding the full history of his work for the client, with the views Now, Everything, History and By person, a registry of 46 folders, and one write path that shows its plan before it writes (dry run by default). Rows the client creates are acknowledged and added to, never overwritten. - The decoy sweep (
decoy_sweep.py). Counts what sits in the sample tables Notion plants in a new workspace and keeps a dated, ordered plan for clearing them with the administrator's content moved out first. - The audit bundle. A frozen copy of the workspace (10 databases, 256 records, 1,115 blocks), the scripts that re-derive every number, four analyst passes, the second diagnosis, the reconciliation and the solution, which names what it does not prevent.
The shared service layer
- The service spine. One shared library (
tools/notionlib.py, 250 lines) and a 31-program pipeline that name no client, a template folder for the next client, and a playbook from intake to handoff (docs/PLAYBOOK.md, nine steps from Intake to Recurring ops). It talks to Notion directly with a key held per client, because the hosted connector needs a person to sign in and a scheduled job has nobody present. The same rules are projected for a second AI tool, Codex. - The library as the one door. Pacing at about three calls a second, backoff on rate and server errors, the append-only mutation ledger, the pinned interface version, the
NOTION_READONLYswitch, and a guard for every wall the service has hit (select-option colours that cannot be changed in place, options created without a colour staying grey forever, a rename by id that returns success and changes nothing). - The scheduled-job runner (
pipeline/runner.py), andprovision_healthchecks.py. Every scheduled job goes through the runner; the provisioning program creates one outside monitoring check per job injobs.jsonwith a schedule and grace fitted to its cadence and writes the ping addresses the runner and the gate read. - What runs on a schedule (launchd definitions in the client's
ops/launchd/folder, declared injobs.jsonwith a timeout and, where relevant, a read-only setting, a report folder or a chain to another job). - Every hour from 07:10 to 19:10: rebuild the organisation chart from the roles table. A run with nothing changed writes nothing.
- 02:00 every night: copy every table and page body, then publish the copy off the machine.
- 03:00 every night: the workspace gate, read-only.
- 08:00 every day: the business reminders, read-only.
- Monday 09:00: the weekly audit, read-only.
- 1 January, April, July and October at 04:00: the restore drill.
- The nightly backup (
export_data.py,publish_backup.py,restore_data.py,restore_drill.py). Dumps every database's rows with all properties as raw records and every row page's body, found by asking Notion what exists. The publisher works in an isolated temporary repository, permits only dated snapshot and manifest paths, publishes to a dedicated private backup branch, checks that what arrived equals what it sent, and refuses an empty copy. The restore path rebuilds databases and rows as new objects under a recovery page with an old-to-new id map and remapped relations, and was drilled before it was needed. - The workspace gate (
verify_workspace.py, 748 lines). The largest single check: table shapes, field names, minimum row counts, templates, malformed rows, the heartbeat monitors, the job declarations and the age of the chart's last success, against the intent spec. - The activity instruments (
snapshot_diff.py,edit_census.py,workspace_actors.py,activity_report.py). Four instruments that answer what the client changed, how much, when and who by, from nightly copies, so that Notion's lack of a change history is no blind spot. The shared module keeps the two instruments from ever disagreeing about who an account is or which local day a timestamp falls on; each instrument documents in its own header what it structurally cannot see.snapshot_diff.pycounts rows created, removed, changed property by property, or merely touched, and schema edits such as renamed, retyped, added and removed fields. - The weekly audit pipeline (
run_weekly_audit.py,weekly_evidence.py,weekly_analysis.py,weekly_finalize.py,audit_summary.py). Five stages: deterministic, run-scoped evidence preparation; a no-egress Claude analysis boundary; validation, atomic storage and local versioning of the report; and a short, actionable summary delivered where the operator already reads. - Immutable releases for the scheduled jobs (
reconcile_infrastructure.py,launchd_command.py,launchd_calendar.py,launchd_loaded.py,release_review.py,record_release_review.py,data_migration.py,atomic_file.py). The scheduler's job definitions run from release bundles extracted from a recorded commit, never from the working copy; mutable client folders appear only as links to an operator-owned data root; every bundle carries a hash manifest; switching to a new release is transactional and reverses itself on failure; a tamper-evident receipt records an independent reviewer's approval of each release; stores are migrated atomically with validation; control files are replaced durably; and the parsers for the scheduler's declarations accept a trigger as evidence only if it can actually occur. - The repository gate in CI (
.github/workflows/gate.yml,.pre-commit-config.yaml,.gitleaks.toml).make gate-offlineruns on every push, every pull request, on demand and every Monday 09:00 UTC on a clean machine, with the secret scanner pinned to one release and run over the whole git history, and a pre-commit hook for secrets, formatting and file size that never blocks a save.make gateadds the dependency audit and the one test that runs the real Claude program. The gate's tool versions are exact pins, because a floating linter version silently changes what the gate accepts. The production code imports only the Python standard library, so a scheduled job runs from a bare interpreter with nothing installed. - The coverage ratchet (
pyproject.toml). A floor that only goes up, raised each time a body of tests lands, with each step recorded with the figure measured. Complexity, branch-count and statement-count thresholds were set by bisecting until the finding count reached zero, and a 800-line limit per source file is enforced. - The quality gate. 422 tests, seven rejection proofs, generated hostile inputs, a secret scan and a dependency audit, with a fuzz suite over job and scheduler-declaration inputs (property-based tests using Hypothesis, with a corpus of hostile job inputs, malformed scheduler files and scheduler-declaration inputs) and six proof harnesses that run named faults against copied modules (activity instruments 12, backup, health split, infrastructure, job declaration, weekly audit), each with an unchanged control that must pass first.
- The threat model and the release builder. A written statement of which client data may leave the machine and where it may sit, with the risks he accepted set down and a test that stops an AI from widening that acceptance; and release bundles cut from a recorded commit with a tamper-evident review receipt.
- The documents an AI fleet runs on. The modification contract (seven numbered rules), the client state file (seven sections), the delivery plan, the review protocol, the threat model with its dated amendment, the Notion knowledge base (six pages and a README), the issue tracker and triage labels, and a template folder for the next client.
What it achieved
- Unattended running. The scheduled jobs run every day with nobody present; the chart job ran 1,165 times unattended.
- Nightly copies. A full copy of the workspace is taken every night and published off the machine.
- The restore drill rebuilt seven tables from the latest nightly copy with every row count exact (311 rows), all 36 parent links between roles pointing inside the rebuilt set, and the three longest pages matching.
- The original move brought 254 records in five tables across in one afternoon. An independent audit found all 193 tasks intact and no broken link.
- A person really shared it. The administrator made at least 1,564 edits and built a 19-step accountability process and six tables of her own inside the workspace, which the nightly copy found and protected.
- Every machine write is on record: 8,355 ledger entries.
- Weekly audit reports, with 164 files of run records under the weekly audit folder.
- Reviews that refuse. The recovery plan was accepted only when an independent reviewer found no blocking defect in it.
- What the second instrument found. Of the 1,564 client edits, a plain night-to-night comparison could see 158. The edit census found the other 1,406.
- Scale. 122 commits on the main line and 199 across all branches, 22,203 lines of Python, 36 learnings, 422 test cases, 32 nightly snapshots on disk.
- The board's roles and duties. 35 seats and 193 duties, each graded against the records; 5,145 work orders and 18,000 or more files read to derive them.
The problem it solves
- AI goes wrong confidently and plausibly, so the thing to build is the machine that holds its work on a client's workspace inside boundaries. The workspace is what the client sees; the harness around the AI is the product.
- A workspace a person edits every day is never still. A check can say that something changed; it cannot say whether that is damage or the administrator doing her job.
- In an unattended system, failure is silent. A crashed program, a sleeping computer and a job nobody scheduled all produce nothing, so the alarm has to fire when success is missing.
- A check that compares a workspace with a copy of itself can only agree with it.
- A page the machine generates and a person cannot edit is a page she cannot correct.
- A backup nobody has restored is a hope.
- A checker can see what is in a workspace, never what it is for. Whether the content is right belongs to the person who runs the board.
- The people using the workspace are its sensors.
- A decision left open with no date gets made by whoever hits the wall first.
- A lesson learned on one client protects the next client only once it is code.
- The company's roles had to come from what its records show it does, since it had never written them down; an AI summary of the business is a lead, never a fact.
- A fault is fixed by a mechanism, never by a "be careful" note. The workspace is audited read-only by four independent analysts, a second diagnosis comes from an AI barred from reading the first, and every cause is mapped to a mechanism. In a single day his AI organisation made 36 commits covering the audit, the contract, the projects board and the guide.
- A green gate can sit over a corrupted backup, so the backup's round trip has its own 44 tests, and a written statement beside the gate says what its green result does and does not prove.
- A claim about how well tests catch faults can be written from the feeling of having been careful, so such a claim is accepted only from a program anyone can re-run, which plants named faults and checks that the suite catches them.
- A report with no reader is the same failure as a log with no failures, so the weekly audit has a delivery layer that puts its summary where he already reads.
- A test in this process cannot cover a subprocess contract, so one test runs the real Claude program.
- A test must never reach the client's backup slot, so the publisher permits only dated snapshot and manifest paths.
How he built it
Sharing the workspace with a person
- Machine-owned and human-owned. Every block the AI wrote is listed by its id in a stored manifest and marked on the page with a 🤖 footer. Everything else, and every value a person typed, is human-owned. Ownership is never worked out by exclusion.
- "📎 Preserved edits". When a person edits something the machine owns, the generator moves her words into a "📎 Preserved edits" section before it rewrites that spot, and reports it. Repeated preserved edits are read as a sign that she needs an input the product lacks.
- Named playbooks. The AI may write to anything a person owns only through a named playbook he authorised once, each with its own tests: regenerating the organisation page, a single instructed write, recurring-task resets, the projects board sync, the restore drill inside its own scratch page, and one approved redesign pass. Anything else is read-only.
- Validate, plan, execute, verify. Every value read from the workspace is untrusted input. The whole change is planned before the first write, a stop leaves nothing half-written and names the change it refused to make, and success is announced only after the page has been read back. A success reply from Notion is not proof: one rename returned success and changed nothing.
- The validated reader. A blank or malformed row becomes one line in an anomaly report and the chart is still drawn. A field whose type a person has changed stops the run.
- One door for every write: the mutation ledger. Every call to Notion goes through one shared library, under the AI's own identity. It sets the pace, retries, and records each change in an append-only ledger before and after it happens, with a fingerprint of what was sent. The Notion interface version is pinned; moving to a newer one is a planned migration with its own tests.
NOTION_READONLY. Notion's access keys cannot be limited to reading, so the library itself refuses every write when this switch is set. The nightly check, the reminders and the weekly audit run under it.- Never any agent's call. Inviting or removing people, sharing, billing, deleting anything a person entered, and renaming or clearing a person's field or test data, however wrong it looks. The AI presents the option with a recommendation. A client edit that looks like damage is reported and left alone.
- Client isolation is absolute. Each client's key, data, records and scripts sit in that client's own folder, and the shared machinery names no client. Keys are never committed or printed. The scripts that did the original build are kept as a record and never run again.
- The enforcement map. The contract ends with a table naming the code that enforces each rule, so that no rule exists only as prose.
What the AI must treat as true
- The client state file, read before anything is touched. It says who edits the workspace, what has been promised to them and by when, and it keeps the register of things that look like defects and are deliberate. An anomaly is not a defect until it has been checked there; if it touches something a person entered and is not listed, it is a question for the client. It exists so that no AI reads a report cold and calls the administrator's protected test data damage.
- The division of labour. The service governs the machine, never the client's content. AI drafted the duty text for 193 recurring tasks and the administrator reviews it, with a
Confidencetag (Proven, Likely, Unproven) tracking her progress. The AI may not report her review queue as a risk. - The intent spec and accepted drift. The workspace is checked against a hand-reviewed statement of what it is meant to be. An accepted change by the administrator is written into that statement with its reason, so the check stops raising it.
- The client's own words are the record. Her emails are kept word for word in the project. Where they and any file disagree, she wins.
- Positive provenance. "A limitation of your instrument is never evidence about reality." Before any claim that data is lost, invented or the work of a named person, the AI must open Notion's version history, the session records and the client's emails. "Absent from the sources I checked" never means it exists nowhere, and an edit record names an account, never a person. Because the edit attribution on this workspace cannot name a human, no doc, script or test attributes an edit to a person.
- The Notion knowledge base. Six pages distilled from the official documentation, consulted before any on-screen operation or claim about how Notion behaves. Guessing by clicking is a defect.
- The learnings ratchet. Every wall hit on a client is recorded, then promoted from prose into the shared library, then into the gate, so the next client inherits it: 36 entries, L1 to L36. Every planned change is labelled SPINE, CLIENT or OPERATOR, so a shared cause is never fixed in one client's folder.
- The evidence rule for mining. Earlier AI-written summaries of the company are leads, never facts, and every role had to cite a primary file; people's names stayed off the chart, which holds seats only.
Who checks whom
- Verify gate before "done". A helper's report that data was written is a claim. The query of the workspace is the evidence.
- Independent approval. The AI that produces work may never approve it. Each approval comes from a newly created reviewer with no inherited conversation, which reads the rules and the actual change, runs the proof, and ties its verdict to that evidence. Before any change to the client's workspace, a reviewer approves the exact action, the producer does only that, and a third agent checks the result. A reviewer that saw an earlier version may diagnose but cannot approve, and work awaiting review may not be described as done.
- The plan gate. A plan is reviewed by fresh reviewers against his standards before any of it is built. Earlier plans count as rank-4 hearsay, so every fact in a new plan is measured again.
- The staged diagnosis, with quarantine in force. His brief barred the diagnosing AI from opening the earlier conclusions until its own diagnosis was on disk, then required a three-column reconciliation. A cause had to be explained plainly from end to end (the Feynman standard), traced to a broken rule that would have prevented the whole class (five-whys to an invariant), and had to predict a defect nobody had looked for ("Prediction or it isn't a diagnosis"). The solution had to name what it would not prevent and how to prove it wrong.
- Order with reasons. Work is sequenced by what masks or destroys what: the backup before any further change to client data, the alarm before any schedule runs.
make gateandgate-proof. One command checks the whole codebase (format, lint, types, file size, duplication, secrets, dependency audit, tests above a coverage floor), and its header states what a green result does and does not prove. A second points every check at deliberately broken input and fails if the check does not object, asserting the exact failure and pairing each with a positive control. His rule for any instrument: make it go red once before trusting any green, because "present" is never an answer to "in effect". A claim about how well the tests catch faults is accepted only when anyone can re-run the proof.- A check must be able to go green. A check holding rows that can never clear says nothing about the rows that can, and buries the real ones. The remedy is an acceptance a person writes down by name, never an age limit. A check's message must also say what it actually tested.
- Builders on separate files. Several AI builders working at once each get their own files, so one change can be undone without the other.
- Corrections stay visible. A wrong statement in the record is corrected in place with a dated note, and the older line it contradicts is fixed in the same change.
- Findings become numbered issues. The AI owns the building, testing and review. An issue is marked for him only when the contract reserves the decision to a person.
How he knows it is still working
- The runner. Every scheduled job goes through one wrapper: one log a person reads, recording failures as well as successes, a lock so runs cannot overlap, and a time limit so a stuck job becomes a reported failure.
- The dead-man's switch. An outside monitoring service expects a success signal from each job. The signal is sent only after the job has read back what it wrote, and the alarm fires when the signal is missing, so a dead computer raises it too. Only job names and result codes leave the machine.
- The workspace gate. Each night the workspace is compared with the intent spec: table shapes, field names, minimum row counts, templates, and malformed rows, which get 48 hours before they count (the anomaly budget). It refuses to report healthy when the chart's last success is over 24 hours old.
- A reader test for every specified field. A program that never reads a field shows its data as missing while logging success, so every field in the design carries a test that fails if it is not read, and when two fields disagree the winner is shown and the disagreement is reported.
- Enumerate what exists, not what the build remembered. The nightly copy asks Notion what exists and never works from a list of what the build made, so a table the administrator creates is protected from then on. Each copy leaves the machine with a fingerprint, the publisher checks that what arrived equals what it sent, and an empty copy cannot be published.
- The restore drill. Each quarter it rebuilds the latest copy in a scratch page, compares row counts table by table, checks that the links between rows point inside the rebuilt set, compares page text, and removes the scratch page. A count alone would pass with every link empty, so the links are checked too.
- Every job in exactly one declared state. Each job must be scheduled, deliberately held back, or chained to another; none is a failure and two is a contradiction. The check reads the computer's own scheduler and does not believe the job list.
- The weekly audit. Each Monday, Claude runs with no person present over a prepared bundle of 14 fingerprinted evidence files: two copies of the workspace, the difference between them, the logs, the gate's output and the client's emails. It has three reading tools, no command line and no connectors, which cuts the lethal trifecta of client data, untrusted text and a way out, and it is told to ignore any instruction found inside what it reads. Its instructions carry the provenance rules. A supervisor ends it after ten silent minutes and keeps what it wrote; it watches the child's stream and not the clock, because a silent child is a wedge and never patience. Anything it writes before the report's title is deleted by the program, because telling a model a rule is a request and deleting the violation is a mechanism. One test runs the real Claude program, because no in-house test can see how the real program treats its options.
- The board checks and the business reminders. Five nightly checks on the projects board: nothing appears that is not cleared for it, every client request is acknowledged within 48 hours, every active project has an update in the last 7 days, every pause carries its reason, and the log never shrinks. A daily read-only job names what is overdue.
- The decoy sweep. Notion plants sample tables in a new workspace, and the administrator once typed an urgent task into the wrong "Tasks". Each week the AI counts what sits in those tables and keeps an ordered plan for clearing them, her content moved out first. Clearing them is a day-one step for every later client.
- The activity instruments. One instrument answers what the client changed, pairing fields by their permanent ids so a rename does not read as a thousand edits. The edit census answers how much and when, counted in minutes that carry an edit and not in objects, because one duplicate action stamped 1,069 objects in two minutes.
- What "signed off" means. Seven conditions that must all hold, among them: the client's data survives the loss of his machine, shown by a drill that ran; a red alarm means something new; a successor can run the service from the documents alone. It never means the board's content is correct, which belongs to the administrator.
- Immutable installs. The jobs run from a release cut from a recorded commit, with a hash manifest, so an edit in the working folder can never change what the scheduler runs, and an independent reviewer's approval of that release is a receipt that shows tampering.
How it reaches people who are not technical
- Start Here. A guide inside the workspace, written for the administrator and generated with 14 automatic checks on its content, including three that stop specific false promises from coming back.
- The footer on every generated page. It says the page is generated, when, and where to make a correction.
- Designed for the owner's phone. Nine principles for every screen the company's owner reads, each tested by asking what he sees and taps when he opens it cold: "Tap a picture, not a row", "A default view must never land empty", "Never hide an honesty marker". The plumbing is parked in a "System room".
- The projects board and its registry. The board is a true and correctly bounded mirror of his work for the client. An AI session in any of his project folders can update it through one skill and one write path. A registry classifies every folder, clearing a folder for this board is a human act, and an unlisted folder is refused, so work for another client can never appear. Rows the client creates are acknowledged and added to, never overwritten. Entries are in plain English for an owner reading on a phone, who is notified only when a project starts, pauses, resumes or ships.
- SCOPE LOCK: read-to-fill, never read-to-redefine. An AI sweeping his folders to fill the board has its deliverable fixed before it opens a file. Nothing it finds may change the task.
- The decision register. Each decision that belongs to a person is listed with whose it is, a recommendation, and a default that applies on a stated date if nobody answers.
- He judges the work by evidence, not by reviewing every line. A fresh reviewer runs the evidence and returns a pass before any phase closes, so no code review or command is handed to him. Steps Notion offers only on screen are done by the AI in a browser.
- The weekly summary. The audit's findings arrive as a short summary through channels he already reads.
Named concepts
The named concepts, defined
Machine-owned and human-owned · "📎 Preserved edits" · Named playbooks · Validate, plan, execute, verify · The mutation ledger · NOTION_READONLY · Client isolation is absolute · The enforcement map · The client state file · The intent spec · Accepted drift · The learnings ratchet · SPINE, CLIENT, OPERATOR · Client zero · Verify gate before "done" · Independent approval · The plan gate · Rank-4 hearsay · Quarantine in force · The Feynman standard · Five-whys to an invariant · gate-proof · "Present" is never an answer to "in effect" · Ask the artifact, don't reconstruct it · The dead-man's switch · The anomaly budget · The restore drill · Exactly one declared state · The lethal trifecta · The decoy sweep · The edit census · Start Here · SCOPE LOCK: read-to-fill, never read-to-redefine · The decision register · The projects board (System 2)
What it shows
He can put AI to work inside a company's daily operations beside the person who runs them, make it safe by construction, and know without watching that it is still working.