# Meet Sofuu: The General-Purpose Runtime for AI That Collapses Your AI Stack Into One Binary

Building AI applications in JavaScript or TypeScript today usually requires duct-taping a fragile multi-process stack:

- **Node.js or Python** running the application logic.
- **External vector databases** (Chroma, Pinecone, Qdrant) running as separate network services.
- **Background LLM daemons** (Ollama, vLLM) communicating across localhost ports.
- **The localhost IPC tax** — every hop between app, vector database, and daemon serializes JSON over a socket.

We built [**Sofuu**](https://sofuu.xyz) to collapse this entire architecture into **one in-process runtime, a single ≤ 5.5 MiB binary**.

---

## What is Sofuu?

**Sofuu is a general-purpose runtime for AI — built to run anywhere from servers to smart devices.** It is not an npm framework or a wrapper around Node: it is a standalone native binary with a Rust/C systems core (QuickJS + libuv, zero JIT) that measures a **22.5 ms median cold start** (wall clock including process spawn, Apple M2 Pro — every number in this post is measured and published in the repo's BENCHMARKS.md).

TypeScript and JavaScript are the orchestration surface. The primitives live in the runtime core:

### 1. In-Process Cognitive Vector Memory (QTSQ)

Built-in encrypted `.qtsq` memory containers with hardware SIMD search — measured **0.82 ms** for top-K over 10,000 × 768-dim vectors on Apple Silicon, in-process, with no external database. And QTSQ itself is now open source under the Apache-2.0 license ([github.com/haruhito2666/qtsq](https://github.com/haruhito2666/qtsq)).

### 2. Autonomous Agent Loops & Prompt Sovereignty

Define multi-step agents with native tools, budget caps, cancel signals, and streaming observability. Sofuu guarantees **prompt sovereignty**: the runtime never injects hidden system prompts or biases.

### 3. Native Model Context Protocol (MCP)

First-class MCP **client and server** support is built into the standard library. Connect to existing tool ecosystems without installing adapter packages.

### 4. Sandbox v2 & 5-Shield Security

Untrusted agent tools and third-party plugins cross five shields: schema validation, policy and network jailing, a circuit breaker, watchdog deadlines, and a panic guard — a throwing plugin becomes a typed error, never a dead process.

> **Honesty note:** the built-in inference engine is **experimental**. For production workloads, point the built-in `llamacpp` provider at a llama.cpp server.

---

## Hello World in Sofuu

Memory, an agent, and recall — one process, no `node_modules`:

```typescript
// Memory + agent + tools in one process
const brain = sofuu.memory.open("./brain.qtsq", 768);
brain.remember(
  sofuu.ai.embedLocal("Deployment target: AWS us-east-1"),
  "Deployment target: AWS us-east-1"
);

sofuu.agent.define({
  name: "deploy-auditor",
  system: "Inspect the repository and summarize deployment requirements.",
  tools: ["web", "memory"],
  budget: { maxSteps: 12 },
});

const result = await sofuu.agent.run(
  "deploy-auditor",
  "Audit this repo for deployment requirements"
);
console.log(result.answer);

const [hit] = brain.recall(sofuu.ai.embedLocal("deployment target"), 1);
console.log("Recalled:", hit.text);
```

Run it immediately:

```bash
sofuu run agent.ts
```

*(No compilation step — TypeScript is stripped in-process. No `node_modules`. No background daemons.)*

---

## Runs Everywhere, Ships as an SDK

The same binary runs on macOS and Linux (including Raspberry Pi 5), and the engine embeds into iOS and Android apps through the `libsofuu` C ABI — QuickJS has no JIT, so App Store policy holds by construction. The Android SDK publishes as a Gradle dependency:

```gradle
implementation 'com.sofuu:sofuu-android:0.3.0'
```

---

## Open Source — All of It

The Sofuu runtime is MIT-licensed, and the QTSQ memory engine is open source under the Apache License 2.0.

- **Website & Documentation:** <https://sofuu.xyz>
- **GitHub Repository:** <https://github.com/sofuu-runtime/sofuu>
- **QTSQ Engine:** <https://github.com/haruhito2666/qtsq>
- **Official AI Skill:** <https://sofuu.xyz/SKILL.md>

### Try it in 10 seconds:

```bash
# macOS & Linux (auto-detects architecture) — or: npm i -g sofuu
curl -fsSL https://sofuu.xyz/install | sh
```

Current release: **v0.3.0-beta.2**. We are actively developing Sofuu and would love your feedback, bug reports, and benchmark tests!
