Skip to content

Q&A pipeline: from target to report

End-to-end recipe for the canonical benchmark flow: target → preflight → fixed question/task set → without_docs vs with_docs answer generation → judge scoring → report.

For the static documentation benchmark (coverage, freshness, readability, example_pass_rate), see the top-level README.

Prerequisites

1. API keys

# OpenAI (question generation, answering)
export OPENAI_API_KEY="sk-..."

# Anthropic (judging — separate provider to reduce self-evaluation bias)
export ANTHROPIC_API_KEY="sk-ant-..."

# GitHub (optional — raises persona-discovery rate limit from 60 to 5000/hour)
export GITHUB_TOKEN="ghp_..."

2. Dependencies

pip install dokimi               # released package
# or, from a source checkout:
pip install -e ".[dev]"          # package + dev tooling
# or, dependencies only:
pip install -r requirements.txt

The package install provides the dokimi console entry point used below. python -m dokimi … is equivalent. The dependencies-only route installs no dokimi command: run python -m dokimi … from the inner dokimi/ package directory in its place. Source-install and requirements-file commands run from the inner dokimi/ package directory; see installation.

The pipeline degrades gracefully if optional deps are missing — see Troubleshooting.

Content setup

onetbb ships in the package's product registry, and benchmark run discovers personas and generates its own questions, so the canonical flow below needs only the credentials above. For a fixed comparison, pass --questions-root <dir> with an onetbb_golden.json in it; that set then replaces the generated questions. External content covers your own targets and question sets. For a first skill or repository check, use Start here.

Canonical flow

Use this path after installation, credentials and content setup. Manual persona/question/answer/eval commands below are advanced debugging tools.

dokimi benchmark preflight --target onetbb
dokimi benchmark run --target onetbb

Defaults: results/<target>_final/, openai/gpt-6.1-sol answer model, anthropic/claude-sonnet-5-5 judge, semantic-only retrieval with top_k=3, and without_docs vs with_docs arms.

For fair model/context comparisons, seed once and reuse questions:

dokimi benchmark run --target onetbb --out-dir results/onetbb_seed
dokimi benchmark run --target onetbb --questions-from results/onetbb_seed --model gpt-6-astra

On the 0.2.0 release this flag is --output-dir; --out-dir needs a source checkout of main.

See user-flow.md for target/generalization rules.

Pipeline

On the 0.2.0 release the --out flags in these steps are --output; --out needs a source checkout of main.

Commands use the installed CLI. For source-relative paths, run from the inner dokimi/ package directory, not the outer checkout root. Use --help on any subcommand for the full option list.

Step 1 — Discover personas

dokimi eval personas discover \
  --product oneTBB \
  --repo uxlfoundation/oneTBB \
  --count 5 \
  --save-analysis

Reads the GitHub repo (README, issues, API patterns), generates 5–8 user personas via LLM, and writes personas/oneTBB.json. Each persona has id, name, description, skill_level, concerns, and typical_questions. Add --dry-run to price the call first (it reads the repo and calls no model); --max-usd X makes the call only if its estimate is within X, else it exits 3.

Review and approve:

$EDITOR personas/oneTBB.json
dokimi eval personas validate --file personas/oneTBB.json

Step 2 — Generate questions

dokimi eval questions generate \
  --product oneTBB \
  --personas personas/oneTBB.json \
  --count 2 \
  --validate \
  --model gpt-6.1-sol

Extracts seed topics from the docs, generates questions per persona × topic, LLM-validates them (threshold 60/100), and deduplicates via embeddings (similarity > 0.85). Expected output: ~30–50 unique questions in questions/oneTBB.json.

Step 3 — Generate context-arm and baseline answers

dokimi answers generate \
  --product oneTBB \
  --questions questions/oneTBB.json \
  --out answers/oneTBB.json \
  --model gpt-6.1-sol \
  --provider openai \
  --top-k 3 \
  --rerank-threshold 0.3 \
  --debug-retrieval

For each question, two answers are produced: context arm (retrieved via the configured --doc-source, default Context7) and baseline (model knowledge only). Use --doc-source local:<path> or --doc-source url:<url> for alternative sources — see adding-doc-source.md.

Step 4 — Score answers

dokimi eval score pointwise \
  --product oneTBB \
  --answers answers/oneTBB.json \
  --out eval/oneTBB.json \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic

LLM-as-judge scores each answer on five 0–100 dimensions (correctness, completeness, specificity, code_quality, actionability), then computes an aggregate and the context-arm minus baseline delta.

Multi-judge panel:

dokimi eval score panel \
  --product oneTBB \
  --answers answers/oneTBB.json \
  --out eval/panel/oneTBB.json

