orizu 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -3
- package/dist/help.js +611 -0
- package/dist/index.js +458 -20
- package/dist/preview-runtime.js +857 -0
- package/dist/skill-installer.js +180 -0
- package/package.json +12 -3
- package/scripts/vendor-orizu-skill.mjs +54 -0
- package/src/help.ts +676 -0
- package/src/index.ts +568 -21
- package/src/preview-runtime.ts +976 -0
- package/src/skill-installer.ts +260 -0
- package/vendor/orizu-gepa-python/src/orizu_gepa/cli.py +16 -0
- package/vendor/orizu-gepa-python/src/orizu_gepa/optimizer.py +68 -56
- package/vendor/orizu-gepa-python/src/orizu_gepa/reflection.py +31 -6
- package/vendor/skills/orizu-cli/SKILL.md +185 -0
- package/vendor/skills/orizu-cli/agents/openai.yaml +4 -0
- package/vendor/skills/orizu-cli/references/building-apps.md +1461 -0
- package/vendor/skills/orizu-cli/references/building-judges.md +218 -0
- package/vendor/skills/orizu-cli/references/cli-reference.md +324 -0
- package/vendor/skills/orizu-cli/references/optimization-reports.md +174 -0
- package/vendor/skills/orizu-cli/references/optimization-with-gepa.md +291 -0
- package/vendor/skills/orizu-cli/references/primer.md +245 -0
- package/vendor/skills/orizu-cli/references/prompt-control-plane.md +830 -0
- package/vendor/skills/orizu-cli/scripts/test-app.mjs +492 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orizu-cli
|
|
3
|
+
description: Use when the user wants to improve an LLM application's performance in a measurable way, or mentions Orizu by name. Triggers include improving model or agent performance, collecting human feedback on model outputs, converting feedback into evals, building or crafting evals, running prompt optimization (including one-off prompt tweaks the user is willing to validate with evals), working with Orizu datasets, tasks, apps, prompts, judges, scorers, runners, score runs, or optimization runs, hill-climbing on metrics, or building "continually learning" agents. Orizu is a platform for building evals first, then improving LLM applications by optimizing against them. The CLI handles human feedback collection, eval creation, versioned prompt and scorer artifacts, local runner execution, score submission, and prompt optimization. Do NOT use for prompt advice when the user has explicitly said they don't want to set up evals.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Orizu
|
|
7
|
+
|
|
8
|
+
Orizu improves LLM applications by building evals first, then optimizing against them. The end-to-end loop has four steps: **Upload → Annotate → Judge → Optimize**. The CLI covers human-eval collection plus the Phase 0 prompt control plane: prompts, judges, scorers, runners, local runner execution, score submission, packaged GEPA-style text optimization, and live optimization logging.
|
|
9
|
+
|
|
10
|
+
For end-to-end methodology and rationale, read `references/primer.md`. The reference docs below cover specific stages in depth.
|
|
11
|
+
|
|
12
|
+
## When to step aside
|
|
13
|
+
|
|
14
|
+
Skip this skill when:
|
|
15
|
+
- The user wants a one-off prompt tweak they explicitly won't validate with evals.
|
|
16
|
+
- The user has already said they don't want to set up evals.
|
|
17
|
+
- The request is generic prompt-engineering theory unrelated to a specific app.
|
|
18
|
+
|
|
19
|
+
# Orizu CLI basics
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- Node.js 20+ installed.
|
|
24
|
+
- Install the CLI: `npm i -g orizu`.
|
|
25
|
+
- Install this skill from the CLI package: `orizu install-skill --target agent-user --yes`.
|
|
26
|
+
- Rediscover the command surface any time with `orizu --help`, `orizu <group> --help`, or `orizu capabilities --json`.
|
|
27
|
+
- Login callback requires `127.0.0.1:43123`.
|
|
28
|
+
- Credentials are stored at `~/.config/orizu/credentials.json`.
|
|
29
|
+
- Current `orizu login` creates a user-owned personal access token for the CLI and stores it as a v3 API-key credential. The raw token is not recoverable after creation.
|
|
30
|
+
|
|
31
|
+
## Login
|
|
32
|
+
|
|
33
|
+
- Verify auth: `orizu whoami`.
|
|
34
|
+
- Start the login flow: `orizu login` (opens a browser tab).
|
|
35
|
+
- Approving login in the browser creates a personal access token for that Orizu user. The token inherits the user's current team/project access and loses access if the user's role or membership changes.
|
|
36
|
+
- Clear local credentials and revoke the current CLI token: `orizu logout`.
|
|
37
|
+
- Revoke other CLI tokens from the Personal Tokens page in Orizu.
|
|
38
|
+
- Auth failure loop: `orizu login` → `orizu whoami` → rerun the original command.
|
|
39
|
+
|
|
40
|
+
## Teams and projects
|
|
41
|
+
|
|
42
|
+
Projects live inside teams. Resolve or create both before any workflow command.
|
|
43
|
+
|
|
44
|
+
- `orizu teams list` — list teams the user belongs to.
|
|
45
|
+
- `orizu teams create --name "<team name>"` — create a team.
|
|
46
|
+
- `orizu projects list [--team <teamSlug>]` — list projects (optionally scoped to a team).
|
|
47
|
+
- `orizu projects create --name "<project name>" --team <teamSlug>` — create a project.
|
|
48
|
+
|
|
49
|
+
For team membership, app, dataset, and task command surfaces, see `references/cli-reference.md`.
|
|
50
|
+
|
|
51
|
+
# Evals best practices
|
|
52
|
+
|
|
53
|
+
Walk through the four steps in order — each depends on the output of the previous. Methodology and rationale: `references/primer.md`.
|
|
54
|
+
|
|
55
|
+
## 1. Upload — gather diverse traces
|
|
56
|
+
|
|
57
|
+
Principles:
|
|
58
|
+
- Mix production traces with a **random sample**. Thumbs-down feedback alone is biased toward extreme failures and misses subtle ones.
|
|
59
|
+
- Aim for **~100+ diverse traces**. Stop adding when you stop discovering new failure modes (theoretical saturation).
|
|
60
|
+
- Synthetic data is fine when real traces are scarce — vary structured inputs (feature × persona × scenario), seed from real logs, and filter for difficulty. Don't ask "generate 50 test cases" cold.
|
|
61
|
+
|
|
62
|
+
CLI:
|
|
63
|
+
```bash
|
|
64
|
+
orizu datasets upload --project <teamSlug>/<projectSlug> --file <traces.jsonl> --name "<batch>"
|
|
65
|
+
orizu datasets append --dataset <datasetId> --file <more.jsonl>
|
|
66
|
+
orizu datasets lock --dataset <datasetId> --reason "Freeze for labeling"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Deeper: `references/primer.md` (Step 1, Step 0 error analysis); `references/cli-reference.md` (datasets surface).
|
|
70
|
+
|
|
71
|
+
## 2. Annotate — binary labels per failure mode
|
|
72
|
+
|
|
73
|
+
Principles:
|
|
74
|
+
- **Binary, not Likert.** Pass/fail forces a ship/no-ship decision; 3/5 doesn't.
|
|
75
|
+
- **One question per failure mode.** Don't bundle correctness, tone, and helpfulness.
|
|
76
|
+
- **Annotate failures you've actually observed.** Hypothetical-failure labels are low-value.
|
|
77
|
+
- **Custom UI per task** — generic annotation interfaces collapse signal. The labeler should feel like an app annotators want to use, not a form they tolerate.
|
|
78
|
+
|
|
79
|
+
CLI:
|
|
80
|
+
```bash
|
|
81
|
+
orizu apps create --project <teamSlug>/<projectSlug> --name "<labeler>" --dataset <datasetId> \
|
|
82
|
+
--file <App.tsx> --input-schema <input.json> --output-schema <output.json>
|
|
83
|
+
|
|
84
|
+
orizu tasks create --project <teamSlug>/<projectSlug> --dataset <datasetId> --app <appId> \
|
|
85
|
+
--title "<round>" --labels-per-item 2
|
|
86
|
+
|
|
87
|
+
# Open the returned task URL and test the draft manually before assigning.
|
|
88
|
+
orizu tasks publish --task <taskId> --assignees <userId1,userId2>
|
|
89
|
+
|
|
90
|
+
orizu tasks status --task <taskId>
|
|
91
|
+
orizu tasks report set --task <taskId> --report-file ./task-report.md
|
|
92
|
+
orizu tasks export --task <taskId> --format jsonl --out ./labels.jsonl
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Authoring the labeler: **`references/building-apps.md`** covers the component contract, design principles, common patterns (trace exploration, side-by-side, text annotation, etc.), the offline smoke test at `scripts/test-app.mjs` (runs on plain `node`), and `orizu apps preview`. When you generate or modify an app, run the preview command with a representative sample row, inspect the screenshot, and revise the app until the rendered workflow appears to match the user's intended review task before `orizu apps create`.
|
|
96
|
+
|
|
97
|
+
Deeper: `references/primer.md` (Step 2); `references/cli-reference.md` (apps + tasks surface).
|
|
98
|
+
|
|
99
|
+
## 3. Judge — turn labels into automated evaluators
|
|
100
|
+
|
|
101
|
+
Use the Phase 0 prompt control plane when the user wants judges stored in Orizu as versioned prompt artifacts, runner zips, scorer definitions, and submitted score results. Read **`references/prompt-control-plane.md`** before using those commands. When the user mentions prompt feedback, prompt comments, or asks what to focus on for the next prompt version, inspect comment threads with `orizu prompts comments <prompt-id-or-name> --project <team>/<project>` before editing or pushing.
|
|
102
|
+
|
|
103
|
+
Judge construction details are still useful when authoring the evaluator itself.
|
|
104
|
+
|
|
105
|
+
A judge is the evaluator prompt artifact. A scorer is the metric contract that names what score is being produced and how it should be displayed, compared, and used in optimizations. For UI-visible prompt performance, register a scorer and submit score runs; do not rely only on raw `runs submit`.
|
|
106
|
+
|
|
107
|
+
Set scorers are aggregate metric contracts. Use `orizu scorers exec` for builtin set metrics such as Cohen's kappa, accuracy, precision, recall, and F1; it consumes subject results or dependency row-scorer results, computes one aggregate, stores row evidence, and submits a canonical score run by default. If you already computed an aggregate locally, use `orizu scores submit --aggregate` with explicit `scoreValue`, `diagnostics`, `feedbackSummary`, and optional `rowEvidence`. `runners exec --scorer-version` remains a low-level row-runner compatibility command. Use a row-mode scorer, not a set scorer, for GEPA reflection because reflection needs per-row feedback.
|
|
108
|
+
|
|
109
|
+
Principles:
|
|
110
|
+
- **Code assertions first.** If a failure is a rule (keyword present, tool called, format valid), write a code check. Fast, free, deterministic.
|
|
111
|
+
- **LLM-as-a-judge for nuanced criteria only.** Always validate against your human labels.
|
|
112
|
+
- **TPR > 90% and TNR > 90%** before trusting a judge. Track each separately — accuracy is misleading on imbalanced data.
|
|
113
|
+
- **A 100% pass rate is a smell.** Your evals are saturated; add harder cases.
|
|
114
|
+
|
|
115
|
+
Authoring workflow:
|
|
116
|
+
1. Export labels: `orizu tasks export --task <id> --format jsonl --out labels.jsonl`.
|
|
117
|
+
2. For each failure mode, choose code assertion or LLM-judge.
|
|
118
|
+
3. Build the judge.
|
|
119
|
+
4. Validate: split labels train/dev/test (20/40/40), measure TPR + TNR on test, target both > 90%.
|
|
120
|
+
5. Run the validated judge over future outputs.
|
|
121
|
+
|
|
122
|
+
Detailed walkthrough — code assertion patterns, LLM-judge prompt scaffold, train/dev/test split, TPR/TNR computation, saturation: **`references/building-judges.md`**.
|
|
123
|
+
|
|
124
|
+
## 4. Optimize — hill-climb against validated judges
|
|
125
|
+
|
|
126
|
+
Use the Phase 0 prompt control plane when the user wants an optimizer run to appear in Orizu, stream live events, or promote accepted candidates into the prompt timeline. For text-candidate GEPA-style optimization, prefer the bundled `orizu optimizations run-gepa` flow. Read **`references/prompt-control-plane.md`** before wiring those endpoints.
|
|
127
|
+
|
|
128
|
+
GEPA details below are still useful for local optimizer implementation. DSPy is only relevant when the customer already uses DSPy or asks for an external DSPy GEPA implementation.
|
|
129
|
+
|
|
130
|
+
Principles:
|
|
131
|
+
- Only optimize against judges you've validated. Otherwise you Goodhart your way to a worse system.
|
|
132
|
+
- Compare before/after on the **same held-out eval suite**. Don't trust vibes.
|
|
133
|
+
- Read **per-failure-mode metrics**, not just combined — averages hide regressions.
|
|
134
|
+
- Improved-system traces feed back into step 1; the loop continues.
|
|
135
|
+
|
|
136
|
+
Local execution workflow:
|
|
137
|
+
1. Package the candidate execution as an Orizu runner.
|
|
138
|
+
2. Register validated row/set scorers.
|
|
139
|
+
3. Run the bundled GEPA-style optimizer or a custom optimizer against the scorer set.
|
|
140
|
+
4. Inspect `logs/<optimization_run_id>` for full local optimization traces, especially `evaluations.jsonl`, `reflections.jsonl`, `events.jsonl`, and `result.json`.
|
|
141
|
+
5. If the local log is unavailable or the run happened remotely, use `orizu optimizations export <run-id> --out <run-id>.optimization.json`.
|
|
142
|
+
6. Write a markdown optimization report from the logs/export and attach it with `--report-file <path>` when finishing, failing, or cancelling the run.
|
|
143
|
+
7. Diff before/after on a held-out set; ship if it holds.
|
|
144
|
+
|
|
145
|
+
Bundled `run-gepa` reflection behavior:
|
|
146
|
+
- The reflective LM's final text is used verbatim as the next candidate prompt. It should return only the complete updated prompt body, not analysis, labels, XML tags, or markdown fences.
|
|
147
|
+
- Keep provider-native reasoning controls separate from the prompt text with `--reflection-provider-settings <json|@file>`.
|
|
148
|
+
- Reflection max-token limits are explicit config, not implicit defaults. Use `--reflection-max-tokens <n>` when a provider requires an output cap; this maps to Anthropic `max_tokens` and OpenAI `max_output_tokens`.
|
|
149
|
+
- Anthropic native Messages reflection requires `max_tokens`, so `run-gepa` with an `anthropic/...` reflection model must receive `--reflection-max-tokens <n>` and should fail fast if it is omitted. OpenAI reflection may omit `max_output_tokens` unless the user explicitly wants a cap.
|
|
150
|
+
- By default, `run-gepa` skips reflection and child creation when every row in the selected parent mini-batch is already perfect (`1.0` for higher-is-better scorers, `0.0` for lower-is-better scorers). This saves reflection tokens because the child cannot beat a saturated mini-batch. Use `--no-skip-perfect-parent-reflection` to force reflection anyway, or `--skip-perfect-parent-reflection` to make the default explicit in scripted runs.
|
|
151
|
+
- `run-gepa` writes complete local logs by default under `logs/<optimization_run_id>`; override with `--log-dir <dir>` or disable with `--no-local-log`.
|
|
152
|
+
- Server optimization events redact row snapshots and reflection prompts by default; the local log keeps full row inputs, outputs, scores, feedback, reflection prompts, and reflection responses for later agent analysis.
|
|
153
|
+
- OpenAI example: `--reflection-model openai/gpt-5 --reflection-provider-settings '{"reasoning":{"effort":"medium","summary":"auto"}}'`.
|
|
154
|
+
- Anthropic example: `--reflection-model anthropic/claude-opus-4-7 --reflection-max-tokens 4096 --reflection-provider-settings '{"thinking":{"type":"adaptive","display":"omitted"},"output_config":{"effort":"medium"}}'`.
|
|
155
|
+
|
|
156
|
+
Detailed walkthrough — GEPA mechanics, Orizu-tracked optimization, optional DSPy context for customers already using it, and before/after comparison: **`references/optimization-with-gepa.md`**. Report-writing structure and interpretation guidance: **`references/optimization-reports.md`**.
|
|
157
|
+
|
|
158
|
+
# Reference index
|
|
159
|
+
|
|
160
|
+
- `references/primer.md` — methodology end-to-end (read first when in doubt about *why*).
|
|
161
|
+
- `references/cli-reference.md` — full CLI command surface.
|
|
162
|
+
- `references/prompt-control-plane.md` — Phase 0 prompts, judges, scorers, runners, score submission, optimizer event logging, bundled GEPA, and promotion endpoints.
|
|
163
|
+
- `references/building-apps.md` — labeler app contract, design principles, common patterns, offline smoke test.
|
|
164
|
+
- `references/building-judges.md` — judge/scorer authoring + TPR/TNR validation.
|
|
165
|
+
- `references/optimization-with-gepa.md` — GEPA optimization loop, with DSPy only as external context.
|
|
166
|
+
- `references/optimization-reports.md` — report template, GEPA diagnostics, kappa/confusion-matrix guidance, and next-step recommendations.
|
|
167
|
+
- `scripts/test-app.mjs` — smoke test for `App.tsx` + schemas before `orizu apps create` (runs on plain `node`).
|
|
168
|
+
|
|
169
|
+
# Execution rules
|
|
170
|
+
|
|
171
|
+
- Prefer explicit flags in non-TTY contexts; reserve interactive fallback for TTY.
|
|
172
|
+
- Canonical selectors: `--team`, `--project`, `--app`, `--task`, `--dataset`, `--assignees`.
|
|
173
|
+
- `tasks create` creates drafts by default. Test the returned task URL manually, then use `tasks publish --task <taskId> --assignees <userId1,userId2>` after approval.
|
|
174
|
+
- `tasks assign` and `tasks publish` take user IDs, not emails.
|
|
175
|
+
- `datasets edit-rows` requires a non-empty string `id` on each row in `--file`.
|
|
176
|
+
- `datasets delete-rows` uses `--row-ids` as the canonical selector.
|
|
177
|
+
- `datasets delete` requires interactive terminal confirmation; there is no non-interactive confirmation option.
|
|
178
|
+
- Locked datasets reject append/edit/delete row mutations.
|
|
179
|
+
- `--output-schema` JSON Schema validation surface is restricted to `type`, `required`, `properties`, `items`, `enum`.
|
|
180
|
+
- Export defaults: `--format jsonl`, output `<taskId>.<format>`.
|
|
181
|
+
- Task reports can be uploaded only after the task is `paused` or `completed`; rerun `tasks report set` or `tasks report upload` to replace the markdown report.
|
|
182
|
+
- Prompt control-plane commands should use ids for dataset versions, split sets, prompt versions, scorer versions, runner versions, optimizer versions, and optimization runs.
|
|
183
|
+
- Optimization exports default to `<run-id>.optimization.json`; prefer the existing `logs/<run-id>` directory from `run-gepa` when it is available because it contains the full local trace without needing server rehydration.
|
|
184
|
+
- When ending an optimization run, attach a markdown report with `--report-file` when possible. Use `references/optimization-reports.md` for what to include.
|
|
185
|
+
- Use `orizu prompts comments <prompt-id-or-name> --project <team>/<project> [--label <label> | --version <id>] [--json]` to list prompt-level discussion threads with open/resolved status, selected text/line context, and replies.
|