Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7f1a69a
feat(tier3): import production trace exports as reviewed eval cases
chrisknvidia Nov 7, 2026
e4a418f
test(golden): add trace import commands to the CLI surface
chrisknvidia Nov 7, 2026
f716d24
test(tier3): relax trace redaction timing bound for shared CI runners
chrisknvidia Nov 7, 2026
d24534e
Merge branch 'main' into feat/christopherk/trace-datasets
rng1995 Nov 8, 2026
e25cd53
Merge origin/main into trace-datasets
chrisknvidia Nov 10, 2026
de009dd
Address trace import review findings
chrisknvidia Nov 10, 2026
674bdfa
Merge remote-tracking branch 'origin/main' into feat/christopherk/tra…
chrisknvidia Nov 10, 2026
f9b861d
Merge remote-tracking branch 'origin/main' into feat/christopherk/tra…
chrisknvidia Nov 10, 2026
09336c2
Merge remote-tracking branch 'origin/main' into feat/christopherk/tra…
chrisknvidia Nov 10, 2026
da43ef4
Merge remote-tracking branch 'origin/main' into feat/christopherk/tra…
chrisknvidia Nov 10, 2026
7da347d
merge: sync origin/main into #378
chrisknvidia Nov 10, 2026
5093c8c
merge: sync origin/main into #378
chrisknvidia Nov 10, 2026
b0c921f
merge: sync latest main into #378
chrisknvidia Nov 10, 2026
5828983
Merge main into trace dataset documentation
chrisknvidia Nov 10, 2026
1bf68c5
Merge current main into trace datasets
chrisknvidia Nov 10, 2026
a26b243
Merge main next steps into trace datasets
chrisknvidia Nov 10, 2026
553ad18
Merge run budgets into trace import workflow
chrisknvidia Nov 10, 2026
cf01e46
Merge main into trace datasets
chrisknvidia Nov 10, 2026
0740364
Merge main into trace datasets
chrisknvidia Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to SkillEvaluator are documented in this file.

### Added

- Import production trace exports into redacted review candidates with
`tier3 import-traces`, then promote only explicitly human-reviewed expectations
and replay fixtures with `tier3 accept-traces`.

