This is not just another Doom Emacs dotfile. This is the frontend of a human-agent ecosystem where both sides share one org-agenda timeline, publish to the same digital garden, and evolve the system together — in plain text.
The agent-in-charge reports here: §doomemacs-config — 인간과 에이전트가 같은 org를 여는 하네스 (Denote
20260227T120800). What this house owns, what it refuses, where the boundaries run, and the current judgment.AGENTS.mdis the standing baseline inside the repo; that note is the report going out.
Start here: Installation · Commands · Agent integration · Garden operations. This is a personal configuration, not a standalone agent harness or a turnkey distribution.
If you glance at config.el and think "just another messy dotfile" — look closer.
What you're seeing is a shared working house. A modular Emacs configuration where a human (GLG/힣) writes, reads, enters equations, and manages a Denote knowledge base — while AI agents work on the same Org files through a separate RPC daemon. Both leave entries on one agenda timeline. The human's editor is not replaced by an agent harness: it is the place where their work meets.
Emacs is a meta-editor. Org-mode is a meta-document format. Shell scripts and Emacs daemons compose around plain-text records: Org notes become exported Markdown, public garden pages, retrieval sources, and material for the next piece of writing. Full exports can run unattended; incremental export processes changed files. The useful unit is the whole writing-and-returning loop, not an isolated agent chat.
This is one piece of a larger ecosystem. agent-config keeps shared skills and working principles; Entwurf opens and addresses independent sibling sessions; andenken retrieves past conversations and public garden writing. Their harnesses own execution, authentication, and transcripts. This repo owns the human editing surface, the Emacs RPC APIs, and the Org-to-garden export pipeline. Agents do not need Emacs to run — it is the meeting point, not their runtime.
And this timeline is not hidden inside Emacs. geworfen throws it into the world — a WebTUI at agenda.junghanacs.com that renders the same org-agenda data live. Human journal entries, agent commit stamps, diary schedules — all on one public time axis. The same elisp function agents call, the same data the browser fetches.
The buffers connect a living graph: Emacs → Org-mode → Denote notes → ox-hugo Markdown export → the Quartz digital garden → semantic retrieval → agent skills → back to Emacs. Hugo is the export format here; Quartz publishes the garden.
Why Emacs in a terminal matters: This full Doom Emacs runs in TTY with Korean input and remote access over SSH. Clipboard and image support depend on the terminal and transport; GUI parity is not assumed. An agent can reach a running Emacs server via emacsclient, eval elisp, read Org files, and stamp agenda entries. The terminal is not a limitation. It is the universal interface — the one that works on a laptop, a NUC, an Oracle ARM server, and a Galaxy Fold.
Why Org-mode: one plain-text source can hold writing, tasks, citations, equations, and links. Denote gives notes stable identifiers; the export pipeline publishes selected writing to the garden; andenken makes public garden writing retrievable alongside admitted conversations. memex-kb provides a separate Org conversion surface. The source remains readable and editable outside any agent session.
A Doom Emacs configuration for human-agent collaborative workflows, built on NixOS.
| Emacs | 31.1 (system default, Nixpkgs emacs31-gtk3) + Neomacs (separate bare comparison profile) |
| Framework | Doom Emacs (hlissner style) |
| Notes | 3,500+ Denote org-mode files in ~/org/ |
| Garden | notes.junghanacs.com — 2,200+ published |
| Platforms | NixOS (laptop, NUC, Oracle ARM), Termux (Galaxy Fold4) |
| Lines | ~20K across config + lisp + bin + scripts |
| AI | gptel on one backend — ChatGPT subscription OAuth, two models |
doomemacs-config/
├── init.el # Doom modules + single-instance guard
├── config.el # Loader — requires lisp/*.el, kept minimal
├── packages.el # Package declarations
├── per-machine.el # Machine-specific (git-ignored)
│
├── lisp/ # Modular config (one concern per file)
│ ├── ai-*.el # AI/Agent integration
│ ├── denote-*.el # Denote ecosystem (5)
│ ├── org-*.el # Org-mode (2)
│ ├── korean-input-config.el # Korean input, fonts, NFD→NFC, writing hygiene
│ ├── tty-config.el # TTY: term-keys, width fixes, clipboard setup
│ ├── term-config.el # In-Emacs terminal — :term ghostel module + overrides
│ ├── tmux-config.el # tmux control surface — herd status board, attach
│ ├── workflow-shared.el # Human ↔ Agent shared contract
│ └── ... # 25+ more modules
│
├── bin/ # Standalone scripts
│ ├── agent-server.el # Agent RPC server (socket "server")
│ ├── denote-export.el # Multi-daemon export engine
│ ├── denote-export-parallel.py # Python parallel orchestrator
│ ├── emacs-unstable.sh # Separate Doom profile on system Emacs 31
│ ├── neomacs.sh # Neomacs vanilla profile launcher + probe runner
│ ├── fix-org-links.el # Stage 1 — ~/org link rewriter (file:~/repos/gh → GitHub URL)
│ ├── fix-org-mdbold.el # **bold** → *bold* on garden dirs only (not journal)
│ ├── site-policy.el # SSOT for host aliases, internal-path patterns, lychee opts
│ ├── verify-relref.py # Hugo relref link validator + fixer
│ ├── verify-figures.py # Figure src validator + fixer (Hugo + markdown)
│ ├── verify-content.py # Garden content hygiene (host alias, internal path, GitHub 404)
│ ├── verify-org-links.py # Stage 1.5 — ~/org GitHub URL lychee verify (read-only)
│ └── check-description.sh # Check for missing description / abstract
│
├── neomacs/ # Neomacs vanilla minimal profile (builtin-only, Doom-free)
│ ├── early-init.el / init.el # Runs on Neomacs AND stock GNU Emacs
│ └── probe/ # K-review probes — Korean org, export, TLS, real corpus
│
├── prompts/ # gptel-agent system prompts (overrides upstream)
│ └── gptel-agent.md # Subagent-free variant of upstream default
│
├── tests/ # ERT suite — `emacs -Q --batch`, no Doom (Tier A)
│ ├── run-tests.sh # Auto-discovers test-*.el
│ └── TESTING-GUIDELINES.org # Tier A/B/C partition — what is worth testing
│
├── run.sh # Unified CLI/TUI management
└── flake.nix # Emacs 31 Nix build (nixos-unstable emacs31-gtk3)
This config is being refactored toward a consistent Doom-style Lisp system: config.el stays a loader, lisp/*.el keeps one concern per file, custom symbols use the my/ namespace, and new code avoids Doom v2 compatibility shims such as IS-*, setq!, and featurep!.
The living convention document is published in the garden and kept at a stable URL:
GitHub is split on purpose. The human surface stays thin; agents already own the heavy issue/PR lane.
| Surface | Where | Role |
|---|---|---|
| consult-gh | SPC g h (project-config.el) |
Human global search — repos / code / issues. Preview in Emacs, hand the target to an agent. |
| magit-gh | Magit ; |
PRs inside the current Magit repo. |
| git-link | commands | URL for the file/commit under point. |
| ghcli (agent skill) | outside Emacs | Issue/PR/notification work for agents. |
consult-gh is MELPA core only (no embark/forge/pr-review companions, no omni-search stack). Clone default is ~/repos/3rd/. Multi-account switch is SPC g h a (gh auth already holds the logins).
The stance here is to keep what Doom binds and only override the keys that actually need to change. So bindings are pushed in non-destructively: a map! in this config walks into the keymap Doom already put at a prefix and overwrites one key, leaving the rest of the group intact. config.el loads after Doom's modules, so on a genuine collision ours wins — without taking the group down with it.
That means a prefix is never given a name in map!:
;; No. Both bind a keymap AT the key, destroying whatever prefix map is there.
(map! :leader (:prefix ("f" . "files") "y" #'my/yank-buffer-absolute-path))
(map! :leader (:prefix-map ("j" . "pi-agent") "a" #'my/zmx-launch))
;; Yes. Keys only. Doom's doom-leader-file-map survives; SPC f y becomes ours.
(map! :leader (:prefix "f" "y" #'my/yank-buffer-absolute-path))This is not stylistic. Doom pulled general.el out of map! (de2a3364a) after which-key landed in Emacs 30.1, moving labels from general's global regexp table to native cons cells (("label" . command)). A described prefix used to be a no-op that only registered a label; it now binds a fresh make-sparse-keymap. The syntax never changed, so a config written against the old meaning breaks in silence — here it took out doom-leader-file-map, the standard help-map, and every group five different files were sharing.
Group labels live in one place, the which-key SSOT block in keybindings-config.el. Built-in which-key renames the existing binding in place rather than replacing it, and will plant a label for a group that doesn't exist yet — so labeling is non-destructive and load-order-independent, and the whole leader layout reads in one screen.
tests/test-keybinding-lint.el fails the build on either named-prefix form, at file:line.
F7 opens the pass menu, including in Ghostel's usual semi-char mode. C-c C-p retains its mode-specific behavior (for example, previous heading in Org). Ghostel's explicit raw char mode still sends F7 to the terminal application.
The core design: one timeline for both human and AI.
workflow-shared.el is loaded by both user Emacs and agent-server.el. It defines:
- Dynamic
org-agenda-filesfrom_aprjtagged Denote files + botlog + journal - Tag regex contract —
[[:alnum:]@#%]+only, matching Denote filetags - Active timestamps in journal entries for agenda visibility
Agents stamp entries like:
**** pi-skills: feat: summarize skill :pi:commit:piskills:
<2026-03-01 Sat 11:53>
The same org-agenda view shows human tasks and agent activity side by side.
The editor and agent RPC run in separate instances. Daily use is one GUI + many TTY clients attached to the pi daemon. A second Doom profile is available for comparison:
| Socket | Instance | Purpose |
|---|---|---|
"user" |
Emacs 31.1 GUI | GLG's primary editor — doom run, attach via emacsclient -s user -t (optional ecs alias below) |
"pi" |
Emacs 31.1 headless (full Doom) | TTY attach target — terminal tabs attach via ./run.sh pi tty (optional ep alias below). One full Doom shared by N terminals |
"server" |
Emacs 31.1 headless | Agent RPC daemon — agents eval elisp via emacsclient -s server (loaded with bin/agent-server.el) |
"doom-unstable" |
Emacs 31.1, separate Doom profile | Isolated comparison frontend (./run.sh unstable run) |
Standalone emacs -nw (no daemon) still works (optional et alias below) but is no longer the primary path — the pi daemon shares Doom state across all TTY tabs and avoids per-tab init cost.
Entwurf has replaced the former pi-shell-acp project. It opens visible sibling sessions and delivers messages by garden id across independent harnesses. ACP is one plugin, not the identity or collaboration boundary. Emacs does not own sibling lifecycle, authentication, or transcripts.
This config offers several ways to meet those agents:
- Terminal sessions: ghostel holds tmux sessions; agents keep running independently of Emacs. The herd board reports terminal activity, not Entwurf delivery or citizen liveness.
- Native Emacs buffers: pilish is a two-buffer client for Pi's stdio RPC, configured in
ai-pi-agent.el.ai-pimacs.elconfigures an alternative one-buffer client, pimacs. Neither client is the Pi harness itself. - ACP buffers:
ai-agent-shell.elconfigures agent-shell; outside Termux, its Claude adapter comes from the dependency pinned by Entwurf. - Shared Org work: the agent RPC daemon exposes the APIs in
bin/agent-server.el, independently of any one agent harness.
The current pilish configuration passes --entwurf-control and --emacs-agent-socket pi; pimacs passes the same control flag but selects server. The socket flag exports PI_EMACS_AGENT_SOCKET for that Pi session's tools. pilish therefore targets the full Doom pi editor instance, not the headless RPC daemon. For ordinary headless Org operations, use server explicitly:
./run.sh agent start
emacsclient -s server --eval '(agent-denote-search "emacs")'These are separate choices: the selected Emacs socket says where elisp runs; an Entwurf garden id says which sibling receives a message. Neither substitutes for the other.
The socket split is intentional:
server— agent RPC daemon (bin/agent-server.el). Headless, loaded by./run.sh agent start. Agent elisp runs outside the editor process; concurrent writes to shared files still need coordination.pi— human TTY attach (./run.sh pi tty). Full Doom. This is where GLG actually writes.user— GUI Emacs for visual work (Magit graphs, ePub, image-heavy org).
Because the primary editor surface is emacs -nw / emacsclient -t, every keybinding has to survive in TTY frames. Cases like :lang org's , localleader being silently dropped under emacs --daemon (fixed in org-config.el by deferring +org-init-keybinds-h to server-after-make-frame-hook, the same pattern doom itself uses in doom-keybinds.el:80) are taken seriously here — not as Emacs trivia, but because the terminal is the surface agents and humans both touch.
Parallel multi-daemon pipeline exporting 2,000+ org notes to Hugo markdown:
~/org/{meta,bib,notes,botlog}/*.org
│
denote-export-parallel.py # Python ProcessPoolExecutor
│
┌────┼────┐
d1 d2 dN # N Emacs daemons (run.sh default: 4)
└────┼────┘ # ox-hugo + link conversion + security filters
│
~/repos/gh/notes/content/
./run.sh export all # Incremental (mtime-based)
./run.sh export all --force # Full re-export
./run.sh dblock all # Update dynamic blocks onlyA historical full export (~2,000 files, 8 daemons) took ~33 min; this is not a current benchmark. run.sh defaults to 4 workers. Incremental export processes only changed files; duration depends on the batch.
Incremental means mtime against the last export stamp
(filter_changed_files in denote-export-parallel.py), and the dblock pass saves a
file only when its output actually changed, so an unchanged note keeps its old mtime.
The consequence downstream: a --force run rewrites every file it touches even when
the content is identical, so the whole batch lands with a fresh mtime and no git diff.
Anything that watches this tree for change — andenken's md track does — must not
read mtime as "content changed" on its own.
A tag is not a label, it is a magnet: /tags/emacs links to meta/†-이맥스, so a tag
no meta note defines is a dead URL. Org sources may accumulate stray tags freely; the
garden must not. The export filter (§ Section 1.7 of
denote-export-config.el) drops every tag that is not
in the pool, and never modifies the org file.
The pool is the union of #+filetags: declared in meta/*.org headers — no allowlist,
no special case. Measured 2026-09-04: 1,294 tags across 538 meta notes, all ASCII.
To publish a tag, write its meta note; to retire one, remove the filetag. The gate is
provenance, not language — nothing in the filter prefers English, so a Korean filetag
in a meta note would publish; today's all-English pool is a curation outcome, not a
rule. Two paths bypass the filter: @-prefixed categories, which are a separate
namespace, and #+hugo_tags:, which short-circuits the hook entirely.
Section tags need no exception, which is the test that the design holds — they are
decided by the same rule as everything else. Measured against the pool on 2026-09-04:
bib, meta, botlog, autholog, journal and monthly have meta notes and
survive; notes and llmlog do not and drop out on their own, recoverable from the
folder name anyway. That membership moves whenever a meta note is written or retagged,
so read the pool, not this line.
A pool below my/org-hugo--tag-pool-minimum (500) aborts the export rather than
silently stripping every tag in the garden, which is what a headless daemon with the
wrong denote-directory would otherwise do. The cache re-fingerprints meta/ on its
own instead of waiting to be invalidated, because both holders outlive an edit — a GUI
session, and an export daemon the parallel orchestrator reuses across runs.
lisp/ekg-config.el configures EKG 0.9.2 with VUI 1.0.0, pinned to their release commits. VUI 1.4 removes the colon from keyword text properties, while EKG 0.9.2 uses :ekg-note-id to resolve list actions. That pair rendered notes but could not open them for editing; the compatible VUI pin is removable only after the list/open probe passes with a newer pair. It starts a new database at ~/org/ekg/ekg-2026.sqlite; the older ekg.db is not imported or opened. This is an additional capture surface, not a garden migration. No Denote export, embedding, LLM, agent, or agenda module is enabled.
After ./run.sh sync and an Emacs restart, use M-x ekg-capture, ekg-capture-file, ekg-show-notes-with-tag, or ekg-show-notes-with-all-tags. Notes use Org formatting; display truncation counts characters for Korean text. Finish a capture with C-c C-c.
Inline tags require brackets: write #[과학] #[무엇]인가, not bare #과학 #무엇. EKG converts these to tag links and collects the tags on save; Korean and English both work. Completion after # uses existing tags (M-x completion-at-point); it is not automatic translation or tag suggestion. A fresh database initially has few candidates. EKG-specific Evil bindings live in lisp/keybindings-config.el: in the notes list, j/k (or n/p) select notes, RET/o edit, c captures, r refreshes, t selects a tag, b opens a resource, x hides a note, and q closes the list. In capture/edit buffers, C-c C-c finishes in normal, visual, and insert states. C-c C-k aborts a new capture; for an existing note it calls kill-current-buffer (EKG 0.9.2 has no ekg-edit-abort). ekg-confirm-on-buffer-kill is enabled so unsaved changes require confirmation; already saved edits are not rolled back. In all three states, C-c / retains EKG's metadata menu (a adds a tag, r removes one). Single-letter actions do not override Org body editing.
Normal EKG changes use the native triples every-change backup strategy with 30 numbered recovery copies. Copies go to ${XDG_STATE_HOME:-~/.local/state}/ekg/backups/, outside the synchronized Org tree. Forced backups (including upgrades and handoff) can temporarily retain additional copies. SQLite's .backup creates each snapshot; our wrapper checks that the expected file exists and passes read-only PRAGMA quick_check, because triples itself does not check the backup subprocess exit status. Missing sqlite3, missing/empty copies, and failed checks signal errors. A backup error may happen after the note was saved to the live database; preserve that database and investigate rather than repeatedly recapturing the note.
Syncthing is not SQLite replication, even without simultaneous editing. Use only one EKG-owning Emacs instance at a time. Before changing machines:
- Finish or abort all pending EKG captures/edits.
- Run
M-x my/ekg-close-for-syncon every Emacs instance that opened EKG. It verifies a forced backup before closing; it does not run Syncthing. - Wait until Syncthing has finished on both machines, with no conflicts, before opening EKG on the destination. That machine must also have this configuration and the pinned package installed.
Do not enable WAL or copy a running database's main file as a backup. On a sync conflict, stop EKG on both sides and preserve all conflicting databases and local snapshots; do not merge SQLite files or choose a winner by mtime alone. Local numbered copies are recovery points, not an off-machine archive or a proof that a snapshot contains the desired note. To restore, close all EKG instances, preserve the failed DB, inspect a snapshot, then restore a copy of it to the configured path with Syncthing paused on both sides. Resume synchronization only after verifying the recovered notes and deliberately reconciling the other host.
The 2026-10-31 installed-package probe (EKG 0.9.2, triples abc1842) found that the fresh-store 0.3 upgrade rebuild lost all four indexes through an index-name collision during table rename. This config therefore checks the index set on connection and permits at most two close/reopen cycles through upstream setup before any user write; incomplete acceptance closes the connection and errors. Initial schema writes already contained duplicates in the probe, so one reopen was not sufficient. No triples source is patched; retire this workaround only when installed-package probes demonstrate that both upgrade and automatic-recovery rebuilds preserve all four indexes. Do not run ekg-force-upgrade on a live working database: take a verified backup and rehearse maintenance on an isolated copy first, since forced upgrades can re-enter connection setup during rebuilding.
The final probe passed Korean/English inline-tag recognition, four-index acceptance, 35 saved revisions, actual list rendering and edit-target resolution, 30 normal recovery copies, snapshot checks, and recovery of the identical EKG note and complete index set from a copied handoff snapshot. The list/open check reproduced the VUI 1.4 failure and passed with VUI 1.0.0. These are package-level checks, not proof of real Syncthing transfer or human GUI acceptance.
tests/test-ekg-config.el covers failure signalling, local routing, SQLite readback, and handoff ordering without touching personal data. The opt-in tests/ekg-integration.el exercises the installed EKG/triples packages against temporary databases; supply their installed directories on load-path and run it separately from the vanilla ERT suite.
The care bots read GLG's EKG notes through the agent RPC daemon (#12). Tags are clues that combine: (agent-ekg-notes '("과학" "무엇")) returns the notes carrying both. A day is its date tag, "date/2026-10-31", as EKG adds it at capture.
| Door | Returns |
|---|---|
(agent-ekg-notes TAGS &optional LIMIT OFFSET) |
Text notes with every tag (AND), newest first, ties by id — only ids agent-ekg-read accepts. LIMIT 1..100 (default 20); :total counts all matches. Each entry carries a 200-character raw :preview and :length. |
(agent-ekg-read ID) |
One note's raw stored text, tags and times. ID keeps its type: 4242 and "4242" differ. Inline commands are not run, resources not fetched. Hidden notes are returned with :hidden t. |
(agent-ekg-tags &optional LIMIT OFFSET) |
Content tags with :count (what agent-ekg-notes returns for that one tag) and :hidden-count. Material for spotting typos with GLG, not a corrector. |
All three return a plist: (:ok t … :source …), or (:ok nil :error KIND :message …) with KIND store-missing, store-invalid, package-unavailable, invalid-argument, not-found, not-a-note, or read-failed. An empty search is (:ok t :total 0 :notes nil), never an error. Hidden notes (EKG's trash/draft) follow EKG's own rule: left out of listings unless that tag is requested. :source gives the DB path, host, file mtime/size and read time — freshness of this host's copy, not proof that Syncthing has finished.
The logic is lisp/ekg-agent-read.el, using EKG's own API rather than a private SQLite parser. The daemon does not load ekg-config.el; the store path is my/ekg-agent-db-file, kept equal to my/ekg-db-file by a test. Each call checks that the store exists and is SQLite before connecting, so a missing or half-synced file is reported rather than created empty. It binds its own ekg-db and closes it, leaving any connection the caller holds untouched.
No door saves, tags, trashes, or deletes a note, but the file is not byte-identical. Measured 2026-10-31 on a fixture (EKG 0.9.2, triples abc1842): the first ekg-connect in each Emacs process runs ekg-upgrade-db, whose tail re-registers five core note types — SQLite's file change counter rose by 5 with identical rows, and later calls in the same process wrote nothing. The daemon therefore changes the synced file's bytes once, on its first EKG call after a start. This is EKG's normal bookkeeping, left as is (#12 does not promise an immutable file); a newer EKG may differ, so re-measure on upgrade. This is a read surface for the documented doors, not a sandbox: emacs_eval can still run any EKG function.
tests/test-ekg-agent-read.el (vanilla) covers argument rejection, the store checks, failure kinds, path drift, and that bin/agent-server.el defines the doors. The opt-in tests/ekg-agent-read-integration.el seeds a temporary store through ekg-config.el in a child Emacs, then runs the reader load form and the doors from the shipping agent-server.el source against it (the whole daemon is not booted): AND, date tags, hidden notes, typed reads, counts equal to listings, paging, connection isolation, the first-call counter, and no sidecar file after close. The run command is in its header.
The in-buffer agent workflow uses gptel-agent (karthink): Markdown/Org agent definitions, skills from ~/.claude/skills/, and tools inside Emacs buffers. Our default prompt removes subagent delegation (see below). This is distinct from the independent coding sessions reached through Entwurf and tmux.
| Module | File | Purpose |
|---|---|---|
| gptel-agent | ai-gptel.el (use-package! gptel-agent) |
Primary chat/agent surface — agent presets, skills, in-buffer tool execution |
| GPTel core | ai-gptel.el |
OpenAI-sub (ChatGPT subscription OAuth), two models (gpt-6.1-terra/gpt-6.1-sol) + Codex stream advice |
| Pi clients | ai-pi-agent.el, ai-pimacs.el |
pilish (two buffers) and pimacs (one buffer), over Pi stdio RPC |
| Agent Shell | ai-agent-shell.el |
ACP protocol, shell manager |
| Bot Config | ai-bot-config.el |
Telegram, Slack and Teams chat integrations |
| Whisper STT | ai-stt-whisper.el |
Speech-to-text via Groq whisper-large-v3 |
| Edge TTS | ai-tts-edge.el |
Text-to-speech |
| tmux | tmux-config.el |
The agent herd — session status board + attach, see § tmux inside Emacs |
teams4e is pinned from Git in packages.el, including its Python backend. Run ./run.sh sync after changing the declaration and restart Emacs. M-x teams4e starts with synthetic data (teams4e-mock-mode); M-x teams4e-mock-disable switches out of mock mode for the current session. Mock mode is enabled again at startup until the configuration is deliberately changed.
The teams-for-linux login does not itself give teams4e a Graph token. Live use requires an approved external authentication provider and appropriate tenant permissions; do not reuse credentials or capture company messages into Org or AI tools without checking company policy. See the upstream authentication guide. Agent Shell actions are separate and can invoke a real agent even in mock mode.
Models ship faster than a dotfile can absorb them. Every new release used to arrive
as another backend, another hand-copied spec block, another my/gptel-switch-to-*
command — and the ones that stopped being used never left. So the surface was cut
down to a single backend: OpenAI-sub, the ChatGPT subscription over OAuth
(gptel-make-openai-oauth, Codex Responses endpoint). DeepSeek, OpenRouter with its
hand-maintained Gemini specs, a Dockerized Claude wrapper, and a local Claude proxy
were all removed rather than left to rot.
The dated Copilot trial ended; GLG removed that backend on 2026-09-25.
| Role | Model | Where it is used |
|---|---|---|
| Default | gpt-6.1-terra |
Chat, buffer summarize/translate |
| Fast | gpt-6.1-terra |
gptel-quick, magit commit messages, inline translate, elfeed |
| Manual only | gpt-6.1-sol |
Explicit selection via my/gptel-switch-model or my/gptel-buffer-model-toggle |
GLG selected terra for both automatic slots on 2026-11-10. Retries also stay on terra by default; there is no automatic escalation to sol. The 2026-08-11 congestion measurement concerned the 5.6 tier, not these models.
my/gptel-models in ai-gptel.el is the SSOT — adding a model is
one line there. Passing :models explicitly also matters for a subtler reason:
without it the backend advertises upstream's full default list, so the menu fills
with models that are never used.
Specs are not restated here. Upstream gptel-openai.el loads before the OAuth
backend (via gptel-openai-responses.el) and attaches context, cost, and
capability metadata to the model symbols. Passing those symbols as :models
keeps upstream as the source of truth.
Two advices remain pinned to this backend, each documented at its definition with the
condition that would make it deletable: the Codex endpoint's mandatory stream=true
(gptel-request still defaults to :stream nil), and a max_output_tokens clear
that silences the per-request warning upstream now emits for gptel-agent's
unconditional 8192 cap. Their source-adjacent comments record the verification conditions and removal triggers; re-check them against upstream before changing either advice.
Transient overload is absorbed rather than surfaced. The subscription rail answers a
congested request with HTTP 200 and a payload-level server_is_overloaded, so
reporting :status alone yields a failure message naming nothing but HTTP 200, which
makes a remote hiccup look like a local regression. my/gptel-error-message reads
:error first; my/gptel-request-retry rides the failure out with exponential
backoff. Its final attempt switches to the fallback model, which only changes anything
when the caller's model differs from it. Both automatic slots currently use terra;
the measurements above remain explicitly about the older 5.6 tier. This is what a Codex CLI does internally; without
it, a single first failure is all the user ever sees.
gptel-agent-dirs is appended with our prompts/ directory so files here
override upstream definitions of the same name. Currently shipping:
prompts/gptel-agent.md— subagent-free variant of the upstream default. DELEGATE /<tool name="Agent">/ researcher / executor / introspector guidance removed; skills + 14 default tools (TodoWrite / Glob / Grep / Read / Edit / Write / Bash / Eval / WebSearch / WebFetch / ...) preserved.
Why: the upstream default prompt instructs the LLM to delegate aggressively, which (a) bloats every system message with ~100 lines of routing rules and (b) triggers tool-only stream completions on the OAuth Codex backend, hitting gptel-agent #107. Removing the delegation guidance keeps a single foreground agent loop — closer to how I actually use Emacs day to day.
Agents run in tmux, and tmux runs in ghostel. The nesting is deliberate: a crashed Emacs does not take the agents down, and the same session can be picked up from a bare terminal on any machine. That makes tmux the thing Emacs has to hold, not replace — which is why almost nothing about tmux is configured here.
The shell is SSOT. tm opens a session named after the directory, tml picks one with fzf (both in nixos-config users/junghan/modules/shell.nix), and ~/.config/tmux/tmux.conf owns the in-terminal keys — M-[/M-] for windows, M-\ for panes, M-c s for the fzf session popup. This config adds only what the terminal cannot reach from inside.
In ghostel's semi-char mode SPC is sent to the PTY, so doom-leader never fires inside a terminal buffer. What comes back to Emacs is exactly ghostel-keymap-exceptions — C-c, C-x, M-x, and a few more. So C-c is the only prefix available in the buffer where tmux actually lives. Outside a terminal buffer the same commands sit on SPC \ t.
| Key | Action |
|---|---|
C-c t h |
Herd — the status board below |
C-c t w |
Pick a window of this buffer's session |
C-c t n / C-c t p |
Next / previous window |
C-c t c / C-c t k |
New window (keeps the session's path) / kill the current one |
C-c t s |
Attach a session (one ghostel buffer per session) |
C-c t l |
List sessions |
The tmux prefix itself needs one more binding. GLG remaps M-c to C-c at the input layer — C-c is a pinky-hostile chord and M-c is the hand that reaches for it, which is also why tmux carries M-c as prefix2. Inside Emacs that means the M-c event never exists to be forwarded. So C-c C-c sends it explicitly: under the remap those keys are a doubled M-c, and physical M-c M-c c opens a window. That displaces ghostel-send-C-c, which moves to C-c C-k — interrupting the foreground program has to stay reachable. (tmux's primary C-b already reaches the PTY on its own through evil-ghostel; this is about the hand, not capability.)
C-c t c exists for the same reason. Creating the window from Emacs has one trap worth naming: new-window -c "#{pane_current_path}" expands against the calling client, not the target session, so it silently inherits the caller's directory. The path is resolved against the target first.
Session switching is buffer switching. tmux switch-client would need the client pty, and ghostel's pty is native (ghostel-use-native-pty) so Emacs cannot see it — but select-window needs no client target, so window navigation works regardless.
M-[ needed a fix at two layers to reach tmux at all, which is why it presented as "M-] works, M-[ does not":
- ghostel deliberately skips
?\[and?Owhen bindingM-<printable>, sinceESC [/ESC Oare the CSI/SS3 prefixes TTY input decoding uses for arrow keys. Measured on Emacs 31 —input-decode-mapwins by longest match, so binding it does not shadow CSI, and arrow keys still decode before and after anM-[press. Re-added interm-config.el;M-Ois left alone. - This config had
M-[/M-]on workspace switching globally.M-]was shadowed by ghostel's map and reached the PTY;M-[had nothing to shadow it, so it fell through and switched an Emacs workspace instead. Moved tos-[/s-].
run 1s doomemacs-config 1/2 ~/repos/gh/doomemacs-config
run 1s prime-agent 3/3 ~/repos/3rd/pi/prime-agent
idle 16h memex-kb 2/2 ~/repos/gh/memex-kb
free 5d jeohmunga 0/1 ~/repos/gh/jeohmunga
One question, narrowly: is that session still doing something, or is it three agents sitting idle and worth killing? It is a resource decision. Agents is live agents / total windows, so 2/2 means both windows hold an agent and 0/1 is an empty shell. RET opens the session, w breaks it into windows, D kills it, gr refreshes.
Classification uses one signal: window_activity, tmux's timestamp of the last pane output. Writing directly to pane_tty shows what resets it — a printed line, a spinner redrawing in place, and even invisible bytes (\033[?25l\033[?25h, an OSC 2 title change). It counts bytes arriving, not visible change. session_activity is the wrong one: it also counts client interaction, and reported 2s for a session whose windows had been silent for 16 hours.
The obvious worry is an app that repaints on a timer looking busy forever. Sampling the whole board twice, 30s apart, all 18 silent panes came back at exactly +30s — nothing here repaints while parked — while every working agent sat pinned at 0s, because these CLIs animate a spinner while they think. So a long silent tool call is the only realistic false idle, which is what the generous 60s threshold is for.
Pane titles are shown but never used to classify. Agent CLIs do broadcast state there (✳ … from Claude Code, ● …: done from pi), but the vocabulary is per-CLI and changes without notice — which is exactly how the previous version of this file rotted into a dead parser. Idle time is CLI-neutral. "Waiting for approval" is deliberately not modeled: agents run yolo here.
Full Korean support across GUI and terminal:
- Input: korean-hangul with Evil auto-switching, abbrev expansion
- Fonts: machine-specific families via git-ignored
per-machine.el, with Korean font handling in the shared config - NFD→NFC: macOS/Termux filename normalization
- TTY: term-keys, width corrections, OSC 52 setup; kitty-graphics is manual opt-in
- Unicode: NBSP handling, zero-width space for ox-hugo
Korean input is configured for both GUI and TTY. Clipboard transport is not universally equivalent: the recorded remote OSC 52 path is unresolved, its end-to-end cause has not been established, and the current workaround is tmux copy-mode. See the clipboard FAQ and NEXT.md before changing that path.
The system default is Emacs 31.1 as of 2026-09-02 — every device moved via the
nixos-config unstable overlay, so "user", "pi" and "server" all run 31.1. This
channel is no longer where 31 gets tried out; it stays as a second, fully separate Doom
profile for testing a config change without touching the daily one.
A second Emacs install built from Nixpkgs nixos-unstable. The launcher/output name remains emacs-unstable for compatibility; it selects the released emacs31-gtk3 package explicitly, matching this i3/X11 environment and its GTK input-method integration.
./run.sh G (or menu G, or ./run.sh doom-pull) updates only the main Doom checkout. Update the optional profile explicitly with ./run.sh doom-pull unstable; use ./run.sh doom-pull all to update both.
./run.sh unstable run # GUI
./run.sh unstable tty # Terminal (optional alias: etu)
./run.sh unstable install # First setup
./run.sh unstable debug # --debug-initBuilt via flake.nix using Nixpkgs. Separate EMACSDIR (~/doomemacs-unstable) and server socket ("doom-unstable") so it coexists with the system Emacs — same version now, separate profile and package tree.
Neomacs rewrites the Emacs core (~300K lines
of C) in Rust. neomacs/ holds a vanilla profile for it, plus probes that turn
Korean behavior into reproducible reports. Doom is not involved: separate
--init-directory, separate server name, no shared state.
The profile is builtin-only with one deliberate exception: if a local pure-Elisp
Denote checkout already exists on disk it is put on load-path, so denote: links in
a real corpus resolve instead of aborting the export probe. Nothing is fetched, no
package manager runs, and anything needing a C module or native-comp stays out — the
no-network rule holds.
./bin/neomacs.sh --fetch # download a release AppImage (no source build)
./bin/neomacs.sh # GUI
./bin/neomacs.sh --probe # run all probes in batch
./bin/neomacs.sh --gnu # same profile on stock GNU Emacs — the baselineThe profile must run identically on Neomacs and stock GNU Emacs, so comparison with GNU helps attribute a divergence to the runtime rather than to this config. Probes run one process per file, because a crash that kills the runtime is itself a finding.
For the GNU batch baseline, use NEOMACS_BIN=emacs ./bin/neomacs.sh --probe; --gnu launches the interactive comparison profile and does not compose with --probe. Neomacs --daemon and --kill fail closed in the launcher; they are not working server operations.
Current Neomacs validation and workarounds belong to neomacs-config (ownership moved on 2026-09-27). This repo retains the builtin-only comparison profile and reproducible probes; neomacs/README.md records historical measurements, not the current validation verdict.
./run.sh # Interactive TUI menu
./run.sh sync # doom sync
./run.sh agent start # Start agent RPC daemon (socket "server")
./run.sh pi start # Start pi Doom daemon (socket "pi")
./run.sh pi tty # Attach a new TTY client to the pi daemon
./run.sh export all # Export all folders (incremental)
./run.sh export all --force # Force re-export
./run.sh unstable tty # Separate Doom profile — terminal mode
./run.sh verify # Verify garden md ([1/4]~[4/4], read-only)
./run.sh fix # Fix garden md ([1/4]~[4/4], step-by-step y/N)
./run.sh fix-org # Rewrite ~/org link patterns (dry-run + y/N + --apply)
./run.sh fix-org --check # Verify ~/org GitHub URLs with lychee (read-only)
./run.sh fix-bold # **bold** → *bold* on notes/bib/meta/botlog (dry-run + y/N)Post-export content quality verification and correction for the digital garden. Unified under the TUI Verify section's V/F keys. Four stages:
./run.sh verify — read-only verification [1/4]~[4/4]:
| Stage | Tool | Checks |
|---|---|---|
| [1/4] relref | verify-relref.py --summary |
ALIVE / VIRTUAL / REWRITE / DEAD / AMBIGUOUS / MALFORMED |
| [2/4] description | check-description.sh |
Missing #+description: / abstract callout in botlog / notes / bib |
| [3/4] figures | verify-figures.py |
ALIVE / REWRITE / AMBIGUOUS / DEAD / UNKNOWN — covers both Hugo {{< figure src=…>}} and Markdown  |
| [4/4] content | verify-content.py --lychee |
HOST_ALIAS / INTERNAL_PATH / PRIVATE_ENDPOINT / URL_CRED / GITHUB_404 (+ ORPHAN, currently disabled) |
./run.sh fix — per-stage dry-run followed by y/N apply:
| Stage | Action |
|---|---|
| [1/4] relref | DEAD/MALFORMED → plain text, REWRITE → corrected path |
| [2/4] anchors | Strip leaked ox-hugo anchors: {#title--relref-section-id-dot-md} → {#title} (regression where transcoded markdown leaks into the slug of link-embedded headings) |
| [3/4] figures | REWRITE → copy source file into notes/static/images/ and rewrite the markdown src to /images/{basename} |
| [4/4] content | HOST_ALIAS auto-alias rewrite; INTERNAL_PATH and GITHUB_404 → plain text. lychee verifies github.com/USER/* URLs return 200 OK. site-policy.el is the SSOT |
verify-figures.py SEARCH_DIRS priority: notes/static/images/ → ~/screenshot/ → ~/org/.attach/. Files already promoted by a prior export are matched first, so only the src is rewritten without a copy (sha256 match → SKIP-IDENT).
verify-content.py output annotates every detection with a → ~/org: <path> mapping line so the source file can be opened directly in Emacs for editing.
lychee operational notes:
GITHUB_PERSONAL_ACCESS_TOKEN(orGITHUB_TOKEN) recommended. Place it in~/.env.local;run.shauto-sources it for verify/fix [4/4] andfix-org --check. Without a token results are advisory only — secondary abuse rate-limits trigger many false positives (measured: 84 broken without token → 1 with token)..lycheecacheprovides a 1-day cache withcache-exclude-status: "404"as a safety net — agenda-stamp SHA URLs flip from 404 → 200 over the push cycle, so caching them would persist a false positive.max-concurrency: 16(default 128 trips abuse detection).
Remaining broken items (DEAD / UNKNOWN / GITHUB_404, etc.) are decided by the user in the source org file: remove the figure, retake the screenshot, mark as private, demote to plain text, or rename.
Rewrites links in source ~/org files (Stage 1). The SSOT transformation that lives next to the garden export hook:
| Pattern | Rewritten to |
|---|---|
[[file:~/repos/gh/REPO]] |
[[https://github.com/junghan0611/REPO]] |
[[file:~/repos/gh/REPO/path/file.el]] |
[[https://github.com/junghan0611/REPO/blob/main/path/file.el]] |
[[file:~/repos/gh/REPO/file.el::N]] |
[[https://github.com/junghan0611/REPO/blob/main/file.el#LN]] (line anchor preserved) |
[[https://OLD.junghanacs.com][...]] |
site-policy.el host-aliases substitution |
Protected regions (never touched): [[denote:UUID]], [[file:~/screenshot/...]], [[file:~/org/.attach/...]], [[file:~/org/...]], and the interior of code / verbatim / src-block (handled automatically via org-element).
Modes:
O/./run.sh fix-org— dry-run → y/N → apply. Local-absent targets are marked with ⚠./run.sh fix-org --apply— apply directly without prompt./run.sh fix-org --check— no transformation. Verifies[[https://github.com/USER/...]]URLs in~/orgvia lychee and reports broken ones as file:line (user triages directly in~/org)
SSOT: a single line added to bin/site-policy.el is simultaneously visible to fix-org, verify-content, and verify-org-links.
Agents often paste markdown bold into org sources. This rewrites the garden publish surface only:
| Scope | notes/ bib/ meta/ botlog/ |
| Excluded | journal/ (never scanned) |
| Guard | org-element skips src/example/export/verse/comment, drawers, code/verbatim |
| Flow | B / ./run.sh fix-bold — dry-run → y/N → apply |
Standard operational flow after a full export:
Phase Command Purpose
───── ─────── ───────
1. Org hygiene O ) ./run.sh fix-org ~/repos/gh/ file: → GitHub URL
(optional) CLI: ./run.sh fix-org --check Detect broken GitHub URLs (token required)
B ) ./run.sh fix-bold **bold** → *bold* (notes/bib/meta/botlog)
2. Export 7 ) ./run.sh export <dir> Incremental
8 ) ./run.sh export <dir> --force Force rebuild
9 ) submenu Per-folder incremental/full
3. Garden verify V ) ./run.sh verify [1/4]~[4/4] checks
4. Garden fix F ) ./run.sh fix Per-stage y/N. Only auto-fixable cases applied
5. User triage (edit ~/org directly in Emacs) Follow the → ~/org mapping from verify output
6. Deploy cd ~/repos/gh/notes && git push Publish the garden
cd ~/sync/org && git push Push ~/org changes too
# Doom Emacs
git clone https://github.com/doomemacs/doomemacs.git ~/doomemacs
# This config
git clone https://github.com/junghan0611/doomemacs-config.git ~/repos/gh/doomemacs-config
ln -s ~/repos/gh/doomemacs-config ~/.doom.d
# Sync
~/doomemacs/bin/doom syncThese are optional examples, not a guarantee of aliases installed by this repo. Use the full commands above when following the instructions.
# Daily use — daemon attach
alias ecs='emacsclient -s user -t' # Attach TTY client to GUI Emacs (user daemon)
alias ep='~/.doom.d/run.sh pi tty' # Attach TTY client to pi daemon (full Doom)
alias es='~/.doom.d/run.sh agent restart' # Restart agent RPC daemon (socket "server")
alias eup='~/.doom.d/run.sh unstable run' # Separate Doom profile GUI
# Standalone (fallback)
alias et='emacs -nw' # System stable Emacs terminal, no daemon
alias etu='~/.doom.d/bin/emacs-unstable.sh --nw' # Separate Doom profile terminal, no daemonTypical session: launch doom run once for the GUI, run ./run.sh pi start, then open WezTerm tabs and type ep in each. All tabs share the same pi daemon — config edits, packages, native-comp eln cache, even open buffers are shared. Agent RPC runs in a separate server daemon so it never blocks the editor.
| Platform | Emacs | Terminal | Status |
|---|---|---|---|
| NixOS 26.05 | 31.1 (emacs31-gtk3, system default since 2026-09-02) |
Ghostty / WezTerm | Primary |
| Termux (Android) | 30.x (nox) | Termux | Tested |
- Digital Garden — 2,200+ notes published from this setup
- Garden repo — Quartz publication of the exported notes
- geworfen — org-agenda live at agenda.junghanacs.com
- agent-config — Shared skills, identity, and working principles across harnesses
- Entwurf — Visible sibling lifecycle and garden-id delivery
- memex-kb — Org-mode → any format conversion
- andenken — Retrieval over conversations, public garden writing, and bot records
- nixos-config — Reproducible system
- GLG-Mono — Custom programming font
- §doomemacs-config — the agent-in-charge's standing report — Denote
20260227T120800 - §doomemacs-config: ⊨agent-server — fence, playground, trust: the three layers behind
bin/agent-server.el - 에이전트 기억층 — 누가 기억의 주인인가 — the cross-repo axis where each steward answers from their own seat
- GNU Emacs — the extensible, self-documenting editor
- Org Mode — your life in plain text
- Doom Emacs — Henrik Lissner's framework
- Protesilaos Stavrou — Denote, modus-themes, and a philosophy of computing
- Pi Coding Agent — the coding-agent runtime used by the Pi clients
- ghostel — dakra's terminal emulator inside Emacs (libghostty-based); the surface my pi / Claude Code TTY workflow runs on, and the project that finally made Korean IME inside terminal-Emacs feel solid. The Lisp-IME read-only compose fix landed upstream (PR #510, shipped as the documented
ghostel-imeextension), and this config now rides the official:term ghostelmodule — unpinned to trackmain, since ghostel iterates faster than Doom's package pin
Q: Doesn't running multiple Emacs instances waste memory?
After switching to the daemon-attach model (2026-05) the memory footprint dropped sharply. Opening N WezTerm tabs no longer spawns N Emacs processes — only emacsclient -t clients are added.
| Process | RSS |
|---|---|
GUI Emacs (doom run, user daemon) |
~413 MB |
| Pi Emacs daemon (full Doom, all TTY tabs share) | ~360 MB |
emacsclient -t (per terminal tab) |
< 5 MB |
Agent RPC daemon (server socket, headless) |
~124 MB |
The old standalone model spawned a fresh ~360 MB Doom process per TTY tab — five tabs ≈ 1.8 GB. Now five tabs cost 360 MB + 5 × 5 MB ≈ 385 MB. The native-comp eln cache was already shared, but the bigger win is paying the Doom init cost only once.
Q: Why pi daemon + emacsclient -t instead of standalone emacs -nw per tab?
Originally each tab launched its own standalone emacs -nw. The upside was a dedicated pi coding agent session per instance — but Doom init ran every time, and the package cache, theme, and open buffers were isolated.
Now a single full Doom daemon started by ./run.sh pi start accepts attach from every terminal. A buffer opened in one tab is visible in another, and gptel sessions, the pi agent shell, and org-agenda are shared. Agent RPC runs in a separate server daemon so editing and agent traffic never block each other.
Standalone emacs -nw is kept as a fallback (optional et alias above) — useful when the daemon is down or an isolated environment is needed.
Q: How does Korean input work in terminal Emacs over SSH?
Five layers, each solved independently:
| Layer | Solution |
|---|---|
| Physical key → X11 | xkb kr104: Right Alt → Alt_R keysym |
| X11 → Terminal | fcitx5 Default group (English) → passthrough |
| Terminal → Escape seq | WezTerm: RightAlt → term-keys byte sequence |
| Escape seq → Emacs event | term-keys input-decode-map → <Hangul> |
| Emacs event → Korean text | toggle-input-method → korean-hangul (internal) |
No OS IME inside Emacs. No NFD issues. Works identically over SSH + tmux. See tty-config.el, korean-input-config.el.
Q: How does clipboard work in terminal Emacs?
tty-config.el enables Emacs's built-in xterm.el OSC 52 selection path, not clipetty. Configuration is not proof of end-to-end clipboard delivery.
The recorded 2026-09-14 remote test found that an xclip selection override could clear the terminal's OSC 52 parameter even with xclip-mode disabled. Two attempted fixes were reverted. The current workaround for that SSH/tmux path is tmux copy-mode, which was observed to reach the local clipboard; the next unresolved probe is direct OSC 52 output from the Emacs pane's pty.
Local clipboard access depends on the active Doom TTY/xclip and terminal environment. Do not infer remote success from local success, or blame the terminal from an Emacs selection failure alone. NEXT.md records the measured boundary and the exact next probe; no clipboard behaviour was changed in this documentation update.
Q: Why block cursor in normal mode, bar in insert?
DECSCUSR escape sequences in tty-config.el — 3 lines, no extra package. evil-terminal-cursor-changer disabled (was conflicting with term-keys/KKP).
Q: 33 minutes for 2000 files? Really?
That is a historical measurement with 8 parallel Emacs daemons via Python ProcessPoolExecutor, not a current performance guarantee. run.sh now defaults to 4 workers. Incremental export processes only changed files. The same ox-hugo + Denote pipeline handles dblock updates, security filtering, and link conversion in one pass.
MIT