# madrigal

`madrigal` provides LLM-driven Emacs editing through CRDT replicas.

## Install with `use-package`

If `madrigal` is in your `load-path` (or installed as a package), use:

```elisp
(use-package madrigal
  :ensure t
  :after (llm crdt)
  :commands (madrigal-edit)
  :init
  ;; llm-openai.el is a module in the `llm` package; load it explicitly
  ;; when you want OpenAI/OpenAI-compatible providers.
  (require 'llm-openai)
  :custom
  (madrigal-llm-provider
   (make-llm-openai-compatible
    :url "https://api.openai.com/v1/"
    :key (lambda () (getenv "OPENAI_API_KEY"))
    :chat-model "gpt-4o")))
```

## Dependency Notes

- Package dependencies are declared in `madrigal.el` and `madrigal-pkg.el`:
  - `llm`
  - `crdt`
- `llm-openai` is **not** a separate package dependency; it is a module
  provided by the `llm` package. Load it with `(require 'llm-openai)` before
  constructing OpenAI or OpenAI-compatible providers.