token-cascade
v0.2.1
Published
SigRank product facade over TTEOP canonical semantics — delegates metric computation to tteop-spec, adds SigRank aliases (SNR, 10xDEV), RS05 class taxonomy, operator signatures, and field ranking.
Maintainers
Readme
@sigrank/cascade
SigRank product facade over TTEOP canonical semantics. Pure functions only — no filesystem, no API, no auth, no transport.
Canonical TTEOP metric computation (Yield, Leverage, Velocity, output_fraction,
log_leverage) is delegated to tteop-spec,
the executable/reference implementation of the TTEOP protocol. This package
preserves SigRank-facing aliases (SNR, 10xDEV), the 24-stage RS05 class
taxonomy, operator signatures, and field ranking — all product extensions
that do not redefine TTEOP semantics.
Authority chain
TTEOP (protocol specification)
→ [email protected] (canonical executable/reference semantics)
→ @sigrank/cascade (this package — SigRank product facade)
→ sigrank-mcp (product tooling)This package owns:
- SNR (display alias for TTEOP
output_fraction) =output / (input + output) - 10xDEV (display alias for TTEOP
log_leverage) =log10(cacheRead / input) - RS05 24-stage class taxonomy (product extension, not TTEOP)
- Operator signatures, field ranking, percentile/rank helpers (product extensions)
Canonical TTEOP metrics (Υ Yield, Leverage, Velocity) and all null semantics,
rounding (banker's rounding per SRP-METRIC-002), and edge-case behavior are
owned by tteop-spec and delegated through this package.
Install
npm install @sigrank/cascade
# or
bun add @sigrank/cascadeUsage
cascade(input, output, cacheCreate, cacheRead)
Compute the full cascade from 4 token pillars. cacheCreate and cacheRead
accept null for unavailable cache telemetry — null is passed through to
tteop-spec so canonical null semantics apply directly (affected metrics
are null, not 0). Passing 0 produces 0-valued metrics (e.g.
leverage = 0/input = 0), preserving the null/zero distinction.
import { cascade } from "@sigrank/cascade";
const c = cascade(1_251_211, 11_296_121, 128_196_310, 2_555_179_769);
console.log(c.yield); // 18436.98
console.log(c.leverage); // 2042.2
console.log(c.velocity); // 9.028
console.log(c.snr); // 0.9003
console.log(c.dev10x); // 3.31
console.log(c.class); // "REFINER I"
// null cache = unavailable → metrics are null
const partial = cascade(1000, 5000, null, null);
console.log(partial.yield); // null
console.log(partial.leverage); // null
console.log(partial.dev10x); // null
console.log(partial.velocity); // 5
console.log(partial.snr); // 0.8333classify(totalTokens)
Classify an operator by total token volume into one of 24 RS05 stages.
import { classify } from "@sigrank/cascade";
classify(2_694_000_000); // "BEARER I"
classify(0); // "IGNITER III"round(n, d)
Round to d decimal places using banker's rounding (round-half-to-even),
delegated to tteop-spec's canonical roundHalfToEven (SRP-METRIC-002).
Returns null for non-finite inputs.
import { round } from "@sigrank/cascade";
round(3.14159, 2); // 3.14
round(Infinity, 2); // nullfieldStats(yields, leverages?, velocities?, snrs?)
Compute field statistics from an array of yields. Returns null if fewer than 5 data points.
import { fieldStats } from "@sigrank/cascade";
const stats = fieldStats([100, 200, 300, 400, 500, 600, 1000]);
// { count: 7, median_yield: 400, top_10_percent_yield: 1000, ... }percentileOf(value, field)
Percentage of field values below the given value.
import { percentileOf } from "@sigrank/cascade";
percentileOf(900, [100, 200, 300, 400, 500, 600, 1000]); // 85.7rankOf(value, field)
Rank of a value against a field (1 = best/highest).
import { rankOf } from "@sigrank/cascade";
rankOf(900, [100, 200, 300, 400, 500, 600, 1000]); // 2operatorSignature(cascadeResult)
Generate a compact operating signature from cascade metrics.
import { cascade, operatorSignature } from "@sigrank/cascade";
const c = cascade(1_251_211, 11_296_121, 128_196_310, 2_555_179_769);
const sig = operatorSignature(c);
// { code: "L2042-V9.03-S0.90-C11.34", archetype: "BALANCED_ELITE", dominant_trait: "combined reuse + throughput" }evaluateOperator(pillars, options?)
Build a full OperatorEvaluation from pillars, optionally with field data for benchmarking.
import { evaluateOperator } from "@sigrank/cascade";
const eval = evaluateOperator(
{ input: 1_251_211, output: 11_296_121, cache_read: 2_555_179_769, cache_write: 128_196_310 },
{
codename: "MOSES",
fieldYields: [1000, 2000, 3000, 4000, 5000, 18436.98],
}
);Exports
| Export | Type |
|--------|------|
| cascade() | function |
| classify() | function |
| round() | function |
| fieldStats() | function |
| percentileOf() | function |
| rankOf() | function |
| operatorSignature() | function |
| evaluateOperator() | function |
| RS05_CLASS_THRESHOLDS | constant |
| CascadeResult | interface |
| OperatorEvaluation | interface |
| FieldStats | interface |
| ClassThreshold | interface |
Canonical reference
MO§ES Υ 18436.98 from (1251211, 11296121, 128196310, 2555179769).
License
UNLICENSED
