# pi-gpt55-complete

A [pi](https://pi.dev/) package that mitigates GPT-5.5's intermittent `518n - 2` reasoning truncation pattern (`516`, `1034`, `1552`, ...) for the built-in `openai-codex/gpt-5.5` model.

The extension only applies to:

```text
openai-codex/gpt-5.5
```

Other OpenAI Codex models are delegated to pi's built-in provider unchanged.

## What it does

When a GPT-5.5 round ends with `usage.reasoning == 518 * n - 2` and the reasoning block contains encrypted replay state, the extension:

1. streams reasoning blocks live;
2. buffers tentative text/tool-call output;
3. appends a commentary `Continue thinking...` replay message carrying the encrypted reasoning signature;
4. opens another round;
5. folds the reasoning blocks plus the final clean round's output into one assistant message.

Continuation rounds are capped at 3.

## Install

From npm, after publishing:

```bash
pi install npm:pi-gpt55-complete
```

From GitHub:

```bash
pi install git:github.com/YPQuinn/pi-gpt55-complete@v0.1.0
```

For local development:

```bash
pi -e . --model openai-codex/gpt-5.5:xhigh
```

## Development smoke test

```bash
pi --no-extensions -e . --list-models gpt-5.5
npm pack --dry-run
```

## Security

Pi extensions run with the same permissions as your local pi process. This package does not persist or log credentials; it delegates transport/auth to pi's built-in OpenAI Codex provider.

## Credits

The detect-and-continue mechanism is inspired by the `codexcomp` / CodexCont approach for GPT-5.5's `518n - 2` reasoning truncation fingerprint.

## License

MIT
