@agentskit/doc-bridge 1.7.45 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +488 -0
- package/CONTRIBUTING.md +23 -0
- package/README.md +87 -40
- package/SECURITY.md +7 -0
- package/action.yml +1 -1
- package/bin/ak-docs.js +2 -2
- package/bin/ak-verify.js +13 -7
- package/dist/cli/program.d.ts +3 -1
- package/dist/cli/program.js +15871 -6218
- package/dist/cli/program.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +95 -6
- package/dist/config/index.js.map +1 -1
- package/dist/{index-BUL0q7s8.d.ts → index-7wYGbllW.d.ts} +134 -1
- package/dist/index.d.ts +9880 -1062
- package/dist/index.js +16143 -6127
- package/dist/index.js.map +1 -1
- package/docs/MARKETPLACE.md +1 -1
- package/docs/PRD-documentation-efficiency-study.md +406 -0
- package/docs/PRD-knowledge-retrieval-and-enrichment.md +466 -0
- package/docs/adr/0002-documentation-audit-boundary.md +22 -0
- package/docs/adr/0003-study-protocol-and-historical-evidence.md +40 -0
- package/docs/adr/0004-controlled-study-runner.md +25 -0
- package/docs/adr/0005-documentation-quality-and-criticality.md +20 -0
- package/docs/adr/0006-registry-semantic-grounding.md +20 -0
- package/docs/adr/0007-longitudinal-study-metrics.md +21 -0
- package/docs/adr/0008-study-verification-boundary.md +21 -0
- package/docs/adr/0009-study-provider-cli-adapter.md +25 -0
- package/docs/agent-corpus/INDEX.md +12 -1
- package/docs/agent-corpus/OVERVIEW.md +25 -0
- package/docs/agent-corpus/chat.md +5 -1
- package/docs/agent-corpus/cli.md +16 -0
- package/docs/agent-corpus/conformance.md +12 -0
- package/docs/agent-corpus/doc-bridge.md +47 -0
- package/docs/agent-corpus/doctor.md +8 -0
- package/docs/agent-corpus/gates.md +4 -0
- package/docs/agent-corpus/mcp.md +13 -0
- package/docs/agent-corpus/memory.md +4 -0
- package/docs/agent-corpus/query.md +33 -0
- package/docs/bench/README.md +122 -0
- package/docs/bench/retrieval-baseline-v1.json +28 -0
- package/docs/bench/retrieval-suite-v1.json +1033 -0
- package/docs/chat-and-rag.md +3 -2
- package/docs/for-agents.md +9 -1
- package/docs/getting-started.md +4 -11
- package/docs/guides/gate-ci.md +11 -1
- package/docs/guides/install-and-run.md +9 -65
- package/docs/index.md +22 -1
- package/docs/knowledge-engine-runbook.md +38 -3
- package/docs/landing/assets/context-payload-reduction.svg +21 -0
- package/docs/landing/assets/controlled-ab-comparison.svg +30 -0
- package/docs/landing/index.html +119 -5
- package/docs/loop-workflow.md +117 -0
- package/docs/mcp.md +6 -1
- package/docs/parity/public-claims-v1.json +145 -0
- package/docs/playbook/doc-bridge-pattern.md +1 -1
- package/docs/query.md +90 -2
- package/docs/recipes/index-pipeline.md +1 -1
- package/docs/schemas/agent-handoff-v1.md +15 -0
- package/docs/schemas/doc-bridge-index-v1.md +65 -0
- package/docs/spec/benchmark-v1.md +33 -1
- package/docs/spec/cli.md +30 -10
- package/docs/spec/config-v1.md +157 -8
- package/docs/spec/documentation-audit-v1.md +61 -0
- package/docs/spec/enrichment-overlay-v1.md +241 -0
- package/docs/spec/graph-signals-v1.md +92 -0
- package/docs/spec/incremental-scan-v1.md +102 -0
- package/docs/spec/markdown-analyzer-v1.md +73 -0
- package/docs/spec/mcp-knowledge-tools-v1.md +147 -0
- package/docs/spec/measured-enrichment-v1.md +229 -0
- package/docs/spec/public-parity-v1.md +119 -0
- package/docs/spec/registry-agents.md +6 -0
- package/docs/spec/render-v1.md +122 -0
- package/docs/spec/retrieval-index-v1.md +164 -0
- package/docs/spec/study-metrics-v1.md +58 -0
- package/docs/spec/study-protocol-v1.md +46 -0
- package/docs/spec/study-provider-cli-v1.md +116 -0
- package/docs/spec/study-runner-v1.md +35 -0
- package/docs/spec/study-task-suite-v1.md +41 -0
- package/docs/spec/study-verification-v1.md +40 -0
- package/docs/study/README.md +84 -0
- package/docs/study/ab-adjudicated-cost-analysis-v1.md +29 -0
- package/docs/study/ab-adjudicated-cost-plan-v1.json +33 -0
- package/docs/study/ab-adjudicated-cost-plan-v2-v1.json +33 -0
- package/docs/study/ab-adjudicated-cost-result-v1.json +80 -0
- package/docs/study/ab-baseline-analysis-v1.md +21 -0
- package/docs/study/ab-baseline-plan-v1.json +33 -0
- package/docs/study/ab-baseline-recovery-plan-v1.json +33 -0
- package/docs/study/ab-baseline-result-v1.json +79 -0
- package/docs/study/documentation-audit-round-2026-08-31.json +183 -0
- package/docs/study/historical-evidence-v1.json +252 -0
- package/docs/study/observation-ledger-v1.json +30632 -0
- package/docs/study/phase3-task-coverage-v1.json +34 -0
- package/docs/study/phase4-public-pilot-ledger-v1.json +1344 -0
- package/docs/study/phase4-public-pilot-result-v1.json +52 -0
- package/docs/study/phase4-public-pilot-run-plan-v1.json +26 -0
- package/docs/study/phase4-public-pilot-task-suite-v1.json +71 -0
- package/docs/study/pilot-round-2026-08-31.json +46 -0
- package/docs/study/protocol-v1.json +90 -0
- package/docs/study/publication-gate-v1.md +45 -0
- package/docs/study/quality-scorecard-cycle-plan.md +545 -0
- package/docs/study/quality-scorecard-v1.json +38 -0
- package/docs/study/round-1-adjudicated-smoke-v1.json +30642 -0
- package/docs/study/round-1-instrumentation-plan-v1.md +39 -0
- package/docs/study/round-2-expanded-adjudication-v1.json +91 -0
- package/docs/study/round-2-expanded-validation-v1.md +58 -0
- package/docs/study/round-3-evidence-contract-v1.json +75 -0
- package/docs/study/round-3-evidence-contract-v1.md +57 -0
- package/docs/study/round-4-confirmation-v1.json +75 -0
- package/docs/study/round-4-confirmation-v1.md +55 -0
- package/docs/study/run-plan-v1.json +33 -0
- package/docs/study/semantic-adjudication-cycle-8.md +20 -0
- package/docs/study/task-suite-v1.json +96 -0
- package/docs/study/token-efficiency-plan-v1.md +337 -0
- package/docs/study/token-efficiency-protocol-v2.json +62 -0
- package/docs/study/verification-binding-v1.json +27 -0
- package/docs/validation-cycle-plan.md +14 -0
- package/docs/verification-harness.md +11 -6
- package/ecosystem-claims.json +2 -2
- package/ecosystem-upstream.json +2 -2
- package/ecosystem.json +4 -4
- package/mcpb/manifest.json +9 -1
- package/package.json +34 -15
- package/scripts/check-ecosystem-upstream.mjs +34 -6
- package/skills/doc-bridge-handoff/fixtures/synthetic-repo/docs/for-agents/packages/payments.md +7 -0
- package/skills/doc-bridge-handoff/scripts/resolve-handoff.mjs +1 -1
- package/src/agents/registry-adapter.ts +192 -24
- package/src/audit/documentation.ts +513 -0
- package/src/bench/baseline.ts +198 -0
- package/src/bench/overlay-delta.ts +139 -0
- package/src/bench/retrieval.ts +319 -0
- package/src/budget/compile.ts +91 -0
- package/src/budget/sections.ts +70 -0
- package/src/cli/program.ts +684 -74
- package/src/cli/usage.ts +71 -0
- package/src/config/defaults.ts +1 -0
- package/src/config/index.ts +4 -0
- package/src/config/schema.ts +126 -2
- package/src/conformance/documentation-standard-v1.ts +8 -6
- package/src/discovery/areas.ts +197 -0
- package/src/discovery/documentation.ts +211 -5
- package/src/discovery/identity.ts +24 -0
- package/src/discovery/incremental.ts +314 -0
- package/src/discovery/inputs.ts +110 -0
- package/src/discovery/markdown.ts +481 -0
- package/src/discovery/repository.ts +485 -101
- package/src/doctor/run-doctor.ts +244 -12
- package/src/enrich/approvals.ts +190 -0
- package/src/enrich/cache.ts +93 -0
- package/src/enrich/context-pack.ts +272 -0
- package/src/enrich/overlay.ts +255 -0
- package/src/enrich/review.ts +106 -0
- package/src/enrich/stage.ts +374 -0
- package/src/enrich/stats.ts +100 -0
- package/src/enrich/validate.ts +410 -0
- package/src/federation/llms.ts +2 -4
- package/src/findings/report.ts +103 -0
- package/src/graph/build.ts +356 -0
- package/src/graph/memory.ts +208 -0
- package/src/index-builder/build-handoffs.ts +22 -11
- package/src/index-builder/build-index.ts +132 -3
- package/src/index-builder/llms-txt.ts +48 -8
- package/src/index-builder/project-corpus.ts +111 -0
- package/src/index.ts +630 -2
- package/src/lib/fuzzy-match.ts +235 -0
- package/src/mcp/knowledge.ts +554 -0
- package/src/mcp/server.ts +113 -18
- package/src/metrics/benchmark.ts +21 -0
- package/src/parity/check.ts +309 -0
- package/src/parity/claims.ts +259 -0
- package/src/parity/resolve.ts +160 -0
- package/src/query/handoff.ts +326 -0
- package/src/query/load-index.ts +53 -1
- package/src/query/query.ts +92 -59
- package/src/query/search.ts +289 -92
- package/src/query/text.ts +155 -0
- package/src/reconciliation/reconcile.ts +101 -10
- package/src/render/data.ts +356 -0
- package/src/render/engine.ts +398 -0
- package/src/render/generated.ts +77 -0
- package/src/render/render.ts +209 -0
- package/src/render/template-source.ts +52 -0
- package/src/render/templates.ts +289 -0
- package/src/report/html.ts +2 -2
- package/src/retrieval/bm25.ts +161 -0
- package/src/retrieval/project.ts +495 -0
- package/src/retrieval/rank.ts +383 -0
- package/src/retrieval/weights.ts +39 -0
- package/src/retriever/doc-bridge-retriever.ts +100 -15
- package/src/rules/engine.ts +30 -10
- package/src/schemas/agent-handoff.ts +56 -0
- package/src/schemas/budget.ts +37 -0
- package/src/schemas/doc-bridge-index.ts +53 -2
- package/src/schemas/enrichment.ts +369 -0
- package/src/schemas/json-schemas.ts +39 -2
- package/src/schemas/knowledge.ts +14 -1
- package/src/schemas/retrieval-index.ts +152 -0
- package/src/shims/graphology.d.ts +91 -0
- package/src/study/adjudication.ts +196 -0
- package/src/study/execution.ts +350 -0
- package/src/study/expectations.ts +219 -0
- package/src/study/metrics.ts +467 -0
- package/src/study/protocol.ts +271 -0
- package/src/study/provider-cli.ts +115 -0
- package/src/study/provider-telemetry.ts +47 -0
- package/src/study/quality-scorecard.ts +164 -0
- package/src/study/runner.ts +461 -0
- package/src/study/task-suite.ts +321 -0
- package/src/study/verification.ts +134 -0
- package/src/validate.ts +1 -4
- package/src/version.ts +1 -1
- package/src/workflow/engine.ts +36 -11
- package/scripts/verification-harness.mjs +0 -482
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Longitudinal study metrics v1
|
|
3
|
+
description: Deterministic, content-addressed comparison of controlled study rounds.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Longitudinal study metrics v1
|
|
7
|
+
|
|
8
|
+
`ak-docs study metrics <observation-ledger.json>` calculates an anonymization-safe report from `ControlledStudyObservationV1` records. It groups observations by task, repository, category, difficulty, model, scenario, replicate, and aggregate, then compares the selected baseline and current rounds. When a round contains retries or recovery runs, pass `--baseline-run-id` and `--current-run-id` to bind each side to an exact run without rewriting ledger history.
|
|
9
|
+
|
|
10
|
+
When both sides intentionally share one round (for example, two arms of a pairwise run), the same-round selection keeps only the explicitly named run IDs. A same-round report exposes the scenario groups for arm-level analysis; it does not manufacture a round comparison.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
ak-docs study metrics docs/study/observation-ledger-v1.json --text
|
|
14
|
+
ak-docs study metrics docs/study/observation-ledger-v1.json --baseline-round baseline --current-round cycle-1 --json
|
|
15
|
+
ak-docs study metrics docs/study/observation-ledger-v1.json --baseline-round baseline --baseline-run-id baseline-run-01 --current-round cycle-1 --current-run-id cycle-1-run-01 --json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Metric contract
|
|
19
|
+
|
|
20
|
+
The report keeps metric families separate. Counts are sums, rates are weighted ratios or means as stated below, and latency/answer-cost distributions use p95.
|
|
21
|
+
|
|
22
|
+
| Family | Metrics | Collection |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Discovery/context | `providerTokens`, `estimatedTokens`, `tokensToCorrectAnswerP95`, `timeToCorrectAnswerP95Ms`, `contextBytesP95`, `responseBytesP95`, `searchHitRate`, `evidenceCitationRate`, `averageToolCalls`, `clarificationRate` | provider or explicitly labeled observation measurements |
|
|
25
|
+
| Task/delivery | `successRate`, `completedRate`, `acceptanceCheckRate`, `errorRate`, `reworkRate`, `safetyRate` | adjudication and observation measurements |
|
|
26
|
+
| Documentation | `documentationFindingCount`, `documentationExampleRate`, `documentationFreshnessRate`, `documentationCorrectnessRate`, `documentationCompletenessRate`, `documentationClarityRate`, `documentationMaintainabilityRate` | audit or human/adjudicator measurements |
|
|
27
|
+
| Operations/cost | `latencyP95Ms`, `analysisCostUsd`, `agentCostUsd`, `adjudicatorCostUsd`, `totalCostUsd`, `providerTokenCostUnits`, `adjudicatorTokenCostUnits` | runner and explicitly labeled cost measurements |
|
|
28
|
+
|
|
29
|
+
Provider token totals and estimated token totals are never combined. An estimate is valid only when the observation says `tokenMethod: estimate`. Known values are retained in partial totals; if any observation is missing a value, the metric is marked with a `-partial` entry in `missingMetrics` and must not be used as a complete-round comparison. A value that was not collected at all is `null`, listed in `missingMetrics`, and excluded from its denominator.
|
|
30
|
+
|
|
31
|
+
Observations may carry additional bounded numeric values in `measurements`. The reserved keys above have the following meanings:
|
|
32
|
+
|
|
33
|
+
- `searchHitRate`, `errorRate`, and documentation `*Rate` values are ratios from `0` to `1`.
|
|
34
|
+
- `acceptanceChecksPassed` and `acceptanceChecksTotal` form a weighted acceptance ratio.
|
|
35
|
+
- `documentationFindingCount`, `analysisCostUsd`, `agentCostUsd`, `adjudicatorCostUsd`, `providerTokenCostUnits`, and `adjudicatorTokenCostUnits` are additive values. Token-unit fields are one unit per provider-reported input or output token and are not currency values. USD fields are valid only when the run records configured rates and provider-reported usage.
|
|
36
|
+
- `safetyOutcome` is preferred for the safety rate; `safe` is `1`, `unsafe` is `0`, and `not-applicable` is excluded.
|
|
37
|
+
|
|
38
|
+
## Comparison rules
|
|
39
|
+
|
|
40
|
+
Each comparison contains baseline and current values, absolute change, relative change when the baseline is non-zero, sample sizes, limitations, and one of `improved`, `unchanged`, `regressed`, `inconclusive`, or `not-analyzed`.
|
|
41
|
+
|
|
42
|
+
- Fewer tokens, lower latency, less context, fewer clarifications, less rework, and lower cost are directionally better.
|
|
43
|
+
- Higher success, evidence, safety, acceptance, search-hit, and documentation-quality rates are directionally better.
|
|
44
|
+
- A lower-efficiency value cannot make a round `improved` when success, evidence citation, evidence quality, acceptance, safety, or rework regresses.
|
|
45
|
+
- A comparison with fewer than two observations on either side is `inconclusive`, not a pass.
|
|
46
|
+
- Missing baseline/current groups are `not-analyzed`; the calculator does not invent values or backfill historical data.
|
|
47
|
+
|
|
48
|
+
Wilson 95% intervals are emitted for completion and task success rates. They communicate uncertainty; they do not establish causality. Aggregate results must be read with the subgroup results because model, scenario, repository, task difficulty, and documentation changes can confound a round.
|
|
49
|
+
|
|
50
|
+
## Provenance and immutability
|
|
51
|
+
|
|
52
|
+
The report is normalized and content-hashed with `sha256-normalized-v1`. JSON and text output expose the same group/comparison metric values and report hash. Calculating metrics never writes or replaces a baseline. Baseline approval and replacement remain explicit, audited harness operations.
|
|
53
|
+
|
|
54
|
+
The report contains identifiers, versions, hashes, counts, timings, and classifications only. It must not contain repository contents, private paths, prompts, credentials, or raw agent responses.
|
|
55
|
+
|
|
56
|
+
The CLI exits non-zero for a comparison classified as `regressed`. Structural verification that only checks report generation may pass `--allow-regressions`; regressions remain present in the report and should still fail a quality gate that is intended to enforce improvement.
|
|
57
|
+
|
|
58
|
+
The first anonymized deterministic documentation snapshot is [Audit round 2026-08-31](../study/documentation-audit-round-2026-08-31.json). It is an observational inventory, not the controlled baseline: all six consumers still require semantic review, and its missing metrics must remain missing rather than being inferred.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Study protocol v1
|
|
3
|
+
description: Versioned and anonymization-safe contracts for measuring documentation quality and agent efficiency.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Study protocol v1
|
|
7
|
+
|
|
8
|
+
Phase 0 defines two content-addressed JSON artifacts:
|
|
9
|
+
|
|
10
|
+
- `StudyProtocolV1` defines the population, evidence classes, task categories, model slots, scenarios, metrics, executable outcome checks, budget, privacy policy, and stopping rules.
|
|
11
|
+
- `HistoricalEvidenceRegistryV1` preserves historical observations, available numeric measurements, explicit missing measurements, limitations, and validation state.
|
|
12
|
+
|
|
13
|
+
The contracts are validated by the real Doc Bridge CLI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ak-docs study protocol docs/study/protocol-v1.json --text
|
|
17
|
+
ak-docs study history docs/study/historical-evidence-v1.json --protocol docs/study/protocol-v1.json --text
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Both artifacts contain a SHA-256 normalized content hash. A hash mismatch, unknown cross-reference, duplicate identifier, unsafe public field, or incompatible schema fails closed.
|
|
21
|
+
|
|
22
|
+
## Evidence classes
|
|
23
|
+
|
|
24
|
+
`historical` records preserve observations from prior cycles. They may show evolution but cannot support causal claims because the task suite, models, and metrics were not fixed.
|
|
25
|
+
|
|
26
|
+
`controlled` records belong to the approved benchmark protocol and can be compared only when the source revision, protocol, model, scenario, and validation contract match.
|
|
27
|
+
|
|
28
|
+
## Outcome coverage
|
|
29
|
+
|
|
30
|
+
Every protocol outcome must map to one or more executable checks. An outcome outside the current phase must instead declare an explicit `notApplicableReason`; an empty mapping is never silently accepted.
|
|
31
|
+
|
|
32
|
+
## Privacy contract
|
|
33
|
+
|
|
34
|
+
Public study artifacts use anonymized repository identifiers. They do not contain repository contents, paths, prompts, credentials, private identifiers, or raw agent responses. Publication always requires human review. The schema deliberately uses bounded identifiers and safe source references instead of arbitrary URLs or file paths.
|
|
35
|
+
|
|
36
|
+
## Missing data
|
|
37
|
+
|
|
38
|
+
Unavailable historical metrics are represented in `missingMetrics` with one of `missing`, `not-analyzed`, `blocked`, or `not-applicable` plus a reason. The importer never derives a missing value from another metric.
|
|
39
|
+
|
|
40
|
+
## Protocol changes
|
|
41
|
+
|
|
42
|
+
Changing task definitions, metric formulas, model identity, scenario behavior, privacy rules, or validation requirements changes the protocol hash. Existing baseline and historical evidence remains immutable; a changed protocol starts a new controlled evidence series.
|
|
43
|
+
|
|
44
|
+
## Human authority
|
|
45
|
+
|
|
46
|
+
The protocol and historical registry can be discovered and summarized by agents, but agents cannot approve protocol changes, replace a baseline, adjudicate their own output, or publish a report. Those actions remain human-gated through the verification harness.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Study provider CLI contract v1
|
|
3
|
+
description: Generic, bounded command contract for model and agent execution in controlled studies.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Study provider CLI contract v1
|
|
7
|
+
|
|
8
|
+
The provider adapter lets a study use a hosted model CLI, a vendor CLI, or an AgentsKit Registry agent without adding that provider to Doc Bridge. It does not install a model runtime and does not assume Ollama.
|
|
9
|
+
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
Create a content-addressed configuration with `createStudyProviderCliConfig` or validate one with:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
ak-docs study providers path/to/provider-cli.json --text
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Each provider entry contains:
|
|
19
|
+
|
|
20
|
+
| Field | Meaning |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `modelId` | Must match one pinned model in the run plan. |
|
|
23
|
+
| `scenarioIds` | One or more of `repository-only`, `deterministic-doc-bridge`, `registry-assisted`. |
|
|
24
|
+
| `command` | Executable name or path. It is launched without a shell. |
|
|
25
|
+
| `args` | Ordered arguments passed unchanged to the executable. |
|
|
26
|
+
| `envAllowlist` | Names copied from the parent environment. Credentials must be named explicitly. |
|
|
27
|
+
| `providerNetwork` | Audit declaration that the provider may send input to an external service. |
|
|
28
|
+
| `maxInputBytes` / `maxOutputBytes` | Provider-specific bounds; the lower bound wins against the run-plan budget. |
|
|
29
|
+
| `pricing` | Optional configured USD rates used only to derive auditable `agentCostUsd`; omitted rates produce no currency claim. |
|
|
30
|
+
|
|
31
|
+
The optional top-level `adjudicator` uses the same bounded command fields and adds `id` and `modelId`. It is a separate process from the provider under evaluation. Its output is used to record an independent rubric decision; the provider cannot approve its own result.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"adjudicator": {
|
|
36
|
+
"id": "independent-reviewer",
|
|
37
|
+
"modelId": "reference-model",
|
|
38
|
+
"command": "/absolute/path/to/adjudicator",
|
|
39
|
+
"args": [],
|
|
40
|
+
"envAllowlist": [],
|
|
41
|
+
"providerNetwork": true,
|
|
42
|
+
"maxInputBytes": 1000000,
|
|
43
|
+
"maxOutputBytes": 50000,
|
|
44
|
+
"pricing": {
|
|
45
|
+
"currency": "USD",
|
|
46
|
+
"inputPerMillionUsd": 1,
|
|
47
|
+
"cachedInputPerMillionUsd": 0.5,
|
|
48
|
+
"outputPerMillionUsd": 3
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The cost formula is `(uncached input × input rate + cached input × cached rate + output × output rate) / 1,000,000`. Rates are study configuration, not a vendor billing assertion; the report must preserve the configuration hash and run ID. Cost is emitted only when the process reports both input and output token counts. `providerTokenCostUnits` remains the provider-reported input plus output total and is never presented as currency.
|
|
55
|
+
|
|
56
|
+
The parser rejects stale content hashes, duplicate model/scenario mappings, unsafe environment names, and invalid command arguments. A command must exist and be executable before any task starts.
|
|
57
|
+
|
|
58
|
+
## Provider process contract
|
|
59
|
+
|
|
60
|
+
The child process receives one JSON request on stdin and must emit exactly one JSON object on stdout. Human-readable logs must go to stderr. The request contains the task, scenario, expected outcome, evidence requirements, acceptance checks, allowed tools, and forbidden actions. It does not contain the configured repository path.
|
|
61
|
+
|
|
62
|
+
The generic runner does not enforce scenario tool semantics. A provider mapping must enforce its own scenario contract: a `repository-only` command must not query Doc Bridge, while a `deterministic-doc-bridge` command must execute the configured deterministic query or handoff and pass its bounded result to the model. A scenario label or `allowedTools` field alone is not evidence that Doc Bridge was used.
|
|
63
|
+
|
|
64
|
+
The response may contain the bounded metrics below. Unknown fields are ignored by the generic runner, while unknown numeric measurements are preserved by the observation schema for future metric versions. The bundled Codex adapter additionally passes a JSON Schema to the provider CLI and requires the semantic fields (`taskOutcome`, `evidenceQuality`, `safetyOutcome`, evidence IDs, clarification/rework counts, an observed latency or explicit `null`, and measurements) so missing output is visible as a provider failure rather than silently becoming an empty result. When observed, measurements must use canonical names: `searchHitRate`, `acceptanceChecksPassed`, `acceptanceChecksTotal`, `errorRate`, `documentationFindingCount`, the documentation `*Rate` fields, `analysisCostUsd`, and `agentCostUsd`.
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"inputTokens": 1200,
|
|
69
|
+
"outputTokens": 340,
|
|
70
|
+
"tokenMethod": "provider",
|
|
71
|
+
"toolCalls": 4,
|
|
72
|
+
"firstEvidenceLatencyMs": 820,
|
|
73
|
+
"taskOutcome": "success",
|
|
74
|
+
"evidenceQuality": "high",
|
|
75
|
+
"safetyOutcome": "safe",
|
|
76
|
+
"evidenceIds": ["artifact-hash:abc123"],
|
|
77
|
+
"clarificationRequests": 0,
|
|
78
|
+
"reworkCount": 0,
|
|
79
|
+
"measurements": {
|
|
80
|
+
"searchHitRate": 1,
|
|
81
|
+
"timeToCorrectAnswerP95Ms": 820
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Raw prompts, responses, repository contents, paths, and credentials are not written to the observation ledger. The ledger stores status, hashes, timing, labeled token counts, context-token attribution, first-evidence latency when observed, tool counts, metric fields, and automated or pending human adjudication. The runner derives `providerTokenCostUnits` from provider-reported input plus output tokens; this is a transparent token-equivalent cost metric and must not be presented as currency. Context-token estimates are stored separately with `contextTokenMethod: "estimate"`; they are never combined with provider usage.
|
|
87
|
+
|
|
88
|
+
The bundled Codex adapter also records privacy-safe aggregate context telemetry: `observedToolEventCount`, `observedToolInputBytes`, `observedToolOutputBytes`, `observedProviderInputBytes`, `observedAgentMessageBytes`, `observedContextBytes`, `observedProviderDurationMs`, and (when a tool event is observed) `timeToFirstToolEventMs`. These are byte counts and durations only; commands, paths, prompts, responses, and repository content are not emitted by the adapter. The duration is wall-clock time for the isolated provider process, while `timeToFirstToolEventMs` measures the first observed tool event, not semantic answer quality. The deterministic handoff is serialized as compact JSON before it is passed to the model, and the adapter explicitly tells the model to use its `startHere` and `readBeforeEditing` paths before exploring the repository. This preserves canonical content while removing formatting-only bytes and makes the intended low-context path measurable. Gzip and a cross-process cache are intentionally not used for model context: the model must receive readable content, and the current adapter starts an isolated process per observation, so either mechanism would add complexity without reducing billed model tokens. The public `--agent` CLI path also emits compact JSON, so machine consumers do not pay for presentation-only whitespace.
|
|
89
|
+
|
|
90
|
+
## Independent adjudication
|
|
91
|
+
|
|
92
|
+
Adjudicate a persisted ledger in a separate process:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ak-docs study adjudicate docs/study/observation-ledger-v1.json docs/study/task-suite-v1.json \
|
|
96
|
+
--adjudicator path/to/provider-cli.json --output .tmp/adjudicated-ledger.json \
|
|
97
|
+
--run-id cycle-1 --offset 24 --limit 24 --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The adjudicator receives only anonymized task metadata and the bounded structured candidate record: outcomes, evidence IDs, per-requirement evidence presence, acceptance execution state, numeric measurements, execution status, duration, and response size. It does not receive repository paths, raw stdout, prompts, repository contents, or credentials. Automated adjudication records the adjudicator configuration hash in addition to its actor and method. A timeout, unavailable command, oversized output, or invalid JSON leaves the adjudication `pending`; no deterministic fallback silently converts that failure into a success. `--offset` and `--limit` support deterministic low-cost samples while preserving all unselected observations in the output ledger; offset counts only observations matching `--run-id`.
|
|
101
|
+
|
|
102
|
+
## Running a study
|
|
103
|
+
|
|
104
|
+
First validate the complete plan without invoking a provider:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
ak-docs study run docs/study/run-plan-v1.json docs/study/task-suite-v1.json \
|
|
108
|
+
--providers path/to/provider-cli.json \
|
|
109
|
+
--repositories path/to/repositories.json \
|
|
110
|
+
--ledger path/to/observation-ledger.json \
|
|
111
|
+
--dry-run --text
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The canonical run plan dry run validates the configured 24-task balanced sample, repository roots, executable commands, and input limits. It writes no ledger and makes no provider call. To execute, omit `--dry-run`. The ledger is persisted after each observation, so an interrupted run can resume and skip completed task executions idempotently. Reduced pilots may use fewer population identifiers and tasks, but require their own hashed suite, run plan, repository configuration, run ID, and explicit pilot label. A full 288-execution matrix requires a separately hashed run plan with `sampling.sampleSize` set to 288.
|
|
115
|
+
|
|
116
|
+
Provider configuration and repository-root configuration are local operational inputs. Do not commit credentials, private paths, raw provider output, or consumer repository content to a publication artifact.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Controlled study runner v1
|
|
3
|
+
description: Isolated, bounded, provenance-preserving execution for the controlled study baseline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Controlled study runner v1
|
|
7
|
+
|
|
8
|
+
`ControlledStudyRunPlanV1` binds a task suite to one source revision, protocol hash, configuration hash, Doc Bridge version, two pinned model configurations, the three study scenarios, and a deterministic sampling policy. A plan is content-addressed and cannot be treated as a baseline merely because it parses.
|
|
9
|
+
|
|
10
|
+
The default `balanced-task-strata` strategy preserves the original study sample. The `pairwise-task-strata` strategy selects exactly two declared scenarios for every selected task/model combination. It is intended for A/B comparisons such as `repository-only` versus `deterministic-doc-bridge`; the task, model, repository, and replicate remain constant across both arms.
|
|
11
|
+
|
|
12
|
+
`runControlledCommand` starts a fresh child process for each attempt with `shell: false`, a unique session identifier, bounded runtime, bounded output, and an explicit retry limit. It records only status, exit metadata, timing, byte counts, hashes, labeled token counts, context-token attribution, first-evidence latency when observed, and tool-call counts. Raw stdout, stderr, prompts, repository content, and credentials are never persisted in an observation.
|
|
13
|
+
|
|
14
|
+
The standard provider process contract is documented in [Study provider CLI contract v1](./study-provider-cli-v1.md). Provider selection is intentionally external to the core runner, so a hosted model CLI or an AgentsKit Registry agent can be used without bundling a local model runtime.
|
|
15
|
+
|
|
16
|
+
The runner recognizes `completed`, `failed`, `timed-out`, `unavailable`, `invalid-output`, and `budget-exceeded` outcomes. An unavailable or invalid Registry agent is evidence of a failed/blocked scenario, never a successful task result. Provider token counts are labeled `provider`; calculated counts must be labeled `estimate`.
|
|
17
|
+
|
|
18
|
+
When a provider reports labeled input and output usage and its configuration contains `pricing`, the runner also records `agentCostUsd` using the configured USD rates. Missing pricing or missing usage remains missing data. Independent adjudication is a separate `study adjudicate` command and records its own actor, method, token usage, and optional `adjudicatorCostUsd`; provider output is never used as its own approval.
|
|
19
|
+
|
|
20
|
+
The current Codex plan uses a calibrated ceiling of `400000` tokens per task. This ceiling was raised only after a real pilot measured `331325` input tokens for a repository-only discovery task; the pilot remains a budget finding and is not counted as a successful observation. The ceiling is a safety bound, not a target, and the study still reports the measured token distribution. The current run selects 24 tasks, one per task, balanced across the six model×scenario strata (four tasks per stratum), and permits one attempt per task to avoid duplicate spend after the pilot showed the cost of retries.
|
|
21
|
+
|
|
22
|
+
`ControlledStudyObservationV1` keeps model, scenario, task, variant, replicate, source, plan, and run provenance together with an automated deterministic or human adjudication state. The runner does not approve semantic results. `upsertControlledStudyObservation` is idempotent for the same run/task and rejects conflicting replacements; ledger hashes make changes detectable. Provider token usage also produces the explicit `providerTokenCostUnits` measurement: one unit is one provider-reported input or output token, not a currency claim. `contextTokens` is paired with `contextTokenMethod`; the default runner value is a byte-based estimate (`ceil(contextBytes / 4)`) and is never presented as provider usage. `firstEvidenceLatencyMs` is optional because a provider must not invent it.
|
|
23
|
+
|
|
24
|
+
An observation may also record `round`, `taskOutcome`, `evidenceQuality`, `safetyOutcome`, `clarificationRequests`, `reworkCount`, and bounded numeric `measurements`. The measurement envelope is extensible; the v1 metrics calculator reserves names for search hit rate, acceptance checks, errors, documentation findings/examples/freshness/quality, and analysis or Registry-agent cost. Unknown measurements are preserved for future metric versions but are not interpreted automatically.
|
|
25
|
+
|
|
26
|
+
Validate and inspect the committed plan and ledger with:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ak-docs study plan docs/study/run-plan-v1.json --text
|
|
30
|
+
ak-docs study ledger docs/study/observation-ledger-v1.json --text
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use `ak-docs study run ... --dry-run` with a provider CLI configuration and one local repository root per declared population identifier to validate the planned sample before execution. A real run requires those explicit operational inputs and persists the ledger after each observation for recovery. For a pairwise run, set `sampling.strategy` to `pairwise-task-strata`, list two `sampling.scenarioIds`, and set `sampling.sampleSize` to a multiple of the model/scenario stratum count. The canonical pairwise matrix for 24 tasks and two models is 96 observations; a reduced pilot must use a separately hashed run plan and run ID and must be reported as pilot evidence.
|
|
34
|
+
|
|
35
|
+
The committed ledger contains pilot, reduced-sample, and failed structured-provider observations. Failed observations remain immutable evidence; a recovered provider run must use a new run identifier and must not overwrite them. Use a new round identifier when the recovery is a separate experimental round; same-round recovery is valid only when the report explicitly selects the run IDs.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Study task suite v1
|
|
3
|
+
description: A fixed, anonymization-safe task and adjudication contract for controlled study baselines.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Study task suite v1
|
|
7
|
+
|
|
8
|
+
`docs/study/task-suite-v1.json` is the canonical Phase 1 controlled task contract. It contains exactly four bounded tasks (discovery, architecture, documentation, and implementation) for each population identifier. The checked-in canonical artifact uses six stable anonymized consumer identifiers and therefore contains 24 tasks; reduced public pilots may declare a smaller population without changing the canonical artifact.
|
|
9
|
+
|
|
10
|
+
The suite is a definition, not evidence that a task was executed. Execution records belong to a later observation ledger and must retain the suite hash, protocol hash, source revision, model, scenario, replicate, and verification run ID.
|
|
11
|
+
|
|
12
|
+
## Required task fields
|
|
13
|
+
|
|
14
|
+
Every task declares:
|
|
15
|
+
|
|
16
|
+
- objective and initial context;
|
|
17
|
+
- allowed tools and forbidden actions;
|
|
18
|
+
- expected outcome, evidence requirements, and acceptance commands;
|
|
19
|
+
- task-specific token/runtime budget;
|
|
20
|
+
- every logical, endpoint, database, CLI, MCP, UI, and documentation surface, with a reason for each non-applicable surface;
|
|
21
|
+
- separate `success`, `partial`, `incorrect`, `incomplete`, and `blocked` rubric criteria;
|
|
22
|
+
- two distinguishable equivalent variants in its own variant group.
|
|
23
|
+
|
|
24
|
+
The schema rejects unknown repositories, missing categories, budget overruns, duplicate identifiers, unsafe public text, and tasks without a complete rubric. It also rejects suites whose planned execution count exceeds `maxRuns`.
|
|
25
|
+
|
|
26
|
+
## Execution plan
|
|
27
|
+
|
|
28
|
+
The canonical plan is 24 tasks × 3 scenarios × 2 model slots × 2 replicates = 288 planned executions. `selectTaskExecutions` produces a deterministic ordering from the declared seed and assigns executions of each variant to every task. Scenario order, model identity, and replicate remain explicit in each selected execution. A pilot must publish its population, task count, replicate count, and sampling plan; it must not be presented as six-repository evidence.
|
|
29
|
+
|
|
30
|
+
Run the contract through the packaged CLI:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
ak-docs study tasks docs/study/task-suite-v1.json --text
|
|
34
|
+
ak-docs study select docs/study/task-suite-v1.json --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Adjudication
|
|
38
|
+
|
|
39
|
+
Agent output is never the adjudication result. During a real run, the deterministic evaluator receives the execution status, the bounded acceptance-check measurements (`acceptanceChecksPassed`, `acceptanceChecksTotal`, and `acceptanceChecksExecuted`), and the number of evidence items, then records an `automated` adjudication with method `deterministic-rubric-v1`. A success requires every declared check to be observed as executed and passed; missing execution telemetry is blocked rather than inferred. The evaluator returns one of the five rubric statuses without reading the provider's self-reported `taskOutcome`. Human adjudication remains required for semantic correctness, documentation quality, and any claim that cannot be proven by the declared artifact checks.
|
|
40
|
+
|
|
41
|
+
No baseline is approved by creating or selecting the suite. Baseline execution, comparison, and immutable approval are separate phases.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Study verification binding v1
|
|
3
|
+
description: Provenance, privacy, budget, recovery, and audit rules for controlled study evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Study verification binding v1
|
|
7
|
+
|
|
8
|
+
`ControlledStudyVerifiedResultV1` is the publication-safe boundary for a controlled study result. It wraps a result with the exact verification run, source revision, protocol/configuration hashes, immutable baseline hash, artifact hashes, privacy scan outcome, and consumed budget.
|
|
9
|
+
|
|
10
|
+
The binding is content-addressed with `sha256-normalized-v1`. It is not a baseline and cannot replace one. Baseline replacement is a separate, explicit, human-authorized study operation; the `@agentskit/harness@0.9.0` verification CLI does not replace baselines during a normal run. The replacement must record the new artifact hash, actor, intent, and timestamp in the study evidence ledger.
|
|
11
|
+
|
|
12
|
+
Validate a binding through the real CLI:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
ak-docs study verification docs/study/verification-binding-v1.json --text
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Required evidence
|
|
19
|
+
|
|
20
|
+
Every controlled result must bind:
|
|
21
|
+
|
|
22
|
+
- `verificationRunId` and `sourceRevisionHash`;
|
|
23
|
+
- `protocolHash`, `configurationHash`, and `baselineHash`;
|
|
24
|
+
- hashes for every included artifact, never raw repository content;
|
|
25
|
+
- anonymized privacy status, artifact count, zero forbidden matches, and publication-review state;
|
|
26
|
+
- maximum and consumed token/runtime budget.
|
|
27
|
+
|
|
28
|
+
The binding rejects budget exhaustion and tampered content. A result without this envelope may be useful for local exploration, but is not a verified study result.
|
|
29
|
+
|
|
30
|
+
## Privacy boundary
|
|
31
|
+
|
|
32
|
+
`scanStudyPublicationArtifact` recursively checks machine-readable artifacts and logs for private paths, URLs, credentials, prompts, raw agent output, snippets, and repository-content fields. `scripts/study-privacy-gate.mjs` applies the same scan to a file or directory. It reports only field paths, never the matched secret value. Publication requires human review even when the deterministic scan has zero matches.
|
|
33
|
+
|
|
34
|
+
Study artifacts use anonymized consumer identifiers and bounded hashes. Do not place repository names, internal paths, document contents, prompts, credentials, or raw responses in a ledger, report, log, or publication export.
|
|
35
|
+
|
|
36
|
+
## Recovery and idempotency
|
|
37
|
+
|
|
38
|
+
Observation ledgers are updated with `upsertControlledStudyObservation`; the same run/task is reused when its content hash matches and rejected when it conflicts. Workflow stage artifacts are atomic and hash-verified. A failed, cancelled, stale, corrupted, or interrupted workflow can resume from the last valid completed stage; invalid artifacts are not silently reused. Changed source, configuration, protocol, task definition, model, tool version, or evidence produces a new run.
|
|
39
|
+
|
|
40
|
+
The harness records `CLARIFYING`, `PLANNED`, `VERIFYING`, `AWAITING_HUMAN_APPROVAL`, `AWAITING_AUTHORIZATION`, `BLOCKED`, and `COMPLETE` distinctly. Missing checks, stale evidence, privacy matches, budget exhaustion, or regressions cannot be reported as complete.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Documentation efficiency study
|
|
3
|
+
description: Anonymized measurements for Doc Bridge context efficiency, evidence quality, and agent workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation efficiency study
|
|
7
|
+
|
|
8
|
+
The next improvement series is governed by the [Token efficiency improvement
|
|
9
|
+
plan](./token-efficiency-plan-v1.md). It separates context-payload reduction,
|
|
10
|
+
provider-token reduction, and tokens-to-correct-action so that a smaller
|
|
11
|
+
payload cannot be presented as a correctness or token-saving result by itself.
|
|
12
|
+
|
|
13
|
+
This directory contains the anonymized, versioned evidence behind the Doc Bridge performance narrative. It is designed to let contributors inspect the numbers without exposing repository contents, private paths, prompts, credentials, or raw agent responses.
|
|
14
|
+
|
|
15
|
+
## Executive summary
|
|
16
|
+
|
|
17
|
+
An earlier anonymized dogfooding cycle estimated up to **99% context-payload reduction** between the scanned repository corpus and the P95 payload returned to an agent. This is a historical context-payload measurement, not a guaranteed token reduction or correctness result, and it must not be read as a provider-token result.
|
|
18
|
+
|
|
19
|
+
The published controlled A/B study with 96 executions showed a directional operational signal of 18.46% fewer paired provider token-equivalent units across 46 token-complete pairs and 39.75 seconds lower P95 latency than repository-only context. Operational completion was 87.5% versus 75.0%. The sample is not a causal or enterprise-readiness claim.
|
|
20
|
+
|
|
21
|
+
The independent bounded adjudicator recorded **0 adjudicator-success outcomes in both arms**. Because this adjudicator is mechanical and does not independently judge semantic correctness, this round does not demonstrate improved task correctness; it remains `inconclusive` and should be used only as an auditable historical directional measurement. A newer local pilot is not included in the public narrative until its semantic evaluation and publication review are complete.
|
|
22
|
+
|
|
23
|
+
Acceptance telemetry is now checked separately from task correctness: every pilot observation records passed, total, and executed acceptance-check counts, while the deterministic adjudicator blocks a success when any declared check was not observed as executed. This prevents a missing execution measurement from being mistaken for a passing task.
|
|
24
|
+
|
|
25
|
+
Semantic correctness and natural-language contradiction detection are explicit
|
|
26
|
+
limitations of this study, not missing evidence hidden by the publication
|
|
27
|
+
artifacts. They remain open validation work for a future adjudicated corpus.
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
## Evidence classification
|
|
34
|
+
|
|
35
|
+
| Label | Meaning |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `controlled` | Fixed task, model, scenario, and measurement contract. |
|
|
38
|
+
| `estimated` | Derived from bounded measurements where direct provider data was unavailable. |
|
|
39
|
+
| `observational` | Real-world dogfooding evidence without a controlled counterfactual. |
|
|
40
|
+
| `inconclusive` | Useful signal, but insufficient evidence for a causal claim. |
|
|
41
|
+
|
|
42
|
+
## Published artifacts
|
|
43
|
+
|
|
44
|
+
| Artifact | Purpose |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| [Protocol](./protocol-v1.json) | Metric definitions, scenarios, privacy boundary, and stopping rules. |
|
|
47
|
+
| [Token efficiency protocol v2](./token-efficiency-protocol-v2.json) | Correct-action token metric, evidence gates, and non-regression targets. |
|
|
48
|
+
| [Task suite](./task-suite-v1.json) | Fixed anonymized discovery, architecture, documentation, and implementation tasks. |
|
|
49
|
+
| [Phase 4 public pilot suite](./phase4-public-pilot-task-suite-v1.json) | One public fixture, four tasks, and explicit pilot-only scope for validating the real runner without duplicating a repository. |
|
|
50
|
+
| [Phase 4 public pilot plan](./phase4-public-pilot-run-plan-v1.json) | Hashed 16-observation pairwise pilot using the two configured Codex model slots. |
|
|
51
|
+
| [Phase 4 public pilot ledger](./phase4-public-pilot-ledger-v1.json) | Bounded structured observations with hashes, statuses, provider usage, evidence IDs, and automated adjudication. |
|
|
52
|
+
| [Phase 4 public pilot result](./phase4-public-pilot-result-v1.json) | Anonymized execution counts, paired token/latency measurements, failed preparation runs, and limitations. |
|
|
53
|
+
| [Publication gate v1](./publication-gate-v1.md) | Evidence and claim-boundary checks required before publishing study results. |
|
|
54
|
+
| [A/B baseline result](./ab-baseline-result-v1.json) | Controlled repository-only versus deterministic Doc Bridge measurements. |
|
|
55
|
+
| [A/B baseline analysis](./ab-baseline-analysis-v1.md) | Human-readable interpretation of the controlled baseline. |
|
|
56
|
+
| [Adjudicated A/B result](./ab-adjudicated-cost-result-v1.json) | Cost-attributed execution and independent bounded adjudication. |
|
|
57
|
+
| [Round 2](./round-2-expanded-validation-v1.md) | Expanded adjudication and operational measurements. |
|
|
58
|
+
| [Round 3](./round-3-evidence-contract-v1.md) | Evidence-coverage contract validation. |
|
|
59
|
+
| [Round 4](./round-4-confirmation-v1.md) | Fresh-sample confirmation and final limitations. |
|
|
60
|
+
| [Historical evidence](./historical-evidence-v1.json) | Earlier anonymized dogfooding and validation-cycle measurements. |
|
|
61
|
+
|
|
62
|
+
All publication-bound artifacts pass the deterministic privacy gate. The values are intentionally anonymized and should be interpreted together with their provenance and limitations.
|
|
63
|
+
|
|
64
|
+
The Phase 4 public pilot is intentionally separate from the six-population canonical suite. It is an execution-path and measurement smoke study, not evidence of enterprise-wide documentation quality or generalization. Its local provider and repository configuration stay outside the publication artifacts; only hashes, bounded observations, and the run identifier belong in published evidence.
|
|
65
|
+
|
|
66
|
+
## Reproduce the charts
|
|
67
|
+
|
|
68
|
+
From the repository root:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
node scripts/generate-study-charts.mjs
|
|
72
|
+
node scripts/generate-study-charts.mjs --check
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The generator uses only the checked-in JSON artifacts and Node.js APIs. It does not call an LLM or access a consumer repository.
|
|
76
|
+
|
|
77
|
+
## What the study does not prove
|
|
78
|
+
|
|
79
|
+
- It does not prove that Doc Bridge makes every agent answer correctly.
|
|
80
|
+
- It does not prove a universal 99% token reduction.
|
|
81
|
+
- It does not establish causality across all repositories, languages, or models.
|
|
82
|
+
- It does not replace semantic human review of documentation/code contradictions.
|
|
83
|
+
|
|
84
|
+
The study is a transparent measurement baseline and a contribution surface for better analyzers, adapters, acceptance checks, and future replicates.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Controlled A/B study — adjudicated cost round
|
|
2
|
+
|
|
3
|
+
This round compares `repository-only` with `deterministic-doc-bridge` using 24 anonymized task definitions, two configured CLI models, one replicate, and 48 observations per arm. The run completed all 96 planned observations and records execution failures rather than dropping them.
|
|
4
|
+
|
|
5
|
+
## Result
|
|
6
|
+
|
|
7
|
+
The deterministic Doc Bridge arm completed 42/48 executions (87.5%) versus 36/48 (75.0%) for repository-only. Its latency p95 was 84,440 ms versus 124,193 ms. Across 46 paired observations with token data, the deterministic arm used 53,325 fewer provider token-equivalent units on average (−18.459%). Provider token-equivalent units are input plus output tokens; they are not currency.
|
|
8
|
+
|
|
9
|
+
Evidence citation was unchanged at 93.75%. The high-quality evidence rate was 20.833% for deterministic Doc Bridge versus 22.917% for repository-only. The independent bounded adjudicator recorded zero successful outcomes in both arms. That means this run does not demonstrate improved semantic correctness, even though it shows directional operational improvement.
|
|
10
|
+
|
|
11
|
+
The result is `inconclusive`. It is useful as an auditable directional measurement, not as a causal, enterprise-readiness, or USD-cost claim.
|
|
12
|
+
|
|
13
|
+
## Provenance
|
|
14
|
+
|
|
15
|
+
- Plan: `ab-adjudicated-cost-plan-v2-v1.json`, hash `f61bf70063fcceb9dfe823ac9d0707f0f004a075143cae6e9518523c64ba1b4f`
|
|
16
|
+
- Run: `phase-9-ab-adjudicated-cost-03`
|
|
17
|
+
- Ledger hash: `cc3eb8a816f961b4a4d8fdefd96365e6b89f3fd7d5aad287c3c5cc79a80ed0f5`
|
|
18
|
+
- Metrics report hash: `d2849c3515da91385af91e9a80b70fa25b5f2ad6f248255229aba6ce73b3fd22`
|
|
19
|
+
- Structured result: [ab-adjudicated-cost-result-v1.json](./ab-adjudicated-cost-result-v1.json)
|
|
20
|
+
|
|
21
|
+
## What changed from the previous round
|
|
22
|
+
|
|
23
|
+
- Provider token totals are now derived and labeled as token-equivalent units when both input and output counts exist.
|
|
24
|
+
- Provider-reported outcomes are no longer treated as the final outcome; the runner records a deterministic bounded adjudication.
|
|
25
|
+
- Child process groups are terminated on timeout or output limits, preventing nested CLI processes from surviving a failed observation.
|
|
26
|
+
|
|
27
|
+
## Remaining measurement gap
|
|
28
|
+
|
|
29
|
+
The adjudicator is mechanical and bounded. It does not independently judge whether the answer is semantically correct, whether documentation claims are true, or whether a repository change is safe. A future round needs a blinded human or separately configured review agent with an explicit rubric before correctness or quality claims can be strengthened.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "controlled-study-run-plan",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"planVersion": "v1-ab-adjudicated-cost",
|
|
5
|
+
"protocolVersion": "v1",
|
|
6
|
+
"protocolHash": "7a56ae4da91ae56fb8b4b7e506adce525ab6fcb637d635cafb7091c2bd437adf",
|
|
7
|
+
"taskSuiteHash": "d7810828bce3c6616f00897fd7c92dfa4ecdf12e549923795cd95cc81a2b0029",
|
|
8
|
+
"sourceRevisionHash": "0dfd7a83cfdfaecd78055642f74ce6552bfd83cf14f7bc6ed308ec978eda0ef6",
|
|
9
|
+
"configurationHash": "0a7dede28ccf1e672044c7b429a67d64d34e68c133dd21ffc07d763ff50642fe",
|
|
10
|
+
"docBridgeVersion": "1.7.45",
|
|
11
|
+
"models": [
|
|
12
|
+
{ "id": "low-cost-model", "role": "low-cost", "provider": "codex", "model": "gpt-5.6-sol", "version": "codex-cli-0.149.0", "parametersHash": "6dc5481139cc4fc6960a38ffd4c7e68605108d0d3eac9ac3c269c92703200273", "contextLimit": 272000, "toolConfigurationHash": "a08b38a4fa7e559811713cabc2e2f62cb05ef266d406dcb38cf46be627417e20", "promptContractHash": "5ba19f0e4ea57c4206d2965a55fc1bbd081348a8ccf89c86ff64a81df93bf98b" },
|
|
13
|
+
{ "id": "reference-model", "role": "reference", "provider": "codex", "model": "gpt-5.6-luna", "version": "codex-cli-0.149.0", "parametersHash": "785593a535c713ae8015defb031047fb9ae55926ec4ac0cb0cafcdaa5cba1e30", "contextLimit": 272000, "toolConfigurationHash": "d2fe8bbf1fa6add2b357c4a199a37224c03bbe4edf29901ff45ae0ef8ee99366", "promptContractHash": "5ba19f0e4ea57c4206d2965a55fc1bbd081348a8ccf89c86ff64a81df93bf98b" }
|
|
14
|
+
],
|
|
15
|
+
"scenarios": [
|
|
16
|
+
{ "id": "repository-only", "network": false },
|
|
17
|
+
{ "id": "deterministic-doc-bridge", "network": false },
|
|
18
|
+
{ "id": "registry-assisted", "agentId": "ecosystem-doc-bridge-corpus-scanner", "agentVersion": "v1.0.0", "network": false }
|
|
19
|
+
],
|
|
20
|
+
"taskIds": [
|
|
21
|
+
"consumer-01-discovery", "consumer-01-architecture", "consumer-01-documentation", "consumer-01-implementation",
|
|
22
|
+
"consumer-02-discovery", "consumer-02-architecture", "consumer-02-documentation", "consumer-02-implementation",
|
|
23
|
+
"consumer-03-discovery", "consumer-03-architecture", "consumer-03-documentation", "consumer-03-implementation",
|
|
24
|
+
"consumer-04-discovery", "consumer-04-architecture", "consumer-04-documentation", "consumer-04-implementation",
|
|
25
|
+
"consumer-05-discovery", "consumer-05-architecture", "consumer-05-documentation", "consumer-05-implementation",
|
|
26
|
+
"consumer-06-discovery", "consumer-06-architecture", "consumer-06-documentation", "consumer-06-implementation"
|
|
27
|
+
],
|
|
28
|
+
"sampling": { "strategy": "pairwise-task-strata", "sampleSize": 96, "scenarioIds": ["repository-only", "deterministic-doc-bridge"] },
|
|
29
|
+
"budget": { "maxTokens": 400000, "maxRuntimeMs": 180000, "maxOutputBytes": 256000, "maxAttempts": 1 },
|
|
30
|
+
"runId": "phase-9-ab-adjudicated-cost-01",
|
|
31
|
+
"contentHashAlgo": "sha256-normalized-v1",
|
|
32
|
+
"contentHash": "7d03ca649d4d4d23cc9c7cb7237aba6e51697d04d2d8ac1912101ccb439b08b8"
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "controlled-study-run-plan",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"planVersion": "v1-ab-adjudicated-cost",
|
|
5
|
+
"protocolVersion": "v1",
|
|
6
|
+
"protocolHash": "7a56ae4da91ae56fb8b4b7e506adce525ab6fcb637d635cafb7091c2bd437adf",
|
|
7
|
+
"taskSuiteHash": "d7810828bce3c6616f00897fd7c92dfa4ecdf12e549923795cd95cc81a2b0029",
|
|
8
|
+
"sourceRevisionHash": "c4a2decdccfd7262f64c78b6d8bb1c1101094d0afed519750b8ebfbfde1c1019",
|
|
9
|
+
"configurationHash": "0a7dede28ccf1e672044c7b429a67d64d34e68c133dd21ffc07d763ff50642fe",
|
|
10
|
+
"docBridgeVersion": "1.7.45",
|
|
11
|
+
"models": [
|
|
12
|
+
{ "id": "low-cost-model", "role": "low-cost", "provider": "codex", "model": "gpt-5.6-sol", "version": "codex-cli-0.149.0", "parametersHash": "6dc5481139cc4fc6960a38ffd4c7e68605108d0d3eac9ac3c269c92703200273", "contextLimit": 272000, "toolConfigurationHash": "a08b38a4fa7e559811713cabc2e2f62cb05ef266d406dcb38cf46be627417e20", "promptContractHash": "5ba19f0e4ea57c4206d2965a55fc1bbd081348a8ccf89c86ff64a81df93bf98b" },
|
|
13
|
+
{ "id": "reference-model", "role": "reference", "provider": "codex", "model": "gpt-5.6-luna", "version": "codex-cli-0.149.0", "parametersHash": "785593a535c713ae8015defb031047fb9ae55926ec4ac0cb0cafcdaa5cba1e30", "contextLimit": 272000, "toolConfigurationHash": "d2fe8bbf1fa6add2b357c4a199a37224c03bbe4edf29901ff45ae0ef8ee99366", "promptContractHash": "5ba19f0e4ea57c4206d2965a55fc1bbd081348a8ccf89c86ff64a81df93bf98b" }
|
|
14
|
+
],
|
|
15
|
+
"scenarios": [
|
|
16
|
+
{ "id": "repository-only", "network": false },
|
|
17
|
+
{ "id": "deterministic-doc-bridge", "network": false },
|
|
18
|
+
{ "id": "registry-assisted", "agentId": "ecosystem-doc-bridge-corpus-scanner", "agentVersion": "v1.0.0", "network": false }
|
|
19
|
+
],
|
|
20
|
+
"taskIds": [
|
|
21
|
+
"consumer-01-discovery", "consumer-01-architecture", "consumer-01-documentation", "consumer-01-implementation",
|
|
22
|
+
"consumer-02-discovery", "consumer-02-architecture", "consumer-02-documentation", "consumer-02-implementation",
|
|
23
|
+
"consumer-03-discovery", "consumer-03-architecture", "consumer-03-documentation", "consumer-03-implementation",
|
|
24
|
+
"consumer-04-discovery", "consumer-04-architecture", "consumer-04-documentation", "consumer-04-implementation",
|
|
25
|
+
"consumer-05-discovery", "consumer-05-architecture", "consumer-05-documentation", "consumer-05-implementation",
|
|
26
|
+
"consumer-06-discovery", "consumer-06-architecture", "consumer-06-documentation", "consumer-06-implementation"
|
|
27
|
+
],
|
|
28
|
+
"sampling": { "strategy": "pairwise-task-strata", "sampleSize": 96, "scenarioIds": ["repository-only", "deterministic-doc-bridge"] },
|
|
29
|
+
"budget": { "maxTokens": 400000, "maxRuntimeMs": 180000, "maxOutputBytes": 256000, "maxAttempts": 1 },
|
|
30
|
+
"runId": "phase-9-ab-adjudicated-cost-03",
|
|
31
|
+
"contentHashAlgo": "sha256-normalized-v1",
|
|
32
|
+
"contentHash": "f61bf70063fcceb9dfe823ac9d0707f0f004a075143cae6e9518523c64ba1b4f"
|
|
33
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "controlled-study-ab-result",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"resultVersion": "v1",
|
|
5
|
+
"round": "ab-adjudicated-cost-2026-08-31",
|
|
6
|
+
"runId": "phase-9-ab-adjudicated-cost-03",
|
|
7
|
+
"planHash": "f61bf70063fcceb9dfe823ac9d0707f0f004a075143cae6e9518523c64ba1b4f",
|
|
8
|
+
"ledgerHash": "cc3eb8a816f961b4a4d8fdefd96365e6b89f3fd7d5aad287c3c5cc79a80ed0f5",
|
|
9
|
+
"metricsReportHash": "d2849c3515da91385af91e9a80b70fa25b5f2ad6f248255229aba6ce73b3fd22",
|
|
10
|
+
"sample": {
|
|
11
|
+
"taskCount": 24,
|
|
12
|
+
"modelCount": 2,
|
|
13
|
+
"scenarioCount": 2,
|
|
14
|
+
"observationsPerArm": 48,
|
|
15
|
+
"pairedComparisons": 48
|
|
16
|
+
},
|
|
17
|
+
"arms": [
|
|
18
|
+
{
|
|
19
|
+
"scenarioId": "repository-only",
|
|
20
|
+
"observationCount": 48,
|
|
21
|
+
"executionStatus": { "completed": 36, "budget-exceeded": 11, "timed-out": 1 },
|
|
22
|
+
"completedRate": 0.75,
|
|
23
|
+
"taskOutcome": { "success": 3, "partial": 34, "blocked": 10, "missing": 1 },
|
|
24
|
+
"adjudicationOutcome": { "success": 0, "partial": 33, "blocked": 13, "incomplete": 2 },
|
|
25
|
+
"adjudicatedSuccessRate": 0,
|
|
26
|
+
"evidenceCitationRate": 0.9375,
|
|
27
|
+
"evidenceQualityRate": 0.229167,
|
|
28
|
+
"providerTokens": 13416254,
|
|
29
|
+
"providerTokenObservations": 47,
|
|
30
|
+
"providerTokenCostUnits": 13416254,
|
|
31
|
+
"latencyMeanMs": 68064.75,
|
|
32
|
+
"latencyP95Ms": 124193,
|
|
33
|
+
"totalCostUsd": null
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"scenarioId": "deterministic-doc-bridge",
|
|
37
|
+
"observationCount": 48,
|
|
38
|
+
"executionStatus": { "completed": 42, "budget-exceeded": 5, "timed-out": 1 },
|
|
39
|
+
"completedRate": 0.875,
|
|
40
|
+
"taskOutcome": { "success": 1, "partial": 29, "blocked": 17, "missing": 1 },
|
|
41
|
+
"adjudicationOutcome": { "success": 0, "partial": 40, "blocked": 6, "incomplete": 2 },
|
|
42
|
+
"adjudicatedSuccessRate": 0,
|
|
43
|
+
"evidenceCitationRate": 0.9375,
|
|
44
|
+
"evidenceQualityRate": 0.208333,
|
|
45
|
+
"providerTokens": 11048857,
|
|
46
|
+
"providerTokenObservations": 47,
|
|
47
|
+
"providerTokenCostUnits": 11048857,
|
|
48
|
+
"latencyMeanMs": 58335.292,
|
|
49
|
+
"latencyP95Ms": 84440,
|
|
50
|
+
"totalCostUsd": null
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"pairedDeltas": {
|
|
54
|
+
"comparisonDirection": "deterministic-doc-bridge minus repository-only",
|
|
55
|
+
"providerTokenCostUnitsAverage": -53325.065,
|
|
56
|
+
"providerTokenCostUnitsRelative": -0.18459,
|
|
57
|
+
"providerTokenPairCount": 46,
|
|
58
|
+
"latencyAverageMs": -9729.458,
|
|
59
|
+
"latencyRelative": -0.142944,
|
|
60
|
+
"latencyP95Ms": -39753,
|
|
61
|
+
"completedRate": 0.125,
|
|
62
|
+
"evidenceCitationRate": 0,
|
|
63
|
+
"evidenceQualityRate": -0.020834,
|
|
64
|
+
"adjudicatedSuccessRate": 0
|
|
65
|
+
},
|
|
66
|
+
"interpretation": {
|
|
67
|
+
"classification": "inconclusive",
|
|
68
|
+
"summary": "The deterministic Doc Bridge arm completed more executions and used fewer provider token-equivalent units with lower latency p95 in this controlled sample. Evidence citation was unchanged and high-quality evidence was slightly lower. The independent adjudicator found no successful outcome in either arm, so the study does not establish improved task correctness.",
|
|
69
|
+
"decision": "Do not use this run as a causal, enterprise-readiness, or currency-cost claim. Use it as an auditable directional measurement and as input to the next study design."
|
|
70
|
+
},
|
|
71
|
+
"limitations": [
|
|
72
|
+
"The cost metric is provider token-equivalent units, not USD; the CLI provider emitted no currency cost.",
|
|
73
|
+
"Two observations lacked provider token counts, so paired token comparison uses 46 of 48 pairs.",
|
|
74
|
+
"Adjudication is deterministic and bounded by execution status, acceptance metrics, and evidence count; it is not independent semantic review by a human or second model.",
|
|
75
|
+
"The sample has 24 task definitions, two models, one replicate, and two scenarios; it does not establish causality or generalize to other repositories.",
|
|
76
|
+
"The study task acceptance instrumentation produced no adjudicated successes; semantic correctness remains not analyzed."
|
|
77
|
+
],
|
|
78
|
+
"contentHashAlgo": "sha256-normalized-v1",
|
|
79
|
+
"contentHash": "9589b4e36283c36face82acdacbd756b3b96e001c59f2fb0574f9b5be4ef034c"
|
|
80
|
+
}
|