P6A-8: Source Reference Bundle and harness profile aji_source

- source bundle: a /docs directory with QUICK.md (Quick Reference plus a
  where-to-read table), language/*.md, diagnostics/errors.md and the AIR
  bundle only under air/; built from docs/agent/source-bundle.txt
  (> output files, @manifest includes) by zig build agent-reference
- Quick Reference examples are checked: every aji block must be an
  excerpt of a conformance program in tests/conformance/source/quickref
  (zig build test fails otherwise); QR fixes found by the check
  (mut d = data, region not auto-borrowed, statement/borrow blocks that
  could not verify, io_error match)
- frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006
- aji lower --stats: mechanical_air_eliminated_raw and _normalized (each
  byte-string materialization counted as one constant; spec 15 §11)
- harness: profile aji_source (doc_groups), per-file and per-group docs
  metrics on distinctive lines, profile columns (tool calls, lowered AIR
  raw/normalized, docs files read, IR-form and type-mismatch counts),
  dev-echo aji_source variant, scripted run and test, source token report
- plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block
  deferred
This commit is contained in:
dev committed 2026-10-05 13:16:51 +03:00
1 parent 61be766634
commit 3e2d9b63a7
35 files changed
+1170 -106

No files matched your search

+17 -2
View File
@@ -99,7 +99,7 @@ The harness calls `CMD WORKSPACE LANGUAGE TASK_DIR` outside the agent's sandbox.
| Variable | Contents |
|---|---|
| `AJIEVAL_LANGUAGE` | `aji_air`, `rust` or `zig` |
| `AJIEVAL_LANGUAGE` | `aji_air`, `aji_source`, `rust` or `zig` |
| `AJIEVAL_TOOLCHAIN_PATH` | the toolchain's PATH entries, `:`-separated |
| `AJIEVAL_TOOLCHAIN_DIRS` | the directories to bind read-only, one per line |
@@ -224,6 +224,21 @@ A first-generation snapshot is not available in Track B. There is no cost in dol
| `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 |
| `docs` | for a documentation directory (the Source Reference Bundle of `aji_source`), per file and per group of the profile's `doc_groups`; see below |
**Directory documentation (`metrics.context.docs`).**
| Field | Meaning |
|---|---|
| `quick_reference_tokens`, `source_docs_tokens`, `air_docs_tokens` | size of each group (`<group>_tokens`) |
| `full_source_docs_tokens` | every group except `air_docs` |
| `read_tokens_by_group` | tokens of the group's lines that the agent saw |
| `coverage_by_section` | per file: the fraction of its distinctive lines that the agent saw |
| `files_opened`, `unique_docs_read` | the files whose `/docs/…` path occurs in a tool input, and how many there are |
A line is *distinctive* when no other file of the mount contains it. A line seen in a tool output counts toward a group only if every file containing it belongs to that group. This keeps table rules, fences and sections copied into several files out of the attribution: the error-code table, for instance, is in both `diagnostics/` and `air/`.
**Task variants for `aji_source`.** A task supports the condition through a `languages.aji_source` entry: a starter workspace whose README names `main.aji` and the `main` signature, and a public test. `in` is a keyword in `.aji`, so a source entry point names that capability `input`, and the grant becomes `--grant input=io.read`. Example: [`dev-tasks/dev-echo/lang/aji_source/`](dev-tasks/dev-echo/lang/aji_source/). The evaluator gets `AJIEVAL_LANGUAGE=aji_source` and runs `aji check`/`aji run` on `main.aji`.
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.
@@ -234,7 +249,7 @@ python3 -m ajieval freeze PLAN.json # PLAN.freeze.json: frozen state + rand
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]
python3 -m ajieval summary RUNS_DIR # shareable: PASS/FAIL matrix, per-cell metrics, aggregates
python3 -m ajieval profile RUNS_DIR # shareable: termination, output tokens, solution size, diagnostic-code occurrences
python3 -m ajieval profile RUNS_DIR # shareable: termination, output tokens, tool calls, solution size, lowered AIR size (aji_source), docs files read, IR-form and type-mismatch diagnostic counts, diagnostic-code occurrences
```
In Track B the repair metrics are derived from the transcript's shell commands, with their exit codes and outputs: