The existing codebase RAG engine (src/review/rag.ts, retrieveContext/retrieveContextWithMetrics) and its review-path wiring (src/review/rag-wire.ts) build the retrieval QUERY from a PR's changed files + diff (buildRagQuery at src/review/rag-wire.ts:144, prepending the PR title to the changed-paths list + a diff sample). For the miner's ANALYZE phase there is no diff yet — only an issue's title + body — so this issue adds the issue-centric analogue of buildRagQuery, reusing the SAME underlying retrieveContext/retrieveContextWithMetrics retrieval engine unchanged.
This is a pure query-composition function (mirrors buildRagQuery's existing pattern exactly, just swapping the input source), so it's foundation-tier and independent of anything else in this phase.
Deliverables
References
src/review/rag-wire.ts:144 (buildRagQuery — the PR-centric analogue this issue mirrors)
src/review/rag-wire.ts:32 (MAX_QUERY_PATHS/MAX_QUERY_DIFF_CHARS budget constants to mirror)
src/review/rag.ts:358 (MIN_QUERY_CHARS — the existing floor this issue's output must still respect)
src/review/rag.ts:394 (retrieveContextWithMetrics signature — the function this issue's query text ultimately feeds, unchanged)
The existing codebase RAG engine (
src/review/rag.ts,retrieveContext/retrieveContextWithMetrics) and its review-path wiring (src/review/rag-wire.ts) build the retrieval QUERY from a PR's changed files + diff (buildRagQueryatsrc/review/rag-wire.ts:144, prepending the PR title to the changed-paths list + a diff sample). For the miner's ANALYZE phase there is no diff yet — only an issue's title + body — so this issue adds the issue-centric analogue ofbuildRagQuery, reusing the SAME underlyingretrieveContext/retrieveContextWithMetricsretrieval engine unchanged.This is a pure query-composition function (mirrors
buildRagQuery's existing pattern exactly, just swapping the input source), so it's foundation-tier and independent of anything else in this phase.Deliverables
src/review/issue-rag-wire.ts(co-located with the existingrag-wire.tssince it composes over the SAMEretrieveContextWithMetrics/createReviewAdaptersplumbing) exportingbuildIssueRagQuery(input: { title: string; body?: string; labels?: string[] }), returning{ queryText: string }buildRagQuery's style: prepend the issue title, then the body (bounded — reuse the sameMAX_QUERY_DIFF_CHARS-style budget constant, renamed appropriately, atsrc/review/rag-wire.ts:34), then append labels as a short hint lineMIN_QUERY_CHARSfloor already enforced insideretrieveContextWithMetrics(src/review/rag.ts:358) — a one-line issue produces""and the caller degrades to no-context, exactly like the PR pathretrieveContext/retrieveContextWithMetrics/upsertChunksinsrc/review/rag.ts— this issue only builds the query TEXT; retrieval itself is reused unchangedReferences
src/review/rag-wire.ts:144(buildRagQuery— the PR-centric analogue this issue mirrors)src/review/rag-wire.ts:32(MAX_QUERY_PATHS/MAX_QUERY_DIFF_CHARSbudget constants to mirror)src/review/rag.ts:358(MIN_QUERY_CHARS— the existing floor this issue's output must still respect)src/review/rag.ts:394(retrieveContextWithMetricssignature — the function this issue's query text ultimately feeds, unchanged)