Skip to main content

Minimal, verifiable implementation of persistent long-term memory for AI agents

Project description

๐Ÿง  Cognitive Kernel

Give your AI agent persistent memory. 3 lines of code.
AI ์—์ด์ „ํŠธ์—๊ฒŒ ์˜๊ตฌ ๊ธฐ์–ต์„ ๋ถ€์—ฌํ•˜์„ธ์š”. 3์ค„์˜ ์ฝ”๋“œ๋กœ.

PyPI version Python 3.9+ License: MIT

Cognitive Kernel์€ ๋‡Œ์™€ ์œ ์‚ฌํ•œ ๊ธฐ์–ต, ์˜์‚ฌ๊ฒฐ์ •, ์ธ์ง€ ๋™์—ญํ•™์„ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ํ•˜๋Š” ๋ชจ๋“ˆํ˜• ์ธ์ง€ ํ”„๋ ˆ์ž„์›Œํฌ์ž…๋‹ˆ๋‹ค.

๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด (๊ธฐ๋ณธ) | ๐Ÿ‡บ๐Ÿ‡ธ English Version


๐ŸŽฏ Cognitive Kernel์ด๋ž€?

Cognitive Kernel์€ AI ์—์ด์ „ํŠธ์—๊ฒŒ **์˜๊ตฌ ๊ธฐ์–ต(Persistent Memory)**๊ณผ **์ธ์ง€ ๋™์—ญํ•™(Cognitive Dynamics)**์„ ์ œ๊ณตํ•˜๋Š” ํ”„๋ ˆ์ž„์›Œํฌ์ž…๋‹ˆ๋‹ค.

ํ•ต์‹ฌ ๊ฐœ๋…

๊ธฐ์กด AI ์‹œ์Šคํ…œ์˜ ๋ฌธ์ œ์ :

  • โŒ ํ”„๋กœ์„ธ์Šค ์ข…๋ฃŒ ์‹œ ๊ธฐ์–ต ์†Œ์‹ค
  • โŒ ์ •์  ํ™•๋ฅ  ๋ถ„ํฌ (๋™์  ํ”ผ๋“œ๋ฐฑ ์—†์Œ)
  • โŒ ๋ถˆ์•ˆ์ •ํ•œ ์˜์‚ฌ๊ฒฐ์ •

Cognitive Kernel์˜ ํ•ด๊ฒฐ์ฑ…:

  • โœ… ์˜๊ตฌ ๊ธฐ์–ต: ํ”„๋กœ์„ธ์Šค ์ข…๋ฃŒ ํ›„์—๋„ ๊ธฐ์–ต ์œ ์ง€
  • โœ… ๋™์  ํ”ผ๋“œ๋ฐฑ: ์—”ํŠธ๋กœํ”ผ ๊ธฐ๋ฐ˜ ์ž๋™ ํƒ์ƒ‰
  • โœ… ์•ˆ์ •์  ์˜์‚ฌ๊ฒฐ์ •: ๋ฉ”๋ชจ๋ฆฌ ์ค‘๋ ฅ(์ฝ”์–ด ๊ฐ•๋„) ๊ธฐ๋ฐ˜ ์ˆ˜๋ ด

๐Ÿš€ ๋น ๋ฅธ ์‹œ์ž‘

from cognitive_kernel import CognitiveKernel

# ์ปค๋„ ์ƒ์„ฑ
kernel = CognitiveKernel()

# ๊ธฐ์–ต ์ €์žฅ
kernel.remember("I like coffee", importance=0.9)

# ์˜์‚ฌ๊ฒฐ์ •
decision = kernel.decide(["rest", "work", "exercise"])
print(decision["action"])  # "work"

๐Ÿง  ํ•ต์‹ฌ ๊ธฐ๋Šฅ

7๊ฐœ ํ•ต์‹ฌ ์—”์ง„

