Version 2.51.0 Release: Structured Knowledge Slot Planning and Material Engine

This commit is contained in:
g1nation
2026-05-03 10:32:58 +09:00
parent 5e3750a93e
commit 53edc33c3e
4 changed files with 378 additions and 7 deletions
+90
View File
@@ -51,6 +51,60 @@ describe('Second Brain Trace', () => {
].join('\n'),
'utf8'
);
fs.mkdirSync(path.join(brainRoot, 'Strategy'), { recursive: true });
fs.writeFileSync(
path.join(brainRoot, 'Strategy', 'Report Evidence Mapping.md'),
[
'# Report Evidence Mapping',
'',
'Template-driven reports should map each section to evidence, insight, risk, and next action knowledge.',
'A schema should guide structure while Second Brain notes supply the actual content.'
].join('\n'),
'utf8'
);
fs.writeFileSync(
path.join(brainRoot, 'Strategy', 'Risk and Action Playbook.md'),
[
'# Risk and Action Playbook',
'',
'Risk sections should capture limitations, validation gaps, and tradeoffs.',
'Action sections should turn knowledge into MVP steps, implementation recommendations, and next decisions.'
].join('\n'),
'utf8'
);
fs.mkdirSync(path.join(brainRoot, 'Ontology'), { recursive: true });
fs.writeFileSync(
path.join(brainRoot, 'Ontology', 'Knowledge Graph Concepts.md'),
[
'# Knowledge Graph Concepts',
'',
'Ontology notes define concepts, relations, categories, and graph structure before writing.',
'They help a report decide which ideas are parent concepts, evidence, methods, and outcomes.'
].join('\n'),
'utf8'
);
fs.mkdirSync(path.join(brainRoot, 'Writing'), { recursive: true });
fs.writeFileSync(
path.join(brainRoot, 'Writing', 'Report Narrative Structure.md'),
[
'# Report Narrative Structure',
'',
'Writing guidance should shape report structure, section order, narrative flow, and concise executive summaries.',
'It should not replace evidence; it organizes selected knowledge into a readable output.'
].join('\n'),
'utf8'
);
fs.mkdirSync(path.join(brainRoot, 'Technical'), { recursive: true });
fs.writeFileSync(
path.join(brainRoot, 'Technical', 'Implementation Techniques.md'),
[
'# Implementation Techniques',
'',
'Technical technique notes explain implementation methods, architecture choices, and tooling tradeoffs.',
'They should support practical next actions after the report identifies risks and evidence.'
].join('\n'),
'utf8'
);
fs.mkdirSync(path.join(brainRoot, '00_Raw', 'conversations'), { recursive: true });
fs.writeFileSync(
path.join(brainRoot, '00_Raw', 'conversations', '2026-05-01.md'),
@@ -270,4 +324,40 @@ describe('Second Brain Trace', () => {
fs.rmSync(root, { recursive: true, force: true });
}
});
it('builds structured knowledge slots for report and template requests', () => {
const trace = buildSecondBrainTrace(
'제2뇌 지식을 사용해서 템플릿 기반 전략 보고서를 작성해줘. 근거, 핵심 분석, 리스크, 실행안을 포함해줘.',
brainRoot,
{ force: true }
);
const context = renderSecondBrainTraceContext(trace);
const markdown = renderSecondBrainTraceMarkdown(trace, true);
expect(trace.knowledgeSlots.length).toBeGreaterThanOrEqual(4);
expect(trace.knowledgeSlots.map((slot) => slot.id)).toEqual(expect.arrayContaining(['evidence', 'insight', 'risk', 'action']));
expect(trace.knowledgeSlots.some((slot) => slot.selectedPaths.some((pathName) => pathName.includes('Report Evidence Mapping.md')))).toBe(true);
expect(trace.retrievedDocuments.some((doc) => doc.usedFor?.includes('근거') || doc.usedFor?.includes('실행안'))).toBe(true);
expect(context).toContain('Structured knowledge slots');
expect(context).toContain('Do not merely follow a static template');
expect(markdown).toContain('## 구조화 지식 슬롯');
expect(markdown).toContain('"knowledgeSlots"');
});
it('plans ontology, writing, information, and technical materials before report synthesis', () => {
const trace = buildSecondBrainTrace(
'제2뇌 전체 지식을 버리지 말고 온톨로지, 글쓰기 지식, 정보, 테크닉, 기술 내용을 재료로 먼저 파악한 뒤 보고서를 작성해줘.',
brainRoot,
{ force: true }
);
const context = renderSecondBrainTraceContext(trace);
const slotIds = trace.knowledgeSlots.map((slot) => slot.id);
expect(slotIds).toEqual(expect.arrayContaining(['ontology', 'writing', 'information', 'technical']));
expect(trace.knowledgeSlots.find((slot) => slot.id === 'ontology')?.selectedPaths.join('\n')).toContain('Knowledge Graph Concepts.md');
expect(trace.knowledgeSlots.find((slot) => slot.id === 'writing')?.selectedPaths.join('\n')).toContain('Report Narrative Structure.md');
expect(trace.knowledgeSlots.find((slot) => slot.id === 'technical')?.selectedPaths.join('\n')).toContain('Implementation Techniques.md');
expect(context).toContain('Material planning rule');
expect(context).toContain('Coverage rule');
});
});