ollie/scripts/README.md

87 lines
2.3 KiB
Markdown

# scripts
Shell scripts for interacting with the ollie 9P filesystem.
All scripts read `OLLIE_9MOUNT` (default: `$HOME/mnt/ollie`) for the mount path.
---
## osh
Interactive chat interface for ollie sessions. Resumes the most recent
session for the current directory by default; creates a new one if none
exists.
```
osh [-new] [-resume] [-session ID] [-cwd DIR] [-backend B] [-model M] [-agent A]
```
**Flags**
| Flag | Description |
|---|---|
| `-new` | Always create a new session |
| `-resume` | Resume last session for the cwd; error if none |
| `-session ID` | Attach to a specific session by ID |
| `-cwd DIR` | Working directory (default: `pwd`) |
| `-backend B` | Backend override (e.g. `ollama`, `anthropic`) |
| `-model M` | Model override |
| `-agent A` | Agent config name |
**Input**
At the `>` prompt:
| Input | Action |
|---|---|
| `<text>` | Submit prompt, stream response |
| `/q <text>` | Enqueue prompt for later |
| `/<cmd>` | Send to session ctl (e.g. `/compact`, `/clear`) |
| `/kill` | Kill the session and exit |
| Ctrl-C | Interrupt running turn (or exit if idle) |
**Examples**
```sh
osh # resume or create session for pwd
osh -new -model gpt-4o # fresh session with model override
osh -session 1745123456-abc # attach to a specific session
```
---
## oq
Non-interactive one-shot query. Submits a prompt to `b/new`, waits for
completion, prints the result to stdout, then removes the job. Exit code
is non-zero on failure.
```
oq [flags] [prompt...]
echo "prompt" | oq [flags]
```
**Flags**
| Flag | Description |
|---|---|
| `-name N` | Base job name; jobs are suffixed `-0`, `-1`, ... |
| `-cwd DIR` | Working directory (default: `pwd`) |
| `-agent A` | Agent config name |
| `-backend B` | Backend override |
| `-model M` | Model override |
| `-output json` | Append JSON-only instruction to prompt |
| `-parallel N` | Run the same prompt N times in parallel (default: 1) |
| `-keep` | Do not remove job(s) after printing result |
**Examples**
```sh
oq "Summarize this repo in one sentence"
cat error.log | oq "What is causing this error?"
oq -output json "List the top 3 risks as JSON"
oq -parallel 4 -keep "Write a haiku about filesystems"
oq -backend ollama -model qwen3:8b "Explain this function" < main.go
```
With `-parallel N` and N > 1, results are separated by `=== {id} ===` headers.