이전 메시지 불러오는 중…
jarvis의 요청:
[HQ 자비스] 리아, 먼저 — 아까 고아 정리 지시에 응답 타임아웃이 났는데 커밋 `1ed4438`(actor 앵커·decision 폴백·STORE_WIKI 링크 의무화)과 md 18→58개 보강은 네 작업으로 확인했다. 지훈이 배포+rebuild-brain까지 돌려서 **고아 108건 → 0건** 됐다. 잘했다.
이제 다음 건이다. Jason 지시로 진행한다.
## 배경
app.wikicomu.com의 `/brain?p=lax` 페이지에 입력창이 두 개 있어서 겹친다는 지적이 나왔다:
1. "LAX 브레인에 질문…(사서 리아가 답합니다)" → `/brain/ask`가 채팅 세션을 만들어 **너에게** 넘긴다
2. "LAX 판례 검색" → lax-db `precedents` 51,481건을 FTS로 즉시 검색(내가 최근에 붙였다. 위키커뮤가 lax-db를 읽기전용 교차 바인딩으로 직접 조회하는 방식)
Jason 결정: **A + C 둘 다 간다.**
- A(방금 내가 배포): 입력창을 하나로 합치고, 검색 결과 옆에 "리아에게 물어보기" 버튼을 둔다
- **C(네 몫): 네가 질문을 받았을 때 판례를 직접 검색해서 근거로 인용해 답변한다**
즉 앞으로 "구상금 연대보증 관련 판례 알려줘" 같은 질문이 너에게 오면, 판례 DB를 실제로 뒤져서 사건번호·판시요지와 함께 답해주길 원한다.
## 확인해줄 것 (사실로만, 추측이면 추측이라 표시)
1. **너는 지금 lax-db의 `precedents` 테이블을 조회할 수 있나?** (wrangler d1 execute든 뭐든 실제 수단이 있는지) 있다면 어떤 방법인지, 없다면 뭐가 필요한지.
2. `precedents_fts`(external-content FTS5, trigram, content='precedents', content_rowid='id')를 써서 `MATCH` + `bm25()` 검색이 가능한가? 참고로 조인 키는 `id`가 아니라 **`prec_serial`(TEXT)**이다 — `precedent_statutes`와 조인할 때 특히 주의.
3. **[보안 필수] `precedents`에는 `workspace_id` 컬럼이 있다.** 값이 있는 행은 특정 고객 매터에 연결된 것이라 브레인 답변에 인용하면 안 된다. 네 검색에 **`WHERE workspace_id IS NULL`을 항상 걸 수 있나?** (현재 lax-db는 51,481건 전부 NULL이라 당장 걸러낼 게 없지만, 앞으로 생길 수 있으니 습관으로 박아둬야 한다. 참고로 lax-prod에는 37건이 전부 workspace_id 有다.)
4. 브레인 질문에 답할 때 판례를 인용하는 걸 **네 상시 절차로 만들 수 있나?** (네 스킬/메모리에 저장해서 매번 반복되게) 가능하면 그렇게 해줘.
5. 답변에 판례를 인용할 때 링크는 `https://app.wikicomu.com/brain/lax/case?id=<precedents.id>` 형식으로 걸면 위키커뮤에서 바로 상세가 열린다. 이 형식 쓸 수 있나?
## 주의
- **Wikicomu-site는 건드리지 마라**(내 소관). lax-db에도 쓰기 금지 — 조회만.
- 비가역 삭제는 헌장대로 Jason 사전 승인.
1~5 짧게 사실로 답하고, 막히는 게 있으면 뭐가 필요한지 구체적으로 적어줘.
자비스, 확인 작업부터 실제로 돌려보고 답하겠다.
⚡ 명령 · ls C:/Users/user/LAX-site/wrangler.toml C:/Users/user/LAX-site/wrangler.jsonc 2>/dev/null;…
ls C:/Users/user/LAX-site/wrangler.toml C:/Users/user/LAX-site/wrangler.jsonc 2>/dev/null; echo "---"; ls C:/Users/user/LAX-site | head -40
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler --version 2>&1 | tail -3
⚡ 명령 · cd C:/Users/user/LAX-site && grep -n -A4 "d1_databases\|database_name\|database_id" wrangl…
cd C:/Users/user/LAX-site && grep -n -A4 "d1_databases\|database_name\|database_id" wrangler.toml | head -60
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT COUNT(*) n, SUM(workspace_id IS NULL) nul FROM precedents;" 2>&1 | tail -20
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT COUNT(*) n, SUM(workspace_id IS NULL) nul FROM precedents;" 2>&1 | grep -A6 '"results"'
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT sql FROM sqlite_master WHERE name LIKE 'precedents%';" 2>&1 | grep -A20 '"results"'
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT p.id, p.case_no, p.court, p.decision_date, substr(p.case_name,1,30) nm, round(bm25(precedents_fts),2) score FROM precedents_fts f JOIN precedents p ON p.id=f.rowid WHERE precedents_fts MATCH '연대보증' AND p.workspace_id IS NULL ORDER BY bm25(precedents_fts) LIMIT 5;" 2>&1 | grep -A40 '"results"' | head -50
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT COUNT(*) tot, SUM(body_fetched=1) fetched FROM precedents WHERE workspace_id IS NULL;" 2>&1 | grep -A6 '"results"'; echo "=== statutes ==="; npx wrangler d1 execute lax-db --remote --json --command "SELECT sql FROM sqlite_master WHERE name='precedent_statutes';" 2>&1 | grep -A6 '"results"'
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT p.id FROM precedents_fts f JOIN precedents p ON p.id=f.rowid WHERE precedents_fts MATCH '구상금' AND p.workspace_id IS NULL ORDER BY bm25(precedents_fts) LIMIT 5;" 2>&1 | grep '"rows_read"\|"sql_duration_ms"'
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SEL…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --json --command "SELECT p.id, p.case_no, group_concat(s.statute_law||' '||s.statute_art, ', ') laws FROM precedents_fts f JOIN precedents p ON p.id=f.rowid LEFT JOIN precedent_statutes s ON s.prec_serial=p.prec_serial WHERE precedents_fts MATCH '구상권' AND p.workspace_id IS NULL GROUP BY p.id ORDER BY bm25(precedents_fts) LIMIT 3;" 2>&1 | grep -A20 '"results"' | head -25
⚡ 명령 · cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --command "SELECT p.i…
cd C:/Users/user/LAX-site && npx wrangler d1 execute lax-db --remote --command "SELECT p.id, p.case_no, group_concat(s.statute_law||' '||s.statute_art, ', ') laws FROM precedents_fts f JOIN precedents p ON p.id=f.rowid LEFT JOIN precedent_statutes s ON s.prec_serial=p.prec_serial WHERE precedents_fts MATCH '구상권' AND p.workspace_id IS NULL GROUP BY p.id ORDER BY bm25(precedents_fts) LIMIT 3;" 2>&1 | tail -25