← /
systems · 15 architecture

systems

/craft 는 다.
여기는 어떻게 — 손수 구축한 본격 architecture.

마스킹: 회사명 · 실명 · 클라이언트 · 내부 path 일반화

scroll ↓
01brain

뉴런 파일시스템 → 규칙 컴파일러

NeuronFS Brain Compiler

폴더 구조가 곧 규칙이다 — 마크다운 78개가 단일 CLAUDE.md 로 컴파일된다.

  1. 017 region (brainstem · limbic · hippocampus · sensors · cortex · ego · prefrontal) 폴더 스캔
  2. 02각 region 안 active 뉴런 (markdown) 만 — _pending_review · _archive 제외
  3. 03P0~P6 priority 정렬 — brainstem(P0) → limbic(P1) → … → prefrontal(P6)
  4. 04Go 바이너리 단일 emit → CLAUDE.md / GEMINI.md 자동 갱신
  5. 05git push → 서버 pull → 서버 emit → 모든 LLM 에이전트 즉시 새 규칙
차별

보통 LLM 룰은 정적 system prompt 단일 파일. NeuronFS = 폴더 구조 자체가 의미 + 자동 컴파일 → 규칙 진화가 git diff 로 잡힌다.

codecore/neuronfs (Go) · brain/{region}/{neuron}.md
scope78 neuron · 145 activation · 500+ LOC 컴파일러
운영

사이트 모든 LLM 에이전트가 단일 CLAUDE.md 참조

02brain

뉴런 자율진화 — 자동 승격 + 자동 폐기

Neuron Auto-Promote + Auto-Archive Cron

쓸수록 시스템이 똑똑해진다 — 좋은 패턴은 승격하고 나쁜 패턴은 archive 한다.

  1. 01매일 03:30 KST — counter ≥ 10 + dopamine ≥ 1 + bomb = 0 뉴런 자동 승격 (client → universal)
  2. 02매일 04:00 KST — bomb ≥ 1 또는 stale(counter ≤ 1 && 30일 무변동 && dopamine 0) 자동 archive
  3. 03evolution-lock 으로 promote 와 archive 동시성 방지
  4. 04audit.log('auto_neuron_promote' / 'auto_neuron_archive') — 모든 변화 추적
  5. 05_archive/ 폴더 = 냉동 보관 (영구 삭제 X · 복원 가능)
차별

사람이 별점 4-5 = dopamine, 1-2 = bomb → counter 누적 → 자동 승격/폐기. 시스템이 자연선택처럼 작동.

codecore/modules/neuron-auto-promote.js · neuron-auto-archive.js
scope187 + 261 LOC · 7 region 병렬 스캔
운영

운영 자동화 — 사람 손 없이 시스템 자가 진화

03brain

반복 에러 → 자동 수정 제안 파이프라인

Auto-Fix Autonomous Repair Pipeline

사고가 3번 반복되면 시스템이 직접 수정안을 만든다.

  1. 01neuron.js 가 에러 패턴 3회 이상 감지
  2. 02CTO-Tech 에이전트 prompt → 근본 원인 분석 + 수정 코드 제안
  3. 03proposal.status = awaiting_approval → 텔레그램 Gatekeeper 에 승인 요청
  4. 04approveFix() → executeTask(proposal, sourceType='auto-fix') → 코드 patch 적용
  5. 05Quality-Checker 검증 → git commit + audit log
차별

CI/CD 는 실패 알림만 — 우리는 실패 = 학습 신호. 수정안 자체를 시스템이 생성. 사람은 승인만.

codecore/modules/auto-fix.js · agent CTO-Tech
scope150+ LOC · agent chaining (CTO-Tech → executeTask → Quality-Checker)
운영

반복 사고 자동 closed-loop

04brain

사용자 피드백 → 뉴런 신호 영속화

Brain Writer + Corrections Pipeline

승인/반려/수정요청 한 번이 뉴런 한 줄로 영구 박힌다.

  1. 01POST /board/approve → onApprove(agentId) → brain-writer.append('dopamine', cortex/quality/推{agentId}_성공)
  2. 02POST /board/reject → onReject(agentId, reason) → append('correction', cortex/quality/禁{agentId}_품질미달)
  3. 03BRAIN_PATH/_inbox/corrections.jsonl 에 append (쓰레드 안전)
  4. 04evolve.sh (cron 10분) → corrections.jsonl 읽기 → 뉴런 신호 파일로 변환
  5. 05sync_brain.py 재생성 → 다음 LLM call 에서 즉시 반영
