ESS 诊断技能集
ESS-Diagnostics-Skills
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 31
- Forks
- 19
02 资源文件 4
- 参考文档docs/plans/2026-09-17-ess-diagnostics-design.md14.1 KB
- 参考文档docs/plans/2026-09-17-ess-diagnostics-implementation.md20.3 KB
- 参考文档README.md3.9 KB
- 脚本scripts/transcript_to_json.py5.1 KB
03 SKILL.md 正文
Diagnose an ESS Transcript
Read-only diagnostic skill that walks a Field Engineer (FDE) turn-by-turn
through a Copilot Studio / PVA transcript (a JSON payload exported as a .txt
file), running a 5-check diagnostic on each turn with evidence quoted straight
from the transcript. It produces an evidence-cited markdown Debug Report plus a
normalized-transcript JSON artifact. This skill replaces the earlier standalone
Python diagnostics tool.
Rules
- This skill is read-only. The ONLY writes it may make are the three output files written in Step 4: the markdown Debug Report, the normalized-transcript JSON, and the faithful full-transcript JSON. Never modify the transcript, agent files, or anything else.
- Do NOT narrate your internal process. Say "Let me walk you through this transcript" not "Let me read the parse map." Speak directly to the FDE.
- Do not proceed past Step 0 until the FDE has stated the problem and you have confirmed the transcript file path. This is a hard stop: ask even if a problem statement was already supplied in the invocation — echo the supplied statement back and have the FDE confirm or refine it. Never parse the transcript before the problem is established.
- Every check verdict MUST quote the specific transcript field value it rests on (the actual query string, result names, and so on). Make no claim the transcript does not support.
- Walk the transcript one turn at a time. After presenting a turn's checks, pause and ask the FDE to confirm or add context before advancing to the next turn.
- Track progress with todos if the transcript has many turns.
Step 0: Establish the Problem
On invocation, STOP before doing anything else. Do not read or parse the transcript yet — the problem must be established first.
Confirm the transcript file path with the FDE, stating the path you were given. Then ask explicitly: "What specific problem are you investigating in this transcript?"
If a problem statement was supplied in the invocation arguments, echo it back verbatim and ask the FDE to confirm it as-is or refine it — do NOT silently accept it.
Only once the FDE has given or confirmed the problem statement AND the file path is confirmed may you proceed to Step 1. Keep the confirmed problem statement — it is cited in the final report.
Step 1: Read and Parse the Transcript
Read the transcript file (a JSON payload stored in a .txt) and extract the
events you will need for the checks.
Iterate events by their array position in the transcript, NOT by seq.
seq is unreliable — some event kinds (e.g. TranscriptTrace) repeat
seq: -1 many times. The array/list order is canonical; walk it in order.
Top-level events are objects with t (the event kind) and p (its payload).
All diagnostic signals are t = "Trace" events discriminated by p.data.kind.
Extract events using this parse map:
| Concept | Where it lives | Fields |
|---|---|---|
| User utterance | t = SynchronousIncomingActivity (only p.activity.type = "message") |
p.activity.text |
| Bot message | t = OutgoingActivity (only p.activity.type = "message") |
p.activity.text |
| Intent recognized | t = Trace, p.data.kind = LlmIntentRecognized |
intentId, intentMessage, userUtterance |
| Search issued | t = Trace, p.data.kind = PluginStart |
p.data.input.search_query, p.data.input.search_keywords, pluginName |
| Search results | t = Trace, p.data.kind = PluginResponse |
citableContent[] (source, chunks), output |
| Grounding / answer signal | t = Trace, p.data.kind = AnalyticsAiMetricsSignalTraceData |
completionState, triggeredGptFallback, rewrittenMessage, rewrittenMessageKeywords, verifiedSearchResults[] (url, rankScore, snippet), citedKnowledgeSources, textCitations |
| Knowledge search state | t = Trace, p.data.kind = KnowledgeTraceData |
isKnowledgeSearched, completionState, citedKnowledgeSources, failedKnowledgeSourcesTypes |
Only activities with p.activity.type = "message" are real user or bot turns;
activities with p.activity.type = "event" are system plumbing and must be
skipped for turn segmentation. Result shapes differ by trace:
PluginResponse.citableContent[] items have source + chunks, while
AnalyticsAiMetricsSignalTraceData.verifiedSearchResults[] items have url,
rankScore, snippet, searchType — a rankScore DOES exist there.
If a mapped field or event kind is absent in a given transcript, mark the affected check N/A with a note like "field not present in this transcript" rather than failing or guessing. This map derives from observed real exports; field names may vary by bot configuration.
Segment the events into turns. A turn is a user utterance plus the bot activity and trace events that follow it, up to (but not including) the next user utterance. Group events into turns by walking array order.
After parsing, tell the FDE how many turns were found before starting the per-turn walkthrough.
Faithful transcript-to-JSON (helper script)
The transcript is a large JSON-in-.txt payload. To give the FDE a complete,
readable JSON copy of the WHOLE transcript — every event and field preserved,
not just the diagnostic fields — run the bundled helper rather than hand-parsing
it:
python scripts/transcript_to_json.py "<transcript-path>"
(On Windows use python; on POSIX use python3.) Run from the skill directory
tools/ESS-Diagnostics-Skills/. It writes a
lossless, pretty-printed <transcript-name>-transcript.json into the same OS
temp folder used for the other outputs (see Step 4), annotating each event with
a _turn and _index but removing nothing, and prints the absolute output path
(or an Error: ... line on failure — relay that to the FDE rather than
retrying blindly). This faithful dump is SEPARATE from the compact
normalized-diagnostic JSON written in Step 4; produce both.
Step 2: Walk Each Turn Through the 5 Checks
Walk the turns in array order from Step 1. For each turn, first present the user utterance and the bot's response, then run CHECK-001 through CHECK-005 in order. Give each check a verdict of Pass, Fail, or N/A, and quote the specific transcript field value that the verdict rests on as evidence.
If an earlier check in the same turn already failed and that failure removes a later check's precondition (for example, no intent was recognized, so no search could fire), mark the later check N/A rather than Fail, and note which earlier check it depends on — this avoids counting one root cause as several failures.
Interactive pause protocol
After running the 5 checks for a turn, do NOT advance on your own. Present a compact structured summary, then a section menu, and STOP. Wait for the FDE. You may NOT look at or process the next turn until the FDE responds.
First, present a structured summary of the turn — not just the verdicts:
- Intent — the recognized intent (
intentId/intentMessage), or, when recognition did not land, the failure signal (triggeredGptFallback). - Search query — the original user prompt AND the issued / rewritten query and keywords.
- Search response — a compact one-line-per-result list of EVERY returned
result (not just the count): for each result show its identifier (e.g. the KB
number from the source text), its title / short description, and its
rankScore. This makes a mis-ranked but topically correct source visible at a glance. Then note the cited sources and what the bot actually answered. - Verdict strip — a one-line summary, e.g.
001 Pass · 002 Pass · 003 Pass · 004 Pass · 005 Pass.
Then present this menu and STOP — wait for the FDE before touching the next turn:
Drill into a section, or advance:
1. Intent 2. Search query 3. Search results
4. Grounding 5. Final answer
[continue] next turn [run all] finish without pausing [override] a verdict
From this first pause onward, if the FDE types run all, switch to a batch
pass: auto-advance through all remaining turns without pausing, still collecting
everything the full report needs.
If the FDE picks a section number (1–5), show the FULL raw transcript
evidence for that section — the complete search_query + search_keywords, the
full verifiedSearchResults / citableContent list, the full intent object, or
the complete bot answer text, as applies — PLUS the reasoning behind that
section's check verdict (why Pass / Fail / N/A). For section 3 (Search
results) specifically, show the Source Text for EVERY result returned — for
each result, its full citableContent[].chunks source text along with its
source / url, rankScore, and searchType. Do not show only the top result
or a snippet; list all of them, in the order returned, so the FDE can see
whether a topically correct source was retrieved but under-ranked or not cited.
Explicitly invite the FDE to OVERRIDE the verdict if their domain knowledge says
it is wrong. After a drill-down, return to the SAME turn's menu; do not
auto-advance.
If the FDE overrides a verdict (via [override] or during a drill-down),
record it: which check, the skill's original verdict, the FDE's override
verdict, and the FDE's stated reason. Carry the override (with its reason) into
the final Debug Report. An overridden verdict REPLACES the skill's verdict for
divergence and root-cause purposes in Step 3.
continue advances to the next turn. The loop repeats — summary, menu, hard
stop — for every turn until all turns are done, unless run all was chosen.
-
CHECK-001 — Intent Recognition. Pass if the turn has an
LlmIntentRecognizedevent (quote itsintentId/intentMessage). Fail if there is no intent event at all, OR the turn'sAnalyticsAiMetricsSignalTraceDatacarriestriggeredGptFallback = true(quote thetriggeredGptFallbackflag) — that fallback flag is the real signal that intent recognition did not land. (Some exports may instead surface an explicit unknown-intent event; the real signal here istriggeredGptFallback.) This is the first divergence candidate — a fail here often explains a downstream decline. -
CHECK-002 — Search Query Issued. Pass if a
PluginStartcarries a non-emptyp.data.input.search_queryorp.data.input.search_keywords. When reporting this check, ALWAYS show three things:- Original user prompt — the turn's user utterance from the
SynchronousIncomingActivityp.activity.text. (Prefer this: theuserUtterancefield on theLlmIntentRecognizedevent is often empty.) - Issued search query / keywords — the actual
p.data.input.search_queryandp.data.input.search_keywordsvalues. - Rewrite note — read this DIRECTLY from
rewrittenMessage/rewrittenMessageKeywordson theAnalyticsAiMetricsSignalTraceData; do NOT infer it. If a rewrite is present and materially different from the issued query / original prompt, quote it (e.g. "query was rewritten to '<rewrittenMessage>'"); otherwise state "no rewrite." Dropping filler/stopwords while keeping the key search term(s) does NOT count as a material rewrite — mark that "no rewrite." Treat it as a rewrite only when the key term itself changed, was dropped, or was narrowed/broadened in a way that could change what gets retrieved. A bad rewrite (dropping the key term) can itself be the root cause.
Fail if a knowledge answer was expected but no search fired. N/A if the turn is not knowledge-seeking (e.g. a greeting).
- Original user prompt — the turn's user utterance from the
-
CHECK-003 — Search Result Topical Relevance. Pass if the returned results are topically relevant to the query/keywords. Prefer
verifiedSearchResults[].rankScoretogether with each result'ssnippetwhere present (arankScoreDOES exist onAnalyticsAiMetricsSignalTraceData.verifiedSearchResults[]). Where that is absent, fall back to keyword overlap between the query/keywords and the result'ssnippet/sourceor thePluginResponse.citableContent[].chunks— ignore common English stopwords and tokens shorter than 2 chars, and require a real shared term. Fail if results came back but none are relevant. N/A if no search was issued. When reporting this check, list EVERY returned result with its source text (citableContent[].chunks) andrankScore, not just the top hit — a topically correct source that was retrieved but under-ranked or not cited is itself the finding. -
CHECK-004 — Knowledge Grounding Consistency. Judge this from the mapped fields only:
isKnowledgeSearched,completionState,citedKnowledgeSources, and theverifiedSearchResultscount, versus what the bot's finalOutgoingActivityp.activity.textdoes with them. Pass if the two are consistent — the answer presents substantive knowledge AND knowledge was searched / results were returned, OR the answer declines / says it lacks information AND nothing usable was retrieved. Fail on a mismatch — the answer presents specific knowledge as fact but nothing (verifiedSearchResults/citedKnowledgeSources) backed it (ungrounded), or results were returned yet the answer ignores them and declines. Quote theverifiedSearchResultscount /completionState/citedKnowledgeSourcesand the relevant answer text as evidence. N/A if the turn is not knowledge-seeking. -
CHECK-005 — Final Answer vs. Retrieved Content / Guardrails. Pass if the bot's final
OutgoingActivitytext aligns with what was retrieved (verifiedSearchResults/citedKnowledgeSources/textCitations), OR the bot appropriately declined / gave a guardrail response when no relevant content was found. Fail if it answered with unsupported content (not backed by retrieved results), or it declined despite having relevant results.
Step 3: Identify Divergence and Root Cause
After all turns are walked, identify the FIRST failing check across the whole transcript — the earliest turn, then the lowest check number within that turn. That check is the divergence point.
Compose a root cause statement derived from that first failure, citing the evidence that supports it (the quoted query, result names, search_results count, or answer text behind the failing check).
If NO check failed anywhere, state that explicitly: there is no divergence and the transcript looks healthy. Do not invent a problem where the evidence shows none.
Step 4: Write the Outputs
After the walkthrough and diagnosis, write three files into a per-run subfolder outside the repo, in the OS temporary directory. These outputs may contain employee PII (utterances, retrieved policy content), so they are written outside the repo and must NEVER be committed to source control or shared outside approved channels.
Derive the file basename from the transcript's file name — for a transcript
foo.txt, the transcript name is foo. Write all three files into a per-run
subfolder named for the transcript:
- On Windows:
%TEMP%\ess-diagnostics\<transcript-name>\ - On POSIX:
$TMPDIR(or/tmpwhen$TMPDIRis unset)/ess-diagnostics/<transcript-name>/
Create the subfolder if it does not exist.
1. Markdown Debug Report — <temp-dir>/ess-diagnostics/<transcript-name>/<transcript-name>-debug-report.md.
This is the human-readable diagnosis. It MUST contain:
- The confirmed problem statement (the one confirmed with the FDE in Step 0).
- Per-turn checklist results — for each turn, the user utterance and the bot response, followed by the 5 check verdicts (Pass / Fail / N/A), each with its quoted transcript evidence.
- FDE verdict overrides — a section listing every verdict the FDE overrode during the walkthrough. For each override, list: which check, the skill's original verdict, the FDE's override verdict, and the FDE's stated reason. Note that the overridden verdicts are the ones used for the divergence and root-cause analysis. If there were no overrides, state that.
- The divergence point (from Step 3).
- The root cause (from Step 3).
2. Normalized-transcript JSON — <temp-dir>/ess-diagnostics/<transcript-name>/<transcript-name>-normalized.json.
This is a normalized transcript ONLY — a clean, flattened, reusable parsed
artifact. It carries NO diagnostic verdicts, checks, divergence, or root cause;
those live only in the markdown report. It is an array of turn objects in array
order. Each turn object contains:
user_utterance— the user's prompt text, fromSynchronousIncomingActivity.p.activity.text.intent— an object:{ "kind": "LlmIntentRecognized" | null, "intentId": ..., "intentMessage": ..., "userUtterance": ..., "triggeredGptFallback": <true|false> }. PopulateintentId/intentMessage/userUtterancefrom theLlmIntentRecognizedevent; usenullfor any field that is absent, andnullforkindwhen no intent event fired. Represent intent-recognition failure viatriggeredGptFallback(read from theAnalyticsAiMetricsSignalTraceData).search— an object:{ "original_prompt": ..., "query": <search_query>, "keywords": <search_keywords>, "rewritten_message": <rewrittenMessage|null>, "rewritten_keywords": <rewrittenMessageKeywords|null>, "rewritten": <true|false>, "rewrite_note": ... }.query/keywordscome fromPluginStart.p.data.input.search_query/search_keywords;rewritten_message/rewritten_keywordscome fromrewrittenMessage/rewrittenMessageKeywordson theAnalyticsAiMetricsSignalTraceData. Setrewritten/rewrite_noteby comparing the original prompt to the issued query: dropping filler/stopwords while the key search term(s) stay the same =>false/"no rewrite"; a change to the key term itself (changed, dropped, or narrowed/broadened so retrieval could differ) =>truewith a note of what changed. Usenull/ empty values when no search occurred.search_results— an array of the real result objects returned. FromAnalyticsAiMetricsSignalTraceData.verifiedSearchResults[]use keysurl,rankScore,snippet,searchType; and/or fromPluginResponse.citableContent[]use items withsource,chunks. Emit them exactly as returned; an empty array if none.grounding— an object:{ "isKnowledgeSearched": <bool>, "completionState": ..., "citedKnowledgeSources": [...], "triggeredGptFallback": <bool> }, from theKnowledgeTraceData/AnalyticsAiMetricsSignalTraceDatafields.bot_text— the bot'sOutgoingActivity.p.activity.textfor the turn.
Emit each turn object in this shape. Example of ONE populated turn object:
{
"user_utterance": "How much parental leave do I get?",
"intent": {
"kind": "LlmIntentRecognized",
"intentId": "KnowledgeSearch",
"intentMessage": "User is asking about parental leave policy",
"userUtterance": "How much parental leave do I get?",
"triggeredGptFallback": false
},
"search": {
"original_prompt": "How much parental leave do I get?",
"query": "parental leave entitlement",
"keywords": "parental leave",
"rewritten_message": null,
"rewritten_keywords": null,
"rewritten": false,
"rewrite_note": "no rewrite"
},
"search_results": [
{
"url": "https://contoso.example/policies/parental-leave-2025",
"rankScore": 0.87,
"snippet": "Eligible employees receive up to 16 weeks of paid parental leave.",
"searchType": "Semantic"
}
],
"grounding": {
"isKnowledgeSearched": true,
"completionState": "Answered",
"citedKnowledgeSources": [
"https://contoso.example/policies/parental-leave-2025"
],
"triggeredGptFallback": false
},
"bot_text": "Eligible employees receive up to 16 weeks of paid parental leave."
}
Remember: the normalized JSON contains NO verdicts, checks, divergence, or root cause — those belong only in the markdown Debug Report.
3. Faithful transcript JSON — <temp-dir>/ess-diagnostics/<transcript-name>/<transcript-name>-transcript.json.
This is the COMPLETE original transcript converted to readable JSON — every
event and every field preserved, nothing dropped (unlike the compact normalized
JSON above, which keeps only the diagnostic fields). Produce it with the bundled
helper introduced in Step 1:
python scripts/transcript_to_json.py "<transcript-path>"
The helper writes this file into the same per-run temp folder and prints its absolute path. Do not hand-build this file; use the helper so the dump stays lossless.
After writing all three files, tell the FDE the three absolute output file paths in the temp directory: the markdown Debug Report, the normalized-diagnostic JSON, and the faithful transcript JSON.
04 同仓库更多 Skills
topic-actions
暂无简介
servicenow-da
暂无简介
servicenow-da-itsm
暂无简介
servicenow-da-hrsd
暂无简介
更新
update
暂无简介
测试
test
暂无简介