Arroyo is a Literate Programming system that sits on top of org-mode to make it easy for cross-file development of complex software. It is the pattern that is expressed in this arcology2go project, the prior arcology-django project and the Complete Computing Project. In general, it uses regular, bog standard org-babel, but it also expands upon it with blocks that are programmable on export.
The programmable blocks can be used, for example, to extract data values from org-mode tables and embed them as configuration. An HTML web view of the file presented by the Arcology web stack would show the configuration values as human legible tables, and the org-babel tooling will extract those in to the source code.
The programmable blocks can also be used to query the Roam Data Models to, for example, automatically generate import manifests for the software so that a single system can be spread across multiple per-feature org-mode files without a user needing to update the central registry.
It should be as simple as downloading a document or cloning a git repo, then clicking a button to give your computer cluster new powers. The document should not only declare how to install the software, but they could explain how to use it, present a table of keybindings and configurations, links and resources, all acting as the source of truth.
INPROGRESS Usage
→ Rebuild of the Complete Computer 0x02.22: This is (Not) Advanced
arroyo-system README.org file
mark locations where usernames etc need to be defined. consider making that programmable or informed by SOPs!
record screencast
Work Plan
The work is organized in to seven sprints. The priority is CCE migration: making the existing Complete Computing Environment work with the new Kotlin-based tooling before building outward-facing bootstrapping workflows. The tooling assumes an ~/org/ directory, indexed and cross-referenced by the roam-indexer.
DONE Sprint 1: Arroyo DB Schema + CLI Query Tool
The indexer captures ARROYO_* file properties into SQLDelight tables. A CLI exposes queries directly to stdout — no internal API needed yet, just callable from terminal or Emacs.
SQLDelight schema: unified
arroyo_keywordstable (PKfile, kw, value,node_id?) witharroyo_generator_rolesfor role registry andnode_ancestorsclosure table for property inheritance. Role inclusion/exclusion computed at query time via self-joins againstarroyo_keywordsandnode_ancestors— no per-module-type tables, no junction tables.IndexerPlugininterface extracted toroam/models.org— each domain (arroyo, quiz, tasks) provides its own pluginArroyoIndexerPluginextracted toarroyo/generators.org— single-phase: collect all ARROYO_* keywords from file properties, heading properties, and keyword lines; dispatch roles toarroyo_generator_roles, everything else toarroyo_keywords; populatenode_ancestorsclosure table for heading inheritanceRole semantics: no
ARROYO_SYSTEM_ROLE→ applies to ALL roles; explicit roles → only those roles;ARROYO_SYSTEM_EXCLUDE→ filtered out at query time. Roles inherit throughnode_ancestors— file-level roles apply to all headings; heading-scoped roles apply to that heading and children.Multi-valued keywords (e.g.
ARROYO_SYSTEM_ROLE: edge server) are split on whitespace and stored as separate rowsARROYO_MODULE_WANTEDsupport — inverse ofARROYO_MODULE_WANTS, stored alongside snippets; wants values are heading IDs resolved directlyCLI subcommands that query the DB and print results:
arcology nixos-modules --role server→ sorted import list to stdoutarcology home-modules --role endpoint→ sorted import listarcology emacs-snippets→ topologically ordered file pathsarcology emacs-epkgs→ Nix override blocksarcology keywords ARROYO_TANGLE_THIS→ file list
Tests against real CCE org files as fixtures
Results
Indexed 237 files from ~/org/cce/. All Arroyo tables populated:
| Table | Rows | Description |
|---|---|---|
| arroyo_keywords | 299 | Unified store for all ARROYO_* values (NIXOS_MODULE, HOME_MODULE, EMACS_MODULE, HOME_EPKGS, TANGLE_THIS, SYSTEM_EXCLUDE, MODULE_WANTS, INPUT, OUTPUT, SYSTEM_OVERLAY, etc.) with optional node_id for heading-scoped keywords |
| arroyo_generator_roles | 149 | System role assignments (endpoint, server, settop, edge, droid) with optional node_id for heading-scoped roles |
| node_ancestors | — | Closure table mapping each heading node to all ancestor headings for property inheritance |
Dependency resolution: 198 snippets have ARROYO_MODULE_WANTS, 13 have ARROYO_MODULE_WANTED. The emacs-snippets CLI topologically sorts by querying arroyo_keywords for =ARROYO_MODULE_WANTS=/=ARROYO_MODULE_WANTED= entries, resolving heading-ID wants to module names via nodeIdToModule maps, and adding reverse edges from wanted.
Four extraction paths cover all CCE formats:
Preamble
:PROPERTIES:drawer entries →fileProperties→ denormalized tablesPreamble =#+ARROYO_= keyword lines → regex scan of raw content 3. Heading-level =#+ARROYO_= keyword lines → recursive section body scan
Heading-level
:PROPERTIES:drawer entries →nodeProperties→ denormalized tables
Files created
arroyo/generators.org— noweb-decomposed: schema, repository, plugin, topological sort, CLI commands, testsarroyo/arroyo.org— work plan, sprint tracking, design decisions
Files modified
roam/models.org—IndexerPlugininterfaceroam/parser.org— implementedextractFileProperties()(was empty stub)roam/indexer.org— removedarroyoRepositoryparam, inline task/flashcard extraction; replaced with plugin invocation looproam/indexer-platform.org— wiredArroyoIndexerPlugin,QuizIndexerPluginin factoryroam/cli.org— registered 5 new subcommandsquiz/flashcard.org— addedQuizIndexerPluginarroyo/generators.org— fixedallKeywordsto includenodeProperties; fixedARROYO_EMACS_MODULEhandler to searchallKeywordsinstead offileProperties; added file-path-to-module-name resolution for =wants=/=wanted=; addedwantedreverse edges to topological sort; added tests for keyword-line format andwantedreverse edges
DONE Sprint 2: Table Integration + Parameterized Noweb
Org-mode tables are already parsed by orgmode-kmp (OrgChunk.OrgTable with header, subtables, formula line). The work is in the tangle layer: extracting tables as structured data, binding them to source blocks via :var, and supporting parameterized <<ref(arg)>> noweb calls.
Table extraction: convert
OrgTabletoList<List<String>>usingplainText()on each cell to strip org link syntax=:var tbl=tableName= parsing:
headerArgs["var"]already stored by the parser; split on = to extract (varName, tableName).tableNameresolves to a#+name:block of type OrgTable.<<ref(arg)>>parameterized noweb: extendOrgTangle.resolveNowebregex from<<([^>]+)>>to<<([^(>]+)(\(([^)]*)\))?>>. When a ref has an argument, pass the arg name through to the generator block's:varscope for execution of the code instead of for raw embedding.`:results raw` convention: blocks with
:results raw(the existing CCE convention) have their evaluated output embedded verbatim at the <<ref>> call site, not wrapped in delimiter comments. This is used to output org-mode syntax for tables of content, etc.Unit tests against real CCE table formats (rix-pkgs, wrapWine-pkgs, python-pkgs tables in arroyo-nix.org)
Results
Three changes in arroyo/core.org and six new tests shipped:
TangleModels— addedUnresolvedTableRef(tableName, inBlockName)warning type for parameterized noweb arg validationOrgParseUtils— addedNamedTabledata class (name + rows),collectNamedTables()(walks the document tree alongsidecollectNamedBlocks, collecting namedOrgTablechunks),OrgTable.toNestedList()(flattens header + subtables rows intoList<List<String>>viaplainText()cell stripping), andparseVarHeaderArg()(splits =:var tbl=tableName= into varName/tableName)OrgTangle— collectstableBlocksandvarBindingsmaps duringtangle();resolveNowebregex extended from<<([^>]+)>>to<<([^(>]+)(?:\\(([^)]*)\\))?>>capturing optional arguments; unresolved table args emitUnresolvedTableRefwarning but block body still expanded; plain<<ref>>(no args) still resolves correctlyTangleCommand— addedUnresolvedTableRefcase to the warning handlerSix new tests: named table collection, unnamed table skip,
<<gen-overlay(rix-pkgs)>>parameterized noweb, unresolved table warning, org-link stripping viaplainText(), and backward-compatible plain<<ref>>resolution
Deferred to Sprint 3: :results raw output behavior (only meaningful once block evaluation exists), tableFor() on the Arroyo host object (needs eval context), and actually passing :var data into generator blocks (plumbing exists, eval engine doesn't).
Files modified
arroyo/core.org— updatedtangle-models,org-parse-utils,org-tangle, andtangle-commandsource blocksarroyo/tests.org— added six Sprint 2 tests totangle-testsource block
DONE Sprint 3: Generator Evaluation #+begin_src lua :eval arroyo
Generator blocks use #+begin_src lua :eval arroyo with an Arroyo host object implicitly in scope. Scripts are evaluated by LuaJ (org.luaj:luaj-jse:3.0.1) — a single JAR, works on Android, zero compiler embedding. The :eval arroyo header arg signals to the tangle engine that this block is evaluated rather than extracted.
The
arroyoLua table exposes (see Sprint 6 Results for the full 18-function list):arroyo.nixos_modules(role: String?nil): table= — sorted NixOS module imports from the DBarroyo.home_modules(role: String?nil): table= — sorted Home Manager module importsarroyo.emacs_snippets(): table— topologically ordered Emacs module filesarroyo.epkg_overrides(): table— Nix override blocks from ARROYO_HOME_EPKGSarroyo.system_overlays(role: String?nil): table= — file contents ofARROYO_SYSTEM_OVERLAYentriesarroyo.inputs(role: String?nil): table= — file contents ofARROYO_INPUTentriesarroyo.outputs(): table— file contents ofARROYO_OUTPUTentriesarroyo.emacs_init(): string— concatenated Emacs module.elfiles in topological order
=:var tbl=tableName= bindings are converted from
List<List<String>>to 1-indexed Lua nested tables and set as globals before execution<<ref(arg)>>parameterized noweb passes the arg table data to the eval block, overriding the default:varbindingBlock output (
:results raw) is captured and embedded at the<<ref>>call site without delimiter wrapping:results rawon a non-eval block also skips delimiter wrappingError handling: eval errors per block emit
EvalErrorwarnings (one broken generator doesn't halt the pipeline)Missing eval context (no
--dbflag) emitsMissingEvalContextwarning and uses raw body:tangle ~/pathpaths now expand tilde to$HOMEmake tangle-stableacceptsDBparameter for eval context:make tangle-stable ORG... DB=arcology.db=
Results
Pivoted from JSR-223/Kotlin scripting to LuaJ — single JAR, works on Android, zero compiler embedding. The architecture is split cleanly: ArroyoTangleContext interface in commonMain, LuaJ implementation (ArroyoScriptHost) in jvmMain.
build.gradle.kts+libs.versions.toml— addedluaj-jse{ module"org.luaj:luaj-jse", version"3.0.1" }= to jvmMain and androidMain depsTangleModels— addedEvalError(blockName, message)andMissingEvalContext(blockName, language)warning typesArroyoTangleContext(new,commonMain) — interface exposingnixosModules(),homeModules(),emacsSnippets(),epkgOverrides(),tableFor(),evalBlock()OrgTangle—tangle()accepts optionalevalContext;:eval arroyoblocks evaluated viaevaluateBlock()in main loop andresolveNoweb()for<<ref(arg)>>references;:results rawskips delimiter wrapping;:varbindings resolved and passed to eval context; parameterized<<ref(arg)>>overrides default:vartable; errors caught per-block, emitEvalErrorwarnings, pipeline continues;resolveTanglePathexpands ~ in:tangle ~/...paths and handles absolute paths correctlyArroyoScriptHost(new,jvmMain) — LuaJJsePlatform.standardGlobals();arroyo.*functions as Lua callbacks;List<List<String>>converted to 1-indexed Lua nested tables; oneGlobalsinstance per tangle sessionTangleCommand— accepts--dbflag; constructsArroyoScriptHostwithArroyoRepositoryImplwhen db exists; passes eval context toOrgTangle.tangle()Makefile—tangle-stableaccepts optionalDBparameter and passes--repo-root .Seven new tests: eval block with mock context, null context warning, eval error fallback,
:vartable binding,:results rawno wrapping, parameterized<<ref(arg)>>to eval block, backward-compatible plain<<ref>>context/my_nixos_configuration.org— copy of~/org/cce/my_nixos_configuration.orgwith thearroyo_nixos_importsgenerator ported from elisp to#+begin_src lua :eval arroyo :results raw
Files created
arroyo/core.org—ArroyoTangleContextinterface source blockarroyo/generators.org—ArroyoScriptHostLuaJ source blockcontext/my_nixos_configuration.org— CCE NixOS config with Lua generator
Files modified
arroyo/core.org—tangle-models(new warning types),org-tangle(eval support, tilde expansion),tangle-command(--dbflag)arroyo/tests.org—tangle-test(7 new eval test methods)Makefile—tangle-stableacceptsDBparameterbuild.gradle.kts,libs.versions.toml— LuaJ dependency
DONE Sprint 4: Convert CCE Generators
Replace the elisp arroyo-generate-imports / arcology-api-generator calls in the CCE org files with #+begin_src kotlin :eval arroyo blocks. Migrate away from #+PROPERTY: header-args file-level propagation — all header args are placed inline on each source block.
=arroyo-nix.org='s table-driven package generation (gen-pkg-overlays, gen-python-overlays) — these are the
<<ref(arg)>>patterns where tables are passed as arguments=arroyo-emacs.org='s
generate_epkg_overridesandarroyo-emacs-init-location=cce.org='s Emacs Module Index, NixOS Module Index, Home Manager Module Index
arroyo-nixos.organdarroyo-home-manager.orgimport generatorsNormalize ARROYO_MODULE_WANTS whitespace (CCE files have tabs, trailing spaces)
All produce the same output the current Python/elisp system generates
Tests against real
~/org/ccefiles to verify output matches legacy system
DONE Sprint 4.5: Cross-file table inclusion
The edgeserver.org file uses :var tbl=nginx-common.org:hosts — a cross-file table reference where a table from another org file is bound to a variable for :eval arroyo blocks. The tangle tool now resolves these references.
OrgParseUtils: addedTableRefdata class +parseTableRef()— splitsother.org:tableNameinto(fileName, tableName)using the last:preceded by a.as the cross-file delimiterOrgTangle.tangle(): added optionalfileReader: ((String) -> String?)? = nullparameter. AresolveTableclosure is built insidetangle()that checks localtableBlocksfirst, then falls back to parsing the external file viafileReader+OrgLexer+collectNamedTables(). External files are cached inexternalTableCacheso each file is parsed at most once per sessionAll four internal methods (
evaluateBlock(),resolveNoweb(),resolveVarBindingsForEval(),evalBlockForRef()) now accept aresolveTablelambda instead of aMap<String, List<List<String>>>, enabling transparent cross-file resolution everywhere a table ref is usedTangleCommand: constructs afileReaderlambda that resolves external org files relative to the current org file's parent directory on disk:var tbl=other.org:tableNamerefs are validated eagerly — they resolve correctly when the external file exists, and emitUnresolvedTableRefwarnings when the file is missing or the table is not foundTwo new tests: happy path (external table data passes through to eval context) and error path (missing file emits warning)
Results
Two new tests pass: cross-file table references resolve correctly and pass data through to eval contexts; missing files emit the expected warnings. The feature is ready for converting the edgeserver.org generator from Elisp to Lua.
Files modified
arroyo/core.org—org-parse-utils(TableRef+parseTableRef()),org-tangle(fileReaderparam,resolveTableclosure, all internal methods switched to lambda),tangle-command(CLIfileReaderwiring)arroyo/tests.org—tangle-test(2 new cross-file tests)
DONE Sprint 5: The arroyo flood Command
CLI that orchestrates the full rebuild pipeline: index → tangle with eval.
Indexes the org directory to populate ARROYO_* metadata tables
Queries
ARROYO_TANGLE_THISkeywords, filters by--roleif specified--all-modules/-aflag: tangles all files withARROYO_NIXOS_MODULE,ARROYO_HOME_MODULE,ARROYO_EMACS_MODULE, orARROYO_TANGLE_THIS(not justTANGLE_THIS)findRepoRootwalks up from the org file to find a.git.hgetc marker, then uses repo-root-relative paths for tangle markersAbsolute tangle paths (starting with
/) are written directly instead of relative to org dirTangles matching files with
:eval arroyoblocks evaluated using DB queriesFiles with
ARROYO_TANGLE_THIS: yesmatch any role; values are space-delimited tokens--ignore-errorsflag continues on file failure; default exits with code 1 on failure--dry-runlists files without modifying
Pipeline
Index org directory → populate DB with module metadata
Query ARROYO_TANGLE_THIS (and ARROYO_NIXOS_MODULE/HOME_MODULE/EMACS_MODULE with
--all-modules) → filter by roleTangle each matching file with
ArroyoScriptHosteval context
With --all-modules the flood runs in two phases: module snippets (ARROYO_NIXOS_MODULE ARROYO_HOME_MODULE ARROYO_EMACS_MODULE) are tangled first, then ARROYO_TANGLE_THIS files are tangled in a second pass. A file carrying both a module keyword and ARROYO_TANGLE_THIS is tangled in both phases — the TANGLE_THIS phase produces entry-point outputs (flake.nix, init.el) whose Lua generators consume the module snippets the first phase just wrote to disk, so it must run last. The same files contain both static :tangle blocks and dynamic generators.
Emacs Integration
arroyo.el (tangled from arroyo/emacs-integration.org to lisp/arroyo.el) provides:
M-x arroyo-flood— full rebuild, async with prefix-arg for role filterM-x arroyo-tangle-and-index— tangle + index current file (only if#+AUTO_TANGLE: t)arroyo-auto-tangle-mode— replacesorg-auto-tangle-mode
Results
FloodCommand implemented with role filtering, dry-run, and ignore-errors support. Six tests cover role matching (space-delimited tokens, bare yes, case sensitivity, whitespace handling). Emacs integration provides the M-x arroyo-flood entry point matching the legacy arroyo-nixos-full-spread behavior.
Files created
arroyo/emacs-integration.org— tangles tolisp/arroyo.el
Files modified
arroyo/generators.org—FloodCommandsource block ingenerators-commandsroam/cli.org— CLI registration, Makefilefloodtarget, documentationarroyo/tests.org—FloodCommandTestwith 6 test casesarroyo/arroyo.org— Sprint 5 resultsMakefile—make floodtarget
DONE Sprint 6: Nix Flake Generation + Submodule Modularization
Generate a flake.nix into ~/nix/ — the tangle output directory for the arroyo-system repo. CCE submodules (cce-core, cce-emacs, cce-workstation, cce-wobserver) are pure org-file repositories under ~/org/ — no flake.nix of their own. The generated flake composes them by reading ARROYO_INPUT and ARROYO_OUTPUT file contents from the DB and concatenating them directly. This avoids pulling journals or PARA notes into the nix store.
The submodules are not flake inputs in the traditional sense — they're indexed org-file repos whose ARROYO_NIXOS_MODULE ARROYO_HOME_MODULE ARROYO_EMACS_MODULE entries are queried at tangle time. ARROYO_INPUT and ARROYO_OUTPUT entries point at files on disk (resolved relative to ~/nix/), whose contents are inlined into the generated flake.nix.
Repository Clustering
The ~220 flat org files in the old ~/org/cce/ split into 4 org-file repos plus the arroyo-system entry-point repo:
| Repo | Org files | Contents | Role |
|---|
-----------|----------|------|
| cce-core | 53 | Arroyo generators (arroyo-nixos.org, arroyo-home-manager.org, arroyo-emacs.org, arroyo-nix.org), cce.org index, shared infrastructure (ssh, syncthing, gnupg, yubikey, zfs, direnv, nixpkgs overlay, package tables), version-pins, morph, nixops, nix-on-droid | all |
| cce-emacs | 103 | ~100 ARROYO_EMACS_MODULE files (evil-mode, org-roam, magit, hydra, exwm, gnus, consult, etc.) | all |
| cce-workstation | 40 | Desktop-specific: KDE, audio, laptop hardware, applications, riverwm, xmonad, firefox, waydroid, mpd, mbsync, bitwarden, etc. | endpoint, settop |
| cce-wobserver | 26 | Server-specific: akkoma, nginx, gitea, matrix, jellyfin, vaultwarden, nextcloud, postgres, paperless, blocky, backups, wobserver-docker, etc. | server, edge, settop |
| arroyo-system | 5 | Entry points (my_nixos_configuration.org, nixos-wobserver.org, home-manager.org, arroyo-flake.org, systems.org), host definitions, role configs | entry points |
arroyo-system/flake.nix (generated)
Produced by a Lua generator in arroyo-system/arroyo-flake.org. The flake inputs and outputs are generated from the DB: arroyo.inputs() and arroyo.outputs() return the file contents of ARROYO_INPUT and ARROYO_OUTPUT entries (paths resolved relative to ~/nix/), concatenated directly into the flake. System overlays come from arroyo.system_overlays(). Host module lists are produced by arroyo.nixos_role_modules(role) in arroyo-system/systems.org, which returns ./modulePath lines for each ARROYO_NIXOS_MODULE entry filtered by role. A third-party module just needs org files with the right keywords — the indexer picks them up and the generator includes them automatically.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
<<arroyo_inputs()>>
};
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; overlays = [ <<arroyo_system_overlays()>> ]; };
in {
<<arroyo_outputs()>>
};
}Migration Steps
Create submodule repos; hand-write
flake.nixfor eachMove org files into submodules.
ARROYO_MODULE_WANTSpaths (cce/foo.org) stay relative within each repoConvert
#+PROPERTY: header-argsto inline:tangleon every elisp source block (remaining Sprint 4 work)Rewrite
:tanglepaths:~/arroyo-nix/nixos/foo.nix→nixos/foo.nix(relative to submodule root). Entry point tangles move to arroyo-systemMove entry points (
my_nixos_configuration.org,nixos-wobserver.org,home-manager.org) to arroyo-systemCreate
arroyo-system/arroyo-flake.orgwith Lua generators that produceflake.nixBuild new
arroyo.*Lua functions:inputs(),outputs(),system_overlays(),nixos_role_modules(role),home_role_modules(role),emacs_init(),packages()Wire
arroyo floodto index all submodules and tangle arroyo-systemDelete
~/arroyo-nix/(replaced by flake-native output)
Results
Sprint 6 is largely complete. The CCE submodules are split in to four org-file repos (cce-core, cce-emacs, cce-workstation, cce-wobserver) and the arroyo-system entry-point repo. arroyo flood --all-modules indexes all submodules and tangles the arroyo-system files to produce ~/nix/flake.nix. The generated flake passes nix flake check.
Unified schema + node_ancestors closure table
The per-module tables (nixos_modules, home_manager_modules, arroyo_emacs_snippets, arroyo_emacs_epkgs, and their role junction tables) are gone. All ARROYO_* values are stored in a single arroyo_keywords table with PK (file, kw, value) and an optional node_id column for heading-scoped keywords. A node_ancestors closure table maps each heading node to all its ancestor headings, enabling property inheritance: a file-level role applies to all headings in the file; a heading-scoped role applies to that heading and its children. Role-filter queries use IN (SELECT ancestor_id FROM node_ancestors WHERE node_id ak.node_id)= to match inherited roles and exclusions.
Heading-scoped roles and exclusions
ARROYO_SYSTEM_ROLE, ARROYO_SYSTEM_EXCLUDE, ARROYO_NIXOS_MODULE, ARROYO_HOME_MODULE, ARROYO_EMACS_MODULE, ARROYO_HOME_EPKGS, ARROYO_INPUT, ARROYO_SYSTEM_OVERLAY, ARROYO_MODULE_WANTS, and ARROYO_MODULE_WANTED can all appear in heading :PROPERTIES: drawers, not just file-level :PROPERTIES: or =#+ARROYO_= keyword lines. The indexer extracts these via nodeProperties and populates node_ancestors so that role/exclusion inheritance works correctly. =#+ARROYO_= keyword lines are always file-scoped (node_id null=) regardless of where they appear in the document.
Multi-valued keyword splitting
Keywords with space-delimited values (e.g. ARROYO_SYSTEM_ROLE: edge server) are split on whitespace and inserted as separate rows. This applies to ARROYO_SYSTEM_ROLE, ARROYO_NIXOS_MODULE, ARROYO_HOME_MODULE, ARROYO_EMACS_MODULE, ARROYO_HOME_EPKGS, ARROYO_INPUT, ARROYO_SYSTEM_OVERLAY, ARROYO_MODULE_WANTS, ARROYO_MODULE_WANTED, and ARROYO_SYSTEM_EXCLUDE.
New Lua functions
The arroyo Lua table now exposes 18 functions:
arroyo.nixos_modules(role),arroyo.nixos_modules_meta(role)— NixOS module imports fromARROYO_NIXOS_MODULEarroyo.home_modules(role),arroyo.home_modules_meta(role)— Home Manager module imports fromARROYO_HOME_MODULEarroyo.emacs_snippets()— topologically ordered Emacs module file pathsarroyo.emacs_init()— concatenated contents of all Emacs module.elfiles in topological order (paths resolved relative to~/nix/lisp/)arroyo.emacs_modules_meta()— Emacs module metadata with dependency infoarroyo.epkg_overrides()— Nix override blocks fromARROYO_HOME_EPKGSarroyo.file_title_for(path),arroyo.org_dir()— metadata helpersarroyo.flake_inputs(orgDir)— submodule directory names from indexed filesarroyo.nixos_role_modules(role),arroyo.home_role_modules(role)—./modulePathlines for role-filtered modules (used byarroyo-system/systems.org)arroyo.system_overlays(role)— file contents ofARROYO_SYSTEM_OVERLAYentries (paths resolved relative to~/nix/)arroyo.inputs(role)— file contents ofARROYO_INPUTentries (paths resolved relative to~/nix/)arroyo.outputs()— file contents ofARROYO_OUTPUTentries (paths resolved relative to~/nix/)
system_overlays, inputs, and outputs return file contents, not paths — the Lua generators in arroyo-flake.org concatenate them directly into the flake. This is the key design shift from the old submodule-input model: instead of importing .nix files from flake input store paths, the flake is assembled from file contents queried at tangle time.
EmacsSnippetsCommand rewrite
EmacsSnippetsCommand now uses getArroyoKeywordsWithNodeId("ARROYO_MODULE_WANTS") and getArroyoKeywordsWithNodeId("ARROYO_MODULE_WANTED") instead of the old getEmacsSnippets(): List<EmacsSnippetRow>. Wants values are heading IDs resolved directly via nodeIdToModule / moduleToNodeId maps built from ARROYO_EMACS_MODULE entries — no more file-path-to-module-name resolution.
FloodCommand improvements
--all-modules/-aflag: tangles all files withARROYO_NIXOS_MODULE,ARROYO_HOME_MODULE,ARROYO_EMACS_MODULE, orARROYO_TANGLE_THIS(not justTANGLE_THIS)findRepoRoot: walks up from the org file to find a.git.hgetc marker, then uses repo-root-relative paths for tangle markersAbsolute path handling: if a tangle output path starts with
/, writes to that absolute path instead of relative to org dir
Tangle engine improvements
OrgTable.toNestedList()no longer includes the header row — the tangle tool strips it automatically. Lua:eval arroyogenerators receive only data rows.uncommaBodynow handles leading whitespace: org-escape commas after indentation are un-escaped correctly (e.g. indented,*comment lines in source blocks)applyLinePrefix: when a noweb ref appears on a line with a prefix (e.g.# <<ref>>) and the replacement is multi-line, the prefix is propagated to all subsequent lines, preserving comment/indentation structureFlakeModuleRefsimplified:cceSubmodulefield removed, onlymodulePathremains. Root-level files withARROYO_NIXOS_MODULE/ARROYO_HOME_MODULEare no longer skipped — all modules are included regardless of directory depth.
Files modified
arroyo/core.org—ArroyoTangleContextinterface (4 new methods),FlakeModuleRef(cceSubmodule removed),OrgTangle(uncommaBody, applyLinePrefix),OrgTable.toNestedList()(header stripping)arroyo/generators.org— unified schema (arroyo_keywords + node_ancestors), ArroyoRepository (removed per-module methods, added unified queries), ArroyoIndexerPlugin (heading-property extraction, multi-valued splitting, node_ancestors population), ArroyoScriptHost (4 new Lua functions), FloodCommand (--all-modules, findRepoRoot, absolute paths), EmacsSnippetsCommand (heading-ID resolution)arroyo/tests.org— heading-scoped role/exclusion tests, multi-valued keyword tests, system_overlays/inputs/outputs tests, applyLinePrefix test
DONE port away from morph to a flake-native tool like deploy-rs
Take the existing morph-wrappers in CCE and update them so I can type deploy the-hostname to build a new system and push it to that host, and also update the M-x arroyo-flood command to match
INPROGRESS Sprint 7: Rebuild Docs + Community
Update Rebuild pages to reflect Kotlin-based tooling, build "Build Your Own Arroyo" guide, publish Nix flake template.
Update Rebuild of The Complete Computer pages
nix flake init --templatefor CCE bootstrappingDevstream / blog post covering the new architecture
DONE Shebang support + expanded comment types
Two related improvements to the tangle engine so it can produce executable scripts and correctly comment-wrap a wider range of file types.
:shebang header arg
#+begin_src bash :tangle ../scripts/foo.sh :shebang t now prepends a #! line and marks the output file executable. The CLI layer (TangleCommand, FloodCommand) calls setExecutable(true, true) after writing, driven by a new executableFiles: Set<String> field on TangleResult.
:shebang t/:shebang yes— usedefaultShebangFor(language)to pick a sensible interpreter (bash →#!/usr/bin/env bash, python →#!/usr/bin/env python3, ruby, perl, make, etc.). Languages with no obvious default returnnulland emit no shebang.:shebang "/path/to/interp"— use the literal string.:shebang no— opt out (no shebang, not executable).When multiple blocks target the same file, only the first block's shebang is applied — the engine guards against duplicate
#!lines.
Expanded comment styles
commentPrefixFor is now a thin wrapper over commentStyleFor, which returns a ~CommentStyle(prefix, suffix)= pair to support languages with non-symmetric comment delimiters. New and corrected mappings:
shell,sh,zsh,fish→#yaml,yml,toml,ini,conf,properties,dockerfile,terraform,hcl→#jinja,jinja2→#;jinja-htmlhtml+jinjadjango-html→{# … #}html,xml,svg,markdown→<!-- … -->css,scss,sass,less→ =/ … /=lua→--;vim→"Kotlin/Java/C/C++/Rust/Go/JS/TS/Scala/Swift/Dart/Groovy →
//(unchanged)Nix/Makefile/Python/Ruby/Perl/Elisp/Lisp/SQL/Haskell → unchanged
The OrgDetangle delimiter regex was broadened to recognize the new prefixes (<!--, /*, {#) and the optional suffixes on the end delimiter, so the round-trip works for HTML/CSS/Jinja tangles.
Files modified
arroyo/core.org—tangle-models(executableFilesfield onTangleResult),org-parse-utils(CommentStyledata class,commentStyleFor,defaultShebangFor,commentPrefixForas wrapper, narrative for shebang + comment styles),org-tangle(shebang collection loop,executableFilesreturn),org-detangle(broadened delimiter regex),tangle-command(chmod +x after write)arroyo/generators.org—flood-command(chmod +x after write)arroyo/tests.org—tangle-test(15 new tests: shebang t/yes/no/explicit, multi-block dedup, shell/yaml/toml/html/css/jinja/lua/vim/unknown comment prefixes,defaultShebangForunit test)arroyo/arroyo.org— this Sprint 7.5 entry
DONE Eval failures are hard errors, not recoverable warnings
Sprint 3 shipped eval-error handling as "emit EvalError warning, embed the raw Lua source in the tangled output, keep going." That was wrong: broken Lua ends up silently in generators.py sites.json .css files and ships to production. Embedding the raw source — or embedding nothing — is worse than failing loudly.
TangleModels— addedTangleEvalException(blockName, message, cause), a regularExceptionsubclass (not aTangleWarning). TheEvalErrorwarning type is kept for visibility but no longer controls flow.OrgTangle.evaluateBlockandOrgTangle.evalBlockForRefnow add theEvalErrorwarning (so the user sees which block failed) AND re-throw asTangleEvalException. The raw block body is never returned on eval failure.tangle()propagates the exception to its caller.TangleCommandcatchesTangleEvalExceptionaround thetangle()call, printsERROR: <message>to stderr, and callsexitProcess(1)immediately. No files from the failing org file are written. Files from earlier org files in the same invocation already on disk stay on disk.FloodCommandcatchesTangleEvalException; with--ignore-errorsthe failed file is skipped and counted toward the failure total, otherwiseexitProcess(1)immediately without tangling further files.Three tests in
arroyo/tests.org:eval error throws TangleEvalException and writes no file(replaces the old "uses raw body" test)eval error in parameterized noweb ref throws TangleEvalExceptioneval error in one of two blocks targeting same file throws and writes nothing
Files modified
arroyo/core.org—tangle-models(TangleEvalException),org-tangle(evaluateBlock/evalBlockForRefre-throw),tangle-command(catch +exitProcess)arroyo/generators.org—generators-commandsFloodCommand(catch +exitProcess/--ignore-errorsskip)arroyo/tests.org—tangle-test(3 new tests, old "uses raw body" test replaced)
DONE arcology flood rebuild subcommand
flood populates ~/nix but it also needs to carry a CLI flag "--build thehost" that will:
git adduntracked tangled files=nixos-rebuild build --flake ~/nix#thehost --target-host=thehost --ask-sudo-password --sudo=
DONE orgmode-kmp parseParagraph should stop on Token.{File,Generic,}Keyword
orgmode-kmp's parseParagraph (orgmode-kmp/orgmode/src/commonMain/kotlin/xyz/lepisma/orgmode/OrgChunk.kt:539) has a trail-stop predicate that only halts on EOF, list markers, HeadingStars, and certain =BlockStart=/=BlockEnd= types. It does NOT halt on Token.Keyword (#+NAME:, #+RESULTS:, …), Token.FileKeyword, or Token.GenericKeyword. When prose runs directly into a #+NAME: line with no blank line between them, the paragraph parser greedily consumes the #+NAME: token and everything after it — including table rows — as inline paragraph text.
Concrete failure surfaced in arcology-django's configuration.org: the roam_allowed_keywords and my_roam_allowed_keywords tables (under ** Roam Allowed Keywords) are preceded by prose ending in : then #+NAME: on the very next line — no blank line. Those tables never parse as OrgChunk.OrgTable; the chunk dump shows them truncated into OrgParagraph text. collectNamedTables returns 8 tables from the file, missing exactly those two, and tangle then emits Unresolved table arg 'roam_allowed_keywords' for gen-config-list and the-code/1.
Other tables in the same file (arroyo-roles, ignored_roam_tags, arcology_apps, etc.) work because they have a blank line between the preceding prose and #+NAME:, which terminates the paragraph via the two-consecutive-=LineBreak= rule. arroyo-roles also has prose-then-#+NAME: with no blank line but parses correctly — the exact trigger is the specific mix of inline elements in the preceding paragraph (e.g. =#+KEYWORD='s= verbatim markup) that lets the paragraph stopper fire on the double-LF before the #+NAME: line; the two failing tables have a single-line preceding paragraph ending in : that doesn't trip the double-LF rule before #+NAME:.
Fix: add Token.Keyword, Token.FileKeyword, and Token.GenericKeyword to the stop conditions in =parseParagraph='s trail predicate (OrgChunk.kt:539-578) so affiliated keywords terminate a paragraph regardless of surrounding blank lines. Emacs' org-element treats #+NAME: as a keyword line in this position; we should match.
The Elisp tangle path (Emacs org-babel-tangle) handles this case correctly — the legacy site is being kept alive with the Elisp tangle while arcology2go rolls forward.
Fix shipped
=parseParagraph='s trail-stop predicate (orgmode-kmp/orgmode/src/commonMain/kotlin/xyz/lepisma/orgmode/OrgChunk.kt:539) now returns true for Token.Keyword, Token.FileKeyword, and Token.GenericKeyword unconditionally, and for Token.CommentStart only when the paragraph has already consumed tokens. Affiliated keywords don't need a separate token type here: #+ATTR_HTML, #+CAPTION, #+NAME, #+RESULTS, #+TBLFM all lex as Token.Keyword tagged with a KeywordType in the lexer, so the three keyword cases cover Emacs' affiliated-keyword set. The CommentStart guard exists because parseCommentLine is commented out of the parseChunk oneOf chain: a chunk-initial comment line is consumed by parseParagraph as paragraph text (via parsePlainText), and an unguarded comment stop would make parseParagraph fail with "No inline elements parsed", failing the chunk parse — and every file with a comment line after a blank line would stop parsing entirely.
Four regression tests in orgmode-kmp/orgmode/src/commonTest/kotlin/xyz/lepisma/orgmode/OrgParserTest.kt:
testParagraphParsing_KeywordLineNoBlankLine should stop paragraph before NAME and parse the table— prose ending in:runs into#+NAME:with no blank line; asserts the paragraph/keyword-line/table chunk split reproducing the configuration.org failure shape, and that the paragraph no longer contains the name or table rows.testParagraphParsing_FileAndGenericKeywordNoBlankLine should stop paragraph— mid-body#+RESULTS:/#+TITLE:(Token.Keyword and Token.FileKeyword) and#+ARCOLOGY_KEY:(Token.GenericKeyword) each terminate a paragraph.testParagraphParsing_CommentLineNoBlankLine should stop in-flight paragraph but keep paragraph-initial comments— pins theCommentStartguard on both sides: prose stops before a trailing comment line, while a paragraph-initial comment still parses (legacy chunk-initial behavior).testParagraphParsing_KeywordWithBlankLine should still parse keyword line and table— the double-=LineBreak= path is unchanged.
Files modified
orgmode-kmp/orgmode/src/commonMain/kotlin/xyz/lepisma/orgmode/OrgChunk.kt—parseParagraphstop predicate: keyword token stops + guardedToken.CommentStartstoporgmode-kmp/orgmode/src/commonTest/kotlin/xyz/lepisma/orgmode/OrgParserTest.kt— four paragraph-boundary regression tests
Validation: make test-orgmode (OrgParserTest 42 tests, 0 failures), make test, make build, and make test-app all pass. No submodule pointer bump or commit yet — awaiting explicit instruction.
DONE orgmode-kmp OrgBlock parsing needs to support parsing multiple :var keywords
parseSourceBlock (orgmode-kmp/orgmode/src/commonMain/kotlin/xyz/lepisma/orgmode/OrgBlock.kt:128-140) parsed header args into Map<String, String> keyed by arg name. Repeated :var keys overwrote earlier ones — =:var sites=sites-config :var domains=domains-config= ended up as just ={var: domains=domains-config}=, and the Lua script saw nil for sites. Same for =:var site="default-colors" :var tbl=site-colors= — only the tbl binding survived, so the quoted string site arg was lost.
Concrete failures in arcology-django's configuration.org:
elisp-join-tables(sites.json generator): bothsitesanddomainsbindings lost except the last; Lua gotnilfor whichever was missing → "table expected, got nil" eval error.mk-site-colors(per-site CSS generator): =:var site="default-colors" :var tbl=site-colors= collapsed to just =tbl=site-colors=. Then the parameterized noweb<<mk-site-colors("default-colors")>>inresolveVarBindingsForEvalbound the quoted-string arg to the FIRST:varname — which was nowtbl(because thesitebinding was lost). Lua'sipair(tbl)received a string → "table expected, got string" eval error.
Fixed by changing OrgSourceBlock.headerArgs to Map<String, List<String>> (preserve all occurrences in document order; scalar args read through a scalar helper that takes the last occurrence — org-babel last-wins semantics). The parser at OrgBlock.kt appends rather than overwrites.
Design decisions:
Scalar args (
tangle,eval,noweb,shebang,comments,noweb-ref) takelastOrNull()uniformly viaMap<String, List<String>>.scalar.mergeHeaderArgs(heading-levelheader-argspropagation) uses simple per-key override: the block's own list wins when the key is present on the block, the heading's list fills only keys the block lacks. CCE files are migrated away from file-level propagation so this path is low-stakes.evaluateBlockiterates ALL:varbindings for a block: quoted values become string bindings, unquoted values resolve throughresolveTableinto table bindings, unresolvable names emitUnresolvedTableRefwarnings per binding.resolveVarBindingsForEval: for<<ref(arg)>>, the arg overrides the first table-typed:varbinding (the one whose default value is not a quoted string); quoted-string bindings pass through unchanged; a quoted-string arg binds to the first binding's name; on unresolved arg table, the overridden binding falls back to its own default table.ArroyoScriptHost.evalBlockalready tookMap<String, List<List<String>>>+Map<String, String>— the Lua boundary is unchanged.
The Elisp tangle path preserves multiple :var bindings and works.
Files modified
orgmode-kmp—OrgBlock.kt(headerArgs: Map<String, List<String>>, append-on-repeat parser),OrgParserTest.kt(list-shape assertions, two new multi-=:var= preservation tests)arroyo/core.org—org-parse-utils(scalarhelper, list-shapedparseHeaderArgsPropertyValue,extractHeadingHeaderArgs, list-shapedmergeHeaderArgs),org-tangle(multi-bindingvarBindings,evaluateBlock,resolveVarBindingsForEval,resolveNowebparam, all scalar reads viascalar)web/renderer.org—renderSourceBlock/renderSourceBlockCaptionnoweb-ref reads and list-valued header-arg rendering; test fixtures wrapped inlistOfarroyo/tests.org/TangleTest.kt—multiple var bindings all reach eval,quoted string and table var bindings coexist,parameterized arg overrides only the table typed var binding(themk-site-colorsregression)arroyo/arroyo.org— this entry
DONE OrgTangle noweb-ref blocks with the same name should concatenate in document order
OrgTangle.tangle() (src/commonMain/kotlin/computer/whatthefuck/arroyo/OrgTangle.kt:39) builds nowebBlocks allBlocks.associate { it.name to it.block.body }= — a Map<String, String>. When two or more source blocks share a name (both have :noweb-ref theref, or both follow #+NAME: theref), associate silently keeps only the last one in document order. Emacs org-babel concatenates all blocks with a given :noweb-ref in document order when <<theref>> is expanded; we should match.
Same root shape as the multi-:var bug: a Map keyed by name can't hold multiple values. Fix: change nowebBlocks to Map<String, List<String>> (or Map<String, String> built by joining the bodies with "\n"). resolveNoweb (OrgTangle.kt:197-269) then looks up the list and joins with "\n" (or uses the pre-joined string). blockMap (line 33, allBlocks.associateBy { it.name }) has the same problem for the :eval arroyo lookup at line 233 — needs the same treatment, or at minimum a decision about which block "wins" for eval (probably: the last one, matching current behavior, OR an error if they disagree on :eval).
Tests to add in arroyo/tests.org / TangleTest.kt:
multiple noweb-ref blocks concatenate in order— two#+begin_src kotlin :noweb-ref combinedblocks with bodies "val a1" and "val b2"; a consumer<<combined>>; assert the tangled output contains both lines in order.multiple NAME blocks with same name concatenate— same but using#+NAME: combinedon consecutive blocks (no:noweb-ref).multiple noweb-ref blocks with :eval arroyo— decide and assert the behavior for which block's header args win for eval lookup.
DONE Tangle comment delimiters and the :comments / :results separation
tangleCommentFor (src/commonMain/kotlin/computer/whatthefuck/arroyo/OrgParseUtils.kt:224) emitted the heading-ID link line with style.prefix but omitted style.suffix. For symmetric comment languages (//, #, ;) this is invisible, but for CSS the start delimiter was =/ ... with no closing /=, so the rest of the tangled file was swallowed as a CSS comment until the ends here */ line. Fix: append style.suffix to the heading-link line, matching the start and end delimiters.
Separately, wrapWithComments (OrgTangle.kt:296) treated :results raw as a tangle knob that suppressed delimiter wrapping. This is wrong: :results is org-babel's evaluation-output embedding control (raw, drawer, value, output, etc.), not a tangle control. The proper org-babel knob for comment wrapping is :comments (none, no, link, org, both). The tangle engine now recognizes :comments none and :comments no as the only no-wrap triggers and ignores :results entirely. Nine blocks in web/templates.org and web/domains.org that had been using :results raw as a no-wrap hack were migrated to :comments none.
Files modified
arroyo/core.org—org-parse-utils(tangleCommentForheading-link suffix),org-tangle(wrapWithCommentshonors:comments none|noonly; ignores:results), narrative for:commentssemanticsarroyo/tests.org—tangle-test(new:comments nonot wrapped,heading id delimiter is closed for non-symmetric comment styles,results raw is not a tangle knob and does not skip wrapping; renamedresults raw eval block has no delimiter wrapping→comments none on eval block skips delimiter wrapping)arroyo/tools.org— agent docs and key rules now describe:comments noneas the no-wrap knob and note that:resultsis not a tangle knobweb/templates.org,web/domains.org— eight Pebble template blocks and thedomains.jsongenerator migrated from:results rawto:comments none