---
slug: "xl0-pi-lovely-codex"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/xl0/pi-lovely-codex@master/README.md"
repo: "https://github.com/xl0/pi-lovely-codex"
source_file: "README.md"
branch: "master"
---
# @xl0/pi-lovely-codex

GPT "Fast mode" control and Codex-style `apply_patch` tool.

## Install

```bash
pi install npm:@xl0/pi-lovely-codex
```

Use without install:

```bash
pi -e npm:@xl0/pi-lovely-codex
```

## `/lovely-codex`

![Lovely codex settings](https://raw.githubusercontent.com/xl0/pi-lovely-codex/master/assets/lovely-codex-settings.png)

### GPT fast mode 🏎️

- `default` -> omit `service_tier` - default mode
- `fast` -> send `service_tier: "priority"` for `openai` and `openai-codex` - request fast mode on OpenAI API and Codex sub.
- `fast-codex` -> send priority only for `openai-codex` - request fast mode on Codex sub only.

Applies only to provider `openai` or `openai-codex`, model id starting with `gpt-`. Fast mode shows `🏎️` in status line.

### apply_patch tool

GPT models have been relentlessly fine-tuned to use the `apply_patch` tool in Codex. They can use the default Pi `edit` tool of course,
but often make silly mistakes that might be just muscle memory from being trained on `apply_patch` for the edit task.

This extension adds the tool GPT models crave so much.

> Note: Current `apply_patch` implementation shells out to `codex --codex-run-as-apply-patch`. **You need to have codex installed and available on PATH.**

`add apply_patch` controls whether Lovely Codex enables the `apply_patch` tool:

- `on` -> always add the `apply_patch` tool.
- `off` -> don't add the `apply_patch` tool.
- `gpt-only` -> enable `apply_patch` only when current model id starts with `gpt-` or contains `/gpt-`.

Optionally, you can disable the now redundant built-in tools while `apply_patch` is active:
- `disable write`
- `disable edit`

When `apply_patch` becomes inactive, `write`/`edit` are restored only if they were active at session start.

Default effective values: `add apply_patch = gpt-only`, `disable write = off`, `disable edit = off`.

Config scopes:

- User: `~/.pi/agent/xl0-pi-lovely-codex.json`
- Workspace: `<cwd>/.pi/xl0-pi-lovely-codex.json`

Workspace overrides User. All keys are optional.

## Related projects

|  |  |
| --- | --- |
| [Pi Lovely Web](https://github.com/xl0/pi-lovely-web) | `web_search`, `web_fetch`, `web_image` tools |
| [Pi Lovely Dev Tools](https://github.com/xl0/pi-lovely-dev-tools) | interactive debugging helpers `/tool`, `/show-sysprompt`, `/show-context`, `/llm-stats` |
| [Pi Lovely IDE](https://github.com/xl0/pi-lovely-ide) | IDE integration |
| [Pi Lovely Config](https://github.com/xl0/pi-lovely-config) | scoped config helpers for Pi extensions |
| [Pi Lovely Comment](https://github.com/xl0/agent-files/tree/master/pi/packages/pi-lovely-comment) | open the last assistant message in your editor and sync edits back into the prompt |
| [Pi Lovely Rename](https://github.com/xl0/agent-files/tree/master/pi/packages/pi-lovely-rename) | automatic and manual session naming |

---

Like this work? [Hire me](https://alexey.work/cv?ref=pi-lovely-codex)
