---
id: wiki-2026-0508-cognitive-architecture
title: Cognitive Architecture
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [SOAR, ACT-R, agent architecture, neuro-symbolic, agentic, working memory, declarative memory]
duplicate_of: none
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-05-10
github_commit: pending
tech_stack:
  language: agent design
  framework: SOAR / ACT-R / LangGraph / OpenAI Agents SDK
---

# Cognitive Architecture

## 매 한 줄
> **"매 intelligence 의 시스템 설계도"**. 매 perception + memory + reasoning + learning 의 cognitive loop. 매 classical: SOAR, ACT-R. 매 modern: LLM-based agentic (LangGraph, OpenAI Agents SDK, AutoGen). 매 neuro-symbolic 의 hybrid.

## 매 핵심

### 매 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**.

### Classical architecture

#### SOAR (Newell, 1980s)
- 매 production rule + 매 state-space search.
- 매 chunking 의 learning.
- 매 unified theory.

#### ACT-R (Anderson, 1990s)
- 매 declarative + procedural.
- 매 modular (visual, motor, goal, retrieval).
- 매 psychologically grounded.

#### CLARION
- 매 implicit + explicit.
- 매 dual-process (Kahneman).

#### LIDA
- 매 global workspace theory.

### Modern (LLM-era)

#### ReAct (Reason + Act)
- 매 think → act → observe loop.
- 매 chain-of-thought + tool.

#### Plan-and-Execute
- 매 plan first, 매 execute step.
- 매 LangChain.

#### Reflection
- 매 self-critique.
- 매 Reflexion.

#### Multi-agent
- 매 specialized role.
- 매 AutoGen, CrewAI, MetaGPT.

#### Agentic memory
- 매 vector store (semantic).
- 매 episodic (recent + summary).
- 매 procedural (tool examples).

### 매 modern stack
- **LangChain / LangGraph**: 매 graph-based.
- **OpenAI Agents SDK** (2025): 매 first-party.
- **AutoGen** (Microsoft): 매 multi-agent.
- **CrewAI**: 매 role-based.
- **DSPy**: 매 declarative.
- **PydanticAI**: 매 typed.

### 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?'})
```

### Plan-and-Execute (LangGraph)
```python
from langgraph.graph import StateGraph
from typing import TypedDict, Annotated
import operator

class State(TypedDict):
    plan: list[str]
    past_steps: Annotated[list, operator.add]
    response: str

def planner(state):
    plan = llm.invoke(f'Plan steps for: {state["input"]}')
    return {'plan': parse_steps(plan)}

def executor(state):
    next_step = state['plan'][len(state['past_steps'])]
    result = execute_step(next_step)
    return {'past_steps': [(next_step, result)]}

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}

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]] · [[AI]]
- Classical: [[SOAR]] · [[ACT-R]]
- Modern: [[ReAct]] · [[LangGraph]] · [[AutoGen]] · [[Reflexion]]
- 응용: [[Memory-Hierarchy]] · [[Working Memory]]
- Adjacent: [[Bayesian-Brain-Hypothesis]] · [[Biological-Intelligence]] · [[Neural-Symbolic-Integration|Neuro-Symbolic-AI]] · [[Multi-agent-System|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]] · [[Neural-Symbolic-Integration|Neuro-Symbolic-AI]] · [[Multi-agent-System|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 |
