[RAG] Implement visual conflict and density metadata tags for enhanced context intelligence
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
# docs Chronicle Records
|
||||||
|
|
||||||
|
## Project
|
||||||
|
- ID: docs
|
||||||
|
- Root: /Volumes/Data/project/Antigravity/ConnectAI/docs
|
||||||
|
- Record root: /Volumes/Data/project/Antigravity/ConnectAI/docs/docs/records/docs
|
||||||
|
- Detail level: standard
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
Capture project direction, architecture discussion, decisions, and development notes as Markdown.
|
||||||
|
|
||||||
|
## Folders
|
||||||
|
- `planning/`
|
||||||
|
- `discussions/`
|
||||||
|
- `decisions/`
|
||||||
|
- `development/`
|
||||||
|
- `bugs/`
|
||||||
|
- `retrospectives/`
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# Bug: Viewed integration_retrieval.test.ts:1-59 `integration_retrieval.test.ts`를 통해 **...
|
||||||
|
|
||||||
|
## Date
|
||||||
|
2026-05-05
|
||||||
|
|
||||||
|
## Symptom
|
||||||
|
Viewed integration_retrieval.test.ts:1-59 `integration_retrieval.test.ts`를 통해 **ConnectAI**의 지능형 검색 엔진(Astra Engine)이 실전 수준의 **상충 감지(Conflict Detection)** 능력을 갖추고 있음을 확인했습니다. 특히 `doc2.md`와 같이 "충돌", "오류", "논란", "반대" 등 부정적 지표가 다수 포함된 문서에 대해 `conflictDetected: true`와 `HIGH` 심각도를 부여하는 로직은, 단순히 데이터를 수집하는 것을 넘어 **'수집된 지식의 위험도를 스스로 평가'**할 수 있음을 의미합니다. 이는 사용자께서 강조하신 "다시 검증할 수 있는 수집 흐름"의 핵심적인 기술적 근거가 됩니다. 이제 프로젝트의 고수준 운영 전략과 데이터 관리 정책을 파악하기 위해, `docs/records/src/chronicle.config.json`을 살펴보겠습니다. 이를 통해 수집 ...
|
||||||
|
|
||||||
|
## Cause
|
||||||
|
Captured automatically from the current conversation. Confirm root cause during follow-up review if needed.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
## 간단 요약 이 요청은 프로젝트 지식 생성이 아니라 코드리뷰와 제품 평가 요청입니다. 확인된 파일 구조 기준으로 보면, 이 프로젝트는 지식 수집 워크플로우를 앱 형태로 묶어 운영하려는 도구로 보이며, 먼저 데이터 수집 흐름의 안정성, 외부 연동 실패 처리, 수집 결과의 저장/재처리 가능성을 중심으로 평가해야 합니다. ## 확인된 근거 대상 경로: `/Volumes/Data/project/Antigravity/ConnectAI/src` 확인된 우선 파일: - `docs/records/src/README.md` - `docs/records/src/bugs/BUG-0001-edited-agent-ts-edited-agent-ts-edited-agent-ts-edited-agent.md` - `docs/records/src/chronicle.config.json` - `docs/records/src/project-profile.md` - `docs/records/src/timeline....
|
||||||
|
|
||||||
|
## Prevention
|
||||||
|
Keep automatic records tied to the active project and verify the relevant test or reproduction path.
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"projectId": "docs",
|
||||||
|
"projectName": "docs",
|
||||||
|
"projectRoot": "/Volumes/Data/project/Antigravity/ConnectAI/docs",
|
||||||
|
"recordRoot": "/Volumes/Data/project/Antigravity/ConnectAI/docs/docs/records/docs",
|
||||||
|
"description": "Auto-detected from the local project path in the conversation.",
|
||||||
|
"corePurpose": "Capture project direction, architecture discussion, decisions, and development notes as Markdown.",
|
||||||
|
"detailLevel": "standard",
|
||||||
|
"createdAt": "2026-05-05T02:55:58.823Z",
|
||||||
|
"updatedAt": "2026-05-05T02:55:58.824Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Project Profile
|
||||||
|
|
||||||
|
## Project Name
|
||||||
|
docs
|
||||||
|
|
||||||
|
## Description
|
||||||
|
Auto-detected from the local project path in the conversation.
|
||||||
|
|
||||||
|
## Project Root
|
||||||
|
/Volumes/Data/project/Antigravity/ConnectAI/docs
|
||||||
|
|
||||||
|
## Record Root
|
||||||
|
/Volumes/Data/project/Antigravity/ConnectAI/docs/docs/records/docs
|
||||||
|
|
||||||
|
## Core Purpose
|
||||||
|
Capture project direction, architecture discussion, decisions, and development notes as Markdown.
|
||||||
|
|
||||||
|
## Target Users
|
||||||
|
- Project developer
|
||||||
|
|
||||||
|
## Avoid Directions
|
||||||
|
- Do not mix records across projects.
|
||||||
|
|
||||||
|
## Record Detail Level
|
||||||
|
standard
|
||||||
|
|
||||||
|
## Created
|
||||||
|
2026-05-05T02:55:58.823Z
|
||||||
|
|
||||||
|
## Updated
|
||||||
|
2026-05-05T02:55:58.823Z
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Project Timeline
|
||||||
|
|
||||||
|
## 2026-05-05
|
||||||
|
- Project Chronicle record folder initialized for docs.
|
||||||
|
|
||||||
|
## 2026-05-05
|
||||||
|
- Auto bug record created: bugs/BUG-0001-viewed-integration-retrieval-test-ts-1-59-integration-retrie.md
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
agent.ts 인데 코드 분석해주면 좋겠어.
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# src Chronicle Records
|
||||||
|
|
||||||
|
## Project
|
||||||
|
- ID: src
|
||||||
|
- Root: /Volumes/Data/project/Antigravity/ConnectAI/src
|
||||||
|
- Record root: /Volumes/Data/project/Antigravity/ConnectAI/src/docs/records/src
|
||||||
|
- Detail level: standard
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
Capture project direction, architecture discussion, decisions, and development notes as Markdown.
|
||||||
|
|
||||||
|
## Folders
|
||||||
|
- `planning/`
|
||||||
|
- `discussions/`
|
||||||
|
- `decisions/`
|
||||||
|
- `development/`
|
||||||
|
- `bugs/`
|
||||||
|
- `retrospectives/`
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# Bug: Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts ...
|
||||||
|
|
||||||
|
## Date
|
||||||
|
2026-05-05
|
||||||
|
|
||||||
|
## Symptom
|
||||||
|
Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Edited agent.ts Viewed agent.ts:2159-2206 제공해주신 코드 리뷰 관점과 제품 평가 리포트를 정독했습니다. 현재 **ConnectAI**의 아키텍처는 단순한 챗봇을 넘어, **지식 수집 파이프라인의 안정성(Robustness)**과 **데이터의 무결성(Integr...
|
||||||
|
|
||||||
|
## Cause
|
||||||
|
Captured automatically from the current conversation. Confirm root cause during follow-up review if needed.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
## 간단 요약 이 요청은 프로젝트 지식 생성이 아니라 코드리뷰와 제품 평가 요청입니다. 확인된 파일 구조 기준으로 보면, 이 프로젝트는 지식 수집 워크플로우를 앱 형태로 묶어 운영하려는 도구로 보이며, 먼저 데이터 수집 흐름의 안정성, 외부 연동 실패 처리, 수집 결과의 저장/재처리 가능성을 중심으로 평가해야 합니다. ## 확인된 근거 대상 경로: `/Volumes/Data/project/Antigravity/ConnectAI/src` 확인된 우선 파일: - `core/astraPath.ts` - `core/conflict.ts` - `core/dataProcessor.ts` - `core/errorHandler.ts` - `core/errors.ts` - `core/events.ts` - `core/health.ts` - `core/lock.ts` - `core/queue.ts` - `core/services.ts` 확인된 구조 일부: ```text agents/ agents/A...
|
||||||
|
|
||||||
|
## Prevention
|
||||||
|
Keep automatic records tied to the active project and verify the relevant test or reproduction path.
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
# Bug: Viewed agent.ts:2159-2206 제공해주신 세부 파일 구조와 **지식 수집 워크플로우** 관점의 코드리뷰 요청을 정독했습니다. 이...
|
||||||
|
|
||||||
|
## Date
|
||||||
|
2026-05-05
|
||||||
|
|
||||||
|
## Symptom
|
||||||
|
Viewed agent.ts:2159-2206 제공해주신 세부 파일 구조와 **지식 수집 워크플로우** 관점의 코드리뷰 요청을 정독했습니다. 이전 분석에서 `engine.ts`의 상태 영속화와 `diagnostics.ts`의 무결성 검증을 확인했다면, 이번에는 사용자께서 우려하신 **'외부 연동 실패 처리'**의 실체인 `src/lib/api.ts`와 `src/lib/gemini.ts`, 그리고 UI 결합도를 결정짓는 `src/components/AgentDashboard.tsx`를 집중 분석하겠습니다. 특히 외부 API 호출 시의 타임아웃 처리, 속도 제한(Rate Limiting) 대응, 그리고 UI가 엔진의 상태를 어떻게 관측하는지 확인하여 리포트를 보완하겠습니다.따르겠습니다. `src/lib/api.ts` 파일이 존재하지 않는 것으로 확인되었습니다. 사용자께서 언급하신 **'다음에 깊게 볼 파일'** 리스트 중 일부가 현재 파일 시스템 구조와 차이가 있을 수 있으므로, 정확한...
|
||||||
|
|
||||||
|
## Cause
|
||||||
|
Captured automatically from the current conversation. Confirm root cause during follow-up review if needed.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
## 간단 요약 이 요청은 프로젝트 지식 생성이 아니라 코드리뷰와 제품 평가 요청입니다. 확인된 파일 구조 기준으로 보면, 이 프로젝트는 지식 수집 워크플로우를 앱 형태로 묶어 운영하려는 도구로 보이며, 먼저 데이터 수집 흐름의 안정성, 외부 연동 실패 처리, 수집 결과의 저장/재처리 가능성을 중심으로 평가해야 합니다. ## 확인된 근거 대상 경로: `/Volumes/Data/project/Antigravity/ConnectAI/src` 확인된 우선 파일: - `docs/records/src/README.md` - `docs/records/src/bugs/BUG-0001-edited-agent-ts-edited-agent-ts-edited-agent-ts-edited-agent.md` - `docs/records/src/chronicle.config.json` - `docs/records/src/project-profile.md` - `docs/records/src/timeline....
|
||||||
|
|
||||||
|
## Prevention
|
||||||
|
Keep automatic records tied to the active project and verify the relevant test or reproduction path.
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"projectId": "src",
|
||||||
|
"projectName": "src",
|
||||||
|
"projectRoot": "/Volumes/Data/project/Antigravity/ConnectAI/src",
|
||||||
|
"recordRoot": "/Volumes/Data/project/Antigravity/ConnectAI/src/docs/records/src",
|
||||||
|
"description": "Auto-detected from the local project path in the conversation.",
|
||||||
|
"corePurpose": "Capture project direction, architecture discussion, decisions, and development notes as Markdown.",
|
||||||
|
"detailLevel": "standard",
|
||||||
|
"createdAt": "2026-05-05T02:53:58.918Z",
|
||||||
|
"updatedAt": "2026-05-05T02:53:58.920Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Project Profile
|
||||||
|
|
||||||
|
## Project Name
|
||||||
|
src
|
||||||
|
|
||||||
|
## Description
|
||||||
|
Auto-detected from the local project path in the conversation.
|
||||||
|
|
||||||
|
## Project Root
|
||||||
|
/Volumes/Data/project/Antigravity/ConnectAI/src
|
||||||
|
|
||||||
|
## Record Root
|
||||||
|
/Volumes/Data/project/Antigravity/ConnectAI/src/docs/records/src
|
||||||
|
|
||||||
|
## Core Purpose
|
||||||
|
Capture project direction, architecture discussion, decisions, and development notes as Markdown.
|
||||||
|
|
||||||
|
## Target Users
|
||||||
|
- Project developer
|
||||||
|
|
||||||
|
## Avoid Directions
|
||||||
|
- Do not mix records across projects.
|
||||||
|
|
||||||
|
## Record Detail Level
|
||||||
|
standard
|
||||||
|
|
||||||
|
## Created
|
||||||
|
2026-05-05T02:51:13.090Z
|
||||||
|
|
||||||
|
## Updated
|
||||||
|
2026-05-05T02:51:13.090Z
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Project Timeline
|
||||||
|
|
||||||
|
## 2026-05-05
|
||||||
|
- Project Chronicle record folder initialized for src.
|
||||||
|
|
||||||
|
## 2026-05-05
|
||||||
|
- Auto bug record created: bugs/BUG-0001-edited-agent-ts-edited-agent-ts-edited-agent-ts-edited-agent.md
|
||||||
|
|
||||||
|
## 2026-05-05
|
||||||
|
- Auto bug record created: bugs/BUG-0002-viewed-agent-ts-2159-2206-제공해주신-세부-파일-구조와-지식-수집-워크플로우-관점의-코드.md
|
||||||
@@ -116,7 +116,12 @@ export function assembleContext(chunks: RetrievalChunk[]): string {
|
|||||||
for (const [source, groupChunks] of groups) {
|
for (const [source, groupChunks] of groups) {
|
||||||
const label = sourceLabels[source] || source;
|
const label = sourceLabels[source] || source;
|
||||||
const items = groupChunks
|
const items = groupChunks
|
||||||
.map((c) => `- ${c.title}: ${c.content}`)
|
.map((c) => {
|
||||||
|
const metadata = c.metadata;
|
||||||
|
const conflictTag = metadata.conflictDetected ? ` [⚠️ CONFLICT: ${metadata.conflictSeverity}]` : '';
|
||||||
|
const densityTag = metadata.informationDensity !== undefined ? ` (Density: ${metadata.informationDensity.toFixed(2)})` : '';
|
||||||
|
return `- ${c.title}${conflictTag}${densityTag}: ${c.content}`;
|
||||||
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
sections.push(`### ${label}\n${items}`);
|
sections.push(`### ${label}\n${items}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,21 +138,25 @@ export class RetrievalOrchestrator {
|
|||||||
.filter((s) => s.score > 0)
|
.filter((s) => s.score > 0)
|
||||||
.sort((a, b) => b.score - a.score)
|
.sort((a, b) => b.score - a.score)
|
||||||
.slice(0, limit)
|
.slice(0, limit)
|
||||||
.map((scored) => {
|
.map((s) => {
|
||||||
const doc = documents[scored.index];
|
const doc = documents[s.index];
|
||||||
const excerpt = extractBestExcerpt(doc.content, expandedTokens, 400);
|
const excerpt = extractBestExcerpt(doc.content, expandedTokens, 400);
|
||||||
return {
|
return {
|
||||||
id: `brain-${scored.index}`,
|
id: `brain-${s.index}`,
|
||||||
source: 'brain-memory' as const,
|
source: 'brain-memory' as const,
|
||||||
title: doc.relativePath,
|
title: doc.relativePath,
|
||||||
content: summarizeText(excerpt, 400),
|
content: summarizeText(excerpt, 400),
|
||||||
score: scored.score,
|
score: s.score,
|
||||||
tokenEstimate: estimateTokens(excerpt),
|
tokenEstimate: estimateTokens(excerpt),
|
||||||
metadata: {
|
metadata: {
|
||||||
filePath: doc.filePath,
|
filePath: doc.filePath,
|
||||||
category: this.inferCategory(doc.relativePath),
|
category: this.inferCategory(doc.relativePath),
|
||||||
isProjectEvidence: this.isProjectEvidence(doc.relativePath, doc.content),
|
isProjectEvidence: this.isProjectEvidence(doc.relativePath, doc.content),
|
||||||
lastUpdated: doc.lastModified
|
lastUpdated: doc.lastModified,
|
||||||
|
// Phase 5: Scoring Intelligence Integration
|
||||||
|
conflictDetected: s.conflictDetected,
|
||||||
|
conflictSeverity: s.conflictSeverity,
|
||||||
|
informationDensity: s.informationDensity
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import { RetrievalOrchestrator } from '../src/retrieval/index';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as utils from '../src/utils';
|
||||||
|
|
||||||
|
// Mocking dependencies
|
||||||
|
jest.mock('fs');
|
||||||
|
jest.mock('../src/utils');
|
||||||
|
|
||||||
|
describe('Retrieval Orchestrator Phase 5 Integration Tests', () => {
|
||||||
|
let orchestrator: RetrievalOrchestrator;
|
||||||
|
const mockBrainPath = '/mock/brain';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
orchestrator = new RetrievalOrchestrator();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('End-to-End Brain Search: should populate advanced scoring metadata in results', () => {
|
||||||
|
// 1. Mock Brain Files
|
||||||
|
const mockFiles = [
|
||||||
|
'/mock/brain/doc1.md',
|
||||||
|
'/mock/brain/doc2.md'
|
||||||
|
];
|
||||||
|
(utils.findBrainFiles as jest.Mock).mockReturnValue(mockFiles);
|
||||||
|
|
||||||
|
// 2. Mock File Content
|
||||||
|
const fileContents: Record<string, string> = {
|
||||||
|
'/mock/brain/doc1.md': 'Astra 성능 최적화 전략에 대한 문서입니다.',
|
||||||
|
'/mock/brain/doc2.md': '이 설계는 기존 아키텍처와 충돌하며 오류가 많고 논란이 있는 반대 의견입니다.'
|
||||||
|
};
|
||||||
|
(fs.readFileSync as jest.Mock).mockImplementation((path: string) => fileContents[path]);
|
||||||
|
(fs.statSync as jest.Mock).mockReturnValue({ mtimeMs: Date.now() });
|
||||||
|
|
||||||
|
// 3. Perform Retrieval
|
||||||
|
const brain = { localBrainPath: mockBrainPath };
|
||||||
|
const result = orchestrator.retrieve('최적화 충돌', {
|
||||||
|
brain: brain as any,
|
||||||
|
memoryManager: {
|
||||||
|
getLongTermMemory: () => ({ buildContext: () => null }),
|
||||||
|
getProjectMemory: () => ({ buildContext: () => null }),
|
||||||
|
getProceduralMemory: () => ({ buildContext: () => null }),
|
||||||
|
getEpisodicMemory: () => ({ buildContext: () => null })
|
||||||
|
} as any,
|
||||||
|
contextBudget: { totalBudget: 2000 }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. Verify Intelligence Metadata
|
||||||
|
expect(result.selectedChunks.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
// Find doc2 (the conflicting one)
|
||||||
|
const conflictChunk = result.selectedChunks.find(c => c.title.includes('doc2'));
|
||||||
|
expect(conflictChunk).toBeDefined();
|
||||||
|
if (conflictChunk) {
|
||||||
|
expect(conflictChunk.metadata.conflictDetected).toBe(true);
|
||||||
|
expect(conflictChunk.metadata.conflictSeverity).toBe('HIGH'); // '충돌', '오류', '논란', '반대' -> 4 indicators
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find doc1 (the dense one)
|
||||||
|
const denseChunk = result.selectedChunks.find(c => c.title.includes('doc1'));
|
||||||
|
expect(denseChunk).toBeDefined();
|
||||||
|
if (denseChunk) {
|
||||||
|
expect(denseChunk.metadata.informationDensity).toBeGreaterThan(0);
|
||||||
|
expect(denseChunk.metadata.conflictDetected).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Verify Assembled Context String
|
||||||
|
const contextString = orchestrator.buildContextString(result);
|
||||||
|
expect(contextString).toContain('[⚠️ CONFLICT: HIGH]');
|
||||||
|
expect(contextString).toContain('(Density:');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Score Normalization: should normalize scores across brain sources', () => {
|
||||||
|
(utils.findBrainFiles as jest.Mock).mockReturnValue(['/mock/brain/test.md']);
|
||||||
|
(fs.readFileSync as jest.Mock).mockReturnValue('테스트 내용');
|
||||||
|
(fs.statSync as jest.Mock).mockReturnValue({ mtimeMs: Date.now() });
|
||||||
|
|
||||||
|
const result = orchestrator.retrieve('테스트', {
|
||||||
|
brain: { localBrainPath: mockBrainPath } as any,
|
||||||
|
memoryManager: {
|
||||||
|
getLongTermMemory: () => ({ buildContext: () => null }),
|
||||||
|
getProjectMemory: () => ({ buildContext: () => null }),
|
||||||
|
getProceduralMemory: () => ({ buildContext: () => null }),
|
||||||
|
getEpisodicMemory: () => ({ buildContext: () => null })
|
||||||
|
} as any
|
||||||
|
});
|
||||||
|
|
||||||
|
// Scores should be boosted by source priority (brain-memory boost is 0.9)
|
||||||
|
const chunk = result.selectedChunks[0];
|
||||||
|
expect(chunk.score).toBeCloseTo(0.9, 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user