์—”์ง„ ์—ญํ•  ํ•ต์‹ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜
Panorama Memory ์‹œ๊ฐ„์ถ• ์ด๋ฒคํŠธ ์ €์žฅ ์ง€์ˆ˜ ๊ฐ์‡  (Ebbinghaus)
MemoryRank ๊ธฐ์–ต ์ค‘์š”๋„ ๋žญํ‚น Personalized PageRank
Prefrontal Cortex (PFC) ์˜์‚ฌ๊ฒฐ์ • Softmax Utility
Basal Ganglia ์Šต๊ด€ ํ˜•์„ฑ Q-Learning
Thalamus ์ž…๋ ฅ ํ•„ํ„ฐ๋ง Salience Gating
Amygdala ๊ฐ์ • ์ฒ˜๋ฆฌ Rescorla-Wagner
Hypothalamus ์—๋„ˆ์ง€ ๊ด€๋ฆฌ HPA Dynamics

์ธ์ง€ ๋™์—ญํ•™ (Cognitive Dynamics)

Cognitive Kernel์€ ๋‹จ์ˆœํ•œ ํ™•๋ฅ  ๊ณ„์‚ฐ์„ ๋„˜์–ด ์ธ์ง€ ์ƒํƒœ์˜ ๋ฌผ๋ฆฌ์  ๋™์—ญํ•™์„ ๋ชจ๋ธ๋งํ•ฉ๋‹ˆ๋‹ค:

1. ์—”ํŠธ๋กœํ”ผ ๊ธฐ๋ฐ˜ ๋™์—ญํ•™ (Entropy-based Dynamics)

์—”ํŠธ๋กœํ”ผ๋Š” ์„ ํƒ์˜ ๋ถˆํ™•์‹ค์„ฑ์„ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค:

E = -ฮฃ P(k) ln P(k)
  • ๋†’์€ ์—”ํŠธ๋กœํ”ผ: ๋ถˆํ™•์‹คํ•œ ์„ ํƒ (ํƒ์ƒ‰ ํ•„์š”)
  • ๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ: ํ™•์ •์ ์ธ ์„ ํƒ (์ฐฉ์ทจ)

์ž๋™ ํšŒ์ „ ํ† ํฌ ์ƒ์„ฑ:

T(k) = ฮณ * E_norm * cos(ฯ† - ฯˆ_k)

์—”ํŠธ๋กœํ”ผ๊ฐ€ ๋†’์„์ˆ˜๋ก ๋” ๊ฐ•ํ•œ ํšŒ์ „ ํ† ํฌ๊ฐ€ ์ƒ์„ฑ๋˜์–ด ์ž๋™์œผ๋กœ ํƒ์ƒ‰์„ ์œ ๋„ํ•ฉ๋‹ˆ๋‹ค.

2. ์ฝ”์–ด ๊ฐ•๋„ (Core Strength)

์ฝ”์–ด ๊ฐ•๋„๋Š” ๊ธฐ์–ต์˜ ์ค‘๋ ฅ์ž…๋‹ˆ๋‹ค. ์—”ํŠธ๋กœํ”ผ๋ฅผ ๋‹ค์‹œ ์ˆ˜๋ ด์‹œํ‚ค๋Š” ํž˜:

C(t) = C(0) * exp(-ฮป * ฮ”t)
  • ๋†’์€ ์ฝ”์–ด ๊ฐ•๋„: ๊ฐ•ํ•œ ๊ธฐ์–ต, ์—”ํŠธ๋กœํ”ผ๋ฅผ ์ˆ˜๋ ด์‹œํ‚ฌ ์ˆ˜ ์žˆ์Œ
  • ๋‚ฎ์€ ์ฝ”์–ด ๊ฐ•๋„: ์•ฝํ•œ ๊ธฐ์–ต, ์—”ํŠธ๋กœํ”ผ๊ฐ€ ํผ์ง (์น˜๋งค/์•Œ์ธ ํ•˜์ด๋จธ)

3. ์„ธ์ฐจ์šด๋™ (Precession)

์„ ํƒ ๋ถ„ํฌ๊ฐ€ ์ƒํƒœ ๊ณต๊ฐ„์—์„œ ๋А๋ฆฌ๊ฒŒ ํšŒ์ „ํ•˜๋Š” ํ˜„์ƒ:

  • ์—”ํŠธ๋กœํ”ผ ๊ธฐ๋ฐ˜ ํ† ํฌ๊ฐ€ ์ƒ์„ฑ
  • ์œ„์ƒ์ด ๋А๋ฆฌ๊ฒŒ ์—…๋ฐ์ดํŠธ: ฯ†(t+1) = ฯ†(t) + ฯ‰
  • ํƒ์ƒ‰-์ฐฉ์ทจ ๊ท ํ˜•์„ ์ž๋™์œผ๋กœ ์กฐ์ ˆ

