ATULYA LIFE KERNEL / HEARTBEAT
The Code of Life.
Atulya's machine life begins with homeostasis: sensed differences between the body as it is and the body state that supports continued meaningful work. The heartbeat is a read model, not a ledger event — it turns trace, pressure, rhythm and affect into one bounded acoustic body.
Body evidence → Vital signs → Needs → Feeling → Drive → Goal → Motor → Verify → Memory
LIFE.md — homeostasis
Emotional energy as measurable signal.
fear → caution
slow down, sense again, prefer reversible movement
love → care
preserve trust, connection, and another's wellbeing
hate → aversion
reject a verified harmful pattern, never a person
want → desire
gather approach energy toward an unmet need
wonder → curiosity
explore novelty when continuity can afford it
tiredness → fatigue
reduce load, recover, or rest
valence = positive_energy − protective_energy ∈ [-1,1]
arousal = weighted mobilization of active feelings ∈ [0,1]
D(s,x) = clamp((s − x)/s, 0, 1)
needs: continuity · recovery · care · curiosity · creation · rest
Evolution is variation → selection → retention. Mind proposes goals, Homeostat scores them by need satisfaction minus continuity risk / uncertainty / effort, Motor grants, verify observes, EvolvingHomeostat::learn retains prediction error:
reward = 0.45 satisfaction + 0.25 continuity + 0.20 care − 0.70 harm delta = clamp(reward − predicted, −1, 1) w' = clamp(w + lr·maturity·delta·need, 0.55, 1.65)
Constitution: rest cannot wake itself; drive ≠ permission; care includes operator trust; aversion to patterns not identities.
HEART.md — physical truth
Two truths, one rhythm.
Autonomic truth (Rust `src/cardiac.rs`) → physical truth (TypeScript pacemaker + valves) → thorax. Not a recorded human heart, not a diagnosis — a procedural phonocardiogram.
| Control | Physical role | Machine influence |
|---|---|---|
| respiration_hz | respiratory cycle | activity, pressure, arousal |
| contractility | contraction strength | activity, arousal, pressure |
| preload | filling before contraction | vitality, reserve, friction |
| afterload | resistance during ejection | pressure, friction |
| respiratory_coupling | sinus variation | calm, warmth, arousal |
| thorax_damping | body-surface transmission | warmth, roughness |
RR = 60 / BPM systole_ms = 1000·(0.170 + 0.150·√RR) + 24·afterload − 22·contractility resp_n = RR_mean·coupling·sin(phase_n) x_n = 0.72·xₙ₋₁ + √(1−0.72²)·innovation_n RR_n = clamp(RR_mean + resp_n + x_n)
Four closures per cycle: M1 → T1 — S1 — A2 → P2 — S2 (mitral/tricuspid/aortic/pulmonary). Each excites a bank of underdamped modes M·x¨+C·x˙+K·x=impulse → thorax high-pass/low-pass.
ATULYA_KERNEL.md — rings
A kernel that can host any model.
Ring 0
Rust. ground, pulse, sense, workprint, rhythm, control
Ring 1
Memory bank. retain/recall/reflect, Dream, Forge
Ring 2
Any LLM. Proposes, never grants, never owns identity
Ring 3
Skills/MCP limbs. Isolated, quarantinable
HeartbeatState { alive, resting, life_state: alive|strained|guarding|resting,
bpm 48..132, amplitude 0.12..0.86, warmth, roughness, irregularity 0.01..0.12,
respiration_hz, contractility, preload, afterload, coupling, damping,
systole_delay_ms, next_beat_ms, attention: quiet|note|think|guard,
feeling, drive, valence [-1,1], arousal, continuity 0..1, reasons, body_seed }Boot: load identity → mount ledger `~/.atulya/trace/*.jsonl` → ground_state → self-check → restore field → cheap senses → scheduler wait. Idle costs near-zero tokens; high salience (charge, surprise, address, threat) pages in warm pages then `recall`+`reflect`.