omtex
aien-dev/omtex
Brought by drakestapleton
omtex / README.md
| 1 | # omtex: write papers in Omega, publish LaTeX and PDF |
| 2 | |
| 3 | ## Human-Directed Agentic Engineering |
| 4 | |
| 5 | Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, |
| 6 | architecture, constraints, acceptance criteria, and stopping points; agents implement, |
| 7 | execute checks, diagnose failures, and revise within those boundaries. Human review |
| 8 | retains responsibility for claims, acceptance, and release decisions. |
| 9 | |
| 10 | For the documented method and a systems-software case study, see Gregory M. Kurtzer, |
| 11 | [*Ginux: Building an Independent Kernel That Runs Linux Userspace through |
| 12 | Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.23682548). |
| 13 | |
| 14 | |
| 15 | omtex is an Omega library (`lib/omtex.om`). A paper is an Omega program that calls omtex words such as |
| 16 | `title`, `section`, `para`, `equation`, `figure`, `table`, `bibitem` and `omlisting`. Compiled with the |
| 17 | pinned seeded compiler, the program writes the paper's LaTeX to stdout. `pdflatex` then makes the PDF. |
| 18 | |
| 19 | - **Escaped or refused, never passed through.** Prose uses a small markup (`*emph*`, `**bold**`, |
| 20 | `` `code` ``, `$math$`, `[@cite]`, `[#ref]`, `"quotes"`, `~` tie). Everything else is escaped. A byte |
| 21 | the library cannot render safely stops the program with `omtex: refused element N: <reason> at byte B` |
| 22 | and exit 111. Math passes only a check: balanced braces, no `% $ #`, and no `\input`, `\write`, `\def` |
| 23 | or other deny-listed control sequences. |
| 24 | - **Omega listings are compiled.** `omlisting` bodies must compile with the pinned `omc` (rc 0). |
| 25 | `omrefuse N` + `omlisting` must be refused with error N. `omfragment` is shown and reported as |
| 26 | NOT_CHECKED. A failed check stops the build (exit 113). Highlighting uses an `Omega` `listings` |
| 27 | language generated from the compiler's own keyword table. |
| 28 | - **Deterministic.** The same source gives the same `.tex`, and with `SOURCE_DATE_EPOCH` the same PDF bytes. |
| 29 | |
| 30 | Design and rationale: [`docs/DESIGN.md`](docs/DESIGN.md). omtex is a library, not a `target latex` in omc. |
| 31 | |
| 32 | ## Quick start |
| 33 | |
| 34 | Needs Linux AArch64 (the pinned omc emits arm64 ELF), `git`, `sh`, and TeX Live with `cm-super` |
| 35 | (see [`DEPENDENCIES.md`](DEPENDENCIES.md)). |
| 36 | |
| 37 | ```sh |
| 38 | git clone https://github.com/aien-dev/omtex.git && cd omtex |
| 39 | tools/build.sh examples/hello/hello.om build/hello # fetches the pinned omc on first use |
| 40 | tests/run.sh # TESTS pass=59 fail=0 not_run=0 |
| 41 | ``` |
| 42 | |
| 43 | `tools/build.sh` checks the omc sha256 against `tools/pin.sh` and refuses any other compiler. Set `OMC` |
| 44 | to use an existing copy of the pinned `seed/out/omc`. The build: |
| 45 | |
| 46 | 1. concatenates `lib/omtex.om` with the paper (Omega has no imports yet) and compiles it; |
| 47 | 2. runs the program to produce `paper.tex`; |
| 48 | 3. runs `paper.gen check OMC DIR` to compile every Omega listing; |
| 49 | 4. runs `pdflatex` (and `bibtex` if the paper uses it) until references settle. An unresolved |
| 50 | reference fails the build. |
| 51 | |
| 52 | ## A paper |
| 53 | |
| 54 | ``` |
| 55 | text o1 "11pt" |
| 56 | text c1 "article" |
| 57 | text fe "fontenc" |
| 58 | text fo "T1" |
| 59 | text t1 "Hello from *Omega*" |
| 60 | text a1 "M. Drake Stapleton" |
| 61 | text s1 "Intro" |
| 62 | text l1 "sec:intro" |
| 63 | text p1 "Costs 5% & more_stuff, see Section[#sec:intro]; \"quoted\" and `a_b{c}` and $x^2 + y_{i}$ and **bold *nested* bold**." |
| 64 | fn main to int |
| 65 | docclass o1 c1 |
| 66 | usepkgo fo fe |
| 67 | title t1 |
| 68 | author a1 |
| 69 | begindoc |
| 70 | maketitle |
| 71 | sectionl s1 l1 |
| 72 | para p1 |
| 73 | enddoc |
| 74 | ret 0 |
| 75 | end |
| 76 | ``` |
| 77 | |
| 78 | This is `examples/hello/hello.om`. Each word takes the names of Omega `text` constants as arguments. |
| 79 | |
| 80 | | Phase | Words | |
| 81 | |---|---| |
| 82 | | preamble | `docclass opts cls`, `usepkg name`, `usepkgo opts name`, `preamble line`, `omlang`, `title`, `author`, `date` | |
| 83 | | document | `begindoc`, `maketitle`, `docabstract`, `enddoc` | |
| 84 | | structure | `section`, `sectionl t label`, `sectionn` (unnumbered), `subsection`, `subsectn` | |
| 85 | | text | `para`, `paran` (no indent), `prose` (does not end the paragraph), `parbreak`, `rawtex` (math-checked) | |
| 86 | | lists | `itemize`, `itemizeo opts`, `enumerate`, `item`, `endlist` | |
| 87 | | math | `equation`, `equationl label m`, `displaymath`, `align` | |
| 88 | | floats | `figure path caption label`, `table caption label spec`, `cell`, `row`, `hline`, `endtable` | |
| 89 | | references | `bibbegin`, `bibitem key text`, `bibtex style file` | |
| 90 | | listings | `codelang name`, `listing`, `omlisting`, `omrefuse rc`, `omfragment` (each `caption label body`) | |
| 91 | |
| 92 | Examples: |
| 93 | - `examples/omega-language`: reproduces the published *Omega* paper (Zenodo 23547811). |
| 94 | - `examples/turing-brief`: reproduces *The Turing* brief from aienos.com. |
| 95 | - `examples/listings`: feature tour, with listings checked by the compiler, a table, a figure, a |
| 96 | bibliography and math. |
| 97 | |
| 98 | ## Reproductions |
| 99 | |
| 100 | Both papers were reproduced from Omega source. In each case the PDF text matches the published PDF |
| 101 | with 0 differing lines, and every page is pixel-identical to the original `.tex` built with the same |
| 102 | pdfTeX. Details, including the remaining source-level differences, are in |
| 103 | [`evidence/REPRODUCTION.md`](evidence/REPRODUCTION.md). Run the comparison with `tools/compare.sh`. |
| 104 | |
| 105 | ## Zenodo |
| 106 | |
| 107 | `tools/zenodo-draft.sh` creates an unpublished draft (`new`) or a new-version draft of a published |
| 108 | record (`newversion`), uploads the PDF, and checks the md5. `show` and `discard` also exist. It |
| 109 | **never publishes**: any URL containing `publish` is refused, and the run fails unless the deposition is |
| 110 | still an unsubmitted draft afterwards. Publishing is done by a person in the Zenodo web UI. |
| 111 | |
| 112 | ```sh |
| 113 | atlas-vault run ZENODO_TOKEN -- sh tools/zenodo-draft.sh new build/listings/paper.pdf examples/listings/zenodo.json |
| 114 | atlas-vault run ZENODO_TOKEN -- sh tools/zenodo-draft.sh newversion 23547811 build/omega-language/paper.pdf |
| 115 | ``` |
| 116 | |
| 117 | `--sandbox` uses sandbox.zenodo.org with `ZENODO_SANDBOX_TOKEN`. Runs against zenodo.org are in |
| 118 | `evidence/zenodo-*.txt`. |
| 119 | |
| 120 | ## License |
| 121 | |
| 122 | Apache License 2.0 with LLVM Exceptions; see `LICENSE` and `NOTICE`. |