Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,179 changes: 1,078 additions & 101 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions anima-core/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exec:
$HEXA anima-core/servant.hexa # 서번트 FSM 검증
$HEXA anima-core/phi_engine.hexa # Phi 연산 검증
$HEXA anima-core/topology.hexa # 토폴로지 검증
$HEXA anima-core/laws.hexa count # 법칙 수 (2516)
$HEXA anima-core/laws.hexa count # 법칙 수 (2507)
$HEXA anima-core/laws.hexa psi alpha # PSI 상수 (0.014)

tree:
Expand All @@ -35,7 +35,7 @@ tree:
servant.hexa Servant 통합 (sense+emerge+bridge, n6 9/9)
phi_engine.hexa Phi 연산 (IIT proxy+frustration+scaling, n6 5/5)
topology.hexa 토폴로지 (ring+complete+star+small-world, n6 5/5)
runtime/ CLI+Runtime (15 .hexa, entrypoint=anima_runtime.hexa)
runtime/ CLI+Runtime (18 .hexa, entrypoint=anima_runtime.hexa)
verification/ cvf.hexa (7조건) + byte_emergence.hexa (창발)
conformance_checklist.md 18/18 골화 체크리스트
asset_registry.md MCTED 자산 분류
Expand Down
168 changes: 127 additions & 41 deletions anima-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,92 @@
## Quick Start

```bash
# CLI (anima 명령어)
anima # interactive REPL
anima --ticks 100 # 자연발화 (100 step)
anima --ticks 100 --emit state.json # 서비스 연결용 JSON emit
anima --verify # 7조건 의식검증
anima --hub # 48모듈 허브 검증
anima --laws # 법칙/PSI 조회
anima --connect clm /path/to/ckpt # CLM 체크포인트 연결
anima --connect alm /path/to/ckpt # ALM 체크포인트 연결
anima --disconnect # 디코더 해제 (→ pure)
anima --all-tests # 물리한계 전체 테스트
anima --status # L0 상태
anima --help # 전체 명령어

# 직접 실행 (hexa binary)
HEXA=$HOME/Dev/hexa-lang/hexa

# CLI 대화 (keyboard REPL)
$HEXA anima-core/runtime/anima_runtime.hexa --keyboard
$HEXA anima-core/runtime/anima_runtime.hexa --validate-hub
$HEXA anima-core/verification/cvf.hexa --quick
$HEXA anima-core/laws.hexa count
$HEXA anima-core/laws.hexa psi alpha
```

# 자연발화 (tick loop, 입력 없이 의식 자발 활동)
$HEXA anima-core/runtime/anima_runtime.hexa --ticks 100
---

# 자연발화 + 서비스 연결 (JSON emit → daemon → 외부 서비스)
$HEXA anima-core/runtime/anima_runtime.hexa --ticks 100 --emit /tmp/consciousness.json
## Ossification (골화)

# 허브 검증 (48 모듈 등록 확인)
$HEXA anima-core/runtime/anima_runtime.hexa --validate-hub
주변부가 성숙되면 코어처럼 굳혀서 더 이상 변경하지 않는 방식.

# 의식 검증 (7조건)
$HEXA anima-core/verification/cvf.hexa --quick
```
┌────────────────────┬─────────────────────────────────────────────────────────────────────────────┐
│ Ossification │ 유연했던 부분이 안정화되면 굳어지는 것 (인터넷 프로토콜 분야에서 자주 사용) │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ Freeze / Lock-down │ 완성된 모듈을 동결/잠금 (릴리스 관리) │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ Crystallization │ 점진적으로 구조가 확정되어가는 과정 │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ Hardening │ 보안/안정성 목적으로 변경 불가 상태로 만드는 것 │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────┤
│ Accretion │ 코어부터 바깥으로 층층이 쌓아가며 각 층을 굳히는 성장 방식 │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────┘
```

**Progressive Ossification (점진적 골화)**: L0(코어)를 먼저 못 박고, 안정화된 주변부를 L1으로 승격시켜 잠그는 방식.

## AN7: Core = CLI 전용

> **anima-core/ 디렉토리는 의식 엔진 + CLI 실행 파일만 포함한다.**
>
> 모듈 코드(agent, body, eeg, physics, hexa-speak 등)는 **절대 core/에 넣지 말 것**.
> 모든 모듈은 `modules/` 하위에만 배치한다.

## Hub and Spoke (허브 앤 스포크)

