pi-ext bugabingas pi extensions
owned by bugabinga
README Source History Refs Compare Notes Search Rename slash command and state paths from autoresearch to tune; verify unit+harness tests and extension build 6f10dd33e2dffe35455db0a13c73266545db2ad0
Oliver Jan Krylow <oliver@bugabinga.net > · 9 Jun 2026
unsigned
Browse files Compare with HEAD
Result: {"status":"keep","wall_time":600,"tests_passed":44,"failures":0}
Changed files (11) extensions/autoresearch/CHANGELOG.md Modified 6 6 ##
0.1.0 - 2026-05-30 8 8 Fork of [pi-autoresearch](https://github.com/davebcn87/pi-autoresearch) with breaking changes:
10 - - State dir moved to `.pi/autoresearch/` (was `autoresearch.*` files at project root)
10 + - State dir moved to `.pi/tune/` (was `autoresearch.*` files at project root)
11 11 - Scripts renamed: `benchmark.mjs` (was `autoresearch.sh`), `checks.mjs` (was `autoresearch.checks.sh`)
12 12 - Hooks are Node.js only (`.mjs`), no bash dependency
13 - - `workingDir` config option removed (state always in `.pi/autoresearch/`)
14 - - Session files renamed: `session.jsonl` (was `autoresearch.jsonl`), `session.md` (was `autoresearch.md`), `ideas.md` (was `autoresearch.ideas.md`)
13 + - `workingDir` config option removed (state always in `.pi/tune/`)
14 + - Session files renamed: `session.jsonl` (was `session.jsonl`), `session.md` (was `session.md`), `ideas.md` (was `ideas.md`)
15 15 - Adapted to `@earendil-works/pi-coding-agent` and `typebox` packages
extensions/autoresearch/README.md Modified 3 - Autonomous experiment loop for Pi.
3 + Tune code through autonomous experiment loops for Pi.
10 10 ##
Commands / tools / settings 13 - `/autoresearch [off|clear|export|<text>]` — start, stop, clear, or resume autoresearch mode.
13 + `/tune [off|clear|export|<text>]` — start, stop, clear, or resume tune mode.
16 16 - `init_experiment` — configure session (name, metric, unit, direction)
18 18 - `log_experiment` — record result, auto-commit or auto-revert
21 - Keyboard shortcuts configurable in `<agent-dir>/extensions/autoresearch.json`.
21 + Keyboard shortcuts configurable in `<agent-dir>/extensions/tune.json`.
25 - - `session_start` / `session_tree`: reconstruct state from `.pi/autoresearch/session.jsonl`
26 - - `before_agent_start`: inject autoresearch system prompt when mode active
25 + - `session_start` / `session_tree`: reconstruct state from `.pi/tune/session.jsonl`
26 + - `before_agent_start`: inject tune system prompt when mode active
27 27 - `session_before_compact`: produce deterministic compaction summary
28 28 - `agent_end`: schedule auto-resume when mode active
29 29 - `session_shutdown`: clean up UI and timers
33 - All state lives in `.pi/autoresearch/`:
33 + All state lives in `.pi/tune/`:
48 - Runs an autonomous loop: edit → commit → benchmark → log → keep or revert → repeat.
48 + Tunes through an autonomous loop: edit → commit → benchmark → log → keep or revert → repeat.
50 50 Confidence scoring (MAD-based) after 3+ runs: ≥2.0× = real, 1.0–2.0× = marginal, <1.0× = noise.
extensions/autoresearch/__tests__/remaining.test.ts Modified 1 - import { describe, expect, it }
from "bun:test" ;
1 + import { beforeAll, describe, expect, it }
from "bun:test" ;
2 2 import * as fs
from "node:fs" ;
3 3 import * as path
from "node:path" ;
11 11 import { __test }
from "../index.ts" ;
13 13 const TESTDIR
= "/tmp/pi-ext-20260530-164209-project" ;
15 + '{"type":"config","name":"Optimize sqrt/sin loop","metricName":"total_ms","metricUnit":"ms","bestDirection":"lower"}' ,
16 + '{"run":1,"commit":"92d4b83","metric":7,"metrics":{},"status":"keep","description":"Baseline: unoptimized sqrt/sin loop","timestamp":1780152220658,"segment":0,"confidence":null,"asi":{"hypothesis":"Baseline measurement"}}' ,
17 + '{"run":2,"commit":"92d4b83","metric":10,"metrics":{},"status":"discard","description":"Sin LUT inside timed region — slower","timestamp":1780152284058,"segment":0,"confidence":null,"asi":{"hypothesis":"Sin lookup table inside timed region adds overhead"}}' ,
18 + '{"run":3,"commit":"5666498","metric":1,"metrics":{},"status":"keep","description":"Sin LUT built before timed region","timestamp":1780152315721,"segment":0,"confidence":2,"asi":{"hypothesis":"Move sin LUT construction before timed region"}}' ,
19 + '{"run":4,"commit":"5666498","metric":1,"metrics":{},"status":"discard","description":"Sqrt+sin LUTs — no improvement","timestamp":1780152358180,"segment":0,"confidence":2,"asi":{"hypothesis":"Pre-compute both sqrt and sin"}}' ,
20 + '{"run":5,"commit":"5666498","metric":1,"metrics":{},"status":"discard","description":"Full product LUT — no improvement","timestamp":1780152396062,"segment":0,"confidence":null,"asi":{"hypothesis":"Pre-compute full products"}}' ,
24 + const tuneDir
= path.
join (TESTDIR,
".pi" ,
"tune" );
25 + fs.
mkdirSync (tuneDir, { recursive:
true });
26 + fs.
writeFileSync (path.
join (tuneDir,
"session.jsonl" ), TEST_JSONL);
19 33 const paths
= autoresearchSummaryPathsFor (TESTDIR);
20 34 const summary
= buildAutoresearchCompactionSummary (paths);
22 - expect (summary).
toContain (
"Autoresearch Compaction Summary" );
36 + expect (summary).
toContain (
"Tune Compaction Summary" );
23 37 expect (summary).
toContain (
"## Session" );
24 38 expect (summary).
toContain (
"Optimize" );
25 39 expect (summary).
toContain (
"total_ms" );
80 94 it (
"isBenchmarkCommand accepts/rejects correctly" , ()
=> {
81 - expect (__test.
isBenchmarkCommand (
"node .pi/autoresearch/benchmark.mjs" )).
toBe (
true );
95 + expect (__test.
isBenchmarkCommand (
"node .pi/tune/benchmark.mjs" )).
toBe (
true );
82 96 expect (__test.
isBenchmarkCommand (
"node benchmark.mjs" )).
toBe (
true );
83 97 expect (__test.
isBenchmarkCommand (
"pnpm test" )).
toBe (
false );
84 98 expect (__test.
isBenchmarkCommand (
"nice node benchmark.mjs" )).
toBe (
true );
100 114 describe (
"hook paths" , ()
=> {
101 - it (
"resolves to .pi/autoresearch/hooks/{stage}.mjs" , ()
=> {
115 + it (
"resolves to .pi/tune/hooks/{stage}.mjs" , ()
=> {
102 116 expect (
hookScriptPath (
"/project" ,
"before" )).
toBe (
103 - "/project/.pi/autoresearch/hooks/before.mjs" ,
117 + "/project/.pi/tune/hooks/before.mjs" ,
105 119 expect (
hookScriptPath (
"/project" ,
"after" )).
toBe (
106 - "/project/.pi/autoresearch/hooks/after.mjs" ,
120 + "/project/.pi/tune/hooks/after.mjs" ,
116 130 const template
= fs.
readFileSync (templatePath,
"utf-8" );
118 132 expect (templatePath).
toEndWith (path.
join (
"autoresearch" ,
"assets" ,
"template.html" ));
119 - expect (template).
toContain (
"__AUTORESEARCH_TITLE__" );
133 + expect (template).
toContain (
"__TUNE_TITLE__" );
120 134 expect (template).
toContain (
"session.jsonl" );
121 135 expect (template).
toContain (
"Nugu dark palette" );
122 136 expect (template).
toContain (
"diff-review-theme" );
extensions/autoresearch/__tests__/unit.test.ts Modified 71 71 const { isBenchmarkCommand }
= __test;
73 73 it (
"accepts node benchmark.mjs" , ()
=> {
74 - expect (
isBenchmarkCommand (
"node .pi/autoresearch/benchmark.mjs" )).
toBe (
true );
74 + expect (
isBenchmarkCommand (
"node .pi/tune/benchmark.mjs" )).
toBe (
true );
77 77 it (
"accepts node with path to benchmark.mjs" , ()
=> {
96 + describe (
"tune autocomplete" , ()
=> {
97 + const { tuneArgumentCompletions, tuneCommandArgumentSuggestions }
= __test;
99 + it (
"suggests subcommands from argument prefixes" , ()
=> {
100 + expect (
tuneArgumentCompletions (
"e" )).
toEqual ([
101 + { value:
"export" , label:
"export" , description:
"Open live dashboard" },
103 + expect (
tuneArgumentCompletions (
" c" )).
toEqual ([
104 + { value:
"clear" , label:
"clear" , description:
"Delete session.jsonl and stop" },
108 + it (
"does not suggest after freeform objective text begins" , ()
=> {
109 + expect (
tuneArgumentCompletions (
"optimize runtime" )).
toBeNull ();
110 + expect (
tuneArgumentCompletions (
"z" )).
toBeNull ();
113 + it (
"intercepts forced autocomplete for tune subcommands" , ()
=> {
114 + expect (
tuneCommandArgumentSuggestions ([
"/tune " ],
0 ,
6 )).
toEqual ({
117 + { value:
"off" , label:
"off" , description:
"Turn tune mode off" },
118 + { value:
"clear" , label:
"clear" , description:
"Delete session.jsonl and stop" },
119 + { value:
"export" , label:
"export" , description:
"Open live dashboard" },
122 + expect (
tuneCommandArgumentSuggestions ([
"/tune e" ],
0 ,
7 )).
toEqual ({
124 + items: [{ value:
"export" , label:
"export" , description:
"Open live dashboard" }],
126 + expect (
tuneCommandArgumentSuggestions ([
"/tune optimize" ],
0 ,
14 )).
toBeNull ();
96 132 describe (
"parseJsonlEntry" , ()
=> {
150 186 it (
"returns default when no config" , ()
=> {
151 - expect (
extractAutoresearchSessionName (
'{"run":1}\n' )).
toBe (
"Autoresearch" );
187 + expect (
extractAutoresearchSessionName (
'{"run":1}\n' )).
toBe (
"Tune" );
203 239 ideasPath :
"/tmp/nonexistent/ideas.md" ,
205 241 const summary
= buildAutoresearchCompactionSummary (paths);
206 - expect (summary).
toContain (
"Autoresearch Compaction Summary" );
242 + expect (summary).
toContain (
"Tune Compaction Summary" );
207 243 expect (summary).
toContain (
"Runs so far: 0" );
208 244 expect (summary).
toContain (
"Next Step" );
228 264 describe (
"hookScriptPath" , ()
=> {
229 - it (
"resolves to .pi/autoresearch/hooks/{stage}.mjs" , ()
=> {
265 + it (
"resolves to .pi/tune/hooks/{stage}.mjs" , ()
=> {
230 266 expect (
hookScriptPath (
"/project" ,
"before" )).
toBe (
231 - "/project/.pi/autoresearch/hooks/before.mjs" ,
267 + "/project/.pi/tune/hooks/before.mjs" ,
233 269 expect (
hookScriptPath (
"/project" ,
"after" )).
toBe (
234 - "/project/.pi/autoresearch/hooks/after.mjs" ,
270 + "/project/.pi/tune/hooks/after.mjs" ,
extensions/autoresearch/assets/template.html Modified 6 6 <
meta charset=
"utf-8" >
7 7 <
meta name=
"viewport" content=
"width=device-width, initial-scale=1" >
8 - <
title >__AUTORESEARCH_TITLE__</
title >
8 + <
title >__TUNE_TITLE__</
title >
11 11 const mode
= localStorage.getItem(
"diff-review-theme" )
|| "system" ;
239 239 <
header id=
"topbar" >
240 240 <
div class=
"brand" >
242 - <
h1 id=
"title" >Autoresearch</
h1 >
243 - <
div class=
"subtitle" >Pi × experiments</
div >
242 + <
h1 id=
"title" >Tune</
h1 >
243 + <
div class=
"subtitle" >Pi × tune</
div >
244 244 <
div id=
"summary" >Loading session.jsonl…</
div >
298 298 const VALID
= new Set ([
"keep" ,
"discard" ,
"crash" ,
"checks_failed" ]);
299 299 const COLORS
= { line:
"#d86dd8" , info:
"#3ec5dd" , error:
"#e46479" , grid:
"rgba(157,157,157,.18)" , muted:
"#9d9d9d" };
300 - let state
= { config:{ name:
"Autoresearch" , metricName:
"metric" , metricUnit:
"" , bestDirection:
"lower" }, runs:[] };
300 + let state
= { config:{ name:
"Tune" , metricName:
"metric" , metricUnit:
"" , bestDirection:
"lower" }, runs:[] };
301 301 let lastText
= "" ;
352 352 const config = entries.find(x => x && x.type === "config") || {};
354 - name: config.name || "Autoresearch",
354 + name: config.name || "Tune",
355 355 metricName: config.metricName || "metric",
356 356 metricUnit: config.metricUnit || "",
357 357 bestDirection: config.bestDirection === "higher" ? "higher" : "lower",
extensions/autoresearch/compaction.ts Modified 34 34 export function autoresearchSummaryPathsFor (workDir
: string )
: AutoresearchSummaryPaths {
35 - const base
= path.
join (workDir,
".pi" ,
"autoresearch" );
35 + const base
= path.
join (workDir,
".pi" ,
"tune" );
38 38 jsonlPath: path.
join (base,
"session.jsonl" ),
66 66 function headerSection ()
: string {
68 - "# Autoresearch Compaction Summary" ,
68 + "# Tune Compaction Summary" ,
70 - "The conversation history was discarded; the persisted autoresearch state below is the source of truth." ,
70 + "The conversation history was discarded; the persisted tune state below is the source of truth." ,
71 71 "Continue the experiment loop using only what is included here plus the live tools." ,
extensions/autoresearch/hooks.ts Modified 16 16 const TIMEOUT_MS
= 30_000 ;
17 17 const STDOUT_MAX_BYTES
= 8 * 1024 ;
18 18 const TRUNCATION_MARKER
= "\n…[truncated: hook stdout exceeded 8KB]" ;
19 - const HOOKS_DIR
= ".pi/autoresearch/hooks" ;
19 + const HOOKS_DIR
= ".pi/tune/hooks" ;
21 21 const NEWLINE
= 0x0a ;
22 22 const UTF8_CONT_MASK
= 0xc0 ;
extensions/autoresearch/index.ts Modified 15 15 } from
"@earendil-works/pi-coding-agent" ;
16 16 import { truncateTail, DEFAULT_MAX_LINES, DEFAULT_MAX_BYTES, formatSize }
from "@earendil-works/pi-coding-agent" ;
17 17 import { StringEnum }
from "@earendil-works/pi-ai" ;
18 - import { Text, truncateToWidth, matchesKey, visibleWidth }
from "@earendil-works/pi-tui" ;
23 + type AutocompleteItem,
24 + type AutocompleteSuggestions,
25 + }
from "@earendil-works/pi-tui" ;
19 26 import { Type }
from "typebox" ;
20 27 import * as fs
from "node:fs" ;
21 28 import * as path
from "node:path" ;
50 57 const EXPERIMENT_MAX_LINES
= 10 ;
51 58 const EXPERIMENT_MAX_BYTES
= 4 * 1024 ;
53 - const STATE_DIR
= ".pi/autoresearch" ;
60 + const STATE_DIR
= ".pi/tune" ;
62 + const TUNE_SUBCOMMAND_COMPLETIONS
: AutocompleteItem []
= [
63 + { value:
"off" , label:
"off" , description:
"Turn tune mode off" },
64 + { value:
"clear" , label:
"clear" , description:
"Delete session.jsonl and stop" },
65 + { value:
"export" , label:
"export" , description:
"Open live dashboard" },
130 143 const RunParams
= Type.
Object ({
131 144 command: Type.
String ({
132 - description:
"Shell command to run (e.g. 'node .pi/autoresearch/benchmark.mjs')" ,
145 + description:
"Shell command to run (e.g. 'node .pi/tune/benchmark.mjs')" ,
134 147 timeout_seconds: Type.
Optional (
135 148 Type.
Number ({ description:
"Kill after this many seconds (default: 600)" }),
822 835 return fs.
existsSync (templateFile)
? fs.
readFileSync (templateFile,
"utf-8" )
: "" ;
838 + function tuneArgumentCompletions (argumentPrefix
: string )
: AutocompleteItem []
| null {
839 + const prefix
= argumentPrefix.
trimStart ();
840 + if (
/\s/ .
test (prefix))
return null ;
841 + const matches
= TUNE_SUBCOMMAND_COMPLETIONS.
filter ((item)
=> 842 + item.
value .
startsWith (prefix),
844 + return matches.
length > 0 ? matches
: null ;
847 + function tuneCommandArgumentSuggestions (
849 + cursorLine
: number ,
851 + )
: AutocompleteSuggestions | null {
852 + const line
= lines[cursorLine]
?? "" ;
853 + const beforeCursor
= line.
slice (
0 , cursorCol);
854 + const match
= beforeCursor.
match (
/ ^ \/tune\s + ([ ^ \s] * ) $ / );
855 + if (
! match)
return null ;
856 + const prefix
= match[
1 ]
?? "" ;
857 + const items
= tuneArgumentCompletions (prefix);
858 + return items
? { prefix, items }
: null ;
827 863 export const __test
= {
830 866 isBenchmarkCommand,
831 867 dashboardTemplatePath,
868 + tuneArgumentCompletions,
869 + tuneCommandArgumentSuggestions,
940 978 const notifyAutoResumeLimitReached = (ctx
: ExtensionContext )
: void => {
942 - `Autoresearch auto-resume limit reached (${MAX_AUTORESUME_TURNS} turns)` ,
980 + `Tune auto-resume limit reached (${MAX_AUTORESUME_TURNS} turns)` ,
947 985 const composeResumeMessage = (_ctx
: ExtensionContext )
: string => {
949 987 "Run the next iteration now." ,
950 - "Use the persisted autoresearch state as needed, pick the most promising hypothesis, then call run_experiment + log_experiment." ,
988 + "Use the persisted tune state as needed, pick the most promising hypothesis, then call run_experiment + log_experiment." ,
951 989 BENCHMARK_GUARDRAIL,
1046 1084 const autoresearchHelp = ()
=> 1048 - "Usage: /autoresearch [off|clear|export|<text>]" ,
1086 + "Usage: /tune [off|clear|export|<text>]" ,
1050 - "<text> enters autoresearch mode and starts or resumes the loop." ,
1051 - "off leaves autoresearch mode." ,
1052 - "clear deletes session.jsonl and turns autoresearch mode off." ,
1088 + "<text> enters tune mode and starts or resumes the loop." ,
1089 + "off leaves tune mode." ,
1090 + "clear deletes session.jsonl and turns tune mode off." ,
1053 1091 "export opens a local live dashboard in your browser." ,
1056 - " /autoresearch optimize unit test runtime" ,
1057 - " /autoresearch export" ,
1094 + " /tune optimize unit test runtime" ,
1172 1210 render (width: number): string[] {
1173 1211 const safeWidth
= Math .
max (
1 , width
|| getTuiSize (tui).
width );
1174 1212 const title
= truncateDisplayText (
1175 - `🔬 autoresearch${state. name ? `: ${state. name }` : ""}` ,
1213 + `🔬 tune${state. name ? `: ${state. name }` : ""}` ,
1176 1214 Math .
max (
0 , safeWidth
- 5 ),
1178 1216 const fillLen
= Math .
max (
0 , safeWidth
- 3 - 1 - visibleWidth (title)
- 1 );
1305 1343 pi.
on (
"session_start" ,
async (_e, ctx)
=> reconstructState (ctx));
1344 + pi.
on (
"session_start" ,
async (_e, ctx)
=> {
1345 + if (
typeof ctx.ui.addAutocompleteProvider
!== "function" )
return ;
1346 + ctx.ui.
addAutocompleteProvider ((current)
=> ({
1347 + async getSuggestions (lines, cursorLine, cursorCol, options) {
1348 + const suggestions
= tuneCommandArgumentSuggestions (
1353 + if (suggestions)
return suggestions;
1354 + return current.
getSuggestions (lines, cursorLine, cursorCol, options);
1356 + applyCompletion (lines, cursorLine, cursorCol, item, prefix) {
1357 + return current.
applyCompletion (lines, cursorLine, cursorCol, item, prefix);
1359 + shouldTriggerFileCompletion (lines, cursorLine, cursorCol) {
1360 + if (
tuneCommandArgumentSuggestions (lines, cursorLine, cursorCol))
return true ;
1361 + return current.
shouldTriggerFileCompletion ?.(lines, cursorLine, cursorCol)
?? true ;
1306 1365 pi.
on (
"session_tree" ,
async (_e, ctx)
=> reconstructState (ctx));
1307 1366 pi.
on (
"session_before_switch" ,
async ()
=> clearOverlay ());
1308 1367 pi.
on (
"session_shutdown" ,
async (_e, ctx)
=> {
1363 1422 const hasChecks
= fs.
existsSync (checksPath);
1366 - "\n\n## Autoresearch Mode (ACTIVE)" + 1367 - "\nYou are in autoresearch mode. Optimize the primary metric through an autonomous experiment loop." + 1425 + "\n\n## Tune Mode (ACTIVE)" + 1426 + "\nYou are in tune mode. Optimize the primary metric through an autonomous experiment loop." + 1368 1427 "\nUse init_experiment, run_experiment, and log_experiment tools. NEVER STOP until interrupted." + 1369 1428 `\nExperiment rules: ${mdPath} — read this file at the start of every session and after compaction.` + 1370 1429 "\nWrite promising but deferred optimizations as bullet points to ideas.md — don't let good ideas get lost." + 1397 1456 "Initialize the experiment session. Call once before the first run_experiment." ,
1398 1457 promptSnippet :
"Initialize experiment session (name, metric, unit, direction)." ,
1399 1458 promptGuidelines : [
1400 - "Call init_experiment exactly once at the start of an autoresearch session." ,
1459 + "Call init_experiment exactly once at the start of a tune session." ,
1401 1460 "If session.jsonl already exists with a config, do NOT call init_experiment again." ,
1402 1461 "If the optimization target changes, call init_experiment again to insert a new config header." ,
1480 - text:
`✅ Experiment initialized: "${state. name }"${reinitNote}\nMetric: ${state.metricName} (${state.metricUnit || "unitless"}, ${state.bestDirection} is better)${limitNote}\nState dir: .pi/autoresearch/\nConfig written to session.jsonl. Now run the baseline with run_experiment.` ,
1539 + text:
`✅ Experiment initialized: "${state. name }"${reinitNote}\nMetric: ${state.metricName} (${state.metricUnit || "unitless"}, ${state.bestDirection} is better)${limitNote}\nState dir: .pi/tune/\nConfig written to session.jsonl. Now run the baseline with run_experiment.` ,
1483 1542 details : {
state :
cloneExperimentState (state) },
1544 - text:
`❌ benchmark.mjs exists — you must run it instead of a custom command.\n\nFound: ${benchmarkPath}\nYour command: ${params.command}\n\nUse: run_experiment({ command: "node .pi/autoresearch/benchmark.mjs" })` ,
1603 + text:
`❌ benchmark.mjs exists — you must run it instead of a custom command.\n\nFound: ${benchmarkPath}\nYour command: ${params.command}\n\nUse: run_experiment({ command: "node .pi/tune/benchmark.mjs" })` ,
2197 2256 text
+= `\n⚠️ Failed to write session.jsonl: ${e instanceof Error ? e.message : String (e)}` ;
2201 2260 if (params.
status !== "keep" ) {
2203 2262 const revertScript
= ` 2204 - git checkout -- . ':(exclude,glob).pi/autoresearch/**' ':(exclude,glob).pi/autoresearch/*' 2205 - git clean -fd -e '.pi/autoresearch' -e '.pi/autoresearch/**' 2>/dev/null 2263 + git checkout -- . ':(exclude,glob).pi/tune/**' ':(exclude,glob).pi/tune/*' 2264 + git clean -fd -e '.pi/tune' -e '.pi/tune/**' 2>/dev/null 2207 2266 await pi.
exec (
"bash" , [
"-c" , revertScript], { cwd, timeout:
10000 });
2208 - text
+= `\n📝 Git: reverted changes (${params. status }) — .pi/autoresearch/ preserved` ;
2267 + text
+= `\n📝 Git: reverted changes (${params. status }) — .pi/tune/ preserved` ;
2210 2269 text
+= `\n⚠️ Git revert failed: ${e instanceof Error ? e.message : String (e)}` ;
2346 2405 if (shortcuts.toggleDashboard) {
2347 2406 pi.
registerShortcut (shortcuts.toggleDashboard
as Parameters <
typeof pi.registerShortcut>[
0 ], {
2348 - description:
"Toggle autoresearch dashboard" ,
2407 + description:
"Toggle tune dashboard" ,
2349 2408 handler :
async (ctx)
=> {
2350 2409 const runtime
= getRuntime (ctx);
2351 2410 if (runtime.state.results.
length === 0 ) {
2361 2420 if (shortcuts.fullscreenDashboard) {
2362 2421 pi.
registerShortcut (shortcuts.fullscreenDashboard
as Parameters <
typeof pi.registerShortcut>[
0 ], {
2363 - description:
"Fullscreen autoresearch dashboard" ,
2422 + description:
"Fullscreen tune dashboard" ,
2364 2423 handler :
async (ctx)
=> {
2365 2424 const runtime
= getRuntime (ctx);
2366 2425 const state
= runtime.state;
2416 2475 const out
: string []
= [];
2417 2476 const title
= truncateDisplayText (
2418 - `🔬 autoresearch${state. name ? `: ${state. name }` : ""}` ,
2477 + `🔬 tune${state. name ? `: ${state. name }` : ""}` ,
2419 2478 Math .
max (
0 , safeWidth
- 5 ),
2421 2480 const fillLen
= Math .
max (
2501 2560 let dashboardServerPort
: number | null = null ;
2502 2561 const dashboardSseClients
= new Set <
ServerResponse >();
2504 - const TITLE_PLACEHOLDER
= "__AUTORESEARCH_TITLE__" ;
2505 - const LOGO_PLACEHOLDER
= "__AUTORESEARCH_LOGO__" ;
2563 + const TITLE_PLACEHOLDER
= "__TUNE_TITLE__" ;
2564 + const LOGO_PLACEHOLDER
= "__TUNE_LOGO__" ;
2507 2566 function readTemplate ()
: string {
2508 2567 return readDashboardTemplate ();
2577 2636 const jsonlContent
= fs.
readFileSync (jsonlPath,
"utf-8" ).
trim ();
2578 2637 const sessionName
= extractAutoresearchSessionName (jsonlContent);
2579 2638 const html
= injectDataIntoTemplate (template, sessionName);
2580 - const exportDir
= fs.
mkdtempSync (path.
join (
tmpdir (),
"pi-autoresearch-dashboard-" ));
2639 + const exportDir
= fs.
mkdtempSync (path.
join (
tmpdir (),
"pi-tune-dashboard-" ));
2581 2640 const dest
= path.
join (exportDir,
"index.html" );
2582 2641 fs.
writeFileSync (dest, html);
2645 - pi.
registerCommand (
"autoresearch" , {
2646 - description:
"Start, stop, clear, or resume autoresearch mode" ,
2704 + pi.
registerCommand (
"tune" , {
2705 + description:
"Start, stop, clear, or resume tune mode" ,
2706 + getArgumentCompletions: tuneArgumentCompletions,
2647 2707 handler :
async (args, ctx)
=> {
2648 2708 const runtime
= getRuntime (ctx);
2649 2709 const trimmedArgs
= (args
?? "" ).
trim ();
2669 2729 if (wasRunning) ctx.
abort ();
2672 - ? "Autoresearch mode OFF — aborting current run" 2673 - : "Autoresearch mode OFF" ,
2732 + ? "Tune OFF — aborting current run" 2697 2757 if (fs.
existsSync (jsonlPath)) {
2699 2759 fs.
unlinkSync (jsonlPath);
2700 - ctx.ui.
notify (
"Deleted session.jsonl and turned autoresearch OFF" ,
"info" );
2760 + ctx.ui.
notify (
"Deleted session.jsonl and turned tune OFF" ,
"info" );
2701 2761 }
catch (error) {
2703 2763 `Failed to delete session.jsonl: ${error instanceof Error ? error.message : String (error)}` ,
2708 - ctx.ui.
notify (
"No session.jsonl found. Autoresearch OFF" ,
"info" );
2768 + ctx.ui.
notify (
"No session.jsonl found. Tune OFF" ,
"info" );
2713 2773 if (runtime.autoresearchMode) {
2714 - ctx.ui.
notify (
"Already active — use '/autoresearch off' to stop" ,
"info" );
2774 + ctx.ui.
notify (
"Already active — use '/tune off' to stop" ,
"info" );
2721 2781 const rulesLoaded
= hasAutoresearchRules (ctx);
2722 2782 const kickoff
= rulesLoaded
2723 - ? `Autoresearch mode active. ${trimmedArgs} ${BENCHMARK_GUARDRAIL}` 2724 - : `Start autoresearch: ${trimmedArgs} ${BENCHMARK_GUARDRAIL}` ;
2783 + ? `Tune active. ${trimmedArgs} ${BENCHMARK_GUARDRAIL}` 2784 + : `Start tune: ${trimmedArgs} ${BENCHMARK_GUARDRAIL}` ;
2728 - ? "Autoresearch ON — rules loaded from session.md" 2729 - : "Autoresearch ON — no session.md found, setting up" ,
2788 + ? "Tune started — resumed from session.md" 2789 + : "Tune started — setting up experiment loop" ,
extensions/autoresearch/jsonl.ts Modified 183 183 export function extractAutoresearchSessionName (jsonlContent
: string )
: string {
184 - return firstConfigEntry (jsonlContent)?.
name || "Autoresearch" ;
184 + return firstConfigEntry (jsonlContent)?.
name || "Tune" ;
187 187 export function reconstructJsonlState (jsonlContent
: string )
: ReconstructedJsonlState {
extensions/autoresearch/shortcuts.ts Modified 14 14 export const DEFAULT_TOGGLE_DASHBOARD_SHORTCUT
= "ctrl+shift+t" ;
15 15 export const DEFAULT_FULLSCREEN_DASHBOARD_SHORTCUT
= "ctrl+shift+f" ;
17 - const CONFIG_FILE_NAME
= "autoresearch.json" ;
17 + const CONFIG_FILE_NAME
= "tune.json" ;
64 64 function warnUsingDefaults (reason
: "Could not read" | "Invalid" , configPath
: string )
: void {
66 - `${reason} autoresearch config at ${configPath}; using default shortcuts.` ,
66 + `${reason} tune config at ${configPath}; using default shortcuts.` ,