この文書は、scriptorium runtime の外部から観測できる retrieval 挙動をまとめたものです。
runtime 全体の公開面は Runtime Contract、artifact の build/load ルールは Artifacts を参照してください。
- search text は matching 前に normalize されます
- full-text tokenization は CJK を含む mixed query を扱います
- path boost と label boost は normalized phrase と token match を使います
search はランク付けされた docs/code ref を返します。
- empty または whitespace-only query は結果なしになります
topKとsnippetLinesは許容範囲内に clamp されますextensionsにより docs / code / 両方を切り替える- result は dedupe 後、score、path、range で sort されます
- 有効な docs index artifact があればまずそれを使います
- 無効または未設定なら Markdown filesystem scan に fallback します
- docs match は arbitrary line ではなく heading block 単位で返します
- heading text と file path は body-only match より強く boost されます
- snapshot-backed source は prebuilt snapshot を先に検索します
- snapshot path が使えない場合は configured filesystem root を scan します
- line match は matched line を中心にした
code_rangeref になります - 同一 file 内で近接する hit は cluster され、最良の local result を残します
- line match がなくても path や source label が強く合う場合は line 1 anchored の file-level fallback を返せます
mode=implementation は追加的な ranking hint です。
- startup / entrypoint file を boost
- DI / service registration hint を boost
- route / endpoint material を boost
- attribute / decorator pattern を boost
- config-oriented material を boost
- docs と code の両方に有用な match があれば、両 corpus から少なくとも 1 件ずつ返す方向に寄せます
- docs snippet は一致した heading block の先頭から切り出します
- code snippet は可能なら matched line を中心に取ります
- 長さは
snippetLinesで制御する
get_content は 1 つの refId を解決します。
snippet: anchor 周辺の focused rangefull: block または file 全体。ただしmaxLinesに従うmulti_range: 重要行の周辺 range を強調表示
- Markdown ref は heading block を解決します
- slug が file 内の heading block を指します
snippetとfullはその block に対して動作しますmulti_rangeは ordered list、bullet list、nested heading など flow に有用な行を中心に range を作ります
- code ref は logical code path と line anchor を解決します
snippetは requested line を中心に切り出しますfullは truncate 条件付きで file 全体を返しますmulti_rangeは anchor line、近傍の signature、route handler、そのほか注目すべき実装行を強調します
- file ref は line anchor なしで file path 全体を解決します
- docs-only mode では code source に対する code/file ref は使えません
expand_related は 1 つ以上の seed ref から supporting ref を探します。
- seed は Markdown または code context として読み込まれます
- overlap token、import-like token、path proximity、framework tag が score に寄与します
- result には opaque な score だけでなく、score の理由も含まれます
- docs と code の candidate は同じ response に混在できます
mode=implementation では startup wiring、DI、route、attribute/decorator、config link など framework-aware な relation を追加で考慮します。
summarize_flow は refs を決定的な step list に変換します。
Markdown:
- numbered steps
手順1のような labeled step- bullet lists
- nested headings
- paragraph fallback
Code:
- route handler、function/class signature、認識可能な operation から candidate step を作ります
- style により step の compactness が変わります
flow: title、description、ref を持つ順序付き stepassumptions: fallback が入った理由confidence: source quality と merge 安定性に基づく定性的な confidence
使える ref がない場合も protocol error にはせず、requested topic から fallback を作ります。
guide_implementation は retrieval tool を束ねて、根拠付きの implementation guide を 1 回で返します。
topic,framework,languageから query を構築します- implementation-mode の docs/code search を実行します
- 最良の initial seed から supporting ref を追加収集します
- その ref を flow summary にして短い implementation guide を組み立てます
docs,sampleCode,assumptions,confidenceを分けて返します
guide は現在の corpus に grounding されます。supporting ref が足りない場合は、その制約を response に明記し、存在しない source を補完しません。