Workflow Evaluation
Evaluate observable agent behavior and determine whether, where, and how the workflow contributes to it.
Required Source Of Truth
Always read:
docs/ai/project/WORKFLOW_EVALUATION_STANDARD.md
Read when relevant:
docs/ai/project/WORKFLOW_CODING_CONSTITUTION.md when evaluating a coding workflow
docs/ai/project/WORKFLOW_LEARNING_CONSTITUTION.md when evaluating a learning workflow
- normalized session traces
.foreman/ when the repo is Foreman-managed: done.md, log.md, and pre-extracted traces in .foreman/traces/
- observations in
docs/ai/evaluation/observations/
- observations in
docs/ai/evaluation/
- the workflow artifact under review, but only after the blind behavioral pass for trace-first evaluations
- existing reports in
docs/ai/evaluation/reports/
Do not reconstruct the evaluation process from memory when the standard is available.
Route The Evaluation
Choose exactly one strategy and record it in the input contract.
Use trace-first when:
- the goal is workflow improvement, usage diagnosis, or regression review
- the user reports that the agent loops, retries, reworks, asks poorly, runs too much, or needs human correction
- representative session history is available
Use artifact-first when:
- the workflow is new and has no session history
- the goal is design, clarity, safety, portability, adoption, or promotion review
- only workflow artifacts and controlled scenarios are available
When improvement is requested but traces are unavailable, state insufficient runtime evidence. Do not substitute static review for observed behavior without making the scope change explicit.
Boundaries
Do not use this skill to:
- perform the underlying product or coding task
- operate the workflow under review as the product task itself
- fix application code
- treat workflow compliance as the only quality signal
- attribute every agent problem to the workflow
Workflow changes are recommendations or improvement contracts. Implementing them is a separate task unless the user explicitly requests implementation.
Input Contract
Required:
workflow_name
workflow_artifacts
workflow_version
workflow_type
claimed_purpose
claimed_task_classes
evaluation_goal
evaluation_strategy
expected_behavior
prohibited_behavior
runtime_context
Required for trace-first:
session_corpus
- selection, inclusion, and exclusion rules
- known denominator
behavior_questions
- known cohort keys such as task class, workflow version, runtime, model, project, and outcome
Optional:
- comparison target
- known constraints and incidents
- change under test
- agent observations
- raw transcript paths or normalized traces
- baseline scenarios
- evaluation quality plan
- human reference review or calibration set
- quality thresholds
Use unknown for missing fields. Never invent evidence or a denominator.
Foreman Corpus
When the repo is managed by foreman-agent, .foreman/ already supplies corpus, denominator, and outcome labels.
.foreman/traces/<id>-<timestamp>/ holds raw worker transcripts that Foreman copied when an item was approved or rejected; normalize each file with extract_session_trace.py --input before analysis, since Foreman only pins them and never parses them
- a worker on a database-backed runtime such as opencode leaves no copied file; locate that session with
--runtime opencode and the TASK: <id> prompt string instead, and note the coverage gap when it cannot be found
.foreman/done.md is the denominator, with one line per approved item; friction counts convert to rates only against it
↻N on a done.md line is the recorded rework count for that item, and a missing ↻ means zero
.foreman/log.md lines record orchestration-level events with timestamp, id, @agent, type, and detail
A log.md line is direct evidence that the event happened, not evidence of its cause.
Foreman records events without diagnosing them, so cause attribution still needs trace or artifact corroboration.
A flagged line is the exception: it is the human's own observation rather than an event Foreman witnessed.
Treat it as agent-reported-observation strength, and corroborate it against the trace directory carrying the same timestamp before promoting it to a finding.
An item that was rejected and later approved has two trace directories.
Treat the pair as one rework trajectory rather than two independent sessions, and count the item once in the denominator.
.foreman/ is gitignored and lives in each managed repo, not in the workflow repo.
Its path must be supplied explicitly in session_corpus.
Never assume it exists, and state insufficient runtime evidence when it does not.
Foreman only observes the assignment boundary, so log.md alone cannot explain in-session behavior.
Use the traces for first divergence, retries, repeated reads, and tool failures.
Session Trace Preflight
Normalize raw history before analysis when possible.
Transcripts pinned under .foreman/traces/ are raw copies, so run the extractor on each one with --input.
python3 skills/workflow-evaluation/extract_session_trace.py --input <raw-transcript-path> --runtime codex
python3 skills/workflow-evaluation/extract_session_trace.py --input <raw-transcript-path> --runtime claude
python3 skills/workflow-evaluation/extract_session_trace.py --runtime opencode --session-id <session-id>
Latest matching local sessions:
python3 skills/workflow-evaluation/extract_session_trace.py --runtime codex --latest --project <repo-cwd>
python3 skills/workflow-evaluation/extract_session_trace.py --runtime claude --latest --project <repo-cwd>
python3 skills/workflow-evaluation/extract_session_trace.py --runtime opencode --latest --project <repo-cwd>
For Opencode, inspect opencode session list and opencode db path; history is normally in ~/.local/share/opencode/opencode.db.
After extraction:
- use
session-trace.json for metadata and normalized event access
- audit
chat-history.ndjson, command-transcript.ndjson, tool-call-trace.ndjson, and artifact-trail.ndjson directly
- treat
decision-log.json and failure-retry-log.json as extractor output, not proof that semantic decisions or failures were captured completely
- keep the raw source reference for traceability
Four-phase Flow
Use four human-facing phases only:
Frame -> Diagnose -> Decide -> Validate
Outcome reconstruction, segmentation, work classification, aggregation, attribution, workflow mapping, exercises, and replay are internal checklists, not separate workflow phases or required artifacts.
1. Frame
- freeze workflow version, goal, strategy, behavior questions, expected behavior, prohibited behavior, and required outcome evidence
- for trace-first, record corpus selection, inclusion, exclusion, denominator, cohort keys, and incomplete traces
- scan related observations when paths are not supplied; treat them as leads, not findings
- read only workflow metadata needed to identify the version before the blind pass
- for artifact-first, identify the artifact set, claimed scope, and task classes
- if runtime improvement is requested without traces, return
insufficient runtime evidence unless the user accepts an explicit artifact-first scope change
Output: one Evaluation Brief. Do not create a separate artifact when the brief can live in the final report.
2. Diagnose
For trace-first:
- reconstruct intent, acceptance criteria, outcome, human intervention, commands, tool results, file changes, tests, and artifacts
- find the first divergence before focusing on downstream retries or rework
- segment by intent, decision, or hypothesis only when useful
- check misunderstanding, missing or unnecessary clarification, premature execution, repeated work without new evidence, edit-revert, rework, recovery loops, unused artifacts, unsafe actions, missing stops, and unsupported conclusions
- classify work when it explains impact:
productive-discovery, productive-execution, workflow-overhead, rework, recovery, coordination-cost, avoidable-repetition, or unknown
- aggregate comparable sessions by failure mechanism with numerator, denominator, and counterexamples
- only after behavioral findings exist, read workflow rules, attribute cause, consider alternatives, and map findings to workflow contracts or
not related
For artifact-first:
- normalize entry points, phases, inputs, outputs, artifacts, responsibilities, dependencies, assumptions, and stop/escalation rules
- record static findings as
design risk only until trace or exercise evidence corroborates them
Evidence Gate: every main behavioral finding needs direct evidence, first divergence or unknown, honest recurrence status, an alternative explanation, and an evidence status no stronger than the source.
3. Decide
Route each supported finding by attribution:
workflow-caused or workflow-exacerbated: consider the smallest targeted workflow experiment
model-execution: default to do not change workflow
runtime-tool: route to runtime, tool, integration, or recovery
task-environment: route to context, environment, or task contract
inconclusive: collect more evidence
Each workflow experiment defines the observed pattern, first divergence, attribution, falsifiable hypothesis, smallest change, success threshold, regression protection, and regression/neighbor/control replay set.
Output one of: do not change workflow, need more evidence, or run targeted improvement experiment. Adoption verdicts are only for explicit adoption or promotion reviews.
Attribution Gate: the recommendation must match the attributed cause and must not use workflow changes to hide unsupported model, runtime, tool, or environment diagnoses.
4. Validate
Validate evaluator quality:
- audit claim-to-evidence for every main finding
- report
evaluation_quality_status as calibrated, partially-calibrated, or uncalibrated
- show
Chưa đo when human reference or calibration evidence is unavailable
- use
calibrated only when the declared thresholds pass on a representative supported cohort; use partially-calibrated for incomplete coverage or unmet metrics, and uncalibrated when reference evidence is unavailable
- when a calibration set exists, measure evidence support, first-divergence agreement, attribution agreement, and unsupported workflow attribution
- use the standard's initial targets: 100% direct evidence for main findings, at least 80% first-divergence and attribution agreement across at least five human-reviewed sessions, and zero unsupported workflow attribution in the audited sample
- treat small samples as calibration evidence, not statistical proof
Validate workflow changes with comparable regression, neighbor, and control replay. Classify each result as Resolved, Improved but below threshold, Inconclusive, Regressed, or Hypothesis rejected.
For artifact-first, use representative success and stress exercises. Static findings remain design risk until corroborated. Use canonical adoption verdicts only when requested.
Validation Gate: quality status and limitations are visible, main findings pass the claim-to-evidence audit, and every improvement claim has comparable replay evidence.
Finding Contract
Every behavioral finding includes:
- stable finding ID and severity
- evidence status
- cohort and denominator
- observed pattern and trigger
- first divergence
- impact and work classification
- human intervention
- cause attribution and alternative explanation
- root-cause hypothesis and confidence
- workflow mapping when applicable
- smallest change or
do not change workflow
- re-test
Treat observations created by record-workflow-friction as agent-reported-observation. They may describe workflow, model, runtime, tool, environment, task, or coordination friction. Corroborate before upgrading evidence status or calling them workflow failures.
Output
Write a self-contained Vietnamese HTML5 report to:
docs/ai/evaluation/reports/{name}.html
Use docs/ai/project/templates/workflow-evaluation-report.html.
Required section IDs:
#decision-summary
#session-behavior
#key-findings
#cause-attribution
#improvement-impact
#action-plan
#scope-limitations
#evidence-appendix
Report rules:
- keep the decision summary under 120 words and main findings at five or fewer
- put corpus coverage, repeated behavior, first divergence, rework/recovery/repetition, human intervention, and attribution on the main page
- show
evaluation_quality_status, calibration coverage, and Chưa đo for unavailable quality metrics
- keep normalized workflow structure and detailed methodology in the appendix unless directly decision-relevant
- use only measured counts, rates, duration, tokens, or tool calls; show
Chưa đo otherwise
- escape trace content and omit secrets, credentials, tokens, and unnecessary raw transcript
- replace every template placeholder
- use canonical adoption verdicts only when adoption or promotion is actually requested
Done When
Every evaluation:
- uses
Frame, Diagnose, Decide, and Validate as the only human-facing phases
- passes main findings through the Evidence Gate and recommendations through the Attribution Gate
- reports evaluator quality as
calibrated, partially-calibrated, or uncalibrated
- does not treat process completeness or report quality as proof of diagnostic correctness
For trace-first, also require:
- corpus and denominator are explicit
- session outcomes are reconstructed from evidence
- blind behavioral findings exist before workflow mapping
- findings include first divergence, work classification, and cause attribution
- only workflow-related findings create workflow changes
- improvement claims have comparable replay evidence
For artifact-first, also require:
- normalized structure and design risks are explicit
- runtime evidence is not invented
- exercise coverage and limitations are visible
- adoption verdict, when requested, matches the evidence
Every full evaluation ends with the required Vietnamese HTML report and no unresolved template placeholders.
1---2name: workflow-evaluation3description: Evaluate, compare, improve, promote, reject, or review an AI workflow. For workflow improvement and usage diagnosis, analyze real session history trace-first to find agent friction, rework, retries, human intervention, and first divergence before mapping findings back to workflow rules. For new-workflow adoption without traces, review artifacts and controlled exercises. Writes a Vietnamese HTML report to docs/ai/evaluation/reports/.4---56# Workflow Evaluation78Evaluate observable agent behavior and determine whether, where, and how the workflow contributes to it.910## Required Source Of Truth1112Always read:1314- `docs/ai/project/WORKFLOW_EVALUATION_STANDARD.md`1516Read when relevant:1718- `docs/ai/project/WORKFLOW_CODING_CONSTITUTION.md` when evaluating a coding workflow19- `docs/ai/project/WORKFLOW_LEARNING_CONSTITUTION.md` when evaluating a learning workflow20- normalized session traces21- `.foreman/` when the repo is Foreman-managed: `done.md`, `log.md`, and pre-extracted traces in `.foreman/traces/`22- observations in `docs/ai/evaluation/observations/`23- observations in `docs/ai/evaluation/`24- the workflow artifact under review, but only after the blind behavioral pass for trace-first evaluations25- existing reports in `docs/ai/evaluation/reports/`2627Do not reconstruct the evaluation process from memory when the standard is available.2829## Route The Evaluation3031Choose exactly one strategy and record it in the input contract.3233Use `trace-first` when:3435- the goal is workflow improvement, usage diagnosis, or regression review36- the user reports that the agent loops, retries, reworks, asks poorly, runs too much, or needs human correction37- representative session history is available3839Use `artifact-first` when:4041- the workflow is new and has no session history42- the goal is design, clarity, safety, portability, adoption, or promotion review43- only workflow artifacts and controlled scenarios are available4445When improvement is requested but traces are unavailable, state `insufficient runtime evidence`. Do not substitute static review for observed behavior without making the scope change explicit.4647## Boundaries4849Do not use this skill to:5051- perform the underlying product or coding task52- operate the workflow under review as the product task itself53- fix application code54- treat workflow compliance as the only quality signal55- attribute every agent problem to the workflow5657Workflow changes are recommendations or improvement contracts. Implementing them is a separate task unless the user explicitly requests implementation.5859## Input Contract6061Required:6263- `workflow_name`64- `workflow_artifacts`65- `workflow_version`66- `workflow_type`67- `claimed_purpose`68- `claimed_task_classes`69- `evaluation_goal`70- `evaluation_strategy`71- `expected_behavior`72- `prohibited_behavior`73- `runtime_context`7475Required for `trace-first`:7677- `session_corpus`78- selection, inclusion, and exclusion rules79- known denominator80- `behavior_questions`81- known cohort keys such as task class, workflow version, runtime, model, project, and outcome8283Optional:8485- comparison target86- known constraints and incidents87- change under test88- agent observations89- raw transcript paths or normalized traces90- baseline scenarios91- evaluation quality plan92- human reference review or calibration set93- quality thresholds9495Use `unknown` for missing fields. Never invent evidence or a denominator.9697## Foreman Corpus9899When the repo is managed by `foreman-agent`, `.foreman/` already supplies corpus, denominator, and outcome labels.100101- `.foreman/traces/<id>-<timestamp>/` holds raw worker transcripts that Foreman copied when an item was approved or rejected; normalize each file with `extract_session_trace.py --input` before analysis, since Foreman only pins them and never parses them102- a worker on a database-backed runtime such as opencode leaves no copied file; locate that session with `--runtime opencode` and the `TASK: <id>` prompt string instead, and note the coverage gap when it cannot be found103- `.foreman/done.md` is the denominator, with one line per approved item; friction counts convert to rates only against it104- `↻N` on a `done.md` line is the recorded rework count for that item, and a missing `↻` means zero105- `.foreman/log.md` lines record orchestration-level events with timestamp, id, `@agent`, type, and detail106107A `log.md` line is direct evidence that the event happened, not evidence of its cause.108Foreman records events without diagnosing them, so cause attribution still needs trace or artifact corroboration.109110A `flagged` line is the exception: it is the human's own observation rather than an event Foreman witnessed.111Treat it as `agent-reported-observation` strength, and corroborate it against the trace directory carrying the same timestamp before promoting it to a finding.112113An item that was rejected and later approved has two trace directories.114Treat the pair as one rework trajectory rather than two independent sessions, and count the item once in the denominator.115116`.foreman/` is gitignored and lives in each managed repo, not in the workflow repo.117Its path must be supplied explicitly in `session_corpus`.118Never assume it exists, and state `insufficient runtime evidence` when it does not.119120Foreman only observes the assignment boundary, so `log.md` alone cannot explain in-session behavior.121Use the traces for first divergence, retries, repeated reads, and tool failures.122123## Session Trace Preflight124125Normalize raw history before analysis when possible.126Transcripts pinned under `.foreman/traces/` are raw copies, so run the extractor on each one with `--input`.127128```bash129python3 skills/workflow-evaluation/extract_session_trace.py --input <raw-transcript-path> --runtime codex130python3 skills/workflow-evaluation/extract_session_trace.py --input <raw-transcript-path> --runtime claude131python3 skills/workflow-evaluation/extract_session_trace.py --runtime opencode --session-id <session-id>132```133134Latest matching local sessions:135136```bash137python3 skills/workflow-evaluation/extract_session_trace.py --runtime codex --latest --project <repo-cwd>138python3 skills/workflow-evaluation/extract_session_trace.py --runtime claude --latest --project <repo-cwd>139python3 skills/workflow-evaluation/extract_session_trace.py --runtime opencode --latest --project <repo-cwd>140```141142For Opencode, inspect `opencode session list` and `opencode db path`; history is normally in `~/.local/share/opencode/opencode.db`.143144After extraction:145146- use `session-trace.json` for metadata and normalized event access147- audit `chat-history.ndjson`, `command-transcript.ndjson`, `tool-call-trace.ndjson`, and `artifact-trail.ndjson` directly148- treat `decision-log.json` and `failure-retry-log.json` as extractor output, not proof that semantic decisions or failures were captured completely149- keep the raw source reference for traceability150151## Four-phase Flow152153Use four human-facing phases only:154155```text156Frame -> Diagnose -> Decide -> Validate157```158159Outcome reconstruction, segmentation, work classification, aggregation, attribution, workflow mapping, exercises, and replay are internal checklists, not separate workflow phases or required artifacts.160161### 1. Frame162163- freeze workflow version, goal, strategy, behavior questions, expected behavior, prohibited behavior, and required outcome evidence164- for trace-first, record corpus selection, inclusion, exclusion, denominator, cohort keys, and incomplete traces165- scan related observations when paths are not supplied; treat them as leads, not findings166- read only workflow metadata needed to identify the version before the blind pass167- for artifact-first, identify the artifact set, claimed scope, and task classes168- if runtime improvement is requested without traces, return `insufficient runtime evidence` unless the user accepts an explicit artifact-first scope change169170Output: one `Evaluation Brief`. Do not create a separate artifact when the brief can live in the final report.171172### 2. Diagnose173174For trace-first:175176- reconstruct intent, acceptance criteria, outcome, human intervention, commands, tool results, file changes, tests, and artifacts177- find the first divergence before focusing on downstream retries or rework178- segment by intent, decision, or hypothesis only when useful179- check misunderstanding, missing or unnecessary clarification, premature execution, repeated work without new evidence, edit-revert, rework, recovery loops, unused artifacts, unsafe actions, missing stops, and unsupported conclusions180- classify work when it explains impact: `productive-discovery`, `productive-execution`, `workflow-overhead`, `rework`, `recovery`, `coordination-cost`, `avoidable-repetition`, or `unknown`181- aggregate comparable sessions by failure mechanism with numerator, denominator, and counterexamples182- only after behavioral findings exist, read workflow rules, attribute cause, consider alternatives, and map findings to workflow contracts or `not related`183184For artifact-first:185186- normalize entry points, phases, inputs, outputs, artifacts, responsibilities, dependencies, assumptions, and stop/escalation rules187- record static findings as `design risk` only until trace or exercise evidence corroborates them188189`Evidence Gate`: every main behavioral finding needs direct evidence, first divergence or `unknown`, honest recurrence status, an alternative explanation, and an evidence status no stronger than the source.190191### 3. Decide192193Route each supported finding by attribution:194195- `workflow-caused` or `workflow-exacerbated`: consider the smallest targeted workflow experiment196- `model-execution`: default to `do not change workflow`197- `runtime-tool`: route to runtime, tool, integration, or recovery198- `task-environment`: route to context, environment, or task contract199- `inconclusive`: collect more evidence200201Each workflow experiment defines the observed pattern, first divergence, attribution, falsifiable hypothesis, smallest change, success threshold, regression protection, and regression/neighbor/control replay set.202203Output one of: `do not change workflow`, `need more evidence`, or `run targeted improvement experiment`. Adoption verdicts are only for explicit adoption or promotion reviews.204205`Attribution Gate`: the recommendation must match the attributed cause and must not use workflow changes to hide unsupported model, runtime, tool, or environment diagnoses.206207### 4. Validate208209Validate evaluator quality:210211- audit claim-to-evidence for every main finding212- report `evaluation_quality_status` as `calibrated`, `partially-calibrated`, or `uncalibrated`213- show `Chưa đo` when human reference or calibration evidence is unavailable214- use `calibrated` only when the declared thresholds pass on a representative supported cohort; use `partially-calibrated` for incomplete coverage or unmet metrics, and `uncalibrated` when reference evidence is unavailable215- when a calibration set exists, measure evidence support, first-divergence agreement, attribution agreement, and unsupported workflow attribution216- use the standard's initial targets: 100% direct evidence for main findings, at least 80% first-divergence and attribution agreement across at least five human-reviewed sessions, and zero unsupported workflow attribution in the audited sample217- treat small samples as calibration evidence, not statistical proof218219Validate workflow changes with comparable regression, neighbor, and control replay. Classify each result as `Resolved`, `Improved but below threshold`, `Inconclusive`, `Regressed`, or `Hypothesis rejected`.220221For artifact-first, use representative success and stress exercises. Static findings remain `design risk` until corroborated. Use canonical adoption verdicts only when requested.222223`Validation Gate`: quality status and limitations are visible, main findings pass the claim-to-evidence audit, and every improvement claim has comparable replay evidence.224225## Finding Contract226227Every behavioral finding includes:228229- stable finding ID and severity230- evidence status231- cohort and denominator232- observed pattern and trigger233- first divergence234- impact and work classification235- human intervention236- cause attribution and alternative explanation237- root-cause hypothesis and confidence238- workflow mapping when applicable239- smallest change or `do not change workflow`240- re-test241242Treat observations created by `record-workflow-friction` as `agent-reported-observation`. They may describe workflow, model, runtime, tool, environment, task, or coordination friction. Corroborate before upgrading evidence status or calling them workflow failures.243244## Output245246Write a self-contained Vietnamese HTML5 report to:247248```text249docs/ai/evaluation/reports/{name}.html250```251252Use `docs/ai/project/templates/workflow-evaluation-report.html`.253254Required section IDs:255256- `#decision-summary`257- `#session-behavior`258- `#key-findings`259- `#cause-attribution`260- `#improvement-impact`261- `#action-plan`262- `#scope-limitations`263- `#evidence-appendix`264265Report rules:266267- keep the decision summary under 120 words and main findings at five or fewer268- put corpus coverage, repeated behavior, first divergence, rework/recovery/repetition, human intervention, and attribution on the main page269- show `evaluation_quality_status`, calibration coverage, and `Chưa đo` for unavailable quality metrics270- keep normalized workflow structure and detailed methodology in the appendix unless directly decision-relevant271- use only measured counts, rates, duration, tokens, or tool calls; show `Chưa đo` otherwise272- escape trace content and omit secrets, credentials, tokens, and unnecessary raw transcript273- replace every template placeholder274- use canonical adoption verdicts only when adoption or promotion is actually requested275276## Done When277278Every evaluation:279280- uses `Frame`, `Diagnose`, `Decide`, and `Validate` as the only human-facing phases281- passes main findings through the Evidence Gate and recommendations through the Attribution Gate282- reports evaluator quality as `calibrated`, `partially-calibrated`, or `uncalibrated`283- does not treat process completeness or report quality as proof of diagnostic correctness284285For `trace-first`, also require:286287- corpus and denominator are explicit288- session outcomes are reconstructed from evidence289- blind behavioral findings exist before workflow mapping290- findings include first divergence, work classification, and cause attribution291- only workflow-related findings create workflow changes292- improvement claims have comparable replay evidence293294For `artifact-first`, also require:295296- normalized structure and design risks are explicit297- runtime evidence is not invented298- exercise coverage and limitations are visible299- adoption verdict, when requested, matches the evidence300301Every full evaluation ends with the required Vietnamese HTML report and no unresolved template placeholders.