Files
dotemacs/agent-start-here.md
T
Willem van den Ende 3fe94894bf 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.
2026-11-05 10:52:05 +00:00

7.3 KiB

Agent start here: handoff note (v2)

Rewritten 2025-11-05 after the mac session finished the unified migration. Read this before touching anything. The previous version (mac after first pull) is obsolete; its pending mac work is done.

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

  • 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 with ./bin/link-machine.sh.
  • Never commit init.el, custom.el, config-local.el, or *.elc.
  • config.el and packages.el are shared by both machines. Prefer config-mac.el / config-linux.el for machine-specific work.
  • Do not "reconcile" mac/init.el with linux/init.el. They differ on purpose (mac: no +eglot, elixir module without +lsp, vertico-era module list; Linux: (elixir +lsp), etc.).
  • 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

File Ownership
config.el shared settings, loaded first
packages.el shared package declarations
config-linux.el loaded on GNU/Linux only
config-mac.el loaded on macOS only
linux/init.el, mac/init.el per-machine Doom module lists
config-local.el gitignored overrides; actually loaded since 2e21324, after everything else. Template: config-local.example.el

Agent environment lessons (cost us time; read these)

  • pi's sandbox blocks all writes to ~/.emacs.d. doom sync, doom env, anything that writes caches/logs fails with Operation not permitted, and sandbox-exec cannot escape it. Humans must run doom sync / doom env 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 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 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:
    (progn (require 'eglot)
           (alist-get '(elixir-mode elixir-ts-mode heex-ts-mode)
                      eglot-server-programs nil nil #'equal))
    
    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.

Open work: speech-to-text on the mac

config-mac.el now has the ported whisper/live-dictate block (keys under SPC A). whisper and websocket are installed. What is missing is a backend. Facts established this session, so the next agent need not re-derive them:

  • 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.

Known shared defects (still open; out of scope unless the human asks)

  • config.el's use-package! pi-coding-agent block is awkward: :commands pi plus an :init defalias do overlapping jobs; a :custom line is commented out. Balanced parens, loads fine, but should be cleaned up.
  • Dead/commented leftovers in config.el: linum-format (mode gone in Emacs 29), duplicate display-line-numbers-type and enable-local-variables settings, commented doom-font block.
  • 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 config-linux.el, not by changing the mac path.
  • LaTeX fonts are mac-only in shared config.el (~line 128): ETBembo RomanOSF / Raleway / Fira Code in org-latex-classes. Linux PDF export fails until that block moves to config-mac.el.
  • Duplicated blog roots in shared config.el (~line 318) and in both leaves. Harmless (leaf wins) but should be removed from the shared file.
  • config-local.el now actually loads (2e21324). If a stale one exists on the Linux machine, its settings wake up on the next restart there. The Linux session should check for its existence before anything else.

When done

Report: git log --oneline and git status --short; what changed file by file and why; static vs runtime checks, explicitly; any machine-specific values still leaking from shared files. Then update or delete this note.