# pi-ask-agent-mode

Ask / Agent mode for the [Pi](https://pi.dev) coding agent.

- **`/ask`** — read-only: disables built-in `write` / `edit`, shows an `ask` status, appends a short system constraint
- **`/agent`** — restore the tool set from before ask mode

Optional trailing text is sent as a user message after the switch (interactive TUI only).

## Install

```bash
# from npm
pi install npm:pi-ask-agent-mode

# from git
pi install git:github.com/1834539664/pi-ask-agent-mode

# from a local checkout
pi install /absolute/path/to/pi-ask-agent-mode

# try once without installing
pi -e npm:pi-ask-agent-mode
```

## Usage

| Command | Behavior |
|---------|----------|
| `/ask` | Switch to ask (read-only) mode |
| `/ask <message>` | Switch to ask, then send `<message>` |
| `/agent` | Switch to agent (writable) mode |
| `/agent <message>` | Switch to agent, then send `<message>` |

New sessions and session switches always start in **agent** mode (ask state is not restored).

## Behavior

| Layer | Effect |
|-------|--------|
| Tools | Removes active `write` and `edit` while in ask mode |
| System prompt | Appends an ask-mode note (other tools/commands remain available, including bash/curl) |
| Status | Footer shows `ask` while in ask mode |
| Bash | **Not** filtered; destructive shell commands can still mutate the system |

For hard isolation, use a sandbox / container, not this extension alone.

## Limitations

- **Not supported with `pi -p` / print mode.** `pi.sendUserMessage` is fire-and-forget; print mode may exit before the follow-up turn finishes. Use the interactive TUI.
- Ask mode is in-memory only for the current session process; switching sessions resets to agent.

## Package layout

```text
pi-ask-agent-mode/
  package.json          # keywords: pi-package, pi.extensions
  extensions/
    ask-mode.ts
  README.md
  LICENSE
```

## License

MIT
