build-os 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +85 -2
  3. package/SECURITY.md +636 -0
  4. package/THIRD_PARTY_NOTICES.md +909 -0
  5. package/dist/buildos-design.js +5 -0
  6. package/dist/buildos-discovery.js +5 -0
  7. package/dist/buildos-intake.js +5 -0
  8. package/dist/buildos.js +64406 -0
  9. package/dist/system/.os/AGENTS.md +36 -0
  10. package/dist/system/.os/CLAUDE.md +4 -0
  11. package/dist/system/.os/config/AGENTS.md +17 -0
  12. package/dist/system/.os/config/CLAUDE.md +3 -0
  13. package/dist/system/.os/config/instance.yaml +37 -0
  14. package/dist/system/.os/contracts/AGENTS.md +22 -0
  15. package/dist/system/.os/contracts/CLAUDE.md +3 -0
  16. package/dist/system/.os/contracts/config-contract.md +97 -0
  17. package/dist/system/.os/contracts/converted-source-contract.md +52 -0
  18. package/dist/system/.os/contracts/entity-consolidation-contract.md +176 -0
  19. package/dist/system/.os/contracts/entity-records-contract.md +278 -0
  20. package/dist/system/.os/contracts/examples/entity-resolution/README.md +22 -0
  21. package/dist/system/.os/contracts/examples/entity-resolution/expected-diagnostics.json +71 -0
  22. package/dist/system/.os/contracts/examples/entity-resolution/invalid-graph-cases.json +384 -0
  23. package/dist/system/.os/contracts/examples/entity-resolution/invalid-index-cases.json +42 -0
  24. package/dist/system/.os/contracts/examples/entity-resolution/valid-all-types.jsonl +16 -0
  25. package/dist/system/.os/contracts/examples/entity-resolution/valid-consolidation-manifest.json +27 -0
  26. package/dist/system/.os/contracts/examples/entity-resolution/valid-index.json +13 -0
  27. package/dist/system/.os/contracts/examples/entity-resolution/valid-multi-hop.jsonl +3 -0
  28. package/dist/system/.os/contracts/examples/entity-resolution/valid-resolver-results.json +29 -0
  29. package/dist/system/.os/contracts/examples/extraction-outcomes/minted.json +12 -0
  30. package/dist/system/.os/contracts/examples/extraction-outcomes/referenced.json +12 -0
  31. package/dist/system/.os/contracts/examples/extraction-outcomes/updated.json +12 -0
  32. package/dist/system/.os/contracts/examples/persona-identity/ambiguous-alias.json +33 -0
  33. package/dist/system/.os/contracts/examples/persona-identity/exact-identity-key.json +29 -0
  34. package/dist/system/.os/contracts/examples/persona-identity/normalization-collision.json +38 -0
  35. package/dist/system/.os/contracts/examples/persona-identity/unique-alias.json +23 -0
  36. package/dist/system/.os/contracts/extraction-contract.md +77 -0
  37. package/dist/system/.os/contracts/finding-contract.md +100 -0
  38. package/dist/system/.os/contracts/intake-translation-contract.md +85 -0
  39. package/dist/system/.os/contracts/persona-identity-contract.md +88 -0
  40. package/dist/system/.os/contracts/playbook-contract.md +76 -0
  41. package/dist/system/.os/contracts/root-and-path-contract.md +48 -0
  42. package/dist/system/.os/contracts/run-record-contract.md +101 -0
  43. package/dist/system/.os/data/AGENTS.md +16 -0
  44. package/dist/system/.os/data/CLAUDE.md +1 -0
  45. package/dist/system/.os/data/capabilities.jsonl +1 -0
  46. package/dist/system/.os/data/extractions.jsonl +0 -0
  47. package/dist/system/.os/data/findings.jsonl +0 -0
  48. package/dist/system/.os/data/personas.jsonl +0 -0
  49. package/dist/system/.os/data/requirements.jsonl +1 -0
  50. package/dist/system/.os/data/results.jsonl +0 -0
  51. package/dist/system/.os/data/runs.jsonl +0 -0
  52. package/dist/system/.os/data/test-cases.jsonl +1 -0
  53. package/dist/system/.os/indexes/AGENTS.md +11 -0
  54. package/dist/system/.os/indexes/CLAUDE.md +1 -0
  55. package/dist/system/.os/indexes/playbooks.json +260 -0
  56. package/dist/system/.os/scripts/AGENTS.md +60 -0
  57. package/dist/system/.os/scripts/CLAUDE.md +3 -0
  58. package/dist/system/.os/scripts/buildos +109 -0
  59. package/dist/system/.os/scripts/buildos-design +13 -0
  60. package/dist/system/.os/scripts/buildos-design.cmd +9 -0
  61. package/dist/system/.os/scripts/buildos-discovery +13 -0
  62. package/dist/system/.os/scripts/buildos-discovery.cmd +9 -0
  63. package/dist/system/.os/scripts/buildos-intake +13 -0
  64. package/dist/system/.os/scripts/buildos-intake.cmd +9 -0
  65. package/dist/system/.os/scripts/buildos.cmd +30 -0
  66. package/dist/system/.os/scripts/node-required.txt +1 -0
  67. package/dist/system/.os/scripts/pinned-version.cjs +768 -0
  68. package/dist/system/.os/skills/AGENTS.md +65 -0
  69. package/dist/system/.os/skills/CLAUDE.md +3 -0
  70. package/dist/system/.os/skills/buildos-browser-to-playwright/SKILL.md +116 -0
  71. package/dist/system/.os/skills/buildos-browser-to-playwright/agents/openai.yaml +2 -0
  72. package/dist/system/.os/skills/buildos-bulk-extract/SKILL.md +73 -0
  73. package/dist/system/.os/skills/buildos-bulk-extract/scripts/work.py +1603 -0
  74. package/dist/system/.os/skills/buildos-bulk-extract/tests/test_work.py +659 -0
  75. package/dist/system/.os/skills/buildos-design-planning/SKILL.md +44 -0
  76. package/dist/system/.os/skills/buildos-design-planning/agents/openai.yaml +2 -0
  77. package/dist/system/.os/skills/buildos-discovery/SKILL.md +50 -0
  78. package/dist/system/.os/skills/buildos-discovery/agents/openai.yaml +2 -0
  79. package/dist/system/.os/skills/buildos-discovery-qualification/SKILL.md +40 -0
  80. package/dist/system/.os/skills/buildos-discovery-qualification/agents/openai.yaml +2 -0
  81. package/dist/system/.os/skills/buildos-docs-handoff/SKILL.md +48 -0
  82. package/dist/system/.os/skills/buildos-docs-handoff/agents/openai.yaml +2 -0
  83. package/dist/system/.os/skills/buildos-export-azure-boards/SKILL.md +183 -0
  84. package/dist/system/.os/skills/buildos-export-azure-boards/adapters/00-adapter-registry.md +112 -0
  85. package/dist/system/.os/skills/buildos-export-azure-boards/adapters/dynamics-365-ce/ADAPTER.md +180 -0
  86. package/dist/system/.os/skills/buildos-export-azure-boards/adapters/dynamics-365-ce/authoring-depth.md +327 -0
  87. package/dist/system/.os/skills/buildos-export-azure-boards/adapters/dynamics-365-ce/component-templates.md +365 -0
  88. package/dist/system/.os/skills/buildos-export-azure-boards/adapters/dynamics-365-ce/examples.md +280 -0
  89. package/dist/system/.os/skills/buildos-export-azure-boards/agents/openai.yaml +4 -0
  90. package/dist/system/.os/skills/buildos-export-azure-boards/assets/adapters/dynamics-365-ce-golden-example.csv +8 -0
  91. package/dist/system/.os/skills/buildos-export-azure-boards/assets/adapters/dynamics-365-ce-manifest.json +348 -0
  92. package/dist/system/.os/skills/buildos-export-azure-boards/assets/new-items-template.csv +1 -0
  93. package/dist/system/.os/skills/buildos-export-azure-boards/assets/synthetic-golden-example.csv +7 -0
  94. package/dist/system/.os/skills/buildos-export-azure-boards/assets/synthetic-manifest.json +210 -0
  95. package/dist/system/.os/skills/buildos-export-azure-boards/assets/target-17-column-template.csv +1 -0
  96. package/dist/system/.os/skills/buildos-export-azure-boards/references/azure-boards-csv-contract.md +234 -0
  97. package/dist/system/.os/skills/buildos-export-azure-boards/references/backlog-mapping.md +110 -0
  98. package/dist/system/.os/skills/buildos-export-azure-boards/references/source-selection.md +71 -0
  99. package/dist/system/.os/skills/buildos-export-azure-boards/references/writing-style.md +134 -0
  100. package/dist/system/.os/skills/buildos-export-azure-boards/scripts/adapters/dynamics-365-ce.mjs +239 -0
  101. package/dist/system/.os/skills/buildos-export-azure-boards/scripts/azure_boards_csv.mjs +645 -0
  102. package/dist/system/.os/skills/buildos-extract/SKILL.md +51 -0
  103. package/dist/system/.os/skills/buildos-extract/agents/openai.yaml +2 -0
  104. package/dist/system/.os/skills/buildos-extraction-plan/SKILL.md +56 -0
  105. package/dist/system/.os/skills/buildos-extraction-plan/agents/openai.yaml +2 -0
  106. package/dist/system/.os/skills/buildos-intake/SKILL.md +49 -0
  107. package/dist/system/.os/skills/buildos-intake/agents/openai.yaml +2 -0
  108. package/dist/system/.os/skills/buildos-intake-convert/SKILL.md +56 -0
  109. package/dist/system/.os/skills/buildos-intake-convert/agents/openai.yaml +2 -0
  110. package/dist/system/.os/skills/buildos-playbook-drafting/SKILL.md +48 -0
  111. package/dist/system/.os/skills/buildos-playbook-drafting/agents/openai.yaml +2 -0
  112. package/dist/system/.os/skills/buildos-preflight/SKILL.md +34 -0
  113. package/dist/system/.os/skills/buildos-preflight/agents/openai.yaml +2 -0
  114. package/dist/system/.os/skills/buildos-reference-review/SKILL.md +41 -0
  115. package/dist/system/.os/skills/buildos-reference-review/agents/openai.yaml +2 -0
  116. package/dist/system/.os/skills/buildos-reporting/SKILL.md +34 -0
  117. package/dist/system/.os/skills/buildos-reporting/agents/openai.yaml +2 -0
  118. package/dist/system/.os/skills/buildos-row-drafting/SKILL.md +49 -0
  119. package/dist/system/.os/skills/buildos-row-drafting/agents/openai.yaml +2 -0
  120. package/dist/system/.os/skills/buildos-row-maintenance/SKILL.md +43 -0
  121. package/dist/system/.os/skills/buildos-row-maintenance/agents/openai.yaml +2 -0
  122. package/dist/system/.os/skills/buildos-validation-reporting/SKILL.md +29 -0
  123. package/dist/system/.os/skills/buildos-validation-reporting/agents/openai.yaml +2 -0
  124. package/dist/system/.os/skills/buildos-workflow/SKILL.md +68 -0
  125. package/dist/system/.os/skills/buildos-workflow/agents/openai.yaml +2 -0
  126. package/dist/system/.os/skills/capability-matrix/SKILL.md +891 -0
  127. package/dist/system/.os/skills/fit-gap-analysis/SKILL.md +191 -0
  128. package/dist/system/.os/skills/fit-gap-analysis/config/owner-colors.json +11 -0
  129. package/dist/system/.os/skills/fit-gap-analysis/references/formats.md +178 -0
  130. package/dist/system/.os/skills/fit-gap-analysis/references/scoring-brief.md +86 -0
  131. package/dist/system/.os/skills/fit-gap-analysis/scripts/fitgap.py +1309 -0
  132. package/dist/system/.os/templates/AGENTS.md +14 -0
  133. package/dist/system/.os/templates/CLAUDE.md +3 -0
  134. package/dist/system/.os/templates/guardrail-playbook.md +36 -0
  135. package/dist/system/.os/templates/instance-config.yaml +37 -0
  136. package/dist/system/.os/templates/procedure-playbook-explicit-steps-standing.md +52 -0
  137. package/dist/system/.os/templates/procedure-playbook-explicit-steps-stateful.md +58 -0
  138. package/dist/system/.os/templates/procedure-playbook-guided-objective-standing.md +61 -0
  139. package/dist/system/.os/templates/procedure-playbook-guided-objective-stateful.md +66 -0
  140. package/dist/system/.os/templates/procedure-playbook-inferred-actions-standing.md +61 -0
  141. package/dist/system/.os/templates/procedure-playbook-inferred-actions-stateful.md +68 -0
  142. package/dist/system/AGENTS.md +17 -0
  143. package/dist/system/CLAUDE.md +8 -0
  144. package/dist/system/_dot.gitignore +4 -0
  145. package/dist/system/assets/AGENTS.md +27 -0
  146. package/dist/system/assets/CLAUDE.md +3 -0
  147. package/dist/system/playbooks/AGENTS.md +38 -0
  148. package/dist/system/playbooks/CLAUDE.md +3 -0
  149. package/dist/system/playbooks/administrative/AGENTS.md +22 -0
  150. package/dist/system/playbooks/administrative/CLAUDE.md +3 -0
  151. package/dist/system/playbooks/administrative/manual-intake-conversion.md +74 -0
  152. package/dist/system/playbooks/administrative/respect-configured-scoped-metadata.md +46 -0
  153. package/dist/system/playbooks/administrative/respect-make-docs-plugin-boundary.md +52 -0
  154. package/dist/system/playbooks/build/AGENTS.md +21 -0
  155. package/dist/system/playbooks/build/CLAUDE.md +3 -0
  156. package/dist/system/playbooks/build/package-build-artifact.md +64 -0
  157. package/dist/system/playbooks/discovery/AGENTS.md +21 -0
  158. package/dist/system/playbooks/discovery/CLAUDE.md +3 -0
  159. package/dist/system/playbooks/discovery/inspect-ui-discoverability.md +72 -0
  160. package/dist/system/playbooks/testing/AGENTS.md +21 -0
  161. package/dist/system/playbooks/testing/CLAUDE.md +3 -0
  162. package/dist/system/playbooks/testing/run-core-validation.md +65 -0
  163. package/dist/system/workspace/AGENTS.md +18 -0
  164. package/dist/system/workspace/CLAUDE.md +3 -0
  165. package/dist/system/workspace/datasets/.gitkeep +1 -0
  166. package/dist/system/workspace/datasets/AGENTS.md +10 -0
  167. package/dist/system/workspace/datasets/CLAUDE.md +3 -0
  168. package/dist/system/workspace/findings/AGENTS.md +19 -0
  169. package/dist/system/workspace/findings/CLAUDE.md +3 -0
  170. package/dist/system/workspace/runs/AGENTS.md +17 -0
  171. package/dist/system/workspace/runs/CLAUDE.md +3 -0
  172. package/dist/system.json +983 -0
  173. package/package.json +47 -4
