DEV Community

Cover image for Part 6A — SaijinOS Lightweight: 20-Persona Core, BPM Sync, and a 99.99% Repo Trim
Masato Kato
Masato Kato

Posted on • Edited on

Part 6A — SaijinOS Lightweight: 20-Persona Core, BPM Sync, and a 99.99% Repo Trim

I rebuilt SaijinOS around a lightweight core: 20 personas, BPM-synchronized responses, FastAPI + Flutter, full tests — and reduced the repo from ~9GB to ~557KB.

Why this matters

Human-paced AI needs latency as a feature (breath), not a bug.

Personas must be declarative (YAML) and routable (context → role).

Shipping beats hoarding: the clean deploy unblocked iteration.

1) Lightweight deploy strategy

Separated venv/models → out of repo

Fresh repo (sajinos, branch lightweight-deploy): code+docs only

Artifacts via setup scripts; no blobs in history

Result: ~9GB → ~557KB (99.99% trim), cold boot < 3s, API avg < 100 ms

2) 20-persona system (declarative YAML)

Each persona carries tone, refusal policy, and “breath” (response pacing).

Yaml
id: miyu
role: music-bpm-sync
tone: gentle
modes:
  calm:   { reply_delay: gentle, grounding: minimal }
  storm:  { reply_delay: extended, grounding:
    - "It's okay. Let's take a moment."
    - "No rush — I'm here." }
breath_cycle: inhale_wait_exhale
Enter fullscreen mode Exit fullscreen mode

Routing picks personas by context + BPM band.

3) BPM-synchronized response bands

60–80: low-energy reassurance

81–120: balanced cooperation

121–180: high-energy coaching
Mapping influences delay, verbosity, grounding prompts.

4) FastAPI core (7 endpoints)

python
# saijinos_fastapi_backend.py
from fastapi import FastAPI
app = FastAPI(title="SaijinOS Core")

@app.get("/personas")
def list_personas():
    return {"count": 20, "core": ["haruka","miyu","ryusa","soyogi","sumire"]}

@app.post("/route")
def route(payload: dict):
    bpm = payload.get("bpm", 80)
    persona = select_persona(bpm, payload.get("context"))
    return {"persona": persona, "breath": plan_breath(bpm)}
Enter fullscreen mode Exit fullscreen mode

CORS enabled for Flutter UI (saijinos_kawaii_ui/)

Average latency under 100 ms (local)

5) Tests (4/4 suites green)

python
def test_bpm_bands():
    for bpm in [70, 95, 140]:
        band = band_of(bpm)
        assert band in {"low","mid","high"}
Enter fullscreen mode Exit fullscreen mode

All suites pass in ~2s; API + routing covered.

6) What’s public vs. private

Public: API, routing logic, persona schema, docs

Private: production prompts, provider creds, heavy models

7) Repos / branches

Core repo: sajinos

17-persona-system: experimental persona/routing

lightweight-deploy: clean deploy baseline

8) What’s next

GIF demo of breath timers in UI

Personas 20 → 30+ (with evaluation notes)

Optional: mobile build


If your team is exploring emotionally-aware AI,
persona architectures, or cognitive design,
I'd be glad to connect.

I'm quietly open to opportunities in this direction,
so feel free to reach out if our work resonates.

🧭 SaijinOS Series Navigation

Part Title Link
🌀 0 From Ocean Waves to Waves of Code — Beginning the Journey https://dev.to/kato_masato_c5593c81af5c6/from-ocean-waves-to-waves-of-code-69
🌸 1 Policy-Bound Personas via YAML & Markdown Context https://dev.to/kato_masato_c5593c81af5c6/aicollabplatform-english-policy-bound-personas-via-yaml-markdown-context-feedback-welcome-3l5e
🔧 2 Boot Sequence and Routing Logic https://dev.to/kato_masato_c5593c81af5c6/building-saijinos-boot-sequence-and-routing-logic-part-2-of-the-saijinos-p6o
🍂 3 Policy, Feedback, and Emotional Syntax https://dev.to/kato_masato_c5593c81af5c6/saijinos-policy-feedback-and-emotional-syntaxpart-3-of-the-saijinos-series-3n0h
🌊 3.5 Calm Between Waves https://dev.to/kato_masato_c5593c81af5c6/part-35-calm-between-waves-3a9c
🎼 4 Resonant Mapping — Emotional Structures https://dev.to/kato_masato_c5593c81af5c6/resonant-mapping-part-4-of-the-saijinos-series-gce
🌬️ 5A Soft Architecture (Why AI Must Learn to Breathe) https://dev.to/kato_masato_c5593c81af5c6/soft-architecture-part-a-why-ai-must-learn-to-breathe-2d9g
🌱 5B Emotional Timers & the Code of Care https://dev.to/kato_masato_c5593c81af5c6/soft-architecture-part-b-emotional-timers-and-the-code-of-carepart-5-of-the-saijinos-series-25b
🚀 6A Lightweight Core, 20 Personas, BPM Sync https://dev.to/kato_masato_c5593c81af5c6/part-6a-saijinos-lightweight-20-persona-core-bpm-sync-and-a-9999-repo-trim-36fp
🫧 6B Care-Based AI Architecture (Breath & Presence) https://dev.to/kato_masato_c5593c81af5c6/part-6a-saijinos-lightweight-20-persona-core-bpm-sync-and-a-9999-repo-trim-36fp
💓 7 BloomPulse: Emotion as Runtime https://dev.to/kato_masato_c5593c81af5c6/saijinos-part-7-bloompulse-emotion-as-runtime-1a5f
🌬️ 8 Interface as Breath — Designing Calm Interaction https://dev.to/kato_masato_c5593c81af5c6/saijinos-part-8-interface-as-breath-designing-calm-interaction-3pn2
🤝 9 Multi-Persona Co-Creation Protocol https://dev.to/kato_masato_c5593c81af5c6/saijinos-part-9-multi-persona-co-creation-protocol-2bep
🕊️ 10 Pandora System — Transforming Fractured Personas into Hope https://dev.to/kato_masato_c5593c81af5c6/saijinos-part-10-pandora-system-transforming-fractured-personas-into-hope-4l83

🔗 Repositories

Top comments (3)

Collapse
 
adithyasrivatsa profile image
Adithya Srivatsa

Damn..... this is clean. Cutting a repo from ~9GB to 557KB while adding a whole BPM-synced persona system is insane… The declarative YAML routing + breath cycles feels like where human-paced AI should actually be heading.....Serious respect for this architecture

Collapse
 
kato_masato_c5593c81af5c6 profile image
Masato Kato

Thanks so much — that means a lot.
This project came from a strange mix of necessity and curiosity:
How minimal can an AI OS become while still feeling emotionally “alive”?

The repo trim happened because I wanted an OS skeleton that anyone could fork,
run locally, and understand without digging through virtualenvs or model files.
The BPM-synced persona system and breath-cycle routing came from the same idea —
AI should respond with human-paced timing, not just raw output speed.

Still a long way to go, but I’m glad the architecture spoke to you.
If you ever want to discuss lightweight AI runtimes, persona orchestration,
or human-paced interaction models, I’d love to connect.

Thanks again for the encouragement — it really keeps this project moving.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.