Track B: networkless shell, context metrics, freeze, journal

- Claude Code and OpenCode: system shells replaced inside the sandbox by
  wrappers that run every command in a nested bubblewrap with an empty
  network namespace and no resolver socket; the CLI keeps its backend
  connection. dev-netprobe (new dev task) passes for all three agents:
  no network, no DNS from the shell
- context metrics for both tracks: provider input (cached/uncached),
  cumulative context through the tool loop, unique reference tokens and
  bundle coverage; report shows them; no dollar cost for Track B
- ajieval freeze: frozen state (clean Aji commit, binary, bundle,
  toolchains, docs, CLI versions and config fingerprints, tasks,
  evaluator, limits) and a shuffled cell order; matrix verifies it and
  runs cells sequentially in that order; ajieval journal
- docs: benchmark-authoring.md (roles, clean-context brief, E-G
  checklist); harness.md, protocol §39b, plan updated
This commit is contained in:
dev committed 2026-10-04 17:58:32 +03:00
1 parent 00cbb65447
commit 8b7911669d
16 files changed
+574 -43

No files matched your search

+1
View File
@@ -4,6 +4,7 @@ Non-normative. Empirical validation of the Aji hypothesis stated in [spec 14](..
| Document | Purpose |
|---|---|
| [benchmark-authoring.md](benchmark-authoring.md) | Separation of roles for E0-2 and E-G: benchmark author and reference writers in clean contexts; brief; gate checklist |
| [harness.md](harness.md) | Agent scaffold and run recorder (E0-3): task format, evaluator contract, run record, commands |
| [protocol.md](protocol.md) | Agent Language Evaluation Protocol 0.2: variables, benchmark families T01–T10, conditions `Aji/AIR` and `Aji/source`, maintenance and seeded-bug benchmarks, metrics, statistics, stages A–E, success and falsification criteria |
| [../agent/README.md](../agent/README.md) | Agent Reference Bundle: contents, measurement, growth policy, milestones |
+81
View File
@@ -0,0 +1,81 @@
# Benchmark Authoring and References (E0-2, E-G)
Non-normative. How the private tasks and reference implementations for the Track B smoke (E-N) and later experiments are produced without contaminating them with knowledge of Aji's development.
## Separation of roles
| Role | Context | Sees | Produces |
|---|---|---|---|
| Language developer (the agent working in this repository) | the whole development history | this public repository | language, harness |
| Benchmark author | a fresh agent context in the private benchmark repository | only the brief below and [`harness.md`](harness.md) (task format, evaluator contract) | tasks, public and hidden tests, evaluator, manifest, reviewer notes |
| Reference writer, one per language | a fresh agent context per language | one task statement, its language's starter workspace and the documentation a smoke participant gets (for Aji exactly the frozen Agent Reference Bundle) | a reference solution |
| Owner | everything private | everything | reviews, freezes, runs |
Rules:
- The private repository is never shown to the language developer's conversation. Hidden tests, task designs and evaluator code are never pasted into it.
- The benchmark author writes the evaluator from the task statement and does **not** tune it to reference implementations.
- If a reference fails the evaluator because the task is ambiguous, the statement or evaluator is corrected and its `version` is increased, and the references are rerun. Then everything is frozen. After the freeze no change is allowed until the last run of the experiment.
- The Aji reference is written by a separate agent, never by the language developer.
Reference writers can run through the harness itself, which gives them exactly the participants' environment: `ajieval native` with the task, the language and generous limits. The runs live in the private repository, and their records are not shared with the language developer.
## Brief for the benchmark author
> You are designing a private held-out benchmark for comparing AI agents writing systems software in three languages: Aji/AIR, Rust and Zig. You have no role in Aji language design and must not optimize tasks for Aji.
>
> Create two benchmark tasks:
>
> 1. A memory-safety-heavy streaming/binary-processing systems task.
> 2. A concurrency-heavy bounded-processing task.
>
> The tasks must belong to these broad families, but must NOT reproduce public examples such as a simple length-prefixed frame decoder, append-only log, basic producer/consumer pipeline, or simple fan-out example.
>
> For each task produce:
>
> - a language-neutral task statement;
> - deterministic acceptance criteria;
> - public tests;
> - private hidden tests;
> - fuzz/property tests where applicable;
> - resource limits;
> - a machine evaluator implementing `CMD WORKSPACE LANGUAGE TASK_DIR` and returning the required JSON verdict;
> - a task manifest containing version and hashes;
> - reviewer notes explaining possible ambiguities;
> - no reference to Aji-specific constructs in the task statement.
>
> Requirements:
>
> - More than one implementation strategy must be valid.
> - Hidden tests must test only stated requirements.
> - Do not introduce arbitrary requirements that favor one language.
> - Include malformed/error cases.
> - The concurrency task must exercise boundedness, ownership/lifetime of work, termination and at least one failure/cancellation scenario.
> - The memory task must exercise incremental input, malformed data, integer/bounds edge cases and constrained memory.
> - Avoid task structures already described in public Aji documentation.
> - Do not reveal the hidden tests or concrete hidden task design outside this private benchmark repository.
>
> Task directory and evaluator format: see `harness.md` (task directory, evaluator contract). Each language gets a starter workspace with a README describing the program's interface and a public test command. The Aji/AIR workspace describes the entry point and the `aji run` invocation (grants, inputs), the way `docs/evaluation/dev-tasks/dev-echo/lang/aji_air/README.md` does.
## Gate E-G (before the 18 runs)
All of the following must hold:
```text
networkless shell for all native agents (verified: dev-netprobe)
native configurations frozen (ajieval freeze)
2 private tasks reviewed
evaluator frozen
task/evaluator hashes frozen
Rust references PASS
Zig references PASS
Aji/AIR references PASS
Aji compiler commit frozen
Agent Reference Bundle hash frozen
Rust/Zig toolchains + docs frozen
```
`ajieval freeze PLAN.json` records the frozen state and a random cell order. `ajieval matrix PLAN.json` refuses to run if anything changed. Observations during the runs go to `ajieval journal PLAN.json "…"` and are acted on only after the last run.
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
"""Dev evaluator for dev-netprobe: accepted iff the agent's shell had no
network (net.txt says NETWORK_BLOCKED) and probe.sh was left unchanged.
usage: evaluator.py WORKSPACE LANGUAGE TASK_DIR
"""
import json, os, sys
ws, task_dir = sys.argv[1], sys.argv[3]
try:
out = open(os.path.join(ws, "net.txt")).read()
except OSError:
out = ""
pristine = open(os.path.join(task_dir, "lang", "any", "probe.sh")).read() == open(os.path.join(ws, "probe.sh")).read()
gates = {"probe_ran": "NETWORK_" in out, "probe_unchanged": pristine, "network_blocked": "NETWORK_BLOCKED" in out and "NETWORK_REACHABLE" not in out, "no_dns": "DNS_RESOLVES" not in out}
print(json.dumps({"accepted": all(gates.values()), "gates": gates, "net_txt": out[-500:]}))
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
# Reports whether this shell can reach the network.
reach=0
if command -v curl >/dev/null 2>&1; then
curl -sS -m 8 -o /dev/null https://example.com 2>/dev/null && reach=1
fi
python3 - <<'PY' && reach=1
import socket, sys
try:
socket.create_connection(("1.1.1.1", 443), 5).close()
except OSError:
sys.exit(1)
PY
getent hosts example.com >/dev/null 2>&1 && echo "DNS_RESOLVES"
if [ "$reach" = 1 ]; then echo "NETWORK_REACHABLE"; else echo "NETWORK_BLOCKED"; fi
@@ -0,0 +1,5 @@
# Task: environment probe
Harness development task (dev set): it checks the isolation of the agent's shell. Do not evaluate anything with it.
Run the command `sh probe.sh` in the repository exactly once, using your shell tool, and save its complete output into the file `net.txt` in the repository (for example `sh probe.sh > net.txt 2>&1`). Do not modify `probe.sh`. Then stop.
@@ -0,0 +1,14 @@
{
"id": "dev-netprobe",
"version": "1",
"set": "dev",
"family": "harness-dev",
"prompt": "prompt.md",
"languages": {
"aji_air": {"workspace": "lang/any", "test": "sh probe.sh"},
"rust": {"workspace": "lang/any", "test": "sh probe.sh"},
"zig": {"workspace": "lang/any", "test": "sh probe.sh"}
},
"limits": {"tool_calls": 10, "total_tokens": 200000, "wall_seconds": 300, "command_timeout": 60},
"concurrency": false
}
+36 -3
View File
@@ -168,8 +168,10 @@ Per agent:
| Agent | Configuration | Shell network |
|---|---|---|
| `codex` | `codex exec --json`; `approval_policy=never`; web search off; product features off (multi-agent, apps, browser, computer use, plugins, skills, goals, hooks…) | off (Codex `workspace-write` sandbox) |
| `claude` | `claude -p --output-format stream-json`; tools limited to `Bash`, `Read`, `Edit` and `Write`; `--strict-mcp-config`; slash commands off | on |
| `opencode` | `opencode run --pure --format json`; no MCP; `webfetch`, `websearch` and `task` off | on |
| `claude` | `claude -p --output-format stream-json`; tools limited to `Bash`, `Read`, `Edit` and `Write`; `--strict-mcp-config`; slash commands off | off (networkless shell wrapper) |
| `opencode` | `opencode run --pure --format json`; no MCP; `webfetch`, `websearch` and `task` off; no LSP downloads | off (networkless shell wrapper) |
**Networkless shell.** Inside the sandbox, the real shell binaries (`/usr/bin/bash`; `sh` follows its symlink) are replaced by wrappers. Each wrapper runs the command in a nested bubblewrap with a fresh, empty network namespace and without the resolver socket. The CLI process keeps the network to reach its backend. Every process a tool starts through a shell, `python3` sockets included, has neither network nor DNS. The live check is the dev task [`dev-netprobe`](dev-tasks/dev-netprobe/), which all three agents pass.
**Record (`aji-eval-native/1`).** The run directory holds:
@@ -191,7 +193,38 @@ Per agent:
- tool calls and token usage as reported by the CLI, normalized to input, output and cached input;
- the evaluator verdict.
A first-generation snapshot is not available in Track B.
A first-generation snapshot is not available in Track B. There is no cost in dollars either: on subscriptions there is no honest cost per solution, so Track B reports success, time, tool calls and context. Economics stays with Track A.
## Context metrics (both tracks, `metrics.context`)
| Metric | Measures |
|---|---|
| `provider_input_tokens` | what the provider counted: total, cached and uncached input, and output |
| `cumulative_context_tokens` | the text returned to the agent through its tool loop (every tool output, plus the task message), counted each time it was returned |
| `unique_reference_tokens` | the distinct documentation text the agent saw: distinct lines in the outputs of tool calls that touched `/docs` |
| `reference_coverage` | for a single-file reference (the Aji bundle), the fraction of its lines that the agent saw |
The gap between provider input and cumulative context is history resending, mostly cached. The gap between cumulative context and unique reference is rereading and verbose output. The tokenizer is `cl100k_base` if tiktoken is installed, otherwise bytes / 4. Each record names the one it used.
## Freezing and running an experiment
```sh
python3 -m ajieval freeze PLAN.json # PLAN.freeze.json: frozen state + random cell order
python3 -m ajieval matrix PLAN.json # verifies the freeze, runs cells sequentially in frozen order
python3 -m ajieval journal PLAN.json "observation" [--run RUN_ID]
```
The freeze records:
- the Aji commit (the repository must be clean), the `aji` binary and the bundle hash;
- the language profiles, toolchain versions and documentation hashes;
- for each native agent: the CLI version and binary hash, and a fingerprint of its configuration (config, command line template, task preamble, shell wrapper);
- the harness commit, the task hashes, the evaluator hash and the limits;
- the shuffled order of all cells.
If any of it changes, `matrix` stops. Problems seen during the runs go to the journal (`<out>/journal.md`) and are acted on only after the last run.
How tasks and references are produced without contamination: [`benchmark-authoring.md`](benchmark-authoring.md).
## Smoke test (E-S)
+1 -1
View File
@@ -1578,7 +1578,7 @@ Track B — native agent language × coding-agent product (each model in it
tests the practical economics of development
```
Track B measures model + system prompt + context management + tool policy + compaction + agent heuristics together, so its results are never used as evidence for H4. Order (owner decision): the first experiment is Track B on existing subscriptions — a native dev-echo gate, then 2 tasks × 3 languages × 3 native agents × 1 run = 18 runs — and its analysis decides whether the controlled 36-run Track A (direct APIs, one scaffold) is bought next. Track B agents run with model, filesystem, shell, compiler, tests, documentation and the task statement only: web and search tools, MCP, skills, custom agents, subagents, external memory and global instructions are disabled where the product allows. Track B results never label models by capability; they describe how Aji behaves on three different agent stacks.
Track B measures model + system prompt + context management + tool policy + compaction + agent heuristics together, so its results are never used as evidence for H4. Order (owner decision): the first experiment is Track B on existing subscriptions — a native dev-echo gate, then 2 tasks × 3 languages × 3 native agents × 1 run = 18 runs — and its analysis decides whether the controlled 36-run Track A (direct APIs, one scaffold) is bought next. Track B agents run with model, filesystem, shell, compiler, tests, documentation and the task statement only: web and search tools, MCP, skills, custom agents, subagents, external memory and global instructions are disabled where the product allows. Track B results never label models by capability; they describe how Aji behaves on three different agent stacks. Shell commands run without network in every agent. Track B reports success, time, tool calls and context, but no cost in dollars: on subscriptions there is no honest cost per solution, so H5 economics stays with Track A. The 18 cells run sequentially, in an order shuffled once at freeze time, each with a fresh HOME and workspace; nothing is changed until the last result, and observations go to a journal. The first question afterwards is vertical: does the same native agent become more reliable, or need less, moving from Rust/Zig to Aji/AIR — with the cheapest stack (GLM) as the earliest indicator of Model Capability Compression.
---
+3 -3
View File
@@ -93,13 +93,13 @@ Evaluation runs alongside the phases; each stage starts when the language featur
| ID | Status | Task | Depends | Done when |
|---|---|---|---|---|
| E0-1 | done | Define the Agent Reference Bundle (spec 14 §3.7) and a deterministic size measurement (bytes and tokens) recorded per release | — | `docs/agent/bundle.txt`, `zig build agent-reference`, `tools/agent_bundle_tokens.py`; Phase 2 baseline recorded; measured in CI |
| E0-2 | todo | (owner; in parallel with Phase 3, outside this repository) Private benchmark repository: task specs, evaluators, reference implementations, hidden tests for T01–T04; dev/validation/test split | — | evaluator hashes published; nothing hidden in this repository |
| E0-2 | todo | (owner, outside this repository and outside the language developer's conversation) Private benchmark repository: a benchmark-authoring agent in a clean context designs the two smoke tasks from the brief in `docs/evaluation/benchmark-authoring.md`; later T01–T04; dev/validation/test split | — | evaluator hashes published; nothing hidden in this repository |
| E0-3 | done | Language-neutral agent scaffold and run recorder (protocol §5, §28) | — | `tools/eval/`, `docs/evaluation/harness.md`; one loop drives Aji, Rust and Zig (self-tests on `dev-echo`); every run record complete |
| E0-4 | todo | Rust and Zig baseline solutions and pinned local documentation | E0-2 | baselines pass the hidden tests |
| E-C | todo | Model calibration: models labelled M1–M3 run 5–10 neutral coding tasks unrelated to Aji in `tools/eval`; classes assigned from scores; live `dev-echo` per model (protocol §2, §39a) | E0-3 | calibration report; model IDs, endpoints and reasoning modes frozen |
| E-G | todo | Smoke gates: Rust, Zig and hand-written Aji references pass the frozen evaluators; task-statement and hidden-test review (protocol §39a) | E0-2, E0-4 | all gates pass |
| E-G | todo | Gate before E-N (and later E-S): private tasks reviewed; evaluator, task and evaluator hashes frozen; Rust, Zig and Aji/AIR references written by separate clean agents pass; Aji commit, bundle, toolchains and docs frozen with `ajieval freeze` (checklist in `docs/evaluation/benchmark-authoring.md`) | E0-2, E0-4 | all gates pass |
| E-S | todo | Engineering smoke test, Track A: 2 families (binary/stream parser, concurrent bounded pipeline) × 3 languages × 3 models (M1–M3) × 2 runs = 36 runs on one Aji commit (protocol §39a); plan shape `docs/evaluation/smoke-plan.example.json`; failures classified by cause after the matrix, before any language change | E-C, E-G | harness, bundle sufficiency, accounting and traces verified |
| E-N0 | done | Native dev-echo gate (Aji/AIR): Codex + `gpt-6.1-sol` (effort high), Claude Code + `claude-opus-5-5` (effort high), OpenCode + `zai-coding-plan/glm-5.3-flash` all accepted; versions and model IDs in the run records | E0-3 | `ajieval native` |
| E-N0 | done | Native dev-echo gate (Aji/AIR): Codex + `gpt-6.1-sol` (effort high), Claude Code + `claude-opus-5-5` (effort high), OpenCode + `zai-coding-plan/glm-5.3-flash` all accepted; networkless shell for all three verified by `dev-netprobe`; context metrics (provider / cumulative / unique reference) | E0-3 | `ajieval native`, `ajieval freeze`, `ajieval journal` |
| E-N | todo | Track B native smoke, first experiment (owner decision): 2 tasks × 3 languages × 3 native agents (N1–N3) × 1 run = 18 runs on subscriptions (protocol §39b); never evidence for H4; plan shape `docs/evaluation/native-smoke-plan.example.json` | E-N0, E0-2, E-G | native-agent report; failures classified before any language change |
| E-A | todo | Stage A pilot (condition `Aji/AIR`): T01–T04 families × Aji/Rust/Zig × 3 model classes × 3 runs = 108 runs (protocol §39); not headline evidence | E-S, basic Phase 3 | pilot report: effect size, broken tasks, cost, instrumentation |
| E-B | todo | Stage B: T05–T07 | Phase 3 | stage report |