The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(scripts): prompt:report and a CI lane for the prompt-budget ratchet
M3gA-Mind482aab2924c1
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.ymlindex 51332ef43b..77e1beea18 100644--- a/.github/workflows/ci-lite.yml+++ b/.github/workflows/ci-lite.yml@@ -148,6 +148,10 @@ jobs:# entry, resolved to `["rust-tauri"]` alone, skipping every lane# that would have compiled the family it enabled.- 'scripts/ci/product-features.*'+ # The prompt-budget ratchet runs in rust-quality; editing its+ # limits or the script must arm the lane that checks them.+ - 'scripts/prompt-budget.limits'+ - 'scripts/check-prompt-budget.sh'# The coverage-presence gate and its allowlist decide whether this# lane FAILS, so they arm it for the same reason.- 'scripts/ci/assert-coverage-presence.sh'@@ -447,6 +451,13 @@ jobs:bash scripts/ci-cancel-aware.sh cargo clippy -p openhuman \--features "$(bash scripts/ci/product-features.sh)" -- -D warnings+ - name: Guard — the fixed prompt prefix may not grow+ if: needs.changes.outputs['rust-core'] == 'true'+ # Until this step no lane ran check-prompt-budget.sh, and the recorded+ # limits rotted unnoticed. It builds openhuman-core with the same+ # product feature set clippy just resolved.+ run: bash scripts/ci-cancel-aware.sh bash scripts/check-prompt-budget.sh --verbose+- name: Run clippy (core crate, contributor default set)if: needs.changes.outputs['rust-core'] == 'true'# The set a contributor's editor and pre-push hook actually compile. Adiff --git a/package.json b/package.jsonindex 04822e2f9a..5b5df478a9 100644--- a/package.json+++ b/package.json@@ -40,6 +40,8 @@"merge-pr": "bash scripts/shortcuts/review/merge.sh","mock:api": "node scripts/mock-api-server.mjs","pr:checklist": "node scripts/check-pr-checklist.mjs",+ "prompt:eval": "bash scripts/prompt-eval.sh",+ "prompt:report": "bash scripts/prompt-report.sh","pr:sync-main": "node scripts/merge-main-into-open-prs.mjs","release:notes": "node scripts/release/generate-release-notes.mjs","release:notes:preview": "bash -c 'source scripts/load-dotenv.sh && node scripts/release/generate-release-notes.mjs --from latest-release --to main --output CHANGELOG.preview.md'",diff --git a/scripts/README.md b/scripts/README.mdindex 0c253fdc9e..faa3fde894 100644--- a/scripts/README.md+++ b/scripts/README.md@@ -39,6 +39,8 @@ comments of the scripts inside them.| `pnpm rust:layout` | `ci/check-openhuman-rust-layout.mjs` || `pnpm test:inventory` | `generate-test-inventory.mjs` || `pnpm pr:checklist` | `check-pr-checklist.mjs` |+| `pnpm prompt:report` | `prompt-report.sh` — every agent's fixed prefix (prompt + tool schemas), largest first; report-only |+| `pnpm prompt:eval` | `prompt-eval.sh` — real-model prompt comprehension scenarios; report-only, never run in CI |See `package.json` for the full list, including `i18n:*`, `tauri:ios:*`,`tauri:android:*`, and the `shortcuts/`/`deep-work`/`agent-batch` commands@@ -57,7 +59,7 @@ above.- **`check-*`** (outside `ci/`) — repo-level gates: `check-coverage-matrix.mjs`,`check-domain-e2e-coverage.mjs`, `check-pr-checklist.mjs`,`check-kernel-floor.sh` (dependency-floor ratchet), `check-prompt-budget.sh`- (fixed-prefix token ratchet), `check-linux-tls-dependencies.sh`.+ (fixed-prefix byte ratchet, run in CI by `rust-quality`), `check-linux-tls-dependencies.sh`.- **`i18n-*`** — translation coverage and audit tools (`i18n-coverage.ts`,`i18n-find-english.ts`, `i18n-react-audit.ts`, behind `pnpm i18n:*`);`i18n-doc-scan.sh` scans the Chinese GitBook docs instead of the app.diff --git a/scripts/prompt-report.sh b/scripts/prompt-report.shnew file mode 100755index 0000000000..cea2c9c8f9--- /dev/null+++ b/scripts/prompt-report.sh@@ -0,0 +1,75 @@+#!/usr/bin/env bash+# Print every agent's fixed per-turn prefix — system prompt plus advertised tool+# schemas — one row per agent, largest first, with a fleet total.+#+# Report-only: nothing here fails on a number. The ratchet that does is+# `scripts/check-prompt-budget.sh`, which measures through the same CLI, so the+# two never disagree about a byte.+#+# Usage: scripts/prompt-report.sh [--workspace <dir>]+#+# (default) Hermetic: a fresh empty workspace and config, so the+# numbers describe the repo, not whoever is logged in.+# --workspace <dir> Measure a real, signed-in workspace instead. The only way+# to see `integrations_agent`, which renders once per+# *connected* toolkit and so has nothing to render+# hermetically.+#+# Units are bytes. `~tok` is bytes / 4, the same reading aid `prompt-size`+# prints (`EST_BYTES_PER_TOKEN` in agent/debug/prompt_size.rs) — a divisor, not+# a tokenizer. A real token count is true for one model only, and the fleet+# spans several.+set -euo pipefail++cd "$(dirname "${BASH_SOURCE[0]}")/.."++REAL_WORKSPACE=""+while (( $# )); do+ case "$1" in+ --workspace) REAL_WORKSPACE="${2:?--workspace needs a directory}"; shift 2 ;;+ *) echo "unknown flag: $1" >&2; exit 64 ;;+ esac+done++BIN="${CARGO_TARGET_DIR:-target}/debug/openhuman-core"+if [[ ! -x "$BIN" ]]; then+ echo "[prompt-report] building openhuman-core …" >&2+ cargo build --manifest-path Cargo.toml --bin openhuman-core \+ --features "$(bash scripts/ci/product-features.sh)" >&2+fi++if [[ -n "$REAL_WORKSPACE" ]]; then+ echo "[prompt-report] measuring signed-in workspace $REAL_WORKSPACE" >&2+ measured="$(RUST_LOG=error "$BIN" agent prompt-size --workspace "$REAL_WORKSPACE" --json)"+else+ # `--hermetic` puts config.toml beside the workspace dir (its parent), so the+ # workspace must be a child of the temp dir — see check-prompt-budget.sh.+ TMP="$(mktemp -d "${TMPDIR:-/tmp}/openhuman-prompt-report.XXXXXX")"+ trap 'rm -rf "$TMP"' EXIT+ echo "[prompt-report] measuring against hermetic workspace $TMP" >&2+ measured="$(RUST_LOG=error "$BIN" agent prompt-size --workspace "$TMP/workspace" --hermetic --json)"+fi++python3 - "$measured" <<'PY'+import json, sys++TOK = 4 # EST_BYTES_PER_TOKEN+rows = []+for r in json.loads(sys.argv[1])["agents"]:+ name = r["agent"] + (f"[{r['toolkit']}]" if r.get("toolkit") else "")+ worst = max(r["tools"], key=lambda t: t["bytes"], default=None)+ rows.append((name, r["prompt_bytes"], r["tool_bytes"], r["fixed_prefix_bytes"],+ f"{worst['name']} ({worst['bytes']})" if worst else "-"))+rows.sort(key=lambda row: -row[3])++fmt = "{:<34} {:>9} {:>9} {:>9} {:>8} {}"+print(fmt.format("agent", "prompt B", "tools B", "fixed B", "~tok", "worst tool (B)"))+for name, p, t, f, w in rows:+ print(fmt.format(name, p, t, f, f // TOK, w))+tp, tt, tf = (sum(row[i] for row in rows) for i in (1, 2, 3))+print(fmt.format(f"TOTAL ({len(rows)} rows)", tp, tt, tf, tf // TOK, ""))++if not any(row[0].startswith("integrations_agent") for row in rows):+ print("integrations_agent — not measurable hermetically; run with "+ "--workspace ~/.openhuman/workspace to measure per connected toolkit")+PY