feat: 추가된 메모리 기능으로 광맥 및 마지막 행동 저장

- 에이전트가 발견한 광맥 좌표를 `ore_patch_memory.json`에 저장하여 재시작 시 활용 가능
- 마지막 실행한 행동과 결과를 `agent_last_action_memory.json`에 저장하여 다음 상태 요약에서 참고 가능
- `state_reader.py`에서 메모리 로드 및 상태 요약에 포함
- `ai_planner.py`에서 시스템 프롬프트에 기억된 광맥 및 마지막 행동 관련 가이드 추가
- `README.md`에 새로운 메모리 기능 설명 추가
This commit is contained in:
21in7
2026-03-25 23:34:25 +09:00
parent 8c90e80582
commit 25eaa7f6cd
16 changed files with 498 additions and 12 deletions

13
main.py
View File

@@ -17,6 +17,7 @@ from state_reader import StateReader
from context_compressor import ContextCompressor
from ai_planner import AIPlanner
from action_executor import ActionExecutor
from agent_last_action_memory import save_last_action_memory
RCON_HOST = os.getenv("FACTORIO_HOST", "127.0.0.1")
RCON_PORT = int(os.getenv("FACTORIO_PORT", "25575"))
@@ -124,6 +125,18 @@ def run():
status = "OK" if success else "FAIL"
print(f" 결과: {status} {message}")
# 재시작 시 직전 행동을 참고할 수 있도록 메모리에 저장
try:
save_last_action_memory({
"action": act,
"params": action.get("params", {}),
"success": success,
"message": message,
"timestamp": time.time(),
})
except Exception:
pass
planner.record_feedback(action, success, message)
if not success: