feat(core): upgrade to v2.65.0 with Cognition Layer & Proactive Advisor
- Integrated v4.0 Operational Policy into AgentEngine and AgentExecutor. - Added Context Amplification for policy-driven reasoning. - Implemented Proactive Advisor for next-action decision forks. - Added CognitionAudit diagnostics for real-time policy monitoring. - Updated test suites to support dual-execution cognition patterns.
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
# Bug: 지금 내가 분석 요청하고 너가 답을 줄때 아래 템플릿에 맞춰 답을 써주고 있는데, 개선 포인트가 있는지 확인해줘. ## 내가 보는 위험 가장 큰...
|
||||
|
||||
## Date
|
||||
2026-05-04
|
||||
|
||||
## Symptom
|
||||
지금 내가 분석 요청하고 너가 답을 줄때 아래 템플릿에 맞춰 답을 써주고 있는데, 개선 포인트가 있는지 확인해줘. ## 내가 보는 위험 가장 큰 위험은 선택지를 넓히는 동안 실제 다음 행동이 흐려지는 것입니다. 지금은 더 많은 가능성보다 판단 기준 하나를 세우는 편이 낫습니다. ## Astra 판단 이 프로젝트는 단순히 기능을 구현한 것을 넘어, **복잡한 LLM 기반 작업의 안정적인 운영을 위한 고도로 정교하게 설계된 '실행 엔진' 아키텍처**를 구축했다는 점이 가장 큰 특징입니다. 현재의 구조는 **'실행 능력(Execution Capability)'** 측면에서는 최고 수준이지만, 궁극적인 목표인 **'자비스형 비서(Proactive Cognition)'**로 가기 위해서는 실행 능력에 기반을 둔 **'사고 능력(Cognition)'** 레이어를 추가하는 것이 핵심 과제입니다. ## 간단 요약 ConnectAI의 아키텍처는 **Producer-Consumer 패턴**을 기반으로...
|
||||
|
||||
## Cause
|
||||
Captured automatically from the current conversation. Confirm root cause during follow-up review if needed.
|
||||
|
||||
## Fix
|
||||
## 내가 보는 위험 가장 큰 위험은 구조가 좋아 보이는 것과 운영에서 믿을 수 있는 것이 다르다는 점입니다. 특히 수집 도구는 실패 복구, 중복 제거, 상태 저장, 진단 로그가 약하면 기능이 많아져도 실제 사용감은 계속 흔들립니다. ## Astra 판단 이 프로젝트는 단순히 기능을 구현한 것을 넘어, **복잡한 LLM 기반 작업의 안정적인 운영을 위한 고도로 정교하게 설계된 '실행 엔진' 아키텍처**를 구축했다는 점이 가장 큰 특징입니다. 현재의 구조는 **'실행 능력(Execution Capability)'** 측면에서는 최고 수준이지만, 궁극적인 목표인 **'자비스형 비서(Proactive Cognition)'**로 가기 위해서는 실행 능력에 기반을 둔 **'사고 능력(Cognition)'** 레이어를 추가하는 것이 핵심 과제입니다. ## 간단 요약 ConnectAI의 아키텍처는 **Producer-Consumer 패턴**을 기반으로 멀티 에이전트 워크플로우를 오케스트레이션하는...
|
||||
|
||||
## Prevention
|
||||
Keep automatic records tied to the active project and verify the relevant test or reproduction path.
|
||||
@@ -6,6 +6,6 @@
|
||||
"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-04T06:49:36.436Z",
|
||||
"updatedAt": "2026-05-04T06:49:36.437Z"
|
||||
"createdAt": "2026-05-04T10:19:39.144Z",
|
||||
"updatedAt": "2026-05-04T10:19:39.146Z"
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# ADR: /Volumes/Data/project/Antigravity/ConnectAI 이 프로젝트 자체를 나는 자비스와 같은 툴로 만드는 것이 내 목표...
|
||||
|
||||
## Status
|
||||
accepted
|
||||
|
||||
## Context
|
||||
/Volumes/Data/project/Antigravity/ConnectAI 이 프로젝트 자체를 나는 자비스와 같은 툴로 만드는 것이 내 목표야. 이런 목표를 기반으로 봤을때 우리 프로젝트는 위치는 지금 어느정도에 있고. 어느 부분을 더 개선해야하는지 알려줘
|
||||
|
||||
## Decision
|
||||
--- id: mission_1777878245127 date: 2026-05-04T07:05:18.351Z type: knowledge_artifact standard: P-Reinforce v3.0 tags: [automated, connect_ai, brain_sync] --- ## 📌 Brief Summary # 최종 합성 보고서: 멀티 에이전트 오케스트레이션 엔진 심층 분석... # 최종 합성 보고서: 멀티 에이전트 오케스트레이션 엔진 심층 분석 **작성자:** Lead Synthesis Writer & Editor **날짜:** 2024년 5월 29일 **대상 코드:** AgentEngine 및 관련 핵심 모듈 (TypeScript/JavaScript) --- ## 📝 Executive Summary (요약) 본 보고서는 제공된 TypeScript 기반의 멀티 에이전트 워크플로우 오케스트레이션 엔진(`AgentEngine`)의 아키텍처, 안정성 메커니즘, 그리고 복원력...
|
||||
|
||||
## Reason
|
||||
Captured automatically because the conversation contained decision-oriented language.
|
||||
|
||||
## Alternatives
|
||||
Not captured yet.
|
||||
|
||||
## Consequences
|
||||
- Future prompts should treat this as project context unless the user changes direction.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# ADR: /Volumes/Data/project/Antigravity/ConnectAI 이 프로젝트 아키텍처 분석해줘.
|
||||
|
||||
## Status
|
||||
accepted
|
||||
|
||||
## Context
|
||||
/Volumes/Data/project/Antigravity/ConnectAI 이 프로젝트 아키텍처 분석해줘.
|
||||
|
||||
## Decision
|
||||
## 내가 보는 위험 가장 큰 위험은 선택지를 넓히는 동안 실제 다음 행동이 흐려지는 것입니다. 지금은 더 많은 가능성보다 판단 기준 하나를 세우는 편이 낫습니다. ## Astra 판단 이 프로젝트는 단순히 기능을 구현한 것을 넘어, **복잡한 LLM 기반 작업의 안정적인 운영을 위한 고도로 정교하게 설계된 '실행 엔진' 아키텍처**를 구축했다는 점이 가장 큰 특징입니다. 현재의 구조는 **'실행 능력(Execution Capability)'** 측면에서는 최고 수준이지만, 궁극적인 목표인 **'자비스형 비서(Proactive Cognition)'**로 가기 위해서는 실행 능력에 기반을 둔 **'사고 능력(Cognition)'** 레이어를 추가하는 것이 핵심 과제입니다. ## 간단 요약 ConnectAI의 아키텍처는 **Producer-Consumer 패턴**을 기반으로 멀티 에이전트 워크플로우를 오케스트레이션하는 데 최적화되어 있습니다. 명시적인 락, 상세한 오류 복구 매트릭스, ...
|
||||
|
||||
## Reason
|
||||
Captured automatically because the conversation contained decision-oriented language.
|
||||
|
||||
## Alternatives
|
||||
Not captured yet.
|
||||
|
||||
## Consequences
|
||||
- Future prompts should treat this as project context unless the user changes direction.
|
||||
@@ -33,3 +33,12 @@
|
||||
|
||||
## 2026-05-04
|
||||
- Auto decision record created: decisions/ADR-0003-volumes-data-project-antigravity-connectai-이-프로젝트-자체를-나는-자비스.md
|
||||
|
||||
## 2026-05-04
|
||||
- Auto decision record created: decisions/ADR-0004-volumes-data-project-antigravity-connectai-이-프로젝트-자체를-나는-자비스.md
|
||||
|
||||
## 2026-05-04
|
||||
- Auto decision record created: decisions/ADR-0005-volumes-data-project-antigravity-connectai-이-프로젝트-아키텍처-분석해줘.md
|
||||
|
||||
## 2026-05-04
|
||||
- Auto bug record created: bugs/BUG-0002-지금-내가-분석-요청하고-너가-답을-줄때-아래-템플릿에-맞춰-답을-써주고-있는데-개선-포인트가-있는지-확인해.md
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "astra",
|
||||
"displayName": "Astra",
|
||||
"description": "A local Jarvis-style project operating assistant for VS Code. Connects memory, project context, tools, and a single thinking-partner voice.",
|
||||
"version": "2.64.1",
|
||||
"version": "2.65.0",
|
||||
"publisher": "connectailab",
|
||||
"license": "MIT",
|
||||
"icon": "assets/icon.png",
|
||||
|
||||
+9
-1
@@ -382,8 +382,16 @@ export class AgentExecutor {
|
||||
? `\n\n${renderSecondBrainTraceContext(secondBrainTrace)}`
|
||||
: '';
|
||||
const memoryCtx = this.buildMemoryContext(prompt || '', activeBrain);
|
||||
|
||||
// [Astra v4.0] 지식 관리 운영 정책 주입
|
||||
const v4PolicyCtx = [
|
||||
"\n### 🏛️ 지식 관리 정책 v4.0 (Knowledge Management Policy Applied)",
|
||||
"- [신뢰도] '의도적으로 작성된 글'은 Medium 이상의 신뢰도를 부여하여 최우선 근거로 활용할 것.",
|
||||
"- [품질] 데이터의 양보다 '추론 기여 밀도'를 중시하여 핵심 위주로 깊이 있게 서술할 것.",
|
||||
"- [충돌] 지식 간 충돌 발생 시 시스템이 독단적으로 판단하지 말고, 반드시 [CONFLICT WARNING] 플래그와 함께 상충되는 두 관점을 모두 명시하여 사용자에게 판단을 위임할 것."
|
||||
].join('\n');
|
||||
|
||||
const fullSystemPrompt = `${agentSkillCtx}\n\n${systemPrompt}${internetCtx}${memoryCtx}${designerCtx}${localProjectKnowledgeCtx}${thinkingPartnerCtx}${astraStanceCtx}${secondBrainTraceCtx}\n\n[CONTEXT]\n${brainContext}${brainInventoryCtx}\n${contextBlock}${negativeCtx}`;
|
||||
const fullSystemPrompt = `${agentSkillCtx}\n\n${systemPrompt}${internetCtx}${memoryCtx}${designerCtx}${localProjectKnowledgeCtx}${thinkingPartnerCtx}${astraStanceCtx}${secondBrainTraceCtx}${v4PolicyCtx}\n\n[CONTEXT]\n${brainContext}${brainInventoryCtx}\n${contextBlock}${negativeCtx}`;
|
||||
const messagesForRequest: ChatMessage[] = [
|
||||
{ role: 'system', content: fullSystemPrompt, internal: true },
|
||||
...reqMessages
|
||||
|
||||
+16
-6
@@ -101,10 +101,10 @@ Your sole purpose is to transform vague requests into flawless, high-resolution
|
||||
- COMPONENTS: Each blueprint must have [Objective], [Core Challenges], [Data Requirements], and [Step-by-Step Research Tasks].
|
||||
- CONSTRAINT: Do not be vague. Use professional terminology. If the request is too simple, expand it with relevant technical considerations.`;
|
||||
|
||||
async execute(input: string, brainContext?: string, signal?: AbortSignal): Promise<string> {
|
||||
async execute(input: string, brainContext?: string, signal?: AbortSignal, options?: AgentExecuteOptions): Promise<string> {
|
||||
const wrappedInput = `### SYSTEM INSTRUCTION: GENERATE EXECUTION BLUEPRINT
|
||||
1. Target Goal: ${input}
|
||||
2. Available Knowledge Base: ${brainContext}
|
||||
2. Available Knowledge Base & Policy: ${brainContext}
|
||||
3. Mission: Create a comprehensive research roadmap.`;
|
||||
return this.callLLM(this.persona, wrappedInput, signal);
|
||||
}
|
||||
@@ -118,10 +118,10 @@ Your mission is to extract, filter, and synthesize critical data based on a stra
|
||||
- CRITICAL THINKING: Identify gaps in the plan and provide extra insights to fill those gaps.
|
||||
- NO FLUFF: Be concise but extremely dense with information.`;
|
||||
|
||||
async execute(input: string, brainContext?: string, signal?: AbortSignal): Promise<string> {
|
||||
async execute(input: string, brainContext?: string, signal?: AbortSignal, options?: AgentExecuteOptions): Promise<string> {
|
||||
const wrappedInput = `### SYSTEM INSTRUCTION: DATA HARVESTING
|
||||
1. Blueprint to Follow: ${input}
|
||||
2. Contextual Constraints: ${brainContext}
|
||||
2. Contextual Constraints & Policy: ${brainContext}
|
||||
3. Mission: Provide a dense summary of facts and technical insights.`;
|
||||
return this.callLLM(this.persona, wrappedInput, signal);
|
||||
}
|
||||
@@ -135,13 +135,23 @@ Your goal is to produce a state-of-the-art final report that wows the user.
|
||||
- LANGUAGE: Always respond in the user's language (KOREAN).
|
||||
- POLISHING: Ensure logical flow between sections. Make it look like a premium report.`;
|
||||
|
||||
async execute(input: string, originalRequest?: string, signal?: AbortSignal): Promise<string> {
|
||||
async execute(input: string, originalRequest?: string, signal?: AbortSignal, options?: AgentExecuteOptions): Promise<string> {
|
||||
// [Astra v4.0] Advisor 모드 처리
|
||||
if (options?.config?.role === 'advisor') {
|
||||
const advisorPersona = `You are the [Strategic Proactive Advisor].
|
||||
Analyze the provided report and suggest 3 high-impact next actions for the user.
|
||||
- Focus on decision forks, risk mitigation, or immediate implementation steps.
|
||||
- Be extremely concrete and actionable.
|
||||
- Respond in KOREAN.`;
|
||||
return this.callLLM(advisorPersona, input, signal);
|
||||
}
|
||||
|
||||
// Fix 3: Trim input if it's too long (Basic Context Diet)
|
||||
const trimmedData = input.length > 8000 ? input.substring(0, 8000) + '... [Data Trimmed for Performance]' : input;
|
||||
|
||||
const wrappedInput = `### SYSTEM INSTRUCTION: FINAL SYNTHESIS
|
||||
1. Gathered Research Data: ${trimmedData}
|
||||
2. User's Original Objective: ${originalRequest}
|
||||
2. User's Original Objective & Policy: ${originalRequest}
|
||||
3. Mission: Write the definitive final report in KOREAN.`;
|
||||
return this.callLLM(this.persona, wrappedInput, signal);
|
||||
}
|
||||
|
||||
@@ -93,3 +93,33 @@ export class PerformanceProfiler {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class CognitionAudit {
|
||||
/**
|
||||
* [Astra v4.0] 지능적 판단 및 정책 준수 여부를 감사(Audit)합니다.
|
||||
* 시스템이 얼마나 '생각'하고 '경고'했는지 정량적으로 측정합니다.
|
||||
*/
|
||||
public static auditPolicyCompliance(stage: string, content: string): void {
|
||||
const findings = [];
|
||||
|
||||
// 1. 충돌 경고 감지 (Conflict Warning)
|
||||
if (content.includes('[CONFLICT WARNING]')) {
|
||||
findings.push('Conflict Detected & Warning Issued');
|
||||
}
|
||||
|
||||
// 2. 선제적 제안 감지 (Proactive Advice)
|
||||
if (content.includes('## 💡 Astra의 선제적 제안')) {
|
||||
findings.push('Proactive Advice Generated');
|
||||
}
|
||||
|
||||
// 3. 신뢰도 인용 패턴 확인 (Credibility Usage)
|
||||
const highTrustCitationCount = (content.match(/\[\[/g) || []).length;
|
||||
if (highTrustCitationCount > 0) {
|
||||
findings.push(`Knowledge Density: ${highTrustCitationCount} connections used`);
|
||||
}
|
||||
|
||||
if (findings.length > 0) {
|
||||
logInfo(`[CognitionAudit] [${stage}] ${findings.join(' | ')}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+51
-3
@@ -4,7 +4,7 @@ import * as path from 'path';
|
||||
import { lockManager } from '../core/lock';
|
||||
import { actionQueue } from '../core/queue';
|
||||
import { logInfo, logError } from '../utils';
|
||||
import { AgentDataValidator, PerformanceProfiler } from './diagnostics';
|
||||
import { AgentDataValidator, PerformanceProfiler, CognitionAudit } from './diagnostics';
|
||||
import { WikiFormatter } from './formatter';
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
@@ -506,8 +506,16 @@ export class AgentEngine {
|
||||
);
|
||||
this.validateResult(finalReport, 'Writer');
|
||||
|
||||
// --- Phase 4: Proactive Advisor (Astra v4.0) ---
|
||||
// 리포트 작성 후, 사용자의 다음 행동을 선제적으로 제안합니다.
|
||||
const proactiveAdvice = await this.generateProactiveAdvice(finalReport, prompt, brainContext, signal);
|
||||
const enrichedReport = `${finalReport}\n\n---\n## 💡 Astra의 선제적 제안 (Proactive Next Actions)\n${proactiveAdvice}`;
|
||||
|
||||
// 3. 지식 저장 포맷 표준화 (Standardization: Astra 피드백)
|
||||
const standardizedReport = WikiFormatter.format(finalReport, missionId);
|
||||
const standardizedReport = WikiFormatter.format(enrichedReport, missionId);
|
||||
|
||||
// [Astra v4.0] 지능적 판단 감사 (Cognition Audit)
|
||||
CognitionAudit.auditPolicyCompliance('MissionComplete', standardizedReport);
|
||||
|
||||
this.transition(state, 'completed', '미션 완료', onProgress);
|
||||
logInfo(`[AgentEngine] 미션 완료: ${missionId} (총 ${state.getElapsedMs()}ms)`);
|
||||
@@ -589,7 +597,12 @@ export class AgentEngine {
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
const result = await agent.execute(input, context, signal, options);
|
||||
|
||||
// [Astra v4.0] 맥락 증폭 (Context Amplification)
|
||||
// 에이전트 실행 직전, 지식 신뢰도 및 충돌 처리 정책을 주입합니다.
|
||||
const amplifiedContext = this.amplifyContext(context, options);
|
||||
|
||||
const result = await agent.execute(input, amplifiedContext, signal, options);
|
||||
const durationMs = Date.now() - startTime;
|
||||
|
||||
PerformanceProfiler.logLLMLatency(agentName, durationMs, result.length);
|
||||
@@ -680,4 +693,39 @@ export class AgentEngine {
|
||||
// Error Recovery Matrix: Permanent 오류 발생을 방지하기 위한 선제적 핸드오프 검증
|
||||
AgentDataValidator.validateHandoff(step, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* [Astra v4.0] 맥락 증폭 로직
|
||||
* 지식 관리 정책 v4.0을 LLM 지시사항으로 변환하여 주입합니다.
|
||||
*/
|
||||
private amplifyContext(context: string, options?: AgentExecuteOptions): string {
|
||||
const policyDirectives = [
|
||||
"\n### 🏛️ Knowledge Management Policy v4.0 Applied",
|
||||
"- [CREDIBILITY] 정보 출처가 의도적으로 작성된 글인 경우 Medium 이상의 신뢰도를 부여하고 우선적으로 인용하십시오.",
|
||||
"- [QUALITY] 지식의 양보다 '추론 기여 밀도'를 중시하여 핵심 위주로 서술하십시오.",
|
||||
"- [CONFLICT] 상충되는 지식 발견 시 스스로 판단하지 말고 반드시 [CONFLICT WARNING] 플래그와 함께 두 관점을 모두 보고하십시오."
|
||||
].join('\n');
|
||||
|
||||
return `${context}\n${policyDirectives}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* [Astra v4.0] 선제적 제안 생성
|
||||
* 수행된 작업 결과를 분석하여 다음 단계의 의사결정 포크를 제안합니다.
|
||||
*/
|
||||
private async generateProactiveAdvice(report: string, originalPrompt: string, context: string, signal: AbortSignal): Promise<string> {
|
||||
logInfo(`[AgentEngine] 선제적 제안 생성 중...`);
|
||||
// 본 로직은 별도의 가벼운 추론 단계를 거치거나, WriterAgent의 기능을 확장하여 구현할 수 있습니다.
|
||||
// 현재는 WriterAgent에게 한 번 더 질의하거나, 리포트에서 액션 아이템을 추출하는 구조로 시작합니다.
|
||||
const advicePrompt = `다음 리포트를 읽고, 사용자가 다음에 내려야 할 '전략적 의사결정'이나 '실행 작업' 3가지를 제안해줘.
|
||||
원래 요청: ${originalPrompt}
|
||||
리포트 요약: ${report.substring(0, 1000)}...`;
|
||||
|
||||
try {
|
||||
// WriterAgent를 Advisor 모드로 재활용
|
||||
return await this.writer.execute(advicePrompt, context, signal, { config: { role: 'advisor' } });
|
||||
} catch (err) {
|
||||
return "다음 단계에 대한 자동 제안을 생성하지 못했습니다. 리포트의 결론 섹션을 참고해 주세요.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,9 +511,9 @@ describe('Concurrency & Stress Tests', () => {
|
||||
|
||||
const outputs = await Promise.all(results);
|
||||
|
||||
// 모든 작업이 완료되어야 함
|
||||
// 모든 작업이 완료되어야 함 (최종 리포트 + 선제적 제안 = taskCount * 2)
|
||||
expect(outputs).toHaveLength(taskCount);
|
||||
expect(completionOrder).toHaveLength(taskCount);
|
||||
expect(completionOrder).toHaveLength(taskCount * 2);
|
||||
|
||||
console.log(`\n📊 [Queue Saturation Test]`);
|
||||
console.log(` Tasks Submitted: ${taskCount}`);
|
||||
|
||||
Reference in New Issue
Block a user