# Pi Generation Config Extension

A powerful extension for the `pi` coding agent that allows you to manage LLM generation parameters (like temperature, top_p, etc.) on a per-model basis, save them as model-scoped presets, and use convenient shorthands. All settings are stored globally across all your projects.

## Features

- **Global Per-Model Persistence**: Settings are saved specifically for each model you use and persist across different projects.
- **Per-Model Presets**: Save a collection of parameters as a named preset scoped to the current model. Preset names are unique per model — you can reuse names across different models.
- **Shorthands**: Map long parameter names to short ones (e.g., `temp` $\rightarrow$ `temperature`). Comes with defaults for `temp`, `tp`, `tk`, `mp`, `rp`, and `pp`.
- **Request-Level Overrides**: Use tags in your prompts to change settings for a single turn without affecting the saved config.
- **Universal Support**: Works with any parameter supported by your AI provider.

## Installation

### Via Git
```bash
pi install https://github.com/dauryg/pi-generation-config.git
```

### Via npm
```bash
pi install pi-generation-config
```

## Usage

### 1. General Status & Discovery
- `/gconfig`: Show settings for the active model and list available presets.
- `/gconfig params`: The "Discovery" command. Lists all known parameters (with shorthands) for the active model, followed by all custom configurations set for all models.

### 2. Managing Parameters
Set parameters for the currently active model:
- `/gconfig set <key> <value> [shorthand]`
  - Example: `/gconfig set temperature 0.7`
  - Example: `/gconfig set max_tokens 4000 fast` (sets `max_tokens` and creates a shorthand 'fast')

Set parameters for a specific model without switching to it:
- `/gconfig set-model <key> <value> <model_id> [shorthand]`
  - Example: `/gconfig set-model temperature 0.1 gpt-4o`

Removing settings:
- `/gconfig reset`: Clear all custom settings for the active model.
- `/gconfig delete param <key>`: Delete a specific parameter from the active model.

### 3. Working with Presets
Presets allow you to save a "vibe" or a "mode" (e.g., "Creative" or "Coding") and apply it instantly to the current model. Presets are scoped per-model, so the same preset name can hold different settings on different models.

- **Save**: `/gconfig preset save <name> [description]`
  - Example: `/gconfig preset save creative "High temp for brainstorming"`
- **Load**: `/gconfig preset load <name>`
  - Example: `/gconfig preset load creative`
- **List**: `/gconfig preset list`
  - Shows only presets saved for the active model.
- **Delete**: `/gconfig delete preset <name>`
  - Deletes the preset from the active model.

### 4. Shorthands
Define your own aliases for long parameter names.
- **Add**: `/gconfig shorthand add <short> <long>`
  - Example: `/gconfig shorthand add tp top_p`

### 5. Per-Request Overrides (Prompt Tags)
You can override any setting for a single message by using tags at the beginning of your prompt. These tags are stripped before the prompt is sent to the model.

- **Example**: `[temp: 0.1] Summarize this file deterministically.`
- **Example**: `[max_tokens: 50] Give me a one-sentence answer.`
- **Example**: `[tp: 0.9] [temp: 0.8] Write a poem about coding.`

Apply an entire saved preset for a single turn:
- **Example**: `[preset: code] Build the app from the specs we discussed.`

## Configuration Storage
Settings are stored globally in your home directory:
`~/.pi/agent/generation-config.json`
