Skip to content

feat: add BM25 pre-search to QA workflow and remove keyword-search (#382)#385

Draft
kiyotis wants to merge 37 commits into
mainfrom
worktree-text-search
Draft

feat: add BM25 pre-search to QA workflow and remove keyword-search (#382)#385
kiyotis wants to merge 37 commits into
mainfrom
worktree-text-search

Conversation

@kiyotis

@kiyotis kiyotis commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

See steering.

kiyotis and others added 30 commits June 25, 2026 10:48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n, add incremental test steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tional

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add scripts/bm25-search.sh that wraps bm25s Python library.
Builds index from knowledge/*.json on first run, saves to
scripts/.bm25-index/, and reloads on subsequent calls.
Detects staleness by comparing index mtime to newest JSON mtime.
Returns top-20 sections as JSON array with file, section_id,
section_title, and score fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Insert Step 3 (BM25 pre-search) between Step 2 (ask user) and the
former Step 3 (semantic search). Renumber former Steps 3-8 to Steps 4-9
and update all internal cross-references (Step 5→6 in answer generation
pointer, Step 6→7 in verify pointer, Step 8→9 in output pointer).

BM25 path: extract narrow terms → bm25-search.sh → read-sections.sh
→ generate answer → verify → if PASS skip Steps 4-8 to Step 9.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…qa.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…h.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er/verify-answer)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntent check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…w recorded

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Aligns parameter name with verify-answer.md's output field name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds check-answerable.md workflow that judges whether BM25 hits are
sufficient to answer the question. Updates qa.md to the agreed flow:
Step 1 hearing → Step 2 full-text-search → Step 3 check-answerable
(OK→Step5 / NG→Step4) → Step 4 semantic-search → Step 5 generate-answer
→ Step 6 verify-answer (FAIL→regenerate with {findings}) → Step 7 output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rding

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…8 issue noted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ge title lookup

Pass the full component page title list (libraries/handlers/adapters, 130 files)
to LLM as a translation table. LLM maps question concepts to Nablarch-specific
terms by finding related page titles and extracting their hyphenated keywords.

Example: "バリデーション" → sees libraries-bean-validation in titles
         → uses "bean-validation" as BM25 search term.

This eliminates the need for LLM to know Nablarch-specific terminology a priori.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…riment results recorded

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-search.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kiyotis and others added 7 commits June 26, 2026 10:15
…p procedure clarified

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…W-TO-RUN.md reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…full benchmark steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… pending

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant