Design Phase

The SHAKA System

Smart Hybrid Advisory Kernel Agent — The brain that watches but never acts.

"SHAKA proposes. NIKA disposes."

The fundamental principle: SHAKA can suggest, but never execute.

Architecture Overview

┌─────────────────────────────────────────────────────┐
│  NIKA RUNNER (Native Infrastructure Kernel)        │
│  ROLE: Execution kernel, sole runtime authority    │
│  OWNS: DAG, Budgets, DataStore, PatchWindows       │
└─────────────────┬───────────────────────────────────┘
                  │ EventBus
                  ▼
┌─────────────────────────────────────────────────────┐
│  SHAKA SERVICE (Smart Hybrid Advisory Kernel Agent)│
│  ROLE: Runtime sidecar, observes + analyzes        │
│  NEVER: Executes, mutates state, bypasses runner   │
└─────────────────────────────────────────────────────┘
                  │
                  ▼
        ┌────────────────┐
        │  EventLog      │  → Replay, Audit
        │  TUI (Lane)    │  → Visual feedback
        │  Reports       │  → Post-run analysis
        └────────────────┘

SHAKA subscribes to events from the runner via an EventBus. It processes these events, runs analysis, and can request the runner to take actions — but the runner always has final authority to accept or reject.

Operating Modes

observe_only default

Zero intervention, report only

Actions: None - pure observation
live_gated_safe

L1 subset + short timeouts (250ms)

Actions: Retry, Switch Model
live_gated_aggressive

Full L1/L2 + longer timeouts (500ms)

Actions: All L1 + Trim Context, Early Stop
ci_guard

CI/CD validation, snapshots

Actions: Fail fast, capture state

Action Levels

L1Recovery— Immediate responses to detected issues
RETRYSWITCH_MODELPATCH_PROMPTENFORCE
L2Optimization— Proactive adjustments for better performance
TRIM_CONTEXTCHANGE_PARALLELEARLY_STOP
L3Improvement— Suggestions for future runs (never runtime)
PROPOSE_REFACTORPROPOSE_SPLITPROPOSE_CACHE

Important: L3 actions are NEVER executed at runtime. They are proposals written to shaka.proposal.yaml for human review.

Internal Components (Planned)

src/shaka/
├── mod.rs           # Main entry point
├── epistemic/       # Sensing layer (signals, scoring)
├── policy/          # Governance (mitigation, budgets)
├── facets/          # Sub-advisors
│   ├── security.rs  # Security facet
│   ├── cost.rs      # Cost optimization facet
│   ├── quality.rs   # Output quality facet
│   └── perf.rs      # Performance facet
├── livegate/        # Runtime patches (L1/L2)
├── report/          # Output generation (shaka.report.json)
└── proposal/        # Improvement suggestions (.yaml + .diff)

Key Invariants (Non-Negotiable)

  • DAG is IMMUTABLE — No task add/remove at runtime
  • Budgets are INVIOLABLE — SHAKA cannot exceed budgets
  • Powers are INVIOLABLE — Cannot grant new permissions
  • All actions LOGGED — Complete audit trail, replayable

SHAKA is in active design

Help shape how it works.