The repository includes an Emacs frontend at components/emacs-ui/ that runs
psi in a dedicated process buffer over rpc-edn.
Install directly from GitHub with straight.el:
(straight-use-package
'(psi-emacs
:type git
:host github
:repo "hugoduncan/psi"
:files ("components/emacs-ui/*.el")))
(require 'psi)
This installs the Emacs frontend files from the repo and makes
M-x psi-emacs-start / M-x psi-emacs-project available.
psi is available on PATH.components/emacs-ui to load-path and load psi.el.M-x psi-emacs-start for the default/global buffer.
C-u M-x psi-emacs-start to force a fresh buffer name (*psi*<2>, etc.).M-x psi-emacs-project for a project-scoped buffer in the current project.
*psi:<project>* (for example *psi:psi-main*).C-u M-x psi-emacs-project forces a fresh generated project buffer name.C-u N M-x psi-emacs-project opens/uses slot N
(N<=1 => *psi:<project>*, N>=2 => *psi:<project>*<N>).This opens a dedicated psi buffer (default *psi*, or project-scoped *psi:<project>*) and starts one
owned subprocess per dedicated buffer using:
psi --rpc-ednBy default, the subprocess runs in the directory where psi-emacs-start is
invoked. Override explicitly via psi-emacs-working-directory if needed.
psi-emacs-commandpsi-emacs-command controls the exact subprocess command used by the frontend.
Default:
("psi" "--rpc-edn")
Customize interactively:
M-x customize-variable RET psi-emacs-command RETOr set in init:
(setq psi-emacs-command '("psi" "--rpc-edn"))
Example with explicit model:
(setq psi-emacs-command
'("psi" "--rpc-edn" "--model" "sonnet-4.6"))
Requirement: command must launch psi in rpc-edn mode (include --rpc-edn).
Streaming stall detection defaults to 600 seconds (10 minutes) in Emacs.
Customize psi-emacs-stream-timeout-seconds to change the frontend watchdog.
From repo root:
bb emacs:test (loads the split frontend suites, including psi-buffer-lifecycle-test.el, psi-dispatch-test.el, psi-streaming-transcript-test.el, psi-tool-output-mode-test.el, psi-extension-ui-test.el, psi-capf-test.el, and psi-session-tree-test.el)bb emacs:e2e (live end-to-end harness against psi --rpc-edn)bb emacs:byte-compilebb emacs:checkIn psi-emacs-mode:
RET inserts newline (never sends)C-c RET send prompt
commandprompt_while_streaming with behavior=steer)C-u C-c RET queue override for non-slash streaming inputC-c C-q queue while streaming for non-slash input; slash-prefixed input still uses backend command; fallback to normal send when idleC-c C-k abort active streaming (abort)C-c C-r reconnect (prompts before clearing edited buffer)C-c C-t toggle tool-output view mode (collapsed ↔ expanded); also available as M-x psi-emacs-toggle-tool-output-viewC-c m m set model (M-x psi-emacs-set-model)C-c m n cycle model next (M-x psi-emacs-cycle-model-next)C-c m p cycle model previous (M-x psi-emacs-cycle-model-prev)C-c m t set thinking level (M-x psi-emacs-set-thinking-level)C-c m c cycle thinking level (M-x psi-emacs-cycle-thinking-level)Compose source rules:
C-c RET and C-c C-q).C-c C-r after confirmation) resets the buffer and repositions the draft anchor at the new buffer end; after reconnect, sends come only from text typed after that reset point.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |