ローカル(パソコン内に保存された)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.
ワークフロー実行のトレース(実行記録)から最終的な結果だけを抽出し、読みやすいマークダウン形式で表示します。
ユーザーが指定する引数は、ワークフロー名(例:context_competitors)または実行ID のいずれかです。引数が指定されない場合は、すべてのワークフローの中で最も新しいトレースを使用します。
トレースJSONファイルを探す:
logs/runs/<ワークフロー名>/ フォルダ内にJSON形式で保存されています<タイムスタンプ>_<ワークフローID>.jsonlogs/runs/<ワークフロー名>/ 内で最新の .json ファイルを探しますlogs/runs/*/ フォルダを検索して、そのIDを含むファイル名のファイルを見つけますlogs/runs/*/ フォルダ内で最も新しく更新されたJSONファイルを探しますトレースファイルから結果を取り出す
JSON ルートレベルの output フィールドだけが必要です。children や input は読み込みません。
大きなファイル対応(トレースファイルは1万行以上になることがあります):
jq '.output' <ファイル> を試す — これが最速ですjq が使えない場合:ファイルの最後の500行を読む(output フィールドはJSON の根元にあり、ファイルの終わり近くにあります)。必要に応じてさかのぼって処理しますchildren 配列には数千行のステップ詳細が含まれており、必要ありませんマークダウンファイルを tmp/trace_result_<ワークフロー名>_<ID>.md に保存(tmp/ ディレクトリがなければ作成)します。以下の内容を含めます:
output を読みやすくきれいなマークダウン形式でレンダリング:
目標は「デバッグ用」ではなく「読んで理解したい」ドキュメントです。見栄えよく整形してください。
ユーザーに保存ファイルのパスを伝えます
Show just the final output of an Output.ai workflow trace — the actual result, rendered as readable markdown.
The argument the user provided is either a workflow name (e.g. context_competitors) or a workflow run ID. If no argument is provided, use the most recent trace across all workflows.
Find the trace JSON file:
logs/runs/<workflow_name>/ as JSON files<timestamp>_<workflow_id>.json.json file in logs/runs/<workflow_name>/logs/runs/*/ folders for a file containing that ID in its filename.json file across all logs/runs/*/ foldersExtract the output from the trace file. You only need output from the JSON root — skip children and input.
Strategy for large files (trace files can be 10k+ lines):
jq '.output' <file> to extract directly — this is the fastest pathjq is not available: read the last 500 lines of the file (the output field is at the root level, near the end of the JSON). Work backwards in chunks if neededchildren array with step details can be thousands of lines and you don't need any of itSave a markdown file to tmp/trace_result_<workflow_name>_<id>.md (create the tmp/ directory if it doesn't exist) with:
Render output as clean, readable markdown:
The goal is a document you'd want to READ, not debug. Make it look good.
Tell the user the saved file path.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。