본문으로 건너뛰기
cccskills
무료GitHub에 공개

collaborative-emacs

Claude Code runs an Emacs daemon, starts a CRDT server, shares buffers.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md6.8 KB
  • CONCOMITANT_SKILLS.md1.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Collaborative Emacs — Claude Code + CRDT Live Editing

Trit: 0 (ERGODIC - bidirectional coordination) Status: Working Date: 2026-02-10 Prerequisite: crdt.el (elpa), emacsclient

What This Does

Claude Code runs an Emacs daemon, starts a CRDT server, shares buffers. User's Emacs auto-connects and sees live edits. No interactive prompts.

Quick Start (Human Side)

  1. Install crdt.el

    ;; Via GNU ELPA
    (use-package crdt)
    
  2. Host a session (on your machine)

    M-x crdt-share-buffer    ;; share current buffer
    ;; or
    M-x crdt-new-session     ;; start a session, then share buffers into it
    

    Prompts for port (default 6530). Binds 0.0.0.0 so Tailscale peers can connect.

  3. Connect from another machine

    M-x crdt-connect
    ;; URL: ein://your-machine.tail1234.ts.net:6530
    ;; or:  ein://100.x.y.z:6530
    

Architecture (Preferred)

┌──────────────┐    emacsclient -s     ┌──────────────────┐
│  Claude Code │ ──────────────────▶   │  Emacs daemon    │
│  (this CLI)  │                       │  "claude-crdt"   │
└──────────────┘                       │  CRDT SERVER     │
                                       │  port 6531       │
                                       └────────┬─────────┘
                                                │
                                         auto-connect
                                         (crdt-autoconnect.el)
                                                │
                                                ▼
                                       ┌──────────────────┐
                                       │  User's Emacs    │
                                       │  (CRDT client)   │
                                       └──────────────────┘

Setup

Auto-connect file (already installed)

~/.emacs.d/crdt-autoconnect.el:

(require 'crdt)
(require 'url-parse)
(run-at-time 3 nil
  (lambda ()
    (condition-case err
        (let ((url (url-generic-parse-url "ein://localhost:6531")))
          (crdt-connect url "alice")
          (message "Connected to Claude CRDT on port 6531"))
      (error (message "CRDT connect failed: %S" err)))))

Usage

Step 1: Claude starts daemon with CRDT server

emacs -nw --daemon=claude-crdt

emacsclient -s claude-crdt -e '
(progn
  (require (quote crdt))
  (let ((buf (get-buffer-create "*claude-workspace*")))
    (with-current-buffer buf (org-mode) (insert "#+TITLE: Workspace\n"))
    (crdt-new-session 6531 nil "" "claude"
      (quote (crdt-default-session-permissions)))
    (crdt--share-buffer buf (car crdt--session-list) "workspace.org")))'

Step 2: Claude shares files

emacsclient -s claude-crdt -e '
(let* ((s (car crdt--session-list))
       (buf (find-file-noselect "/path/to/file.org")))
  (crdt--share-buffer buf s "file.org"))'

Step 3: User launches Emacs and auto-connects

Local:

emacs -nw -l ~/.emacs.d/crdt-autoconnect.el

Over Tailscale (from any node on the tailnet):

CRDT_HOST=2-monad CRDT_PORT=6531 emacs -nw -l ~/.emacs.d/crdt-autoconnect.el

Or by Tailscale IP:

CRDT_HOST=100.87.209.11 emacs -nw -l ~/.emacs.d/crdt-autoconnect.el

3 seconds after startup, connects automatically. No minibuffer prompts. Then: M-x crdt-switch-to-buffer

Tailscale Notes

The daemon's crdt-new-session binds to 0.0.0.0 — accessible on all interfaces including Tailscale. No extra config needed.

crdt.el URL Format (confirmed from upstream docs)

ProtocolURLUse
Unencryptedein://host:portDefault
TLS (stunnel)eins://host:portEncrypted

Full Tailscale URLs for M-x crdt-connect:

ein://2-monad.pirate-dragon.ts.net:6531   # FQDN
ein://2-monad:6531                        # MagicDNS short
ein://100.87.209.11:6531                  # by IP

Programmatic connection (no prompts):

(crdt-connect (url-generic-parse-url "ein://2-monad.pirate-dragon.ts.net:6531") "alice")

crdt-copy-url on the server side also generates these ein:// URLs.

Online tailnet nodes:

  • 2-monad (100.87.209.11) — this machine
  • causality (100.69.33.107)
  • hatchery (100.72.249.116)

Step 4: Claude reads shared buffers

emacsclient -s claude-crdt -e '
(let* ((s (car crdt--session-list))
       (buf (gethash "BUFFER-NAME" (crdt--session-buffer-table s))))
  (with-current-buffer buf
    (buffer-substring-no-properties (point-min) (point-max))))'

Step 5: Claude writes to shared buffers

emacsclient -s claude-crdt -e '
(let* ((s (car crdt--session-list))
       (buf (gethash "BUFFER-NAME" (crdt--session-buffer-table s))))
  (with-current-buffer buf
    (goto-char (point-max))
    (insert "\n* New heading from Claude\n")))'

Key Patterns

Read buffer content

(let* ((s (car crdt--session-list))
       (buf (gethash "BUFFER" (crdt--session-buffer-table s))))
  (with-current-buffer buf
    (buffer-substring-no-properties (point-min) (point-max))))

Insert at point-max

(with-current-buffer buf
  (goto-char (point-max))
  (insert "text"))

Insert at specific position

(with-current-buffer buf
  (goto-char (point-min))
  (search-forward "* Target Heading")
  (end-of-line)
  (insert "\nNew content under heading"))

Run org commands on shared buffer

(with-current-buffer buf
  (org-sort-entries nil ?a))  ; sort alphabetically

Check who's connected

emacsclient -s claude-crdt -e '
(let ((s (car crdt--session-list)))
  (hash-table-keys (crdt--session-user-table s)))'

Critical Lessons

  • crdt-share-buffer and crdt-connect use interactive settings buffers — NEVER call them from emacsclient, they block forever
  • Use crdt-new-session (programmatic) to create server sessions
  • Use crdt--share-buffer (internal) to add buffers without prompts
  • Use crdt-autoconnect.el with url-generic-parse-url for the user's side — fully non-interactive, delayed 3s after init
  • Claude daemon hosts the server (port 6531), user is the client
  • emacs --batch can't maintain CRDT connections (exits immediately)
  • Always use --daemon=claude-crdt for persistent connection

Cleanup

# Kill the daemon when done
emacsclient -s claude-crdt -e '(kill-emacs)'

Related Skills

  • crdt-vterm — terminal sharing via CRDT + vterm
  • emacs — base Emacs ecosystem skill
  • elisp — Emacs Lisp reference
  • emacs-info — Info navigation

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

13c0e3

무료

Gay MCP skill at invocation 26

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

19d57d

무료

Gay MCP skill at invocation 5

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1ea91a

무료

Gay MCP skill at invocation 27

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1eab21

무료

Gay MCP skill at invocation 3

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

plurigrid의 스킬 모두 보기

이 스킬의 문제 신고