On this page

0121: Density measurement and gates

Status: Proposed — design default, pending the maintainer's confirmation

Context

ADR-0010 sets agent-density targets. Reliable gates need deterministic measures, while real latency, RSS and provider caching still need explicit evidence.

Decision

Measure 10,000 idle agents using ADR-0115 counters and gate at at most 16,384 bytes per agent excluding unique context; report RSS delta per agent separately. Benchmark 100,000 spawns and then 100,000 forks with an in-program monotonic clock: target each median at most 50 microseconds, report p99, and do not gate timing.

Use a fake provider's byte-identical-prefix cache model and usage fields cache_read_input_tokens, cache_creation_input_tokens and input_tokens. Gate the ratio of summed cache-read tokens to summed shared-prefix tokens for siblings 2 through N at 0.90 or above. Define a usage-field JSONL replay format with a fake sample; a real-provider recording and 90% confirmation are manual, owner-credentialed and explicitly unverified until performed. Step 24 addendum: keep the immutable reply-only ModelPort ABI (rather than new mutable natives or breaking reply fields); opt-in cache_call threads cache state and exposes existing TokenUsage, using an explicit byte-offset breakpoint and ceil(bytes/4) per prefix/remainder, without TTL/eviction.

Gate process sharing with registry stats and a /proc/<pid>/task child scan: 64 agents across two repositories produce exactly two LSP processes and one MCP process. The deterministic density smoke gate covers counters, cache ratio and process counts; the interpreter prints n/a for counters and compares outputs and journals. Add benchmark digest rows only; preserve existing rows.

Consequences

M13.4 addendum: ADR-0122 defers the idle and timing targets. The smoke gate now enforces a 28,672 B/agent cumulative-allocation proxy regression ceiling, not the 16,384 B live-memory target; fixture invocation counts do not verify registry-level process sharing.

Deterministic regressions fail the gate without making noisy RSS or timings blocking. Fake cache results do not establish real-provider performance, and /proc measurement requires the intended Linux environment.

Alternatives

Gating wall-clock time or RSS would make routine checks environment-sensitive. Treating a fake cache hit as real-provider proof would overstate validation.