Skip to content
/ goose.el Public

goose.el is a minimal and extensible Emacs package that connects Emacs to the Goose CLI using a vterm-based major mode.

License

Notifications You must be signed in to change notification settings

aq2bq/goose.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goose.el

Bring Goose AI power directly into Emacs — with a seamless, terminal-driven workflow.

goose.el is a minimal and extensible Emacs package that connects Emacs to the Goose CLI using a vterm-based major mode.
You can manage multiple named sessions, send instant (buffer, region, file, templates, or custom text), and fast AI-driven automation directly from your editor.

Features

  • Dedicated major mode (goose-mode) for Goose sessions (inherits from vterm-mode)
  • Session-based management with automatic labeling and buffer isolation
  • One-command context sharing:
    Instantly send buffer content, active region, file path, templates, or custom text to Goose
  • Prompt template integration:
    Select and inject templates from ~/.config/goose/prompts/
  • Fully customizable keybindings and session parameters (via transient menus)
  • Optimized for rapid experimentation, coding, debugging, and text workflows with AI

screen


Requirements


Installation

Manual installation (MELPA planned):

;; Download goose.el and put it somewhere in your load-path.
;; leaf
(leaf goose
  :load-path "/path/to/goose.el"
  :hook (goose-mode-hook . (lambda ()
                             (display-line-numbers-mode -1)))
  :bind (("C-c g" . goose-transient)))

;; use-package
(use-package goose
  :load-path "/path/to/goose.el"
  :hook (goose-mode-hook . (lambda ()
                             (display-line-numbers-mode -1)))
  :bind (("C-c g" . goose-transient)))

or simply:

(load "/path/to/goose.el")

Usage

  • Start a new Goose session:
    M-x goose-start-session
  • Restart the last session:
    M-x goose-restart-session
  • Send current buffer:
    M-x goose-add-context-buffer
  • Send region:
    M-x goose-add-context-region
  • Send file path:
    M-x goose-add-context-file-path
  • Send prompt template:
    M-x goose-add-context-template
  • Send arbitrary text:
    M-x goose-add-context-text
  • Show full menu:
    C-c g (transient menu, configurable via goose-transient-key)

Each session is isolated in its own buffer using goose-mode, so you can work in parallel and keep workflows organized!


Customization

Use M-x customize-group RET goose RET or set variables directly:

  • goose-program-name (Goose CLI path)
  • goose-default-buffer-name (buffer name prefix)
  • goose-prompt-directory (prompt template location)
  • goose-context-format (format string for context injection)
  • goose-transient-key (default: C-c g)

Prompt Templates

Place text templates in ~/.config/goose/prompts/ (customizable) for quick insertion.
Example file: bugfix.txt

Steps to reproduce the bug in my code:
<insert code here>
Describe the causes and suggest solutions.

Insert using M-x goose-add-context-template


Advanced

  • Dedicated major mode: All Goose sessions use goose-mode (derived from vterm-mode), allowing custom hooks, keymaps, and clean separation from generic vterm buffers.
  • Hook for customization:
    (add-hook 'goose-mode-hook
              (lambda () (message "Welcome to Goose session!")))

Troubleshooting

  • Copy text from Goose sessions:
    Goose uses vterm; press C-c C-t (vterm-copy-mode) to select/copy as in a standard buffer.
  • Goose CLI not found?
    Ensure CLI is in your $PATH, or set goose-program-name.
  • Prompt templates not visible?
    Make sure goose-prompt-directory contains template files.

Built with Goose

This package was built as a companion to Goose CLI,
and follows its philosophy of persistent, contextual AI interactions.


Contributing

Pull requests and issues are welcome!
Feel free to share your own prompt templates, UX ideas, or bug fixes.


License

MIT © 2025 Daisuke Terada (@aq2bq) and contributors


About

goose.el is a minimal and extensible Emacs package that connects Emacs to the Goose CLI using a vterm-based major mode.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published