차별

보통 RLHF 는 별도 학습 batch. 우리는 production feedback 이 runtime 에 즉시 박힘 = 온라인 학습.

codecore/modules/brain-writer.js · neuron-trace.js · evolve.sh
scope100+ LOC + 10분 cron · prompt injection guard
운영

human-in-the-loop 자율진화 핵심 고리

05brain

뉴런 3-tier 파일시스템 격리

Neuron Scope 3-Tier File-System Isolation

RLS 보다 강하다 — 회사별 뉴런이 물리적으로 분리된다.

  1. 01scope = client_{coId} (회사 전용) · universal (공통) · proprietary (핵심)
  2. 02각 scope = 별도 brain_ 디렉토리 (brain_co13 · brain_universal · brain_proprietary)
  3. 03scanBrain(brainPath, scope) → 7 region 병렬 + neuron 카운터
  4. 04promoteNeuron(from, to) → 이동 + audit. proprietary 승격은 owner 수동 only
  5. 05client → universal 은 자동 (counter ≥ 10) · universal → proprietary 은 수동 only
차별

SQL RLS 는 query-time filtering — file-system isolation 은 물리적 분리. brain_co13 / brain_co14 는 절대 섞이지 않는다.

codecore/modules/neuron-scope.js · brain_{scope}/
scope316 LOC · 7 region × 2 경로 (active + _pending_review)
운영

데이터 moat 격리의 가장 강한 형태

06pipeline

청크 병렬 생성 + 분량 미달 자동 보충

Chunked Generator + Continuation Pipeline

30000자 single shot 은 깨진다 — 청크로 쪼개고 부족분은 자동 보충.

  1. 01단발 거대 prompt → 8~13개 sub-prompt 로 분할 (chunk-prompt-builder)
  2. 02curl_multi 롤링 풀 → 동시성 최대 6 cap (API rate limit 안 깨짐)
  3. 03429 / 5xx / timeout → Retry-After + 지수백오프 (최대 2회 자동 재시도)
  4. 04부분 실패 정책 — 전체 실패는 FAILED, 비핵심 키 누락은 성공분 COMPLETED
  5. 05분량 미달 키 (목표 90% 미만) → chunk-continuation 자동 호출 → 누적 → 최종 array_merge
차별

OpenAI Batch API 와 다르다 — 동기 실시간 + 동시성 cap + 부분 실패 허용. 분량 보장은 자체 구현.

codecore/api/chunked-generator.php · openai-batch.php · chunk-continuation.php
scope1200+ LOC (365 + 280 + 200 + 223 + 200)
운영

단발 40K timeout 사고 회피

07orchestrator

5인 전문가 병렬 호출 + 대종합 합성

5-Persona Master Chain Orchestrator

단일 모델 + variance 아니다 — 5명의 독립 세계관이 병렬로 답하고 종합한다.

  1. 015 페르소나 = Logic (원국 논리) · Aura (기운) · Health (건강) · Love (연애) · Master (종합)
  2. 02각 페르소나 = 독립 prompt + 독립 톤 (tsundere_grandma / luxury_communicator 등)
  3. 03병렬 호출 (curl_multi) → 8청크 × 5 페르소나 = 40 sub-call 동시
  4. 04응답 reshape — flat $merged → agent_consensus['logic-master'/'aura-gen'/...] 트리
  5. 05Grand Master stage → 5 결과 합성 → grand_synthesis 본문 생성
차별

prompt variation 단순 N회 호출이 아니다. 각 페르소나가 독립 세계관 → 논리·기운·건강·연애 다각도 → 최종 종합 = 신뢰도 단일 호출 X.

codecore/assets/js/premium-mock.js · prompt-builder.php · chunked-generator.php (L293-324)
scope1000+ LOC · trait 기반 modular
운영

프리미엄 리포트 다각도 해석 표준

08engine

매거진 가독성 7축 엔진

Magazine Readability Engine

