--- name: companyx-rag description: Use this skill when a Company X user asks for answers grounded in Company X internal documents, especially for evidence checks, internal-material summaries, program explanations, or document-based fact verification. runtime: kind: internal_python --- # Company X RAG Use this skill only for Company X users and only when the answer should be grounded in Company X internal documents. ## Trigger - The user is authenticated as a Company X member (`team_id == COMPANYX_TEAM_ID`). - AND the question matches one of the following: - Intent markers: `근거`, `내부 문서`, `내부 자료`, `자료 기준`, `문서 기준`, `문서 확인해줘`, `근거 확인해줘`, `협력`, `MOU`, `계약서`, `투자조합`, `사업계획서`, `정관`, `재무제표`, `재무상태표`, `손익계산서`, `고유번호증`, `서면의결서`, `추천서`, `공문`, `협약`, `소집통지`, `주주총회`, `정기주총`, `결산`, `감사`, `보고서`, `규약`, `인감`, `등기`, `사업자등록`, `팁스`, `TIPS`, `립스`, `LIPS` - Domain markers: `오늘전통`, `옐로펀치`, `yellowpunch`, `x-course`, `컴퍼니엑스`, `company x`, `companyx` - If neither marker matches, the question goes to the normal skill pipeline (calendar, email, news, etc.). - Note: `team_id` alone does NOT trigger grounding. This prevents general queries from being misrouted to document search. (260323 rollback of P1-5, all agents agreed.) ## Current Note - 현재 코드 기준 Company X 팀 사용자는 질문 마커와 무관하게 grounding 경로를 우선 시도합니다. - 위 Trigger 섹션은 운영 의도 설명으로 읽고, 실제 진입 조건 판단은 현재 코드와 workflow 문서를 우선합니다. ## Do - Search Company X internal documents before using general web knowledge. - Answer in this order: 1. direct answer 2. evidence documents 3. short evidence summary - If documents conflict, say they conflict. - If documents are missing, say the evidence is insufficient. ## Do Not - Do not guess missing internal facts. - Do not answer from general web knowledge first when the user expects internal grounding. - Do not dump long raw excerpts without a short explanation. - Do not expose Company X internal grounding to non-Company X users. ## Current Operating Path - Team boundary: `79441171-3951-4870-beb8-916d07fe8be5` - Retrieval service: `skill-rag-file` (`/api/search`, `search_mode=hybrid`) - 검색 경로: 벡터(PGVector cosine) + 키워드(TSVECTOR + GIN) + 그래프(Apache AGE) → RRF 합산 - Embedding: Gemini Embedding 2 (`gemini-embedding-2-preview`), `768d`, skill-embedding 게이트웨이 경유 - Storage: PostgreSQL (pgvector + AGE) 단일 운영. ChromaDB는 레거시(운영 비사용). - 청킹: 텍스트 추출 후 문자 단위 분할 (chunk_size=1000, overlap=200) - 인덱싱 대상: 200개 파일 (`latest_200_companyx.txt`), DB 기준 `team_document` 1,172건 / `team_document_chunk` 3,095건 - NAS 원본: `/mnt/nas/workspace/6.Company X` (53,249 파일) ## Question Types - `fact_check`: 사실 확인 (기본값) — "근거 있어?", "협력 관계야?" - `explanatory`: 설명 요청 — "뭐야?", "설명해줘" - `quantitative`: 수치 질문 — "몇 개야?", "얼마나?" - `recap`: 재정리 — "다시 정리해줘", "문서명만" ## Response Shape - Pydantic 모델: `CompanyXRAGOutput` - `direct_answer`: 1~3문장 답변 (근거 부족 시 빈 문자열) - `evidence_docs`: 근거 문서 파일명 목록 - `failure_reason`: 답변 불가 사유 (`null` 또는 "문서 없음", "단정 불가" 등) - 사용자 응답 구조: 1. Direct answer: `네/아니요/현재는 단정 불가` 2. Evidence section: 문서명, snippet 요약, chunk/page, 점수(score, vec, kw) 3. Limitation section (필요 시): `문서 없음`, `문서 간 불일치`, `최신 집계 미확인`