bench

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bench measures what it costs an agent to answer a question with jade's tools versus with ordinary shell and file tools.

What this measures, and what it does not

docs/scope.md §26 asks whether an agent using jade "completes real tasks more efficiently and reliably than shell/file tooling", and §42-43 lists tokens, turns and success rate as the metrics. This harness measures the first of those three, deterministically and without an LLM in the loop: for each scenario it runs both arms and counts the bytes each one puts in front of the agent — a "tokens to answer" metric rather than a search-precision score.

It deliberately does NOT measure turns or success rate. Both require a real agent making real decisions, and faking them with a scripted call sequence would produce a number that looks like evidence while measuring only the script's author. Turn counts are reported as the number of tool calls each arm needs, which is a floor on turns, not a measurement of them.

The honest reading of a result table is therefore: "answering this question costs N tokens of context through jade and M through shell." That is a real, reproducible comparison, and it is the part of docs/scope.md's question that can be answered without a benchmark agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateTokens

func EstimateTokens(bytes int) int

EstimateTokens approximates tokens from bytes at the widely used ~4 characters per token. It is an estimate, not a tokenizer: the comparison between two arms is the meaningful output, not either absolute number, and both arms are estimated identically so the ratio holds regardless of the constant's exact value.

func Report

func Report(results []Result) string

Report renders results as plain text. Deliberately not JSON: this output is read by a person deciding whether jade is worth continuing, and it is also the house style Phase 10 is moving every jade response toward.

Types

type API

API is the subset of the internal server the scenarios exercise. Declared as an interface so the benchmark cannot quietly grow a dependency on server internals.

type Arm

type Arm func() (output string, calls int, err error)

Arm is one way of answering a scenario's question. It returns everything the agent would have to read, concatenated, plus how many tool calls it took.

type ArmResult

type ArmResult struct {
	Bytes  int
	Tokens int
	Calls  int
	Err    error
}

ArmResult is one arm's measured cost.

type Result

type Result struct {
	Name     string
	Question string
	Jade     ArmResult
	Shell    ArmResult
}

Result is one scenario measured on both arms.

func Run

func Run(scenarios []Scenario) []Result

Run measures every scenario. A failing arm is recorded rather than aborting the suite: one broken scenario should not hide the rest, and a tool that errors is itself a result worth seeing.

func (Result) TokenRatio

func (r Result) TokenRatio() float64

TokenRatio is jade's token cost as a multiple of shell's. Below 1.0 means jade is cheaper. Returns 0 when shell produced nothing to compare against.

type Scenario

type Scenario struct {
	Name string
	// Question is the agent-level task, phrased as an agent would think of
	// it rather than as a tool invocation.
	Question string
	Jade     Arm
	Shell    Arm
}

Scenario is one question asked of a repository, answered two ways.

func DefaultScenarios

func DefaultScenarios(api API, root string) []Scenario

DefaultScenarios are questions an agent actually asks while working in a repository, each answered both ways.

Fairness rules, because a benchmark whose arms answer different questions measures nothing:

  • both arms must produce enough for the agent to answer the question;
  • the shell arm uses the command a competent agent would actually reach for, not a deliberately clumsy one;
  • jade's arm is measured as its response is actually serialized to the agent over MCP (JSON), not as some hypothetical trimmed form.

Directories

Path Synopsis
Package agent runs the release plan's external benchmark: a real agent (Claude Code headless) solving real tasks in a repository Jade was not built in, once per arm — shell tools only, Jade only, and Jade plus shell.
Package agent runs the release plan's external benchmark: a real agent (Claude Code headless) solving real tasks in a repository Jade was not built in, once per arm — shell tools only, Jade only, and Jade plus shell.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL