chore: import upstream snapshot with attribution
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
---
|
||||
title: "Pi coding tasks"
|
||||
description: "Let OpenSRE hand a coding task to the Pi agent, which edits the working tree and returns a diff."
|
||||
---
|
||||
|
||||
The **Pi coding tool** lets OpenSRE submit a coding task to the [Pi](https://pi.dev) agent.
|
||||
Pi edits files in a workspace to implement the change and returns a summary plus the git diff.
|
||||
It **does not commit, push, or open a pull request** — it only edits the working tree so you can
|
||||
review the diff.
|
||||
|
||||
This is different from using Pi as your LLM provider (`LLM_PROVIDER=pi`, see
|
||||
[LLM providers](/llm-providers)). There Pi is the reasoning engine; here Pi is the thing that
|
||||
actually changes code.
|
||||
|
||||
<Warning>
|
||||
This is a **mutating** tool — it changes files on disk. It is **disabled by default**: it only
|
||||
becomes available to the agent when `PI_CODING_ENABLED=1`. Enable it only when you want OpenSRE to
|
||||
make code changes. It never commits, pushes, or opens a PR, so you always review the diff.
|
||||
</Warning>
|
||||
|
||||
## Quick reference
|
||||
|
||||
| Env var | What it does |
|
||||
| --- | --- |
|
||||
| `PI_CODING_ENABLED` | Opt-in switch. Set to `1` to make the tool available. Off by default. |
|
||||
| `PI_CODING_MODEL` | Optional Pi model in `provider/model` form (e.g. `anthropic/claude-haiku-4-5`). |
|
||||
| `PI_CODING_WORKSPACE` | Default repository path Pi edits. Defaults to the current directory. |
|
||||
| `PI_CODING_TIMEOUT_SECONDS` | Per-task timeout (default 600, clamped 60–1800). |
|
||||
| `PI_BIN` | Optional explicit path to the `pi` binary. |
|
||||
|
||||
## Enable it
|
||||
|
||||
1. Install and authenticate the Pi CLI (same binary/credentials as the Pi provider):
|
||||
```bash
|
||||
npm i -g @earendil-works/pi-coding-agent
|
||||
# then authenticate: run `pi` and use /login, or export a provider key such as GEMINI_API_KEY
|
||||
```
|
||||
2. Turn the tool on:
|
||||
```bash
|
||||
export PI_CODING_ENABLED=1
|
||||
export PI_CODING_MODEL=anthropic/claude-haiku-4-5 # optional
|
||||
```
|
||||
3. Confirm Pi is ready:
|
||||
```bash
|
||||
uv run opensre doctor
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
When the tool runs, it:
|
||||
|
||||
1. runs `pi` in headless mode inside the workspace with your task plus a fixed set of rules
|
||||
(follow `AGENTS.md`, do not commit or push, do not run destructive git commands, preserve
|
||||
unrelated changes, summarize what changed),
|
||||
2. lets Pi edit the files,
|
||||
3. returns `success`, a `summary`, the list of `changed_files`, and the `diff` (truncated if large).
|
||||
|
||||
You review the diff and decide whether to keep, commit, or revert the changes.
|
||||
|
||||
## Example
|
||||
|
||||
Once enabled, the tool is available to the agent (investigation surface). Describe a scoped
|
||||
coding task, for example:
|
||||
|
||||
```
|
||||
add input validation to parse_config() in config/loader.py
|
||||
```
|
||||
|
||||
If the agent calls the tool, Pi edits `PI_CODING_WORKSPACE`, and you get back a summary and the
|
||||
diff to review. Nothing is committed. (The agent decides whether to call the tool; for a
|
||||
deterministic run, invoke `pi_coding_task` directly — see the tests.)
|
||||
|
||||
## Notes
|
||||
|
||||
- Nothing is committed or pushed. Opening a PR is out of scope for now.
|
||||
- It is **disabled by default**. Only when `PI_CODING_ENABLED=1` does the agent see it and get
|
||||
to choose to call it — enable it deliberately, since it edits files.
|
||||
- If `PI_CODING_ENABLED` is unset, or the Pi CLI is missing or unauthenticated, the tool stays
|
||||
unavailable and returns a clear message instead of running.
|
||||
Reference in New Issue
Block a user