magi-ai 0.1.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/LICENSE +21 -0
- package/README.ja.md +377 -0
- package/README.md +377 -0
- package/dist/bin/magi-benchmark.d.ts +14 -0
- package/dist/bin/magi-benchmark.js +93 -0
- package/dist/bin/magi-mcp.d.ts +8 -0
- package/dist/bin/magi-mcp.js +28 -0
- package/dist/bin/magi.d.ts +2 -0
- package/dist/bin/magi.js +634 -0
- package/dist/src/adapters/base.d.ts +34 -0
- package/dist/src/adapters/base.js +149 -0
- package/dist/src/adapters/claude.d.ts +29 -0
- package/dist/src/adapters/claude.js +65 -0
- package/dist/src/adapters/codex.d.ts +21 -0
- package/dist/src/adapters/codex.js +41 -0
- package/dist/src/adapters/gemini.d.ts +18 -0
- package/dist/src/adapters/gemini.js +31 -0
- package/dist/src/adapters/registry.d.ts +19 -0
- package/dist/src/adapters/registry.js +59 -0
- package/dist/src/audit/hash-chain.d.ts +21 -0
- package/dist/src/audit/hash-chain.js +70 -0
- package/dist/src/audit/types.d.ts +25 -0
- package/dist/src/audit/types.js +1 -0
- package/dist/src/audit/writer.d.ts +18 -0
- package/dist/src/audit/writer.js +100 -0
- package/dist/src/benchmark/golden-tasks.d.ts +9 -0
- package/dist/src/benchmark/golden-tasks.js +476 -0
- package/dist/src/benchmark/reporter.d.ts +5 -0
- package/dist/src/benchmark/reporter.js +107 -0
- package/dist/src/benchmark/runner.d.ts +30 -0
- package/dist/src/benchmark/runner.js +224 -0
- package/dist/src/benchmark/scorer.d.ts +12 -0
- package/dist/src/benchmark/scorer.js +124 -0
- package/dist/src/benchmark/types.d.ts +54 -0
- package/dist/src/benchmark/types.js +1 -0
- package/dist/src/cache/deliberation-cache.d.ts +49 -0
- package/dist/src/cache/deliberation-cache.js +127 -0
- package/dist/src/cli/commands/config-cmd.d.ts +11 -0
- package/dist/src/cli/commands/config-cmd.js +190 -0
- package/dist/src/cli/commands/demo.d.ts +12 -0
- package/dist/src/cli/commands/demo.js +66 -0
- package/dist/src/cli/commands/setup.d.ts +7 -0
- package/dist/src/cli/commands/setup.js +182 -0
- package/dist/src/cli/i18n.d.ts +89 -0
- package/dist/src/cli/i18n.js +176 -0
- package/dist/src/cli/interactive-select.d.ts +27 -0
- package/dist/src/cli/interactive-select.js +130 -0
- package/dist/src/cli/tui-setup.d.ts +24 -0
- package/dist/src/cli/tui-setup.js +42 -0
- package/dist/src/config/cli-detector.d.ts +37 -0
- package/dist/src/config/cli-detector.js +99 -0
- package/dist/src/config/user-config.d.ts +81 -0
- package/dist/src/config/user-config.js +134 -0
- package/dist/src/context/auto-collector.d.ts +43 -0
- package/dist/src/context/auto-collector.js +337 -0
- package/dist/src/context/manager.d.ts +35 -0
- package/dist/src/context/manager.js +162 -0
- package/dist/src/context/serializer.d.ts +20 -0
- package/dist/src/context/serializer.js +52 -0
- package/dist/src/demo/recorded-deliberation.d.ts +13 -0
- package/dist/src/demo/recorded-deliberation.js +277 -0
- package/dist/src/engine/angel-detector.d.ts +83 -0
- package/dist/src/engine/angel-detector.js +334 -0
- package/dist/src/engine/at-field.d.ts +40 -0
- package/dist/src/engine/at-field.js +195 -0
- package/dist/src/engine/berserk-orchestrator.d.ts +66 -0
- package/dist/src/engine/berserk-orchestrator.js +378 -0
- package/dist/src/engine/change-metrics.d.ts +56 -0
- package/dist/src/engine/change-metrics.js +214 -0
- package/dist/src/engine/consensus.d.ts +20 -0
- package/dist/src/engine/consensus.js +146 -0
- package/dist/src/engine/dead-sea-scrolls.d.ts +132 -0
- package/dist/src/engine/dead-sea-scrolls.js +610 -0
- package/dist/src/engine/drift-detector.d.ts +39 -0
- package/dist/src/engine/drift-detector.js +225 -0
- package/dist/src/engine/dummy-plug.d.ts +44 -0
- package/dist/src/engine/dummy-plug.js +190 -0
- package/dist/src/engine/engram-manager.d.ts +55 -0
- package/dist/src/engine/engram-manager.js +306 -0
- package/dist/src/engine/events.d.ts +130 -0
- package/dist/src/engine/events.js +44 -0
- package/dist/src/engine/gospel.d.ts +30 -0
- package/dist/src/engine/gospel.js +129 -0
- package/dist/src/engine/hallucination-detector.d.ts +33 -0
- package/dist/src/engine/hallucination-detector.js +215 -0
- package/dist/src/engine/human-resolver.d.ts +19 -0
- package/dist/src/engine/human-resolver.js +89 -0
- package/dist/src/engine/instrumentality.d.ts +64 -0
- package/dist/src/engine/instrumentality.js +297 -0
- package/dist/src/engine/iruel-battle.d.ts +79 -0
- package/dist/src/engine/iruel-battle.js +319 -0
- package/dist/src/engine/kernel/deliberation-kernel.d.ts +12 -0
- package/dist/src/engine/kernel/deliberation-kernel.js +303 -0
- package/dist/src/engine/kernel/index.d.ts +8 -0
- package/dist/src/engine/kernel/index.js +7 -0
- package/dist/src/engine/kernel/phase-runner.d.ts +10 -0
- package/dist/src/engine/kernel/phase-runner.js +155 -0
- package/dist/src/engine/kernel/post-processor.d.ts +17 -0
- package/dist/src/engine/kernel/post-processor.js +131 -0
- package/dist/src/engine/kernel/types.d.ts +107 -0
- package/dist/src/engine/kernel/types.js +1 -0
- package/dist/src/engine/kernel/unit-executor.d.ts +6 -0
- package/dist/src/engine/kernel/unit-executor.js +132 -0
- package/dist/src/engine/lcl-manager.d.ts +44 -0
- package/dist/src/engine/lcl-manager.js +143 -0
- package/dist/src/engine/middleware/cache.d.ts +7 -0
- package/dist/src/engine/middleware/cache.js +29 -0
- package/dist/src/engine/middleware/chain.d.ts +18 -0
- package/dist/src/engine/middleware/chain.js +45 -0
- package/dist/src/engine/middleware/firewall.d.ts +8 -0
- package/dist/src/engine/middleware/firewall.js +24 -0
- package/dist/src/engine/middleware/index.d.ts +4 -0
- package/dist/src/engine/middleware/index.js +3 -0
- package/dist/src/engine/middleware/types.d.ts +43 -0
- package/dist/src/engine/middleware/types.js +1 -0
- package/dist/src/engine/nebuchadnezzar-key.d.ts +61 -0
- package/dist/src/engine/nebuchadnezzar-key.js +203 -0
- package/dist/src/engine/neon-genesis.d.ts +52 -0
- package/dist/src/engine/neon-genesis.js +203 -0
- package/dist/src/engine/objective-judge.d.ts +53 -0
- package/dist/src/engine/objective-judge.js +214 -0
- package/dist/src/engine/offline-mode.d.ts +18 -0
- package/dist/src/engine/offline-mode.js +46 -0
- package/dist/src/engine/orchestrator.d.ts +79 -0
- package/dist/src/engine/orchestrator.js +58 -0
- package/dist/src/engine/secret-cipher.d.ts +26 -0
- package/dist/src/engine/secret-cipher.js +114 -0
- package/dist/src/engine/seele-council.d.ts +90 -0
- package/dist/src/engine/seele-council.js +482 -0
- package/dist/src/engine/self-destruct.d.ts +61 -0
- package/dist/src/engine/self-destruct.js +231 -0
- package/dist/src/engine/self-evolution.d.ts +64 -0
- package/dist/src/engine/self-evolution.js +368 -0
- package/dist/src/engine/sync-rate.d.ts +45 -0
- package/dist/src/engine/sync-rate.js +151 -0
- package/dist/src/engine/type666-firewall.d.ts +76 -0
- package/dist/src/engine/type666-firewall.js +343 -0
- package/dist/src/engine/umbilical-cable.d.ts +41 -0
- package/dist/src/engine/umbilical-cable.js +192 -0
- package/dist/src/index.d.ts +106 -0
- package/dist/src/index.js +426 -0
- package/dist/src/mcp/server.d.ts +38 -0
- package/dist/src/mcp/server.js +196 -0
- package/dist/src/metrics/token-tracker.d.ts +38 -0
- package/dist/src/metrics/token-tracker.js +112 -0
- package/dist/src/parsers/json-extractor.d.ts +9 -0
- package/dist/src/parsers/json-extractor.js +239 -0
- package/dist/src/parsers/opinion-schema.d.ts +81 -0
- package/dist/src/parsers/opinion-schema.js +147 -0
- package/dist/src/parsers/unstructured-parser.d.ts +20 -0
- package/dist/src/parsers/unstructured-parser.js +122 -0
- package/dist/src/pipelines/architecture.d.ts +10 -0
- package/dist/src/pipelines/architecture.js +9 -0
- package/dist/src/pipelines/bug-analysis.d.ts +9 -0
- package/dist/src/pipelines/bug-analysis.js +8 -0
- package/dist/src/pipelines/code-review.d.ts +10 -0
- package/dist/src/pipelines/code-review.js +30 -0
- package/dist/src/pipelines/custom.d.ts +14 -0
- package/dist/src/pipelines/custom.js +29 -0
- package/dist/src/pipelines/registry.d.ts +9 -0
- package/dist/src/pipelines/registry.js +20 -0
- package/dist/src/prompts/personas.d.ts +6 -0
- package/dist/src/prompts/personas.js +44 -0
- package/dist/src/prompts/schemas.d.ts +4 -0
- package/dist/src/prompts/schemas.js +24 -0
- package/dist/src/prompts/templates.d.ts +6 -0
- package/dist/src/prompts/templates.js +91 -0
- package/dist/src/repl/accessibility.d.ts +23 -0
- package/dist/src/repl/accessibility.js +46 -0
- package/dist/src/repl/banner.d.ts +4 -0
- package/dist/src/repl/banner.js +28 -0
- package/dist/src/repl/boot-animation.d.ts +13 -0
- package/dist/src/repl/boot-animation.js +143 -0
- package/dist/src/repl/completer.d.ts +21 -0
- package/dist/src/repl/completer.js +168 -0
- package/dist/src/repl/context.d.ts +24 -0
- package/dist/src/repl/context.js +42 -0
- package/dist/src/repl/display-utils.d.ts +13 -0
- package/dist/src/repl/display-utils.js +65 -0
- package/dist/src/repl/event-listener.d.ts +18 -0
- package/dist/src/repl/event-listener.js +112 -0
- package/dist/src/repl/export-formatter.d.ts +8 -0
- package/dist/src/repl/export-formatter.js +73 -0
- package/dist/src/repl/ghost-text.d.ts +31 -0
- package/dist/src/repl/ghost-text.js +119 -0
- package/dist/src/repl/handoff-animation.d.ts +15 -0
- package/dist/src/repl/handoff-animation.js +65 -0
- package/dist/src/repl/history.d.ts +16 -0
- package/dist/src/repl/history.js +130 -0
- package/dist/src/repl/job-registry.d.ts +26 -0
- package/dist/src/repl/job-registry.js +80 -0
- package/dist/src/repl/magi-repl.d.ts +72 -0
- package/dist/src/repl/magi-repl.js +1008 -0
- package/dist/src/repl/multiline-input.d.ts +45 -0
- package/dist/src/repl/multiline-input.js +78 -0
- package/dist/src/repl/prompt-builder.d.ts +19 -0
- package/dist/src/repl/prompt-builder.js +36 -0
- package/dist/src/repl/repl-state.d.ts +5 -0
- package/dist/src/repl/repl-state.js +19 -0
- package/dist/src/repl/result-display.d.ts +8 -0
- package/dist/src/repl/result-display.js +195 -0
- package/dist/src/repl/session-stats.d.ts +26 -0
- package/dist/src/repl/session-stats.js +119 -0
- package/dist/src/repl/slash-commands.d.ts +60 -0
- package/dist/src/repl/slash-commands.js +725 -0
- package/dist/src/repl/terminal-sanitize.d.ts +14 -0
- package/dist/src/repl/terminal-sanitize.js +19 -0
- package/dist/src/reporters/console.d.ts +7 -0
- package/dist/src/reporters/console.js +78 -0
- package/dist/src/reporters/json.d.ts +2 -0
- package/dist/src/reporters/json.js +3 -0
- package/dist/src/reporters/markdown.d.ts +2 -0
- package/dist/src/reporters/markdown.js +65 -0
- package/dist/src/reporters/streaming.d.ts +20 -0
- package/dist/src/reporters/streaming.js +178 -0
- package/dist/src/tui/activity-log.d.ts +23 -0
- package/dist/src/tui/activity-log.js +67 -0
- package/dist/src/tui/animations.d.ts +39 -0
- package/dist/src/tui/animations.js +167 -0
- package/dist/src/tui/ansi.d.ts +28 -0
- package/dist/src/tui/ansi.js +51 -0
- package/dist/src/tui/boot-sequence.d.ts +11 -0
- package/dist/src/tui/boot-sequence.js +98 -0
- package/dist/src/tui/colors.d.ts +101 -0
- package/dist/src/tui/colors.js +71 -0
- package/dist/src/tui/header.d.ts +24 -0
- package/dist/src/tui/header.js +122 -0
- package/dist/src/tui/index.d.ts +3 -0
- package/dist/src/tui/index.js +3 -0
- package/dist/src/tui/keypress.d.ts +25 -0
- package/dist/src/tui/keypress.js +95 -0
- package/dist/src/tui/layout.d.ts +74 -0
- package/dist/src/tui/layout.js +171 -0
- package/dist/src/tui/magi-tui.d.ts +101 -0
- package/dist/src/tui/magi-tui.js +754 -0
- package/dist/src/tui/panel.d.ts +45 -0
- package/dist/src/tui/panel.js +292 -0
- package/dist/src/tui/screen-buffer.d.ts +54 -0
- package/dist/src/tui/screen-buffer.js +262 -0
- package/dist/src/tui/status-bar.d.ts +25 -0
- package/dist/src/tui/status-bar.js +124 -0
- package/dist/src/tui/terminal-detect.d.ts +26 -0
- package/dist/src/tui/terminal-detect.js +44 -0
- package/dist/src/tui/tui-helpers.d.ts +12 -0
- package/dist/src/tui/tui-helpers.js +37 -0
- package/dist/src/types/adapter.d.ts +75 -0
- package/dist/src/types/adapter.js +36 -0
- package/dist/src/types/config.d.ts +108 -0
- package/dist/src/types/config.js +85 -0
- package/dist/src/types/consensus.d.ts +55 -0
- package/dist/src/types/consensus.js +17 -0
- package/dist/src/types/core.d.ts +178 -0
- package/dist/src/types/core.js +85 -0
- package/dist/src/types/magi-api.d.ts +62 -0
- package/dist/src/types/magi-api.js +7 -0
- package/dist/src/types/phase-h.d.ts +142 -0
- package/dist/src/types/phase-h.js +7 -0
- package/dist/src/types/phase-i.d.ts +186 -0
- package/dist/src/types/phase-i.js +6 -0
- package/dist/src/types/phase-k.d.ts +259 -0
- package/dist/src/types/phase-k.js +6 -0
- package/dist/src/types/phase-l.d.ts +199 -0
- package/dist/src/types/phase-l.js +6 -0
- package/dist/src/types/pipeline.d.ts +37 -0
- package/dist/src/types/pipeline.js +2 -0
- package/dist/src/utils/abstain-factory.d.ts +2 -0
- package/dist/src/utils/abstain-factory.js +18 -0
- package/dist/src/utils/errors.d.ts +34 -0
- package/dist/src/utils/errors.js +59 -0
- package/dist/src/utils/file-validator.d.ts +50 -0
- package/dist/src/utils/file-validator.js +124 -0
- package/dist/src/utils/fire-and-forget.d.ts +5 -0
- package/dist/src/utils/fire-and-forget.js +10 -0
- package/dist/src/utils/flag-validator.d.ts +21 -0
- package/dist/src/utils/flag-validator.js +79 -0
- package/dist/src/utils/freeze.d.ts +8 -0
- package/dist/src/utils/freeze.js +16 -0
- package/dist/src/utils/language-detector.d.ts +16 -0
- package/dist/src/utils/language-detector.js +159 -0
- package/dist/src/utils/latency-tracker.d.ts +45 -0
- package/dist/src/utils/latency-tracker.js +100 -0
- package/dist/src/utils/logger.d.ts +33 -0
- package/dist/src/utils/logger.js +112 -0
- package/dist/src/utils/process.d.ts +40 -0
- package/dist/src/utils/process.js +253 -0
- package/dist/src/utils/retry.d.ts +12 -0
- package/dist/src/utils/retry.js +30 -0
- package/dist/src/utils/safe-fs.d.ts +38 -0
- package/dist/src/utils/safe-fs.js +56 -0
- package/dist/src/utils/safe-json-parse.d.ts +15 -0
- package/dist/src/utils/safe-json-parse.js +49 -0
- package/dist/src/utils/sanitize.d.ts +14 -0
- package/dist/src/utils/sanitize.js +186 -0
- package/dist/src/utils/semaphore.d.ts +22 -0
- package/dist/src/utils/semaphore.js +57 -0
- package/dist/src/utils/shutdown.d.ts +6 -0
- package/dist/src/utils/shutdown.js +51 -0
- package/dist/src/utils/tty.d.ts +5 -0
- package/dist/src/utils/tty.js +7 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# MAGI System
|
|
2
|
+
|
|
3
|
+
> English | **[日本語](./README.ja.md)**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/ryu-tada/MAGI-system/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](./test/)
|
|
9
|
+
[](#soul-system--20-subsystems-that-give-magi-a-soul)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
|
|
12
|
+
**When one AI isn't enough** — Three AI models debate, cross-examine, and vote. Catch what a single model misses.
|
|
13
|
+
|
|
14
|
+
> *Unofficial fan project inspired by Neon Genesis Evangelion. Not affiliated with Khara, Inc.*
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<img src="docs/demo.gif" alt="MAGI System Demo — Evangelion TUI deliberation" width="700">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
## Try It in 60 Seconds
|
|
21
|
+
|
|
22
|
+
No API keys needed. Watch a pre-recorded 3-body deliberation with the Evangelion TUI:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx magi-ai demo
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Ready to deliberate for real? See [Quick Start](#quick-start).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Why Multi-AI Consensus?
|
|
33
|
+
|
|
34
|
+
Every AI model has blind spots. Claude is thorough but verbose. GPT is practical but sometimes overconfident. Gemini is cautious but can be vague. **Using any single model means inheriting its biases undetected.**
|
|
35
|
+
|
|
36
|
+
MAGI forces disagreement to surface. When three models independently analyze the same code and two flag a security issue that the third missed, you know the issue is real. When all three agree, you can act with higher confidence than any single review provides.
|
|
37
|
+
|
|
38
|
+
| Single-model review | MAGI 3-body review |
|
|
39
|
+
|---------------------|--------------------|
|
|
40
|
+
| One perspective, one bias | Three perspectives, biases cancel out |
|
|
41
|
+
| "Looks good to me" | 2/3 APPROVE, 1 REJECT (dissent recorded) |
|
|
42
|
+
| You trust the model | The models verify each other |
|
|
43
|
+
| Silent failures | Cross-examination catches oversights |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## What is MAGI?
|
|
48
|
+
|
|
49
|
+
In *Neon Genesis Evangelion*, the MAGI supercomputer consists of three systems, each imprinted with a different aspect of Dr. Naoko Akagi's personality, making decisions through collective deliberation.
|
|
50
|
+
|
|
51
|
+
This project recreates that architecture: three AI models from different providers analyze the same problem from distinct perspectives. Cross-validation between models eliminates provider-specific biases, achieving judgment quality that no single model can reach alone.
|
|
52
|
+
|
|
53
|
+
| MAGI Unit | CLI Tool | Persona | Focus |
|
|
54
|
+
|-----------|----------|---------|-------|
|
|
55
|
+
| **MELCHIOR-1** | Claude Code (Anthropic) | Scientist | Logic, consistency, structured reasoning |
|
|
56
|
+
| **BALTHASAR-2** | Codex CLI (OpenAI) | Engineer | Practicality, code quality |
|
|
57
|
+
| **CASPER-3** | Gemini CLI (Google) | Auditor | Safety, risk, holistic perspective |
|
|
58
|
+
|
|
59
|
+
> **N-body support**: Defaults to 3 units, but supports 2-7 arbitrary AI units for deliberation.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## How It Works
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Phase 1: INITIAL OPINION (parallel)
|
|
67
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
68
|
+
│ MELCHIOR │ │ BALTHASAR │ │ CASPER │
|
|
69
|
+
│ (Claude) │ │ (Codex) │ │ (Gemini) │
|
|
70
|
+
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
|
|
71
|
+
└────── Promise.allSettled() ─────┘
|
|
72
|
+
│
|
|
73
|
+
Early exit if unanimous
|
|
74
|
+
│
|
|
75
|
+
Phase 2: CROSS-EXAMINATION (parallel)
|
|
76
|
+
Each unit critiques the other two — may change position
|
|
77
|
+
│
|
|
78
|
+
Phase 3: FINAL VOTE (parallel)
|
|
79
|
+
Final vote informed by full deliberation history → Consensus Engine decides
|
|
80
|
+
│
|
|
81
|
+
┌───────▼───────┐
|
|
82
|
+
│ MAGI DECISION │
|
|
83
|
+
└───────────────┘
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
| Decision | Condition | Outcome |
|
|
87
|
+
|----------|-----------|---------|
|
|
88
|
+
| **Unanimous** | 3/3 agree | Immediate adoption |
|
|
89
|
+
| **Majority** | 2/3 agree | Adopted (dissent recorded) |
|
|
90
|
+
| **Deadlock** | All disagree | Tiebreak / Human-in-the-loop |
|
|
91
|
+
| **No quorum** | 2+ ABSTAIN | Unable to decide |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Use Cases
|
|
96
|
+
|
|
97
|
+
| Scenario | Command | What MAGI adds |
|
|
98
|
+
|----------|---------|----------------|
|
|
99
|
+
| PR code review | `magi review src/auth.ts` | 3 models catch different bug classes |
|
|
100
|
+
| Architecture decision | `magi decide "PostgreSQL vs MongoDB?"` | Structured pros/cons from 3 perspectives |
|
|
101
|
+
| Security audit | `magi deliberate "Audit this endpoint"` | Cross-validation reduces false negatives |
|
|
102
|
+
| Technical debt assessment | `/ops prophecy src/legacy/` | Random forest prediction from git history |
|
|
103
|
+
| CI/CD gate | `magi review --output json` | Machine-readable consensus for merge gates |
|
|
104
|
+
| Team tie-breaking | `magi decide "Monorepo migration?"` | Objective multi-perspective arbitration |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Quick Start
|
|
109
|
+
|
|
110
|
+
### Prerequisites
|
|
111
|
+
|
|
112
|
+
- **Node.js v24+** (v20+ minimum)
|
|
113
|
+
- The following 3 AI CLIs installed and authenticated:
|
|
114
|
+
|
|
115
|
+
<details>
|
|
116
|
+
<summary><strong>Claude Code</strong> — MELCHIOR (Anthropic)</summary>
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Install (either one)
|
|
120
|
+
curl -fsSL https://claude.ai/install.sh | bash # Recommended
|
|
121
|
+
npm install -g @anthropic-ai/claude-code # Via Node.js
|
|
122
|
+
|
|
123
|
+
# Auth — browser authentication opens on first launch
|
|
124
|
+
claude
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Requires a paid plan (Pro / Max / Teams / Enterprise). → [Official docs](https://docs.anthropic.com/en/docs/claude-code)
|
|
128
|
+
|
|
129
|
+
</details>
|
|
130
|
+
|
|
131
|
+
<details>
|
|
132
|
+
<summary><strong>Codex CLI</strong> — BALTHASAR (OpenAI)</summary>
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Install
|
|
136
|
+
npm install -g @openai/codex
|
|
137
|
+
|
|
138
|
+
# Auth — setup wizard starts on first launch
|
|
139
|
+
codex
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Requires a ChatGPT subscription (Plus / Pro / Team / Enterprise). → [Official repo](https://github.com/openai/codex)
|
|
143
|
+
|
|
144
|
+
</details>
|
|
145
|
+
|
|
146
|
+
<details>
|
|
147
|
+
<summary><strong>Gemini CLI</strong> — CASPER (Google)</summary>
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Install
|
|
151
|
+
npm install -g @google/gemini-cli
|
|
152
|
+
|
|
153
|
+
# Auth — select "Sign in with Google" on first launch
|
|
154
|
+
gemini
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Free with a Google account (60 req/min, 1,000 req/day). → [Official repo](https://github.com/google-gemini/gemini-cli)
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
### Install
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm install -g magi-ai
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Verify
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
magi doctor
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
✓ MELCHIOR: 2.x.x (Claude Code)
|
|
175
|
+
✓ BALTHASAR: codex-cli 0.x.x
|
|
176
|
+
✓ CASPER: 0.x.x
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Start
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
magi
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Usage
|
|
188
|
+
|
|
189
|
+
On launch, a NERV boot sequence plays and the interactive REPL starts. Type a question in natural language and a 3-body deliberation begins, with the full-screen TUI showing the process in real time.
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
╔════════════════════════════════════════════╗
|
|
193
|
+
║ M A G I S Y S T E M ║
|
|
194
|
+
║ REPL INTERFACE READY ║
|
|
195
|
+
╚════════════════════════════════════════════╝
|
|
196
|
+
Type a question to deliberate. /help for commands.
|
|
197
|
+
|
|
198
|
+
MAGI[01|NORM|3/3|CTX:0]> Should we mass-adopt this new ORM?
|
|
199
|
+
[Full-screen TUI → NERV boot → 3-body deliberation → result]
|
|
200
|
+
|
|
201
|
+
╔═══════════════════════════════════════════════╗
|
|
202
|
+
║ MAGI DECISION: MAJORITY_APPROVE CONF 82% ║
|
|
203
|
+
╠═══════════════════════════════════════════════╣
|
|
204
|
+
║ MELCHIOR ✓ APPROVE ████████░░ 84% ║
|
|
205
|
+
║ BALTHASAR ✓ APPROVE ██████████ 95% ║
|
|
206
|
+
║ CASPER ✗ REJECT ██████░░░░ 67% ║
|
|
207
|
+
╚═══════════════════════════════════════════════╝
|
|
208
|
+
|
|
209
|
+
MAGI[02|NORM|3/3|CTX:1]> Can you elaborate on the risks?
|
|
210
|
+
[Re-deliberation with previous context auto-injected]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Type any question to start deliberation. Slash commands provide specialized operations:
|
|
214
|
+
|
|
215
|
+
| Command | Action |
|
|
216
|
+
|---------|--------|
|
|
217
|
+
| `/review <file>` | Code review deliberation (Tab completion) |
|
|
218
|
+
| `/decide <question>` | Architecture decision |
|
|
219
|
+
| `/berserk <prompt>` | BERSERK mode (5 strategies x N units deathmatch) |
|
|
220
|
+
| `/status` | System dashboard |
|
|
221
|
+
| `/export [file]` | Export deliberation results |
|
|
222
|
+
| `/ops watch start` | Start Angel detection daemon |
|
|
223
|
+
| `/diag evolve` | S² Engine self-evolution |
|
|
224
|
+
| `/admin self-destruct <reason>` | Self-destruct sequence (unanimous required) |
|
|
225
|
+
| `/help` | Full command list |
|
|
226
|
+
|
|
227
|
+
**Context persistence:** The last 5 deliberation summaries are retained and automatically injected into follow-up questions. Project context (git status, package.json, related files) is also auto-collected.
|
|
228
|
+
|
|
229
|
+
### MCP Server (Claude Code Integration)
|
|
230
|
+
|
|
231
|
+
An `.mcp.json` is included at the repo root. Restart Claude Code and the 4 tools (`magi_deliberate`, `magi_review`, `magi_decide`, `magi_doctor`) become available automatically. Verify with MCP Inspector: `npx @modelcontextprotocol/inspector magi-mcp`
|
|
232
|
+
|
|
233
|
+
### Programmatic API
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { Magi } from 'magi-ai';
|
|
237
|
+
|
|
238
|
+
const magi = new Magi();
|
|
239
|
+
const result = await magi.deliberate({
|
|
240
|
+
type: 'code-review',
|
|
241
|
+
title: 'Review auth middleware',
|
|
242
|
+
artifacts: [{ type: 'file', path: 'src/auth.ts', content: '...', language: 'typescript' }],
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
console.log(result.consensus.decision); // => 'MAJORITY_APPROVE'
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
> Non-interactive commands (`magi deliberate`, `magi review`, `magi decide`) are also available for CI/scripts. See `magi --help`.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Features
|
|
253
|
+
|
|
254
|
+
### Evangelion TUI
|
|
255
|
+
|
|
256
|
+
An Evangelion-themed full-screen interface launches by default. From the NERV boot sequence to the inverted-Y 3-panel vote visualization, it faithfully recreates the feel of the original. Zero additional dependencies (raw ANSI + chalk).
|
|
257
|
+
|
|
258
|
+
- NERV boot sequence (~1.5s)
|
|
259
|
+
- Inverted-Y panels — BALTHASAR (top center), CASPER (bottom left), MELCHIOR (bottom right)
|
|
260
|
+
- Breathing animation — panel borders pulse on a sin() curve while thinking
|
|
261
|
+
- Cascading vote reveal + decision stamps
|
|
262
|
+
- BERSERK flash — red flash on berserk warning
|
|
263
|
+
- Detail overlay — press `1`/`2`/`3` to view per-unit reasoning
|
|
264
|
+
|
|
265
|
+
### Soul System — 20 Subsystems That Give MAGI a Soul
|
|
266
|
+
|
|
267
|
+
20 subsystems that map Evangelion lore into technically meaningful features:
|
|
268
|
+
|
|
269
|
+
- **Memory & Personality (EngRam)** — TF-IDF similarity search, 3-layer memory, 12-dim drift detection
|
|
270
|
+
- **Sync Rate** — Beta-distribution Bayesian estimation for task-fitness tracking
|
|
271
|
+
- **A.T. Field** — Quantitative groupthink bias detection and neutralization
|
|
272
|
+
- **BERSERK Mode** — 5 strategies x N units in parallel, fitness-based selection deathmatch
|
|
273
|
+
- **Instrumentality** — MoA weighted reasoning fusion for deadlock resolution
|
|
274
|
+
- **LCL** — Phase-based information density control + 4-type hallucination detection/purification
|
|
275
|
+
- **Angel Detection** — Git-diff-based 6-type code threat pattern detection
|
|
276
|
+
- **Dead Sea Scrolls** — Random forest (50 trees) technical debt prediction
|
|
277
|
+
- **Type-666 Firewall** — 4-layer defense-in-depth firewall
|
|
278
|
+
- **Self-Destruct Sequence** — BFT f=0 unanimous irreversible operation ritual
|
|
279
|
+
- **S² Engine** — Self-diagnosis, improvement proposals, meta-deliberation self-evolution
|
|
280
|
+
- **SEELE Council** — PBFT+Raft distributed consensus protocol
|
|
281
|
+
- **Neon Genesis** — Fisher-Yates memory survival full reset
|
|
282
|
+
|
|
283
|
+
### Security
|
|
284
|
+
|
|
285
|
+
9-layer security hardening: Zod schema input validation → prompt injection prevention (9 patterns) → stdin delivery + dangerous flag detection → process sandbox (ENV/CMD allowlist) → SafeOpinionSchema output validation → SHA-256 hash-chain audit log → semaphore + timeouts → replay prevention nonce → random-salt encryption
|
|
286
|
+
|
|
287
|
+
### Auto-Context Collection
|
|
288
|
+
|
|
289
|
+
Automatically collects and injects project context (git status, package.json, directory tree) and related files (imports, test files) during deliberation. Opt out with `--no-auto-context`. Sensitive files (.env, .key, credentials, etc.) are excluded automatically.
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Architecture
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
MAGI-system/
|
|
297
|
+
├── bin/ # CLI entry points (magi, magi-mcp, magi-benchmark)
|
|
298
|
+
├── src/
|
|
299
|
+
│ ├── index.ts # Public API (Magi class)
|
|
300
|
+
│ ├── types/ # TypeScript types & Zod schemas
|
|
301
|
+
│ ├── adapters/ # CLI wrappers (claude, codex, gemini)
|
|
302
|
+
│ ├── engine/ # Core deliberation (kernel, consensus, middleware)
|
|
303
|
+
│ │ ├── kernel/ # Deliberation loop, phase runner, unit executor
|
|
304
|
+
│ │ └── middleware/ # Koa-style chain (cache, firewall)
|
|
305
|
+
│ ├── parsers/ # Opinion extraction (JSON extractor, Zod schema, unstructured)
|
|
306
|
+
│ ├── pipelines/ # Task-specific flows (code-review, architecture, bug-analysis)
|
|
307
|
+
│ ├── tui/ # Evangelion full-screen TUI (raw ANSI, double-buffered)
|
|
308
|
+
│ ├── repl/ # Interactive REPL (19 slash commands, state machine)
|
|
309
|
+
│ ├── mcp/ # MCP server (4 tools, stdio transport)
|
|
310
|
+
│ ├── context/ # Auto-context collection (git, imports, tests)
|
|
311
|
+
│ ├── cache/ # SHA-256 keyed result cache with TTL
|
|
312
|
+
│ ├── metrics/ # Token usage tracking
|
|
313
|
+
│ ├── audit/ # SHA-256 hash chain audit logging
|
|
314
|
+
│ └── utils/ # Shared utilities (process sandbox, file validation)
|
|
315
|
+
├── test/ # 2135 tests (vitest)
|
|
316
|
+
│ ├── e2e/ # E2E with real CLIs (MAGI_E2E=1 gated)
|
|
317
|
+
│ ├── integration/ # Orchestrator + TUI integration
|
|
318
|
+
│ └── unit/ # Per-module unit tests
|
|
319
|
+
└── docs/ # User-facing documentation
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Development
|
|
325
|
+
|
|
326
|
+
To develop from source:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
git clone https://github.com/ryu-tada/MAGI-system.git
|
|
330
|
+
cd MAGI-system
|
|
331
|
+
npm install
|
|
332
|
+
npm test # 2135 tests
|
|
333
|
+
npm run typecheck # Type check
|
|
334
|
+
npm run build # Build
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Documentation
|
|
340
|
+
|
|
341
|
+
- [Practical Examples](docs/EXAMPLES.md) — 8 scenarios with commands and expected output
|
|
342
|
+
- [Tuning Guide](docs/TUNING_GUIDE.md) — Configuration reference and optimization strategies
|
|
343
|
+
- [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and solutions
|
|
344
|
+
- [Benchmark Results](docs/BENCHMARK_RESULTS.md) — Scoring framework validation (run with real CLIs for production data)
|
|
345
|
+
- [Contributing](CONTRIBUTING.md) — Development setup, adding adapters/pipelines
|
|
346
|
+
- [Changelog](CHANGELOG.md) — Release history
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Tech Stack
|
|
351
|
+
|
|
352
|
+
- **Language**: TypeScript (ESM)
|
|
353
|
+
- **Runtime**: Node.js v24+ (v20+ minimum)
|
|
354
|
+
- **Dependencies**: commander, chalk, zod, @modelcontextprotocol/sdk
|
|
355
|
+
- **Test**: Vitest (2135 tests)
|
|
356
|
+
- **Dev**: tsx
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Credits & Legal
|
|
361
|
+
|
|
362
|
+
> "The MAGI's answer is — unanimous."
|
|
363
|
+
> — Ritsuko Akagi, *Neon Genesis Evangelion*
|
|
364
|
+
|
|
365
|
+
MAGI System is inspired by the MAGI supercomputer system from *Neon Genesis Evangelion*, created by Hideaki Anno and produced by Gainax / Khara, Inc.
|
|
366
|
+
|
|
367
|
+
### Disclaimer
|
|
368
|
+
|
|
369
|
+
This is an **unofficial, non-commercial, fan-made** open-source project. It is not affiliated with, endorsed by, or connected to Khara, Inc. or any official Evangelion production.
|
|
370
|
+
|
|
371
|
+
*Neon Genesis Evangelion* and related names are copyrighted works of Khara, Inc. All rights reserved by their respective owners.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## License
|
|
376
|
+
|
|
377
|
+
MIT — See [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MAGI Benchmark CLI
|
|
4
|
+
*
|
|
5
|
+
* Runs golden-task benchmarks comparing single-Claude vs MAGI 3-body deliberation.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx tsx bin/magi-benchmark.ts # Full benchmark
|
|
9
|
+
* npx tsx bin/magi-benchmark.ts --dry-run # MockAdapter dry-run
|
|
10
|
+
* npx tsx bin/magi-benchmark.ts --single-only # Single Claude only
|
|
11
|
+
* npx tsx bin/magi-benchmark.ts --magi-only # MAGI 3-body only
|
|
12
|
+
* npx tsx bin/magi-benchmark.ts --category security # Category filter
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MAGI Benchmark CLI
|
|
4
|
+
*
|
|
5
|
+
* Runs golden-task benchmarks comparing single-Claude vs MAGI 3-body deliberation.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx tsx bin/magi-benchmark.ts # Full benchmark
|
|
9
|
+
* npx tsx bin/magi-benchmark.ts --dry-run # MockAdapter dry-run
|
|
10
|
+
* npx tsx bin/magi-benchmark.ts --single-only # Single Claude only
|
|
11
|
+
* npx tsx bin/magi-benchmark.ts --magi-only # MAGI 3-body only
|
|
12
|
+
* npx tsx bin/magi-benchmark.ts --category security # Category filter
|
|
13
|
+
*/
|
|
14
|
+
import { Command } from 'commander';
|
|
15
|
+
import chalk from 'chalk';
|
|
16
|
+
import { BenchmarkRunner } from '../src/benchmark/runner.js';
|
|
17
|
+
import { GOLDEN_TASKS } from '../src/benchmark/golden-tasks.js';
|
|
18
|
+
const program = new Command();
|
|
19
|
+
program
|
|
20
|
+
.name('magi-benchmark')
|
|
21
|
+
.description('Run MAGI quality benchmarks against golden tasks')
|
|
22
|
+
.option('--dry-run', 'Use MockAdapters for scoring logic validation')
|
|
23
|
+
.option('--single-only', 'Run single-Claude benchmark only')
|
|
24
|
+
.option('--magi-only', 'Run MAGI 3-body benchmark only')
|
|
25
|
+
.option('--category <name>', 'Filter by category (code-review|architecture|bug-analysis|security)')
|
|
26
|
+
.option('--output-dir <path>', 'Output directory for result JSON files')
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
const categories = new Set(GOLDEN_TASKS.map(t => t.category));
|
|
29
|
+
if (opts.category && !categories.has(opts.category)) {
|
|
30
|
+
console.error(chalk.red(`Unknown category: ${opts.category}`));
|
|
31
|
+
console.error(`Available: ${[...categories].join(', ')}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const runner = new BenchmarkRunner({
|
|
35
|
+
dryRun: opts.dryRun,
|
|
36
|
+
singleOnly: opts.singleOnly,
|
|
37
|
+
magiOnly: opts.magiOnly,
|
|
38
|
+
category: opts.category,
|
|
39
|
+
outputDir: opts.outputDir,
|
|
40
|
+
});
|
|
41
|
+
const taskCount = opts.category
|
|
42
|
+
? GOLDEN_TASKS.filter(t => t.category === opts.category).length
|
|
43
|
+
: GOLDEN_TASKS.length;
|
|
44
|
+
console.log(chalk.cyan('━'.repeat(60)));
|
|
45
|
+
console.log(chalk.cyan.bold(' MAGI Benchmark'));
|
|
46
|
+
console.log(chalk.cyan('━'.repeat(60)));
|
|
47
|
+
console.log(` Tasks: ${taskCount}`);
|
|
48
|
+
console.log(` Mode: ${opts.dryRun ? 'dry-run (MockAdapter)' : 'real CLI'}`);
|
|
49
|
+
if (opts.singleOnly)
|
|
50
|
+
console.log(' Scope: single-Claude only');
|
|
51
|
+
if (opts.magiOnly)
|
|
52
|
+
console.log(' Scope: MAGI 3-body only');
|
|
53
|
+
if (opts.category)
|
|
54
|
+
console.log(` Filter: ${opts.category}`);
|
|
55
|
+
console.log(chalk.cyan('━'.repeat(60)));
|
|
56
|
+
console.log();
|
|
57
|
+
try {
|
|
58
|
+
const { single, magi } = await runner.runAll();
|
|
59
|
+
if (single) {
|
|
60
|
+
console.log(chalk.yellow('── Single Claude ──'));
|
|
61
|
+
console.log(` Weighted Score: ${pct(single.aggregate.weightedScore)}`);
|
|
62
|
+
console.log(` Vote Accuracy: ${pct(single.aggregate.voteAccuracy)}`);
|
|
63
|
+
console.log(` Detection Coverage: ${pct(single.aggregate.detectionCoverage)}`);
|
|
64
|
+
console.log(` Avg Duration: ${Math.round(single.aggregate.avgDurationMs)}ms`);
|
|
65
|
+
console.log();
|
|
66
|
+
}
|
|
67
|
+
if (magi) {
|
|
68
|
+
console.log(chalk.green('── MAGI 3-Body ──'));
|
|
69
|
+
console.log(` Weighted Score: ${pct(magi.aggregate.weightedScore)}`);
|
|
70
|
+
console.log(` Vote Accuracy: ${pct(magi.aggregate.voteAccuracy)}`);
|
|
71
|
+
console.log(` Detection Coverage: ${pct(magi.aggregate.detectionCoverage)}`);
|
|
72
|
+
console.log(` Avg Duration: ${Math.round(magi.aggregate.avgDurationMs)}ms`);
|
|
73
|
+
console.log();
|
|
74
|
+
}
|
|
75
|
+
if (single && magi) {
|
|
76
|
+
const delta = magi.aggregate.weightedScore - single.aggregate.weightedScore;
|
|
77
|
+
const sign = delta >= 0 ? '+' : '';
|
|
78
|
+
const color = delta >= 0 ? chalk.green : chalk.red;
|
|
79
|
+
console.log(color(` Delta (MAGI - Single): ${sign}${(delta * 100).toFixed(1)}pp`));
|
|
80
|
+
console.log();
|
|
81
|
+
}
|
|
82
|
+
console.log(chalk.gray('Report saved to docs/BENCHMARK_RESULTS.md'));
|
|
83
|
+
console.log(chalk.gray('Result JSON saved to test/benchmark/results/'));
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
console.error(chalk.red('Benchmark failed:'), err);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
program.parse();
|
|
91
|
+
function pct(value) {
|
|
92
|
+
return `${(value * 100).toFixed(1)}%`;
|
|
93
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MAGI MCP Server — stdio transport entry point
|
|
4
|
+
*
|
|
5
|
+
* Prevents stdout pollution from libraries (ora, chalk, etc.)
|
|
6
|
+
* so only MCP JSON-RPC frames appear on stdout.
|
|
7
|
+
*/
|
|
8
|
+
// Layer 1: Redirect console.log/info to stderr before any imports
|
|
9
|
+
console.log = (...args) => console.error(...args);
|
|
10
|
+
console.info = (...args) => console.error(...args);
|
|
11
|
+
// Layer 2: Environment variables to suppress color/spinner output
|
|
12
|
+
process.env['NO_COLOR'] = '1';
|
|
13
|
+
process.env['FORCE_COLOR'] = '0';
|
|
14
|
+
process.env['CI'] = '1';
|
|
15
|
+
// Layer 3: Safety flag for future use
|
|
16
|
+
process.env['MAGI_MCP_MODE'] = '1';
|
|
17
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
18
|
+
import { createMagiMcpServer } from '../src/mcp/server.js';
|
|
19
|
+
async function main() {
|
|
20
|
+
const server = createMagiMcpServer();
|
|
21
|
+
const transport = new StdioServerTransport();
|
|
22
|
+
await server.connect(transport);
|
|
23
|
+
console.error('[magi-mcp] Server started on stdio');
|
|
24
|
+
}
|
|
25
|
+
main().catch((error) => {
|
|
26
|
+
console.error('[magi-mcp] Fatal error:', error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|