scripts: move q and sched to b/ namespace

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-18 11:58:42 +02:00
parent a4ba0f9f9f
commit 97297a6c76
5 changed files with 47 additions and 10 deletions

View File

@ -23,7 +23,7 @@
**AI pipelines with standard tools** — ollie scripts compose into multi-stage AI pipelines via Unix pipes. Proof-of-concept:
```
; s/optimize -n 2 -cm qwen/qwen3-8b -jm 'anthropic/claude-opus-4.6' 'generate a hello world program. use c++.' >[2]/dev/null | s/q
; s/optimize -n 2 -cm qwen/qwen3-8b -jm 'anthropic/claude-opus-4.6' 'generate a hello world program. use c++.' >[2]/dev/null | b/q
```
`s/optimize` generates and judges candidate prompts, emitting the best to stdout; `s/q` acts on it. Any tool that reads stdin and writes stdout is already a pipeline stage.
`s/optimize` generates and judges candidate prompts, emitting the best to stdout; `b/q` acts on it. Any tool that reads stdin and writes stdout is already a pipeline stage.

View File

@ -9,8 +9,8 @@ mounted filesystem under `s/`, so they are available without any `$PATH` changes
```sh
exec $OLLIE/s/sh # start interactive shell
$OLLIE/s/job "my prompt" # batch job (foreground)
$OLLIE/s/q "my prompt" # foreground one-shot query
$OLLIE/s/sched "my prompt" # background job; prints b/ path
$OLLIE/b/q "my prompt" # foreground one-shot query
$OLLIE/b/sched "my prompt" # background job; prints b/ path
$OLLIE/s/ls # list sessions
$OLLIE/s/kill <id> # kill a session
$OLLIE/s/optimize "prompt" # generate and return best optimized prompt
@ -19,6 +19,7 @@ $OLLIE/s/optimize "prompt" # generate and return best optimized prompt
Scripts are organized by the filesystem namespace they are hosted under:
- `s/` — scripts hosted under the `s/` namespace
- `b/` — scripts hosted under the `b/` namespace
---
@ -104,6 +105,42 @@ With `-parallel N` and N > 1, results are separated by `=== {id} ===` headers.
---
## b/q
Foreground one-shot query; thin wrapper around `s/job`. Output goes to stdout.
```
b/q [flags] [prompt...]
echo "prompt" | b/q [flags]
```
Accepts the same flags as `s/job`.
---
## b/sched
Submit a background job; prints the `b/` path for each job.
```
b/sched [flags] [prompt...]
echo "prompt" | b/sched [flags]
```
**Flags**
| Flag | Description |
|---|---|
| `-name N` | Base job name |
| `-cwd DIR` | Working directory (default: `pwd`) |
| `-agent A` | Agent config name |
| `-backend B` | Backend override |
| `-model M` | Model override |
| `-output FORMAT` | Output format hint (e.g. `json`) |
| `-parallel N` | Submit N parallel jobs (default: 1) |
---
## s/optimize
Generates N candidate optimized prompts, judges them, and returns the best one to stdout. Debugging output (progress messages) goes to stderr.
@ -128,7 +165,7 @@ echo "prompt" | s/optimize [flags]
```sh
s/optimize "Summarize this document"
s/optimize -n 5 -cm qwen/qwen3-8b -jm anthropic/claude-opus-4.6 "Write a haiku"
s/optimize "generate a hello world program. use c++." >[2]/dev/null | s/q
s/optimize "generate a hello world program. use c++." >[2]/dev/null | b/q
```
Outputs to stdout, making it composable with other pipeline stages.

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# s/q: foreground one-shot query; output goes to stdout.
# b/q: foreground one-shot query; output goes to stdout.
for _arg; do
[ "$_arg" = "-help" ] && cat <<'EOF' && exit 0
usage: q [flags] [prompt...]
@ -16,4 +16,4 @@ Flags:
-help show this help
EOF
done
exec "${0%/*}/job" "$@"
exec "${0%/*}/../s/job" "$@"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# s/sched: submit a background job; prints the b/ path for each job.
# b/sched: submit a background job; prints the b/ path for each job.
for _arg; do
[ "$_arg" = "-help" ] && cat <<'EOF' && exit 0
usage: sched [flags] [prompt...]
@ -17,6 +17,6 @@ Flags:
EOF
done
OLLIE=${OLLIE:-$HOME/mnt/ollie}
"${0%/*}/job" -bg "$@" | while IFS= read -r id; do
"${0%/*}/../s/job" -bg "$@" | while IFS= read -r id; do
[ -n "$id" ] && printf '%s/b/%s\n' "$OLLIE" "$id"
done

View File

@ -47,7 +47,7 @@ fi
[ -z "$prompt" ] && { printf 'optimize: empty prompt\n' >&2; exit 1; }
Q="${0%/*}/q"
Q="${0%/*}/../b/q"
c_flags=()
j_flags=()