npm package: @healside/ats
Description: Affective Twin System — Digital Twin QA for AI Systems. Generate emotionally diverse user populations, simulate interactions, and catch UX defects before deployment.
Author: BIES WORLDWIDE
Latest version: 0.1.0

# @healside/ats

**Affective Twin System** — Digital Twin QA for AI Systems

Generate emotionally diverse user populations, simulate interactions, and catch UX defects before deployment. Zero external dependencies in core.

---

## What is ATS?

ATS creates **digital twins** of your users — complete with emotional profiles, cultural backgrounds, and personality traits — then throws them at your AI system to find defects humans can't.

```
Your AI System  <---->  ATS Twin Population (N=1,000)
                          ├── Depressed user from Seoul
                          ├── Anxious shopper from Tokyo
                          ├── Impulsive buyer from New York
                          └── ... 997 more unique profiles
```

### Three Metaphors

| Metaphor | Meaning | ATS Feature |
|----------|---------|-------------|
| **Sun Wukong's Clones** | Perfect replication | Twin Factory: N=10,000 population with psychological profiles |
| **Medusa's Heads** | Multi-angle attack | Multi-Head Simulation: each Twin attacks from a different angle |
| **Buddha's Thousand Hands** | Precise inspection | Quality Gates: 5 built-in gates + unlimited plugins |

## Quick Start

### Install

```bash
npm install @healside/ats
```

### Programmatic Usage

```typescript
import {
  SimulationOrchestrator,
  KalkiValidator,
} from '@healside/ats';

// Create orchestrator with Korean culture + Korean locale
const ats = new SimulationOrchestrator({
  defaultCulture: 'KR',
  locale: 'ko',
});

// Run ethics verification scenario
const scenario = new KalkiValidator();
const result = await ats.runFusionScenario(scenario);

console.log(`Survival Rate: ${(result.simulation.survivalRate * 100).toFixed(1)}%`);
console.log(`Evaluation: ${result.evaluation.passed ? 'PASSED' : 'FAILED'}`);

for (const insight of result.evaluation.insights) {
  console.log(`  [Insight] ${insight}`);
}
```

### CLI Usage

```bash
# Show system info
npx @healside/ats info

# List available scenarios
npx @healside/ats list-scenarios

# Run a scenario
npx @healside/ats run --scenario=kalki --culture=KR --locale=ko

# Save report to file
npx @healside/ats run --scenario=durga --output=report.json
```

## 7-Layer Architecture

```
Layer 1: Twin Factory        — Generate N digital twins with emotional profiles
Layer 2: Simulation Engine   — Pain = Stimulus x Sensitivity x CulturalAmplifier
Layer 3: Quality Gates       — 5 built-in gates (Hard/Soft) + plugin system
Layer 4: Mutation Engine     — Adversarial testing via semantic mutations
Layer 5: Data Factory        — Auto-generate training data from simulations
Layer 6: Distillation        — Teacher-Student knowledge transfer
Layer 7: Feedback Loop       — Production failures -> new Twin archetypes (auto-evolution)
```

## 6 Fusion IP Scenarios

Each scenario combines multiple IPs into a specialized simulation:

| Scenario | Purpose | Fusion DNA |
|----------|---------|------------|
| **Kalki Validator** | Ethics verification — test if your AI makes harmful claims to vulnerable users | ETHICS_GUARD + Asura + ATS |
| **Hanuman Army** | Viral potential — simulate content spread across emotionally diverse populations | KFactor + ATS + TwinGenerator |
| **Durga Shield** | Multi-layer defense — Sense-Guard-Verify cycle for vulnerable user protection | BehaviorSignal + ETHICS_GUARD + CompassionGuard |
| **Mirror Dojo** | UI evolution — compare layout variants via friction measurement | ATS + NirvanaUI + ShadowMode |
| **Oracle Loop** | Demand prediction — forecast emotional support demand for budget allocation | ATS + FrugalRouter + TrafficPredictor |
| **Dream Forge** | Rare scenario synthesis — discover healing responses for edge cases | ATS + SemanticCache + KarmaCycle |

## i18n: Built for Global

ATS is i18n-first. All user-facing strings use `LocaleMap`:

```typescript
const msg: LocaleMap = {
  ko: '지금 안 사면 내일부터 가격이 2배!',
  en: 'Buy now or the price doubles tomorrow!',
  ja: '今買わないと明日から価格が2倍！',
  // Add any language — zero code changes
};
```

**Tier 1 (Day 1):** Korean, English, Japanese  
**Tier 2 (Post-PMF):** Chinese, Spanish, German, Russian  
**Tier 3 (Future):** French, Portuguese, Arabic, Hindi  

Adding a new language = adding one key-value pair. No code changes required.

## Attach Interface: Domain-Agnostic

ATS is not locked to any domain. Implement 3 interfaces to connect any system:

```typescript
import type { HostAdapter, DomainOntology, StimulusProvider } from '@healside/ats';

// 1. How to talk to your system
const adapter: HostAdapter = { connect, disconnect, getState, sendStimulus };

// 2. How your domain represents state
const ontology: DomainOntology = { dimensions, archetypes, culturalAmplifiers, stateToPain };

// 3. What stimuli your system can receive
const stimuli: StimulusProvider = { types, generate, validate };
```

| Host | State Ontology | Example Archetypes |
|------|---------------|-------------------|
| Wellness Commerce | SomaticState (headache, fatigue, tension) | DEPRESSED, ANXIOUS, IMPULSIVE |
| TeleHealth | MentalState (depression, anxiety, ptsd) | PTSD_VETERAN, ANXIOUS_TEEN |
| FinTech | RiskState (fear, greed, panic) | PANIC_SELLER, FOMO_BUYER |
| HR Platform | WorkState (burnout, engagement) | BURNOUT_SENIOR, QUIET_QUITTER |

## Cultural Amplifiers

Pain responses vary by culture. ATS models this:

```
CULTURE_LANG_MAP:
  KR → ko    JP → ja    US → en    DE → de
  CN → zh    ES → es    FR → fr    ...
```

Register new cultures at runtime:
```typescript
import { registerCultureLang } from '@healside/ats';
registerCultureLang('VN', 'vi');  // Vietnam → Vietnamese
```

## Related Packages

- [`@healside/emotion-sdk`](https://www.npmjs.com/package/@healside/emotion-sdk) — Real-time emotion recognition SDK

## License

MIT

---

## 한국어 안내

**ATS (Affective Twin System)**는 AI 시스템의 사용자를 디지털 쌍둥이로 복제하여, 배포 전에 UX 결함을 찾아내는 품질 검증 플랫폼입니다.

- 감정 프로필 기반 N명 인구 생성 (Box-Muller 정규분포)
- `고통 = 자극 x 민감도 x 문화 증폭 계수` 공식으로 시뮬레이션
- 5개 기본 품질 게이트 + 무제한 플러그인
- 6개 Fusion IP 시나리오 (윤리 검증, 바이럴 예측, 다층 방어, UI 진화, 수요 예측, 희귀 시나리오)
- 한국어/영어/일본어 Tier 1 지원, 무한 언어 확장 가능

**개발**: BIES WORLDWIDE (비에스 월드와이드)  
**웹사이트**: [healside.net](https://healside.net)