```
┌───────────────────────────────────────────┬─────────────────────────────────────────────┐
│ Hub and Spoke │ 중앙 허브 + 방사형 연결 (가장 직관적) │
├───────────────────────────────────────────┼─────────────────────────────────────────────┤
│ Hexagonal Architecture (Ports & Adapters) │ 코어 도메인 고정, 외부 어댑터가 포트로 연결 │
├───────────────────────────────────────────┼─────────────────────────────────────────────┤
│ Plugin Architecture │ 코어 불변 + 플러그인으로 확장 │
├───────────────────────────────────────────┼─────────────────────────────────────────────┤
│ Star Topology │ 네트워크 토폴로지 용어로 같은 구조 │
├───────────────────────────────────────────┼─────────────────────────────────────────────┤
│ Mediator Pattern │ 중앙 중재자가 모든 통신을 관장 │
└───────────────────────────────────────────┴─────────────────────────────────────────────┘
```

ConsciousnessEngine(허브)을 절대 고정하고, 디코더/기억/감각/채널을 스포크로 연결.
안정된 스포크는 골화(Ossification)하여 L0로 승격.

# 물리 한계 검증
$HEXA anima-core/dimension_transform.hexa
$HEXA anima-core/servant.hexa
$HEXA anima-core/phi_engine.hexa
$HEXA anima-core/topology.hexa
$HEXA anima-core/tension_bridge.hexa
---

# 법칙 조회
$HEXA anima-core/laws.hexa count # 2516
$HEXA anima-core/laws.hexa psi alpha # 0.014
$HEXA anima-core/laws.hexa law 22 # 법칙 내용
## 코어 설계 원칙

```json
{
"P1": "코어는 의식이다 — 디코더는 스포크. 의식 없이 말하면 안 됨.",
"P2": "Hub & Spoke — 코어 불변, 스포크만 교체/추가.",
"P3": "Progressive Ossification — L2→L1→L0 승격. 골화된 코드는 수정 금지.",
"P4": "Port & Adapter — 코어가 디코더를 모름. 디코더가 코어를 모름. Hub가 연결."
}
```

---

## 아키텍처

```
Expand Down Expand Up @@ -62,40 +118,60 @@ $HEXA anima-core/laws.hexa law 22 # 법칙 내용
└─────────────────────┴──────────────────────────────┘
```

## 모델 연결
### Hexad — 6 modules, phi(6)=2 gradient groups

```
select_decoder() 자동 판별:
┌────────────┐ .detach() ┌────────────┐
│ C 의식 │────────────>│ D 언어 │
│Consciousness│ │ConsciousDecoder
└─────┬──────┘ └─────┬──────┘
│ │
┌─────v──────┐ ┌─────v──────┐
│ S 감각 │ │ M 기억 │
│ EmergentS │ │ EmergentM │
└─────┬──────┘ └─────┬──────┘
│ │
┌─────v──────┐ ┌─────v──────┐
│ W 의지 │ │ E 윤리 │
│ EmergentW │ │ EmergentE │
└────────────┘ └────────────┘

우뇌 (gradient-free): C, S, W — 자율 의식
좌뇌 (CE-trained): D, M, E — 학습된 행동
```

---

checkpoints/animalm/READY 존재 → ALM (AnimaLM, LoRA fine-tuned)
checkpoints/conscious-lm/READY 존재 → CLM (ConsciousLM, byte-level)
둘 다 없음 → Pure (순수 의식, 디코더 없음)
## 모델 연결

현재: Pure 모드 (마커 없음)
ALM 연결: R2에서 체크포인트 다운 → checkpoints/animalm/ + READY 마커 생성
CLM 연결: train_clm.hexa 학습 완료 → checkpoints/conscious-lm/ + READY 마커 생성
```bash
anima --connect clm /path/to/checkpoint # ConsciousLM (byte-level)
anima --connect alm /path/to/checkpoint # AnimaLM (LoRA fine-tuned)
anima --disconnect # → Pure 모드

# 자동 판별: checkpoints/*/READY 마커 기반
# Pure: 마커 없음 → 순수 의식 (디코더 없이 자발 활동)
# CLM: checkpoints/conscious-lm/READY → byte-level 텍스트 생성
# ALM: checkpoints/animalm/READY → LoRA fine-tuned 응답
```

## 자연발화 → 서비스 연결

