9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
7.5 KiB
7.5 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-goal-oriented-action-planning | Goal-Oriented Action Planning (GOAP) | 10_Wiki/Topics | verified | self |
|
none | A | 0.92 | applied |
|
2026-05-10 | pending |
|
Goal-Oriented Action Planning (GOAP)
매 한 줄
"매 NPC 의 goal 의 의 의 action sequence 의 plan". F.E.A.R. (Monolith 2005) 매 famous. 매 STRIPS-derived. 매 modern alternative: 매 behavior tree, HTN, utility AI. 매 LLM 의 action plan 의 also similar.
매 핵심
매 component
- Goal: 매 desired world state.
- Action: 매 (precondition, effect, cost).
- Planner: 매 A* search 의 의 의 actions.
- WorldState: 매 current facts.
매 vs alternatives
- FSM: 매 hardcoded transitions.
- Behavior Tree: 매 reactive, designer-friendly.
- GOAP: 매 emergent, dynamic plan.
- HTN: 매 hierarchical task decompose.
- Utility AI: 매 score actions.
매 응용
- Game AI (FPS, RTS).
- Robotics planning.
- NPC complex behavior.
- Strategy game.
- LLM agent (similar pattern).
💻 패턴
Action definition
@dataclass
class Action:
name: str
cost: float
preconditions: dict # 매 state requirements
effects: dict # 매 state changes
def can_run(self, world_state):
return all(world_state.get(k) == v for k, v in self.preconditions.items())
def apply(self, world_state):
new = world_state.copy()
new.update(self.effects)
return new
Goal definition
@dataclass
class Goal:
name: str
desired_state: dict
priority: float
def is_satisfied(self, world_state):
return all(world_state.get(k) == v for k, v in self.desired_state.items())
A* planner
import heapq
def goap_plan(world_state, goal, actions):
queue = [(0, world_state, [])]
visited = set()
while queue:
cost, state, path = heapq.heappop(queue)
state_key = frozenset(state.items())
if state_key in visited: continue
visited.add(state_key)
if goal.is_satisfied(state): return path
for action in actions:
if action.can_run(state):
new_state = action.apply(state)
heuristic = compute_heuristic(new_state, goal)
heapq.heappush(queue, (cost + action.cost + heuristic, new_state, path + [action]))
return None # 매 no plan
Heuristic (number of unsatisfied goal facts)
def compute_heuristic(state, goal):
return sum(1 for k, v in goal.desired_state.items() if state.get(k) != v)
Example: combat AI
ACTIONS = [
Action('reload', cost=1, preconditions={'has_weapon': True, 'has_ammo': True}, effects={'weapon_loaded': True}),
Action('grab_ammo', cost=2, preconditions={'near_ammo': True}, effects={'has_ammo': True}),
Action('fire', cost=1, preconditions={'weapon_loaded': True, 'enemy_visible': True}, effects={'enemy_dead': True, 'weapon_loaded': False}),
Action('take_cover', cost=3, preconditions={'cover_available': True}, effects={'in_cover': True}),
]
GOAL_KILL = Goal('kill_enemy', {'enemy_dead': True}, priority=1.0)
world = {'has_weapon': True, 'has_ammo': False, 'near_ammo': True, 'enemy_visible': True, 'cover_available': True}
plan = goap_plan(world, GOAL_KILL, ACTIONS)
# 매 → [grab_ammo, reload, fire]
Reactive replanning
class GOAPAgent:
def __init__(self, actions):
self.actions = actions
self.current_plan = []
self.current_goal = None
def update(self, world_state):
# 매 select goal
goals = self.evaluate_goals(world_state)
new_goal = max(goals, key=lambda g: g.priority)
# 매 replan if goal changed or plan invalid
if new_goal != self.current_goal or not self.plan_valid(world_state):
self.current_plan = goap_plan(world_state, new_goal, self.actions)
self.current_goal = new_goal
if self.current_plan:
return self.current_plan.pop(0)
return None
Cost dynamic adjustment
def dynamic_cost(action, world_state):
base = action.cost
if action.name == 'fire' and world_state['low_ammo']: return base * 3
if action.name == 'take_cover' and world_state['health'] < 30: return base * 0.3
return base
HTN (Hierarchical Task Network)
class Task:
def __init__(self, name, methods):
self.name = name; self.methods = methods # 매 list of decomposition
class Method:
def __init__(self, preconditions, subtasks):
self.preconditions = preconditions; self.subtasks = subtasks
# 매 decompose top task → primitive actions
Behavior Tree (alternative)
class Selector:
def tick(self):
for child in self.children:
if child.tick() == 'success': return 'success'
return 'fail'
class Sequence:
def tick(self):
for child in self.children:
if child.tick() != 'success': return 'fail'
return 'success'
# 매 attack tree
attack = Sequence([HasAmmo(), HasWeapon(), Selector([Fire(), Reload()])])
Utility AI (alternative)
def utility_decide(actions, world_state):
scores = []
for action in actions:
if not action.can_run(world_state): continue
score = sum(consider.score(world_state) for consider in action.considerations)
scores.append((action, score))
return max(scores, key=lambda x: x[1])[0]
LLM agent (similar pattern)
def llm_plan(goal, world_state, available_tools, llm):
prompt = f"""You are a planner. Goal: {goal}
Current state: {world_state}
Tools: {available_tools}
Output a plan (JSON list of tool invocations) to achieve the goal."""
return json.loads(llm.generate(prompt))
Plan visualization
def visualize_plan(plan, world_state):
state = world_state.copy()
for i, action in enumerate(plan):
print(f'{i+1}. {action.name} (cost {action.cost})')
state = action.apply(state)
print(f'Final state: {state}')
매 결정 기준
| 상황 | Approach |
|---|---|
| Complex emergent NPC | GOAP |
| Designer-driven | Behavior Tree |
| Hierarchical task | HTN |
| Score-based | Utility AI |
| Modern flexible | LLM agent |
| Simple | FSM |
기본값: 매 GOAP for emergent + 매 BT for reactive + 매 HTN for hierarchical + 매 LLM for flexible/data-rich.
🔗 Graph
- 부모: Planning
- 변형: Behavior-Tree · HTN
- 응용: F.E.A.R-AI
- Adjacent: STRIPS · Drama Management Systems · Foundation-Models
🤖 LLM 활용
언제: 매 game NPC. 매 robot planning. 언제 X: 매 simple linear behavior.
❌ 안티패턴
- Plan once + execute blind: 매 dynamic world fail.
- Action explosion: 매 search slow.
- No replanning: 매 stale.
- GOAP for trivial NPC: 매 over-engineer.
🧪 검증 / 중복
- Verified (F.E.A.R AI postmortem, Orkin, GOAP literature).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-04-20 | Auto |
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — GOAP + 매 A* / BT / HTN / utility / LLM agent code |