{"id":42209554,"url":"https://github.com/dnouri/pi-coding-agent","last_synced_at":"2026-02-22T15:28:36.440Z","repository":{"id":331269682,"uuid":"1125438750","full_name":"dnouri/pi-coding-agent","owner":"dnouri","description":"Emacs frontend for the pi coding agent","archived":false,"fork":false,"pushed_at":"2026-01-10T17:38:55.000Z","size":466,"stargazers_count":20,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-15T08:07:30.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnouri.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-30T18:18:03.000Z","updated_at":"2026-01-14T13:21:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dnouri/pi-coding-agent","commit_stats":null,"previous_names":["dnouri/pi.el","dnouri/pi-coding-agent"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dnouri/pi-coding-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fpi-coding-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fpi-coding-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fpi-coding-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fpi-coding-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnouri","download_url":"https://codeload.github.com/dnouri/pi-coding-agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnouri%2Fpi-coding-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28794012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-27T00:43:49.844Z","updated_at":"2026-02-22T15:28:36.429Z","avatar_url":"https://github.com/dnouri.png","language":"Emacs Lisp","funding_links":[],"categories":["Articles"],"sub_categories":[],"readme":"#+title: pi-coding-agent\n#+author: Daniel Nouri\n\n#+html: \u003ca href=\"https://melpa.org/#/pi-coding-agent\"\u003e\u003cimg alt=\"MELPA\" src=\"https://melpa.org/packages/pi-coding-agent-badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-unit.yml\"\u003e\u003cimg alt=\"Unit Tests\" src=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-unit.yml/badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-integration.yml\"\u003e\u003cimg alt=\"Integration Tests\" src=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-integration.yml/badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-gui.yml\"\u003e\u003cimg alt=\"GUI Tests\" src=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/test-gui.yml/badge.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/nightly.yml\"\u003e\u003cimg alt=\"Nightly\" src=\"https://github.com/dnouri/pi-coding-agent/actions/workflows/nightly.yml/badge.svg\"/\u003e\u003c/a\u003e\n\nAn Emacs frontend for the [[https://shittycodingagent.ai/][pi coding agent]].\n\n#+html: \u003ca href=\"https://danielnouri.org/media/pi-coding-agent-demo.mp4\"\u003e\u003cimg src=\"https://danielnouri.org/media/pi-coding-agent-preview.gif\" alt=\"pi-coding-agent demo - click to play\" width=\"600\" height=\"600\"\u003e\u003c/a\u003e\n\n* Features\n\n- Compose prompts in a full Emacs buffer: multi-line, copy/paste, macros, support for Vi bindings\n- Chat history as a markdown buffer: copy, save, search, navigate\n- Fork the conversation at any point in the chat buffer (f)\n- Live streaming output as bash commands and tool operations run\n- Syntax-highlighted code blocks and diffs\n- Collapsible tool output with smart preview (expand with TAB)\n- Click the model name or thinking level to change them\n- Rich header line: activity phase, session name, extension status\n- Input history with search (M-p/M-n, C-r)\n- Magit-style transient menu for all commands\n\n* Requirements\n\n- Emacs 28.1 or later\n- [[https://shittycodingagent.ai/][pi coding agent]] 0.51.3 or later, installed and in PATH\n\n** Installing pi coding agent\n\n#+begin_src bash\n# Install with npm\nnpm install -g @mariozechner/pi-coding-agent\n\n# Or with mise\nmise use -g npm:@mariozechner/pi-coding-agent\n#+end_src\n\n** Optional: phscroll for wide tables\n\nMarkdown tables in the chat buffer that exceed the window width normally wrap awkwardly.\n[[https://github.com/misohena/phscroll][phscroll]] enables horizontal scrolling so tables stay readable.\n\n#+begin_src\nM-x package-vc-install RET https://github.com/misohena/phscroll RET\n#+end_src\n\n* Installation\n\n** MELPA\n\nOnce available on [[https://melpa.org/#/pi-coding-agent][MELPA]], you can install directly:\n\n#+begin_src\nM-x package-install RET pi-coding-agent RET\n#+end_src\n\nOr with =use-package=:\n\n#+begin_src emacs-lisp\n(use-package pi-coding-agent\n  :ensure t\n  :init (defalias 'pi 'pi-coding-agent))\n#+end_src\n\nIf you don't have MELPA configured, add this to your init file:\n\n#+begin_src emacs-lisp\n(require 'package)\n(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)\n(package-initialize)\n#+end_src\n\n** Manual installation\n\nClone the repository and add to your load path:\n\n#+begin_src bash\ngit clone https://github.com/dnouri/pi-coding-agent ~/.emacs.d/site-lisp/pi-coding-agent\n#+end_src\n\n#+begin_src emacs-lisp\n(add-to-list 'load-path \"~/.emacs.d/site-lisp/pi-coding-agent\")\n(require 'pi-coding-agent)\n#+end_src\n\nOr with =use-package=:\n\n#+begin_src emacs-lisp\n(use-package pi-coding-agent\n  :load-path \"~/.emacs.d/site-lisp/pi-coding-agent\"\n  :init (defalias 'pi 'pi-coding-agent))\n#+end_src\n\n* Usage\n\nStart a session with =M-x pi-coding-agent=. This opens two windows:\n- *Chat buffer* (top): Shows conversation history with rendered markdown\n- *Input buffer* (bottom): Where you compose prompts\n\nType your prompt and press =C-c C-c= to send. Press =C-c C-p= for the full command menu.\n\nIf you define =(defalias 'pi 'pi-coding-agent)=, then =M-x pi= works as a\nshortcut.\n\nRunning =M-x pi-coding-agent= again from a pi buffer restores missing panes.\nIf both chat and input are already visible in the current frame, the layout\nstays unchanged and focus moves to the input window.\n\nUse =M-x pi-coding-agent-toggle= to hide/show session windows in the\ncurrent frame.\n\nFor multiple sessions in the same directory, use\n=C-u M-x pi-coding-agent= to create a named session.\n\n* Key Bindings\n\n| Key           | Context | Description                       |\n|---------------+---------+-----------------------------------|\n| =C-c C-c=     | input   | Send (queues if busy)             |\n| =C-c C-s=     | input   | Queue steering message (busy only)|\n| =C-c C-k=     | input   | Abort streaming                   |\n| =C-c C-p=     | both    | Open menu                         |\n| =C-c C-r=     | input   | Resume session                    |\n| =M-p= / =M-n= | input   | History navigation                |\n| =C-r=         | input   | Incremental history search        |\n| =TAB=         | input   | Complete paths, @files, /commands |\n| =@=           | input   | File reference (search)           |\n| =n= / =p=     | chat    | Navigate messages                 |\n| =TAB=         | chat    | Toggle section                    |\n| =S-TAB=       | chat    | Cycle all folds                   |\n| =RET=         | chat    | Visit file at point (other window)|\n| =f=           | chat    | Fork from point                   |\n| =q=           | chat    | Quit session                      |\n\nPress =C-c C-p= to access the full menu with model selection, thinking level,\nsession management (new, resume, fork, export), statistics, and custom commands.\n\n* Tips \u0026 Tricks\n\n** ✏️ Composing Prompts\n\nThe input buffer is a full Emacs buffer, one of the main advantages over\nterminal interfaces. Take your time composing, write multi-line prompts,\npaste from other buffers, use registers or kill-ring history. Your prompt\nstays put while the AI responds above.\n\nSlash commands (=/command=) work with completion: type =/= then =TAB= to\nsee available commands, including your custom ones from =~/.pi/commands/=.\n\n** 📎 Editor Features\n\nSeveral features match the TUI experience:\n\n- *File reference (@)*: Type =@= to search project files. Respects =.gitignore=.\n  Results are cached for 30 seconds to keep completion fast.\n\n- *Path completion (Tab)*: Complete relative paths like =./=, =../=, =~/=.\n\n- *Message queuing*: Submit messages while the agent is working:\n  - =C-c C-c= queues a /follow-up/ message, delivered after the agent finishes\n  - =C-c C-s= queues a /steering/ message, delivered after current tool\n    (interrupts remaining tools; only works when agent is busy)\n\n** 🔧 Tool Output\n\nTool output is collapsed by default to keep the chat readable, with a\npreview of the first few lines visible. Press =TAB= on a tool block to\nexpand and see everything. File operations (read, write, edit) show full\nsyntax highlighting, and edit diffs highlight what changed. Long-running\ncommands stream output live so you can watch progress.\n\nPress =RET= on a file-content line in a tool block to open the backing file\nat the matching line number. This works for file tools (=read=, =write=,\n=edit=) and custom tools that include =:path=. By default, the file opens in\nthe other window so you can keep the chat visible. Use =C-u RET= to open in\nthe same window instead.\n\n** 📁 Folding Turns\n\nPress =TAB= on a turn header (You/Assistant) to fold it, =TAB= again to\nunfold. Use =S-TAB= to cycle visibility of all turns at once.\n\n** 💾 Sessions\n\nEach project directory gets its own session automatically. To run multiple\nsessions in the same directory, use =C-u M-x pi-coding-agent= to create a\nnamed session.\n\nResume (=C-c C-r=) and fork (=C-c C-p f=) present a selection menu:\npick from previous sessions or conversation messages to start from.\n\n** 🌿 Forking and Context Management\n\nWhen a conversation gets long, the AI's context window fills up. The menu\n(=C-c C-p=) offers tools to manage this:\n\n- *Compact* (=c=): Summarizes earlier conversation to free up context while\n  preserving key information. Use when context is filling up. If you don't\n  compact manually, pi does it automatically when needed.\n\n- *Fork* (=f=): Branches the conversation from any earlier turn.\n  Press =f= on any turn in the chat buffer, or use the menu to pick\n  from a list.\n\n- *Export* (=e=): Saves the conversation as an HTML file for sharing or\n  archiving.\n\nThe context indicator in the status area shows current usage, warning\nwhen getting full.\n\n* Configuration\n\nExample configuration with =use-package=:\n\n#+begin_src emacs-lisp\n(use-package pi-coding-agent\n  :ensure t\n  :init (defalias 'pi 'pi-coding-agent)\n  :custom\n  (pi-coding-agent-input-window-height 10)        ; Height of input window\n  (pi-coding-agent-tool-preview-lines 10)         ; Lines shown before collapsing tool output\n  (pi-coding-agent-bash-preview-lines 5)          ; Lines shown for bash output\n  (pi-coding-agent-context-warning-threshold 70)  ; Warn when context exceeds this %\n  (pi-coding-agent-context-error-threshold 90)    ; Critical when context exceeds this %\n  (pi-coding-agent-visit-file-other-window t)     ; RET opens file in other window (nil for same)\n  ;; (pi-coding-agent-copy-raw-markdown t)            ; Keep raw markdown on copy (default: strip hidden markup)\n  ;; (pi-coding-agent-input-markdown-highlighting t)  ; GFM syntax highlighting in input buffer\n  )\n#+end_src\n\nCopying from the chat buffer strips hidden markdown markup by default —\n=M-w= and =C-w= produce the visible text you see on screen.  Set\n=pi-coding-agent-copy-raw-markdown= to =t= for raw markdown, useful\nwhen pasting into docs, Slack, or other markdown-aware contexts.\n\nThe input buffer uses plain =text-mode= by default.  Set\n=pi-coding-agent-input-markdown-highlighting= to =t= for GFM syntax\nhighlighting (bold, code spans, fenced blocks) in new sessions.\n\n* Testing\n\n** Running tests locally\n\nRequires Docker for integration and GUI tests (Ollama runs in a container).\n\n#+begin_src bash\n# Unit tests only (fast, no Docker)\nmake check\n\n# Integration tests (requires Docker)\nmake test-integration\n\n# GUI tests (requires Docker)\nmake test-gui\n\n# All tests\nmake test-all\n#+end_src\n\n** GUI tests with visible window\n\nBy default, GUI tests auto-detect whether to show a window or run headless.\n\n#+begin_src bash\n# With a display available, runs with visible window\n./test/run-gui-tests.sh\n\n# Force headless even with display available\n./test/run-gui-tests.sh --headless\n#+end_src\n\n** CI setup\n\nGitHub Actions runs on every push:\n- =test-unit.yml= - Unit tests across Emacs 28.2 and 29.4\n- =test-integration.yml= - Integration tests with Docker Ollama\n- =test-gui.yml= - GUI tests with xvfb virtual framebuffer\n\nNightly builds test against the pinned pi version (from Makefile) and latest.\n\n* Links\n\n- [[https://danielnouri.org/notes/2025/12/30/an-emacs-mode-for-a-shitty-coding-agent/][Blog post]]: Background and motivation\n- [[https://shittycodingagent.ai/][shittycodingagent.ai]]: pi coding agent home page\n\n* License\n\nGPL-3.0-or-later. See [[file:LICENSE][LICENSE]].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fpi-coding-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnouri%2Fpi-coding-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnouri%2Fpi-coding-agent/lists"}