Step 5 — Generate the analysis report

dokimi report generate \
  --product oneTBB \
  --eval eval/oneTBB.json \
  --questions questions/oneTBB.json \
  --out reports/oneTBB.md \
  --format markdown

reports/oneTBB.md contains summary stats (min/max/avg context-arm/baseline/delta), top-N best and worst answers, top improvements and degradations, topic and persona clustering, and recommendations. The summary stats cover only the questions scored in both arms; questions scored in one arm are counted and left out of them, and report eval computes the same numbers from the same file. The reports/ directory is git-ignored.

Step 6 — Dashboard (optional)

dokimi dashboard generate --results-dir .

Aggregates per-library results into DASHBOARD.md / dashboard.json for cross-library comparison. It reads every eval/*.json, eval_*.json and evaluations/*.json under --results-dir (default results). With ., that includes step 4's eval/oneTBB.json and the results/onetbb_seed and results/onetbb_final runs from the benchmark run steps, so oneTBB appears once per file. The panel file sits in eval/panel/, which the pattern does not match. Like report generate, it averages both arms and the delta, per library and per question source, over the questions scored in both arms; a run that scored one arm only shows that arm's mean.

Full run (single command)

PRODUCT=oneTBB
REPO=uxlfoundation/oneTBB

dokimi eval personas discover --product $PRODUCT --repo $REPO --count 5 && \
dokimi eval personas validate --file personas/$PRODUCT.json && \
dokimi eval questions generate --product $PRODUCT --personas personas/$PRODUCT.json --validate && \
dokimi answers generate --product $PRODUCT --questions questions/$PRODUCT.json --model gpt-6.1-sol && \
dokimi eval score pointwise --product $PRODUCT --answers answers/$PRODUCT.json --judge-model claude-sonnet-5-5 --judge-provider anthropic && \
dokimi report generate --product $PRODUCT --eval eval/$PRODUCT.json --questions questions/$PRODUCT.json --out reports/$PRODUCT.md

Advanced manual pipeline wrapper:

dokimi evaluate --product $PRODUCT --repo $REPO

Output layout

File Content
personas/<product>.json 5–8 user personas
questions/<product>.json Validated, deduped questions
answers/<product>.json Context-arm/baseline answer pairs + retrieval metadata + token counts
eval/<product>.json Per-question scores (5 dimensions) + aggregates + deltas
reports/<product>.md Human-readable analysis (git-ignored)
DASHBOARD.md Cross-library summary

Curated inputs live under data/ (data/skills/fastcontext/, data/agent_profiles/, data/explore_tasks/) — the fixtures the framework's own examples and tests need. Question sets, product skills and personas are evaluation content, kept in a separate content repository and passed in by path (--questions <path>, --questions-root <dir>, skill:<path>) — external-content.md walks through pointing the framework at such a checkout. Everything the pipeline produces — answers, eval scores, benchmark snapshots, reports — stays under the git-ignored answers/, eval/, baselines/, reports/ and results/ directories. See data/README.md. dokimi runs list lists the artifacts under results/ (runs.md).

Cost estimate

For 35 questions on the defaults, gpt-6.1-sol ($2/$10 per MTok input/output) answering and generating and claude-sonnet-5-5 ($2/$10) judging:

Step Calls Approx. cost
Persona discovery a few $0.20
Question generation ~35 $0.20
Answer generation ~70 (context arm + baseline) $2
Judge scoring ~70 $5
Total ~$7

These are the earlier measured figures (on gpt-5.5 + claude-sonnet-4-5, ~$13) scaled by list price, not a new measurement. The defaults changed on 2026-10-13, so results from before are not comparable with older baselines; re-baseline — see Default models.

Costs scale roughly linearly with question count. Token counts are recorded per answer in answers/<product>.json.

Exit codes

dokimi commands use these codes, so a script can tell a bad invocation from a failed check.

Code Meaning Examples
0 The command ran and, if it checks something, the check passed.
1 A verdict or a gate that ran and failed, or a runtime failure the command reports (a model call, a run, a clone or fetch); a crash that escapes is 5. eval judge validate --strict and eval leak/eval redteam that fail as blocked. baseline compare --max-context-drop 0 over a regression, repo reach with a harness binary that cannot run, eval triggers generate --fail-on warn over a lint finding
2 A bad invocation: a missing, unreadable or malformed input file, a configuration the agent's CLI rejects (repo run --tools all with a .mcp.json the CLI does not accept: refused before any cell runs), a device given as one (<flag> <path>: not a file), a flag combination the command refuses, an output file that cannot be written, a missing provider credential, a source string that is malformed, unpinned or not a repository root. baseline save on a bad eval file, evaluate --questions on an empty or non-JSON file (--questions <path>: <reason>), benchmark preflight with no golden set, repo scan --manifest ../x.yaml
3 Inconclusive: the run stopped short because a budget ran out (--max-usd, or a call with no price) and kept the partial output (tools preference, skill novelty atoms, probe and analyze, skill routing and catalog routing, repo run when the batch budget is the only reason a cell was not started (with a cell error or a failed probe too it exits 1, 5 for a cell that crashed of the machinery; a batch that started no cell exits 1), and repo hits judge; a stop on a permanent provider error, or on 3 judge calls in a row failing with one error, exits 1; eval personas discover refuses its one call before it runs, so nothing is written), or the result is undecided (eval judge validate: a pass whose interval straddles the gate, or a variant no pair was built for, with --strict making it 1; eval leak: an item that could not be checked, or none could; eval redteam: a graded question not measured, or nothing graded; eval judge agreement --strict: an arm NOT MEASURED, or no arm to compare; repo security --fail-on: an unfinished cell or an arm with no measured cell, when no arm failed and every model has a baseline cell). tools preference --max-usd 5 with calls not run; eval judge validate with too few bases
4 Invalid: the result is not comparable or not trustworthy: a model that differs from the baseline's, or one that cannot be verified, under baseline compare --strict or the regression gate (--max-context-drop or --max-lift-drop); under repo security --fail-on, a model with no baseline cell when no arm failed; under eval judge agreement --strict, an arm JUDGE-DEPENDENT; under runs baseline save --expect-previous, a baseline that no longer points to the run expected (a stale baseline, the pointer left as it was). baseline compare --strict over a baseline scored with another judge
5 Infrastructure failure: a crash (an uncaught exception) in any command, with its traceback on stderr. For a command that emits the cli_output document, --json prints its infra document on stdout first. Also a repo run cell that crashes (a harness that exits nonzero before its first trace line, unless the cap killed it, a docker daemon or CLI failure that stops the agent, a scratch directory that vanished): the batch keeps the other cells and exits 5. backends --json when detect raises; repo run with the docker daemon down

A command that validates its input and then runs exits 2 for the first and 1 for the second. Not every command follows this yet: repo run and eval check exit 2 for a source that does not parse, a pinned local path inside a repository, a --cache-dir (or $DOKIMI_REPO_CACHE) that is not a usable directory or a --cache-root or --cache NAME=DIR that is not one (and, with --schema-only only, a task setup_patch or review_patch link that a run would refuse because it leaves the repository or the task directory), but still exit 1 for other input refusals (a missing or malformed manifest, a bad arm; the ✗ lines; a .mcp.json the CLI rejects under --tools all is exit 2 before any cell; a --manifest path that leaves the source tree as typed is exit 2, pinned or not, as a source refusal; a link in the tree that leads out of it is exit 1), and tools preference exits 1 when every call failed and 3 when --max-usd or an unpriced model stopped it short, and eval personas discover exits 3 when its --max-usd refuses the one call. repo run --max-usd exits 3 when the batch budget stops cells and nothing else went wrong (with a cell error or a failed probe too it exits 1, and 5 for a cell that crashed of the machinery), and repo hits judge --max-usd exits 3 when the budget or an unpriced call stops it, and 1 when 3 judge calls in a row failed with one error. skill novelty atoms, probe and analyze and skill routing and catalog routing exit 3 when the budget or an unpriced call stops them and they keep a partial file, and 1 when they keep nothing (skill shorten, and a stop that leaves no partial file: "nothing was written") or a permanent provider error stopped them (catalog novelty exits 1 too, once it has written its rows, when any skill it took on is partial, error or not run). eval judge agreement --judges and eval score pairwise exit 1, not 2, when every judge call fails, a missing provider credential included.

trace inspect, trace consistency and trace prefilter exit 2 when no trace or session reads.

Troubleshooting

Symptom Fix
LLM calls fail / wrong provider All providers go through LiteLLM (dokimi/llm.py); set the matching *_API_KEY and pass --provider/--model. LangChain is used only by eval score ragas, which wraps its judge in ChatOpenAI/ChatAnthropic; it and ragas come with the ragas extra (pip install 'dokimi[ragas]').
No module named numpy Pipeline falls back to exact-text dedup; install numpy for embedding-based dedup
GitHub client not available Pipeline uses gh CLI fallback; pip install PyGithub to silence
Context7 timeout Raise context7.timeout in dokimi/config/products.yaml (or in a config/products.yaml of your own in the working directory)
Rate limiting OpenAI 10K TPM default, Anthropic 10K TPM default; lower --concurrency

Where to look next