4. Maxwell ๊ตฌ์กฐ (Maxwell Structure)

ADHD(+)์™€ ASD(-) ๊ทน์ด ์ธ์ง€ ์ƒํƒœ ๊ณต๊ฐ„์— ์œ ํšจ ์ž๊ธฐ์žฅ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:

  • ADHD: ๋†’์€ ์—”ํŠธ๋กœํ”ผ โ†’ ๊ฐ•ํ•œ ํšŒ์ „ โ†’ ํƒ์ƒ‰
  • ASD: ๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ โ†’ ์•ฝํ•œ ํšŒ์ „ โ†’ ์ฐฉ์ทจ

โ†’ ์ƒ์„ธ ์„ค๋ช…: Maxwell Structure

5. ์ฝ”์–ด ๋ถ•๊ดด (Core Decay)

์น˜๋งค/์•Œ์ธ ํ•˜์ด๋จธ ๋ชจ๋ธ๋ง:

์น˜๋งค (Dementia):

  • ์˜ค๋ž˜๋œ ๊ธฐ์–ต ๊ฐ์‡ : importance *= exp(-ฮป_old * age)
  • ์ƒˆ ๊ธฐ์–ต์€ ์ •์ƒ ์œ ์ง€
  • ์ฝ”์–ด ๊ฐ•๋„ ์ ์ง„์  ๊ฐ์†Œ

