Files
2nd/10_Wiki/Topics/Autonomous_Queue_Processing_Engine.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

3.9 KiB

id, title, category, status, canonical_id, aliases, source_trust_level, confidence_score, created_at, updated_at, last_reinforced, verification_status, applied_in, tags
id title category status canonical_id aliases source_trust_level confidence_score created_at updated_at last_reinforced verification_status applied_in tags
autonomous-queue-processing-engine Autonomous Queue Processing Engine 10_Wiki/Topics verified self
자율 큐 처리 엔진
지식 수집 엔진
Knowledge Expansion Engine
A 0.98 2026-05-11 2026-05-11 2026-05-11 applied
path note
/Volumes/Data/project/Antigravity/Datacollector_MAC/src/lib/engine.ts Producer-Consumer 기반 지식 수집 파이프라인 구현
path note
/Volumes/Data/project/Antigravity/Datacollector_MAC/src/store/agentStore.ts Zustand Persist를 이용한 큐 및 상태 영속화
engine
queue
automation
architecture

Autonomous_Queue_Processing_Engine

📌 한 줄 통찰 (The Karpathy Summary)

자율 엔진의 생명력은 단순히 코드가 실행되는 것이 아니라, **상태의 영속성(Persistence)**과 비동기 파이프라인의 격리를 통해 프로세스가 중단되어도 마지막 지점에서 즉시 재개할 수 있는 능력에서 나온다.

📖 핵심 개념 (Synthesized Content)

1. Producer-Consumer 모델

지식 수집(Research)과 지식 확장(Ontology Expansion)을 분리합니다. 수집된 지식에서 새로운 주제(Links)를 발견하면 큐에 추가(Produce)하고, 엔진은 큐를 순차적으로 소비(Consume)합니다.

2. 상태 영속화 (State Persistence)

메모리상의 큐는 휘발성입니다. 엔진의 상태(queue, completed, processedCount)는 반드시 파일 시스템이나 LocalStorage 등에 영속화되어야 하며, running 상태에서 비정상 종료 시 재시작할 때 paused로 안전하게 복구되어야 합니다.

3. 지능적 틱 조절 (Intelligent Tick Scheduling)

하드웨어(예: M4 아키텍처)의 부하를 고려하여 작업 간 간격(Tick)을 동적으로 조절하고, 정체 감지 시 Watchdog 로직이 엔진을 다시 깨울 수 있어야 합니다.

💻 코드 패턴 (Implementation Patterns)

상태 영속화 (Zustand 예시)

persist(
  (set, get) => ({
    queue: [],
    completed: [],
    // ... actions
  }),
  {
    name: 'engine-storage',
    partialize: (state) => ({
      queue: state.queue,
      completed: state.completed,
      status: state.status === 'running' ? 'paused' : state.status
    }),
  }
)

Dequeue 및 실행 락

async function processQueue() {
  if (!isRunning || isConsumerActive || executionLock) return;
  
  executionLock = true;
  isConsumerActive = true;
  
  try {
    const task = queue[0];
    await executeTask(task);
    dequeue();
  } finally {
    isConsumerActive = false;
    executionLock = false;
  }
}

🤔 의사결정 기준

항목 기준
작업 우선순위 일반적으로 Depth-First(깊이 우선)를 선호하되, 큐 삽입 시 정렬 필수
중복 처리 큐 삽입 전 completed 리스트와 현재 queue 내 중복을 반드시 체크
종료 조건 목표 처리량(Max Count) 또는 모든 작업 완료 시 엔진 정지

안티패턴

  • In-Memory Only Queue: 브라우저 리프레시나 프로세스 재시작 시 모든 작업 내역을 잃게 됩니다.
  • Concurrent Execution without Lock: 동일한 큐 아이템에 대해 여러 Consumer가 동시에 달려들어 중복 작업을 수행하거나 상태가 꼬일 수 있습니다.

🧪 검증 상태 (Validation)

  • 상태: verified
  • 출처 신뢰도: A
  • 적용 사례: Datacollector_MACKnowledgeEngine 클래스에서 검증됨.

🔗 지식 연결 (Graph)

🕓 변경 이력 (Changelog)

날짜 변경 내용 처리 방식 신뢰도
2026-05-11 Datacollector_MAC 엔진 설계를 바탕으로 최초 생성 CREATE A