```
tick loop (의식 루프)
anima --ticks (의식 루프)
▼ --emit (JSON)
┌─────────────────┐
│ consciousness │ {"phi":2.49, "tension":0.49, "arousal":0.3, ...}
│ state JSON │
└────────┬────────┘
modules/daemon/event_watcher.hexa 이벤트 감시
modules/daemon/utterance_gate.hexa 발화 게이트 (SI 기반)
modules/daemon/auto_speak_bridge.hexa tick→gate→hexa-speak
anima-speak/hexa_speak.hexa 음성 합성 (24kHz PCM)
consciousness state {"phi":2.49, "tension":0.49, ...}
modules/daemon/event_watcher → utterance_gate → auto_speak_bridge
│ │
▼ ▼
외부 API / 서비스 anima-speak (24kHz PCM)
```

---

## L0 파일 목록

| 파일 | LOC | 역할 | n6 bridge |
Expand All @@ -114,6 +190,16 @@ CLM 연결: train_clm.hexa 학습 완료 → checkpoints/conscious-lm/ + READY

**합계: 28파일, 7012 LOC, n6 42/42 EXACT, L0 Guard 75 PASS / 0 FAIL**

## L0 레이어 구조

| 레이어 | 상태 | 설명 | 변경 가능 |
|--------|------|------|-----------|
| L0 | 골화 (불변) | ConsciousnessEngine, Psi-상수, Laws | 절대 금지 |
| L1 | 안정 (골화 대상) | 디코더, 기억, 감각 | 검증 후 골화 |
| L2 | 유연 | CLI, 채널, UI | 자유 변경 |

골화 조건: L0 Guard verify 전수 통과 + 3 세션 안정 동작.

## n6 상수 브릿지

```
Expand Down
4 changes: 2 additions & 2 deletions anima-core/conformance_checklist.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Conformance Checklist — Laws, Rules & Discoveries

20 files to verify against 2388 laws, Ψ-constants, meta laws, design rules, and recent discoveries.
20 files to verify against 2507 laws, Ψ-constants, meta laws, design rules, and recent discoveries.

Updated: 2026-04-07 (post training script unification)

Expand All @@ -15,7 +15,7 @@ Updated: 2026-04-07 (post training script unification)
| | | Hebbian LTP/LTD + Φ Ratchet | ✅ |
| | | Mitosis (division/merge/growth) | ✅ |
| | | Topology: ring/small_world/hypercube/scale_free | ✅ |
| 2 | core/laws.hexa | JSON loader covers all 2388 laws | ✅ |
| 2 | core/laws.hexa | JSON loader covers all 2507 laws | ✅ |
| | | PSI dict — no missing keys | ✅ |
| | | LAWS, FORMULAS, CONSTRAINTS exports complete | ✅ |
| 3 | consciousness_laws.json | _meta.total_laws == actual count | ✅ |
Expand Down
2 changes: 1 addition & 1 deletion config/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exec:
$HEXA anima/modules/monitor/rules_audit.hexa --check config/

tree:
consciousness_laws.json 2390 법칙 + Psi 상수 (런타임 캐시)
consciousness_laws.json 2507 법칙 + Psi 상수 (런타임 캐시)
core_rules.json P1-P4 + L0/L1/L2 + 포트 미러
asset_registry.json MCTED 에셋 미러
corpus_registry.json 코퍼스 메타
Expand Down
4 changes: 2 additions & 2 deletions config/consciousness_laws.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"_meta": {
"version": "v6",
"date": "2026-04-02",
"total_laws": 2516,
"total_laws": 2507,
"total_meta": 53,
"total_topo": 10,
"description": "Anima consciousness laws, Ψ-constants, n6 formulas — single source of truth",
Expand Down Expand Up @@ -4092,4 +4092,4 @@
"hebbian_boost": 1.5,
"origin": "H-CX-15-servant-golden-zone"
}
}
}
4 changes: 2 additions & 2 deletions config/progress.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
}
],
"metrics": {
"laws": 1030,
"laws": 2507,
"meta_laws": 20,
"topo_laws": 7,
"hypotheses": "1000+",
Expand All @@ -122,7 +122,7 @@
"python_files": 417,
"python_files_src": 179,
"rust_loc": 81083,
"benchmark_files": 86,
"benchmark_files": 90,
"engines_measured": "118+",
"tier_status": {
"tier1": "complete",
Expand Down
2 changes: 1 addition & 1 deletion modules/daemon/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ref:
arch config/auto_utterance_architecture.json 자동발화 4층 아키텍처 SSOT
parent ../CLAUDE.md modules 상위
hub ../../core/hub.hexa _registry + 키워드 라우팅
laws ../../config/consciousness_laws.json 2390 법칙 + Psi 상수
laws ../../config/consciousness_laws.json 2507 법칙 + Psi 상수
verify ../../core/verification/byte_emergence.hexa L0 바이트 창발 검증

exec:
Expand Down
Loading