긴 텍스트가 책처럼 읽히게 한다 — 자동 호흡 + drop-cap + 키워드 강조.

  1. 01자동 문단 분할 — \n\n 없는 긴 텍스트 → 문장 단위 split → 3-4 문장씩 그룹화
  2. 02Drop-cap — 첫 단락 첫 글자 oversized (CSS .sp-dropcap)
  3. 03Keyword auto-wrap — 도메인 키워드 (천간지지 · 명리학자) 자동 <span class='sp-keyword'>
  4. 04Ornament divider — 매 3 단락마다 ✦ 자동 삽입 (가독성 호흡)
  5. 05Pullquote 변환 — 강조 문단 → <blockquote class='sp-pullquote'>
  6. 06공개 API — window.MagazineReadability.setRichText(id, txt, opts)
차별

보통 백엔드가 문단 포매팅. 우리는 프론트 클라이언트가 문맥 인식 자동 분석 → 매거진 톤 = 사이트 와이드 일관.

codecore/assets/js/magazine-readability.js · chungwol-{page}.css
scope194 LOC · 모든 premium 페이지 자동 적용
운영

초고가 콘텐츠 프리미엄감 = 스타일 일관성

09framework

오픈몬타주 비디오 파이프라인 오케스트레이션

OpenMontage Video Pipeline Orchestration

파이프라인은 YAML 선언, 에이전트는 SKILL.md 지식 소비자.

  1. 01pipeline_defs/{name}.yaml = orchestration + stages[] + checkpoint_policy + budget_default
  2. 02각 stage = skill (director skill 경로) + tools_available + human_approval_default + review_focus
  3. 03Agent = AGENT_GUIDE.md Rule Zero → pipeline 선택 → stage director 읽음 → tool registry 발견 → 실행
  4. 04Checkpoint 저장 = projects/{name}/checkpoint_{stage}.json
  5. 0511 파이프라인 = animated-explainer · talking-head · screen-demo · cinematic · avatar-spokesperson · …
차별

대부분 비디오 시스템은 Python flow 를 코드로 작성. 여기는 선언형 manifest + agent 가 읽음 = 기획자도 파이프라인 확장.

