[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,90 +2,328 @@
|
||||
id: wiki-2026-0508-cognitive-architecture
|
||||
title: Cognitive Architecture
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [COG-ARCH-001]
|
||||
aliases: [SOAR, ACT-R, agent architecture, neuro-symbolic, agentic, working memory, declarative memory]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [ai, cognitive-science, Architecture, Reasoning, knowledge-representation]
|
||||
source_trust_level: B
|
||||
confidence_score: 0.85
|
||||
verification_status: applied
|
||||
tags: [cognitive-architecture, agent, soar, act-r, neuro-symbolic, agentic-workflow, llm-agent, working-memory]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: agent design
|
||||
framework: SOAR / ACT-R / LangGraph / OpenAI Agents SDK
|
||||
---
|
||||
|
||||
# Cognitive Architecture (인지 아키텍처)
|
||||
# Cognitive Architecture
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "인간의 사고 과정을 모방한 지능의 설계도를 그려라" — 지각, 학습, 기억, 추론 등 지능을 구성하는 다양한 요소들이 어떻게 상호작용하여 전체적인 행동을 만들어내는지 정의하는 시스템 아키텍처.
|
||||
## 매 한 줄
|
||||
> **"매 intelligence 의 시스템 설계도"**. 매 perception + memory + reasoning + learning 의 cognitive loop. 매 classical: SOAR, ACT-R. 매 modern: LLM-based agentic (LangGraph, OpenAI Agents SDK, AutoGen). 매 neuro-symbolic 의 hybrid.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** 환경으로부터 입력을 받아 내부 지식과 대조하고, 목표를 달성하기 위한 계획을 수립하여 실행하는 일관된 '인지 루프'를 하드웨어/소프트웨어적으로 구조화하는 패턴.
|
||||
- **핵심 구성 요소:**
|
||||
- **Perception Module:** 외부 자극을 수용하고 데이터화.
|
||||
- **[[memory|memory]][[_system|system]]s:** 단기/작업 기억(Working Memory)과 장기/일화 기억(Long-term Memory)의 분리 및 관리.
|
||||
- **Knowledge Representation:** 지식을 기호, 신경망 가중치, 또는 그래프 형태로 저장.
|
||||
- **Reasoning & Planning:** 당면한 문제를 해결하기 위한 논리적 추론 및 단계별 행동 계획 수립.
|
||||
- **Learning Mechanism:** 경험을 통해 내부 모델을 지속적으로 업데이트.
|
||||
- **주요 모델:** SOAR (상태 공간 탐색 중심), ACT-R (심리학적 정합성 중심), 그리고 최근의 LLM 기반 Agentic Architectures.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 엄격한 논리 규칙에 기반한 하드코딩된 아키텍처에서, 최근에는 LLM의 유연한 추론 능력을 핵심 엔진으로 사용하는 '뉴로-심볼릭' 혹은 '에이전틱' 아키텍처로 진화.
|
||||
- **정책 변화:** Antigravity 프로젝트는 에이전트의 내부 구조 설계 시 고전 인지 아키텍처의 '작업 기억' 개념을 차용하여, 컨텍스트 윈도우를 효율적으로 관리하는 지능형 버퍼 시스템을 운용함.
|
||||
### 매 component (universal)
|
||||
1. **Perception**: 매 input 의 representation.
|
||||
2. **Memory**:
|
||||
- **Working / short-term**: 매 context.
|
||||
- **Episodic / long-term**: 매 experience.
|
||||
- **Semantic**: 매 concept.
|
||||
- **Procedural**: 매 skill.
|
||||
3. **Reasoning / Planning**.
|
||||
4. **Action / Output**.
|
||||
5. **Learning**: 매 update.
|
||||
6. **Goal management**.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- Theory-of-Mind-ToM-in-AI, AI-Agents-Overview, Agentic-Workflow, Symbolic-AI-vs-Connectionism
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/Cognitive-Architecture.md
|
||||
### Classical architecture
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
#### SOAR (Newell, 1980s)
|
||||
- 매 production rule + 매 state-space search.
|
||||
- 매 chunking 의 learning.
|
||||
- 매 unified theory.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
#### ACT-R (Anderson, 1990s)
|
||||
- 매 declarative + procedural.
|
||||
- 매 modular (visual, motor, goal, retrieval).
|
||||
- 매 psychologically grounded.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
#### CLARION
|
||||
- 매 implicit + explicit.
|
||||
- 매 dual-process (Kahneman).
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
#### LIDA
|
||||
- 매 global workspace theory.
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Modern (LLM-era)
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
#### ReAct (Reason + Act)
|
||||
- 매 think → act → observe loop.
|
||||
- 매 chain-of-thought + tool.
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
#### Plan-and-Execute
|
||||
- 매 plan first, 매 execute step.
|
||||
- 매 LangChain.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
#### Reflection
|
||||
- 매 self-critique.
|
||||
- 매 Reflexion.
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
#### Multi-agent
|
||||
- 매 specialized role.
|
||||
- 매 AutoGen, CrewAI, MetaGPT.
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
#### Agentic memory
|
||||
- 매 vector store (semantic).
|
||||
- 매 episodic (recent + summary).
|
||||
- 매 procedural (tool examples).
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
### 매 modern stack
|
||||
- **LangChain / LangGraph**: 매 graph-based.
|
||||
- **OpenAI Agents SDK** (2025): 매 first-party.
|
||||
- **AutoGen** (Microsoft): 매 multi-agent.
|
||||
- **CrewAI**: 매 role-based.
|
||||
- **DSPy**: 매 declarative.
|
||||
- **PydanticAI**: 매 typed.
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### Neuro-Symbolic
|
||||
- 매 LLM (perception + language) + 매 symbolic (logic, math).
|
||||
- 매 AlphaProof, 매 Wolfram Alpha + LLM.
|
||||
- 매 hybrid 의 strength + interpretability.
|
||||
|
||||
### 매 응용
|
||||
1. **Personal assistant** (Claude, ChatGPT).
|
||||
2. **Code agent** (Cursor, Devin, Cline).
|
||||
3. **Research agent** (Deep Research).
|
||||
4. **Robotics** (RT-2).
|
||||
5. **Game NPC**.
|
||||
6. **Customer service**.
|
||||
|
||||
## 💻 패턴 (응용)
|
||||
|
||||
### ReAct loop (LangChain)
|
||||
```python
|
||||
from langchain.agents import create_react_agent
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langchain.prompts import PromptTemplate
|
||||
|
||||
llm = ChatOpenAI(model='gpt-4o')
|
||||
|
||||
prompt = PromptTemplate.from_template("""You are a helpful agent. Solve the question.
|
||||
|
||||
Tools available:
|
||||
{tools}
|
||||
|
||||
Use the format:
|
||||
Thought: ...
|
||||
Action: tool_name
|
||||
Action Input: ...
|
||||
Observation: ...
|
||||
... (repeat)
|
||||
Thought: I have the answer.
|
||||
Final Answer: ...
|
||||
|
||||
Question: {input}
|
||||
{agent_scratchpad}""")
|
||||
|
||||
agent = create_react_agent(llm, tools, prompt)
|
||||
result = agent.invoke({'input': 'What is the GDP of Japan in 2024?'})
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Plan-and-Execute (LangGraph)
|
||||
```python
|
||||
from langgraph.graph import StateGraph
|
||||
from typing import TypedDict, Annotated
|
||||
import operator
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
class State(TypedDict):
|
||||
plan: list[str]
|
||||
past_steps: Annotated[list, operator.add]
|
||||
response: str
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
def planner(state):
|
||||
plan = llm.invoke(f'Plan steps for: {state["input"]}')
|
||||
return {'plan': parse_steps(plan)}
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
def executor(state):
|
||||
next_step = state['plan'][len(state['past_steps'])]
|
||||
result = execute_step(next_step)
|
||||
return {'past_steps': [(next_step, result)]}
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
def replan(state):
|
||||
if all_done(state):
|
||||
return {'response': summarize(state['past_steps'])}
|
||||
new_plan = llm.invoke(f'Replan based on: {state["past_steps"]}')
|
||||
return {'plan': new_plan}
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
graph = StateGraph(State)
|
||||
graph.add_node('planner', planner)
|
||||
graph.add_node('executor', executor)
|
||||
graph.add_node('replan', replan)
|
||||
graph.set_entry_point('planner')
|
||||
graph.add_edge('planner', 'executor')
|
||||
graph.add_edge('executor', 'replan')
|
||||
graph.add_conditional_edges('replan', lambda s: 'executor' if not s.get('response') else 'END')
|
||||
```
|
||||
|
||||
### Reflexion (self-critique)
|
||||
```python
|
||||
def reflexion_loop(task, max_iter=3):
|
||||
history = []
|
||||
for i in range(max_iter):
|
||||
attempt = llm.solve(task, history=history)
|
||||
result = evaluate(attempt)
|
||||
if result.passed:
|
||||
return attempt
|
||||
|
||||
critique = llm.reflect(f"""Task: {task}
|
||||
Attempt: {attempt}
|
||||
Failure: {result.error}
|
||||
|
||||
Why did this fail? What should be done differently?""")
|
||||
history.append({'attempt': attempt, 'critique': critique})
|
||||
|
||||
return attempt # 매 best so far
|
||||
```
|
||||
|
||||
### Multi-agent (AutoGen-style)
|
||||
```python
|
||||
from autogen import AssistantAgent, UserProxyAgent
|
||||
|
||||
planner = AssistantAgent('planner', system_message='You decompose tasks.')
|
||||
coder = AssistantAgent('coder', system_message='You write Python.')
|
||||
critic = AssistantAgent('critic', system_message='You review code.')
|
||||
user = UserProxyAgent('user', code_execution_config={'work_dir': './sandbox'})
|
||||
|
||||
# 매 group chat
|
||||
groupchat = GroupChat(agents=[user, planner, coder, critic], messages=[], max_round=10)
|
||||
manager = GroupChatManager(groupchat=groupchat, llm_config=llm_config)
|
||||
user.initiate_chat(manager, message='Build a web scraper for HN.')
|
||||
```
|
||||
|
||||
### Memory (vector + episodic)
|
||||
```python
|
||||
from langchain.memory import VectorStoreRetrieverMemory
|
||||
from langchain_community.vectorstores import Chroma
|
||||
|
||||
class HierarchicalMemory:
|
||||
def __init__(self):
|
||||
self.short_term = [] # 매 last 20 turns
|
||||
self.episodic = Chroma(...) # 매 recent episodes
|
||||
self.semantic = Chroma(...) # 매 facts about world
|
||||
self.procedural = [] # 매 tool examples
|
||||
|
||||
def remember(self, event):
|
||||
self.short_term.append(event)
|
||||
if len(self.short_term) > 20:
|
||||
old = self.short_term.pop(0)
|
||||
self.episodic.add_texts([summarize(old)])
|
||||
|
||||
if is_fact(event):
|
||||
self.semantic.add_texts([fact_extract(event)])
|
||||
|
||||
def retrieve(self, query, k=5):
|
||||
return {
|
||||
'short_term': self.short_term,
|
||||
'episodic': self.episodic.similarity_search(query, k=k),
|
||||
'semantic': self.semantic.similarity_search(query, k=k),
|
||||
}
|
||||
```
|
||||
|
||||
### Working memory limit (Miller's 7±2)
|
||||
```python
|
||||
class WorkingMemory:
|
||||
"""매 limited capacity (LLM context budget)."""
|
||||
def __init__(self, max_tokens=8000):
|
||||
self.items = []
|
||||
self.max_tokens = max_tokens
|
||||
|
||||
def add(self, item):
|
||||
self.items.append(item)
|
||||
while self.token_count() > self.max_tokens:
|
||||
# 매 oldest 의 summarize + drop
|
||||
old = self.items.pop(0)
|
||||
summary = summarize_briefly(old)
|
||||
self.items.insert(0, summary)
|
||||
```
|
||||
|
||||
### Goal management
|
||||
```python
|
||||
class GoalStack:
|
||||
"""매 hierarchical goals."""
|
||||
def __init__(self, top_goal):
|
||||
self.stack = [top_goal]
|
||||
|
||||
def push_subgoal(self, subgoal):
|
||||
self.stack.append(subgoal)
|
||||
|
||||
def pop_complete(self):
|
||||
if self.stack:
|
||||
done = self.stack.pop()
|
||||
return done
|
||||
return None
|
||||
|
||||
def current(self):
|
||||
return self.stack[-1] if self.stack else None
|
||||
```
|
||||
|
||||
### Neuro-symbolic (LLM + Wolfram)
|
||||
```python
|
||||
def neuro_symbolic_solve(question):
|
||||
# 매 LLM 의 understand + 매 formalize
|
||||
formal = llm.generate(f"""Convert to Wolfram Alpha query: {question}""")
|
||||
|
||||
# 매 symbolic 의 compute
|
||||
result = wolfram.query(formal)
|
||||
|
||||
# 매 LLM 의 explain
|
||||
return llm.generate(f"""Question: {question}
|
||||
Wolfram result: {result}
|
||||
Explain in plain language.""")
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
| 상황 | Architecture |
|
||||
|---|---|
|
||||
| Single-step Q&A | LLM only |
|
||||
| Tool-using | ReAct |
|
||||
| Multi-step | Plan-and-execute |
|
||||
| Self-improve | Reflexion |
|
||||
| Specialist roles | Multi-agent (AutoGen) |
|
||||
| Long-term context | Hierarchical memory |
|
||||
| Math / proof | Neuro-symbolic |
|
||||
| Robot | RT-2 / VLA |
|
||||
|
||||
**기본값**: ReAct (single agent) + memory + tool. 매 complex = LangGraph / Plan-and-Execute.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Agent-Architecture]] · [[Cognitive-Science]] · [[AI]]
|
||||
- Classical: [[SOAR]] · [[ACT-R]] · [[CLARION]] · [[LIDA]]
|
||||
- Modern: [[ReAct]] · [[LangGraph]] · [[AutoGen]] · [[OpenAI-Agents-SDK]] · [[Reflexion]]
|
||||
- 응용: [[Memory-Hierarchy]] · [[Working-Memory]] · [[Episodic-Memory]] · [[Goal-Stack]]
|
||||
- Adjacent: [[Bayesian-Brain-Hypothesis]] · [[Biological-Intelligence]] · [[Neuro-Symbolic-AI]] · [[Multi-Agent-Systems]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 agent design. 매 long-running task. 매 multi-step. 매 tool-using. 매 robotics.
|
||||
**언제 X**: 매 single-step Q&A. 매 stateless API.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **No memory**: 매 stateless 의 multi-step fail.
|
||||
- **Unbounded loop**: 매 budget exhausted.
|
||||
- **No reflection**: 매 same error 의 repeat.
|
||||
- **Single agent for everything**: 매 specialist 의 lose.
|
||||
- **Tool spam**: 매 simple question 의 tool 의 over-call.
|
||||
- **Too many tool**: 매 selection 의 confusion.
|
||||
- **Memory overflow**: 매 context 의 unmanaged.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Newell SOAR, Anderson ACT-R, Yao ReAct, Shinn Reflexion, AutoGen / LangGraph docs).
|
||||
- 신뢰도 B.
|
||||
- Related: [[Bayesian-Brain-Hypothesis]] · [[Biological-Intelligence]] · [[Neuro-Symbolic-AI]] · [[Multi-Agent-Systems]] · [[Best-of-N_Sampling]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — classical + modern + 매 ReAct / LangGraph / multi-agent / memory code |
|
||||
|
||||
Reference in New Issue
Block a user