package/SECURITY.md ADDED
@@ -0,0 +1,636 @@
1
+ # BuildOS Security
2
+
3
+ This document is for enterprise engineering reviewers and for BuildOS maintainers. It covers the npm package `build-os` from version `0.1.0`. It names every outside package whose code ships in the package, with its version, license, reason, and scan status, and every package used only to build and test BuildOS. It explains how the package is built and bundled, how to check a release (provenance, tarball digest, and SBOM), the checks that run before each release, how to roll back, the input limits and file safety rules of the CLI, the known limits, and how to report a vulnerability. A reviewer can make a decision from this document, the SBOM, and the npm provenance, without reading the code.
4
+
5
+ The rules behind this document are in PRD 20 BuildOS CLI and Distribution (`docs/prd/20-buildos-cli-and-distribution.md` in the BuildOS repository), sections Supply Chain and Release.
6
+
7
+ ## Summary
8
+
9
+ - Requirement: Node.js 24 or newer. The package declares `"engines": { "node": ">=24.0.0" }`.
10
+ - No runtime `dependencies`. `npm install` and `npx` fetch only `build-os`. A user's machine never resolves a third-party package version.
11
+ - All program code is one esbuild bundle, `dist/buildos.js`. It holds BuildOS code, four outside npm packages for document conversion (`fflate` 0.8.3, `parse5` 8.1.1 with `entities` 9.0.0, and `unpdf` 2.1.0 with the pdf.js 6.4.299 build inside it, which inlines six more components), and ports of Go 1.24.1 standard library code and two Go modules (BSD-3-Clause). See [Bundled Runtime Code](#bundled-runtime-code).
12
+ - 50 more lockfile packages are build-time only: TypeScript, esbuild, the Node type definitions, and their 47 transitive packages. None of them ships. See [Build-Time Tools](#build-time-tools).
13
+ - Every lockfile package uses the MIT, Apache-2.0, or BSD-2-Clause license. The Go code is BSD-3-Clause, and pdf.js is Apache-2.0.
14
+ - The published package declares no lifecycle script (the release check refuses a tarball whose `package.json` has one) and has no dependencies, so installing it runs nothing. In this repository's build, CI, and release, every install uses `--ignore-scripts`, and `toolkits/buildos/.npmrc` sets `ignore-scripts=true`; that file does not reach a user's machine. One build-time package, `esbuild` 0.28.2, declares a script that never runs here, under a closed owner-approved exception. See [Install-Script Exception](#install-script-exception).
15
+ - Scans: `npm audit` and the OSV scan found no known vulnerability in any of the 54 lockfile packages on 2026-11-24. See [Scan Record](#scan-record).
16
+ - Each release is built on one reference build environment from a reviewed commit, and the reviewed tarball SHA-256 is committed before the release. The checked tarball and a CycloneDX SBOM are attached to a draft GitHub Release, which the maintainer reviews and publishes (immutable). The release workflow then stages that release asset on npm with provenance, through npm trusted publishing (no stored token), after a person approves the staging job in GitHub. The maintainer approves publication with npm two-factor authentication. See [How to Check a Release](#how-to-check-a-release) and [Release Checks](#release-checks).
17
+ - The CLI makes no network call. It starts one outside program, and only when the user chooses it: the public Make Docs CLI for the optional Make Docs setup. See [Started Programs](#started-programs).
18
+ - The package also carries the BuildOS project files that `buildos init` copies into a project: Markdown, YAML, and JSON files, project wrapper scripts, and agent skills. BuildOS runs none of them itself. See [Package Contents](#package-contents).
19
+ - Every file a command reads is untrusted and read with a size bound. Every write stays inside the project folder unless the user passes `--allow-outside-root`. See [Input Limits](#input-limits), [Read Safety](#read-safety), [Write Safety](#write-safety), and [Known Limits and Out of Scope](#known-limits-and-out-of-scope).
20
+
21
+ ## How to Check a Release
22
+
23
+ These steps use the version `0.1.0` as the example. Use the version you install. They need Node.js 24 or newer and network access to the npm registry. The commands were checked with npm 11.19.1, the npm that comes with Node.js 24.22.3. `npm audit signatures` checks provenance attestations only with a current npm, so update npm first when your npm is older.
24
+
25
+ ### 1. Check the registry signature and the provenance
26
+
27
+ npm checks signatures and provenance for installed packages, so install the package into an empty folder first:
28
+
29
+ ```sh
30
+ mkdir buildos-check
31
+ cd buildos-check
32
+ npm init -y
33
+ npm install --ignore-scripts build-os@0.1.0
34
+ npm audit signatures
35
+ ```
36
+
37
+ The output must say that the package has a verified registry signature and a verified attestation. A missing attestation means the version has no provenance: do not use it.
38
+
39
+ Then read the provenance statement:
40
+
41
+ ```sh
42
+ npm view build-os@0.1.0 dist.attestations.provenance.predicateType
43
+ ```
44
+
45
+ It prints `https://slsa.dev/provenance/v1`. The npm package page shows the same provenance: the source repository `github.com/brucewaynedecoy/build-os`, the workflow `.github/workflows/buildos-release.yml`, and the commit of the release tag `v0.1.0`. npm makes provenance only for a public repository; the release workflow stops before staging when the repository is not public.
46
+
47
+ ### 2. Check the tarball digest
48
+
49
+ Download the published tarball and compute its SHA-256:
50
+
51
+ ```sh
52
+ npm pack build-os@0.1.0
53
+ shasum -a 256 build-os-0.1.0.tgz
54
+ ```
55
+
56
+ On Linux, `sha256sum build-os-0.1.0.tgz` gives the same value. On Windows, run `certutil -hashfile build-os-0.1.0.tgz SHA256` in Command Prompt.
57
+
58
+ The value must equal `tarball_sha256` in the entry for the tag `v0.1.0` in `toolkits/buildos/release-candidates.json` in the BuildOS repository, and the `SHA-256` hash of `metadata.component` in the SBOM. The entry also names the reviewed source commit and the exact build environment (runner image, Node.js, and npm versions). The release workflow stages that exact file (the tarball attached to the release), so the registry copy has the same bytes.
59
+
60
+ ### 3. Read the SBOM
61
+
62
+ Each GitHub Release has the CycloneDX 1.5 SBOM as the file `buildos-<version>.cdx.json`, next to the tarball `build-os-<version>.tgz`, for example `buildos-0.1.0.cdx.json` on the release page for the tag `v0.1.0` (`https://github.com/brucewaynedecoy/build-os/releases/tag/v0.1.0`). How to read it:
63
+
64
+ - `metadata.component` is the package itself: `hashes` holds the tarball SHA-256, and the property `buildos:source_revision` holds the source commit.
65
+ - A component with scope `required` is code in the package. Its property `buildos:delivery` says how it ships: bundled into `dist/buildos.js`, or Go code ported to TypeScript and bundled (no Go code ships).
66
+ - A component with scope `excluded` is a lockfile package used only to build or test BuildOS. It is not in the package (CycloneDX: not part of the runtime).
67
+ - `unpdf` lists the pdf.js build inside it, and pdf.js lists the six components it inlines.
68
+ - npm packages carry npm's license data, SHA-512 hashes, and registry URLs.
69
+
70
+ To list the code in the package:
71
+
72
+ ```sh
73
+ node -e 'const s=require("./buildos-0.1.0.cdx.json");for(const c of s.components)if(c.scope==="required")console.log(c.name,c.version)'
74
+ ```
75
+
76
+ ```text
77
+ entities 9.0.0
78
+ fflate 0.8.3
79
+ parse5 8.1.1
80
+ unpdf 2.1.0
81
+ Go standard library 1.24.1
82
+ golang.org/x/net v0.48.0
83
+ github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728
84
+ ```
85
+
86
+ These are the rows of [Bundled npm Packages](#bundled-npm-packages) and [Other Bundled Code](#other-bundled-code). The release check compares values: it fails when an SBOM hash is not the lockfile's, or when a package's version or license differs between the SBOM, the lockfile, this document's tables, and `THIRD_PARTY_NOTICES.md` (see the SBOM row of [Release Gates](#release-gates)).
87
+
88
+ ## Rollback by Version Pin
89
+
90
+ `buildos init` writes the BuildOS version into the project file `.os/manifest.json` (`buildos_version`). The project wrapper `.os/scripts/buildos` (`.os\scripts\buildos.cmd` on Windows) always runs the pinned version (pin first, owner decision of 2026-11-25). It reads the pin first. It uses an installed `buildos` only when it is an npm install of the pinned version: in the `node_modules` folder of the project folder or of a folder above it (for example the root folder of an npm workspace), or the first `buildos` on `PATH` (for example after `npm install -g`). It never starts a program to learn its version; it reads only the package's `package.json` to choose a candidate. In every other case it runs `npx -y --prefix <current folder> --workspaces=false build-os@<pinned version>`, so npm runs BuildOS in the current folder, also inside an npm workspace. On every start it sets `BUILDOS_REQUIRE_VERSION` to the pinned version, and the BuildOS program that starts stops itself when its own version (the one `buildos version` reports) is another one (exit 3, see [Project wrappers](#package-contents)). So roll back by setting `buildos_version` to an earlier exact version, for example `"0.1.0"`, and running the wrapper again. That is the only rollback step: you do not need to change or remove a global install. The wrapper accepts only an exact version, never a range or a tag such as `latest`.
91
+
92
+ A global install is used only when it is an npm install of exactly the pinned version; otherwise the wrapper fetches the pinned version. To use a global install again without `npx`, install the pinned version: `npm install -g build-os@0.1.0`.
93
+
94
+ A direct `npx` call names its version, for example `npx -y build-os@0.1.0 <command>`. npm then runs a copy that it takes as that version. npm can take a local install of `0.1.0+local` as `0.1.0`, because npm ignores build metadata when it compares versions. A direct call has no self-check. To get the same check as the wrapper, set the variable yourself: `BUILDOS_REQUIRE_VERSION=0.1.0 npx -y build-os@0.1.0 <command>`.
95
+
96
+ Rollback needs the earlier version to still be on the npm registry. A version that a release must not use is marked by the maintainer with `npm deprecate`; npm then prints the deprecation message on install, and an exactly pinned deprecated version still installs. npm does not promise that every version stays. Under the npm Unpublish Policy, an owner can unpublish a new package within 72 hours of publishing it, as long as no other package in the npm public registry depends on it; at any time, an owner can unpublish a package that no other package in the public registry depends on, that had fewer than 300 downloads in the last week, and that has a single owner or maintainer. An unpublished version no longer installs, the unpublish cannot be undone, and its version number can never be used again. The BuildOS maintainer deprecates and does not unpublish. Keep a copy of a tarball you must be able to reinstall (see the offline install in the user guide). `buildos update` and `buildos uninstall` are not part of this release.
97
+
98
+ ## Release Checks
99
+
100
+ Every check is a script that also runs on a maintainer machine (`node scripts/release-gate.ts <gate>`; `node scripts/release-dry-run.ts` runs them in workflow order). The workflow `.github/workflows/buildos-release.yml` runs in three modes:
101
+
102
+ - **dry run**: a manual run with purpose `dry-run`, or a push to a `release-dry-run/` branch. It runs the `resolve` and `verify` jobs and stops there: it never stages or publishes. `verify` runs the candidate gates of [Release Gates](#release-gates) with an invented deny list, and reports the provenance preconditions (a public repository, the repository URL) as warnings instead of failures. A dry run does not exercise the real-list scan, the ruleset and environment checks, `attach`, the required reviewer's approval, the release-asset checks, or staging: a prepare run first exercises the real-list scan, the ruleset and environment checks of the `deny-list` job, and `attach`; a release run first exercises the required reviewer's approval, the release-asset checks, and staging. It can plant one failure (`tag`, `version`, `digest`, `eval`, `audit`, `osv`, or `deny-list`) to show that the check stops the flow.
103
+ - **prepare**: a manual run from the default branch with purpose `prepare` and the tag of a draft GitHub Release. It runs `resolve`, `verify`, and the real deny list, then `attach` puts the checked tarball and the SBOM on the draft.
104
+ - **release**: the maintainer publishes that draft. The `release: published` event runs `resolve`, `verify` (a fresh rebuild), and the real deny list, then `stage` stages the tarball from the release assets on npm.
105
+
106
+ A prepare or release run refuses a planted failure.
107
+
108
+ ### Release Procedure
109
+
110
+ GitHub's procedure for an immutable release is: create the release as a draft, attach every asset to the draft, then publish it. After that, the release's tag and assets cannot change. The BuildOS procedure follows it:
111
+
112
+ 1. The maintainer sets the version, makes a dry run on the reference runner, inspects its tarball, and commits the `reviewed` entry to `toolkits/buildos/release-candidates.json` (header of `scripts/release-candidate.ts`).
113
+ 2. The maintainer creates the tag `v<version>` on that commit (on the default branch) and a draft GitHub Release for it, for example `gh release create v0.1.0 --draft --verify-tag --title "BuildOS 0.1.0" --notes-file toolkits/buildos/RELEASE_NOTES.md`.
114
+ 3. The maintainer runs the workflow from the default branch: Actions > buildos-release > Run workflow, purpose `prepare`, tag `v0.1.0`, candidates `committed`, plant `none` (or `gh workflow run buildos-release.yml --ref main -f purpose=prepare -f tag=v0.1.0 -f candidates=committed -f plant=none`). Every gate runs, then the real deny list, then `attach`.
115
+ 4. The maintainer reviews the draft: downloads `build-os-<version>.tgz` and `buildos-<version>.cdx.json` from it, checks that the tarball SHA-256 equals the reviewed entry, and reads the job summary. Then the maintainer publishes the draft. With release immutability on, its tag and assets are now fixed.
116
+ 5. The release run starts. Its `verify` job rebuilds the tagged commit on the reference runner and must get the reviewed digest again. When it reaches `stage`, GitHub waits: a required reviewer of the environment `buildos-npm-stage` approves the job (Actions > the run > Review deployments > Approve and deploy). Only then does the job start and get its OIDC token.
117
+ 6. The `stage` job checks the rulesets, downloads the tarball and the SBOM from the published release, checks both, and stages the tarball on npm. The maintainer approves the stage on npm with two-factor authentication, only after the recorded publication approval.
118
+
119
+ What this guarantees: the staged file is the release asset; its SHA-256 equals the reviewed entry in the ledger at the tagged commit, which trusted code reads from git; and a fresh build of the tagged commit in the release run gave the same SHA-256 (the reproducible build), so the asset is the code at the tag. The SBOM on the release records that SHA-256 and the reviewed source commit, which trusted code checked before it attached the file and checks again before staging: the published release must hold exactly the tarball and the SBOM, the SBOM must be valid CycloneDX 1.5 and must have the same bytes as the SBOM that the release run's own `verify` job generated from the tagged commit. The SBOM generation is deterministic on the reference build environment (the serial number comes from the tarball digest and the source commit, the time stamp from the commit time, and the npm version is fixed), so a replaced SBOM fails.
120
+
121
+ ### Release Trust Boundary
122
+
123
+ Trust rule: write access to this repository is a release-trusted role. Anyone with write access can push a branch, change the workflow files on that branch, run workflows on it, and create tags and draft releases within the rulesets below. Grant write access only to a person you would trust to release. Untrusted contributions come through pull requests from forks: a workflow run from a fork gets no secret and a read-only token.
124
+
125
+ The candidate is the commit the release points at. A person who can push can write its code, its build scripts, its `package.json`, and its `.npmrc`, so the workflow gives no secret and no write or publish permission to a job that runs any of it. Every privileged job runs only release-control code from the trusted ref: the default-branch commit that `resolve` found (`trusted_sha`). It reads the candidate only as data: the ledger by commit and path with `git` (it must be a regular file, git mode `100644`, never a link), the candidate tree as files, and the tarball as bytes through a strict tar reader.
126
+
127
+ | Job | Permissions and secrets | Code it runs |
128
+ | --- | --- | --- |
129
+ | `resolve` | `contents: read`; no secret | Only the workflow's own shell script and `git`. It validates every event value (the tag must be `v` and an exact semver version, at most 128 characters, before any use), resolves one release commit (release: the event commit, which must equal `refs/tags/<tag>^{commit}`; prepare: the tag's commit, from a run on the default branch), checks that the commit is on the default branch, and records the default-branch head as the trusted commit. A release from a repository that is not public stops here, because npm makes provenance only for a public repository. Every later job checks out an exact SHA, never a name. |
130
+ | `verify` | `contents: read`; no secret | The candidate's build, tests, and gates (table below). The deny-list gate here uses an invented list. The tarball, build record, and SBOM are uploaded only when every gate passed, as `buildos-release-<run id>-<run attempt>`, for 1 day (prepare and release) or 3 days (a dry run). |
131
+ | `deny-list` (prepare, release) | `contents: read`, `actions: read`; the real list, as the environment secret `BUILDOS_DENY_LIST_ENV` of the environment `buildos-deny-list` | `scripts/release-github.ts` checks that the environment deploys only from the default branch and `v*` tags, and then, before the step that holds the secret, that the branch and tag rulesets are active (`release-github.ts rulesets`, below). `scripts/release-stage-check.ts digest` checks the tarball against the ledger at the release commit. `scripts/check-deny-list.mjs` scans the candidate tree and every file of the tarball. All from the trusted commit, Node built-in modules only, no `npm`, no build. |
132
+ | `attach` (prepare) | `contents: write` | `scripts/release-github.ts attach` from the trusted commit: finds the one draft release of the tag (no asset yet), checks the tarball against the ledger, checks that the SBOM records the tarball SHA-256 and the reviewed source commit, uploads both to that release ID, and checks that the release lists exactly those two files with their SHA-256 digests. |
133
+ | `stage` (release) | `contents: read`, `actions: read`, `id-token: write`; environment `buildos-npm-stage` | From the trusted commit: first `release-stage-check.ts precheck` (a public repository and the OIDC token request); then `release-github.ts environment` (the environment has a required reviewer, deploys only from `v*` tags, and the run's review history approves it); then `release-github.ts rulesets`; then `release-github.ts download-asset` (the release is published and immutable, has the tag, and holds exactly two assets, the tarball and the SBOM of the version, each uploaded and with GitHub's SHA-256 digest; it downloads both, from the API's direct response or from the storage host it redirects to, without sending the token there; each file's bytes must match GitHub's digest; the tarball must match the ledger at the release commit and the `verify` digest; the SBOM must record that tarball SHA-256 and the reviewed source commit, be valid against the CycloneDX 1.5 schema, and have the same SHA-256 as this run's `verify` SBOM); then `release-stage-check.ts publish`, which checks the tarball against the ledger and the `verify` digest, refuses a `package.json` with `publishConfig`, a top-level `tag`, `private`, a lifecycle script, or a dependency field, and runs `npm stage publish` (below). |
134
+ | `discard` (prepare, release, after a deny-list failure) | `actions: write` | `scripts/release-github.ts discard` from the trusted commit: deletes the artifact only when it belongs to this run and has this run attempt's name. |
135
+
136
+ The review boundary. The workflow file of a release run comes from the tagged commit, and the workflow file of a prepare run from the default branch, so the file itself is only as trusted as the default branch and the release tags. These owner settings make that enforceable: a branch ruleset on the default branch with required reviews and code-owner review for `.github/workflows/**`, the release scripts, and the ledger (`.github/CODEOWNERS`); a tag ruleset so that only the maintainer can create, move, or delete a `v*` tag; release immutability, so a published release's tag and assets cannot change; and a required reviewer on `buildos-npm-stage`, so a person approves each staging job in GitHub before it gets its OIDC token. The last line of defense is the maintainer's npm two-factor approval of the stage. The `stage` job checks the environment's protection through the GitHub API with `actions: read` and fails closed when it cannot read it or finds no required reviewer, no approval in this run, or other deployment refs. The `deny-list` and `stage` jobs (and the real-list job of `buildos-deny-list.yml`) also check the rulesets with the job token, which always has the Metadata read permission that GitHub's ruleset endpoints need: the effective active rules of the default branch (`GET /repos/{owner}/{repo}/rules/branches/{branch}`) must restrict deletion, block force pushes, require a pull request with at least one approval and code-owner review, and require the six CI checks of step 8 below; and an active tag ruleset that targets `refs/tags/v*` with no exclusion (`GET /repos/{owner}/{repo}/rulesets` and each ruleset by ID) must restrict creation, update, and deletion. A missing rule or an unreadable answer fails the job. What the job cannot check: who may bypass a ruleset (GitHub returns the bypass list only to a user with write access to the ruleset, which the job token is not), and whether the repository setting for release immutability is on (that endpoint needs the Administration permission, which a job token cannot have); the `stage` job checks instead that the release itself is immutable. Who holds write access and who may bypass rely on the owner settings below and on the npm two-factor approval.
137
+
138
+ Code-owner review protects the default branch only. On a writer's own branch, `.github/CODEOWNERS` constrains nothing: the writer can change any workflow there and run it. That run cannot reach the release secrets, because the environments give their secrets and the OIDC staging permission only to the default branch and `v*` tags, the tag ruleset lets only a bypass actor create or move a `v*` tag, and prepare runs only from the default branch.
139
+
140
+ ### Release Gates
141
+
142
+ `verify` job, on the GitHub runner `ubuntu-24.04` with Node.js 24.22.3 and npm 11.19.1:
143
+
144
+ | Step | It fails when |
145
+ | --- | --- |
146
+ | Reference build environment | Node.js is not `v24.22.3`, npm is not `11.19.1`, the runner image is not `ubuntu24`, or the checkout is not the resolved commit. The same commit gives the same tarball bytes in this environment. |
147
+ | Dependency guard, before and after `npm ci --ignore-scripts` | See [CI Checks](#ci-checks): a runtime dependency, an install script outside the closed exception, a version that is not exact, or `ignore-scripts` not set. |
148
+ | Release candidates file | `release-candidates.json` is not well formed: schema version 2; each entry has exactly the fields kind, version, tag (`v<version>`), tarball name, tarball SHA-256, source commit, Node.js and npm versions, runner image, reviewer, review date, and review evidence; a tag and a digest appear once; and every committed entry is of kind `reviewed`. |
149
+ | Tag, version, and reviewed entry | The tag is not `v<package.json version>`; the ledger at HEAD, read from git, is not a regular file with mode `100644`; no entry exists for the tag, or (prepare and release) it is not a `reviewed` entry; the entry version differs; the checkout is not the resolved commit; the reviewed source commit is not an ancestor of the release commit, or their files differ anywhere except the ledger's bytes; the prerelease flag disagrees with the version; or (prepare and release) not the reference environment. |
150
+ | Release build and pack | The build sets the package version and the reviewed source commit, so `buildos version` and every JSON envelope report them. A build refuses a working tree with changes. In a dry run with a self entry this is build B, a second clean build checked against the entry made from build A. |
151
+ | Tarball digest | The rebuilt tarball SHA-256 is not the reviewed one. |
152
+ | Build identity | The packed CLI does not report the package version and the reviewed source commit. |
153
+ | Typecheck and tests | Any failure of strict `tsc`, the unit tests, or the golden suites, or a run that executed no test. |
154
+ | Golden parity from the installed tarball | The release-stamped tarball, installed offline, does not match every golden case. The comparison expects the release version and source commit where a golden holds the development identity (`dev`, `unknown`), and every other byte as captured. |
155
+ | Conversion eval | A run with no executed test, an eval report that does not name every file of the eval manifest, or any file below the gate in PRD 07 Intake and Conversion. |
156
+ | `npm audit` | `npm audit --audit-level=high --include=dev --json` reports a high or critical advisory, exits with a status the counts do not explain, cannot run, or prints a report the check cannot read. |
157
+ | OSV scan | `osv-scanner` 2.7.1 (downloaded, SHA-256 pinned) reports a finding with a score of 7.0 or more or with no valid score, or the scan did not complete. See [OSV Gate](#osv-gate). |
158
+ | Deny-list scanner (invented list) | A personal home-folder path, or a shipped file the scanner cannot fully read, in the repository tree or the tarball. It carries the planted failure in a dry run. The real list runs in the `deny-list` job. |
159
+ | SBOM | The CycloneDX SBOM is not valid against the official CycloneDX 1.5 JSON schema (kept in `scripts/schemas/cyclonedx-1.5/` with its source URL, tag, commit, license Apache-2.0, and SHA-256 in `SOURCES.json`; `scripts/json-schema.ts` validates it, with no new dependency), or its values disagree with the sources: each package's SHA-512 with the lockfile `integrity`, and each package's version and license across the SBOM, the lockfile, this document's Bundled npm Packages table and Lockfile Inventory (and the package counts in the Summary), and `THIRD_PARTY_NOTICES.md`; or the bundle (the esbuild metafile) disagrees with which packages are marked as shipped. |
160
+ | Provenance preconditions | (prepare and release) The repository is not public, or `package.json` `repository.url` is not the GitHub repository. A dry run reports these as warnings. The `stage` job checks them again, first, with the OIDC token request. |
161
+
162
+ A failing gate stops the job: nothing is uploaded and no later job runs. A deny-list failure prints each location as a file label and line (never the term) in the log and in the job summary.
163
+
164
+ `stage` job, the npm call: `npm stage publish <tarball> --provenance --access public --tag <latest or next> --registry https://registry.npmjs.org/ --ignore-scripts`, from an empty folder, with every `npm_config_*` value and any npm token removed from the environment and the user and global npmrc set to empty files. The dist-tag comes from the reviewed entry's version (`next` for a prerelease), computed by the trusted script; npm 11.19.1 lets CLI flags win over a packed `publishConfig`, and the tarball check refuses a `publishConfig` anyway. The flag names were checked against npm 11.19.1 (`npm stage publish --help` and its `lib/commands/publish.js`). npm trusted publishing gives the job a short-lived token, so no npm token is stored. A staged package is not public. The maintainer reviews it on npmjs.com (signed in: account settings > the Staged Packages tab) or with `npm stage list build-os`, `npm stage view <stage-id>`, and `npm stage download <stage-id>`, and approves it with npm two-factor authentication (`npm stage approve <stage-id>`, or Approve on that tab) only after the recorded publication approval, or rejects it.
165
+
166
+ Other rules: GitHub Actions are pinned to full commit SHAs; checkout keeps no credentials; event values reach a script only through `env:`, never as `${{ }}` text inside a script; the GitHub token reaches only the steps that call the GitHub API, through `env:`, never the command line; and no workflow uses `pull_request_target`.
167
+
168
+ ### Owner Settings for Releases
169
+
170
+ These repository settings are part of the release security. No agent changes repository settings. The owner sets them in exactly this order, so that no secret exists while a ref that could receive it is unprotected: first the old repository secret goes, then the rulesets protect `main` and the `v*` tags, then the environments limit their refs, and only then does the environment secret go in, and after that npm trusted publishing. `test/release-workflow.test.ts` keeps this order. Paths are from GitHub's documentation (Managing environments for deployment; Creating rulesets for a repository; Available rules for rulesets; Preventing changes to your releases; Configuring private vulnerability reporting; REST API endpoints for rules), read on 2026-11-24.
171
+
172
+ Owner decision of 2026-11-25 (git history): the current repository keeps the old history and stays private for good, and a new repository `brucewaynedecoy/build-os` starts with one clean commit of the release tree. The history is not rewritten in place: after a force-push, GitHub can still serve the old commits by their hash. Steps 1 and 2 are on the current repository, and step 3 is on every existing clone. Every step from step 4 on, and every `gh` command below that names `brucewaynedecoy/build-os`, is on the new repository.
173
+
174
+ GitHub Free (pin-first final check, finding 4): a repository owned by a personal account on GitHub Free has rulesets and environments only when it is public. So the new repository gets no ruleset while it is private, and these steps protect it in another way: it stays private and empty until one push from a fresh folder, that push sends only `main`, the remote is checked to hold exactly one commit, one branch, and no tag, and the rulesets go on at once after it becomes public. A branch rule never stops a tag: an old tag that reaches the new repository would make the archive history public, so no clone with old objects ever pushes to it.
175
+
176
+ CI run links in these documents from before the cutover (for example `https://github.com/brucewaynedecoy/build-os/actions/runs/...`) name runs of the earlier repository. After the cutover, those runs are in the private archive repository `brucewaynedecoy/build-os-archive`, not in the new public repository.
177
+
178
+ 1. Delete the old repository secret on the current repository: Settings > Secrets and variables > Actions > Repository secrets > `BUILDOS_DENY_LIST` > delete; or `gh secret delete BUILDOS_DENY_LIST --repo brucewaynedecoy/build-os`. Then `gh secret list --repo brucewaynedecoy/build-os` must not list it. A repository secret is readable by any workflow a writer can push, on any branch.
179
+ 2. Rename the current repository to `build-os-archive` and keep it private for good: Settings > General > Repository name. It holds the old history, with the client text removed in W1 R7 P7 and two removed Go binaries with a personal build path. Do not make it public, ever.
180
+ 3. Retarget every existing clone, worktree, and automation of the old repository to the archive, before the new repository exists. After the rename in step 2, their `origin` still names `brucewaynedecoy/build-os`, and when that name is used again, an ordinary push of an old branch would publish old history to the new public repository. In each clone: `git remote set-url origin git@github.com:brucewaynedecoy/build-os-archive.git` (or the `https://github.com/brucewaynedecoy/build-os-archive.git` form), then `git remote -v` must name `build-os-archive` for every remote that named `build-os`. Worktrees share the remotes of their main clone, so check `git remote -v` in each worktree too. Do the same for every automation that pushes or pulls (scripts, scheduled jobs, CI on other systems, agent setups): change its remote URL or turn it off.
181
+ 4. Create the new repository `brucewaynedecoy/build-os`: private, and empty (no README, license, or `.gitignore`): `gh repo create brucewaynedecoy/build-os --private`, or New repository on GitHub with every "Add" option off. Push nothing to it yet. Start all later work on the new repository from a fresh clone of it, never from an old clone or worktree.
182
+ 5. Make the one clean commit in a fresh folder, and push only `main`. The folder has no other remote and no old objects: it is not a clone, a worktree, or a copy of a `.git` folder. The orchestrator prepares the reviewed release tree as plain files (no `.git` folder in it). Review that tree. Then, in a new empty folder outside every clone: `git init -b main`, copy the reviewed tree into it, `git add -A`, and `git commit -m "<message>"`. Run the deny-list check with the real list on that tree, from the root of the folder: `node toolkits/buildos/scripts/check-deny-list.mjs --root . --list-file <list file outside the folder>`. It must exit `0`. Check that the folder has one commit, one branch, and no tag: `git rev-list --all --count` prints `1`, `git branch --list` shows only `main`, and `git tag --list` prints nothing. Only then: `git remote add origin https://github.com/brucewaynedecoy/build-os.git` and `git push origin refs/heads/main:refs/heads/main`. Never use `--all`, `--mirror`, or `--tags`. This is the first push to the new repository.
183
+ 6. Check the remote, in a new empty folder outside every clone: `git ls-remote --heads --tags https://github.com/brucewaynedecoy/build-os.git` prints exactly one line, `<commit> refs/heads/main`, and nothing else (no other branch, no tag). Then `git clone --mirror https://github.com/brucewaynedecoy/build-os.git remote-check.git`, `git -C remote-check.git rev-list --all --count` prints `1` (exactly one commit), and `git -C remote-check.git for-each-ref --format='%(refname)'` prints only `refs/heads/main`. Also `gh api repos/brucewaynedecoy/build-os/branches --jq '.[].name'` prints only `main`, and `gh api repos/brucewaynedecoy/build-os/tags --jq length` prints `0`. Then delete the `remote-check.git` folder. When any check fails, do not make the repository public: delete the new repository and start again from step 4.
184
+ 7. Make the new repository public: Settings > General > Danger Zone > Change repository visibility. npm makes provenance only for a public repository, and on GitHub Free a private repository cannot use environments; until steps 12 to 14 are done, the real-list scan on the default branch and in prepare and release runs fails closed. Do steps 8 to 16 at once after this step, with no push in between.
185
+ 8. Default branch ruleset: Settings > Rules > Rulesets > New ruleset > New branch ruleset. Name `main`, Enforcement status Active, Target branches: Add a target > Include default branch. Turn on Restrict deletions, Block force pushes, Require a pull request before merging (Required approvals 1, Require review from Code Owners), and Require status checks to pass with these checks: `test (ubuntu-latest, Node 24)`, `test (macos-latest, Node 24)`, `test (windows-latest, Node 24)`, `OSV scan of package-lock.json`, `Make Docs contract (pinned range bounds)`, and `Deny list (invented list, every push and pull request)`. Do not require `Deny list (real list, default branch only)`: it is skipped on every pull request, and GitHub counts a skipped required check as passing; it runs after the merge instead, and the prepare and release runs repeat it. The bypass list depends on how many people maintain the repository; see [Sole Maintainer or Two Maintainers](#sole-maintainer-or-two-maintainers). The CI jobs run only when a pull request changes a path in their filter (`toolkits/buildos/**`, `system/**`, `docs/**`, `guide/**`, the root `*.md` files and `justfile`, `.github/**`); for any other change GitHub waits for the required CI checks, so only a bypass actor can merge it.
186
+ 9. Release tags: Settings > Rules > Rulesets > New ruleset > New tag ruleset. Name `release tags`, Enforcement status Active, Target tags: Add a target > Include by pattern `v*`. Turn on Restrict creations, Restrict updates, and Restrict deletions. Bypass list: Add bypass > the role Repository admin, Always allow. In a repository owned by a personal account, only the owner has that role, so only the owner can create, move, or delete a `v*` tag.
187
+ 10. Immutable releases: Settings > General > Releases > Enable release immutability. It applies to releases published after it is turned on; the `stage` job refuses a release that is not immutable.
188
+ 11. Verify steps 8 to 10 before any environment exists: Settings > Rules > Rulesets shows the rulesets `main` and `release tags` as Active; `gh api repos/brucewaynedecoy/build-os/rules/branches/main` lists the rules `deletion`, `non_fast_forward`, `pull_request` (with `required_approving_review_count` 1 and `require_code_owner_review` true), and `required_status_checks` with the six checks; `gh api 'repos/brucewaynedecoy/build-os/rulesets?targets=tag'` lists `release tags` with enforcement `active`; `gh api repos/brucewaynedecoy/build-os/immutable-releases` prints `"enabled": true`. The `deny-list` and `stage` jobs repeat the ruleset part of this check on every prepare and release run.
189
+ 12. Environment `buildos-deny-list`: Settings > Environments > New environment, name `buildos-deny-list` > Configure environment. Deployment branches and tags: Selected branches and tags > Add deployment branch or tag rule: Ref type Branch, pattern `main`; again: Ref type Tag, pattern `v*`. No other rule. No secret yet.
190
+ 13. Environment `buildos-npm-stage`: Settings > Environments > New environment, name `buildos-npm-stage`. Required reviewers: select it, add the maintainer, Save protection rules. Prevent self-review: see [Sole Maintainer or Two Maintainers](#sole-maintainer-or-two-maintainers). Deselect Allow administrators to bypass configured protection rules. Deployment branches and tags: Selected branches and tags > Add deployment branch or tag rule: Ref type Tag, pattern `v*`. No secret.
191
+ 14. Only now add the environment secret: on the `buildos-deny-list` environment page, Environment secrets > Add environment secret, name `BUILDOS_DENY_LIST_ENV`, value: the list. Or from a file outside the repository, without echoing it: `gh secret set BUILDOS_DENY_LIST_ENV --env buildos-deny-list --repo brucewaynedecoy/build-os < <list file>`. No repository or organization secret may have this name.
192
+ 15. Private vulnerability reporting: Settings > Advanced Security (sidebar section "Security and quality") > Private vulnerability reporting > Enable.
193
+ 16. Check the remote again, as in step 6, in a new empty folder outside every clone: `git ls-remote --heads --tags https://github.com/brucewaynedecoy/build-os.git` prints exactly one line, `<commit> refs/heads/main`, and nothing else (no other branch, no tag). Then `git clone --mirror https://github.com/brucewaynedecoy/build-os.git remote-check.git`, `git -C remote-check.git rev-list --all --count` prints `1` (exactly one commit), and `git -C remote-check.git for-each-ref --format='%(refname)'` prints only `refs/heads/main`. Also `gh api repos/brucewaynedecoy/build-os/branches --jq '.[].name'` prints only `main`, and `gh api repos/brucewaynedecoy/build-os/tags --jq length` prints `0`. Then delete the `remote-check.git` folder.
194
+ 17. Only after steps 1 to 16: npm trusted publishing for the new repository, through the First Publication steps in `toolkits/buildos/AGENTS.md`.
195
+
196
+ `.github/CODEOWNERS` names the maintainer for the workflows and itself, every build, release, and gate script with its policy inputs and vendored schemas, the tests and gate corpora the checks run, the package manifest, lockfile, npm and TypeScript settings, the SBOM policy documents (`SECURITY.md`, `THIRD_PARTY_NOTICES.md`), the ledger, and the product files that the build scripts read to decide the package content. `test/codeowners.test.ts` computes that set from the workflows' `run:` lines and the scripts' imports and fails when a file is outside every pattern. Step 8 turns the code-owner review on.
197
+
198
+ ### Sole Maintainer or Two Maintainers
199
+
200
+ Checked against GitHub's documentation on 2026-11-24. GitHub never lets the author of a pull request approve it, and "Require review from Code Owners" needs an approval from a code owner of each changed path. Every pattern in `.github/CODEOWNERS` names one person, the maintainer. So a second reviewer who is not a code owner cannot give the required code-owner approval for the maintainer's own pull request, for example the one that commits a ledger entry. A ruleset bypass list takes roles (Repository admin, Maintain, Write, or a custom role), teams, GitHub Apps, and Dependabot, not a single person.
201
+
202
+ Sole-maintainer route (the current setup):
203
+
204
+ - Branch ruleset `main`: Bypass list > Add bypass > the role Repository admin, then change "Always allow" to "For pull requests only". In a repository owned by a personal account, only the owner has the Repository admin role. With "For pull requests only", GitHub requires the owner to open a pull request for every change: a direct push, a force push, and a deletion of `main` are still refused. On the pull request, the owner can choose to bypass the rules and merge it. The required status checks still run on the pull request and their results show on it and in the audit log, but a bypass merge is not blocked by a missing approval or by a failing check: the owner's own care is the only review.
205
+ - Tag ruleset `release tags`: the Repository admin role, Always allow (tag rulesets have no pull request mode), so only the owner creates, moves, or deletes a `v*` tag.
206
+ - Environment `buildos-npm-stage`: leave Prevent self-review off. Then the owner, as the required reviewer, can approve the staging job of a run the owner started. With it on, nobody could approve it.
207
+ - What this protects: a writer other than the owner cannot merge a change to a code-owned path without the owner's approval, cannot create or move a release tag, cannot get the deny list or the staging permission from a branch, and cannot approve the staging job. A fork pull request gets no secret. Every release still needs the owner's GitHub approval of the staging job and the owner's npm two-factor approval of the stage.
208
+ - What it does not protect: there is no second person. A mistake or a compromise of the owner's GitHub account can change the workflows on `main` through a bypass merge, tag a release, and approve the staging job; only the npm two-factor approval, which needs the owner's second factor, stands after that.
209
+
210
+ Two-maintainer route (the alternative): give a second person write access and add them as a second code owner on every line of `.github/CODEOWNERS` (for example `/.github/ @brucewaynedecoy @second-maintainer`; the test then needs the same list on every line). Remove the bypass actor from the branch ruleset, so each person's pull request needs the other's approval and passing checks. Add the second person as a required reviewer of `buildos-npm-stage` and turn Prevent self-review on, so the person who starts a release cannot approve its staging job. The tag ruleset keeps the Repository admin bypass (in a personal-account repository, only the owner), so the owner still creates the release tags. Under the trust rule above, the second person is release-trusted.
211
+
212
+ ### Maintainer Checklist
213
+
214
+ For each release, beyond the workflow: download the dry run's artifact and inspect the tarball (`tar -tzvf`, `npm diff` against the previous release, an offline install with `buildos version --json` and `buildos help`), and read the SBOM and the gate results in the job summary, before the reviewed entry is computed from that tarball (`node scripts/release-candidate.ts compute --tarball ...`) and committed; review the draft release after the prepare run; check again whether the esbuild [Install-Script Exception](#install-script-exception) is still needed (if esbuild no longer declares an install script, remove the exception with an owner decision recorded in PRD 20); after staging, check the staged package's provenance and digest (an OIDC token cannot read a stage, so the workflow cannot); and approve publication only after the recorded maintainer approval. No agent publishes, stages, tags, or creates a release. The first publication has its own steps in `toolkits/buildos/AGENTS.md`.
215
+
216
+ ## Admission Rules
217
+
218
+ BuildOS uses Node built-in modules first. An outside package is allowed only when Node cannot do the job, and only when it meets every rule below (PRD 20 Supply Chain).
219
+
220
+ 1. It is widely used and actively maintained.
221
+ 2. Its license is MIT, Apache-2.0, BSD, or ISC.
222
+ 3. It has few or no dependencies of its own.
223
+ 4. It is pinned to an exact version and recorded in the lockfile.
224
+ 5. It has no install scripts. CI installs with `--ignore-scripts`.
225
+ 6. `npm audit` and an OSV scan pass with no high or critical findings.
226
+
227
+ PRD 20 also names the build tools: TypeScript compiled with `tsc`, tests with Node's built-in test runner (`node:test` with `node:assert/strict`; no test framework package is installed), and the bundle with esbuild.
228
+
229
+ On 2026-11-23 the owner replaced Vitest with `node:test`. Vitest's dependency tree held 12 MPL-2.0 `lightningcss` packages, which rule 2 does not allow. This removed 67 lockfile packages.
230
+
231
+ ## Bundling
232
+
233
+ esbuild bundles all runtime code, including the outside packages, into `dist/buildos.js`. The published `package.json` has no `dependencies`, `optionalDependencies`, `peerDependencies`, or `bundleDependencies`, so a user's machine never resolves a new third-party version. A fixed upstream package reaches users only through a rebuilt and republished BuildOS release.
234
+
235
+ The build is reproducible: esbuild always runs from the package root, so no path of the build machine enters the bundle; no clock value enters the build; and `npm pack` writes fixed file times. CI builds the package twice from an empty `dist/` on macOS, Linux, and Windows and requires the same SHA-256 (`scripts/reproducible-pack.ts`). Byte identity is claimed for the reference build environment only, because gzip output and file modes can differ between systems.
236
+
237
+ The bundle carries the license notices of bundled code as esbuild legal comments, and `THIRD_PARTY_NOTICES.md` holds every license text.
238
+
239
+ ## Package Contents
240
+
241
+ The package `files` list holds `dist/buildos.js`, the three legacy entry files, `dist/system.json`, `dist/system/`, `LICENSE`, `SECURITY.md`, `THIRD_PARTY_NOTICES.md`, and `README.md`; npm always adds `package.json`. `npm pack --dry-run` lists 173 files. Source, tests, fixtures, goldens, scripts, and the lockfile are not published. `test/package.test.ts` checks the exact file list on every CI run. The packed and unpacked byte sizes change with each build, so the release evidence records them for each version.
242
+
243
+ | Path | What it is |
244
+ | --- | --- |
245
+ | `dist/buildos.js` | The bundle: the only BuildOS program code. The `bin` entries `buildos` and `build-os` both point to it; `build-os` is there because `npx -y build-os@<version>` runs the `bin` named after the package. |
246
+ | `dist/buildos-intake.js`, `dist/buildos-discovery.js`, `dist/buildos-design.js` | The entry files of the legacy command names. Each is a few lines that the build writes: it sets its command name in a global keyed `Symbol.for("buildos.commandName")` and imports `./buildos.js`. It holds no other code. They go away with the legacy names in `0.3.0`. |
247
+ | `dist/system.json` | The list of project files: each file's project path, its name in the package, its mode (`0755` for a file that starts with `#!`, else `0644`), and its SHA-256. `buildos init` refuses to use a file whose SHA-256 does not match. |
248
+ | `dist/system/` | The project files that `buildos init` copies into a project (163 files): the `.os/` operating layer (contracts, templates, config, empty datasets, indexes, the `.os/scripts/` wrappers, and the `.os/skills/` skills), `assets/`, `playbooks/`, `workspace/`, and the root `AGENTS.md`, `CLAUDE.md`, and `.gitignore`. npm leaves `.gitignore` files out of a package, so the project `.gitignore` is stored as `_dot.gitignore` and gets its name back in the project. |
249
+ | `LICENSE`, `SECURITY.md`, `THIRD_PARTY_NOTICES.md`, `README.md`, `package.json` | The package documents. |
250
+
251
+ The build copies `system/` from the repository. It leaves out a `system/docs/` or `system/.make-docs/` folder (Make Docs owns them; neither exists in the source) and local clutter (`__pycache__`, `*.pyc`, `*.pyo`, `.DS_Store`, `Thumbs.db`, and the app folders `.claude/` and `.agents/`). A symbolic link in `system/` fails the build. The pack check fails on any path under `system/docs/` or `system/.make-docs/`, any test, fixture, golden, or testdata path, any Go file, and any Python file other than the three skill scripts below.
252
+
253
+ Skills: `.os/skills/` holds 21 skill folders and a router (64 files). They are instructions and reference files for an agent, plus four scripts that an agent may run, never BuildOS: `buildos-export-azure-boards/scripts/azure_boards_csv.mjs` and `scripts/adapters/dynamics-365-ce.mjs` (Node.js built-ins only), `buildos-bulk-extract/scripts/work.py` with its test `tests/test_work.py` (Python standard library only), and `fit-gap-analysis/scripts/fitgap.py` (Python standard library; its workbook step imports `openpyxl`, which the user installs; BuildOS does not ship it). The `capability-matrix` skill tells the agent to write a Python tool from its own text. BuildOS plans to move the bulk-extract, fit-gap, and Azure Boards scripts into CLI commands in `0.2.0`. `buildos init` copies the skills to `.os/skills/` and never writes into an app folder such as `.claude/` or `.agents/`; an agent copies one skill there when the user asks. The skills hold no client content: the [client-name deny-list check](#client-name-deny-list-check) scans them.
254
+
255
+ Project wrappers: `.os/scripts/` holds the wrappers `buildos`, `buildos-intake`, `buildos-discovery`, and `buildos-design`, each as `sh` and `.cmd`, and their helpers `pinned-version.cjs` and `node-required.txt`. A wrapper only finds BuildOS, and always the version pinned in `.os/manifest.json` (pin first): an npm install of that version, else `npx -y build-os@<version>`, else one plain message that Node.js 24 or newer is needed (exit 127). The wrapper never starts a program to learn its version (W1 R7 P8 pin-first review round 1). It reads `package.json` files only, to choose a candidate: first `node_modules/build-os` in the project folder and in each folder above it, then in npm's local project folder (the first folder up from the current folder with a `package.json` file or a `node_modules` folder; a file named `node_modules` does not count) and in each folder above it, as Node.js looks for a package (W1 R7 P8 pin-first final check, finding 1: npm hoists a workspace install to the workspace root), and only when none counts, the first `buildos` on `PATH` that is not a BuildOS project wrapper. To tell a wrapper, the helper reads at most the first 1,024 bytes of a `PATH` candidate. On macOS and Linux that `buildos` counts only when its real path (all links followed) is the `buildos` bin file of the nearest `package.json` above it. On Windows it counts only when it is an npm `.cmd` shim with the package next to it (`node_modules\build-os`, or the package folder of a `node_modules\.bin` folder); the shim itself never runs. The `package.json` must be a regular file (no link), at most 256 KiB, strict JSON, with the name `build-os` and exactly the pinned version (any version for a `dev` pin), and its `buildos` bin file must be a readable regular file inside the package and not inside a `node_modules` folder below it. The wrapper then runs that bin file as `node <bin file> <arguments>`, with the same Node.js that ran the helper and in the same working folder. A pnpm, yarn, or Volta shim, a hand-made script, and a file that cannot be read do not count: the pinned version runs through `npx`. A `dev` pin has no published version: with no install that counts, it stops with a message that names the two ways that work (exit 3). The `sh` wrapper starts `node` and `npx` by their path on `PATH`, never by bare name, with a leading `./` for a relative `PATH` entry, so a folder name that starts with `-` is never read as an option (W1 R7 P8 pin-first review round 2, finding 1).
256
+
257
+ The program checks itself (W1 R7 P8 pin-first review round 2). On every start (a local install, a `buildos` on `PATH`, or `npx`), the wrapper sets `BUILDOS_REQUIRE_VERSION` to the pinned version (or `dev`). The BuildOS program reads it first, before any command code, any output, and any file access, in `buildos` and in the legacy-name entry files alike (`src/cli/required-version.ts`). Just before that check, the program checks its own Node.js version (W1 R7 P8 pin-first final check, finding 3: a project can hold an older `node_modules/.bin/node`, and `npx` can start BuildOS with it): below 24, nothing on stdout, one plain message on stderr that names the needed and the found version, and exit code 3 (with `--json`, the failure envelope with diagnostic code `node_version`). The bundle parses and runs that far on Node.js 20 (checked with Node.js 20.18.0). When it is set, not empty, and not exactly the program's own build identity (the version `buildos version` reports: a release version or `dev`), the program stops: nothing on stdout, one plain message on stderr that names the required version, the version that started, and the two fixes (fix the install, then run the project wrapper again; or set the version in `.os/manifest.json`), and exit code 3. With `--json` on the command line, the refusal is the JSON failure envelope on stdout instead (diagnostic code `version_mismatch`). There is no fallback after a refusal. The program then removes the variable from its own environment, so a program that it starts (Make Docs, a nested tool) does not get it. An unset or empty variable means no check, so a direct `buildos` run is unchanged. The `package.json` read above only chooses a candidate; this check is what makes sure that a command runs only at the pinned version.
258
+
259
+ The wrapper runs `npx` with `npm_config_bin_links=true`, so npm makes the bin link of a package it installs into its cache, and with `--prefix <current folder> --workspaces=false`, so npm does not change to an npm workspace folder above the current folder. On every system, `pinned-version.cjs` starts `npx` (W1 R7 P8 pin-first final check, finding 5). It keeps the caller's own bin-links settings, in any case and spelling, in `BUILDOS_SAVED_<name>` variables and sets `BUILDOS_NPM_BIN_LINKS_OVERRIDE=1`; the BuildOS program puts the caller's settings back, together with the removal of `BUILDOS_REQUIRE_VERSION`, before it starts any other program. The helper applies the manifest contract of PRD 20 (shared with `src/core/init/manifest.ts` and tested against the same table, `test/fixtures/manifest-contract.json`), so only an exact semver 2.0.0 version with no build metadata and each number at most 9007199254740991 (the largest that npm reads as a version, not as a dist-tag) reaches the `npx` command line, and the `sh` wrapper checks the version's characters again. It reads the manifest as `buildos init` does: a regular file at the name only (a link is not followed), opened once, checked against the entry at the name, and read with a bound, so a file over 64 KiB is refused without being read. The wrappers skip every BuildOS project wrapper on `PATH` (the Go-era one too); never run a `buildos` from the current folder on Windows unless `PATH` names it (the `.cmd` wrapper also sets `NoDefaultCurrentDirectoryInExePath`); stop a chain of wrappers that comes back to them (`BUILDOS_WRAPPER_ACTIVE`, which the BuildOS program clears when it starts, so a program it starts can call a wrapper again); and turn delayed expansion off. The `.cmd` wrapper passes its arguments to the helper without `call`, so Command Prompt reads them once, and the helper starts the chosen program itself with the same console and exit code: `buildos` or `npx` as a `.cmd` file through `cmd.exe /d /v:off /s /c` with each argument quoted and every Command Prompt special character escaped twice (as cross-spawn does for npm's `.cmd` shims), any other program directly. No path goes back to Command Prompt as text, so a folder name in any language reaches the program whatever the console code page. `test/wrappers.test.ts` runs every wrapper with a `PATH` that holds only stubs and fixture npm packages, with recorder programs that check the exact argument list and that a program that must not run never starts, also from folders whose names are not ASCII or hold `!` or `%TEMP%`, from a quoted Windows `PATH` entry with a `;` in it, and under `dash` when the system has it. See [Known Limits and Out of Scope](#known-limits-and-out-of-scope) for the Windows limits.
260
+
261
+ Threat model of the wrappers. The pin gives a repeatable version and a rollback path. It does not defend against a hostile program named `buildos`, `build-os`, `npx`, or `node` on `PATH`, or against a hostile `node_modules` folder: a person who controls those controls the run already. npm itself decides which copy it starts for the `npx` fallback, and it can start a copy that the wrapper did not choose (for example a local install of `<pin>+local`, which npm takes as `<pin>`, or a copy with no bin link, after which npm starts the `bin` named after the package, `build-os`, by name from `PATH`). When that copy is BuildOS at another version, it stops itself through `BUILDOS_REQUIRE_VERSION`. A program that is not BuildOS and ignores the variable is outside what the wrapper can check. `test/package.test.ts` shows these cases with real npm 11: with the pinned version installed with `--no-bin-links`, `npx` alone runs a planted `build-os` from `PATH`, and the project wrapper does not; and a local install of `<pin>+local` that `npx` starts refuses itself. The local lookup takes any `node_modules/build-os` in the project folder or in a folder above it that passes the package test, as Node.js would find it; there is no extra package marker, because no BuildOS release exists without the self-check (nothing is published before `0.1.0`), so every BuildOS release that the lookup can find checks its own version. The helper compares package folders by name, and on Windows it compares paths without case, also on a folder that is case-sensitive; with the self-check, such a mix-up can choose a wrong candidate but cannot run another BuildOS version.
262
+
263
+ ## Started Programs
264
+
265
+ The CLI starts no program, with one exception: `buildos init` runs the public Make Docs CLI when the user answers Yes to the Make Docs question or passes `--make-docs` (PRD 20 Make Docs Companion Setup). It runs `make-docs` from `PATH`, else `npx -y @brucewaynedecoy/make-docs@~2.0.9`, with exactly `setup --target <project> --codex-method none --claude-code-method none --no-github-copilot --no-skills --project-resources all --yes --json`. That `npx` fetch, the user's choice, is the only network use the CLI can cause.
266
+
267
+ - Only `src/adapters/node-process.ts` may load `child_process`. The boundary check (`test/boundary-rules.ts`) enforces this, and fails when that file names a `buildos` program in any string. Core asks for a process only through the process port (`src/core/shared/process-port.ts`).
268
+ - No shell runs on macOS or Linux. On Windows, a `.cmd` or `.bat` program runs through `cmd.exe /d /s /c` with every argument quoted, and an argument with `%`, `!`, a quote, or a line break is refused before anything starts.
269
+ - The program gets no input (`stdin` is closed) and a 10-minute limit. Its output is read, not shown, except the first line of a Make Docs error.
270
+ - BuildOS never writes a Make Docs-owned file (`docs/`, `.make-docs/`) itself. A Make Docs failure leaves BuildOS set up and shows the exact retry command.
271
+ - Tests never run the real Make Docs. The CI job `make-docs-contract` runs the real Make Docs at both bounds of the pinned range in a temporary folder and Make Docs home.
272
+
273
+ ## Bundled Runtime Code
274
+
275
+ ### Bundled npm Packages
276
+
277
+ Node has no ZIP reader, XML parser, HTML parser, or PDF reader, so BuildOS admitted one package per conversion need. XML is read by BuildOS's own port of the Go 1.24.1 `encoding/xml` decoder instead of a package (see [Other Bundled Code](#other-bundled-code)): like Go, it never expands a DTD entity and never loads an external entity. Each package was chosen from two candidates that passed every admission rule, on the full conversion eval set with owner-approved references (`test/conversion-eval/`); the comparison is in the W1 R7 evidence report, section Converter Comparison (`docs/work/2026-11-23-w1-r7-buildos-node-typescript-cli-rewrite/evidence.md` in the BuildOS repository). All four are `devDependencies` pinned to exact versions, installed with `--ignore-scripts`, and bundled by esbuild into `dist/buildos.js`. They sit behind one adapter, `src/adapters/intake-parsers.ts`, that takes bytes and returns plain data, so no package can write a file or print through the core. Why each is trusted: it passed every admission rule, it is widely used, it has at most one dependency, its scans are clean, and it gave Go's results on the eval set.
278
+
279
+ | Package | Version | License | Reason | Transitive packages | Install script | Scan status | Comparison summary |
280
+ | --- | --- | --- | --- | --- | --- | --- | --- |
281
+ | `fflate` | 0.8.3 | MIT | Inflates the DEFLATE entries of DOCX and XLSX (its streaming `Inflate`, fed 1 KiB at a time, so every limit counts real output). The adapter reads the ZIP central directory itself, checks names and limits first, checks each entry's size and CRC-32 as Go does, and inflates only the parts the converter uses. The owner chose a package over own code on `node:zlib`. The adapter imports the browser build, which loads no Node module (the Node build loads `module` and `worker_threads` for an asynchronous API BuildOS does not use). | 0 | none | clean | Against `adm-zip` 0.6.1: both kept every section and gave Go's bytes on all three DOCX and XLSX eval files. `fflate` has no runtime warnings and adds about 11 kB to the bundle (`adm-zip` 38 kB minified). |
282
+ | `parse5` | 8.1.1 | MIT | Parses HTML with the WHATWG algorithm, as Go's `golang.org/x/net/html` does. | 1: `entities` 9.0.0 (BSD-2-Clause) | none | clean | Against `htmlparser2` 12.0.0: both scored the same on both HTML eval files. `parse5` follows the same tree-building algorithm as the Go parser, and has 1 transitive package against 5. It adds more to the bundle (about 300 kB unminified with `entities`, against about 57 kB minified). |
283
+ | `entities` | 9.0.0 | BSD-2-Clause | HTML entity tables, a dependency of `parse5`. | 0 | none | clean | Comes with `parse5`. |
284
+ | `unpdf` | 2.1.0 | MIT; its bundled pdf.js is Apache-2.0 | Reads PDF text runs through its serverless pdf.js build. No OCR and no Poppler. The adapter turns off font loading, WebAssembly, and console output. The optional peer `@napi-rs/canvas` is not installed, and the JBIG2 and OpenJPEG decoder modules (`pdfjs-jbig2*.mjs`, `pdfjs-openjpeg*.mjs`) are not bundled; their loaders inside `pdfjs.mjs` are (see [Components Inside pdf.js](#components-inside-pdfjs)). The bundled pdf.js holds no `eval` and no `new Function`. | 0 | none | clean | Against `pdf2json` 4.1.1: both kept every section on all six PDF eval files and matched every PDF golden after white-space normalization. `pdf2json` writes `Warning: Setting up fake worker.` to the console on every parse and holds `new Function`; `unpdf` prints nothing. `unpdf` adds more to the bundle (about 2.4 MB unminified, against about 956 kB minified for `pdf2json`). |
285
+
286
+ ### Components Inside pdf.js
287
+
288
+ Inventory of the third-party code that pdf.js 6.4.299 inlines into `unpdf/dist/pdfjs.mjs`, from the bundled sources and pdf.js v6.4.299 `external/` (each folder's `README.md` states its license). `test/notices.test.ts` fails when the built bundle holds one of these components (found by a marker in the esbuild output) and `THIRD_PARTY_NOTICES.md` lacks its license text, or this table lacks its row. pdf.js `external/bcmaps`, `external/iccs`, `external/quickjs`, and the standard font files are not inlined: pdf.js loads them by URL, and BuildOS gives it none.
289
+
290
+ | Component | pdf.js source | License | What is bundled | Runs in BuildOS |
291
+ | --- | --- | --- | --- | --- |
292
+ | Brotli decoder (Google) | `external/brotli/decode.js` | MIT | The whole JavaScript decoder (`makeBrotliDecode`), for the `BrotliDecode` stream filter | Yes, for a PDF stream that uses `BrotliDecode` |
293
+ | OpenJPEG decoder loader | `external/openjpeg/openjpeg.js` (built by pdf.js.openjpeg) | BSD-2-Clause | The Emscripten loader (`OpenJPEG`); not `openjpeg.wasm` or `openjpeg_nowasm_fallback.js` | No: WebAssembly is off and no image decoder is registered |
294
+ | JBIG2 decoder loader (PDFium) | `external/jbig2/jbig2.js` (built by pdf.js.jbig2) | Apache-2.0 | The Emscripten loader (`JBig2`); not `jbig2.wasm` or `jbig2_nowasm_fallback.js` | No, as for OpenJPEG |
295
+ | qcms color management loader | `external/qcms/qcms.js` and `qcms_utils.js` (built by pdf.js.qcms) | MIT | The wasm-bindgen loader and helpers; not `qcms_bg.wasm` | No: with WebAssembly off, pdf.js converts colors in JavaScript |
296
+ | Emscripten runtime glue | inside the OpenJPEG and JBIG2 loaders | MIT (or University of Illinois/NCSA) | The generated runtime helpers | Only as part of the loaders above |
297
+ | wasm-bindgen glue | inside the qcms loader | MIT (or Apache-2.0) | The generated `__wbindgen_*` glue | Only as part of the qcms loader |
298
+
299
+ ### Other Bundled Code
300
+
301
+ The bundle also holds BuildOS code and these ports of Go code. No Go code ships: each item is TypeScript that follows the Go source, so the CLI matches the earlier Go tools byte for byte.
302
+
303
+ | Item | Source | npm package | License | Where | Reason |
304
+ | --- | --- | --- | --- | --- | --- |
305
+ | Go `strconv` printable-rune tables (`isPrint16`, `isNotPrint16`, `isPrint32`, `isNotPrint32`) and a port of the `strconv.IsPrint` lookup | Go 1.24.1 standard library: `src/strconv/isprint.go` (generated by `src/strconv/makeisprint.go`, Unicode 15.0.0) and `IsPrint` and `bsearch` in `src/strconv/quote.go` | none | BSD-3-Clause (a BSD license, allowed by Supply Chain rule 2) | `src/core/shared/go-isprint.ts` (generated by `scripts/generate-go-isprint.ts`), `goIsPrint` in `src/core/shared/go-quote.ts`, bundled into `dist/buildos.js` | Go `strconv.Quote` escapes by Go's fixed Unicode 15.0.0 tables, and Node's Unicode data is newer, so the CLI needs Go's own tables to match the Go seed byte for byte |
306
+ | Go simple case-folding orbits (`foldRune` of every non-ASCII rune whose fold is another rune) | Go 1.24.1 standard library: `unicode.SimpleFold` (`src/unicode/letter.go`, case tables in `src/unicode/tables.go`, Unicode 15.0.0) through `foldRune` in `src/encoding/json/fold.go` | none | BSD-3-Clause (a BSD license, allowed by Supply Chain rule 2) | `src/core/shared/go-fold.ts` (generated by `scripts/generate-go-fold.ts`), `goFoldName` in `src/core/shared/go-json.ts`, bundled into `dist/buildos.js` | `encoding/json` matches object keys to struct fields with Go's own folding (`ı` is not `i`, `ſ` is `s`), which JavaScript case mapping and Node's newer Unicode data do not give |
307
+ | Ports of Go standard library code: `encoding/json` scanner, decoder, and encoder rules; `time.Parse` for RFC 3339; `syscall` error text; `path/filepath` `Abs`, `Clean`, `Join`, `Dir`, and `Base` | Go 1.24.1 standard library: `src/encoding/json` (`scanner.go`, `decode.go`, `encode.go`, `indent.go`, `fold.go`), `src/unicode/utf8`, `src/time/format.go` and `format_rfc3339.go`, `src/syscall` errors tables, `src/internal/filepathlite` | none | BSD-3-Clause (a BSD license, allowed by Supply Chain rule 2) | `src/core/shared/go-json.ts`, `rfc3339Offset` in `src/core/entities/consolidate.ts`, `src/core/shared/go-os-error.ts`, `src/core/shared/go-path.ts`, bundled into `dist/buildos.js` | The entity port must match the Go seed byte for byte: Go's JSON error text, decoded values, and written row bytes, its time parsing, its operating system error text, and its path spelling |
308
+ | Ports for the intake domain (W1 R7 P4): Go `encoding/csv`, `strconv.Unquote`, `strings.Fields`, `EqualFold`, and `ToLower`, `path/filepath` `Rel`, `IsAbs`, and `Ext`, the `flag` usage text, and `html.Render` from `golang.org/x/net/html` v0.48.0 | Go 1.24.1 standard library (`src/encoding/csv`, `src/strconv/quote.go`, `src/strings`, `src/path/filepath`, `src/flag`); `golang.org/x/net` v0.48.0 (`html/render.go`, `html/escape.go`) | none | BSD-3-Clause (Go Authors; a BSD license, allowed by Supply Chain rule 2) | `src/core/intake/convert/csv.ts`, `src/core/intake/index/frontmatter.ts`, `src/core/intake/go-text.ts`, `src/core/intake/convert/html.ts`, `src/cli/go-flagset.ts` (shared with P5 since the merge), bundled into `dist/buildos.js` | The intake port must match the Go intake tool byte for byte: CSV bytes and errors, front matter values, file names, flag errors, and inline SVG side artifacts |
309
+ | Port of the Go `encoding/xml` decoder in strict mode (`Decoder.Token`, `rawToken`, `text`, `name`, `nsname`, the XML name tables, `procInst`, and `Unmarshal`'s root-element search) | Go 1.24.1 standard library: `src/encoding/xml/xml.go` and `src/encoding/xml/read.go` | none | BSD-3-Clause (Go Authors; a BSD license, allowed by Supply Chain rule 2) | `src/core/intake/convert/go-xml.ts` (with its own `@license` header), bundled into `dist/buildos.js` | DOCX and XLSX parts must parse, and fail, exactly as the Go intake tool parses them: the same well-formedness rules and `XML syntax error on line N: ...` text, no DTD entity expansion and no external entities, iterative, and bounded (see [Intake Input Limits](#intake-input-limits)) |
310
+ | Port of the first `pdf.NewReader` checks (header, `%%EOF`, final `startxref`) and their error texts | Go module `github.com/ledongthuc/pdf` v0.0.0-20250511090121-5959a4027728, `read.go` | none | BSD-3-Clause (Copyright 2009 The Go Authors) | `goPdfOpenError` in `src/core/intake/convert/pdf.ts`, bundled into `dist/buildos.js` | A PDF that fails these checks (an empty file, a missing header or `%%EOF`) gets the Go intake tool's message |
311
+ | Ports of Go standard library code for the discovery and design ports (W1 R7 P5): `flag` parsing and usage text; `path/filepath` `Rel` and `IsAbs`; `bufio.Scanner` line limits; `bytes.TrimSpace`; `strings.ToLower`; `json.Marshal` | Go 1.24.1 standard library: `src/flag/flag.go`, `src/path/filepath/path.go` and `path_windows.go`, `src/bufio/scan.go`, `src/bytes/bytes.go`, `src/strings/strings.go`, `src/encoding/json/encode.go` | none | BSD-3-Clause (a BSD license, allowed by Supply Chain rule 2) | `src/cli/go-flagset.ts`, `src/core/shared/go-text.ts`, bundled into `dist/buildos.js` | `buildos discovery` and `buildos design` must match the Go tools byte for byte: Go's flag errors and usage text, relative links, line scanning, trimming, lowercase slugs, and written JSON rows |
312
+
313
+ `THIRD_PARTY_NOTICES.md` holds the Go copyright notice and the full BSD-3-Clause text from the Go 1.24.1 `LICENSE` file (the same notice covers the `golang.org/x/net` port), and the notice of `github.com/ledongthuc/pdf`. The bundle also carries the Go notice as an esbuild legal comment. `test/notices.test.ts` fails when `src/core/shared/go-isprint.ts` or `src/core/shared/go-fold.ts` exists without that notice entry, its inventory row, or its own license header. `test/bundle.test.ts` fails when the bundle drops the notice.
314
+
315
+ ## Build-Time Tools
316
+
317
+ These are the direct dev dependencies that are not bundled. Each is pinned to an exact version and never ships. "Transitive packages" counts every lockfile package the tool brings in, including platform packages for other operating systems that npm records but does not install. The three trees do not overlap, so the counts add up to 47.
318
+
319
+ | Package | Version | License | Reason | Transitive packages | Install script | Scan status |
320
+ | --- | --- | --- | --- | --- | --- | --- |
321
+ | `typescript` | 7.0.2 | Apache-2.0 | PRD 20 requires strict TypeScript checked with `tsc`. Runs `tsc --noEmit`. | 20: one native `tsc` binary package per platform (`@typescript/typescript-*`, Apache-2.0); npm installs only the one for the current machine | none | clean |
322
+ | `esbuild` | 0.28.2 | MIT | PRD 20 requires an esbuild bundle. Builds `dist/buildos.js`. | 26: one native binary package per platform (`@esbuild/*`, MIT); npm installs only the one for the current machine | declared, never run (see below) | clean |
323
+ | `@types/node` | 24.19.2 | MIT | Node 24 type definitions for `tsc`. The major version matches the Node floor. | 1: `undici-types` (MIT) | none | clean |
324
+
325
+ Version choice: each version was the newest stable release that was at least two weeks old on 2026-11-23. Why each is trusted: PRD 20 names it, it is widely used, and it runs only on the maintainer's machine and in CI.
326
+
327
+ ## Install-Script Exception
328
+
329
+ PRD 20 Supply Chain rule 5 says that no package may declare an install script. The rule has one closed exception, which the owner approved on 2026-11-23 on the condition that it does not become a precedent.
330
+
331
+ The exception: exactly one package, `esbuild` 0.28.2 (the exact version in `package-lock.json`), may declare an install script, and only its `postinstall` script (`node install.js`). esbuild declares that script to check its platform binary.
332
+
333
+ Why it is safe:
334
+
335
+ - The script never runs. Every install uses `--ignore-scripts`, and `toolkits/buildos/.npmrc` sets `ignore-scripts=true`.
336
+ - esbuild works without the script. Its binary comes from an `@esbuild/*` platform package, which has no script.
337
+ - esbuild is a build-time tool only. It is never bundled or shipped. The published package holds only the files in [Package Contents](#package-contents).
338
+
339
+ How CI enforces it: `scripts/dependency-policy.ts` holds an allow-list with exactly one entry: the name `esbuild`, the version `0.28.2`, the script `postinstall`, and the command `node install.js`. `scripts/check-dependencies.ts` runs before `npm ci`, and again with `--installed` after `npm ci --ignore-scripts` and before every step that uses `node_modules`. The guard fails when:
340
+
341
+ - any other lockfile package has `hasInstallScript`, or any other installed `package.json` declares an install lifecycle script. The install lifecycle scripts are every script that `npm install` or `npm ci` can run: `preinstall`, `install`, `postinstall`, `prepublish`, `preprepare`, `prepare`, `postprepare`, `predependencies`, `dependencies`, and `postdependencies`. An installed package with a `binding.gyp` file and no `preinstall` or `install` script counts as declaring `install`, because npm runs `node-gyp rebuild` for it;
342
+ - the installed esbuild 0.28.2 declares any of those scripts other than `postinstall`, or its `postinstall` runs a command other than `node install.js`;
343
+ - `package.json` itself declares any of those scripts, sets `"gypfile": true`, or declares `workspaces`, or the package root has a `binding.gyp` file (npm would run `node-gyp rebuild` for the root as an implicit `install`; `"gypfile": false` does not excuse it), or the lockfile root entry has `hasInstallScript`. BuildOS may declare none of them. Both guard modes check the root;
344
+ - any `esbuild` copy in the lockfile, or the installed esbuild, has a version other than the allowed one;
345
+ - the allow-list holds more or fewer than one entry, or names a package that is not in the lockfile;
346
+ - `.npmrc` is missing, or does not set `ignore-scripts=true` exactly once, at top level (before any INI `[section]`), with no other spelling of the key;
347
+ - npm itself, run from `toolkits/buildos/` with an empty user config, does not report `ignore-scripts` as `true`. This catches an `npm_config_ignore_scripts` environment override too.
348
+
349
+ `test/supply-chain.test.ts` proves each failure case and the pass case.
350
+
351
+ Changes: to add a package to the exception, or to change the esbuild version, the owner must make a new decision, and PRD 20 must record it. Agents may not extend the exception. An esbuild upgrade therefore needs an owner decision before the allow-list changes. Each release checks again whether the exception is still needed (see [Release Checks](#release-checks)).
352
+
353
+ ## CI Checks
354
+
355
+ The workflow `.github/workflows/buildos-ci.yml` runs on macOS, Linux, and Windows with Node 24, in `toolkits/buildos/`. It runs when a file its tests build, read, or ship changes: `toolkits/buildos/**`, `system/**`, `docs/**`, `guide/**`, the root `*.md` files, the root `justfile`, and `.github/**` (the workflows and `CODEOWNERS`; whole folders, because the link check and the guide tests read targets anywhere in them; `test/system-content.test.ts` fails when a test reads a path the filter leaves out). The deny-list check has its own workflow with no path filter ([Client-Name Deny-List Check](#client-name-deny-list-check)).
356
+
357
+ | Step | What it guards |
358
+ | --- | --- |
359
+ | `node scripts/check-dependencies.ts` (before install) | Fails when `package.json` gains any runtime dependency field entry or an install script (including a root `binding.gyp`, `"gypfile": true`, or `workspaces`), when a dev dependency has no exact version, when `.npmrc` or npm's effective value does not set `ignore-scripts=true`, or when the lockfile breaks the closed [Install-Script Exception](#install-script-exception). Uses only Node built-ins and the npm that ships with Node. |
360
+ | `npm ci --ignore-scripts` | Installs exactly the lockfile. No install script runs. |
361
+ | `node scripts/check-dependencies.ts --installed` (after install) | The same checks, plus every installed `package.json`: only `esbuild` 0.28.2 may declare an install lifecycle script, and only `postinstall`. Runs before every step that uses `node_modules`. |
362
+ | `node scripts/reproducible-pack.ts` | Two release builds of the commit, each from an empty `dist/`, must pack to the same SHA-256. A separate report-only job compares the tarball contents of the three systems. |
363
+ | `npm run typecheck` | Strict `tsc --noEmit`. |
364
+ | `npm test` | Contract tests on Node's built-in test runner (`node --test`), including the core and CLI boundary test. Node 24 runs the TypeScript test files directly with built-in type stripping. |
365
+ | `npm run build` | Builds the esbuild bundle. |
366
+ | `node dist/buildos.js version` | Smoke run of the bundle. |
367
+ | Golden parity from the installed tarball (macOS, Linux, and Windows) | Packs the package, installs the tarball with `--offline --ignore-scripts`, and runs every golden case under its own command name from npm's `.bin` entries: the links on macOS and Linux, and npm's real `.cmd` shims through `cmd.exe` on Windows. In this step, `test/golden/compare.test.ts` fails when a case would not start from the installed `node_modules/.bin`, and `test/package.test.ts` fails when the workflow stops running the step on every system. |
368
+ | `npm audit --audit-level=high` | Fails on a high or critical npm advisory. |
369
+ | Make Docs contract job: `test/make-docs-contract.test.ts`, then `scripts/make-docs-contract.ts` at both bounds of the pinned Make Docs range | The self-test fails the job when the check passes a stub with a renamed setup flag. The real check fails when `make-docs --version`, `make-docs setup --json` (every flag BuildOS passes, and the `status` field), or `make-docs project state status --json` (the `status` field) changes. |
370
+ | OSV job: gate self-check, `node --test test/osv-gate.test.ts` | Runs first. Fails the job when the gate does not fail on a high finding or a scanner error, or does not pass a low finding or a clean scan. |
371
+ | OSV job: `osv-scanner` 2.7.1 on `toolkits/buildos/package-lock.json`, then `scripts/osv-gate.ts --exit-code <scanner exit code>` | Fails on a high or critical OSV finding (CVSS 7.0 or more). A finding with no score also fails, so a person reviews it. Also fails when the scan did not complete; see [OSV Gate](#osv-gate). |
372
+
373
+ GitHub Actions are pinned to full commit SHAs. The workflow has read-only `contents` permission, and checkout does not keep credentials.
374
+
375
+ ### OSV Gate
376
+
377
+ The OSV job downloads the `osv-scanner` 2.7.1 Linux binary from the GitHub release and checks it against a pinned SHA-256 before it runs. It does not use the `osv-scanner-action` container, because that container is pulled by a moving tag and hides the scanner exit code.
378
+
379
+ The scanner exit code is the only proof that the scan completed. When the scanner cannot reach the OSV API, it exits 127 and writes `{"results": []}`, the same file as a clean scan. So `scripts/osv-gate.ts` takes the exit code and fails closed:
380
+
381
+ | Scanner exit code | Output | Gate |
382
+ | --- | --- | --- |
383
+ | `0` (clean) | parses, no findings | pass |
384
+ | `1` (findings) | parses, at least one finding | fail when any finding scores 7.0 or more or has no valid score; pass when all score below 7.0. A valid score is a CVSS score as CVSS writes it: `0.0` to `10.0` with at most one decimal place, and no sign, leading zero, space, exponent, or other text. So `6.99`, `07.0`, and `7e0` count as no score and fail |
385
+ | `0` or `1` | missing, unreadable, not JSON, no `results` array, or findings that disagree with the exit code | fail |
386
+ | `127` (general error, such as an unreachable API), `128` (no packages found), any other code, or no code | any | fail |
387
+
388
+ `test/osv-gate.test.ts` checks each row with real, trimmed `osv-scanner` 2.7.1 outputs in `test/fixtures/osv/`: findings above the threshold fail, findings below it pass, an unreachable API (exit 127, empty results) fails, and a clean scan passes. The OSV job runs this test as a self-check before the real scan. The release workflow uses the same gate.
389
+
390
+ ## Client-Name Deny-List Check
391
+
392
+ BuildOS files must never name a client. `scripts/check-deny-list.mjs` fails when a file names a client on the maintained deny list. The list itself names clients, so it is never committed, shipped, written to a file, or printed. This document names no client and no term on the list.
393
+
394
+ - Source: the environment variable `BUILDOS_DENY_LIST` (one term per line, or comma separated; each term at least 3 characters). In CI and in the release workflow it comes from the environment secret `BUILDOS_DENY_LIST_ENV` of the GitHub environment `buildos-deny-list`, whose deployment refs are the default branch and the `v*` tags, and it is passed only to the one step that runs the check. No repository or organization secret has that name, so none can stand in for it when the environment has no secret; the job then fails closed, and the scanner's message names the environment and the secret. Before the scan, the job checks through the GitHub API that the environment deploys from exactly the default branch and `v*` tags. For local use, `--list-file <path>` reads a file that must be outside the scanned folder.
395
+ - No list: exit 2, "deny list not provided" (fail closed). An empty secret counts as no list. Outside CI only, `--allow-missing` skips the check with a notice; with `CI` or `GITHUB_ACTIONS` set, a missing list always fails.
396
+ - Scan set: every file git tracks or would track in the repository (tracked files and untracked files that `.gitignore` does not exclude; never `.git/`), so `system/`, `docs/`, and every test fixture; plus either every file inside a built npm tarball (`--tarball <file>`), read from the tarball as data and printed as `[tarball]/<path in the package>`, or (local use) every file that `npm pack --dry-run` lists for the package (`--pack`), including the built `dist/system/`. CI and the release workflow use `--tarball`, so npm never runs in the scanned folder. Each package file is opened by its own disk path, kept apart from the path the check prints, so a package folder on another drive (such as a staged package in the Windows temporary folder) is read too. With `--pack` or `--tarball`, the check fails when a listed package file cannot be read or when the list is empty, and the summary says `<n> of <m> package files read`; a package file outside `--root` is printed as `[package]/<path in the package>`.
397
+ - Matching: case-insensitive substring after Unicode NFKC folding, with each run of white space read as one space, so a term split across lines still matches. Cross-line matching works at any file size: the text is folded in windows that overlap by more than the longest term. Substring rather than whole word, so a term inside an identifier, a path, or a URL still matches; a longer word that holds a term is a false positive that the maintainer rewords. File, folder, and archive member names are checked.
398
+ - File types: ZIP-based files (`.docx`, `.xlsx`, `.pptx`, `.zip`, and any file with a ZIP header) are opened with Node's built-in `zlib` (stored and deflated members; an encrypted or ZIP64 archive counts as not fully read), and each member is checked (three levels deep, 256 MiB per member). The archive comment, each member comment, and each central and local extra field are read too (as raw bytes, below), and never printed. An XML file or member (an XML name such as `.xml` or `.rels`, or a file that starts with an XML declaration) is read in its declared encoding: a byte order mark (UTF-8, UTF-16LE, UTF-16BE), UTF-16 found from a leading `<` with a zero byte, or the declaration's `encoding`, else UTF-8. It is checked as full text and as visible text. Visible text joins the actual text nodes and ignores the markup and the formatting white space between elements: in an Office or OpenDocument part, the characters inside text runs (`w:t`, `a:t`, `t` in `.xlsx` shared strings and inline strings, ODF paragraphs) of each paragraph, cell, row, or string item make one line, so a term split across runs and across indentation still matches; in any other XML, text nodes join when one element holds the other or both sit in an element with text of its own. Office document properties (`docProps/*.xml`) are members and are read this way. PDF: every Flate stream is inflated (XMP metadata and object streams), and every string object is decoded (literal strings with their escapes, hex strings, UTF-16BE with a byte order mark), which is where the document information (Title, Author, and the rest) is kept. PNG: `tEXt`, `zTXt` (inflated), and `iTXt` (UTF-8, inflated when compressed) chunks are decoded. Text with a UTF-16 byte order mark is decoded as text. Any other binary file, JPEG included, is checked as raw bytes: UTF-8, Latin-1, and UTF-16LE and UTF-16BE at both byte alignments, which covers JPEG `COM`, EXIF (including its UTF-16 fields), and XMP segments.
399
+ - Encoded forms: every text the check reads, in any file type (XML attribute values and text nodes included, so an `.xlsx` sheet name in `xl/workbook.xml` and HTML-escaped text inside a CSV field are covered), is checked raw, then once with XML and HTML character references decoded (the named references `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&apos;`, and `&nbsp;`, and decimal and hex numeric references), then once percent-decoded (`%XX` runs read as UTF-8, `+` as a space, as in a URL query). The term and the text are folded the same way. A decoded line break becomes a space, so line numbers stay; a match only in a decoded form prints `:decoded <line>` or `:url-decoded <line>`. File, folder, and member names and every printed path part are checked and redacted in the same decoded forms.
400
+ - Home-folder paths: every file, member, and name is also checked for a path inside a personal home folder (`/Users/<name>/`, `/home/<name>/`, `<drive>:\Users\<name>\`, or a UNC profile `\\<server>\Users\<name>\` or `\\<server>\<drive>$\Users\<name>\`, with escaped backslashes or slashes too), such as a build path that a compiled binary keeps. The profile name is read as one whole path component in any script (so a name that only starts with an allowed word, or that starts with a non-ASCII letter, is still found); a Windows name with spaces is read up to the next separator. Placeholders that start with `<`, `$`, `%`, `{`, or `.` are not names. A few generic names are allowed: GitHub runner accounts (`runner`, `runneradmin`, `RUNNER~1`), shared folders (`Shared`, `Public`, `Default`), and documentation placeholders (`me`, `user`, `username`, `you`, `name`, `example`, `someone`). One dependency path is allowed: the bundled PDF reader (unpdf 2.1.0's pdf.js build, in `dist/buildos.js`) defines a simulated environment for its WebAssembly image decoder with a fixed `HOME` value. It is allowed only as that exact text, only in the package file `dist/buildos.js`; the same text in any other file, or a changed text, fails, and `test/deny-list.test.ts` fails when the dependency changes or drops it. A match fails the check and prints `deny-list: home folder path in <path>:<line>`; the folder name is never printed. This check needs no list, but it runs inside the same script, so it runs wherever the deny-list check runs.
401
+ - No silent skips: every file or archive member that is not fully read is counted in the summary by reason: a file over 256 MiB, an archive member over the member limit, an archive nested more than three levels deep, an archive that cannot be opened, a binary file read as raw bytes only, or a path that is not a regular file. Such a file or member in `system/` or in the package file list fails the check and is named (through the same redaction). A path that git lists but that is missing from the working tree is counted as missing.
402
+ - Output: `deny-list: match in <path>:<line>` (or `<path>!<member>:<line>` inside an archive, `:text <n>` for the nth paragraph of visible text, `:name` for a name), and a count summary. One function prints every location: each part of every path, archive members and nested archives included, is shown as `[name on the deny list]` when it matches a term and as `[home folder name]` when it is a personal home folder name. The matched term, the line text, an unknown command-line argument, and error messages are never printed; an internal error, including an uncaught error or a rejected promise, prints only its kind, and debug options such as `NODE_DEBUG` or `--trace-uncaught` add no term or stack to the output (`test/deny-list.test.ts`). The list is removed from the environment of the `git` and `npm` processes the script starts. GitHub's secret masking is a second guard, not the only one.
403
+ - Where it runs: `.github/workflows/buildos-deny-list.yml`, on every push and pull request with no path filter. The job "Deny list (invented list, every push and pull request)" runs everywhere, forks included, with no secret: the self-test `test/deny-list.test.ts` (invented terms only), a build and pack (`scripts/pack-for-scan.ts`), and the scanner over the repository and the tarball with an invented list. It is the check to require on pull requests. The job "Deny list (real list, default branch only)" runs the real list only on pushes to the default branch (and runs started there by hand), in the environment `buildos-deny-list`; it runs only the environment check and the scanner, with Node built-in modules, over the checkout and the tarball from the first job. It is skipped on pull requests, so it must not be a required check (GitHub counts a skipped required check as passing). Every other ref gets a notice that the real list runs after merge and in the release workflow. The release workflow runs it again in prepare and release runs, from the default branch's scanner, on the candidate tree and the reviewed tarball, before attaching and before staging. A maintainer can run it before pushing: `node scripts/check-deny-list.mjs --root ../.. --pack . --list-file <file outside the repository>`. A run on the default branch without the secret fails.
404
+ - What it does not find: see [Known Limits and Out of Scope](#known-limits-and-out-of-scope).
405
+
406
+ ## Input Limits
407
+
408
+ ### Intake Input Limits
409
+
410
+ Every file `buildos intake convert` reads is untrusted. Each limit below is far above what a real office document, web page, or PDF needs. A source over a limit fails with exit 1 and `buildos-intake: error: <format>: <what> exceeds the BuildOS input limit (<limit>)`, in the same class as Go's "not a valid zip file" or "XML syntax error" failures, before any side artifact or twin is written (the whole source is read and checked first). The values are the constants in `src/core/intake/limits.ts`. `test/intake-hostile.test.ts` runs each hostile case (ZIP bombs, unsafe entry names, too many entries, billion laughs, an external entity, deep XML, HTML 100,000 levels deep, a huge sparse XLSX cell reference, too many cells, and too many PDF pages) through the real CLI with a 256 MiB heap and checks the clean failure, the time budget, a peak resident memory under 1 GiB, and that nothing is written in or beside the project. Production-scale cases run at or past each real limit: 2,000,000 attributes on one element, a 20 MiB attribute, 1,080,000 attributes and 1,000,001 sibling elements in a parsed part, 9,000 overlapping ZIP entries, 2,000,001 shared strings, 65 MiB of shared string text, one 1 MiB shared string in 200 cells, and one PDF page with 70 million characters. One known limit is in pdf.js (see [Known Limits and Out of Scope](#known-limits-and-out-of-scope)).
411
+
412
+ | Input | Limit | How it is enforced |
413
+ | --- | --- | --- |
414
+ | ZIP entries (DOCX, XLSX) | 10,000 entries | Counted from the central directory before any entry is read |
415
+ | ZIP entry names | No `..` part, absolute path, drive letter, backslash, or NUL | Every name is checked from the central directory; one unsafe name refuses the archive (`zip: insecure file path "<name>"`) |
416
+ | One ZIP entry, expanded | 256 MiB | Checked on the declared size first, then on the real inflated output, which also may not pass the declared size (`zip: not a valid zip file`, as Go) |
417
+ | All ZIP entries read, expanded | 512 MiB | Summed over the entries the converter reads; only the parts it uses are inflated |
418
+ | ZIP compression ratio | 250 to 1, for an entry over 1 MiB | Declared size over compressed size, before inflating |
419
+ | ZIP integrity | Go's CRC-32 check | `zip: checksum error`, as Go |
420
+ | XML nesting | 1,000 open elements | In the decoder, as each start tag is read |
421
+ | XML tree | 1,000,000 elements, attributes, and text runs | For the parts parsed into a tree (workbook, relationships, numbering); attributes are charged as the decoder reads each one. DOCX bodies, worksheets, and shared strings are streamed |
422
+ | XML attributes | 10,000 per element, and 16 MiB of names and values per element | In the decoder, as each attribute is read, in every part |
423
+ | XML entities | Only `&lt;`, `&gt;`, `&amp;`, `&apos;`, `&quot;`, and character references | As Go: a DTD is skipped, its entities are never expanded, and no external entity is loaded |
424
+ | HTML nesting | 512 open elements | In the parse5 tree adapter, as each node is inserted, so parse5's own work stays bounded |
425
+ | HTML nodes | 2,000,000 | In the parse5 tree adapter |
426
+ | XLSX columns | 16,384 per row (Excel's own last column, `XFD`) | From the cell references, before the row is allocated |
427
+ | XLSX rows | 1,048,576 per sheet (Excel's own limit) | As rows are read |
428
+ | XLSX cells | 20,000,000 allocated per sheet | Sum of row widths; each row is written to the CSV as soon as it is read |
429
+ | XLSX shared strings | 2,000,000 strings, and 64 Mi characters in all | As each string and each text run is read |
430
+ | XLSX CSV twin | 128 MiB per sheet | As each row is written (a shared string can repeat in every cell) |
431
+ | PDF pages | 5,000 | From the document's page count, before any page is read |
432
+ | PDF text | 64 Mi characters | As text runs are read; a page stops being read once the budget is spent |
433
+ | PDF object nesting | 1,000 nested arrays and dictionaries | In the cross-reference checks (a port of Go's `pdf.NewReader` checks) |
434
+ | PDF `/Prev` sections | 1,000 | In the cross-reference checks; Go follows a `/Prev` loop forever |
435
+
436
+ ### Validate Input Limits
437
+
438
+ `buildos validate` only reads. Every file it checks is untrusted. It reads each file through the filesystem port, once, from one open checked against the entry at the name and against its folder (`readFileLimited`, see [Read Safety](#read-safety)), with the bound below; a larger file is not read. It reads only regular files inside the project root. An entry at a checked name (a `.md` name under `playbooks/`, a `*playbook*.md` name in `.os/templates/`, the contract, the config, or a data file) that is a link, a pipe, a socket, or a device is never read and gives a finding. A link at any other name, also a folder link under `playbooks/`, is skipped: BuildOS never follows it, enters it, or looks through it to decide what it is. A folder link that leads out of the project is never read through. Text must be UTF-8 (one byte order mark at the start is ignored). Each of these cases, and each limit below, gives a finding (exit 4) or is skipped, never a crash or a read outside the project. The values are `VALIDATE_LIMITS` in `src/core/validate/validate.ts`, `YAML_MAX_DEPTH` in `yaml-subset.ts`, and `JSON_MAX_DEPTH` in `checks.ts`; `test/validate.test.ts` runs each hostile case (oversized files, YAML block and inline list nesting, a 100,000-level inline list, a 200,000-level JSON line, links in and out of the root, a pipe at a checked name, bytes that are not UTF-8, CRLF, byte order marks, deep folders, a findings flood, and one row with 10,001 bad references).
439
+
440
+ | Limit | Value | Checked |
441
+ | --- | --- | --- |
442
+ | Config contract and config file | 1 MiB each | Before the file is read |
443
+ | One scoped Markdown file | 4 MiB | Before the file is read |
444
+ | One entity data file | 128 MiB | Before the file is read |
445
+ | YAML nesting (config, frontmatter) | 64 levels, block levels and inline list levels together | As blocks and inline lists open |
446
+ | JSON nesting (one data line) | 512 levels | Before the line is parsed |
447
+ | Folder depth under `playbooks/` | 32 levels | As folders are listed |
448
+ | Markdown files checked | 10,000 | As files are listed |
449
+ | Findings reported | 10,000 | In the collector: no check builds more; every loop over values, lines, and entries under `playbooks/` stops once the budget is spent, and the walk under `playbooks/` stops; the one listing of `.os/templates/` (a single folder, not walked) is read whole and does not check the findings budget, and each matching name counts toward the 10,000-file limit (follow-up F-P7-05); the result says it stopped (`truncated`). Data file lines are made one at a time from the bounded text, never split into one array |
450
+
451
+ The removed Python validator read every file whole, followed links (also out of the project), and crashed on deep nesting and on bytes that are not UTF-8.
452
+
453
+ ## Read Safety
454
+
455
+ ### Size Bounds
456
+
457
+ Every file read in `src/core/**` has a size bound. The port's `readBytes` and `readText` take the bound as a required argument: they open the file once, check that the opened file is a regular file no larger than the bound (`fstat`), and read at most one byte more than the bound from that open, so a file that grows while it is read is refused too. A larger file throws `EFBIG` with the bound, no byte of it is kept, and the command fails with `read <path>: file too large: BuildOS reads at most <bound> from one such file` (exit 1 in the Go-shaped domains; a read diagnostic in `entities`). A folder fails as Go's read does. The bounds are `READ_LIMITS` in `src/core/shared/read-limits.ts`:
458
+
459
+ | Read | Bound | Read sites |
460
+ | --- | --- | --- |
461
+ | Data: a JSONL dataset, a JSON index, a consolidation manifest | 128 MiB | entities (graph load, index check and rebuild, consolidation datasets and manifest); discovery (playbook index, run and finding indexes); design (findings index, rollback compare) |
462
+ | Document read whole by discovery or design | 64 MiB | discovery evidence and raw finding text, raw finding reference; design qualification file and finding record |
463
+ | Make Docs design input | 4 MiB | design promotion (router, workflow, contract, template, prompt; legacy `docs/assets/` too) |
464
+ | Intake file | 512 MiB | intake convert sources (each file of an HTML folder too, also for its hash), converted twins read by `index references`, playbooks read by `index playbooks`, the previous references index. Each format's own limits then apply ([Intake Input Limits](#intake-input-limits)) |
465
+
466
+ The evidence copy of `discovery run` is a streaming copy (`openRead`, 8 MiB at a time, never held whole), so its memory is bounded; it has no size bound, as Go's `io.Copy`, because the user names the file and its bytes go only to a new file in the project. The audit of every read site is in the W1 R7 evidence report, section P7 Review Round 2.
467
+
468
+ ### Contained Reads
469
+
470
+ A bounded content read (`readFileLimited`: `buildos validate`, the shared files and the manifest of `buildos init`, and the design inputs) is always contained, also with `--allow-outside-root`. It does the same folder checks as a write. It checks the folder's real path (inside the root), then takes the folder's identity (device and inode), looks at the entry at the name without following a link (`lstat`), and opens it with `O_NOFOLLOW`. After the open, the folder must still have the same real path, inside the root, and the same identity; the opened file must be a regular file with the identity the `lstat` saw; and the name must still be that file. Else the read is refused (exit 3, or an `outside_root` finding in `buildos validate`), and no byte of it is used. `test/fs-port.test.ts` swaps the folder for a link to an outside folder between the folder check and the open, through a test-only hook, and shows that the read is refused, also with `--allow-outside-root`. On Windows the same checks run (Node gives a folder's file ID through `stat`); the CI job runs the read tests that need no symlink.
471
+
472
+ ### Paths Outside the Project
473
+
474
+ The Go-shaped domains (intake, discovery, design, and the entity manifest) keep the read rule the owner approved in parity exceptions PE-010 and PE-012: a path the user names, or that an index names, may be outside the project root, as Go read it, through a read-only port bound to the volume; the size bound applies there too.
475
+
476
+ - Design inputs: `buildos design promote` reads each Make Docs design input, legacy ones too, through a port bound to the project root (`GoFiles.readContained`, `readFileLimited` with `followLinkInRoot`). The entry at the name is looked at without following it. A regular file is read with every check above. A link is read only when its real path is a regular file inside the root: the file at that real path is read with the same checks, and the link must still resolve to it after the read. A link that leads out of the root, or to a device, is refused (exit 3); a dangling link or a folder counts as a missing input. A file over 4 MiB stops the command with the size message (exit 1) and never falls back to a legacy body, and `--allow-outside-root` does not change these reads. The one exception is a write-destination case that an approved edge golden pins (`design-designs-link-outside-allowed`, PE-012): with the switch, when the designs folder itself is a link out of the root, the router `AGENTS.md` in it (a regular file, not a link) is read through that folder link, bounded (`GoFiles.readInWriteFolder`). A refused read never names the switch in its message.
477
+ - Entity graph: discovery and design load `.os/data/` through a port bound to the project root (`GoFiles.openEntityRoot`), in every mode, as `entities` does (PE-007): a data folder or dataset that leads out of the root is refused (exit 3). One narrow case keeps Go's read, because approved edge goldens pin it (PE-014: `discovery-runs-index-link-outside`, `design-index-link-outside`): the index the command replaces (`runs.jsonl` for a run, `findings.jsonl` for a finding or a promotion) may be a link at its own name to a file outside the root, in a folder inside the root; the command replaces that link with a regular file and never writes through it.
478
+ - HTML images (parity exception PE-018, approved 2026-11-24): an HTML document is untrusted, and Go read any path its `<img src>` named and copied the bytes into the project. `intake convert` reads a local image only through a port bound to an allowed folder: first the folder that holds the HTML file (for an HTML folder source, the selected folder), then the project root. The path must be inside that folder as spelled, and its real path after every link must be inside it too, so a link never leads the read out. Any other image (an absolute path or a `../` path outside both, or a link out of them) is not read; an image over 512 MiB is not read either. Each gets Go's `[Uncopied image: ...](...)` marker and one stderr line with the reason; the marker keeps the address as the document gives it, which is relative to the document, not to the converted file, and the warning says so; the command exits 0. The address is percent-decoded once before the containment check (`my%20image.png` names `my image.png`, and an encoded `..%2F` is refused like `../`); when no file has the decoded name, the address as written is tried, as Go read it; an address with an invalid escape is used as written; an address that decodes to a zero byte is not read. `--allow-outside-root` does not widen this. `http(s):`, `data:`, and `file://` sources are handled as in Go.
479
+
480
+ ### Read-Back Sizes and Row Limits
481
+
482
+ A file BuildOS writes and later reads back is checked against its reader's bound before the first write; a larger result stops the command (exit 4, `file_too_large_to_read_back`, the dry run too) and writes nothing. The writers: the discovery runs and findings indexes (128 MiB), the raw findings, finding, and qualification records (64 MiB); the promotion's findings index (128 MiB) and finding record (64 MiB); the intake playbooks index (128 MiB, discovery reads it), references index (512 MiB), and converted twins (512 MiB); the entity datasets of a consolidation and the entity-resolution index (128 MiB, also the index a consolidation rebuilds, checked before the canonical write). Not checked, because BuildOS never reads them back: the run record `run.md`, copied evidence, side artifacts, the design file, and the `buildos init` package files (fixed package content and a small manifest).
483
+
484
+ JSONL row limits (parity exception PE-019): a reader that scans a file line by line cannot read a line of its limit or more, so each row a command writes is checked against the line limit of every reader of that file before the first write and before a dry run reports success; a longer row stops the command (exit 4, `row_too_long_to_read_back`) and writes nothing. The writers and limits: `discovery run discovery` (the new `.os/data/runs.jsonl` row) and `discovery qualify finding` (the new `.os/data/findings.jsonl` row), 64 KiB, because the next run, `qualify finding`, and `design promote` read these files with Go's 64 KiB `bufio.Scanner` token; `design promote finding`, every row of the rewritten `.os/data/findings.jsonl`, 64 KiB; `entities consolidate`, every row of the dataset it rewrites, 64 KiB for `runs.jsonl` and `findings.jsonl` and 16 MiB for any other governed dataset (the entity graph's line limit). The `buildos-bulk-extract` skill helper applies the same limits before it publishes rows. No other command writes a JSONL file.
485
+
486
+ ## Write Safety
487
+
488
+ ### The Filesystem Port
489
+
490
+ Every write goes through the filesystem port in `src/adapters/node-fs.ts`. Before a write, the port checks the target's folder by its real path (after every symlink) and refuses a target outside the root, a device, a special file, or a file descriptor (exit 3) in every domain, unless the command is given `--allow-outside-root` (intake, discovery, and design; it relaxes only that containment check for write destinations, never a device, special-file, or file-descriptor refusal, and never a content read). A symlink at the written file itself is replaced, never followed. Node has no `openat`, so the port cannot open a file relative to a folder it holds open. It does the strongest check Node allows:
491
+
492
+ - The in-place writer (intake twins, side artifacts, and indexes) opens the file with `O_NOFOLLOW` and never with `O_TRUNC`. An existing file is opened without `O_CREAT`; a new file is created with `O_CREAT` and `O_EXCL`.
493
+ - After the open, the port checks the opened file with `fstat`: it must be a regular file with one hard link. Then it resolves the folder's real path again. The folder must have the same real path and the same device and inode as before the open, and must still be allowed (inside the root, or reached through a link with `--allow-outside-root`). The name in the folder must still be the opened file (same device and inode). Only then does the port truncate the file and write through the open descriptor. A refused write removes a file it created.
494
+ - The atomic write (canonical data) applies the same checks after it creates its temporary file (`O_CREAT`, `O_EXCL`, `O_NOFOLLOW`), again before the rename, and again after the rename. A port rename checks both folders before and after the rename.
495
+ - The exclusive create (`writeNewFile`: discovery and design records, evidence copies, and the design file) applies the same checks after its `O_CREAT`, `O_EXCL`, `O_NOFOLLOW` open, and removes its file when a check fails. The atomic symlink put (a promotion rollback) checks its folder before and after the rename, and `remove` checks its folder before it unlinks. The canonical-data port has no write in place: only intake output gets the in-place writer.
496
+ - Cleanup removes only what the same call or command created. A failed exclusive create, atomic write, symlink put, or in-place write removes its own new entry only when the folder path still names the folder it created the entry in (device and inode, taken right after the create) and the entry is still the one it made (device and inode, and file or link). When either changed, nothing is removed, and the refusal (exit 3) names the entry left in place. An exclusive create is complete only after its close succeeds; a failed close removes the new file. Discovery lists a record file or folder for its cleanup only after it created it, so a file another process put in the reserved folder is never removed.
497
+ - Windows: Node opens a folder for writing, where Go fails with `EISDIR`. The in-place writer and its preflight fail with Go's `open <path>: is a directory` before the open.
498
+ - Before the first write of an intake command, every destination is checked: its folder, and, when the file exists, its type, link count, and containment. A refused command leaves no new file.
499
+ - `test/fs-port.test.ts` swaps the folder for a symlink to an outside folder between the checks and the open (and the rename), through a test-only hook, and shows that each write is refused and that nothing lands outside the root.
500
+
501
+ ### `buildos init`: Shared Files
502
+
503
+ `buildos init` writes only inside the project folder and has no `--allow-outside-root`. It reads, changes, and writes back three user files at the project root: `AGENTS.md`, `CLAUDE.md`, and `.gitignore` (PRD 20 Project Initialization and Adoption). It changes only its own section and keeps every other byte; a rerun in a project that BuildOS already set up only refreshes a section that is there, and reports every other shared file with the reason it was not changed. Before any write of any kind (Make Docs included), it checks each of them: each file is read once per plan, from one open that is checked against the entry at the name, with a hard bound (`readFileLimited`; a file over 4 MiB, `SHARED_FILE_MAX_BYTES`, is not read), a file saved as UTF-16 or UTF-32 or holding a zero byte is not changed, and a link is never read or written through. A link stays as it is only when the operating system resolves it to another of the three files in the same folder (the same entry); any other link, inside or outside the root or dangling, stops the command (exit 10), so a user's link is never replaced by a regular file. The manifest and every file or link that an adoption replaces are read the same way, before Make Docs runs. A router file that BuildOS may not read stops only an operation that needs its text; for the Make Docs question its owner is then unknown, and it counts as one Make Docs did not write.
504
+
505
+ The proof that a section is BuildOS's is its integrity line, never where it sits. BuildOS writes `<!-- buildos:section v1 sha256=<hex> -->` (`# buildos:section v1 sha256=<hex>` in `.gitignore`) as the first line inside its section; the SHA-256 covers the exact text up to the end line, with each CRLF read as LF. BuildOS replaces a section only when that line is there and the hash matches, so it replaces only bytes that it wrote and that no one changed. A pair of marker lines without a valid integrity line is never replaced and never deleted: inside a code block, raw HTML block, or HTML comment it is the user's example, and outside every such region the command stops (exit 10) and names the file and line. More than one valid section, or marker lines outside every region that are not one pair, also stop the command. The region scan (fenced code; `<pre>`, `<script>`, `<style>`, and `<textarea>` opened anywhere in a line outside code spans and closed only by their own closing tag; HTML comments opened anywhere in a line and closed only by `-->`) is a second line of defense: when it is wrong, BuildOS still only adds bytes or stops, never changes or removes a byte of the user's. A file with no marker lines that ends inside a region that is never closed gets the section at its start instead of its end. A line ends at LF or CRLF only. A bare CR is text, never a line break and never marker padding, so BuildOS never drops it; a file whose buildos lines appear only when a bare CR is read as a line break stops the command before any write (exit 10). A section whose text is already current is not written, so it keeps every byte. A begin line inside a region starts an example that runs through the next end line. `test/init-review.test.ts` checks the section rules on 4,000 generated files, and `test/init-review-4.test.ts` checks the bare-CR rule on 3,000 generated files with a valid section. The init core loads no crypto module: it hashes through a port (`src/core/shared/hash-port.ts`) that the CLI passes in.
506
+
507
+ ### `buildos init`: Checks Before Any Write
508
+
509
+ A file that BuildOS would replace (a shared file that gets a section, or a Go-era wrapper or skill file, also a wrapper link that itself has more than one hard link) and that has more than one hard link stops the command before Make Docs runs (exit 10): the replace writes a new file and renames it over the name, which would split the name from the other names silently. The link count is part of what the write checks again right before the rename.
510
+
511
+ Before Make Docs runs, `buildos init` also checks that every folder it writes in allows a new entry (exit 5 when not). The check looks at the folder the create or rename acts in, never through a link in it. On macOS and Linux it is `access(W_OK | X_OK)`. No probe file is written. Windows has a limit here (see [Known Limits and Out of Scope](#known-limits-and-out-of-scope)).
512
+
513
+ Each replace passes what it expects to the port: the snapshot read before Make Docs ran (a file's bytes, permission bits, identity, and hard link count, or a link's text, identity, and its own permission bits where the operating system keeps them). After Make Docs ran, the second read of the folder must see every path BuildOS will write as the first read saw it (missing, a folder, or the same file or link); a path that appeared, went away, or changed stops the run before any write (exit 10), with the Make Docs result. Only the three shared files are read anew, because Make Docs may create or change them. An identity is the device and inode (the Windows file ID), kept as a 64-bit value; a file system that reports an inode of 0 gives no identity, and every check by identity then declines (also the port's lower-level checks of folders, opened files, and its own new entries, and the version helper's manifest read). The port compares the snapshot, with a bounded read and no link followed, as the last step before the rename, after the temporary file is written and closed. So an editor save or a `chmod` at any earlier time stops the run (exit 10), and the change stays. A shared file the plan keeps as it is, and a kept link, are checked again before the run reports success. The write keeps the file's full permission bits (setuid, setgid, sticky). An adoption keeps a replaced file's own permission bits and adds the owner-execute bit, so the wrapper runs.
514
+
515
+ ### `buildos init`: Journal and Undo
516
+
517
+ Every step is journaled with the identity (device and inode, or the Windows file ID) of the entry it made, and for a file the bytes and permission bits it wrote; for a replaced entry also what was there before (a file's bytes and mode, or a link's text and mode). A write that took effect and then failed in a later part (the parent folder flush after the rename) reports the entry it committed, so it is journaled and undone too. A failure undoes the journal in reverse: a replaced entry gets its earlier file or link back, and a created entry is removed, each only when the entry still has exactly the identity, bytes, and permission bits this run wrote (the port checks them right before the unlink or rename). A later change by the user, also a save in place that keeps the identity, is kept. Each path that cannot be put back, and each temporary file a failed write could not remove, is listed with its exact path in the human and JSON output; the run then exits 10 with `write_status` `partially_applied`. The list tells a real leftover (`state` `left`) from an earlier file that BuildOS did put back but whose save to disk it could not confirm (`state` `unsure`, the folder flush after the rename failed); a created entry that is already gone is not listed, because the path is as it was; and a folder that BuildOS made but could not read back is journaled and listed, never forgotten. The undo has limits (see [Known Limits and Out of Scope](#known-limits-and-out-of-scope)).
518
+
519
+ ## Known Limits and Out of Scope
520
+
521
+ These are the limits of the guarantees above. Each is tracked in the W1 R7 evidence report.
522
+
523
+ Threat model: BuildOS treats every input file as untrusted. A local process that can already change the project folder while a BuildOS command runs is outside the threat model. So are a compromised Node.js, npm, or operating system.
524
+
525
+ - Time-of-check windows. Node has no `openat`, no `renameat2` with an expected inode, and no Windows equivalent, so these windows stay open; closing them needs operating-system support that Node does not offer. (1) A process that swaps a folder out of the project before a bounded read's open, and swaps it back and out again timed exactly around each check after the open, can still make BuildOS read one outside file. A swap that stays in place, or that is undone once, is always refused, because the read checks the folder and then the name after the open. (2) After a rename, the port can only report a folder swap (exit 3), not undo it. (3) In `buildos init`, a change made in the short time between the port's last check of a destination and the rename itself is not seen, and that change is replaced. (4) The same short window lies between the identity check and the unlink or rename of an undo step.
526
+ - Crash or power loss. The `buildos init` undo runs in the same process, so a crash or power loss in the middle of a run is not undone. Each single write is still atomic: a file is either the old one or the new one.
527
+ - Extended ACLs and extended attributes (follow-up F-P6-01). A replace writes a new file and renames it over the old one, so the new file keeps the POSIX permission bits (BuildOS sets them) but not the old file's extended ACLs (for example a macOS deny-write entry) or extended attributes. Node.js has no API to read or copy them, and BuildOS starts no ACL tool. Writing in place under a checked handle would keep them, but a crash in the middle of such a write leaves a half-written user file, which breaks the promise that a write is atomic and that a failed run restores every byte, so BuildOS keeps the rename. A user who relies on an ACL on `AGENTS.md`, `CLAUDE.md`, `.gitignore`, or a Go-era wrapper should set it again after `buildos init`.
528
+ - Windows folder permission check. On Windows, Node.js has no check of a folder's access rules (ACLs): `fs.access` there only looks at the read-only attribute, which Windows ignores on folders. So on Windows `buildos init` checks only a folder's existence, type, and place inside the project before it writes. A folder that denies the write is found only by the write itself, after Make Docs ran; the run is then undone and reported with the Make Docs result (exit 5).
529
+ - Windows hard link count. The hard link check uses the count that Node.js reports for NTFS. A file system without hard links (FAT, exFAT) and some network shares report one link, so there the check cannot see a link.
530
+ - Windows command line limit. Command Prompt takes at most 8,191 characters on one command line. The `npx` fallback on Windows starts `npx.cmd` through `cmd.exe`, so before it starts, the helper checks the `cmd.exe` line and the line that npm's `npx.cmd` builds from it (twice the `npx.cmd` path, 600 characters for npm's own paths, and the arguments). The 600 characters are an estimate: npm's `npx.cmd` takes its `npx-cli.js` path from `npm prefix -g`, which the helper cannot know without starting a program, so a line close to the limit can be refused although it fits (follow-up F-P8-08). When either is longer than 8,191 characters, the wrapper starts nothing, prints one plain message that names the limit, and exits 2. Shorter arguments work, and so does a local install of the pinned version, which starts with Node.js directly and has no such limit.
531
+ - Windows wrappers and shown commands. Command Prompt reads `%*` as one piece of text, so an argument that the user typed with an escaped `&`, `|`, `<`, or `>` outside quotes is split there, as with every npm `.cmd` shim. For the same reason, an argument with an odd number of double quotes (`"`) changes the quote state for the rest of that text, so a later argument with `&`, `|`, `<`, `>`, or `^` is read as a command character; put such an argument last, or run `npx` directly. An argument with an even number of double quotes, an empty argument, and a folder name with `%TEMP%` in it pass unchanged (`test/wrappers.test.ts`, Windows only). The commands that `buildos init` shows on Windows are for Command Prompt with its default settings: with delayed expansion on (`cmd /v:on`), a `!` in a folder name in such a command would still be read as a variable, and no one spelling of `!` works both with it on and off. BuildOS shows no PowerShell form.
532
+ - pdf.js and one very long string. pdf.js reads one text string of a content stream whole, so a single string of tens of millions of characters (which a small compressed PDF can hold) can exhaust a 256 MiB heap inside pdf.js before the text budget sees it. With Node's default heap (checked on macOS arm64, a 68 MB PDF with one 68-million-character string), it fails at the text budget, exit 1, after 16 s.
533
+ - Findings budget of `buildos validate` (follow-up F-P7-05). The one listing of `.os/templates/` is read whole and does not check the findings budget.
534
+ - What the deny-list check does not find: look-alike characters (homoglyphs) that NFKC does not fold, such as a Cyrillic letter in place of a Latin one; text drawn in the pixels of an image (only names and metadata are read); compressed data of any kind not named above (for example a compressed EXIF block in another format); a term split across two JPEG segments; text in a PDF stream that is not Flate-compressed or that a font maps to other characters; a term split across two table cells or two text boxes, or across two sibling elements of generic XML whose parent has no text of its own; a name encoded twice (for example `&amp;amp;`) or with an HTML named reference other than the six it reads (follow-up F-P7-07); content past three archive levels (counted as not fully scanned); and git history.
535
+ - Git history. The check scans the current files, not old commits. The public repository has one clean commit as its first commit, and the deny-list check with the real list runs on that tree before the first push (Owner Settings for Releases, step 5). Only `main` is pushed, and the remote is checked to hold one commit, one branch, and no tag (steps 6 and 16). The old history, which holds client text that was removed and two removed Go binaries with a personal build path, stays only in the private archive repository `brucewaynedecoy/build-os-archive` (owner decision of 2026-11-25). Commit hashes in these docs from before the public repository (for example the frozen Go baseline `263f5ca`) name commits of the earlier history, which exists only in the private archive repository `brucewaynedecoy/build-os-archive`: the public repository starts from one clean commit (owner decision of 2026-11-25).
536
+ - Skill scripts. BuildOS never runs the scripts in `.os/skills/`. An agent may run them at the user's request, with the user's own Python or Node.js. Their safety rules are their own; the deny-list check scans them.
537
+ - Out of scope for this release: an MCP server, standalone executables with Node embedded, `buildos update`, `buildos uninstall`, project sync, and OCR for scanned PDFs.
538
+
539
+ ## Reporting a Vulnerability
540
+
541
+ Do not open a public issue or pull request for a security problem. Report it privately through GitHub private vulnerability reporting: `https://github.com/brucewaynedecoy/build-os/security/advisories/new` (the **Security** tab of the repository, then **Report a vulnerability**). Include the BuildOS version (`buildos version --json`), the operating system, the command you ran, and what you saw.
542
+
543
+ The maintainer reviews reports for the current npm release and the `main` branch, and coordinates any fix and disclosure through the private advisory. There is no promised response time or release date. A fix ships as a new release; see [Rollback by Version Pin](#rollback-by-version-pin) to move off an affected version.
544
+
545
+ ## Admission Checklist
546
+
547
+ Every new outside package must pass this checklist in the change that adds it. The same change updates this document and, for bundled code, `THIRD_PARTY_NOTICES.md`.
548
+
549
+ - [ ] Node has no built-in module that can do the job. The reason is written down.
550
+ - [ ] The package is widely used and actively maintained. Evidence: download count, recent release, open-issue response.
551
+ - [ ] The license is MIT, Apache-2.0, BSD, or ISC, for the package and for every transitive package.
552
+ - [ ] The package has few or no dependencies. The transitive count is recorded.
553
+ - [ ] The version is exact in `package.json` and recorded in `package-lock.json`.
554
+ - [ ] No install script. The only exception is `esbuild` 0.28.2; see [Install-Script Exception](#install-script-exception). A package with an install script cannot be admitted without a new owner decision recorded in PRD 20.
555
+ - [ ] `npm audit --audit-level=high` and the OSV scan pass with no high or critical finding.
556
+ - [ ] A runtime package is bundled by esbuild and is not a `dependencies` entry.
557
+ - [ ] This document lists the package in the right section and in the inventory, the SBOM check passes, and the scan record is current.
558
+
559
+ ## Scan Record
560
+
561
+ | Date | Tool | Scope | Result |
562
+ | --- | --- | --- | --- |
563
+ | 2026-11-23 | `npm audit --audit-level=high` (npm 11.19.1, Node 24.22.3) | `package-lock.json` | 0 vulnerabilities, exit 0 |
564
+ | 2026-11-23 | OSV API `querybatch` request with every lockfile package name and version | 50 lockfile packages, plus a `lodash` 4.17.20 control | 0 advisories for lockfile packages; the control returned 4 advisories, which shows the query works |
565
+ | 2026-11-23 | `osv-scanner` 2.7.1 (`osv-scanner_darwin_arm64`, release checksum verified), run locally | `package-lock.json`, plus a `lodash` 4.17.20 control lockfile | 50 packages scanned, 0 findings, exit 0; the control exited 1 with 4 findings (5.3, 6.9, 7.2, 8.1). With the OSV API unreachable, the same scan exited 127 with empty results. |
566
+ | 2026-11-23 | `osv-scanner` 2.7.1 (`osv-scanner_linux_amd64`, pinned SHA-256 checked) through the CI OSV job, [run 45282558470](https://github.com/brucewaynedecoy/build-os/actions/runs/45282558470) on `f505935` | `package-lock.json` | OSV job passed. The gate self-check passed, the scan found 50 packages, and the gate printed `scanner exit 0, 0 finding(s), 0 blocking: pass`. |
567
+ | 2026-11-23 | Admission scans (W1 R7 P4 t5): `npm audit` and the OSV API `querybatch`, each candidate installed alone with `--ignore-scripts` | `fflate`, `adm-zip`, `@xmldom/xmldom`, `txml`, `parse5`, `htmlparser2`, `unpdf`, `pdf2json` and their trees | 0 and 0 for every candidate |
568
+ | 2026-11-23 | `npm audit --audit-level=high` (Node 24.22.3), after the P4 packages were added | `package-lock.json`, 55 packages | 0 vulnerabilities, exit 0 |
569
+ | 2026-11-23 | OSV API `querybatch` with every lockfile package name and version, after the P4 packages were added | 55 lockfile packages | 0 advisories |
570
+ | 2026-11-23 | `npm uninstall @xmldom/xmldom --ignore-scripts` (P4 review fix round), then `npm audit --audit-level=high` | `package-lock.json`, 54 packages | 0 vulnerabilities, exit 0 |
571
+ | 2026-11-24 | `osv-scanner` 2.7.1 (`osv-scanner_linux_amd64`, pinned SHA-256 checked) through the CI OSV job, [run 45489678572](https://github.com/brucewaynedecoy/build-os/actions/runs/45489678572) on `42b9782` | `package-lock.json` | 54 packages scanned; the gate printed `scanner exit 0, 0 finding(s), 0 blocking: pass` |
572
+ | 2026-11-24 | `npm audit --audit-level=high` (npm 11.19.1, Node 24.22.3), on `548f4ea` | `package-lock.json`, 54 packages | 0 vulnerabilities, exit 0 |
573
+ | 2026-11-24 | `osv-scanner` 2.7.1 (`osv-scanner_darwin_arm64`, release checksum verified), run locally on `548f4ea`, with `scripts/osv-gate.ts` | `package-lock.json` | 54 packages scanned, exit 0; the gate printed `scanner exit 0, 0 finding(s), 0 blocking: pass` |
574
+
575
+ The OSV API request is not the `osv-scanner` tool. It checks the same package list against the same database. "Clean" in the tables of this document means no advisory in both `npm audit` and the OSV scan on the latest date above. Each release runs both scans again as release checks; the release evidence records their results.
576
+
577
+ ## Lockfile Inventory
578
+
579
+ Every package in `package-lock.json`, from `npm ls --all` and the lockfile. "Brought in by" names the direct dev dependency or dependencies whose tree holds the package. "Kind" shows platform packages and bundled packages; npm installs an optional platform package only on a matching machine. Only the four packages marked "bundled" ship, inside `dist/buildos.js`.
580
+
581
+ | Package | Version | License | Brought in by | Required by | Kind | Install script | Scan status |
582
+ | --- | --- | --- | --- | --- | --- | --- | --- |
583
+ | `@esbuild/aix-ppc64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, aix ppc64 | none | clean |
584
+ | `@esbuild/android-arm` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, android arm | none | clean |
585
+ | `@esbuild/android-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, android arm64 | none | clean |
586
+ | `@esbuild/android-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, android x64 | none | clean |
587
+ | `@esbuild/darwin-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, darwin arm64 | none | clean |
588
+ | `@esbuild/darwin-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, darwin x64 | none | clean |
589
+ | `@esbuild/freebsd-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, freebsd arm64 | none | clean |
590
+ | `@esbuild/freebsd-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, freebsd x64 | none | clean |
591
+ | `@esbuild/linux-arm` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux arm | none | clean |
592
+ | `@esbuild/linux-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux arm64 | none | clean |
593
+ | `@esbuild/linux-ia32` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux ia32 | none | clean |
594
+ | `@esbuild/linux-loong64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux loong64 | none | clean |
595
+ | `@esbuild/linux-mips64el` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux mips64el | none | clean |
596
+ | `@esbuild/linux-ppc64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux ppc64 | none | clean |
597
+ | `@esbuild/linux-riscv64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux riscv64 | none | clean |
598
+ | `@esbuild/linux-s390x` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux s390x | none | clean |
599
+ | `@esbuild/linux-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, linux x64 | none | clean |
600
+ | `@esbuild/netbsd-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, netbsd arm64 | none | clean |
601
+ | `@esbuild/netbsd-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, netbsd x64 | none | clean |
602
+ | `@esbuild/openbsd-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, openbsd arm64 | none | clean |
603
+ | `@esbuild/openbsd-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, openbsd x64 | none | clean |
604
+ | `@esbuild/openharmony-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, openharmony arm64 | none | clean |
605
+ | `@esbuild/sunos-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, sunos x64 | none | clean |
606
+ | `@esbuild/win32-arm64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, win32 arm64 | none | clean |
607
+ | `@esbuild/win32-ia32` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, win32 ia32 | none | clean |
608
+ | `@esbuild/win32-x64` | 0.28.2 | MIT | `esbuild` | `esbuild` | optional, win32 x64 | none | clean |
609
+ | `@types/node` | 24.19.2 | MIT | direct | `package.json` | required | none | clean |
610
+ | `@typescript/typescript-aix-ppc64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, aix ppc64 | none | clean |
611
+ | `@typescript/typescript-darwin-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, darwin arm64 | none | clean |
612
+ | `@typescript/typescript-darwin-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, darwin x64 | none | clean |
613
+ | `@typescript/typescript-freebsd-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, freebsd arm64 | none | clean |
614
+ | `@typescript/typescript-freebsd-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, freebsd x64 | none | clean |
615
+ | `@typescript/typescript-linux-arm` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux arm | none | clean |
616
+ | `@typescript/typescript-linux-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux arm64 | none | clean |
617
+ | `@typescript/typescript-linux-loong64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux loong64 | none | clean |
618
+ | `@typescript/typescript-linux-mips64el` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux mips64el | none | clean |
619
+ | `@typescript/typescript-linux-ppc64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux ppc64 | none | clean |
620
+ | `@typescript/typescript-linux-riscv64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux riscv64 | none | clean |
621
+ | `@typescript/typescript-linux-s390x` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux s390x | none | clean |
622
+ | `@typescript/typescript-linux-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, linux x64 | none | clean |
623
+ | `@typescript/typescript-netbsd-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, netbsd arm64 | none | clean |
624
+ | `@typescript/typescript-netbsd-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, netbsd x64 | none | clean |
625
+ | `@typescript/typescript-openbsd-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, openbsd arm64 | none | clean |
626
+ | `@typescript/typescript-openbsd-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, openbsd x64 | none | clean |
627
+ | `@typescript/typescript-sunos-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, sunos x64 | none | clean |
628
+ | `@typescript/typescript-win32-arm64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, win32 arm64 | none | clean |
629
+ | `@typescript/typescript-win32-x64` | 7.0.2 | Apache-2.0 | `typescript` | `typescript` | optional, win32 x64 | none | clean |
630
+ | `entities` | 9.0.0 | BSD-2-Clause | `parse5` | `parse5` | required, bundled | none | clean |
631
+ | `esbuild` | 0.28.2 | MIT | direct | `package.json` | required | declared, never run | clean |
632
+ | `fflate` | 0.8.3 | MIT | direct | `package.json` | required, bundled | none | clean |
633
+ | `parse5` | 8.1.1 | MIT | direct | `package.json` | required, bundled | none | clean |
634
+ | `typescript` | 7.0.2 | Apache-2.0 | direct | `package.json` | required | none | clean |
635
+ | `undici-types` | 7.24.6 | MIT | `@types/node` | `@types/node` | required | none | clean |
636
+ | `unpdf` | 2.1.0 | MIT (bundled pdf.js: Apache-2.0) | direct | `package.json` | required, bundled | none | clean |