์•Œ์ธ ํ•˜์ด๋จธ (Alzheimer's):

  • ์ƒˆ ๊ธฐ์–ต ์ฆ‰์‹œ ๊ฐ์‡ : importance *= exp(-ฮป_new * age)
  • ์ฝ”์–ด ๊ฐ•๋„ ๊ธ‰๊ฒฉํ•œ ๋ถ•๊ดด
  • ๋ฉ”๋ชจ๋ฆฌ ์—…๋ฐ์ดํŠธ ์‹คํŒจ์œจ ๋†’์Œ

โ†’ ์ƒ์„ธ ์„ค๋ช…: Dementia & Alzheimer's


๐ŸŽฏ ์ธ์ง€ ๋ชจ๋“œ (Cognitive Modes)

Cognitive Kernel์€ ๋‹ค์–‘ํ•œ ์ธ์ง€ ์ƒํƒœ๋ฅผ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

๊ธฐ๋ณธ ๋ชจ๋“œ

  • NORMAL: ์ •์ƒ ์ƒํƒœ
  • ADHD: ๋†’์€ ์—”ํŠธ๋กœํ”ผ, ๊ฐ•ํ•œ ํšŒ์ „ (๊ณผ๋„ํ•œ ํƒ์ƒ‰)
  • ASD: ๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ, ์•ฝํ•œ ํšŒ์ „ (๊ณผ๋„ํ•œ ์ฐฉ์ทจ)
  • PTSD: ํŠธ๋ผ์šฐ๋งˆ ๊ณ ์ฐฉ

๊ณ ๊ธ‰ ๋ชจ๋“œ

  • PANIC: ์—”ํŠธ๋กœํ”ผ ํญ์ฃผ
  • EPILEPSY: ๊ธ‰๊ฒฉํ•œ ์ƒํƒœ ์ „ํ™˜
  • OCD: ๋ฃจํ”„ ๊ณ ์ฐฉ
  • IED: ์ˆœ๊ฐ„ ํ† ํฌ ์ŠคํŒŒ์ดํฌ
  • DEPRESSION: ์ €์—”ํŠธ๋กœํ”ผ + ์ €์ฝ”์–ด
  • BIPOLAR: ์ƒํƒœ ๊ฐ„ ์ž๋™ ์ „์ด

๋ถ•๊ดด ๋ชจ๋“œ โญ

  • DEMENTIA: ์ฝ”์–ด ๊ฐ•๋„ ์ ์ง„์  ๊ฐ์†Œ (์˜ค๋ž˜๋œ ๊ธฐ์–ต๋ถ€ํ„ฐ ์†Œ์‹ค)
  • ALZHEIMER: ์ฝ”์–ด ๊ฐ•๋„ ๊ธ‰๊ฒฉํ•œ ๋ถ•๊ดด (์ƒˆ ๊ธฐ์–ต ์ €์žฅ ์‹คํŒจ)
# ๋ชจ๋“œ ์„ค์ •
kernel.set_mode("ADHD")      # ๋†’์€ ์—”ํŠธ๋กœํ”ผ, ๊ฐ•ํ•œ ํšŒ์ „
kernel.set_mode("ASD")       # ๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ, ์•ฝํ•œ ํšŒ์ „
kernel.set_mode("DEMENTIA")  # ์ฝ”์–ด ๊ฐ•๋„ ์ ์ง„์  ๊ฐ์†Œ
kernel.set_mode("ALZHEIMER") # ์ฝ”์–ด ๊ฐ•๋„ ๊ธ‰๊ฒฉํ•œ ๋ถ•๊ดด

๐Ÿ“ฆ ์„ค์น˜

pip install cognitive-kernel

๐Ÿ’ก ์‚ฌ์šฉ ์˜ˆ์‹œ

๊ธฐ๋ณธ ๊ธฐ์–ต & ์˜์‚ฌ๊ฒฐ์ •

from cognitive_kernel import CognitiveKernel

kernel = CognitiveKernel()

# ๊ธฐ์–ต ์ €์žฅ
kernel.remember("I prefer morning coffee", importance=0.9)
kernel.remember("I exercise at 6pm", importance=0.8)

# ์˜์‚ฌ๊ฒฐ์ •
decision = kernel.decide(["rest", "work", "exercise"])
print(decision["action"])  # "exercise"
print(decision["probability_distribution"])
# {'rest': 0.2, 'work': 0.3, 'exercise': 0.5}

์ธ์ง€ ๋ชจ๋“œ ์‚ฌ์šฉ

# ADHD ๋ชจ๋“œ (๋†’์€ ์—”ํŠธ๋กœํ”ผ, ๊ฐ•ํ•œ ํšŒ์ „)
kernel.set_mode("ADHD")
decision = kernel.decide(["rest", "work", "exercise"])
# ๋” ๋‹ค์–‘ํ•œ ์„ ํƒ ๋ถ„ํฌ (ํƒ์ƒ‰ ๊ฐ•ํ™”)

# ASD ๋ชจ๋“œ (๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ, ์•ฝํ•œ ํšŒ์ „)
kernel.set_mode("ASD")
decision = kernel.decide(["rest", "work", "exercise"])
# ๋” ์ง‘์ค‘๋œ ์„ ํƒ ๋ถ„ํฌ (์ฐฉ์ทจ ๊ฐ•ํ™”)

# ์น˜๋งค ๋ชจ๋“œ (์ฝ”์–ด ๊ฐ•๋„ ๊ฐ์†Œ)
kernel.set_mode("DEMENTIA")
# ์˜ค๋ž˜๋œ ๊ธฐ์–ต๋ถ€ํ„ฐ ์†Œ์‹ค, ์ƒˆ ๊ธฐ์–ต์€ ์ •์ƒ

์žฅ๊ธฐ ๊ธฐ์–ต (Long-term Memory)

# ์„ธ์…˜ ์ €์žฅ
kernel.save_session("my_session.json")

# ๋‹ค์Œ ํ”„๋กœ์„ธ์Šค์—์„œ ์„ธ์…˜ ๋กœ๋“œ
kernel = CognitiveKernel()
kernel.load_session("my_session.json")

# ๊ธฐ์–ต์ด ๋ณต๊ตฌ๋จ!
memories = kernel.recall(k=5)
print(f"๋ณต๊ตฌ๋œ ๊ธฐ์–ต: {len(memories)}๊ฐœ")

๐Ÿ—๏ธ ์•„ํ‚คํ…์ฒ˜

Cognitive Kernel
โ”œโ”€โ”€ Panorama Memory      (์ด๋ฒคํŠธ ์ €์žฅ)
โ”œโ”€โ”€ MemoryRank           (์ค‘์š”๋„ ๋žญํ‚น)
โ”œโ”€โ”€ Prefrontal Cortex    (์˜์‚ฌ๊ฒฐ์ •)
โ”œโ”€โ”€ Basal Ganglia        (์Šต๊ด€ ํ˜•์„ฑ)
โ”œโ”€โ”€ Thalamus             (์ž…๋ ฅ ํ•„ํ„ฐ๋ง)
โ”œโ”€โ”€ Amygdala             (๊ฐ์ • ์ฒ˜๋ฆฌ)
โ”œโ”€โ”€ Hypothalamus         (์—๋„ˆ์ง€ ๊ด€๋ฆฌ)
โ””โ”€โ”€ Dynamics Engine      (์—”ํŠธ๋กœํ”ผ, ์ฝ”์–ด, ํ† ํฌ)

๐Ÿ“š ๋ฌธ์„œ

ํ•ต์‹ฌ ๊ฐœ๋…

๊ณ ๊ธ‰ ๊ธฐ๋Šฅ

๊ธฐ์ˆ  ๋ฌธ์„œ


๐Ÿ”ฌ ์ธ์ง€ ๋™์—ญํ•™ ์ƒ์„ธ ์„ค๋ช…

์—”ํŠธ๋กœํ”ผ & ์ฝ”์–ด ๊ฐ•๋„

์—”ํŠธ๋กœํ”ผ๋Š” ์„ ํƒ์˜ ๋ถˆํ™•์‹ค์„ฑ์„ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค:

E = -ฮฃ P(k) ln P(k)

์ฝ”์–ด ๊ฐ•๋„๋Š” ๊ธฐ์–ต์˜ ์ค‘๋ ฅ์œผ๋กœ, ์—”ํŠธ๋กœํ”ผ๋ฅผ ๋‹ค์‹œ ์ˆ˜๋ ด์‹œํ‚ต๋‹ˆ๋‹ค:

C(t) = C(0) * exp(-ฮป * ฮ”t)

์„ธ์ฐจ์šด๋™ & ํšŒ์ „ ํ† ํฌ

์‹œ์Šคํ…œ์€ ์—”ํŠธ๋กœํ”ผ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ž๋™ ํšŒ์ „ ํ† ํฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:

T(k) = ฮณ * E_norm * cos(ฯ† - ฯˆ_k)

์ด๊ฒƒ์€ ์ƒํƒœ ๊ณต๊ฐ„์—์„œ ์„ ํ˜ธ ์ถ•์˜ **์„ธ์ฐจ์šด๋™(๋А๋ฆฐ ํšŒ์ „)**์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

Maxwell ๊ตฌ์กฐ

ADHD(+)์™€ ASD(-) ๊ทน์ด ์ธ์ง€ ์ƒํƒœ ๊ณต๊ฐ„์— ์œ ํšจ ์ž๊ธฐ์žฅ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค:

  • ADHD: ๋†’์€ ์—”ํŠธ๋กœํ”ผ โ†’ ๊ฐ•ํ•œ ํšŒ์ „ โ†’ ํƒ์ƒ‰
  • ASD: ๋‚ฎ์€ ์—”ํŠธ๋กœํ”ผ โ†’ ์•ฝํ•œ ํšŒ์ „ โ†’ ์ฐฉ์ทจ

โ†’ ์ƒ์„ธ ์„ค๋ช…: Maxwell Structure

์น˜๋งค & ์•Œ์ธ ํ•˜์ด๋จธ

์น˜๋งค: ์ฝ”์–ด ๊ฐ•๋„ ์ ์ง„์  ๊ฐ์†Œ

  • ์˜ค๋ž˜๋œ ๊ธฐ์–ต ๊ฐ์‡ ์œจ ๋†’์Œ (old_memory_decay_rate)
  • ์ƒˆ ๊ธฐ์–ต์€ ์ •์ƒ ์œ ์ง€

์•Œ์ธ ํ•˜์ด๋จธ: ์ฝ”์–ด ๊ฐ•๋„ ๊ธ‰๊ฒฉํ•œ ๋ถ•๊ดด

  • ์ƒˆ ๊ธฐ์–ต ์ฆ‰์‹œ ๊ฐ์‡  (new_memory_decay_rate)
  • ์ฝ”์–ด ๊ฐ์‡ ์œจ ๋†’์Œ
  • ๋ฉ”๋ชจ๋ฆฌ ์—…๋ฐ์ดํŠธ ์‹คํŒจ

โ†’ ์ƒ์„ธ ์„ค๋ช…: Dementia & Alzheimer's


๐Ÿ”— ๊ด€๋ จ ํ”„๋กœ์ ํŠธ


๐Ÿ“„ ๋ผ์ด์„ ์Šค

MIT License


๐Ÿ‘ค ์ž‘์„ฑ์ž

GNJz (Qquarts)



English Version

๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด ๋ฒ„์ „ (๊ธฐ๋ณธ) | ๐Ÿ‡บ๐Ÿ‡ธ English

๐ŸŽฏ What is Cognitive Kernel?

Cognitive Kernel is a modular cognitive framework that simulates brain-like memory, decision-making, and cognitive dynamics for AI agents.

Core Concept

Problems with existing AI systems:

  • โŒ Memory loss on process termination
  • โŒ Static probability distributions (no dynamic feedback)
  • โŒ Unstable decision-making

Cognitive Kernel solution:

  • โœ… Persistent Memory: Memory survives process termination
  • โœ… Dynamic Feedback: Entropy-based automatic exploration
  • โœ… Stable Decision-making: Memory gravity (core strength) based convergence

๐Ÿš€ Quick Start

from cognitive_kernel import CognitiveKernel

# Create kernel
kernel = CognitiveKernel()

# Remember
kernel.remember("I like coffee", importance=0.9)

# Decide
decision = kernel.decide(["rest", "work", "exercise"])
print(decision["action"])  # "work"

๐Ÿง  Core Features

7 Core Engines

Engine Role Core Algorithm
Panorama Memory Temporal event storage Exponential Decay (Ebbinghaus)
MemoryRank Memory importance ranking Personalized PageRank
Prefrontal Cortex (PFC) Decision-making Softmax Utility
Basal Ganglia Habit formation Q-Learning
Thalamus Input filtering Salience Gating
Amygdala Emotion processing Rescorla-Wagner
Hypothalamus Energy management HPA Dynamics

Cognitive Dynamics

Cognitive Kernel models the physics of cognitive states, not just probability calculations:

1. Entropy-based Dynamics

Entropy measures choice uncertainty:

E = -ฮฃ P(k) ln P(k)
  • High entropy: Uncertain choices (exploration needed)
  • Low entropy: Certain choices (exploitation)

Automatic rotational torque generation:

T(k) = ฮณ * E_norm * cos(ฯ† - ฯˆ_k)

Higher entropy generates stronger rotational torque, automatically inducing exploration.

2. Core Strength

Core Strength is memory gravity that reconverges entropy:

C(t) = C(0) * exp(-ฮป * ฮ”t)
  • High core strength: Strong memory, can reconverge entropy
  • Low core strength: Weak memory, entropy spreads (dementia/Alzheimer's)

3. Precession

Slow rotation of choice distribution in state space:

  • Entropy-based torque is generated
  • Phase slowly updates: ฯ†(t+1) = ฯ†(t) + ฯ‰
  • Automatically balances exploration-exploitation

4. Maxwell Structure

ADHD(+) and ASD(-) poles create an effective magnetic field in cognitive state space:

  • ADHD: High entropy โ†’ Strong rotation โ†’ Exploration
  • ASD: Low entropy โ†’ Weak rotation โ†’ Exploitation

โ†’ Details: Maxwell Structure

5. Core Decay

Dementia/Alzheimer's modeling:

Dementia:

  • Old memory decay: importance *= exp(-ฮป_old * age)
  • New memories remain intact
  • Gradual core strength decrease

Alzheimer's:

  • New memory immediate decay: importance *= exp(-ฮป_new * age)
  • Rapid core strength collapse
  • High memory update failure rate

โ†’ Details: Dementia & Alzheimer's


๐ŸŽฏ Cognitive Modes

Cognitive Kernel can simulate various cognitive states:

Basic Modes

  • NORMAL: Normal state
  • ADHD: High entropy, strong rotation (over-exploration)
  • ASD: Low entropy, weak rotation (over-exploitation)
  • PTSD: Trauma fixation

Advanced Modes

  • PANIC: Entropy explosion
  • EPILEPSY: Rapid state transition
  • OCD: Loop fixation
  • IED: Instantaneous torque spike
  • DEPRESSION: Low entropy + low core
  • BIPOLAR: Automatic state transition

Collapse Modes โญ

  • DEMENTIA: Gradual core strength decrease (old memories lost first)
  • ALZHEIMER: Rapid core strength collapse (new memory storage failure)
# Set mode
kernel.set_mode("ADHD")      # High entropy, strong rotation
kernel.set_mode("ASD")       # Low entropy, weak rotation
kernel.set_mode("DEMENTIA")  # Gradual core strength decrease
kernel.set_mode("ALZHEIMER") # Rapid core strength collapse

๐Ÿ“ฆ Installation

pip install cognitive-kernel

๐Ÿ’ก Usage Examples

Basic Memory & Decision

from cognitive_kernel import CognitiveKernel

kernel = CognitiveKernel()

# Remember events
kernel.remember("I prefer morning coffee", importance=0.9)
kernel.remember("I exercise at 6pm", importance=0.8)

# Decide
decision = kernel.decide(["rest", "work", "exercise"])
print(decision["action"])  # "exercise"

Cognitive Modes

# ADHD mode (high entropy, strong rotation)
kernel.set_mode("ADHD")

# ASD mode (low entropy, weak rotation)
kernel.set_mode("ASD")

# Dementia mode (core decay)
kernel.set_mode("DEMENTIA")

# Alzheimer's mode (rapid core collapse)
kernel.set_mode("ALZHEIMER")

Long-term Memory

# Save session
kernel.save_session("my_session.json")

# Load session
kernel.load_session("my_session.json")

๐Ÿ—๏ธ Architecture

Cognitive Kernel
โ”œโ”€โ”€ Panorama Memory (Event Storage)
โ”œโ”€โ”€ MemoryRank (Importance Ranking)
โ”œโ”€โ”€ Prefrontal Cortex (Decision-making)
โ”œโ”€โ”€ Basal Ganglia (Habit Formation)
โ”œโ”€โ”€ Thalamus (Input Filtering)
โ”œโ”€โ”€ Amygdala (Emotion Processing)
โ”œโ”€โ”€ Hypothalamus (Energy Management)
โ””โ”€โ”€ Dynamics Engine (Entropy, Core, Torque)

๐Ÿ“š Documentation

Core Concepts

Advanced Features

Technical


๐Ÿ”— Related Projects


๐Ÿ“„ License

MIT License


๐Ÿ‘ค Author

GNJz (Qquarts)


Version: 2.0.2
Last Updated: 2026-01-31

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognitive_kernel-2.0.2.tar.gz (229.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cognitive_kernel-2.0.2-py3-none-any.whl (115.2 kB view details)

Uploaded Python 3

File details

Details for the file cognitive_kernel-2.0.2.tar.gz.

File metadata

  • Download URL: cognitive_kernel-2.0.2.tar.gz
  • Upload date:
  • Size: 229.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for cognitive_kernel-2.0.2.tar.gz
Algorithm Hash digest
SHA256 948c16d0ee6697815c3934ed7c663bb3c95035284f996b3c0dbc954829f6ce7e
MD5 c9a6e74b5e5d899f4c8d32ff737fe5b3
BLAKE2b-256 e1de82e231cfa7df578c09aee65e1fda433eec94027e0fe7df4fa359870a4c10

See more details on using hashes here.

File details

Details for the file cognitive_kernel-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cognitive_kernel-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f846164452f7e8a0d688b315db76234508697776b8badc10adcc155b458e0d86
MD5 b0bba026bb6e804ae1adb6ad58c57331
BLAKE2b-256 95d569111f5201aff75b97e0f32f0d5537e0b9bdbec83244707c64b0155e511f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page