mizan-os 0.0.0-stage → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile ADDED
@@ -0,0 +1,25 @@
1
+ # Mizan OSS / Enterprise Air-Gapped Container (Node 24 Zero-Dep)
2
+ FROM node:24-alpine
3
+
4
+ RUN apk add --no-cache git
5
+ WORKDIR /app
6
+
7
+ COPY package.json ./
8
+ COPY bin/ ./bin/
9
+ COPY action-center/ ./action-center/
10
+ COPY hub-mcp/ ./hub-mcp/
11
+ COPY ops/distill-lesson.mjs ops/feed-sync.mjs ops/session-hook.mjs ops/POLICY.example.json ./ops/
12
+ COPY feed/ ./feed/
13
+ COPY knowledge/ ./knowledge/
14
+
15
+ ENV NODE_ENV=production \
16
+ BRAIN_ROOT=/data/brain \
17
+ BRAIN_AC_PORT=4321
18
+
19
+ RUN mkdir -p /data/brain/ops && chown -R node:node /app /data/brain
20
+ USER node
21
+
22
+ EXPOSE 4321
23
+ VOLUME ["/data/brain"]
24
+
25
+ CMD ["node", "action-center/server.mjs"]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mizan Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,184 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <img src="docs/assets/mizan-hero-banner.jpg" alt="Mizan — Local-First Multi-Agent Control Plane" width="100%" />
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ <br />
5
+ <br />
6
+
7
+ <h1>Mizan</h1>
8
+ <p><strong>The Local-First Brain OS &amp; Fair-Quota Control Plane for Multi-Agent Coding Fleets</strong></p>
9
+ <p>Orchestrate <strong>Claude Code</strong>, <strong>Codex</strong>, <strong>Cursor</strong>, <strong>OpenCode</strong>, and <strong>Antigravity</strong> from one hardened, zero-dependency hub &mdash; with <code>&lt; 3k</code> fixed prefix tokens, a 4-tool <code>stdio</code> SQLite FTS5 MCP server, and zero-token weekly Kaizen audits.</p>
10
+
11
+ <p>
12
+ <a href="https://github.com/csa7mdm/mizan/actions/workflows/ci.yml"><img src="https://github.com/csa7mdm/mizan/actions/workflows/ci.yml/badge.svg" alt="Mizan CI" /></a>
13
+ <img src="https://img.shields.io/badge/Node.js-24%2B%20Zero--Dep-22c55e?style=flat-square&logo=node.js&logoColor=white" alt="Node 24 Zero-Dep" />
14
+ <img src="https://img.shields.io/badge/Fleet-5%20AI%20Agents-38bdf8?style=flat-square" alt="5 AI Agents" />
15
+ <img src="https://img.shields.io/badge/MCP-4--Tool%20stdio%20FTS5-d4a853?style=flat-square" alt="4-Tool stdio MCP" />
16
+ <img src="https://img.shields.io/badge/Security-DNS%20Rebind%20%2B%20CSRF%20%2B%20Bearer-ef4444?style=flat-square" alt="Security Hardened" />
17
+ <img src="https://img.shields.io/badge/Audit%20Cost-0%20LLM%20Tokens-a855f7?style=flat-square&logoColor=white" alt="0 LLM Tokens" />
18
+ <a href="https://glama.ai/mcp/servers/csa7mdm/mizan"><img src="https://glama.ai/mcp/servers/csa7mdm/mizan/badges/score.svg" alt="Mizan MCP server on Glama" height="20" /></a>
19
+ </p>
20
+
21
+ <p>
22
+ <a href="#-live-action-center">Live Demo</a> &middot;
23
+ <a href="#-60-second-zero-ai-quickstart">Quickstart</a> &middot;
24
+ <a href="#-architecture">Architecture</a> &middot;
25
+ <a href="#-mizan-oss-vs-mizan-enterprise">OSS vs Enterprise</a> &middot;
26
+ <a href="docs/wiki/01-Architecture-and-5-Agent-Fleet.md">Full Wiki (8 Guides)</a>
27
+ </p>
28
+ </div>
29
+
30
+ ---
31
+
32
+ ## Why Mizan? (The 5-Second Empirical Proof)
33
+
34
+ Running 3 to 5 AI coding agents in parallel creates **terminal chaos, silent token burn, skill prefix bloat, and exposed localhost dashboards**. **Mizan** (inspired by *Ma'at* balance, *Al-Mizan* fair measure, and Japanese *Kaizen* continuous improvement) restores calm, deterministic control from one single source of truth.
35
+
36
+ | Metric (Measured on Real Sessions) | Before Mizan | With Mizan | Impact |
37
+ | :--- | :---: | :---: | :--- |
38
+ | **Installed Skills per Agent** | `1,247` / `1,265` | **`6` – `11`** | Eliminates silent prompt-prefix bloat |
39
+ | **Estimated Fixed Prefix Tokens** | `50,644+` tok | **`278` – `2,986` tok** | **~94% prefix reduction** (target `< 15k`) |
40
+ | **Weekly OS Health & Skill ROI Audit** | Manual / ad-hoc | **`0` LLM tokens** | Automated Windows Task Scheduler |
41
+ | **Localhost Dashboard Security** | Open `127.0.0.1` | **`401` + `403` Guards** | Blocks DNS Rebinding & CSRF attacks |
42
+ | **New Venture Triad Bootstrap** | Hours of setup | **`< 1` second (`23` files)** | Platform + Social + Partnerships wired |
43
+
44
+ ---
45
+
46
+ ## Live Action Center (The Aperture Control Plane)
47
+
48
+ A zero-dependency Node 24 local & remote control plane (`127.0.0.1:4321`) built on a **Headless State + Layout Plugin Registry** architecture:
49
+
50
+ - **Per-Project Isolated Cockpit (`Operate`):** Focuses on one project at a time with active-only tasks (`ops/boards/<slug>.json`, completed items archived behind a toggle), **Live Agent Screen** (real-time logs + `Pause` / `Resume` / tree-`Terminate` / direct `stdin` or directive input), and **1-Click Quick Actions** (`Proceed`, `Approve & Proceed`, `Submit`, or auto-extracted choices) whenever an agent pauses.
51
+ - **Interactive Multi-Model Space (`Arena`):** Talk 1-on-1 or compare 2–4 models side-by-side (`Claude Code`, `Codex CLI`, `OpenCode $0`, `Ollama $0`) via live SSE streaming, protected by **Quota Guard**, with **Promote Winner -> Project Task**.
52
+ - **Zero-Noise Blocker Detection & Auto-Discovery:** Combines `ops/session-hook.mjs` (Claude Code hooks), a **Stall Watchdog**, and **Live Session Auto-Discovery** (Antigravity + Claude Code transcripts) so blocked or silent agents surface immediately in the `NEEDS ATTENTION` banner.
53
+ - **Bilingual EN / Egyptian Arabic (`RTL`) + BiDi Fix:** Instant toggle between English and Egyptian founder-friendly Arabic with `<bdi dir="auto">` / `unicode-bidi: plaintext` isolation for mixed code/Arabic logs.
54
+ - **One-Command Auto-Connect (`hub-mcp/connect.mjs`):** Automatically wires `brain-hub` into Claude Code, OpenCode, Codex, and Cursor without manual JSON edits (`node hub-mcp/connect.mjs --dry-run`).
55
+ - **Remote Streamable HTTP MCP (`/mcp`):** Bearer-authenticated endpoint restricted to **5 safe Control-Plane tools** (zero shell execution) for ChatGPT & Claude Mobile via Cloudflare Tunnel or Tailscale Funnel.
56
+ - **Searchable `knowledge/` Playbooks + Unified `ops/ACTIVITY-LOG.jsonl`:** Curated Browser, Mobile (Android USB ADB / Wi-Fi Wireless Debugging / iOS), and Token-Optimal playbooks indexed in `hub-mcp` SQLite FTS5 with zero prefix-token increase.
57
+ - **Invalidated-on-Edit Verification Receipts & `AGENTS.md` Bloat Linter:** Every `Verify Diff` run stamps a SHA-256 git-tree receipt (`PASS` automatically flips to `STALE` if any file is edited afterward). Built-in linter warns when `AGENTS.md`/`CLAUDE.md` exceeds 150 lines or contains auto-generated directory trees.
58
+ - **Worktree Isolation, 10-Port Blocks & 3-Gram Loop Circuit Breaker:** Parallel workers launch in `.mizan-worktrees/<id>` with deterministic 10-port blocks (`MIZAN_PORT=4400, 4410...`), exFAT/WSL `/mnt/c` I/O guards, and a Circuit Breaker that kills workers on repeated errors, 3-gram action loops, or runtime cap.
59
+ - **Fail-Closed Federated Privacy Distiller (`ops/distill-lesson.mjs` + `ops/feed-sync.mjs`):** Zero-dependency 7-stage deterministic sanitizer (hard 16 KB cap, zero `--force` bypass flags, compiled secret regexes + Shannon entropy scanner, OS/WSL path & username stripping, prompt-injection & Base64/shell-pipe rejection) with built-in Node 24 **Ed25519 signing/verification** and 5 signed starter lessons in `feed/lessons/`.
60
+ - **Dynamic Drop-In Layout Plugins (`action-center/plugins/`):** Auto-discovered via `GET /api/plugins` (`atc-grid.js` Air-Traffic Ops multi-project radar + `tiling-split.js` 2x2 live agent panes).
61
+ - **Worktree Merge UI, Setup Wizard, `mizan` CLI & Air-Gapped Docker:** Merge/discard `.mizan-worktrees/*` from the browser, onboard fresh installs via the Setup Wizard, run `node bin/mizan.mjs start|connect|sync-feed|distill|test`, or deploy air-gapped with `Dockerfile`, `docker-compose.yml`, and `ops/POLICY.example.json`.
62
+
63
+ <div align="center">
64
+ <img src="docs/assets/mizan-action-center.gif" alt="Mizan Action Center Live Walkthrough" width="100%" />
65
+ </div>
66
+
67
+ ---
68
+
69
+ ## Architecture
70
+
71
+ One local source of truth propagates rules, lessons (`<= 30` cap), and fleet identity across all 5 agents, while `hub-mcp` exposes 4 read/write primitives over **`stdio` only** (zero network exposure).
72
+
73
+ ```mermaid
74
+ flowchart TD
75
+ Founder["Founder / Tech Lead"] --> AC["Mizan Action Center (127.0.0.1:4321)\nHost/Origin Guard + Bearer Auth + Tailscale"]
76
+
77
+ subgraph Core["Single Source of Truth (~/.claude/brain)"]
78
+ OPS["ops/ Live Control Bus\nFLEET-STATUS.json | BROADCAST.md\nDECISION-QUEUE.json | health-snapshot.json"]
79
+ RULES["Rules & Memory\nAGENTS-CORE.md | LESSONS.md (<=30)\nMODEL-REGISTRY.json | active-projects.md"]
80
+ MCP["hub-mcp/ (stdio-only, Node 24 SQLite FTS5)\nbrain_search_lessons | brain_search_components\nbrain_get_ops_state | brain_log_decision"]
81
+ end
82
+
83
+ AC <-->|"Live JSON State & Decisions"| OPS
84
+ MCP <-->|"Zero-Network stdio JSON-RPC"| Fleet
85
+
86
+ subgraph Fleet["5-Agent Coding Fleet (Desktop Apps + CLIs)"]
87
+ AGY["Antigravity\nLead + Browser + MCP"]
88
+ CC["Claude Code\nDeep Refactors + --worktree"]
89
+ CDX["Codex CLI/App\nIndependent Review + Tests"]
90
+ OC["OpenCode Free Tier\n$0 Boilerplate (Verify-Gated)"]
91
+ CUR["Cursor Entry Plan\nTight Quota (yellow-conserve)"]
92
+ end
93
+
94
+ RULES -->|"05-APPLY-BRAIN.sh (Copy, No Symlinks)"| Fleet
95
+ OPS <--> Fleet
96
+ ```
97
+
98
+ ### Bounded 3-Layer Self-Healing (Kaizen Loop)
99
+
100
+ ```mermaid
101
+ flowchart LR
102
+ F["Anomaly / CI Fail / Stall"] --> L1["Layer 1: Deterministic Guard (0 Tokens)\noxlint | gitleaks | check:rls | pnpm audit"]
103
+ L1 --> L2["Layer 2: Bounded Recovery (Max 2 Tries)\nquiet-run error tail -> recipe -> verify"]
104
+ L2 -->|Green| L3["Layer 3: Sandboxed Kaizen\n1-sentence lesson -> LESSONS.md (<=30)"]
105
+ L2 -->|Still Failing| ESC["Hard Stop -> ops/DECISION-QUEUE.json\nExact logs + 1 recommendation"]
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 60-Second Zero-AI Quickstart (Fresh Windows 11 PC)
111
+
112
+ Bootstrap a brand-new machine **without needing any AI installed first**:
113
+
114
+ ```powershell
115
+ # 1. Clone and run the PowerShell 5.1-safe zero-AI bootstrapper
116
+ git clone https://github.com/csa7mdm/Brain.git "$env:USERPROFILE\.claude\brain"
117
+ cd "$env:USERPROFILE\.claude\brain"
118
+ powershell -ExecutionPolicy Bypass -File .\bootstrap.ps1 -InstallAgents
119
+
120
+ # 2. Start the hardened Action Center (token auto-generated in ops/.ac-token)
121
+ node .\action-center\server.mjs
122
+
123
+ # 3. Connect the 4-tool stdio Hub MCP (Claude Code example)
124
+ claude mcp add brain-hub -- node "$env:USERPROFILE\.claude\brain\hub-mcp\index.mjs"
125
+
126
+ # 4. Bootstrap a new Three-Workspace Venture Triad in < 1 second
127
+ python .\06-VENTURE-OS\new-venture.py my-venture --domain="Developer Tools" --region="Global"
128
+ ```
129
+
130
+ ### macOS & Linux Quickstart (Node 24+)
131
+
132
+ ```bash
133
+ git clone https://github.com/csa7mdm/mizan.git ~/.claude/brain && cd ~/.claude/brain
134
+ bash ./bootstrap.sh --connect --sync-feed
135
+ node ./action-center/server.mjs
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Core Modules
141
+
142
+ | Module | Path | Purpose |
143
+ | :--- | :--- | :--- |
144
+ | **Hardened Action Center** | `action-center/` | Live web UI (`Host/Origin` guard, Bearer auth, Tailscale mobile mode, Broadcast bus, Decision Queue). |
145
+ | **4-Tool Local Hub MCP** | `hub-mcp/` | Zero-dep `stdio` MCP server using Node 24 `node:sqlite` FTS5 over lessons, shared components, and ops state. |
146
+ | **5-Agent Fleet Sync** | `05-APPLY-BRAIN.sh`, `07-VERIFY.sh` | Propagates rules, identity headers, and `<= 30`-line Cursor thin rule across all 5 agents. |
147
+ | **Venture Triad Engine** | `06-VENTURE-OS/` | `new-venture.py`, `brain-doctor.py`, parameterized Platform + Social + Partnerships templates, static guards (`check:rls`, `check:em-dash`, `check:portability`). |
148
+ | **Weekly Kaizen Audit** | `scripts/weekly-health.py` | 0-token scheduled audit: 5-agent prefix budget, 30d Skill ROI, live `opencode models` deprecation probe, portfolio pulse. |
149
+ | **NotebookLM Exporter** | `scripts/export-notebooklm-pack.py` | Compiles lessons, decisions, wiki, and weekly health into a clean NotebookLM source pack for Audio Overviews & Mind Maps. |
150
+ | **Zero-AI Bootstrapper** | `bootstrap.ps1` | Installs minimum prerequisites (`winget`), optional CLI agents, syncs fleet, and registers Windows Task Scheduler. |
151
+
152
+ ---
153
+
154
+ ## Mizan OSS vs. Mizan Enterprise (Open-Core Roadmap)
155
+
156
+ | Capability | Mizan OSS (Community / Solo) | Mizan Enterprise (AAA Corporate) |
157
+ | :--- | :---: | :---: |
158
+ | **5-Agent Fleet Sync & Pre-Flight Gate** | Included | Included |
159
+ | **Hardened Local Action Center + Tailscale** | Included | Included + SSO / SAML / RBAC |
160
+ | **4-Tool `stdio` Hub MCP (SQLite FTS5)** | Included | Team-Shared Postgres/Vector Hub |
161
+ | **Weekly 0-Token Health & Skill ROI Audit** | Included | Org-Wide Telemetry & FinOps Spend Caps |
162
+ | **Static Security & RLS Guards** | Included | Policy-as-Code + Immutable Audit Trails |
163
+ | **Deployment & Compliance** | Local-First (Windows/Mac/Linux) | Air-Gapped / On-Prem + SOC 2 / ISO 27001 Readiness |
164
+
165
+ ---
166
+
167
+ ## Full Documentation Wiki
168
+
169
+ All 8 architecture, security, operations, and extraction guides live in [`docs/wiki/`](docs/wiki/):
170
+
171
+ 1. [01 — Architecture & 5-Agent Fleet](docs/wiki/01-Architecture-and-5-Agent-Fleet.md)
172
+ 2. [02 — Zero-AI Quickstart (Windows 11)](docs/wiki/02-Zero-AI-Quickstart-Windows.md)
173
+ 3. [03 — Action Center & Hardened Mobile Control](docs/wiki/03-Action-Center-and-Mobile-Control.md)
174
+ 4. [04 — 4-Tool Local Hub MCP Server](docs/wiki/04-Hub-MCP-Server.md)
175
+ 5. [05 — Venture Triad & Zero-Cost Static Guards](docs/wiki/05-Venture-Triad-and-Static-Guards.md)
176
+ 6. [06 — Token Discipline, Kaizen & Skill ROI](docs/wiki/06-Token-Discipline-and-Skill-ROI.md)
177
+ 7. [07 — Security & Threat Model](docs/wiki/07-Security-Model.md)
178
+ 8. [08 — Private-to-Public OSS & Enterprise Extraction Guide](docs/wiki/08-Private-to-Public-Extraction-Guide.md)
179
+
180
+ ---
181
+
182
+ ## GitHub SEO Topics (Copy to Repo Settings)
183
+
184
+ `multi-agent-orchestration` · `ai-coding-agents` · `claude-code` · `codex-cli` · `opencode` · `cursor-rules` · `mcp-server` · `sqlite-fts5` · `local-first` · `developer-productivity` · `agent-control-plane` · `indie-hacker`