| name | emacs |
| description | Emacs daemon โ org manipulation, denote notes, citar bibliography, org-agenda, arbitrary elisp. Two sockets: server (agent work), user (show file to user). Core: agent-denote-add-history(ID,CONTENT), agent-denote-add-heading(ID,TITLE,BODY) or (ID,TITLE,TAG,BODY) โ no tag? body as 3rd arg. Never pass nil. agent-denote-add-link(ID,TARGET-ID,DESC). All 3 args required. |
Emacs Agent Server
Connect
ec() { emacsclient -s "${PI_EMACS_AGENT_SOCKET:-server}" --eval "${1}"; }
eu() { emacsclient -s user --no-wait "$@"; }
Define ec/eu in EVERY bash call (subshell resets).
PI_EMACS_AGENT_SOCKET is injected by entwurf when launched with
--emacs-agent-socket <name> (e.g. server, /run/emacs/server for Docker).
Falls back to server when unset.
API
| Function | Args | Example |
|---|
agent-denote-add-history | ID, CONTENT | ec '(agent-denote-add-history "ID" "@pi โ msg")' |
agent-denote-add-heading | ID, TITLE, BODY | ec '(agent-denote-add-heading "ID" "Title" "body")' |
| ID, TITLE, TAG, BODY | ec '(agent-denote-add-heading "ID" "Title" "LLMLOG" "body")' |
agent-denote-add-link | ID, TARGET-ID, DESC | ec '(agent-denote-add-link "ID1" "ID2" "desc")' โ ๏ธ all 3 args required (see Gotchas) |
agent-denote-set-front-matter | ID, &rest PLIST | ec '(agent-denote-set-front-matter "ID" :title "์ ์ ๋ชฉ" :filetags (quote ("meta" "reasoning")) :rename t)' |
agent-denote-search | QUERY, ?TYPE(title/tag/fulltext) | ec '(agent-denote-search "term" (quote tag))' |
agent-denote-keywords | โ | ec '(agent-denote-keywords)' โ all tags list |
agent-denote-rename-by-front-matter | FILE | ec '(agent-denote-rename-by-front-matter "/path")' |
agent-denote-rename-bulk | DIRECTORY | ec '(agent-denote-rename-bulk "/path/")' |
agent-org-read-file | FILE | ec '(agent-org-read-file "/path")' โ content string (guarded paths only) |
agent-org-get-headings | FILE, ?MAX-LEVEL | ec '(agent-org-get-headings "/path" 2)' |
agent-org-get-properties | FILE | ec '(agent-org-get-properties "/path")' โ alist |
agent-org-dblock-update | FILE | ec '(agent-org-dblock-update "/path")' โ ~/org/ all |
agent-org-agenda-day | ?DATE | ec '(agent-org-agenda-day "-1")' โ nil=today |
agent-org-agenda-week | ?DATE | ec '(agent-org-agenda-week)' |
agent-org-agenda-tags | MATCH | ec '(agent-org-agenda-tags "commit")' |
agent-org-agenda-todos | ?PROJECT, ?PRIORITY | ec '(agent-org-agenda-todos "andenken")' |
agent-citar-lookup | QUERY, ?MAX | ec '(agent-citar-lookup "karpathy" 5)' |
agent-server-status | โ | ec '(agent-server-status)' โ version, uptime |
agent-being-data | ?AS-JSON | ec '(agent-being-data)' โ notes/journal/garden counts |
agent-org-agenda-todos: PROJECT is level-2 heading name in Entwurf agenda (e.g. "andenken", "blog", "agent-config"). PRIORITY is "A"/"B"/"C". Both optional โ nil returns all TODOs grouped by project.
For agenda/task-hub work, prefer agent-org-agenda-day/week/todos over agent-org-read-file.
If the target file lives under ~/sync/org/..., agent-org-read-file may be blocked by path guards even when the file is conceptually part of the workflow. In that case:
- use
agent-org-agenda-todos first
- use
agent-org-agenda-day/week for schedule context
- only if raw structure is still needed, fall back to shell tools (
rg) instead of repeatedly calling blocked Emacs read APIs
add-heading: 3rd arg is TAG if UPPERCASE (e.g. "LLMLOG"), BODY otherwise. โ ๏ธ Never pass nil โ body silently drops. No tag? Put body as 3rd arg directly.
set-front-matter: touches only front matter / pre-heading region.
- Supported FM keys:
:title, :filetags, :description, :reference, :date, :hugo_lastmod. Missing keys are created, existing keys replaced. Unknown FM lines preserved.
- Control key:
:rename t โ FM ๊ฐฑ์ ํ denote ๊ท์น๋๋ก ํ์ผ๋ช
๊น์ง ์ฌ์์ฑ. ๋ถ๋ฆฌ ํธ์ถ ๋ถํ์. rename ์คํจํด๋ FM ๋ ์ด๋ฏธ ์ ์ฅ๋จ โ OK: ...; WARN: rename failed โ ... ๋ก ๋ถ๋ฆฌ ๋ณด๊ณ .
- filetags ๊ฐ: ๋ฌธ์์ด
"meta reasoning"ยท"meta,reasoning"ยท":meta:reasoning:" / ๋ฆฌ์คํธ ("meta" "reasoning") ๋ชจ๋ ํ์ฉ. lowercase + alnum ๊ฒ์ฆ + sort + dedup ์๋.
- reference ๊ฐ:
";" ๋๋ "," ๊ตฌ๋ถ ๋ฌธ์์ด / ๋ฆฌ์คํธ ๋ ๋ค ํ์ฉ. ๊ฒฐ๊ณผ๋ ; ๊ตฌ๋ถ.
ec '(agent-denote-add-heading "ID" "New Section" "body text here")'
ec '(agent-denote-add-heading "ID" "New Section" "LLMLOG" "body text here")'
ec '(agent-denote-add-heading "ID" "New Section" "body" "After This Heading")'
ec '(agent-denote-set-front-matter "ID" :title "์ ์ ๋ชฉ" :description "์์ฝ")'
ec '(agent-denote-set-front-matter "ID" :filetags (quote ("meta" "reasoning")) :reference "key1;key2")'
ec '(agent-denote-set-front-matter "ID" :title "์ ์ ๋ ์ ๋ชฉ" :filetags (quote ("ethics" "information")) :rename t)'
Arbitrary Elisp
ec accepts any elisp expression. Use for one-off org parsing or runtime extensions.
ec '(emacs-version)'
ec '(mapcar #'\''buffer-name (buffer-list))'
Notes (read if needed)
Paths
- Read:
~/org/, ~/repos/gh/, ~/repos/work/, ~/repos/3rd/ (guarded allowlist)
- Write:
~/org/botlog/, ~/repos/gh/self-tracking-data/
- Dblock update:
~/org/ (all org files)
- Denote append (add-*):
~/org/ (all denote files, append-only)
~/sync/org/... may be part of the real workflow but still blocked for agent-org-read-file; treat that as a known interface boundary
Daemon management
- thinkpad:
cd ~/repos/gh/doomemacs-config && ./run.sh agent start|stop|restart
- oracle:
~/openclaw/emacs-agent.sh start|stop|restart
- agent-server.el ์ ๊ณ ์น๋ฉด ๋ฐ๋ชฌ ์ฌ์์ํด์ผ ๋ฐ์๋๋ค (์ restart).
- ๋ฐ๋ชฌ์ด hang ์ํ์ฌ๋
./run.sh agent restart ๊ฐ ๋ณต๊ตฌํ๋ค: graceful (kill-emacs)
๋ฅผ 5s timeout ์ผ๋ก ์๋ํ๊ณ , ๋ฌด์๋ต์ด๋ฉด daemon PID ๋ฅผ kill(โํ์์ -9)ํ ๋ค stale
socket ์ ์ ๋ฆฌํ๊ณ start ํ๋ค (bounded force-stop, 2026-07 ์์ ). oracle
emacs-agent.sh ๋ ๋ณ๋ ์คํฌ๋ฆฝํธ๋ผ ์์ง ์๋ pkill ์ด ํ์ํ ์ ์๋ค.
Gotchas โ stale buffer / rename (issue #9, fixed 2026-06-24)
- add- / set-front-matter ๋ ๋งค ํธ์ถ ๋์คํฌ์์ ์๋ก ์ฝ๋๋ค* (stale ๋ฒํผ ํ๊ธฐ).
๊ทธ๋์ ~/org ํ์ผ์ ์ผ๋ฐ Write ๋๊ตฌ๋ก ์ง์ ๊ณ ์น ๋ค ๊ณง๋ฐ๋ก ์ด API ๋ฅผ ๋ถ๋ฌ๋ ์์ .
๊ณผ๊ฑฐ์ stale ๋ฒํผ + "file changed on disk; really edit?" ํ๋กฌํํธ๋ก ๋ฐ๋ชฌ์ด
์กฐ์ฉํ hang ํ๋ค (DESC ๋๋ฝ๊ณผ ๋ฌด๊ดํ hang โ bbot ๊ฐ ํท๊ฐ๋ฆฐ ์ง์ ). ์ด์ ๊ทธ
์ผ์ด์ค๋ hang ๋์
ERROR: ... ๋ฌธ์์ด์ ๋๋ ค์ค๋ค.
- ๊ทธ๋๋ ~/org ํธ์ง์ ๊ณ์ฝ(contract)์ ๊ฐ๋ฅํ๋ฉด raw Write ๊ฐ ์๋๋ผ agent-denote-* API.
- rename ์ ๋ฐ๋ชฌ cwd ์ ๋ฌด๊ดํ๊ฒ repo ์์์ git mv ํ๋ค. ๊ณผ๊ฑฐ
agent-denote-rename-*
๊ฐ ๋ฐ๋ชฌ cwd(์: ~/openclaw/)์ ๋ฐ๋ผ ../org/... ์๋๊ฒฝ๋ก + .git ์๋ cwd ๋ก
git mv ๋ฅผ ๋๋ ค "status 128" ์ผ๋ก ์ฃฝ๋ ๋ฒ๊ทธ๋ฅผ default-directory ๊ณ ์ ์ผ๋ก ์์ .
- ์ ์์ ์
bin/agent-server.el ์ ์๋ค โ ๋ฐ๋ชฌ ์ฌ์์ ํ ์ ํจ.
- add-history ๋ ์๋์ผ๋ก
[YYYY-MM-DD Day HH:MM] timestamp ๋ฅผ ์์ ๋ถ์ธ๋ค.
CONTENT ์ ๋ timestamp ๋ฅผ ๋ฃ์ผ๋ฉด [now] [caller-time] ์ด ์ค๋ณต๋๋ค โ CONTENT ์
timestamp ์์ด ๋ฉ์์ง ๋ณธ๋ฌธ๋ง ๋๊ฒจ๋ผ (์: "@pi โ ์์
์๋ฃ" โ, ์์ [2026-โฆ] โ).
- add-link ๋ ํ์ค
* ๊ด๋ จ๋
ธํธ ์น์
์๋ง ๋ฃ๋๋ค (์์ผ๋ฉด ๋ง๋ ๋ค). ํ์ ์น์
* ๊ด๋ จ๋ฉํ(์์) ยท * ๊ด๋ จ๋งํฌ ยท * ๊ด๋ จ ๋ ํผ๋ฐ์ค ๋ ๊ฑด๋๋ฆฌ์ง ์๋๋ค โ ๋ถ์ฌ์ด
๊ด๋ จ๋
ธํธ(ํ์ค) ๋ฅผ ๋ชป ์ก๊ณ ๊ด๋ จ <๋ค๋ฅธ๋ง> ์ ์ค๋งค์นญํ๋ 2026-07 ํ๊ท๋ ์์ ๋จ.
Agenda
DATE format: nil=today, "-1"=yesterday, "+3"=3days, "2026-03-01"=specific date.
Returns plain text: "Monday 1 April 2026\n Agent: 9:20...... commit :pi:\n Human: 13:40...... ์์
์์"
Recommended order for Entwurf/COS operation:
agent-org-agenda-day โ today's integrated working surface
agent-org-agenda-todos โ Entwurf task hub view by project/priority
agent-org-agenda-week โ weekly framing
agent-org-read-file โ only for allowed raw org files when truly needed