Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n regression=$(grep -o '\"regression_verdict\"[[:space:]]*:[[:space:]]*\"[^\"]*\"' \"$state_file\" \\\n | grep -o '\"[^\"]*\"

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

| tr -d '\"')\n gaps=$(grep -o '\"untested_gaps\"[[:space:]]*:[[:space:]]*[0-9]*' \"$state_file\" \\\n | grep -o '[0-9]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n archetype=$(grep -o '\"archetype\"[[:space:]]*:[[:space:]]*\"[^\"]*\"' \"$state_file\" \\\n | grep -o '\"[^\"]*\"

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

| tr -d '\"')\n\n # Optional: pending_verify gates an independent acceptance check before DONE/ship.\n # Absent (or false) → routing is identical to prior behavior.\n local pending\n pending=$(grep -o '\"pending_verify\"[[:space:]]*:[[:space:]]*[a-z]*' \"$state_file\" \\\n | grep -o '[a-z]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n\n # Guard: missing required fields\n if [[ -z \"$errors\" || -z \"$regression\" || -z \"$gaps\" ]]; then\n echo \"ERROR: malformed state file\" >&2; return 2\n fi\n\n if [[ \"$errors\" -gt 0 ]]; then\n echo \"fix\"; return 0\n fi\n\n if [[ \"$regression\" == \"UNSTABLE\" ]]; then\n echo \"regression\"; return 0\n fi\n\n if [[ \"$gaps\" -gt 0 ]]; then\n echo \"debug\"; return 0\n fi\n\n # Gaps clear but an accepted high-impact change still needs a fresh, independent\n # acceptance check (separate from the signal used to choose it) → verify first.\n if [[ \"$pending\" == \"true\" ]]; then\n echo \"verify\"; return 0\n fi\n\n # All clear: ship if archetype has ship in the pipeline, else DONE\n if [[ \"$archetype\" == \"ship-ready\" ]]; then\n echo \"ship\"; return 0\n fi\n\n echo \"DONE\"\n}\n\n# ---------------------------------------------------------------------------\n# units: compute Units-remaining scalar from a results JSON file.\n# Formula: failing_tests + open_hard_regressions + (metric_delta / metric_target)\n# Prints \"unknown\" and exits 2 when inputs are missing or uncomputable.\n# ---------------------------------------------------------------------------\nunits() {\n local results_file=\"${1:?usage: units \u003cresults.json>}\"\n if [[ ! -f \"$results_file\" ]]; then\n echo \"unknown\"; return 2\n fi\n\n local ft regressions delta target\n ft=$(grep -o '\"failing_tests\"[[:space:]]*:[[:space:]]*[0-9.]*' \"$results_file\" \\\n | grep -o '[0-9.]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n regressions=$(grep -o '\"open_hard_regressions\"[[:space:]]*:[[:space:]]*[0-9.]*' \"$results_file\" \\\n | grep -o '[0-9.]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n delta=$(grep -o '\"metric_delta\"[[:space:]]*:[[:space:]]*[0-9.]*' \"$results_file\" \\\n | grep -o '[0-9.]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n target=$(grep -o '\"metric_target\"[[:space:]]*:[[:space:]]*[0-9.]*' \"$results_file\" \\\n | grep -o '[0-9.]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n\n if [[ -z \"$ft\" || -z \"$regressions\" || -z \"$delta\" || -z \"$target\" ]]; then\n echo \"unknown\"; return 2\n fi\n\n # Integer check: metric_target must be non-zero to avoid divide-by-zero\n if awk -v t=\"$target\" 'BEGIN { exit !(t + 0 == 0) }'; then\n echo \"unknown\"; return 2\n fi\n\n # awk handles floating point; strip trailing .0 for clean integer output\n awk -v ft=\"$ft\" -v r=\"$regressions\" -v d=\"$delta\" -v t=\"$target\" '\n BEGIN {\n val = ft + r + (d / t)\n # Strip unnecessary trailing zeros (e.g. 4.500 → 4.5, 0.000 → 0)\n if (val == int(val)) printf \"%d\\n\", val\n else printf \"%g\\n\", val\n }\n '\n}\n\n# ---------------------------------------------------------------------------\n# plateau: read state.units_remaining; determine if progress has stalled.\n# Skips interleaved \"unknown\" cycles; N=5 consecutive trailing unknowns = BLOCKED.\n# Exit 0 = plateau (no net progress); exit 1 = still improving; exit 3 = BLOCKED.\n# ---------------------------------------------------------------------------\nplateau() {\n local state_file=\"${1:?usage: plateau \u003cstate.json>}\"\n\n node - \"$state_file\" \u003c\u003c'NODE'\nconst fs = require('fs');\nconst n = 5;\nconst blocked = () => { console.log('BLOCKED'); process.exit(3); };\nlet history;\ntry {\n const state = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));\n history = state.units_remaining;\n if (!Array.isArray(history) || history.some(value =>\n value !== 'unknown' && (typeof value !== 'number' || !Number.isFinite(value) || value \u003c 0))) {\n blocked();\n }\n} catch {\n blocked();\n}\n\nlet trailingUnknown = 0;\nfor (let i = history.length - 1; i >= 0 && history[i] === 'unknown'; i--) trailingUnknown++;\nconst values = history.filter(value => value !== 'unknown');\n// An uncomputable runner is BLOCKED; unknown cycles never count as zero progress.\nif (trailingUnknown >= n || values.length === 0) blocked();\nif (values.length \u003c n) process.exit(1);\n// Lower is better. Oscillation with no net improvement is a plateau too.\nprocess.exit(values[values.length - 1] \u003c values[values.length - n] ? 1 : 0);\nNODE\n}\n\n# ---------------------------------------------------------------------------\n# screen-cmd: safety gate for shell strings before execution.\n# Prints \"ok\" / \"refuse\". Database hosts other than localhost, 127.0.0.1 or a\n# single-label name that starts with a letter need a _test or _ci dbname suffix.\n# Bare substring \"test\" inside words like \"latest\" or \"precision\" must NOT qualify.\n# ---------------------------------------------------------------------------\nscreen-cmd() {\n local cmd=\"${1:?usage: screen-cmd \u003cshell-string>}\"\n # A control byte (other than tab and newline) can confuse the readers below, and a\n # backslash before a newline joins two lines into one word (r\\\u003cnewline>m is rm).\n # Both are refused as a whole kind.\n if printf '%s' \"$cmd\" | tr -d '\\t\\n' | LC_ALL=C grep -q '[[:cntrl:]]' \\\n || [[ \"$cmd\" == *\\\\

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\n'* ]]; then\n echo \"refuse\"; return 1\n fi\n # The shell drops quotes and backslashes before it runs a name, so 'rm' and \\rm are rm.\n local bare=${cmd//[\\\"\\'\\\\]/}\n # $IFS and brace lists ({rm,-rf,/}) turn into spaces when bash runs them.\n bare=${bare//\\$\\{IFS\\}/ }\n bare=${bare//\\$IFS/ }\n bare=${bare//[\\{\\},]/ }\n\n # This check cannot expand variables, substitutions or brace lists, and each one can\n # build a name (${X}m, $X, r``m, `printf rm`,

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\x72m', r{m,}). So it refuses the whole\n # kind: any backtick, and any $ outside single quotes unless a closing double quote, a\n # space or the line end follows it (grep \"ok$\" is fine). A brace list outside quotes is\n # refused too. The scan below reads quotes the way bash does: a backslash escapes the\n # next character, and a single quote inside double quotes is just a character.\n # $\"...\" is a quoted string to bash, so it is marked like a backtick and refused.\n # Each quoted part is also kept (joined by \\002) so a script passed to a nested shell\n # can be checked on its own.\n local scan live unquoted parts\n scan=$(printf '%s' \"$cmd\" | awk -v sq=\"'\" -v dq='\"' -v bs='\\\\' 'BEGIN { RS = \"\\001\" } {\n q = \"\"; a = \"\"; b = \"\"; part = \"\"; parts = \"\"\n for (i = 1; i \u003c= length($0); i++) {\n c = substr($0, i, 1)\n if (q == sq) { if (c == sq) { q = \"\"; a = a c; b = b c; parts = parts part \"\\002\"; part = \"\" } else part = part c; continue }\n if (c == bs) { i++; a = a \"_\"; if (q == \"\") b = b \"_\"; else part = part c substr($0, i, 1); continue }\n if (q == dq) { a = a c; if (c == dq) { q = \"\"; b = b c; parts = parts part \"\\002\"; part = \"\" } else part = part c; continue }\n if (c == \"$\" && substr($0, i + 1, 1) == dq) a = a \"`\"\n if (c == sq || c == dq) q = c\n a = a c; b = b c\n }\n printf \"%s\\001%s\\001%s\", a, b, parts part\n }')\n live=${scan%%

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\001'*}\n unquoted=${scan#*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\001'}\n parts=${unquoted#*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\001'}\n unquoted=${unquoted%%

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\001'*}\n if printf '%s' \"$live\" | grep -qE '`|\\$[^\"[:space:]]' \\\n || printf '%s' \"$unquoted\" | grep -qE '\\{[^[:space:]{}]*(,|\\.\\.)[^[:space:]{}]*\\}'; then\n echo \"refuse\"; return 1\n fi\n\n # A glob in a command name (r?, /bin/r[m], sudo r*) can match any program, so a glob\n # in the first word of a command, after assignments, reserved words, flags and\n # numbers, is refused. After a launcher, every later word is checked, because an\n # option value (sudo -u root) can come before the name. Globs in arguments\n # (ls *.txt) and the test commands [ and [[ stay fine.\n # Every line is read, and a redirect target (>x, 2>/dev/null) is dropped first so it\n # cannot stand in for the command name.\n if printf '%s' \"$unquoted\" | awk '{\n line = $0; gsub(/[0-9]*[\u003c>]+[&|]?[[:space:]]*[^[:space:];&|(){}\u003c>]*/, \" \", line)\n n = split(line, segs, /[;&|(){}\u003c>]/)\n for (s = 1; s \u003c= n; s++) {\n w = split(segs[s], words, /[[:space:]]+/)\n launched = 0\n for (k = 1; k \u003c= w; k++) {\n x = words[k]\n if (x == \"\" || x ~ /^[A-Za-z_][A-Za-z0-9_]*=/ || x ~ /^-/ || x ~ /^[0-9]+$/) continue\n if (x ~ /^(if|then|else|elif|do|while|until|!)$/) continue\n y = x; sub(/^[^[:space:]]*[\\/]/, \"\", y)\n if (y ~ /^(sudo|doas|env|exec|command|builtin|nohup|time|nice|ionice|timeout|xargs|stdbuf|chrt|taskset|eval)$/) { launched = 1; continue }\n if (x == \"[\" || x == \"[[\") break\n if (x ~ /[*?[]/) found = 1\n if (!launched) break\n }\n }\n }\n END { exit !found }'; then\n echo \"refuse\"; return 1\n fi\n\n # A shell or eval runs its quoted script as a new command, so each quoted part is\n # screened on its own too: bash -c 'X=rm; $X -rf /' and eval 'r? -rf /' are seen.\n # The outer shell drops the backslash in \\$ and \\`, so the inner script sees a live\n # expansion; those are refused outright when a nested shell is present.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\u003c>])([^[:space:];&|(){`\u003c>]*/)?(eval|sh|bash|zsh|dash|ksh|fish|source|su)([[:space:];&|()\u003c>]|$)' \\\n || printf '%s' \"$bare\" | grep -qE '(^|[;&|(){`])[[:space:]]*\\.[[:space:]]'; then\n if [[ \"$cmd\" == *'\\

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

* || \"$cmd\" == *'\\`'* ]]; then echo \"refuse\"; return 1; fi\n local part\n while IFS= read -r -d

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\002' part; do\n [[ -n \"${part//[[:space:]]/}\" ]] || continue\n screen-cmd \"$part\" >/dev/null || { echo \"refuse\"; return 1; }\n done \u003c\u003c\u003c \"$parts\"

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

\\002'\n fi\n\n # env -S splits one argument into a new command line that the matchers cannot read.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\u003c>])([^[:space:];&|(){`\u003c>]*/)?env([[:space:]]+[^[:space:];&|()\u003c>]+)*[[:space:]]+(-[a-zA-Z]*S|--split-string)'; then\n echo \"refuse\"; return 1\n fi\n\n # Each command matcher below starts at a space, ; & | ( ) { ` $ \u003c or >, so `true;rm -rf /`\n # and `$(rm -rf ~)` are seen too. Flags are read from $bare, so rm \"-rf\" / is too.\n # rm with recursive AND force, in any flag arrangement: bundled (-rf/-Rf/-fr),\n # separate (-r -f), or long (--recursive --force). Both flags must be present.\n # The optional path prefix catches path-qualified invocations (/bin/rm, ./rm,\n # /usr/local/bin/rm) that a bare command-name anchor would miss.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?rm([[:space:];&|()\u003c>]|$)'; then\n local rm_rec=0 rm_force=0\n printf '%s' \"$bare\" | grep -qE -- '(^|[[:space:]])-[a-zA-Z]*[rR]|(^|[[:space:]])--r(e(c(u(r(s(i(ve?)?)?)?)?)?)?)?([^[:alnum:]_-]|$)' && rm_rec=1\n printf '%s' \"$bare\" | grep -qE -- '(^|[[:space:]])-[a-zA-Z]*[fF]|(^|[[:space:]])--f(o(r(ce?)?)?)?([^[:alnum:]_-]|$)' && rm_force=1\n if [[ \"$rm_rec\" -eq 1 && \"$rm_force\" -eq 1 ]]; then\n echo \"refuse\"; return 1\n fi\n fi\n\n # curl/wget piped to an interpreter (sh/bash/zsh/dash/fish/ksh/python/perl/ruby/\n # node/php), including a path-qualified one (| /bin/bash). Enumerated interpreters\n # rather than \"refuse any curl pipe\" so a legitimate derived predicate that pipes\n # curl output to a parser (jq/grep/awk) is not falsely refused.\n if printf '%s' \"$bare\" | grep -qE '(curl|wget)[^|]*\\|[[:space:]]*([^[:space:]]*/)?(sh|bash|zsh|dash|fish|ksh|python[0-9.]*|perl|ruby|node|php)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # curl/wget piped through a launcher (sudo, env, exec, ...) into an interpreter.\n if printf '%s' \"$bare\" | grep -qE '(curl|wget)[^|]*\\|[[:space:]]*(sudo|doas|env|exec|command|nohup|time)([[:space:]]+[^[:space:]|]+)*[[:space:]]+([^[:space:]]*/)?(sh|bash|zsh|dash|fish|ksh|python[0-9.]*|perl|ruby|node|php)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # A remote payload run without a pipe: bash \u003c(curl ...), source \u003c(curl ...),\n # bash -c \"$(curl ...)\", eval \"$(curl ...)\".\n if printf '%s' \"$bare\" | grep -qE '((sh|bash|zsh|dash|fish|ksh|python[0-9.]*|perl|ruby|node|php)|source|\\.)[[:space:]]+(\u003c[[:space:]]*)?\u003c\\([[:space:]]*(curl|wget)'; then\n echo \"refuse\"; return 1\n fi\n if printf '%s' \"$bare\" | grep -qE '((sh|bash|zsh|dash|fish|ksh|python[0-9.]*|perl|ruby|node|php)([[:space:]]+([^[:space:];&|]|[\u003c>]&|&>)+)*[[:space:]]+-[a-zA-Z]*c[a-zA-Z]*|eval)[[:space:]]+[\"'\"'\"']?(\\$\\(|`)[[:space:]]*(curl|wget)'; then\n echo \"refuse\"; return 1\n fi\n\n # curl/wget routed through xargs into an interpreter. The xargs wrapper sidesteps the\n # direct pipe matcher above, so a remote payload still reaches a shell.\n if printf '%s' \"$bare\" | grep -qE '(curl|wget)[^|]*\\|.*xargs.*[[:space:]]([^[:space:]]*/)?(sh|bash|zsh|dash|ksh|python[0-9.]*|perl|ruby|node|php)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # Output piped to netcat exfiltrates data off-host.\n if printf '%s' \"$bare\" | grep -qE '\\|[[:space:]]*([^[:space:]]*/)?(nc|ncat|netcat)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # Raw block-device write — dd target or shell redirect onto a disk device wipes it.\n # Scoped to real device families (incl. SD/eMMC mmcblk, mdadm md, device-mapper dm-)\n # so dd/redirect to /dev/null or a regular file stays ok.\n if printf '%s' \"$bare\" | grep -qE '(of=|>[[:space:]]*)/dev/(sd|hd|vd|nvme|disk|mapper|loop|xvd|mmcblk|md|dm-)'; then\n echo \"refuse\"; return 1\n fi\n\n # Filesystem format destroys everything on a partition. Optional path prefix catches a\n # path-qualified invocation (/sbin/mkfs.ext4) that a bare-name anchor would miss.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?(mkfs|mke2fs)'; then\n echo \"refuse\"; return 1\n fi\n\n # find ... -delete mass-removes matched files. Both tokens required so a plain find\n # search (no -delete) is not refused; optional path prefix catches /usr/bin/find.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?find([[:space:];&|()\u003c>]|$)' \\\n && printf '%s' \"$bare\" | grep -qE '[[:space:]]-delete([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # shred overwrites then unlinks — irrecoverable.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?shred([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # truncate to zero size destroys file contents in place. Non-zero sizes are allowed.\n # Optional path prefix catches /usr/bin/truncate; size matcher covers -s 0, -s0,\n # --size 0, and --size=0.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?truncate([[:space:];&|()\u003c>]|$)' \\\n && printf '%s' \"$bare\" | grep -qE '(-s[[:space:]]*0|--size[[:space:]]*=?[[:space:]]*0)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # Recursive chmod to a zero mode locks an entire tree out of access. Scoped to the\n # zero lock-out (000/00/0 octal short forms) so ordinary recursive permission changes\n # are not refused; optional path prefix catches /bin/chmod.\n if printf '%s' \"$bare\" | grep -qE '(^|[[:space:];&|(){`\\\\$\u003c>])([^[:space:];&|(){`\u003c>]*/)?chmod([[:space:];&|()\u003c>]|$)' \\\n && printf '%s' \"$bare\" | grep -qE '(-R|--recursive)([[:space:];&|()\u003c>]|$)' \\\n && printf '%s' \"$bare\" | grep -qE '(^|[[:space:]])(000|00|0)([[:space:];&|()\u003c>]|$)'; then\n echo \"refuse\"; return 1\n fi\n\n # Fork bomb pattern\n if printf '%s' \"$cmd\" | grep -qF ':(){ :|:'; then\n echo \"refuse\"; return 1\n fi\n if printf '%s' \"$cmd\" | grep -qE ':\\(\\)\\{'; then\n echo \"refuse\"; return 1\n fi\n\n # AWS credential patterns (key IDs start with AKIA, secret keys are 40-char base64)\n if printf '%s' \"$cmd\" | grep -qE 'AKIA[0-9A-Z]{16}'; then\n echo \"refuse\"; return 1\n fi\n\n # PASSWORD= credential pattern\n if printf '%s' \"$cmd\" | grep -qE 'PASSWORD[[:space:]]*='; then\n echo \"refuse\"; return 1\n fi\n\n # Private key headers — pattern starts with dashes so pass -- to avoid flag misparse\n if printf '%s' \"$cmd\" | grep -qE -- 'BEGIN (RSA |EC |OPENSSH |DSA )?PRIVATE KEY'; then\n echo \"refuse\"; return 1\n fi\n\n # Database URL safety: extract host and dbname from postgres:// or postgresql:// URIs\n # Pattern: postgres(ql)://user:pass@HOST/DBNAME or postgres(ql)://HOST/DBNAME\n # A quote or backslash inside the scheme ('postgres'ql://) still gives the shell a URL,\n # so every URL the shell sees must also appear as plain text here.\n local seen_urls plain_urls\n seen_urls=$(printf '%s' \"$bare\" | grep -oE 'postgres(ql)?://' | wc -l)\n plain_urls=$(printf '%s' \"$cmd\" | grep -oE 'postgres(ql)?://' | wc -l)\n if [[ \"$seen_urls\" -ne \"$plain_urls\" ]]; then\n echo \"refuse\"; return 1\n fi\n if printf '%s' \"$cmd\" | grep -qE 'postgres(ql)?://'; then\n # Check every URL: one safe URL must not vouch for a second, real one.\n # A URL ends at whitespace, quotes or shell punctuation, so `A=url1;B=url2` is two URLs.\n # Each URL is read twice: cut at the first punctuation, and with the user:pass part kept\n # whole. `p&ss@prod` and `prod;x@localhost` each fail one of the two readings.\n # Known limit: a dotted user name with & in the password is refused too; run it by hand.\n # Refuse what this check cannot read safely: encoded text (%), several hosts (,),\n # a backslash (the shell drops it, so ho\\st= is host=), and query keys that move\n # the connection (host, hostaddr, dbname, service).\n if printf '%s' \"$cmd\" | grep -qE 'postgres(ql)?://[^[:space:];|\u003c>()]*[%,#\\\\]' \\\n || printf '%s' \"$cmd\" | grep -qiE 'postgres(ql)?://[^[:space:];|\u003c>()]*[?&](host|hostaddr|dbname|service)='; then\n echo \"refuse\"; return 1\n fi\n # A URL with nothing after the scheme leaves the host to PGHOST or -h, and a quoted\n # URL with a space in it (a password such as \"p ss\") is cut before its real host.\n if printf '%s' \"$cmd\" | grep -qE 'postgres(ql)?://([[:space:];&|\u003c>()\"'\"'\"'`]|$)' \\\n || printf '%s' \"$cmd\" | grep -qE '[\"'\"'\"']postgres(ql)?://[^\"'\"'\"']*[[:space:]]'; then\n echo \"refuse\"; return 1\n fi\n # A quote inside the URL (not just around it) hides where the host really ends.\n if printf '%s' \"$cmd\" | grep -qE 'postgres(ql)?://[^[:space:];&|\u003c>()]*[\"'\"'\"'`][^[:space:];&|\u003c>()\"'\"'\"'`]'; then\n echo \"refuse\"; return 1\n fi\n local url rest authority db_path db_host db_name host_ok\n while IFS= read -r url; do\n # Split scheme://[user@]host[:port][/dbname][?query]; the query never feeds dbname.\n rest=${url#*://}\n authority=${rest%%/*}\n # Two @ signs leave it unclear which part is the host.\n if [[ \"$authority\" == *@*@* ]]; then echo \"refuse\"; return 1; fi\n # Some URL parsers end the host part at ? or #, so prod?@localhost may mean prod.\n if [[ \"$authority\" == *[?#]*@* ]]; then echo \"refuse\"; return 1; fi\n db_host=${authority##*@}\n # A ? after the host starts the query, so any later / is not a dbname path.\n if [[ \"$db_host\" == *\\?* ]]; then db_path=\"\"; else db_path=${rest:${#authority}}; fi\n db_host=${db_host%%[:?]*}\n db_path=${db_path%%\\?*}\n db_name=${db_path#/}\n # Shell expansion in the name ($_test is an empty variable) hides the real name.\n if [[ \"$db_name\" == *[\\$\\{\\}\\*\\[~]* ]]; then echo \"refuse\"; return 1; fi\n\n # Allowed hosts: localhost, 127.0.0.1, or a plain single-label name that starts\n # with a letter, such as a container. Anything else is remote: IPv6, a number\n # (2130706433 and 0x7f000001 are IPv4 addresses), and an empty host, which psql\n # fills from PGHOST or -h.\n host_ok=0\n if [[ \"$db_host\" == \"localhost\" || \"$db_host\" == \"127.0.0.1\" ]]; then\n host_ok=1\n elif [[ \"$db_host\" =~ ^[A-Za-z][A-Za-z0-9_-]*$ ]]; then\n host_ok=1\n fi\n\n # Non-allowlisted host: dbname must end with _test or _ci (anchored suffix, not substring)\n if [[ \"$host_ok\" -eq 0 ]] && ! printf '%s' \"$db_name\" | grep -qE '_test$|_ci

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

; then\n echo \"refuse\"; return 1\n fi\n done \u003c \u003c(printf '%s' \"$cmd\" | grep -oE 'postgres(ql)?://[^[:space:];&|\u003c>()\"'\"'\"'`]+'\n printf '%s' \"$cmd\" | grep -oE 'postgres(ql)?://([^[:space:]/@]*@)?[^[:space:];&|\u003c>()\"'\"'\"'`]+')\n fi\n\n echo \"ok\"; return 0\n}\n\n# ---------------------------------------------------------------------------\n# verdict: synthesize a convergence verdict from state JSON.\n# Reads: units, plateau, ceiling, fork_rounds_since_progress fields. Prints\n# verdict + ship-gate line. A plateau answers FORK (run a fork-and-flush round)\n# until FORK_ROUNDS_BEFORE_PLATEAU rounds have run since the last progress,\n# then PLATEAU. A reached ceiling is checked first and always answers CEILING.\n# Exit 0 = CONVERGED; exit 1 = not converged; exit 2 = error.\n# ---------------------------------------------------------------------------\nverdict() {\n local state_file=\"${1:?usage: verdict \u003cstate.json>}\"\n if [[ ! -f \"$state_file\" ]]; then\n echo \"BLOCKED\"; echo \"ship=no\"; return 2\n fi\n\n local units_val plateau_val ceiling_val fork_rounds\n units_val=$(grep -o '\"units\"[[:space:]]*:[[:space:]]*[0-9.]*' \"$state_file\" \\\n | grep -o '[0-9.]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n plateau_val=$(grep -o '\"plateau\"[[:space:]]*:[[:space:]]*[a-z]*' \"$state_file\" \\\n | grep -o '[a-z]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n ceiling_val=$(grep -o '\"ceiling\"[[:space:]]*:[[:space:]]*[a-z]*' \"$state_file\" \\\n | grep -o '[a-z]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n fork_rounds=$(grep -o '\"fork_rounds_since_progress\"[[:space:]]*:[[:space:]]*\"\\{0,1\\}[0-9][0-9]*' \"$state_file\" \\\n | grep -o '[0-9][0-9]*

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…

)\n\n if [[ -z \"$units_val\" ]]; then\n echo \"BLOCKED\"; echo \"ship=no\"; return 2\n fi\n\n if [[ \"$ceiling_val\" == \"true\" ]]; then\n echo \"CEILING\"; echo \"ship=no\"; return 1\n fi\n\n if [[ \"$plateau_val\" == \"true\" ]]; then\n if (( ${fork_rounds:-0} \u003c FORK_ROUNDS_BEFORE_PLATEAU )); then\n echo \"FORK\"; echo \"ship=no\"; return 1\n fi\n echo \"PLATEAU\"; echo \"ship=no\"; return 1\n fi\n\n # units==0 with no plateau/ceiling → converged\n if awk -v u=\"$units_val\" 'BEGIN { exit (u == 0 ? 0 : 1) }'; then\n echo \"CONVERGED\"; echo \"ship=yes\"; return 0\n fi\n\n # units > 0, no plateau/ceiling signal yet → still running\n echo \"BLOCKED\"; echo \"ship=no\"; return 1\n}\n\n# ---------------------------------------------------------------------------\n# validate-state: schema gate for orchestrator-state.json. The ledger is the\n# loop's evidence trail; a malformed one must not be trusted to route from.\n# Prints \"valid\" exit 0 | \"invalid\" exit 2. Node is a checked installation\n# prerequisite, so use its JSON parser rather than approximating JSON with grep.\n# ---------------------------------------------------------------------------\nvalidate-state() {\n local state_file=\"${1:?usage: validate-state \u003cstate.json>}\"\n if [[ ! -f \"$state_file\" ]]; then\n echo \"invalid\"; return 2\n fi\n\n if ! node -e '\n const fs = require(\"fs\");\n const state = JSON.parse(fs.readFileSync(process.argv[1], \"utf8\"));\n const strings = [\"goal\", \"archetype\", \"predicate\", \"terminal_choice\"];\n if (!strings.every((key) => typeof state[key] === \"string\" && state[key].length > 0)) process.exit(1);\n if (!Number.isInteger(state.cycle) || state.cycle \u003c 0) process.exit(1);\n if (!Array.isArray(state.units_remaining) || !Array.isArray(state.pipeline_log)) process.exit(1);\n ' \"$state_file\" 2>/dev/null; then\n echo \"invalid\"; return 2\n fi\n\n echo \"valid\"; return 0\n}\n\n# ---------------------------------------------------------------------------\n# screen-state-predicate: extract the pinned predicate from a persisted state\n# file and re-run it through screen-cmd. Persisted commands are never trusted —\n# a poisoned state file must not re-enter the loop with an unscreened command.\n# Delegates the verdict (ok/refuse + exit) to screen-cmd; \"invalid\" exit 2 when\n# the state has no pinned predicate.\n# ---------------------------------------------------------------------------\nscreen-state-predicate() {\n local state_file=\"${1:?usage: screen-state-predicate \u003cstate.json>}\"\n if [[ ! -f \"$state_file\" ]]; then\n echo \"invalid\"; return 2\n fi\n\n local pred\n if ! pred=$(node -e '\n const fs = require(\"fs\");\n const state = JSON.parse(fs.readFileSync(process.argv[1], \"utf8\"));\n if (typeof state.predicate !== \"string\" || state.predicate.length === 0 || state.predicate.includes(\"\\0\")) process.exit(1);\n process.stdout.write(state.predicate);\n ' \"$state_file\" 2>/dev/null); then\n echo \"invalid\"; return 2\n fi\n\n screen-cmd \"$pred\"\n}\n\ncase \"${1:-}\" in\n classify) shift; classify \"$@\" ;;\n next-hop) shift; next-hop \"$@\" ;;\n units) shift; units \"$@\" ;;\n plateau) shift; plateau \"$@\" ;;\n screen-cmd) shift; screen-cmd \"$@\" ;;\n verdict) shift; verdict \"$@\" ;;\n validate-state) shift; validate-state \"$@\" ;;\n screen-state-predicate) shift; screen-state-predicate \"$@\" ;;\n *) echo \"usage: $0 {classify|next-hop|units|plateau|screen-cmd|verdict|validate-state|screen-state-predicate}\" >&2; exit 64 ;;\nesac\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":29476,"content_sha256":"1c2cc75f099d4b3e61ac12a9dd512ce97ca1aa7758a49b33643e315af3da79a1"},{"filename":"scripts/score-regression.sh","content":"#!/usr/bin/env bash\n# score-regression.sh — scoring backend for autoresearch:regression\n#\n# rubric [file] → grep-rubric quality score of regression.md → \"SCORE: N\"\n# verdict \u003cresults.tsv> → tiered stability verdict from a results TSV\n#\n# verdict logic:\n# - any HARD row that is a green→red regression (classification=regression-eligible, regressed=true) → UNSTABLE\n# - else weighted SCORE: per-dim worst subscore, weights renormalized over dims that ran,\n# STABLE iff stability_score >= threshold (default 95)\n# - classification in {pre-existing,new-coverage,baseline-unavailable,flaky} never gates\n# - exit 0 STABLE / 1 UNSTABLE / 2 ERROR (CI-usable) · score math → stderr\n#\n# Overridable env: REG_THRESHOLD, REG_W_FLAKINESS, REG_W_PERFORMANCE, REG_W_RESOURCE, REG_W_VISUAL\nset -euo pipefail\n\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" && pwd)\"\nREPO_ROOT=\"$(cd \"$SCRIPT_DIR/..\" && pwd)\"\n\nresolve_default_spec() {\n local candidate\n for candidate in \\\n \"$SCRIPT_DIR/../regression.md\" \\\n \"$SCRIPT_DIR/../../../commands/autoresearch/regression.md\" \\\n \"$SCRIPT_DIR/../../../commands/autoresearch_regression.md\" \\\n \"$SCRIPT_DIR/../../../prompts/autoresearch_regression.md\" \\\n \"$REPO_ROOT/.claude/commands/autoresearch/regression.md\" \\\n \"$REPO_ROOT/claude-plugin/commands/autoresearch/regression.md\"; do\n [[ -f \"$candidate\" ]] && { printf '%s\\n' \"$candidate\"; return; }\n done\n printf '%s\\n' \"$SCRIPT_DIR/../regression.md\"\n}\n\nSPEC_DEFAULT=\"$(resolve_default_spec)\"\n\nREG_THRESHOLD=\"${REG_THRESHOLD:-95}\"\nREG_W_FLAKINESS=\"${REG_W_FLAKINESS:-0.30}\"\nREG_W_PERFORMANCE=\"${REG_W_PERFORMANCE:-0.30}\"\nREG_W_RESOURCE=\"${REG_W_RESOURCE:-0.20}\"\nREG_W_VISUAL=\"${REG_W_VISUAL:-0.20}\"\n\n# ---------------------------------------------------------------------------\n# rubric: grep the protocol spec for required invariants/sections/flags.\n# Each pattern matched = +1. Prints \"SCORE: N\" only.\n# ---------------------------------------------------------------------------\nrubric() {\n local file=\"${1:-$SPEC_DEFAULT}\"\n if [[ ! -f \"$file\" ]]; then echo \"SCORE: 0\"; return 0; fi\n\n local checks=(\n \"classification\"\n \"green.{0,3}red\"\n \"regression.eligible|[^a-z]eligible\"\n \"pre-existing\"\n \"new-coverage\"\n \"baseline.unavailable|BASELINE_UNAVAILABLE\"\n \"functional\"\n \"api-contract\"\n \"data-migration\"\n \"integration-e2e\"\n \"flakiness\"\n \"performance\"\n \"resource\"\n \"visual\"\n \"HARD\"\n \"SCORE\"\n \"worktree\"\n \"--detach|detach\"\n \"submodule\"\n \"baseline.cache|--baseline-cache\"\n \"--select\"\n \"findRelatedTests|nx affected|affected\"\n \"Mann.?Whitney\"\n \"independent.process\"\n \"effect.size|median delta\"\n \"SSIM|maxDiffPixelRatio|pixel.ratio\"\n \"samples\"\n \"noise-band\"\n \"forward-only\"\n \"allowlist\"\n \"fix-cycle|--fix-cycles\"\n \"probe\"\n \"auto-skip\"\n \"--max-runs\"\n \"handoff\"\n \"verdict\"\n \"STABLE\"\n \"UNSTABLE\"\n )\n\n local score=0 pat\n for pat in \"${checks[@]}\"; do\n if grep -qiE -- \"$pat\" \"$file\"; then score=$((score + 1)); fi\n done\n echo \"SCORE: $score\"\n}\n\n# ---------------------------------------------------------------------------\n# verdict: reduce a results TSV to STABLE|UNSTABLE + stability score.\n# ---------------------------------------------------------------------------\nverdict() {\n local tsv=\"${1:?usage: verdict \u003cresults.tsv>}\"\n if [[ ! -f \"$tsv\" ]]; then\n echo \"VERDICT: ERROR\"; echo \"score=0.0\"; echo \"blocking=missing-tsv\"\n return 2\n fi\n\n awk -v FS='\\t' \\\n -v wF=\"$REG_W_FLAKINESS\" -v wP=\"$REG_W_PERFORMANCE\" \\\n -v wR=\"$REG_W_RESOURCE\" -v wV=\"$REG_W_VISUAL\" \\\n -v thr=\"$REG_THRESHOLD\" '\n /^#/ { next } # comment (e.g. metric_direction)\n $1==\"iteration\" { next } # header\n NF != 15 { invalid_schema=1; next }\n {\n dim=$3; tier=$5; cls=$6; regressed=$10; subv=$11+0;\n valid_dim = (dim==\"functional\" || dim==\"api-contract\" || dim==\"data-migration\" || dim==\"integration-e2e\" || dim==\"flakiness\" || dim==\"performance\" || dim==\"resource\" || dim==\"visual-ui\");\n expected_tier = (dim==\"functional\" || dim==\"api-contract\" || dim==\"data-migration\" || dim==\"integration-e2e\") ? \"HARD\" : \"SCORE\";\n if (!valid_dim || tier!=expected_tier || (regressed!=\"true\" && regressed!=\"false\") || $11 !~ /^([0-9]+([.][0-9]+)?|[.][0-9]+)$/ || subv\u003c0 || subv>100) {\n invalid_schema=1;\n next;\n }\n if (cls!=\"regression-eligible\" && cls!=\"pre-existing\" && cls!=\"new-coverage\" && cls!=\"baseline-unavailable\" && cls!=\"flaky\") {\n invalid_classification=cls;\n next;\n }\n if (cls!=\"baseline-unavailable\") {\n nrows++;\n present[dim]=1;\n }\n if (tier==\"HARD\" && regressed==\"true\" && cls==\"regression-eligible\") hardset[dim]=1;\n if (tier==\"SCORE\" && cls!=\"baseline-unavailable\") {\n if (!(dim in dmin) || subv \u003c dmin[dim]) dmin[dim]=subv; # per-dim worst case\n }\n }\n END {\n if (invalid_schema) {\n printf \"VERDICT: ERROR\\n\";\n printf \"score=0.00\\n\";\n printf \"blocking=invalid-schema\\n\";\n exit 2;\n }\n if (invalid_classification!=\"\") {\n printf \"VERDICT: ERROR\\n\";\n printf \"score=0.00\\n\";\n printf \"blocking=invalid-classification\\n\";\n exit 2;\n }\n # No measurable data rows ran at all → nothing to gate on. Must NOT read as a\n # green ship signal: an empty/header-only TSV or all-dims-unavailable run is\n # advisory, not STABLE. Emit BASELINE_UNAVAILABLE + non-zero exit.\n if (nrows==0) {\n printf \"VERDICT: BASELINE_UNAVAILABLE\\n\";\n printf \"score=0.00\\n\";\n printf \"blocking=no-dims-ran\\n\";\n printf \"dims_ran=none\\n\";\n printf \"dims_unavailable=functional,api-contract,data-migration,integration-e2e,flakiness,performance,resource,visual-ui\\n\";\n exit 2;\n }\n\n hb=\"\";\n for (d in hardset) hb = hb (hb==\"\"?\"\":\",\") d;\n\n wt[\"flakiness\"]=wF; wt[\"performance\"]=wP; wt[\"resource\"]=wR; wt[\"visual-ui\"]=wV;\n num=0; den=0;\n for (d in dmin) { w=(d in wt)?wt[d]:0; if (w>0){ num+=w*dmin[d]; den+=w; } }\n score = (den>0) ? num/den : 100;\n\n split(\"functional,api-contract,data-migration,integration-e2e,flakiness,performance,resource,visual-ui\", reg, \",\");\n ran=\"\"; unavail=\"\";\n for (i=1;i\u003c=8;i++){\n if (reg[i] in present) ran = ran (ran==\"\"?\"\":\",\") reg[i];\n else unavail = unavail (unavail==\"\"?\"\":\",\") reg[i];\n }\n\n unstable = (hb!=\"\") || (score \u003c thr);\n verdict = unstable ? \"UNSTABLE\" : \"STABLE\";\n if (hb!=\"\" && score\u003cthr) blocking = hb \",score\";\n else if (hb!=\"\") blocking = hb;\n else if (score\u003cthr) blocking = \"score\";\n else blocking = \"none\";\n\n # Display floors to 2 decimals (never rounds up): a true 94.9999 must print as\n # 94.99 — not 95.00 — so the shown number cannot read >= threshold while UNSTABLE.\n # The gate itself (above) compares full precision.\n disp = int(score*100)/100;\n\n printf \"VERDICT: %s\\n\", verdict;\n printf \"score=%.2f\\n\", disp;\n printf \"blocking=%s\\n\", blocking;\n printf \"dims_ran=%s\\n\", (ran==\"\"?\"none\":ran);\n printf \"dims_unavailable=%s\\n\", (unavail==\"\"?\"none\":unavail);\n\n for (d in dmin) printf \" %-12s subscore=%.2f weight=%s\\n\", d, int(dmin[d]*100)/100, ((d in wt)?wt[d]:\"0\") > \"/dev/stderr\";\n printf \" stability_score=%.2f threshold=%s\\n\", disp, thr > \"/dev/stderr\";\n\n exit (unstable ? 1 : 0);\n }\n ' \"$tsv\"\n}\n\ncase \"${1:-}\" in\n rubric) shift; rubric \"$@\" ;;\n verdict) shift; verdict \"$@\" ;;\n *) echo \"usage: $0 {rubric [file] | verdict \u003cresults.tsv>}\" >&2; exit 64 ;;\nesac\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":7775,"content_sha256":"6845552cc5ff420b8cd12c13c49c85858a3f5f061ffa6c7adff7365e4fc5ee37"},{"filename":"security.md","content":"---\nname: autoresearch:security\ndescription: \"STRIDE + OWASP security audit with red-team adversarial personas\"\nargument-hint: \"[Scope: \u003cglob>] [Focus: \u003carea>] [Iterations: N] [--diff] [--fix] [--fail-on \u003cseverity>] [--evals]\"\ndisable-model-invocation: true\n---\n\nEXECUTE IMMEDIATELY.\n\n## Parse Arguments\n\nExtract from $ARGUMENTS:\n- `Scope:` or `--scope` — file globs to audit\n- `Focus:` — specific area (auth, API, data handling, etc.)\n- `Depth:` or `--depth` — quick (5 iterations), standard (15), deep (30+)\n- `Iterations:` or `--iterations` — default 15. \"unlimited\" for unbounded.\n- `--diff` — delta mode: only audit files changed since last audit\n- `--fix` — after audit, auto-fix Critical/High findings (chains to fix)\n- `--fail-on \u003cseverity>` — exit non-zero if findings at/above threshold (CI gate)\n- `--evals`, `--evals-interval N`, `--chain`, `--\u003csubcommand>`\n\n## Setup (if required context missing)\n\nIf Scope missing and no --diff:\n1. Scan codebase for tech stack, frameworks, API routes\n2. request_user_input (single batch):\n Q1 (Scope): \"What to audit?\" — entire codebase, API + middleware, auth, external-facing\n Q2 (Depth): \"How thorough?\" — quick (5), standard (15), deep (30+), unlimited\n Q3 (Action): \"What to do with findings?\" — report only, report + auto-fix, report + CI gate\nIf all provided → skip.\n\n## Setup Phase (once, before loop)\n\n1. **Reconnaissance** — scan: package.json/requirements.txt (deps), .env.example (secrets), Dockerfile (infra), API route files (attack surface), auth/middleware (trust boundaries), DB schemas (data assets), CI/CD configs (supply chain)\n2. **Asset Identification** — catalog data stores, auth systems, external services, user inputs\n3. **Trust Boundary Mapping** — browser↔server, public↔authenticated, user↔admin, CI↔prod\n4. **STRIDE Threat Model** — generate threats per category. Load `references/security-checklist.md` for checklist.\n5. **Attack Surface Map** — entry points, data flows, abuse paths\n6. **Baseline** — count known issues, initialize coverage tracking\n\nCreate output directory: `autoresearch/security-{YYMMDD}-{HHMM}/`\nWrite: overview.md, threat-model.md, attack-surface-map.md\nTSV header: `# metric_direction: higher_is_better\\niteration\\ttimestamp\\tfinding\\tseverity\\towasp\\tstride\\tevidence\\tfile_line`\n\n## Iteration Loop\n\n### Phase 1: Review\n- Read results TSV + coverage tracking\n- Identify untested attack vectors from threat model\n- Prioritize: untested OWASP categories → untested STRIDE → depth on existing\n\n### Phase 2: Attack\n- Adopt red-team persona for this vector (rotate: Security Adversary, Supply Chain, Insider Threat, Infra Attacker)\n- Deep-dive into relevant code with adversarial mindset\n- Look for: code paths, input handling, auth checks, data flows\n\n### Phase 3: Validate\n- Construct proof: file:line + specific attack scenario\n- Every finding MUST have code evidence — no theoretical fluff\n- Classify severity: Critical/High/Medium/Low/Info\n- Map to OWASP (A01-A10) and STRIDE (S/T/R/I/D/E)\n\n### Phase 4: Log\n- Append finding to TSV\n- Update coverage tracking\n- Print coverage every 5 iterations:\n `OWASP: [A01✓ A02✓ A03✗ ...] X/10 | STRIDE: [S✓ T✓ R✗ ...] Y/6 | Score: Z`\n\n### Composite Metric\n`score = (owasp_tested/10)*50 + (stride_tested/6)*30 + min(findings, 20)`\n\n### Eval Checkpoint\nIf --evals: check if current_iteration % interval == 0 → run checkpoint.\n\n### Bounded Check\nIf bounded: current_iteration >= max_iterations → exit loop.\n\n## After Loop\n\n1. Write `findings.md` (severity-ranked)\n2. Write `owasp-coverage.md`\n3. Write `recommendations.md`\n4. If `--fix` → chain to fix with Critical/High findings\n5. If `--fail-on` → check findings against threshold, exit non-zero if exceeded\n\n## Summary\n\nPrint: total findings by severity, OWASP coverage X/10, STRIDE coverage Y/6, composite score.\n\n## Eval Checkpoint (--evals flag)\n\nIf --evals present:\n- Compute interval: floor(max_iterations / 3), min 1. Fixed 10 if unbounded. Override: --evals-interval N.\n- Every {interval} iterations, analyze results TSV.\n- Print: `--- Eval Checkpoint (iterations {X}-{Y}) ---\\nScore: {start} → {end} | New findings: {n} | Coverage: OWASP {x}/10, STRIDE {y}/6\\n{recommendation}\\n---`\n- If no new findings 3+ checkpoints → recommend early stop.\n- At loop end → full evals summary to evals-summary.md.\n\n## Chain Handoff\n\nAfter completion, write handoff.json to output directory: version \"2.1.0\", source \"security\", timestamp, status (COMPLETE|USER_INTERRUPT|BOUNDED|ERROR), results_tsv path, findings = all findings with severity + OWASP + STRIDE + file:line, config{scope, focus, depth}.\nInvoke next target in --chain order via the `autoresearch` skill's Subcommand routing. Propagate --evals flag.\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":4778,"content_sha256":"0ac687ff91e5c87082fb8d083685e096138c0a8b6e86b1ae0df0b4efa146c43b"},{"filename":"ship.md","content":"---\nname: autoresearch:ship\ndescription: \"Ship anything through 8 phases: checklist, dry-run, deploy, verify\"\nargument-hint: \"[Target: \u003cwhat>] [--type \u003ctype>] [--dry-run] [--auto] [--force] [--rollback] [--checklist-only] [--monitor N]\"\ndisable-model-invocation: true\n---\n\nEXECUTE IMMEDIATELY.\n\n## Parse Arguments\n\nExtract from $ARGUMENTS:\n- `Target:` or `--target` — what to ship (path, PR, artifact, deployment)\n- `--type \u003ctype>` — override auto-detection: code-pr, code-release, deployment, content, docs, package, config\n- `--dry-run` — validate everything but don't ship\n- `--auto` — auto-approve if no errors found\n- `--force` — skip non-critical items (blockers still enforced)\n- `--rollback` — undo last ship action\n- `--monitor N` — post-ship monitoring for N minutes\n- `--checklist-only` — only generate checklist, don't execute\n- `--chain`, `--\u003csubcommand>`\n\nRemaining text = description of what to ship.\n\n## Setup (if Target or Type unclear)\n\n1. Auto-detect ship type from context:\n - Has uncommitted changes or PR → code-pr\n - Has version bump / changelog → code-release\n - Has Dockerfile / deploy config → deployment\n - Has markdown / content files → content\n - Has package.json version change → package\n2. If still unclear → request_user_input (single batch):\n Q1 (What): \"What are you shipping?\" — code PR, release, deployment, content, docs, package\n Q2 (Target): \"Specific target?\" — current branch, specific PR, specific path\n Q3 (Mode): \"How to ship?\" — full workflow, dry-run only, checklist only\nIf all clear → skip.\n\n## Phase 1: Identify\n\n- Determine ship type (auto-detected or --type override)\n- Identify target artifact(s)\n- Map to domain-specific checklist\n\n## Phase 2: Inventory\n\nGather everything that will be shipped:\n- Files changed (git diff)\n- Dependencies affected\n- Config changes\n- Migration files\n- Breaking changes\n\n## Phase 3: Checklist\n\nGenerate domain-specific checklist:\n\n**Code PR:** tests pass, types check, lint clean, no secrets, PR description, reviewers assigned\n**Release:** version bumped, changelog updated, migration tested, rollback plan\n**Deployment:** env vars set, health checks configured, rollback ready, monitoring active\n**Content:** links valid, images optimized, SEO metadata, spell check\n**Package:** version bumped, README updated, breaking changes documented, CI green\n\nIf `--checklist-only` → output checklist and stop.\n\n## Phase 4: Prepare\n\nExecute pre-ship tasks:\n- Run test suite\n- Run type checker\n- Run linter\n- Check for secrets in diff\n- Validate configs\n- Flag blockers (must-fix) vs warnings (can-ship-with)\n\nIf blockers found → STOP, report blockers, ask user to fix.\n\n## Phase 5: Dry-Run\n\nIf `--dry-run` or always before actual ship:\n- Simulate the ship action without executing\n- Report what WOULD happen\n- If `--dry-run` → stop here\n\n## Phase 6: Ship\n\n**REQUIRES EXPLICIT USER APPROVAL** (unless --auto with zero errors).\n\nExecute the ship action:\n- Code PR: create/update PR, request reviewers\n- Release: tag, build, publish\n- Deployment: deploy to target environment\n- Content: publish to CMS/platform\n\n## Phase 7: Verify\n\nPost-ship verification:\n- Confirm artifact is live/accessible\n- Run smoke tests if available\n- Check monitoring for errors\n- If `--monitor N` → watch for N minutes\n\n## Phase 8: Log\n\nCreate output directory: `autoresearch/ship-{YYMMDD}-{HHMM}/`\nWrite:\n- `checklist.md` — completed checklist with pass/fail per item\n- `summary.md` — what was shipped, verification results\n- `ship-log.tsv` — phase-by-phase log\n\n## Rollback\n\nIf `--rollback`:\n- Identify last ship action from most recent ship log\n- Reverse it (revert PR, unpublish, rollback deployment)\n- Verify rollback succeeded\n\n## Chain Handoff\n\nWrite handoff.json: version \"2.1.0\", source \"ship\", timestamp, status (COMPLETE|DRY_RUN|ROLLBACK|ERROR), findings = blockers/warnings found during prep.\nInvoke next target in --chain order via the `autoresearch` skill's Subcommand routing.\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":4007,"content_sha256":"1ac368f5ee47a2d2f1c798029637555da205304b66d72c2725479ef85e163626"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Autoresearch — Autonomous Goal-directed Iteration","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Safety Invariants (all subcommands)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never push, publish, or deploy without explicit user approval.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Bounded by default. Override with ","type":"text"},{"text":"Iterations: unlimited","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"All results logged to ","type":"text"},{"text":"autoresearch/{subcommand}-{YYMMDD}-{HHMM}/","type":"text","marks":[{"type":"code_inline"}]},{"text":" directory.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Chain handoff via ","type":"text"},{"text":"handoff.json","type":"text","marks":[{"type":"code_inline"}]},{"text":". Evals reads ","type":"text"},{"text":"*-results.tsv","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Dispatch (bare ","type":"text"},{"text":"autoresearch","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]},{"type":"paragraph","content":[{"text":"Parse the invocation in this order:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Condition","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Mode","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Metric:","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"Verify:","type":"text","marks":[{"type":"code_inline"}]},{"text":" present","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Classic","type":"text","marks":[{"type":"strong"}]},{"text":" — existing metric loop, unchanged","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Free-form natural-language goal, no metric/verify","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Orchestrator","type":"text","marks":[{"type":"strong"}]},{"text":" — see Orchestrator section","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Nothing","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Setup wizard","type":"text","marks":[{"type":"strong"}]},{"text":" — interactive config builder","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--classic","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Force Classic regardless of goal text","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--auto","type":"text","marks":[{"type":"code_inline"}]},{"text":" flag","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Force Orchestrator regardless of goal text","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"Print a banner on every invocation: ","type":"text"},{"text":"[autoresearch] mode: classic | orchestrator | wizard","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Subcommands","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Does","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Default Iterations","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Iterate against a metric: modify → verify → keep/discard","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"25","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch plan","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Convert a goal into validated Scope, Metric, Verify config","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"N/A","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch debug","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Hunt bugs: hypothesize → test → falsify → repeat","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"15","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch fix","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Crush errors one-by-one until zero remain","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"20","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch security","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"STRIDE + OWASP audit with red-team personas","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"15","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch ship","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Ship through 8 phases: checklist → dry-run → deploy → verify","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"N/A","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch scenario","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Generate edge cases across 12 dimensions","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"20","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch predict","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"5 expert personas debate before implementation","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"N/A","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch learn","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Scout codebase → generate docs or wiki → validate → fix loop","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"10","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch reason","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Adversarial debate with blind judges until convergence","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"8","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch probe","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"8 personas interrogate requirements until saturation","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"15","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch improve","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Research ICP challenges, discover improvements, generate PRDs","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"15","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch evals","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Analyze iteration results: trends, plateaus, regressions","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"N/A","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"autoresearch regression","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Regression stability gate: baseline vs candidate, verdict STABLE/UNSTABLE","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"N/A","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Subcommand routing","type":"text"}]},{"type":"paragraph","content":[{"text":"To run a subcommand yourself (an orchestrator hop or a ","type":"text"},{"text":"--chain","type":"text","marks":[{"type":"code_inline"}]},{"text":" target), Read its protocol file and follow it: ","type":"text"},{"text":"\u003cname>.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" (relative to this skill's directory), or ","type":"text"},{"text":"autoresearch.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" for the classic loop. The commands are user-typed only, so the model loads them from here instead of invoking them.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Universal Flags","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Flag","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Applies To","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Purpose","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Iterations: N","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All looping","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Set iteration count","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Iterations: unlimited","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All looping","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Opt-in unbounded","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--evals","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All looping","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Mid-loop checkpoints + final summary","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--evals-interval N","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All looping","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Override checkpoint frequency","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--chain \u003ctargets>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Sequential handoff after completion","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--\u003csubcommand>","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Shorthand for ","type":"text"},{"text":"--chain \u003csubcommand>","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--dry-run","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Orchestrator","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Print derived config + planned pipeline; no execution","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--max-cycles N","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Orchestrator","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Hard ceiling on orchestration cycles (default 50)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--classic","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Bare ","type":"text"},{"text":"autoresearch","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Force Classic metric-loop mode","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--auto","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Bare ","type":"text"},{"text":"autoresearch","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Force Orchestrator mode","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--no-fork","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Metric loops","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Disable fork-and-flush rounds","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Forks: K","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Metric loops","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branches per fork-and-flush round (default 4; 2 when Verify is slow or uses a shared resource)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Guided: R","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Metric loops","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Fraction of fork branches given an Advisor-assigned experiment (default 0.5; 0 = all random)","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Getting Unstuck: Fork-and-Flush","type":"text"}]},{"type":"paragraph","content":[{"text":"Metric loops run fork-and-flush rounds on a fixed schedule: at 33% and 66% of the budget, plus early when 5 iterations pass with no ","type":"text"},{"text":"keep","type":"text","marks":[{"type":"code_inline"}]},{"text":". A round forks K fresh-context branches from the best commit so far, runs each for a small budget, and keeps the winner. A fresh context means the files and results log only, with none of the leader's reasoning. Half the branches (by default) are random and pick their own ideas; the other half are guided, each given one distinct experiment by a stateless Advisor that reads the results log. Protocol: ","type":"text"},{"text":"references/fork-and-flush.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" (arXiv:2610.07447, arXiv:2610.07625).","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Orchestrator","type":"text"}]},{"type":"paragraph","content":[{"text":"Activated when a plain-language goal is given without ","type":"text"},{"text":"Metric:","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"Verify:","type":"text","marks":[{"type":"code_inline"}]},{"text":". Classifies the goal into a ","type":"text"},{"text":"Goal archetype","type":"text","marks":[{"type":"strong"}]},{"text":" — see ","type":"text"},{"text":"references/orchestrator-routing.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" for the archetype table and router decision table.","type":"text"}]},{"type":"paragraph","content":[{"text":"Resolve every ","type":"text"},{"text":"scripts/...","type":"text","marks":[{"type":"code_inline"}]},{"text":" path below relative to this installed skill directory, never relative to the caller's working directory.","type":"text"}]},{"type":"paragraph","content":[{"text":"For performance, latency, throughput, runtime, CPU, memory, allocations, binary size, power, energy, bandwidth, or compute-cost goals, read ","type":"text"},{"text":"references/behavior-preserving-optimization.md","type":"text","marks":[{"type":"code_inline"}]},{"text":". The working metric ranks candidates; independent behavior evidence decides whether a candidate survives.","type":"text"}]},{"type":"paragraph","content":[{"text":"Two modes based on archetype:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Orchestration loop","type":"text","marks":[{"type":"strong"}]},{"text":" — predicate-bearing archetypes (ship-ready, optimize-metric, fix-broken, harden, build-feature, explore). Goal has a mechanical Success predicate; the loop runs until that predicate is met.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Single-pass dispatch","type":"text","marks":[{"type":"strong"}]},{"text":" — subjective/terminal archetypes (document, what-to-build, decide-design). Routes once to the fitting subcommand (learn / improve / reason), lets it self-terminate, then reports. No loop, no Plateau, no ship gate.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Orchestration Loop Steps","type":"text"}]},{"type":"paragraph","content":[{"text":"Backed by ","type":"text"},{"text":"scripts/orchestrate.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" (deterministic seam — all routing logic lives there). Subcommands exposed: ","type":"text"},{"text":"classify","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"next-hop","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"units","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"plateau","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"screen-cmd","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"verdict","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"validate-state","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"screen-state-predicate","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Classify","type":"text","marks":[{"type":"strong"}]},{"text":" — ","type":"text"},{"text":"scripts/orchestrate.sh classify \"\u003cgoal>\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" → archetype label + mode.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Derive predicate","type":"text","marks":[{"type":"strong"}]},{"text":" — reuse ","type":"text"},{"text":"plan","type":"text","marks":[{"type":"code_inline"}]},{"text":" logic to produce a concrete Success predicate: exact shell command + expected output. For ","type":"text"},{"text":"optimize-metric","type":"text","marks":[{"type":"code_inline"}]},{"text":", run the full plan/wizard derivation internally.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Confirm","type":"text","marks":[{"type":"strong"}]},{"text":" — ONE ","type":"text"},{"text":"request_user_input","type":"text","marks":[{"type":"code_inline"}]},{"text":" showing: archetype, mode, concrete predicate (command + expected output), terminal choice (stop-at-verified vs proceed-to-ship). Misclassifications are caught here, not mid-run.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Round-0 dry-run","type":"text","marks":[{"type":"strong"}]},{"text":" — prove the predicate command runs and returns a value; safety-screen every derived command via ","type":"text"},{"text":"screen-cmd","type":"text","marks":[{"type":"code_inline"}]},{"text":"; print projected cycle budget. Stop here if ","type":"text"},{"text":"--dry-run","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Loop","type":"text","marks":[{"type":"strong"}]},{"text":" until predicate satisfied:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"lower-alpha"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Assess state via cheap signals (last ","type":"text"},{"text":"handoff.json","type":"text","marks":[{"type":"code_inline"}]},{"text":", regression verdict, error count) + affected-test verify.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/orchestrate.sh next-hop orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → next subcommand.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run subcommand via Subcommand routing (its own bounded inner loop).","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Record per-hop outcome ∈ {progressed, no-op, failed, blocked}.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Fold hop's ","type":"text"},{"text":"handoff.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" into ","type":"text"},{"text":"orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/orchestrate.sh units","type":"text","marks":[{"type":"code_inline"}]},{"text":" → recompute ","type":"text"},{"text":"Units remaining","type":"text","marks":[{"type":"strong"}]},{"text":" and append the number or ","type":"text"},{"text":"unknown","type":"text","marks":[{"type":"code_inline"}]},{"text":" to the state's ","type":"text"},{"text":"units_remaining","type":"text","marks":[{"type":"code_inline"}]},{"text":" array.","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Stop conditions","type":"text","marks":[{"type":"strong"}]},{"text":" (checked after each hop):","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Predicate met → ship gate (only if ship is in the pipeline) else ","type":"text"},{"text":"CONVERGED","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Cycles > ceiling (default 50, override ","type":"text"},{"text":"--max-cycles N","type":"text","marks":[{"type":"code_inline"}]},{"text":") → stop + report ","type":"text"},{"text":"CEILING","type":"text","marks":[{"type":"code_inline"}]},{"text":". Checked first: a reached ceiling is never extended by fork rounds.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/orchestrate.sh plateau orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → exit 0 (flat): unless ","type":"text"},{"text":"--no-fork","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"fork_rounds_since_progress","type":"text","marks":[{"type":"code_inline"}]},{"text":" is already 2, run one fork-and-flush round from the incumbent (","type":"text"},{"text":"references/fork-and-flush.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"), add 1 to ","type":"text"},{"text":"fork_rounds_since_progress","type":"text","marks":[{"type":"code_inline"}]},{"text":", and continue; otherwise stop + report ","type":"text"},{"text":"PLATEAU","type":"text","marks":[{"type":"code_inline"}]},{"text":". Exit 1: continue. Exit 3: stop + report ","type":"text"},{"text":"BLOCKED","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Hop outcome ","type":"text"},{"text":"blocked","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"failed","type":"text","marks":[{"type":"code_inline"}]},{"text":" with no alternative route → checkpoint + stop + report ","type":"text"},{"text":"BLOCKED","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Orchestrator State","type":"text"}]},{"type":"paragraph","content":[{"text":"orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" — orchestrator-owned, additive. Tracks: goal, archetype, predicate, terminal-choice, ","type":"text"},{"text":"units_remaining","type":"text","marks":[{"type":"code_inline"}]},{"text":" history, cycle count, per-hop pipeline log with outcomes, current incumbent, ","type":"text"},{"text":"fork_rounds_since_progress","type":"text","marks":[{"type":"code_inline"}]},{"text":" (reset to 0 whenever units improve). Each hop's ","type":"text"},{"text":"handoff.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" is unchanged (single-hop bridge); the orchestrator reads it and folds it in. Two clearly-owned state objects, no overlap.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Orchestrator Safety Invariants","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never auto-approve ship/deploy/push.","type":"text","marks":[{"type":"strong"}]},{"text":" The orchestrator never passes ","type":"text"},{"text":"--auto","type":"text","marks":[{"type":"code_inline"}]},{"text":" to ","type":"text"},{"text":"ship","type":"text","marks":[{"type":"code_inline"}]},{"text":"; deploy always requires explicit user approval.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Data-migration behind anchored DB-URL allowlist.","type":"text","marks":[{"type":"strong"}]},{"text":" Reuses regression's allowlist — host must be ","type":"text"},{"text":"localhost","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"127.0.0.1","type":"text","marks":[{"type":"code_inline"}]},{"text":"/container hostname, or database name carries ","type":"text"},{"text":"_test","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"_ci","type":"text","marks":[{"type":"code_inline"}]},{"text":" suffix. Bare substring match does not qualify. Anything else refused.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"screen-cmd on every derived command","type":"text","marks":[{"type":"strong"}]},{"text":" — run before the loop starts AND on every command read from a persisted state file on resume. Persisted commands are never trusted; resume re-screens the pinned predicate via ","type":"text"},{"text":"screen-state-predicate","type":"text","marks":[{"type":"code_inline"}]},{"text":" and refuses on ","type":"text"},{"text":"refuse","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"No un-screened commands mid-loop.","type":"text","marks":[{"type":"strong"}]},{"text":" The autonomous loop cannot introduce new shell commands that bypass ","type":"text"},{"text":"screen-cmd","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Predicate pinned, not re-derived.","type":"text","marks":[{"type":"strong"}]},{"text":" Round-0 writes the derived Success predicate verbatim into ","type":"text"},{"text":"orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":"; every cycle and every resume reuses that exact string so \"done\" is reproducible across runs.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Validate the ledger before routing.","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"validate-state","type":"text","marks":[{"type":"code_inline"}]},{"text":" gates ","type":"text"},{"text":"orchestrator-state.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" (required fields + coarse types); a malformed ledger is not trusted to route from.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Independent verify before convergence.","type":"text","marks":[{"type":"strong"}]},{"text":" High-impact changes accepted on the working signal set ","type":"text"},{"text":"pending_verify","type":"text","marks":[{"type":"code_inline"}]},{"text":"; ","type":"text"},{"text":"next-hop","type":"text","marks":[{"type":"code_inline"}]},{"text":" routes to a ","type":"text"},{"text":"verify","type":"text","marks":[{"type":"code_inline"}]},{"text":" hop (held-out / adversarial check) before ","type":"text"},{"text":"DONE","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ship. The verify hop never auto-approves ship.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Unknown-units cycles excluded from Plateau counter.","type":"text","marks":[{"type":"strong"}]},{"text":" A cycle where ","type":"text"},{"text":"units","type":"text","marks":[{"type":"code_inline"}]},{"text":" returns ","type":"text"},{"text":"unknown","type":"text","marks":[{"type":"code_inline"}]},{"text":" (e.g. runner crash) is not counted as zero-progress; repeated ","type":"text"},{"text":"unknown","type":"text","marks":[{"type":"code_inline"}]},{"text":" routes to ","type":"text"},{"text":"BLOCKED","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]}]},"metadata":{"date":"2026-11-02","name":"autoresearch","author":"@skillopedia","source":{"stars":6787,"repo_name":"autoresearch","origin_url":"https://github.com/uditgoenka/autoresearch/blob/HEAD/.muse/skills/autoresearch/SKILL.md","repo_owner":"uditgoenka","body_sha256":"a4e10490ad156142075e1339f9a716018e8bbe44cd854ba92a25006014ffb897","cluster_key":"a18b0869c1d1988f3bb555fae865b1df7e4eff97ea4965e0a8c415e9b2bcae13","clean_bundle":{"format":"clean-skill-bundle-v1","source":"uditgoenka/autoresearch/.muse/skills/autoresearch/SKILL.md","text_bytes":140618,"source_commit":"7bddd056dfd0b0ded8360588d8101b1ecb5c0baa","skills_sh_rank":7255,"attachment_count":22,"text_attachments":22,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"skill_md_path":".muse/skills/autoresearch/SKILL.md","import_metadata":{"date":"2026-11-02","author":"@skillopedia","version":"2.3.0","category":"general","category_label":"General"},"exact_dupes_collapsed_into_this":0},"version":"2.3.0","category":"general","import_tag":"skills-sh-top20k-2026-11","description":"Autonomous iteration loop: modify, verify, keep/discard against any metric"}},"renderedAt":1793686605122}

Autoresearch — Autonomous Goal-directed Iteration Safety Invariants (all subcommands) - Never push, publish, or deploy without explicit user approval. - Bounded by default. Override with . - All results logged to directory. - Chain handoff via . Evals reads . Dispatch (bare ) Parse the invocation in this order: | Condition | Mode | |---|---| | or present | Classic — existing metric loop, unchanged | | Free-form natural-language goal, no metric/verify | Orchestrator — see Orchestrator section | | Nothing | Setup wizard — interactive config builder | | flag | Force Classic regardless of goal te…