- `skills/skillevaluator/` is an agent skill for operating SkillEvaluator: it
routes requests to the right tier, readiness check, dataset, report, or CI
command, and ships Tier 3 evaluation cases for itself. A test keeps every
Expand Down
34 changes: 34 additions & 0 deletions docs/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ commands referenced below.
| [health-check](#health-check) | Quick CLI + backend readiness check, or another tier with `--tier` | Nothing |
| [models](#models) | List models visible through the selected provider's catalog | Provider configuration/key |
| [tier3 validate](#tier3-validate) | Validate `evals/` and the optional Harbor contract | Nothing |
| [tier3 import-traces](#tier3-import-traces) | Import redacted trace review candidates | Nothing |
| [tier3 accept-traces](#tier3-accept-traces) | Promote explicitly reviewed trace candidates | Nothing |

## Global conventions

Expand Down Expand Up @@ -171,6 +173,38 @@ pipeline.
[tier3 feedback](#tier3-feedback), and `tier3 validate` are advertised **only**
inside the `tier3` group:

### tier3 import-traces
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved

Import a production trace export into redacted candidates outside the skill.
See [Trace Datasets](trace-datasets.mdx) for the v1 JSON/JSONL contract and redaction limits.

```bash
skillevaluator tier3 import-traces ./my-skill ./sessions.jsonl -o ./review
```

| Option | Default | Purpose |
| --- | --- | --- |
| `-o`, `--output DIR` | `./<skill-dir-name>-trace-review` | Review bundle directory, outside the skill. |
| `--force` | off | Overwrite an existing candidates file. |
| `--dry-run` | off | Print classifications, warnings, and the next-step hint; write nothing. |

### tier3 accept-traces

Promote only explicitly reviewed candidates into `evals/evals.json`. Requires
`SKILL_PATH` and `REVIEW_DIR`. `accept` requires a reviewer-written expectation;
`accept_observed` is allowed only for successful sessions with non-empty output.
Pending and rejected candidates are skipped. All decision/redaction errors abort
before writing; dataset validation errors after writing return a non-zero status.

```bash
skillevaluator tier3 accept-traces ./my-skill ./review --dry-run
skillevaluator tier3 accept-traces ./my-skill ./review
```

| Option | Default | Purpose |
| --- | --- | --- |
| `--dry-run` | off | Report additions and already-present ids without writing. |

### tier3 validate

Validate the Tier 3 `evals/` directory and the optional Harbor bring-your-own-task contract before you spend money on a live run. The dataset and directory rules it enforces are documented in [Eval Datasets](eval-datasets.mdx).
Expand Down
7 changes: 7 additions & 0 deletions docs/eval-datasets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Tier 3 executes these cases through
evaluation framework. Native Harbor task bundles are the bring-your-own-task
alternative to the `evals.json` dataset described below.

## Candidates from production trace exports

Use `tier3 import-traces` to create a redacted review bundle outside the skill,
then `tier3 accept-traces` to promote only explicitly reviewed expectations.
Observed production behavior never automatically becomes an expected answer.
See [Trace Datasets](trace-datasets.mdx) for the export contract and review decisions.

## The evals/ directory

SkillEvaluator recognizes this tree inside your skill:
Expand Down
116 changes: 116 additions & 0 deletions docs/trace-datasets.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: "Trace Datasets"
description: "Import a production trace export as redacted candidates, then promote only human-reviewed expectations into an eval dataset."
---

Production behavior is evidence, **not an expected answer**. Import creates a
review bundle outside the skill; nothing is promoted until a reviewer explicitly
chooses a decision. This workflow is local and does not call an LLM.

## Import and review

```bash
skillevaluator tier3 import-traces ./my-skill ./sessions.jsonl
skillevaluator tier3 import-traces ./my-skill ./sessions.json -o ./review --dry-run
```

The default output is `./my-skill-trace-review`, relative to the current working
directory. Output inside the skill is refused. Existing `candidates.json` requires
`--force` to replace it. `--dry-run` prints classifications without writing.
Keep the original export and review bundle private; do not ship either with a skill.

The bundle contains `candidates.json` and redacted replay inputs under
`fixtures/<candidate-id>/`. Each candidate has observed evidence, provenance,
redaction counts, warnings, and a pending review. Observed read/open calls for
files outside the skill that were not exported as fixtures produce
`missing replay input` warnings (deduplicated, capped at 20 per candidate).
Tool-derived
`suggested_assertions` are hints only, never promoted automatically.

## Export contract v1

Accepts JSONL (one session object per line), or a JSON wrapper:

```json
{
"format": "skillevaluator.trace-export",
"version": 1,
"sessions": [
{"session_id": "session-1", "prompt": "Summarize the input", "outcome": "unknown"}
]
}
```

Other wrapper formats and versions are rejected. JSONL uses the v1 session
contract without a wrapper. Records are numbered from 1 (physical line numbers
for JSONL).

| Field | Contract |
| --- | --- |
| `session_id` | Required non-empty string; hashed into a stable `trace-` id. |
| `prompt` | User request; falls back to the first user trajectory message. |
| `outcome` | `success`, `failure`, or `unknown` (default). Other values are unsupported. |
| `skill` | Optional skill name, matched against frontmatter name or directory name. Non-matches are skipped. |
| `trajectory` | ATIF object containing `steps`. |
| `agent`, `agent_log` | Alternative raw log input; agents: `claude-code`, `cursor-cli`, `cline`, `opencode`, `codex`. Unknown formats retain a candidate with a warning and no tool summary. |
| `final_output` | Optional string; otherwise the last agent trajectory message. |
| `files` | List of objects with relative `path` and string `content`. Absolute/traversing paths and invalid content are dropped with incomplete warnings. |
| `source`, `started_at`, `tags` | Optional provenance, redacted before writing. |
| Other fields | Dropped, with unsupported-field warnings. |

The summary and output explicitly report candidates and skipped records:
`duplicate` (normalized prompt and identical fixture contents, pointing to the
earlier candidate), `incomplete` (missing id or prompt), `unsupported` (including
invalid JSON and non-object records), and `other skill`.

## Review decisions and promotion

Edit each candidate's `review` in `candidates.json`:

| Decision | Effect |
| --- | --- |
| `pending` | Skip; the default. |
| `reject` | Skip. |
| `accept` | Requires a non-empty, reviewer-written `expected_output`. Optional `assertions` is a list of strings. |
| `accept_observed` | Explicit opt-in to use the observed output, only for `success` with non-empty output. Failure/unknown outcomes require an independent expectation instead. |

Unknown decisions and missing expectations abort the whole operation before
writing. Write expectations that define correct behavior, not merely what a
production session happened to do. Move only independently reviewed suggestions
into `assertions`; `suggested_assertions` and review notes are not eval criteria.

```bash
skillevaluator tier3 accept-traces ./my-skill ./my-skill-trace-review --dry-run
skillevaluator tier3 accept-traces ./my-skill ./my-skill-trace-review
```

Accepted entries append to agentskills-shaped `evals/evals.json`. Legacy flat
lists or other dataset extensions require manual migration first. Fixtures copy
to `evals/files/trace/<candidate-id>/`; entry-local `files` references prevent
unrelated fixtures from being staged. Fixture-free entries explicitly use `[]`.
`trace_source` records the redacted session id, export hash, outcome, and review
decision. Re-running skips ids already present for the same session; a different
session colliding with an id is an error. Dataset validation runs after writing;
validation errors are printed and return a non-zero exit status.

## Redaction guarantees and limits

Before writing, import applies the shared credential redactor and configured PII
patterns for email addresses, phone numbers, SSNs, personal macOS/Windows paths,
and **all** Linux `/home/<name>/` paths (replaced by `/home/<user>/`). Placeholder
exceptions in matching patterns are respected. Prompts, observed outputs, tool
summaries, fixtures, and provenance strings are redacted; raw logs and unknown
fields are not copied. Per-candidate counts record introduced secret-redaction markers and PII
matches. The export hash is calculated from the original bytes, not redacted text.

Promotion rechecks prompts, expectations, assertions, provenance, and fixtures;
if redaction would still change them, it refuses the candidate rather than
silently editing the reviewed expectation. Reviewers must sanitize newly pasted
material before trying again.

Pattern redaction is **best effort**, not a guarantee that every secret or person
is detected. Reviewers must still inspect all bundle files for sensitive data,
missing replay inputs, and suitability for publication. Review decisions are
explicit local metadata, not authenticated signatures or proof of who reviewed.

See [Eval Datasets](eval-datasets.mdx) for the promoted dataset contract.
3 changes: 3 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ navigation:
- page: Eval Datasets
path: ../docs/eval-datasets.mdx
slug: eval-datasets
- page: Trace Datasets
path: ../docs/trace-datasets.mdx
slug: trace-datasets
- page: Agents & Sandboxes
path: ../docs/agents-and-sandboxes.mdx
slug: agents-and-sandboxes
Expand Down
45 changes: 45 additions & 0 deletions src/skillevaluator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,51 @@ def tier3() -> None:
"""


@tier3.command("import-traces")
@click.argument("skill_path", type=click.Path(exists=True, file_okay=False, path_type=Path))
@click.argument("export", type=click.Path(exists=True, dir_okay=False, path_type=Path))
@click.option("--output", "-o", type=click.Path(file_okay=False, path_type=Path), help="Review bundle directory outside the skill (default: ./<skill-dir-name>-trace-review).")
@click.option("--force", is_flag=True, help="Overwrite an existing candidates file.")
@click.option("--dry-run", is_flag=True, help="Print the summary without writing files.")
def tier3_import_traces(skill_path: Path, export: Path, output: Path | None, force: bool, dry_run: bool) -> None:
"""Import a production trace export into redacted review candidates."""
from skillevaluator.tier3.trace_import import import_traces

output = output or Path.cwd() / f"{skill_path.resolve().name}-trace-review"
try:
document = import_traces(skill_path, export, output, force=force, dry_run=dry_run)
except (ValueError, OSError) as exc:
raise click.ClickException(str(exc)) from exc
click.echo(f"candidate: {len(document['candidates'])}")
for reason in ("duplicate", "incomplete", "unsupported", "other skill"):
click.echo(f"{reason}: {sum(s['reason'] == reason for s in document['skipped'])}")
for item in document["skipped"]:
click.echo(json.dumps(item, ensure_ascii=False))
for candidate in document["candidates"]:
click.echo(f"{candidate['id']}: redactions={candidate['redactions']} warnings={candidate['warnings']}")
click.echo(f"Next: review {output / 'candidates.json'}, then run skillevaluator tier3 accept-traces {skill_path} {output}")


@tier3.command("accept-traces")
@click.argument("skill_path", type=click.Path(exists=True, file_okay=False, path_type=Path))
@click.argument("review_dir", type=click.Path(exists=True, file_okay=False, path_type=Path))
@click.option("--dry-run", is_flag=True, help="Report additions without writing files.")
def tier3_accept_traces(skill_path: Path, review_dir: Path, dry_run: bool) -> None:
"""Promote only human-reviewed trace candidates into evals/evals.json."""
from skillevaluator.tier3.trace_import import accept_traces

try:
result = accept_traces(skill_path, review_dir, dry_run=dry_run)
except (ValueError, OSError, KeyError, TypeError) as exc:
raise click.ClickException(str(exc)) from exc
for key in ("added", "already present", "skipped"):
click.echo(f"{'would add' if dry_run and key == 'added' else key}: {len(result[key])} {', '.join(result[key])}")
for check in result["validation"]:
click.echo(str(check))
if any(check.status == "error" for check in result["validation"]):
raise click.ClickException("Dataset validation failed after writing")


def _target_argument(func):
return click.argument("target_path", type=click.Path(exists=True, resolve_path=True, path_type=Path))(func)

Expand Down
Loading
Loading