📄output-workflow-trace-file
- プラグイン
- outputai
- ソース
- GitHub で見る ↗
説明
ローカルの Output SDK ワークフロートレースファイルの出力を読み込み、 見やすいマークダウン形式でレンダリングします。 次のような場合に使用: ユーザーが最近のワークフローの生成結果を確認したい場合、 ローカルのトレースファイルから結果を参照したい場合、 またはトレース出力をドキュメントとしてレンダリングしたい場合。
原文を表示
Read and render the output of a local Output SDK workflow trace file as clean readable markdown. Use when the user wants to view what a recent workflow produced, see the result from a local trace file, or render trace output as a document.
ユースケース
- ✓ワークフローの生成結果を確認したい
- ✓ローカルのトレースファイルから結果を参照したい
- ✓トレース出力をドキュメントとしてレンダリングしたい
本文(日本語訳)
Output.ai ワークフロートレースの最終出力のみを表示します。実際の結果を、読みやすいマークダウン形式でレンダリングします。
$ARGUMENTS - ワークフロー名(例: context_competitors)またはワークフロー実行IDを指定します。空の場合は、すべてのワークフロー中で最新のトレースを使用します。
手順
-
トレース JSON ファイルを見つける:
- トレースファイルは
logs/runs/<workflow_name>/内に JSON ファイルとして保存されています - ファイル名のパターン:
<timestamp>_<workflow_id>.json - ワークフロー名が指定された場合は、
logs/runs/<workflow_name>/内の最新の.jsonファイルを検索します - 実行 ID が指定された場合は、すべての
logs/runs/*/フォルダを横断して、その ID をファイル名に含むファイルを検索します - 引数がない場合は、すべての
logs/runs/*/フォルダの中で最終更新日時が最も新しい.jsonファイルを検索します
- トレースファイルは
-
トレースファイルから出力を抽出する。
JSON ルートのoutput.outputのみが必要です —childrenとinputはスキップしてください。大容量ファイルへの対応方針(トレースファイルは1万行以上になることがあります):
- まず
jq '.output.output' <file>で直接抽出を試みます — これが最も高速な方法です jqが使用できない場合: ファイルの末尾 500 行を読み込んでください(outputフィールドはルートレベルにあり、JSON の末尾付近に位置します)。必要に応じて末尾から逆方向にチャンク単位で読み進めてください- ファイルを先頭から全体読み込みしないでください — ステップ詳細を含む
children配列は数千行に及ぶ可能性があり、その内容は不要です
- まず
-
マークダウンファイルを
tmp/trace_result_<workflow_name>_<id>.mdに保存する(tmp/ディレクトリが存在しない場合は作成してください)。内容は以下の通り:ヘッダー(簡潔に)
- 1行で: ワークフロー名、ID、実行時間
結果
output.outputをきれいで読みやすいマークダウンとしてレンダリングします:- マークダウンを含む文字列フィールド → そのまま直接レンダリング
- オブジェクトの配列 → 主要フィールドをサブセクションとして各要素をレンダリング
- 文字列の配列 → 番号付きリスト
- ネストされたオブジェクト → キーと値のペアをサブセクションとして表示
- URL → リンクとしてレンダリング
- 長いテキストの抜粋 → ブロック引用としてレンダリング
目標は「デバッグのための出力」ではなく「読みたくなるドキュメント」です。見栄えよく仕上げてください。
-
保存したファイルのパスをユーザーに伝える。
重要事項
- これは結果表示です — デバッグ目的ではなく、読みやすさを優先してレンダリングしてください
- ステップの詳細、各ステップの入出力やタイミングは含めないでください
- JSON コードブロックで囲まないでください — ドキュメントとして読めるものにしてください
- 出力は省略せず、すべて含めてください
原文(English)を表示
Show just the final output of an Output.ai workflow trace — the actual result, rendered as readable markdown.
$ARGUMENTS - Either a workflow name (e.g. context_competitors) or a workflow run ID. If empty, use the most recent trace across all workflows.
Instructions
-
Find the trace JSON file:
- Trace files live in
logs/runs/<workflow_name>/as JSON files - Filenames follow the pattern:
<timestamp>_<workflow_id>.json - If a workflow name is given, find the latest
.jsonfile inlogs/runs/<workflow_name>/ - If a run ID is given, search across all
logs/runs/*/folders for a file containing that ID in its filename - If no argument, find the most recently modified
.jsonfile across alllogs/runs/*/folders
- Trace files live in
-
Extract the output from the trace file. You only need
output.outputfrom the JSON root — skipchildrenandinput.Strategy for large files (trace files can be 10k+ lines):
- First, try
jq '.output.output' <file>to extract directly — this is the fastest path - If
jqis not available: read the last 500 lines of the file (theoutputfield is at the root level, near the end of the JSON). Work backwards in chunks if needed - Do NOT read the entire file from the top — the
childrenarray with step details can be thousands of lines and you don't need any of it
- First, try
-
Save a markdown file to
tmp/trace_result_<workflow_name>_<id>.md(create thetmp/directory if it doesn't exist) with:Header (brief)
- One line: workflow name, ID, duration
Result
Render
output.outputas clean, readable markdown:- String fields that contain markdown → render directly
- Arrays of objects → render each as a sub-section with key fields
- Arrays of strings → numbered lists
- Nested objects → sub-sections with key-value pairs
- URLs → render as links
- Long text excerpts → render as blockquotes
The goal is a document you'd want to READ, not debug. Make it look good.
-
Tell the user the saved file path.
Important
- This is a RESULT view — render for readability, not debugging
- Do NOT include step details, inputs/outputs, or timing per step
- Do NOT wrap things in JSON code blocks — this should read like a document
- Include the full output without truncation
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。