From c6e5ab9ae3acfd8f14cf7fc5b58cceca1daeef13 Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Tue, 3 Nov 2026 13:46:57 +0000 Subject: [PATCH] docs: add agent-start-here.md for the mac after pull Handoff note for the next session on the mac: what the three `unified` commits changed, why the shared/OS ownership now looks the way it does, the pull -> link-machine.sh -> doom sync -> restart sequence, static and runtime checks, the still-pending elixir server decision, and the shared defects not to trip over (pi-coding-agent, org paths, LaTeX fonts, duplicated blog roots). It also records what is intentionally absent on the mac: no STT (the whisper block is Linux-only, though the packages now install everywhere) and no configured eglot server for heex-ts-mode until the mac-side fix lands. --- agent-start-here.md | 264 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 agent-start-here.md diff --git a/agent-start-here.md b/agent-start-here.md new file mode 100644 index 0000000..9f1bebf --- /dev/null +++ b/agent-start-here.md @@ -0,0 +1,264 @@ +# Agent start here: macOS after pulling `unified` + +This is a handoff note for an agent working on the **mac**. The `unified` +branch merges the Linux machine's configuration into this repo. The Linux side +was just brought up to date; the mac has not yet pulled or run `doom sync`. +Read this before touching anything. + +The mac checkout is assumed to be `~/.doom.d` (adjust paths if not). + +## Ground rules + +- Work on `unified`. Do **not** switch to `master`, and do **not** push unless + the human asks. +- Never run `git clean`. The root `init.el` is an untracked, gitignored + symlink; `git clean -xfd` deletes it. Recreate it with + `./bin/link-machine.sh` if it disappears. +- Never commit `init.el`, `custom.el`, `config-local.el`, or `*.elc`; they are + gitignored on purpose. +- `config.el` and `packages.el` are shared with the Linux machine. Changes + there affect both machines; prefer `config-mac.el` for mac-only work. +- `config-linux.el` is loaded only on Linux. Do not put mac settings there. +- Do not "reconcile" `mac/init.el` with `linux/init.el`. They differ on + purpose (different module lists, e.g. ivy vs vertico, `+lsp` flags). +- Secrets and machine-local paths belong in `config-local.el` + (gitignored; see `config-local.example.el`). + +## What each file owns + +| File | Ownership | +|---|---| +| `config.el` | shared settings, loaded first | +| `packages.el` | shared package declarations | +| `config-linux.el` | loaded last on GNU/Linux only | +| `config-mac.el` | loaded last on macOS only | +| `linux/init.el`, `mac/init.el` | per-machine Doom module lists | +| `init.el` | untracked symlink into `linux/` or `mac/`, made by `bin/link-machine.sh` | + +`config.el` ends with the dispatch: + +```elisp +(pcase system-type + ('darwin (load! "config-mac.el" doom-user-dir t)) + ('gnu/linux (load! "config-linux.el" doom-user-dir t))) +``` + +so the OS leaf always gets the last word. + +## What changed on `unified` (three commits) + +``` +9bff435 refactor(treesit): drop unused typescript grammars +0b3cf5b fix(elixir): let the OS files own eglot-server-programs +6df0d5b fix(packages): declare whisper and websocket +``` + +### `9bff435` — typescript grammars removed + +The `typescript`/`tsx` entries in `treesit-language-source-alist` were nested +one list too deep, so lookups never matched them, and the `dolist` that +installed missing grammars errored out. Both entries and the installer are +gone; `heex` and `elixir` remain. + +Consequence for the mac: existing compiled grammars keep working. But +`mac/init.el` enables `(typescript +lsp)` and `(javascript +lsp +tree-sitter)`, +so if you work on TypeScript and the grammars are not installed, re-add this +(with **correct** nesting) plus the installer: + +```elisp +(treesit-language-source-alist + '((heex "https://github.com/phoenixframework/tree-sitter-heex") + (elixir "https://github.com/elixir-lang/tree-sitter-elixir") + (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") + (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src"))) + +(dolist (lang '(heex elixir typescript tsx)) + (unless (treesit-language-available-p lang) + (treesit-install-language-grammar lang))) +``` + +### `0b3cf5b` — eglot ownership moved to the OS files + +The shared `config.el` used to set `eglot-server-programs` for +`(elixir-mode elixir-ts-mode heex-ts-mode)` to `("expert" "--stdio")`. That +value leaked to Linux, where `expert` is not installed. It is deleted; each +OS leaf now owns the setting. + +On the mac, `config-mac.el` still configures: + +```elisp +(add-to-list 'eglot-server-programs + '(elixir-ts-mode + . ("sh" "/Users/willem/.elixir-ls/release/language_server.sh"))) +``` + +So `elixir-ts-mode` keeps working **if that path exists**. Note two things: + +1. The mac still needs the elixir-ls/expert cleanup the human mentioned + (see "Pending mac work" below). +2. The shared entry also covered `heex-ts-mode`, which `config-mac.el` does + not. `elixir-mode` is moot because `major-mode-remap-alist` maps it to + `elixir-ts-mode`, but `.heex` files currently get no configured server on + the mac. + +### `6df0d5b` — `whisper` and `websocket` declared + +`packages.el` now declares both. `doom sync` is **required** on the mac to +install them. + +On the mac they are installed but unused: the `use-package! whisper` block and +the `live-dictate` autoload live in `config-linux.el`. There is no +speech-to-text on the mac yet. Porting it is a feature, not a copy: it needs +Lemonade (or another OpenAI-compatible STT backend), an ffmpeg audio device, +and its own `config-mac.el` block. + +## Startup checklist + +Run these in order from the mac checkout. + +1. Confirm branch and clean tree: + + ```sh + cd ~/.doom.d + git branch --show-current # expect: unified + git status --short # expect: empty (stash/save local edits first) + ``` + +2. Pull: + + ```sh + git fetch + git pull --ff-only + git log --oneline -3 # expect the three commits above + ``` + +3. Make sure the root symlink points at the mac entry file: + + ```sh + ls -l init.el # expect: init.el -> mac/init.el + ./bin/link-machine.sh # only if missing or wrong; auto-detects Darwin + ``` + + Never commit the symlink. `bin/link-machine.sh` only links files that exist + in `mac/`, so `config.el`/`packages.el` stay at the root as intended. + +4. Sync packages (this is not optional; `packages.el` changed): + + ```sh + doom sync + ``` + + Watch for straight.el errors while cloning + `https://github.com/natrys/whisper.el`. + +5. Restart Emacs (a full restart is safer than `M-x doom/reload` after a sync). + +## Verification after startup + +Static checks: + +```sh +grep -n 'expert' config.el # expect: no output +grep -n 'expert' config-mac.el config-linux.el # only gptel prompts + Linux cond + +emacs -Q --batch --eval '(dolist (f (list "config.el" "config-linux.el" "config-mac.el" "packages.el")) (with-current-buffer (find-file-noselect f) (goto-char (point-min)) (check-parens) (message "%s: OK" f)))' +``` + +Do **not** wrap the `check-parens` call in `with-temp-buffer`: that buffer is +in fundamental mode, so char literals such as `?\(` and `#'` are misread and +you get false "unmatched bracket" errors. Use `find-file-noselect` as above. + +Runtime checks in Emacs: + +- Startup shows no error from the old typescript grammar installer. +- `(locate-library "websocket")` and `(locate-library "whisper")` are non-nil. +- Open an `.ex`/`.exs` file: it should use `elixir-ts-mode`, and `M-x eglot` + should offer the server from `config-mac.el`. Check + `M-: eglot-server-programs` and confirm the `language_server.sh` path. +- Open a `.heex` file: expect **no** configured eglot server (known gap; see + below). It should not crash. +- `doom sync` on the mac is also the only way to validate the package changes; + nothing here was runtime-tested on the Linux side. + +## Pending mac work (not done by the Linux session) + +### Elixir language server + +The mac path in `config-mac.el` is: + +```elisp +/Users/willem/.elixir-ls/release/language_server.sh +``` + +Check whether it exists and is executable before trusting it: + +```sh +ls -l /Users/willem/.elixir-ls/release/language_server.sh +command -v expert +``` + +If `expert` is installed, the cleanest fix is to make `config-mac.el` mirror +the Linux logic (pick what exists; leave eglot alone otherwise) and cover all +three modes, not just `elixir-ts-mode`: + +```elisp +(with-eval-after-load 'eglot + (let ((server (cond ((executable-find "expert") + '("expert" "--stdio")) + ((executable-find "language_server.sh") + (list (or (executable-find "bash") "sh") + (executable-find "language_server.sh")))))) + (when server + (setf (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode) + eglot-server-programs + nil nil #'equal) + server)))) +``` + +Commit that separately (e.g. `fix(mac): configure the elixir server that +actually exists`) and say in the message that it was verified on the mac only. +Do not push unless asked. The mac no longer has `expert` forced on it by +shared config, so "nothing found" now means eglot stays at its default. + +### TypeScript grammars + +Only if needed; see the corrected snippet under `9bff435`. + +## Known shared defects (do not trip over them) + +These exist on `unified` and affect both machines; they are out of scope +unless the human asks. + +- **`pi-coding-agent` block in `config.el` is half-edited.** The `:custom` + line is commented out but its closing paren is not, leaving a stray `)`, and + `:commands pi` fights `:init (defalias 'pi 'pi-coding-agent)`. +- **Dead/commented leftovers in `config.el`:** `linum-format` (mode gone in + Emacs 29; value also has a stray `'`), duplicate `display-line-numbers-type` + and `enable-local-variables` settings, commented `doom-font` block. +- **Duplicated blog roots:** `org-roam-export-blog-firehose-root` and + `org-roam-export-jekyll-root` are set in shared `config.el` *and* in both + leaves. Harmless (the leaf wins) but should be removed from the shared file. +- **Org paths are mac-shaped:** `org-directory` and `org-roam-directory` are + only set in shared `config.el` to `~/MyDocuments/...`. That is correct on + the mac but wrong on Linux, which has no override. If fixing, add the Linux + values to `config-linux.el`; do not change the mac path. +- **LaTeX fonts are mac-only:** the shared `org-latex-classes` uses ETBembo + RomanOSF, Raleway and Fira Code. Correct on the mac, missing on Linux, so + Linux PDF export will fail until that block moves to `config-mac.el`. +- **`config-mac.el`'s eglot comment** says the setting was "moved out of the + shared config.el, where this macOS path was hard-coded". That is still + historically true, but the shared file now configures no elixir server at + all; update the comment if you touch that block. + +## When done + +Report: + +- `git log --oneline -3` and `git status --short` +- what you changed, file by file, and why +- which checks you ran, and which things you could not verify (be explicit + about runtime vs static checks) +- any further mac-only values still leaking from shared files + +This file is committed as a handoff note. Once the mac is synced and the +elixir-server work is done, delete it or rewrite it for the next machine.