File size: 3,117 Bytes
d2f31ee 13813a2 d2f31ee 13813a2 d2f31ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # experiments
Experiment designs and run data for [ports-research](https://github.com/thekevinscott/ports-research). This folder is `experiments/` in that repo, gitignored there and stored here.
## Querying with dirsql
`.dirsql.toml` declares one table per file, `run_records` (`run.json`), `manifests` and `results`, and the view `runs` that joins them by `run_id`. One table per file because dirsql hands `on-file` its matches in batches, which can split one run's files across two calls. dirsql loads it only when told to (`-c`); the glob resolves against this directory, so the command works from anywhere. From the repo root:
```
uvx dirsql --no-ignore -c experiments/.dirsql.toml "SELECT experiment, COUNT(*) FROM runs GROUP BY experiment"
```
`--no-ignore` is required: `experiments/` is gitignored, and dirsql skips gitignored files by default. `uv tool install dirsql` makes it `dirsql --no-ignore -c ...`. `jq` must be on PATH: each table's rows come from `jq` over its file.
`runs`: one row per run with a manifest, `run.json` and `result.json` joined on.
| From | Columns |
| --- | --- |
| directory names | `run_id`, `experiment` |
| run.json | `exit_code`, `excluded`, `reason`, `created`, `ended` |
| manifest | `timestamp`, `completed_at`, `container_exit_code` (the manifest's `exit_code`), `error`, `harness_commit`, `harness_dirty`, `sandbox_image_id`, `gbnf_commit`, `reference_files` (JSON list) |
| manifest `condition` | `name`, `source_language`, `target_language`, `model`, `effort`, `include_unit_tests`, `include_source_integration_tests`, `include_target_integration_tests` (V2), `include_python_tests`, `include_typescript_tests` (V1) |
| result.json | `is_error`, `terminal_reason`, `stop_reason`, `subtype`, `api_error`, `api_error_status`, `num_turns`, `queued_turn_count`, `result_index`, `safety_stops`, `duration_ms`, `duration_api_ms`, `ttft_ms`, `ttft_stream_ms`, `time_to_request_ms`, `first_content_frame_ms`, `fast_mode_state`, `fast_mode_disabled_reason`, `session_id`, `uuid`, `result`; nested objects as JSON text: `usage`, `model_usage`, `subagent_stats`, `permission_denials`, `origin` |
| result.json `usage` | `input_tokens`, `output_tokens`, `cache_creation_input_tokens`, `cache_read_input_tokens`, `thinking_tokens`, `speed`, `service_tier`, `inference_geo` |
Runs without a `result.json` have NULL in every result column. `total_cost_usd` is not a column.
Examples:
```
uvx dirsql --no-ignore -c experiments/.dirsql.toml "SELECT experiment, excluded, exit_code, COUNT(*) FROM runs GROUP BY 1, 2, 3 ORDER BY 1, 2, 3"
uvx dirsql --no-ignore -c experiments/.dirsql.toml "SELECT run_id, model, effort, terminal_reason FROM runs WHERE is_error = 1"
uvx dirsql --no-ignore -c experiments/.dirsql.toml "SELECT run_id FROM runs WHERE completed_at IS NULL"
uvx dirsql --no-ignore -c experiments/.dirsql.toml "SELECT model, effort, AVG(output_tokens) FROM runs WHERE experiment = 'v2-models-effort' GROUP BY 1, 2"
```
With no query, the same command opens a REPL. Output is a table on a terminal and JSON when piped; `--format table` or `--format json` forces one.
|