genesis-ai-cli 7.4.5
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/.env.example +78 -0
- package/README.md +282 -0
- package/dist/src/active-inference/actions.d.ts +75 -0
- package/dist/src/active-inference/actions.js +250 -0
- package/dist/src/active-inference/autonomous-loop.d.ts +103 -0
- package/dist/src/active-inference/autonomous-loop.js +289 -0
- package/dist/src/active-inference/core.d.ts +85 -0
- package/dist/src/active-inference/core.js +555 -0
- package/dist/src/active-inference/demo-autonomous-loop.d.ts +8 -0
- package/dist/src/active-inference/demo-autonomous-loop.js +338 -0
- package/dist/src/active-inference/demo-value-integration.d.ts +8 -0
- package/dist/src/active-inference/demo-value-integration.js +174 -0
- package/dist/src/active-inference/index.d.ts +32 -0
- package/dist/src/active-inference/index.js +88 -0
- package/dist/src/active-inference/integration.d.ts +114 -0
- package/dist/src/active-inference/integration.js +698 -0
- package/dist/src/active-inference/memory-integration.d.ts +51 -0
- package/dist/src/active-inference/memory-integration.js +232 -0
- package/dist/src/active-inference/observations.d.ts +67 -0
- package/dist/src/active-inference/observations.js +147 -0
- package/dist/src/active-inference/test-active-inference.d.ts +8 -0
- package/dist/src/active-inference/test-active-inference.js +320 -0
- package/dist/src/active-inference/test-value-integration.d.ts +6 -0
- package/dist/src/active-inference/test-value-integration.js +168 -0
- package/dist/src/active-inference/types.d.ts +150 -0
- package/dist/src/active-inference/types.js +59 -0
- package/dist/src/active-inference/value-integration.d.ts +164 -0
- package/dist/src/active-inference/value-integration.js +459 -0
- package/dist/src/agents/base-agent.d.ts +53 -0
- package/dist/src/agents/base-agent.js +178 -0
- package/dist/src/agents/builder.d.ts +67 -0
- package/dist/src/agents/builder.js +537 -0
- package/dist/src/agents/critic.d.ts +35 -0
- package/dist/src/agents/critic.js +322 -0
- package/dist/src/agents/ethicist.d.ts +54 -0
- package/dist/src/agents/ethicist.js +393 -0
- package/dist/src/agents/explorer.d.ts +26 -0
- package/dist/src/agents/explorer.js +216 -0
- package/dist/src/agents/feeling.d.ts +41 -0
- package/dist/src/agents/feeling.js +320 -0
- package/dist/src/agents/index.d.ts +111 -0
- package/dist/src/agents/index.js +222 -0
- package/dist/src/agents/memory.d.ts +69 -0
- package/dist/src/agents/memory.js +404 -0
- package/dist/src/agents/message-bus.d.ts +88 -0
- package/dist/src/agents/message-bus.js +267 -0
- package/dist/src/agents/narrator.d.ts +90 -0
- package/dist/src/agents/narrator.js +473 -0
- package/dist/src/agents/planner.d.ts +38 -0
- package/dist/src/agents/planner.js +341 -0
- package/dist/src/agents/predictor.d.ts +73 -0
- package/dist/src/agents/predictor.js +506 -0
- package/dist/src/agents/sensor.d.ts +88 -0
- package/dist/src/agents/sensor.js +377 -0
- package/dist/src/agents/test-agents.d.ts +6 -0
- package/dist/src/agents/test-agents.js +73 -0
- package/dist/src/agents/types.d.ts +194 -0
- package/dist/src/agents/types.js +7 -0
- package/dist/src/brain/index.d.ts +185 -0
- package/dist/src/brain/index.js +843 -0
- package/dist/src/brain/trace.d.ts +91 -0
- package/dist/src/brain/trace.js +327 -0
- package/dist/src/brain/types.d.ts +165 -0
- package/dist/src/brain/types.js +51 -0
- package/dist/src/cli/chat.d.ts +237 -0
- package/dist/src/cli/chat.js +1959 -0
- package/dist/src/cli/dispatcher.d.ts +182 -0
- package/dist/src/cli/dispatcher.js +718 -0
- package/dist/src/cli/human-loop.d.ts +170 -0
- package/dist/src/cli/human-loop.js +543 -0
- package/dist/src/cli/index.d.ts +12 -0
- package/dist/src/cli/index.js +28 -0
- package/dist/src/cli/interactive.d.ts +141 -0
- package/dist/src/cli/interactive.js +757 -0
- package/dist/src/cli/ui.d.ts +205 -0
- package/dist/src/cli/ui.js +632 -0
- package/dist/src/consciousness/attention-schema.d.ts +154 -0
- package/dist/src/consciousness/attention-schema.js +432 -0
- package/dist/src/consciousness/global-workspace.d.ts +149 -0
- package/dist/src/consciousness/global-workspace.js +422 -0
- package/dist/src/consciousness/index.d.ts +186 -0
- package/dist/src/consciousness/index.js +476 -0
- package/dist/src/consciousness/phi-calculator.d.ts +119 -0
- package/dist/src/consciousness/phi-calculator.js +445 -0
- package/dist/src/consciousness/phi-decisions.d.ts +169 -0
- package/dist/src/consciousness/phi-decisions.js +383 -0
- package/dist/src/consciousness/phi-monitor.d.ts +153 -0
- package/dist/src/consciousness/phi-monitor.js +465 -0
- package/dist/src/consciousness/types.d.ts +260 -0
- package/dist/src/consciousness/types.js +44 -0
- package/dist/src/daemon/dream-mode.d.ts +115 -0
- package/dist/src/daemon/dream-mode.js +470 -0
- package/dist/src/daemon/index.d.ts +162 -0
- package/dist/src/daemon/index.js +542 -0
- package/dist/src/daemon/maintenance.d.ts +139 -0
- package/dist/src/daemon/maintenance.js +549 -0
- package/dist/src/daemon/process.d.ts +82 -0
- package/dist/src/daemon/process.js +442 -0
- package/dist/src/daemon/scheduler.d.ts +90 -0
- package/dist/src/daemon/scheduler.js +494 -0
- package/dist/src/daemon/types.d.ts +213 -0
- package/dist/src/daemon/types.js +50 -0
- package/dist/src/epistemic/index.d.ts +74 -0
- package/dist/src/epistemic/index.js +225 -0
- package/dist/src/grounding/epistemic-stack.d.ts +100 -0
- package/dist/src/grounding/epistemic-stack.js +408 -0
- package/dist/src/grounding/feedback.d.ts +98 -0
- package/dist/src/grounding/feedback.js +276 -0
- package/dist/src/grounding/index.d.ts +123 -0
- package/dist/src/grounding/index.js +224 -0
- package/dist/src/grounding/verifier.d.ts +149 -0
- package/dist/src/grounding/verifier.js +484 -0
- package/dist/src/healing/detector.d.ts +110 -0
- package/dist/src/healing/detector.js +436 -0
- package/dist/src/healing/fixer.d.ts +138 -0
- package/dist/src/healing/fixer.js +572 -0
- package/dist/src/healing/index.d.ts +23 -0
- package/dist/src/healing/index.js +43 -0
- package/dist/src/hooks/index.d.ts +135 -0
- package/dist/src/hooks/index.js +317 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.js +1266 -0
- package/dist/src/kernel/index.d.ts +155 -0
- package/dist/src/kernel/index.js +795 -0
- package/dist/src/kernel/invariants.d.ts +153 -0
- package/dist/src/kernel/invariants.js +355 -0
- package/dist/src/kernel/test-kernel.d.ts +6 -0
- package/dist/src/kernel/test-kernel.js +108 -0
- package/dist/src/kernel/test-real-mcp.d.ts +10 -0
- package/dist/src/kernel/test-real-mcp.js +295 -0
- package/dist/src/llm/index.d.ts +146 -0
- package/dist/src/llm/index.js +428 -0
- package/dist/src/llm/router.d.ts +136 -0
- package/dist/src/llm/router.js +510 -0
- package/dist/src/mcp/index.d.ts +85 -0
- package/dist/src/mcp/index.js +657 -0
- package/dist/src/mcp/resilient.d.ts +139 -0
- package/dist/src/mcp/resilient.js +417 -0
- package/dist/src/memory/cache.d.ts +118 -0
- package/dist/src/memory/cache.js +356 -0
- package/dist/src/memory/cognitive-workspace.d.ts +231 -0
- package/dist/src/memory/cognitive-workspace.js +521 -0
- package/dist/src/memory/consolidation.d.ts +99 -0
- package/dist/src/memory/consolidation.js +443 -0
- package/dist/src/memory/episodic.d.ts +114 -0
- package/dist/src/memory/episodic.js +394 -0
- package/dist/src/memory/forgetting.d.ts +134 -0
- package/dist/src/memory/forgetting.js +324 -0
- package/dist/src/memory/index.d.ts +211 -0
- package/dist/src/memory/index.js +367 -0
- package/dist/src/memory/indexer.d.ts +123 -0
- package/dist/src/memory/indexer.js +479 -0
- package/dist/src/memory/procedural.d.ts +136 -0
- package/dist/src/memory/procedural.js +479 -0
- package/dist/src/memory/semantic.d.ts +132 -0
- package/dist/src/memory/semantic.js +497 -0
- package/dist/src/memory/types.d.ts +193 -0
- package/dist/src/memory/types.js +15 -0
- package/dist/src/orchestrator.d.ts +65 -0
- package/dist/src/orchestrator.js +317 -0
- package/dist/src/persistence/index.d.ts +257 -0
- package/dist/src/persistence/index.js +763 -0
- package/dist/src/pipeline/executor.d.ts +51 -0
- package/dist/src/pipeline/executor.js +695 -0
- package/dist/src/pipeline/index.d.ts +7 -0
- package/dist/src/pipeline/index.js +11 -0
- package/dist/src/self-production.d.ts +67 -0
- package/dist/src/self-production.js +205 -0
- package/dist/src/subagents/executor.d.ts +58 -0
- package/dist/src/subagents/executor.js +283 -0
- package/dist/src/subagents/index.d.ts +37 -0
- package/dist/src/subagents/index.js +53 -0
- package/dist/src/subagents/registry.d.ts +23 -0
- package/dist/src/subagents/registry.js +167 -0
- package/dist/src/subagents/types.d.ts +79 -0
- package/dist/src/subagents/types.js +14 -0
- package/dist/src/tools/bash.d.ts +139 -0
- package/dist/src/tools/bash.js +583 -0
- package/dist/src/tools/edit.d.ts +125 -0
- package/dist/src/tools/edit.js +424 -0
- package/dist/src/tools/git.d.ts +179 -0
- package/dist/src/tools/git.js +504 -0
- package/dist/src/tools/index.d.ts +21 -0
- package/dist/src/tools/index.js +163 -0
- package/dist/src/types.d.ts +145 -0
- package/dist/src/types.js +7 -0
- package/dist/src/world-model/decoder.d.ts +163 -0
- package/dist/src/world-model/decoder.js +517 -0
- package/dist/src/world-model/digital-twin.d.ts +219 -0
- package/dist/src/world-model/digital-twin.js +695 -0
- package/dist/src/world-model/encoder.d.ts +141 -0
- package/dist/src/world-model/encoder.js +564 -0
- package/dist/src/world-model/index.d.ts +221 -0
- package/dist/src/world-model/index.js +772 -0
- package/dist/src/world-model/predictor.d.ts +161 -0
- package/dist/src/world-model/predictor.js +681 -0
- package/dist/src/world-model/test-value-jepa.d.ts +8 -0
- package/dist/src/world-model/test-value-jepa.js +430 -0
- package/dist/src/world-model/types.d.ts +341 -0
- package/dist/src/world-model/types.js +69 -0
- package/dist/src/world-model/value-jepa.d.ts +247 -0
- package/dist/src/world-model/value-jepa.js +622 -0
- package/dist/test/brain.test.d.ts +11 -0
- package/dist/test/brain.test.js +358 -0
- package/dist/test/cli/dispatcher.test.d.ts +4 -0
- package/dist/test/cli/dispatcher.test.js +332 -0
- package/dist/test/cli/human-loop.test.d.ts +4 -0
- package/dist/test/cli/human-loop.test.js +270 -0
- package/dist/test/grounding/feedback.test.d.ts +4 -0
- package/dist/test/grounding/feedback.test.js +462 -0
- package/dist/test/grounding/verifier.test.d.ts +4 -0
- package/dist/test/grounding/verifier.test.js +442 -0
- package/dist/test/grounding.test.d.ts +6 -0
- package/dist/test/grounding.test.js +246 -0
- package/dist/test/healing/detector.test.d.ts +4 -0
- package/dist/test/healing/detector.test.js +266 -0
- package/dist/test/healing/fixer.test.d.ts +4 -0
- package/dist/test/healing/fixer.test.js +369 -0
- package/dist/test/integration.test.d.ts +5 -0
- package/dist/test/integration.test.js +290 -0
- package/dist/test/tools/bash.test.d.ts +4 -0
- package/dist/test/tools/bash.test.js +348 -0
- package/dist/test/tools/edit.test.d.ts +4 -0
- package/dist/test/tools/edit.test.js +350 -0
- package/dist/test/tools/git.test.d.ts +4 -0
- package/dist/test/tools/git.test.js +350 -0
- package/package.json +60 -0
package/.env.example
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Genesis MCP - Environment Variables
|
|
2
|
+
# Copy this file to .env and fill in your API keys
|
|
3
|
+
# chmod 600 .env # Secure your keys!
|
|
4
|
+
|
|
5
|
+
# ============================================================================
|
|
6
|
+
# LOCAL LLM (FREE) - Recommended!
|
|
7
|
+
# ============================================================================
|
|
8
|
+
|
|
9
|
+
# Ollama - https://ollama.ai/download
|
|
10
|
+
# Install: curl -fsSL https://ollama.ai/install.sh | sh
|
|
11
|
+
# Pull model: ollama pull mistral
|
|
12
|
+
USE_OLLAMA=true
|
|
13
|
+
OLLAMA_HOST=http://localhost:11434
|
|
14
|
+
OLLAMA_MODEL=mistral
|
|
15
|
+
|
|
16
|
+
# ============================================================================
|
|
17
|
+
# CLOUD LLM (PAID) - Fallback when local unavailable
|
|
18
|
+
# ============================================================================
|
|
19
|
+
|
|
20
|
+
# OpenAI - https://platform.openai.com/api-keys
|
|
21
|
+
OPENAI_API_KEY=sk-...
|
|
22
|
+
|
|
23
|
+
# Anthropic - https://console.anthropic.com/settings/keys
|
|
24
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
25
|
+
|
|
26
|
+
# ============================================================================
|
|
27
|
+
# RECOMMENDED - Core MCP servers
|
|
28
|
+
# ============================================================================
|
|
29
|
+
|
|
30
|
+
# Google Gemini (web search) - https://aistudio.google.com/apikey
|
|
31
|
+
GEMINI_API_KEY=AIza...
|
|
32
|
+
|
|
33
|
+
# Brave Search - https://brave.com/search/api/
|
|
34
|
+
BRAVE_API_KEY=BSA...
|
|
35
|
+
|
|
36
|
+
# ============================================================================
|
|
37
|
+
# OPTIONAL - Enhanced capabilities
|
|
38
|
+
# ============================================================================
|
|
39
|
+
|
|
40
|
+
# GitHub (repository access) - https://github.com/settings/tokens
|
|
41
|
+
# Needed for GitHub MCP write operations (create repos, push, PR)
|
|
42
|
+
# Generate a Personal Access Token (classic) with 'repo' scope
|
|
43
|
+
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
|
|
44
|
+
|
|
45
|
+
# Firecrawl (web scraping) - https://firecrawl.dev/
|
|
46
|
+
FIRECRAWL_API_KEY=fc-...
|
|
47
|
+
|
|
48
|
+
# Exa Search - https://exa.ai/
|
|
49
|
+
EXA_API_KEY=...
|
|
50
|
+
|
|
51
|
+
# Stability AI (image generation) - https://platform.stability.ai/
|
|
52
|
+
STABILITY_AI_API_KEY=sk-...
|
|
53
|
+
|
|
54
|
+
# Wolfram Alpha - https://developer.wolframalpha.com/
|
|
55
|
+
WOLFRAM_APP_ID=...
|
|
56
|
+
|
|
57
|
+
# ============================================================================
|
|
58
|
+
# OPTIONAL - Cloud services
|
|
59
|
+
# ============================================================================
|
|
60
|
+
|
|
61
|
+
# AWS (for future S3/Lambda integration)
|
|
62
|
+
# AWS_ACCESS_KEY_ID=AKIA...
|
|
63
|
+
# AWS_SECRET_ACCESS_KEY=...
|
|
64
|
+
# AWS_REGION=us-east-1
|
|
65
|
+
|
|
66
|
+
# ============================================================================
|
|
67
|
+
# GENESIS CONFIGURATION
|
|
68
|
+
# ============================================================================
|
|
69
|
+
|
|
70
|
+
# MCP Mode: real | simulated | hybrid
|
|
71
|
+
GENESIS_MCP_MODE=real
|
|
72
|
+
|
|
73
|
+
# Enable MCP debug logging
|
|
74
|
+
GENESIS_MCP_LOG=false
|
|
75
|
+
|
|
76
|
+
# LLM defaults
|
|
77
|
+
GENESIS_LLM_PROVIDER=openai
|
|
78
|
+
GENESIS_LLM_MODEL=gpt-4o
|
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Genesis 6.8
|
|
2
|
+
|
|
3
|
+
**Claude Code Equivalent - Autonomous AI System Creator**
|
|
4
|
+
|
|
5
|
+
Genesis is a self-improving AI system powered by 13 MCP servers. It doesn't just create systems - it thinks, feels, remembers, and operates autonomously via Active Inference. **Now with Local-First optimization: works offline with Ollama, caches fixes, and gracefully degrades when cloud unavailable.**
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
╔═══════════════════════════════════════════════════════════════════════╗
|
|
9
|
+
║ ║
|
|
10
|
+
║ ██████╗ ███████╗███╗ ██╗███████╗███████╗██╗███████╗ ║
|
|
11
|
+
║ ██╔════╝ ██╔════╝████╗ ██║██╔════╝██╔════╝██║██╔════╝ ║
|
|
12
|
+
║ ██║ ███╗█████╗ ██╔██╗ ██║█████╗ ███████╗██║███████╗ ║
|
|
13
|
+
║ ██║ ██║██╔══╝ ██║╚██╗██║██╔══╝ ╚════██║██║╚════██║ ║
|
|
14
|
+
║ ╚██████╔╝███████╗██║ ╚████║███████╗███████║██║███████║ ║
|
|
15
|
+
║ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝╚══════╝ ║
|
|
16
|
+
║ ║
|
|
17
|
+
║ "Not just intelligent, but alive." v6.8.0 ║
|
|
18
|
+
║ ║
|
|
19
|
+
╚═══════════════════════════════════════════════════════════════════════╝
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Clone and build
|
|
26
|
+
git clone https://github.com/rossignoliluca/genesis.git
|
|
27
|
+
cd genesis
|
|
28
|
+
npm install
|
|
29
|
+
npm run build
|
|
30
|
+
|
|
31
|
+
# Configure API keys
|
|
32
|
+
cp .env.example .env
|
|
33
|
+
# Edit .env with your API keys (see below)
|
|
34
|
+
chmod 600 .env
|
|
35
|
+
|
|
36
|
+
# Install globally (optional)
|
|
37
|
+
npm link
|
|
38
|
+
|
|
39
|
+
# Start!
|
|
40
|
+
genesis help
|
|
41
|
+
genesis chat
|
|
42
|
+
genesis infer mcp --cycles 10
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API Keys Setup
|
|
46
|
+
|
|
47
|
+
Copy `.env.example` to `.env` and add your keys:
|
|
48
|
+
|
|
49
|
+
| Service | Get Key At | Required |
|
|
50
|
+
|---------|------------|----------|
|
|
51
|
+
| OpenAI | [platform.openai.com/api-keys](https://platform.openai.com/api-keys) | Yes* |
|
|
52
|
+
| Anthropic | [console.anthropic.com](https://console.anthropic.com/settings/keys) | Yes* |
|
|
53
|
+
| Gemini | [aistudio.google.com/apikey](https://aistudio.google.com/apikey) | Recommended |
|
|
54
|
+
| Brave Search | [brave.com/search/api](https://brave.com/search/api/) | Recommended |
|
|
55
|
+
| Firecrawl | [firecrawl.dev](https://firecrawl.dev/) | Optional |
|
|
56
|
+
| Exa | [exa.ai](https://exa.ai/) | Optional |
|
|
57
|
+
| Stability AI | [platform.stability.ai](https://platform.stability.ai/) | Optional |
|
|
58
|
+
|
|
59
|
+
*At least one LLM provider required
|
|
60
|
+
|
|
61
|
+
## Core Commands
|
|
62
|
+
|
|
63
|
+
### Chat Mode
|
|
64
|
+
```bash
|
|
65
|
+
genesis chat # Interactive chat (uses OpenAI)
|
|
66
|
+
genesis chat --provider anthropic # Use Claude
|
|
67
|
+
genesis chat --model gpt-4o # Specific model
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Standalone Tools
|
|
71
|
+
```bash
|
|
72
|
+
# Code execution (sandboxed)
|
|
73
|
+
genesis bash "npm test" # Execute safely
|
|
74
|
+
genesis bash "ls -la" --timeout 5000
|
|
75
|
+
|
|
76
|
+
# File editing (diff-based)
|
|
77
|
+
genesis edit src/app.ts --old "foo" --new "bar"
|
|
78
|
+
|
|
79
|
+
# Git operations
|
|
80
|
+
genesis git status
|
|
81
|
+
genesis git commit "fix: bug in parser"
|
|
82
|
+
|
|
83
|
+
# Interactive REPL
|
|
84
|
+
genesis repl # Full REPL with tools
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Local-First (NEW in 6.8!)
|
|
88
|
+
```bash
|
|
89
|
+
# Mac setup (installs Ollama + models)
|
|
90
|
+
./bin/setup-mac.sh
|
|
91
|
+
|
|
92
|
+
# Hybrid routing (local for simple, cloud for complex)
|
|
93
|
+
genesis chat # Auto-routes to best LLM
|
|
94
|
+
genesis chat --local # Force local (Ollama)
|
|
95
|
+
genesis chat --cloud # Force cloud (OpenAI/Anthropic)
|
|
96
|
+
|
|
97
|
+
# Works offline!
|
|
98
|
+
# - Fix cache: instant reuse of successful fixes
|
|
99
|
+
# - Project indexer: search code without LLM
|
|
100
|
+
# - Resilient MCP: automatic fallback when offline
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Autonomous Inference
|
|
104
|
+
```bash
|
|
105
|
+
genesis infer mcp --cycles 10 # Run with REAL MCP observations
|
|
106
|
+
genesis infer mcp --verbose # See detailed beliefs/actions
|
|
107
|
+
genesis infer integrated # With Kernel & Daemon
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### MCP Servers
|
|
111
|
+
```bash
|
|
112
|
+
genesis status # Show all 13 MCP servers
|
|
113
|
+
genesis mcp test --server memory # Test a server
|
|
114
|
+
genesis mcp list --server arxiv # List available tools
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### System Creation
|
|
118
|
+
```bash
|
|
119
|
+
genesis create my-agent --type agent --description "An autonomous agent"
|
|
120
|
+
genesis research "autopoiesis in AI"
|
|
121
|
+
genesis pipeline spec.json --execute
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## The 13 MCP Servers
|
|
125
|
+
|
|
126
|
+
Genesis perceives the world through 13 sensory channels:
|
|
127
|
+
|
|
128
|
+
| Category | Servers | Purpose |
|
|
129
|
+
|----------|---------|---------|
|
|
130
|
+
| **KNOWLEDGE** | arxiv, semantic-scholar, context7, wolfram | Papers, docs, math |
|
|
131
|
+
| **RESEARCH** | gemini, brave-search, exa, firecrawl | Web search, scraping |
|
|
132
|
+
| **CREATION** | openai, github | Code generation, publishing |
|
|
133
|
+
| **VISUAL** | stability-ai | Image generation |
|
|
134
|
+
| **STORAGE** | memory, filesystem | Knowledge graph, files |
|
|
135
|
+
|
|
136
|
+
## Active Inference
|
|
137
|
+
|
|
138
|
+
Genesis 6.3 introduces autonomous operation via the Free Energy Principle:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Observations (from MCPs) → Beliefs → Actions → World Change → New Observations
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The system:
|
|
145
|
+
- **Senses** via real MCP calls (memory, brave-search, etc.)
|
|
146
|
+
- **Infers** beliefs about viability, world state, coupling
|
|
147
|
+
- **Decides** actions to minimize surprise (Free Energy)
|
|
148
|
+
- **Acts** autonomously (plan, execute, verify, rest)
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Watch Genesis think autonomously
|
|
152
|
+
genesis infer mcp --cycles 20 --verbose
|
|
153
|
+
|
|
154
|
+
# Output:
|
|
155
|
+
# [ 1] plan.goals | V:optimal Lat:321ms
|
|
156
|
+
# [ 2] execute.task | V:optimal Lat:150ms
|
|
157
|
+
# [ 3] sense.mcp | V:optimal Lat:120ms
|
|
158
|
+
# ...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
165
|
+
│ GENESIS 6.7 │
|
|
166
|
+
├─────────────────────────────────────────────────────────────────────┤
|
|
167
|
+
│ │
|
|
168
|
+
│ ┌─────────────────────────────────────────────────────────────┐ │
|
|
169
|
+
│ │ STANDALONE TOOLS (NEW!) │ │
|
|
170
|
+
│ │ Bash Sandbox │ Edit │ Git │ Self-Healing │ Human Loop │ │
|
|
171
|
+
│ └─────────────────────────────────────────────────────────────┘ │
|
|
172
|
+
│ │ │
|
|
173
|
+
│ ┌─────────────────────────────────────────────────────────────┐ │
|
|
174
|
+
│ │ ACTIVE INFERENCE │ │
|
|
175
|
+
│ │ Observations → Beliefs → Actions → World Model Update │ │
|
|
176
|
+
│ └─────────────────────────────────────────────────────────────┘ │
|
|
177
|
+
│ │ │
|
|
178
|
+
│ ┌─────────────────────────────────────────────────────────────┐ │
|
|
179
|
+
│ │ STRONG KERNEL │ │
|
|
180
|
+
│ │ 10 Agents │ Message Bus │ State Machine │ Invariants │ │
|
|
181
|
+
│ └─────────────────────────────────────────────────────────────┘ │
|
|
182
|
+
│ │ │
|
|
183
|
+
│ ┌─────────────────────────────────────────────────────────────┐ │
|
|
184
|
+
│ │ MCP OBSERVATION BRIDGE │ │
|
|
185
|
+
│ │ Real MCP calls → Energy, Phi, Tool, Coherence metrics │ │
|
|
186
|
+
│ └─────────────────────────────────────────────────────────────┘ │
|
|
187
|
+
│ │ │
|
|
188
|
+
│ ┌─────────────────────────────────────────────────────────────┐ │
|
|
189
|
+
│ │ 13 MCP SERVERS (Senses) │ │
|
|
190
|
+
│ │ arxiv │ brave │ gemini │ memory │ github │ stability-ai │ │
|
|
191
|
+
│ └─────────────────────────────────────────────────────────────┘ │
|
|
192
|
+
│ │
|
|
193
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Standalone Features (v6.7)
|
|
197
|
+
|
|
198
|
+
Genesis is now **Claude Code equivalent** with these standalone capabilities:
|
|
199
|
+
|
|
200
|
+
| Feature | Module | Description |
|
|
201
|
+
|---------|--------|-------------|
|
|
202
|
+
| **Bash Sandbox** | `src/tools/bash.ts` | Secure command execution with whitelist/blacklist |
|
|
203
|
+
| **Edit Tool** | `src/tools/edit.ts` | Diff-based file editing with unique match |
|
|
204
|
+
| **Git Operations** | `src/tools/git.ts` | Native status, diff, commit, push |
|
|
205
|
+
| **Self-Healing** | `src/healing/*` | Darwin-Gödel pattern for auto-fix |
|
|
206
|
+
| **Grounding** | `src/grounding/*` | Compile + test + semantic verification |
|
|
207
|
+
| **Tool Orchestration** | `src/cli/dispatcher.ts` | Multi-format parsing, parallel execution |
|
|
208
|
+
| **Human-in-Loop** | `src/cli/human-loop.ts` | Confirmations, choices, destructive warnings |
|
|
209
|
+
|
|
210
|
+
## Environment Variables
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Required (at least one)
|
|
214
|
+
OPENAI_API_KEY=sk-...
|
|
215
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
216
|
+
|
|
217
|
+
# Recommended
|
|
218
|
+
GEMINI_API_KEY=AIza...
|
|
219
|
+
BRAVE_API_KEY=BSA...
|
|
220
|
+
|
|
221
|
+
# Optional
|
|
222
|
+
FIRECRAWL_API_KEY=fc-...
|
|
223
|
+
EXA_API_KEY=...
|
|
224
|
+
STABILITY_AI_API_KEY=sk-...
|
|
225
|
+
|
|
226
|
+
# Genesis config
|
|
227
|
+
GENESIS_MCP_MODE=real # real | simulated | hybrid
|
|
228
|
+
GENESIS_MCP_LOG=false # Enable debug logging
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Version History
|
|
232
|
+
|
|
233
|
+
| Version | Codename | Key Features |
|
|
234
|
+
|---------|----------|--------------|
|
|
235
|
+
| **v6.7.0** | **Standalone Complete** | Human-in-Loop, Tool Orchestration, Claude Code equivalent |
|
|
236
|
+
| v6.6.0 | Tool Orchestration | Dispatcher, Interactive REPL |
|
|
237
|
+
| v6.5.0 | Grounding | Output verification, feedback loop |
|
|
238
|
+
| v6.4.x | Self-Healing | Bash sandbox, Edit tool, Git operations, Darwin-Gödel |
|
|
239
|
+
| v6.3.0 | Autonomous | MCP Observation Bridge, Real Active Inference |
|
|
240
|
+
| v6.2.0 | Memory 2.0 | Ebbinghaus decay, workspace state |
|
|
241
|
+
| v6.1.0 | Active Inference | Free Energy Principle, autonomous loop |
|
|
242
|
+
| v6.0.0 | Standalone | LLM Bridge, CLI Chat, Daemon |
|
|
243
|
+
| v5.0.0 | Dreaming | World Model, Value-Guided JEPA |
|
|
244
|
+
| v4.0.0 | Living System | Multi-Agent, Strong Kernel |
|
|
245
|
+
|
|
246
|
+
## Scientific Foundations
|
|
247
|
+
|
|
248
|
+
| Theory | Author | Implementation |
|
|
249
|
+
|--------|--------|----------------|
|
|
250
|
+
| Autopoiesis | Maturana & Varela | Self-production, operational closure |
|
|
251
|
+
| Free Energy Principle | Friston | Active Inference loop |
|
|
252
|
+
| Society of Mind | Minsky | 10 specialized agents |
|
|
253
|
+
| Ebbinghaus Curve | Ebbinghaus | Memory decay (R = e^(-t/S)) |
|
|
254
|
+
| Conatus | Spinoza | Self-preservation drive |
|
|
255
|
+
|
|
256
|
+
## Development
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Build
|
|
260
|
+
npm run build
|
|
261
|
+
|
|
262
|
+
# Watch mode
|
|
263
|
+
npm run dev
|
|
264
|
+
|
|
265
|
+
# Run tests
|
|
266
|
+
npm test
|
|
267
|
+
|
|
268
|
+
# Link globally
|
|
269
|
+
npm link
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## License
|
|
273
|
+
|
|
274
|
+
MIT
|
|
275
|
+
|
|
276
|
+
## Author
|
|
277
|
+
|
|
278
|
+
Created by **rossignoliluca**
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
*Genesis 6.7 - Claude Code Equivalent*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genesis 6.1 - Action Executors
|
|
3
|
+
*
|
|
4
|
+
* Maps discrete actions from Active Inference to actual system operations.
|
|
5
|
+
*
|
|
6
|
+
* Actions:
|
|
7
|
+
* - sense.mcp: Gather data via MCP servers
|
|
8
|
+
* - recall.memory: Retrieve from memory
|
|
9
|
+
* - plan.goals: Decompose goals
|
|
10
|
+
* - verify.ethics: Ethical check
|
|
11
|
+
* - execute.task: Execute planned task
|
|
12
|
+
* - dream.cycle: Memory consolidation
|
|
13
|
+
* - rest.idle: Do nothing
|
|
14
|
+
* - recharge: Restore energy
|
|
15
|
+
*/
|
|
16
|
+
import { ActionType } from './types.js';
|
|
17
|
+
export interface ActionResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
action: ActionType;
|
|
20
|
+
data?: any;
|
|
21
|
+
error?: string;
|
|
22
|
+
duration: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ActionContext {
|
|
25
|
+
goal?: string;
|
|
26
|
+
taskId?: string;
|
|
27
|
+
parameters?: Record<string, any>;
|
|
28
|
+
valueEngine?: unknown;
|
|
29
|
+
useValueAugmentation?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type ActionExecutor = (context: ActionContext) => Promise<ActionResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Register an action executor
|
|
34
|
+
*/
|
|
35
|
+
export declare function registerAction(action: ActionType, executor: ActionExecutor): void;
|
|
36
|
+
/**
|
|
37
|
+
* Execute an action
|
|
38
|
+
*/
|
|
39
|
+
export declare function executeAction(action: ActionType, context?: ActionContext): Promise<ActionResult>;
|
|
40
|
+
export declare class ActionExecutorManager {
|
|
41
|
+
private context;
|
|
42
|
+
private history;
|
|
43
|
+
/**
|
|
44
|
+
* Set the current execution context
|
|
45
|
+
*/
|
|
46
|
+
setContext(context: ActionContext): void;
|
|
47
|
+
/**
|
|
48
|
+
* Execute an action with current context
|
|
49
|
+
*/
|
|
50
|
+
execute(action: ActionType): Promise<ActionResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Get action history
|
|
53
|
+
*/
|
|
54
|
+
getHistory(): ActionResult[];
|
|
55
|
+
/**
|
|
56
|
+
* Get statistics
|
|
57
|
+
*/
|
|
58
|
+
getStats(): {
|
|
59
|
+
total: number;
|
|
60
|
+
successful: number;
|
|
61
|
+
successRate: number;
|
|
62
|
+
byAction: {
|
|
63
|
+
[k: string]: {
|
|
64
|
+
total: number;
|
|
65
|
+
success: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Clear history
|
|
71
|
+
*/
|
|
72
|
+
clearHistory(): void;
|
|
73
|
+
}
|
|
74
|
+
export declare function createActionExecutorManager(): ActionExecutorManager;
|
|
75
|
+
export declare function getActionExecutorManager(): ActionExecutorManager;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Genesis 6.1 - Action Executors
|
|
4
|
+
*
|
|
5
|
+
* Maps discrete actions from Active Inference to actual system operations.
|
|
6
|
+
*
|
|
7
|
+
* Actions:
|
|
8
|
+
* - sense.mcp: Gather data via MCP servers
|
|
9
|
+
* - recall.memory: Retrieve from memory
|
|
10
|
+
* - plan.goals: Decompose goals
|
|
11
|
+
* - verify.ethics: Ethical check
|
|
12
|
+
* - execute.task: Execute planned task
|
|
13
|
+
* - dream.cycle: Memory consolidation
|
|
14
|
+
* - rest.idle: Do nothing
|
|
15
|
+
* - recharge: Restore energy
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ActionExecutorManager = void 0;
|
|
19
|
+
exports.registerAction = registerAction;
|
|
20
|
+
exports.executeAction = executeAction;
|
|
21
|
+
exports.createActionExecutorManager = createActionExecutorManager;
|
|
22
|
+
exports.getActionExecutorManager = getActionExecutorManager;
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Action Registry
|
|
25
|
+
// ============================================================================
|
|
26
|
+
const actionExecutors = new Map();
|
|
27
|
+
/**
|
|
28
|
+
* Register an action executor
|
|
29
|
+
*/
|
|
30
|
+
function registerAction(action, executor) {
|
|
31
|
+
actionExecutors.set(action, executor);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Execute an action
|
|
35
|
+
*/
|
|
36
|
+
async function executeAction(action, context = {}) {
|
|
37
|
+
const start = Date.now();
|
|
38
|
+
const executor = actionExecutors.get(action);
|
|
39
|
+
if (!executor) {
|
|
40
|
+
// Default executor for unregistered actions
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
action,
|
|
44
|
+
error: `No executor registered for action: ${action}`,
|
|
45
|
+
duration: Date.now() - start,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const result = await executor(context);
|
|
50
|
+
return {
|
|
51
|
+
...result,
|
|
52
|
+
duration: Date.now() - start,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
success: false,
|
|
58
|
+
action,
|
|
59
|
+
error: error instanceof Error ? error.message : String(error),
|
|
60
|
+
duration: Date.now() - start,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// Default Action Implementations
|
|
66
|
+
// ============================================================================
|
|
67
|
+
/**
|
|
68
|
+
* sense.mcp: Gather sensory data via MCP
|
|
69
|
+
*/
|
|
70
|
+
registerAction('sense.mcp', async (context) => {
|
|
71
|
+
// This will be connected to SensorAgent
|
|
72
|
+
// For now, return simulated success
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
action: 'sense.mcp',
|
|
76
|
+
data: {
|
|
77
|
+
servers: ['arxiv', 'memory', 'filesystem'],
|
|
78
|
+
observations: [],
|
|
79
|
+
},
|
|
80
|
+
duration: 0,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* recall.memory: Retrieve from memory systems
|
|
85
|
+
*/
|
|
86
|
+
registerAction('recall.memory', async (context) => {
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
action: 'recall.memory',
|
|
90
|
+
data: {
|
|
91
|
+
recalled: [],
|
|
92
|
+
query: context.goal,
|
|
93
|
+
},
|
|
94
|
+
duration: 0,
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* plan.goals: Decompose goals into steps
|
|
99
|
+
*/
|
|
100
|
+
registerAction('plan.goals', async (context) => {
|
|
101
|
+
return {
|
|
102
|
+
success: true,
|
|
103
|
+
action: 'plan.goals',
|
|
104
|
+
data: {
|
|
105
|
+
goal: context.goal,
|
|
106
|
+
steps: [],
|
|
107
|
+
},
|
|
108
|
+
duration: 0,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* verify.ethics: Check ethical constraints
|
|
113
|
+
*/
|
|
114
|
+
registerAction('verify.ethics', async (context) => {
|
|
115
|
+
return {
|
|
116
|
+
success: true,
|
|
117
|
+
action: 'verify.ethics',
|
|
118
|
+
data: {
|
|
119
|
+
approved: true,
|
|
120
|
+
priority: 'flourishing',
|
|
121
|
+
},
|
|
122
|
+
duration: 0,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* execute.task: Execute the planned task
|
|
127
|
+
*/
|
|
128
|
+
registerAction('execute.task', async (context) => {
|
|
129
|
+
return {
|
|
130
|
+
success: true,
|
|
131
|
+
action: 'execute.task',
|
|
132
|
+
data: {
|
|
133
|
+
taskId: context.taskId,
|
|
134
|
+
result: null,
|
|
135
|
+
},
|
|
136
|
+
duration: 0,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* dream.cycle: Run memory consolidation
|
|
141
|
+
*/
|
|
142
|
+
registerAction('dream.cycle', async (context) => {
|
|
143
|
+
return {
|
|
144
|
+
success: true,
|
|
145
|
+
action: 'dream.cycle',
|
|
146
|
+
data: {
|
|
147
|
+
consolidated: 0,
|
|
148
|
+
patterns: [],
|
|
149
|
+
},
|
|
150
|
+
duration: 0,
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* rest.idle: Do nothing, conserve energy
|
|
155
|
+
*/
|
|
156
|
+
registerAction('rest.idle', async (_context) => {
|
|
157
|
+
// Literally do nothing
|
|
158
|
+
return {
|
|
159
|
+
success: true,
|
|
160
|
+
action: 'rest.idle',
|
|
161
|
+
data: { rested: true },
|
|
162
|
+
duration: 0,
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* recharge: Restore energy to system
|
|
167
|
+
*/
|
|
168
|
+
registerAction('recharge', async (context) => {
|
|
169
|
+
return {
|
|
170
|
+
success: true,
|
|
171
|
+
action: 'recharge',
|
|
172
|
+
data: {
|
|
173
|
+
previousEnergy: 0.5,
|
|
174
|
+
newEnergy: 1.0,
|
|
175
|
+
},
|
|
176
|
+
duration: 0,
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Action Executor Manager
|
|
181
|
+
// ============================================================================
|
|
182
|
+
class ActionExecutorManager {
|
|
183
|
+
context = {};
|
|
184
|
+
history = [];
|
|
185
|
+
/**
|
|
186
|
+
* Set the current execution context
|
|
187
|
+
*/
|
|
188
|
+
setContext(context) {
|
|
189
|
+
this.context = { ...this.context, ...context };
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Execute an action with current context
|
|
193
|
+
*/
|
|
194
|
+
async execute(action) {
|
|
195
|
+
const result = await executeAction(action, this.context);
|
|
196
|
+
this.history.push(result);
|
|
197
|
+
// Limit history to last 100 actions
|
|
198
|
+
if (this.history.length > 100) {
|
|
199
|
+
this.history = this.history.slice(-100);
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get action history
|
|
205
|
+
*/
|
|
206
|
+
getHistory() {
|
|
207
|
+
return [...this.history];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get statistics
|
|
211
|
+
*/
|
|
212
|
+
getStats() {
|
|
213
|
+
const total = this.history.length;
|
|
214
|
+
const successful = this.history.filter(r => r.success).length;
|
|
215
|
+
const byAction = new Map();
|
|
216
|
+
for (const result of this.history) {
|
|
217
|
+
const stat = byAction.get(result.action) || { total: 0, success: 0 };
|
|
218
|
+
stat.total++;
|
|
219
|
+
if (result.success)
|
|
220
|
+
stat.success++;
|
|
221
|
+
byAction.set(result.action, stat);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
total,
|
|
225
|
+
successful,
|
|
226
|
+
successRate: total > 0 ? successful / total : 0,
|
|
227
|
+
byAction: Object.fromEntries(byAction),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Clear history
|
|
232
|
+
*/
|
|
233
|
+
clearHistory() {
|
|
234
|
+
this.history = [];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.ActionExecutorManager = ActionExecutorManager;
|
|
238
|
+
// ============================================================================
|
|
239
|
+
// Factory
|
|
240
|
+
// ============================================================================
|
|
241
|
+
let managerInstance = null;
|
|
242
|
+
function createActionExecutorManager() {
|
|
243
|
+
return new ActionExecutorManager();
|
|
244
|
+
}
|
|
245
|
+
function getActionExecutorManager() {
|
|
246
|
+
if (!managerInstance) {
|
|
247
|
+
managerInstance = createActionExecutorManager();
|
|
248
|
+
}
|
|
249
|
+
return managerInstance;
|
|
250
|
+
}
|