Feat: Implement Project Claim Output Brake and refine agent reasoning
This commit is contained in:
@@ -3,6 +3,7 @@ import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import {
|
||||
buildSecondBrainTrace,
|
||||
enforceProjectClaimPolicyInAnswer,
|
||||
renderSecondBrainTraceContext,
|
||||
renderSecondBrainTraceMarkdown
|
||||
} from '../src/features/secondBrainTrace';
|
||||
@@ -157,4 +158,35 @@ describe('Second Brain Trace', () => {
|
||||
fs.rmSync(generalOnlyRoot, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('removes unsupported technical structure claims from final answers under general-only policy', () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'second-brain-policy-'));
|
||||
try {
|
||||
fs.mkdirSync(path.join(root, '02_Architecture_Principles'), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(root, '02_Architecture_Principles', 'API Gateway.md'),
|
||||
'# API Gateway\n\nGeneral Knowledge: API Gateway can route requests.',
|
||||
'utf8'
|
||||
);
|
||||
const trace = buildSecondBrainTrace('현재 프로젝트는 API Gateway 라우팅 구조를 갖추고 있어?', root, { force: true });
|
||||
const answer = [
|
||||
'결론은 간단합니다. 현재 개발 방향은 기술적 기반 면에서는 안정적입니다.',
|
||||
'',
|
||||
'아키텍처는 유연하나 구매 전환 시나리오를 보완해야 합니다.',
|
||||
'모듈화된 구조는 향후 기능 추가 시 유연성을 제공합니다.',
|
||||
'',
|
||||
'다만 UX 관점에서는 공간 경험과 상품 탐색 연결을 확인해야 합니다.'
|
||||
].join('\n');
|
||||
|
||||
const sanitized = enforceProjectClaimPolicyInAnswer(answer, trace);
|
||||
|
||||
expect(sanitized).toContain('현재 정보만으로는 기술 구조를 판단할 수 없습니다');
|
||||
expect(sanitized).not.toContain('기술적 기반 면에서는 안정적');
|
||||
expect(sanitized).not.toContain('아키텍처는 유연');
|
||||
expect(sanitized).not.toContain('모듈화된 구조');
|
||||
expect(sanitized).toContain('UX 관점');
|
||||
} finally {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user