codeopenmontage/pipeline_defs/*.yaml · .agents/skills/pipelines/{name}/
scope11 pipelines · 80+ stages · 60+ stage director skills
운영

비디오 production 본격 framework

10framework

도구 등록 + 실행 계약 시스템

Tool Registry + BaseTool Contract

BaseTool 1개 상속 = 자동 발견 + provider routing.

  1. 01BaseTool 상속 — name · description · capability · provider · tier · status · runtime
  2. 02registry.discover('tools') → 모든 BaseTool 자동 발견 (런타임)
  3. 03capability_catalog() → {TTS · video_generation · image_generation · music_generation · …}
  4. 04Selector 패턴 — tts_selector · image_selector · video_selector → 자동 routing
  5. 05새 provider 추가 = BaseTool 1개 작성. Selector 수정 0.
차별

각 BaseTool 의 agent_skills 필드 → Layer 3 SKILL.md 강제. '도구 호출 전 SKILL.md 읽어라' 가 시스템 룰.

codeopenmontage/tools/base_tool.py · tool_registry.py · tools/{capability}/
scope1105 LOC + 30+ concrete tool classes
운영

60+ vendor-specific SKILL 통합

11orchestrator

자연어 한 줄 → 에이전트 팀 자동 구성

kkirikkiri Natural Language Agent Team Builder

'분석 팀 4명' 한 문장 → 15초 안에 실행 가능한 팀.

  1. 01User natural language intent 파싱
  2. 02Environment scan — .claude/agents/*.md 자동 발견
  3. 03Matching — agent frontmatter 의 recommended-for 와 user intent 매칭
  4. 04Team composition (sequential / parallel)
  5. 05Agent spawning — 각 에이전트의 model · tools · role 로드 + Coordination protocol
차별

기존 multi-agent 는 팀 구성을 코드로 작성. 우리는 자연어 + frontmatter matching → 에이전트 재사용성 극대화.

codegptaku_plugins/plugins/kkirikkiri · agent-file-standard
scopev0.12.0 · pool matching · coordination protocol
운영

재사용성 극대화 — 같은 팀 다시 요청 = 기존 agents 재사용

12runtime

shared hosting 에서 비동기 백그라운드 워커

Shared-Host Worker Async Pattern

Job Queue 없이 mod_php + ignore_user_abort 로 240초 백그라운드.

  1. 01Secret query gate — $_GET['k'] 토큰 → hash_equals() 비교 (인증)
  2. 02ignore_user_abort(true) + set_time_limit(240) → 클라이언트 종료 후에도 처리 계속
  3. 03HTTP 202 Accepted 즉시 반환 → 사용자는 pending 상태로 인식
  4. 04백그라운드 — analysis_status = GENERATING → AI 호출 → COMPLETED
  5. 05최종 → Meta CAPI Lead 자동 발화 + Mailer reportReady 발송
차별

Redis / RabbitMQ 같은 Job Queue 없이 — 순수 PHP + ignore_user_abort 만으로 production 비동기. shared hosting 제약에서 자체 발명.

codecore/api/pet-saju-v2-worker.php · saju-worker.php
scope206 LOC · 동일 패턴 다중 라우트
운영

shared hosting 환경 비동기 production 운영

13pipeline

별점 + 카테고리 chip → 학습 신호 추출

Star Rating → SFT/DPO Label Pipeline

self-directed chip 으로 자유 텍스트의 잡음을 제거한 라벨링.

  1. 01별점 1~5 + 카테고리 chip (사유) → submitAgentFeedback(payload)
  2. 02delivery_id (전송물 ID) + conversation_id (대화 ID) 이중 anchor
  3. 03rating 4~5 + category = chosen (SFT 학습용)
  4. 04rating 1~2 = rejected (DPO 학습용) · rating 3 = 제외
  5. 05matched=0 → silent success 차단, '저장 실패' 명시화
차별

timestamp fallback 폐기 — ID 두 개 anchor. 30분 내 여러 결과 섞임 차단. 라벨 정확도 자체가 학습 데이터의 품질.

codecore/components/agents/StarRating · lib/api/agents.js (L41-56)
scope2 파일 · 120 LOC · Promise 상태 머신
운영

SFT/DPO 학습 데이터 자동 정제

14runtime

브릿지 듀얼마운트 인증 + 테넌트 검증 게이트웨이

Bridge Dual-Mount Authentication Gateway

Bearer 토큰 폐기 — httpOnly cookie + 테넌트 RLS 자동.

  1. 01credentials: 'include' 자동 전송 → nexus_session cookie
  2. 02401 응답 → 'nexus:auth-expired' CustomEvent → authStore.logout + toast
  3. 03OAuth callback: code → POST /auth/exchange-code → server Set-Cookie
  4. 04/api/board (테넌트 격리) vs /api (전역, super_admin only) 분리
  5. 05Bridge token 은 BRIDGE_TOKEN 전용 (board session 으로 접근 X · 401)
차별

localStorage 토큰 영구 폐기 → XSS 탈취 차단. 혼합 auth (cookie + Bearer 레거시) 양립 + 점진 이관.

codecore/lib/api/http.js · bridge.js · agents.js
scope3 파일 · 210 LOC · 25+ endpoint abstraction
운영

다중 회사 동시 운영 + XSS 안전성

15framework

레이어 3 — 벤더 특화 프롬프트 엔지니어링 지식 레이어

Layer 3 SKILL.md — Vendor-Specific Prompt Engineering

도구 호출 전 SKILL.md 읽어라 — Rule Zero.

  1. 013-layer architecture — Layer 1 registry/tools · Layer 2 pipeline skills · Layer 3 vendor skills
  2. 02Layer 3 = .agents/skills/{vendor}/SKILL.md → tool 호출 *반드시 먼저* 읽음
  3. 03SKILL.md 구조 — Quick Reference / Architecture / Prompt Engineering / Error Handling / Cost & Limits
  4. 0430+ vendor — ACE-Step · LTX-2 · HeyGen · BFL · ElevenLabs · FLUX · Remotion · FFmpeg · …
  5. 05각 SKILL.md = 해당 모델이 잘 반응하는 prompt 구조 explicit — trial-and-error 제거
차별

단순 API docs 가 아니다. '이 모델이 좋은 결과를 내는 prompt 구조' 를 explicit 하게 가르침. output quality 2-3배 증가.

codeopenmontage/.agents/skills/{vendor}/SKILL.md
scope30+ skills · 각 500-1000 words + examples + error handling
운영

trial-and-error 제거 = production quality 증명

← /craft — 원리 15/incidents — 사고 → 룰 →
다음 ↘work