docs: rewrite agent-start-here.md for the next session
The mac side of the unified migration is done and verified (doom sync,
eglot/expert for elixir-ts and heex-ts, flycheck, code actions). The
note now records:
- agent-environment lessons: pi sandbox blocks writes to ~/.emacs.d
(humans must run doom sync/env), sandbox PATH lacks /opt/homebrew/bin,
eglot is lazy on the mac (checks need (require 'eglot) first), doom is
a fork at ~/.emacs.d/sources/doom+.
- STT facts gathered this session: whisper.el server modes, brew's
whisper-server serving only /inference, live-dictate's ws /v1/realtime
requirement, GGML model provenance, sox/ffmpeg present.
- updated known-defects list, including that config-local.el now really
loads (1e1ad31) and Linux must check for a stale one.
This commit is contained in:
+112
-236
@@ -1,28 +1,46 @@
|
|||||||
# Agent start here: macOS after pulling `unified`
|
# Agent start here: handoff note (v2)
|
||||||
|
|
||||||
This is a handoff note for an agent working on the **mac**. The `unified`
|
Rewritten 2025-11-05 after the mac session finished the `unified` migration.
|
||||||
branch merges the Linux machine's configuration into this repo. The Linux side
|
Read this before touching anything. The previous version (mac after first
|
||||||
was just brought up to date; the mac has not yet pulled or run `doom sync`.
|
pull) is obsolete; its pending mac work is done.
|
||||||
Read this before touching anything.
|
|
||||||
|
|
||||||
The mac checkout is assumed to be `~/.doom.d` (adjust paths if not).
|
## Where things stand
|
||||||
|
|
||||||
|
**Both machines share one branch: `unified`.** The Linux side brought its
|
||||||
|
config up; the mac side has now pulled, synced, and verified. Commits from
|
||||||
|
the mac session (local on the mac, pushed only if the human asks):
|
||||||
|
|
||||||
|
```
|
||||||
|
2e21324 fix(config): actually load config-local.el
|
||||||
|
c1ec048 feat(mac): port whisper/live-dictate speech-to-text from Linux
|
||||||
|
aadc326 fix(mac): configure the elixir server that actually exists
|
||||||
|
08ec9f5 docs: add agent-start-here.md for the mac after pull (v1 of this note)
|
||||||
|
6df0d5b fix(packages): declare whisper and websocket (from Linux)
|
||||||
|
0b3cf5b fix(elixir): let the OS files own eglot-server-programs (from Linux)
|
||||||
|
9bff435 refactor(treesit): drop unused typescript grammars (from Linux)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Verified working on the mac** (runtime, human-confirmed): `doom sync`
|
||||||
|
(whisper.el + emacs-websocket installed), eglot connecting to `expert` for
|
||||||
|
elixir-ts-mode AND heex-ts-mode, flycheck, eglot code actions.
|
||||||
|
|
||||||
|
**Verified static only** (mac): check-parens on all config files; grep
|
||||||
|
checks; the `alist-get`/`setf` pattern unit-tested in vanilla Emacs 30.2.
|
||||||
|
|
||||||
## Ground rules
|
## Ground rules
|
||||||
|
|
||||||
- Work on `unified`. Do **not** switch to `master`, and do **not** push unless
|
- Work on `unified`. Do **not** switch to `master`, and do **not** push unless
|
||||||
the human asks.
|
the human asks.
|
||||||
- Never run `git clean`. The root `init.el` is an untracked, gitignored
|
- Never run `git clean`. The root `init.el` is an untracked, gitignored
|
||||||
symlink; `git clean -xfd` deletes it. Recreate it with
|
symlink; `git clean -xfd` deletes it. Recreate with `./bin/link-machine.sh`.
|
||||||
`./bin/link-machine.sh` if it disappears.
|
- Never commit `init.el`, `custom.el`, `config-local.el`, or `*.elc`.
|
||||||
- Never commit `init.el`, `custom.el`, `config-local.el`, or `*.elc`; they are
|
- `config.el` and `packages.el` are shared by both machines. Prefer
|
||||||
gitignored on purpose.
|
`config-mac.el` / `config-linux.el` for machine-specific work.
|
||||||
- `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
|
- Do not "reconcile" `mac/init.el` with `linux/init.el`. They differ on
|
||||||
purpose (different module lists, e.g. ivy vs vertico, `+lsp` flags).
|
purpose (mac: no `+eglot`, elixir module without `+lsp`, vertico-era module
|
||||||
- Secrets and machine-local paths belong in `config-local.el`
|
list; Linux: `(elixir +lsp)`, etc.).
|
||||||
(gitignored; see `config-local.example.el`).
|
- `config.el` ends with a `pcase` dispatch loading the OS leaf, and NOW ALSO
|
||||||
|
loads `config-local.el` last (see below), so: shared < OS leaf < local.
|
||||||
|
|
||||||
## What each file owns
|
## What each file owns
|
||||||
|
|
||||||
@@ -30,235 +48,93 @@ The mac checkout is assumed to be `~/.doom.d` (adjust paths if not).
|
|||||||
|---|---|
|
|---|---|
|
||||||
| `config.el` | shared settings, loaded first |
|
| `config.el` | shared settings, loaded first |
|
||||||
| `packages.el` | shared package declarations |
|
| `packages.el` | shared package declarations |
|
||||||
| `config-linux.el` | loaded last on GNU/Linux only |
|
| `config-linux.el` | loaded on GNU/Linux only |
|
||||||
| `config-mac.el` | loaded last on macOS only |
|
| `config-mac.el` | loaded on macOS only |
|
||||||
| `linux/init.el`, `mac/init.el` | per-machine Doom module lists |
|
| `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-local.el` | gitignored overrides; **actually loaded since 2e21324**, after everything else. Template: `config-local.example.el` |
|
||||||
|
|
||||||
`config.el` ends with the dispatch:
|
## Agent environment lessons (cost us time; read these)
|
||||||
|
|
||||||
```elisp
|
- **pi's sandbox blocks all writes to `~/.emacs.d`.** `doom sync`, `doom env`,
|
||||||
(pcase system-type
|
anything that writes caches/logs fails with `Operation not permitted`, and
|
||||||
('darwin (load! "config-mac.el" doom-user-dir t))
|
`sandbox-exec` cannot escape it. Humans must run `doom sync` / `doom env`
|
||||||
('gnu/linux (load! "config-linux.el" doom-user-dir t)))
|
in a normal terminal. Reads of `~/.emacs.d` work fine.
|
||||||
```
|
- **The sandbox PATH lacks `/opt/homebrew/bin`.** `command -v expert` said
|
||||||
|
"not found" while `/opt/homebrew/bin/expert` existed. Always
|
||||||
so the OS leaf always gets the last word.
|
`export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"` first in bash calls.
|
||||||
|
- **eglot is lazy on the mac.** No `+eglot` module; eglot is Emacs 30's
|
||||||
## What changed on `unified` (three commits)
|
built-in, first loaded by the `eglot-ensure` hook (config.el) when an
|
||||||
|
elixir/heex buffer opens. Before that, `eglot-server-programs` is
|
||||||
```
|
void-variable. The correct check:
|
||||||
9bff435 refactor(treesit): drop unused typescript grammars
|
```elisp
|
||||||
0b3cf5b fix(elixir): let the OS files own eglot-server-programs
|
(progn (require 'eglot)
|
||||||
6df0d5b fix(packages): declare whisper and websocket
|
(alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
|
||||||
```
|
eglot-server-programs nil nil #'equal))
|
||||||
|
|
||||||
### `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)
|
|
||||||
```
|
```
|
||||||
|
Expect `("expert" "--stdio")`. Note Emacs 30's built-in default entry for
|
||||||
|
that key is a dynamic `eglot-alternatives` closure
|
||||||
|
(language_server.sh/start_lexical.sh), which our entry replaces in place.
|
||||||
|
- **Emacs is 30.2 (emacs-plus, homebrew); doom is a fork at
|
||||||
|
`~/.emacs.d/sources/doom+`.** Check the fork's modules before assuming
|
||||||
|
upstream Doom behavior.
|
||||||
|
|
||||||
2. Pull:
|
## Open work: speech-to-text on the mac
|
||||||
|
|
||||||
```sh
|
`config-mac.el` now has the ported whisper/live-dictate block (keys under
|
||||||
git fetch
|
`SPC A`). `whisper` and `websocket` are installed. What is missing is a
|
||||||
git pull --ff-only
|
backend. Facts established this session, so the next agent need not
|
||||||
git log --oneline -3 # expect the three commits above
|
re-derive them:
|
||||||
```
|
|
||||||
|
|
||||||
3. Make sure the root symlink points at the mac entry file:
|
- `whisper.el` server modes: `nil` (run whisper-cli as subprocess),
|
||||||
|
`local`/`remote` (whisper.cpp native HTTP server, `/inference`), `openai`
|
||||||
|
(POST to `<whisper-openai-api-baseurl>` + `v1/audio/transcriptions`).
|
||||||
|
- The mac block currently uses `openai` mode → needs a Lemonade-style
|
||||||
|
OpenAI-compatible server on `localhost:13305` (that is what Linux runs).
|
||||||
|
- **Homebrew's `whisper-server` serves only `/inference`** (no OpenAI-compat
|
||||||
|
endpoint in the installed build). So for whisper.cpp the mac block should
|
||||||
|
switch to `whisper-server-mode 'remote` with `whisper-server-baseurl`
|
||||||
|
pointing at its port, or use mode `nil` (subprocess, no server). Verify the
|
||||||
|
exact knob in whisper.el before editing.
|
||||||
|
- **`live-dictate` (`SPC A d`) streams over `ws://host/v1/realtime`** (OpenAI
|
||||||
|
Realtime-style websocket). whisper.cpp cannot serve that. Streaming
|
||||||
|
dictation on the mac therefore needs a Lemonade-style backend — e.g. the
|
||||||
|
Linux box's, via `live-dictate-server-url` — or a new streaming backend.
|
||||||
|
Record-and-transcribe (`SPC A w`) works with whisper.cpp.
|
||||||
|
- whisper.cpp uses GGML model files (same ecosystem as the human's
|
||||||
|
source-built llama.cpp). Models come from HuggingFace
|
||||||
|
(`ggml-org/whisper.cpp`, e.g. `ggml-large-v3-turbo.bin`); the human is
|
||||||
|
picking one. `whisper-server --port 13305 --model <path>` (defaults
|
||||||
|
127.0.0.1:8080). `sox` and `ffmpeg` are already installed.
|
||||||
|
- `live-dictate` on darwin needs `live-dictate-ffmpeg-input-device ":0"`
|
||||||
|
(already set in config-mac.el). First use triggers the macOS mic
|
||||||
|
permission prompt.
|
||||||
|
- If the human prefers not to commit the backend choice, the URLs
|
||||||
|
(`whisper-openai-api-baseurl`, `live-dictate-server-url`) can move to
|
||||||
|
`config-local.el` — which finally loads now.
|
||||||
|
|
||||||
```sh
|
## Known shared defects (still open; out of scope unless the human asks)
|
||||||
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
|
- `config.el`'s `use-package! pi-coding-agent` block is awkward: `:commands
|
||||||
in `mac/`, so `config.el`/`packages.el` stay at the root as intended.
|
pi` plus an `:init` defalias do overlapping jobs; a `:custom` line is
|
||||||
|
commented out. Balanced parens, loads fine, but should be cleaned up.
|
||||||
4. Sync packages (this is not optional; `packages.el` changed):
|
- Dead/commented leftovers in `config.el`: `linum-format` (mode gone in
|
||||||
|
Emacs 29), duplicate `display-line-numbers-type` and
|
||||||
```sh
|
`enable-local-variables` settings, commented `doom-font` block.
|
||||||
doom sync
|
- **Org paths are mac-shaped in shared `config.el`** (~line 42):
|
||||||
```
|
`org-directory`/`org-roam-directory` point at `~/MyDocuments/...`, which
|
||||||
|
does not exist on Linux. Fix on the Linux side by adding Linux values to
|
||||||
Watch for straight.el errors while cloning
|
`config-linux.el`, not by changing the mac path.
|
||||||
`https://github.com/natrys/whisper.el`.
|
- **LaTeX fonts are mac-only in shared `config.el`** (~line 128): ETBembo
|
||||||
|
RomanOSF / Raleway / Fira Code in `org-latex-classes`. Linux PDF export
|
||||||
5. Restart Emacs (a full restart is safer than `M-x doom/reload` after a sync).
|
fails until that block moves to `config-mac.el`.
|
||||||
|
- **Duplicated blog roots** in shared `config.el` (~line 318) and in both
|
||||||
## Verification after startup
|
leaves. Harmless (leaf wins) but should be removed from the shared file.
|
||||||
|
- **`config-local.el` now actually loads (2e21324).** If a stale one exists
|
||||||
Static checks:
|
on the Linux machine, its settings wake up on the next restart there.
|
||||||
|
The Linux session should check for its existence before anything else.
|
||||||
```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
|
## When done
|
||||||
|
|
||||||
Report:
|
Report: `git log --oneline` and `git status --short`; what changed file by
|
||||||
|
file and why; static vs runtime checks, explicitly; any machine-specific
|
||||||
- `git log --oneline -3` and `git status --short`
|
values still leaking from shared files. Then update or delete this note.
|
||||||
- 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.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user