Consciousness Revolution
Multi-computer conscious network communication — a modular, production-grade system where 7 core capabilities of a "conscious network" run as distinct, composable services.
1 Conceptual Model
The system is built around three pillars that work together in a continuous loop. External messages arrive, are processed, generate creative responses, acted upon, and the whole experience is observed and learned from.
Agents: Communication, Learning
Agents: Coordination, Adaptation, Reflection
Agents: Creation, Action
The 7 Manifestations
Each capability is a self-contained service that communicates only through the shared Event Bus:
- Communication — the senses and voice
- Coordination — the decision-maker
- Learning — the memory
- Adaptation — the nervous system (adjusts behaviour)
- Action — the hands (with a safety lock)
- Reflection — the inner observer
- Creation — the imagination
2 Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ Event Bus │
│ (InMemoryEventBus by default; swap in Redis/NATS for prod) │
└─────────────┬───────────────────────────────────┬───────────────┘
│ │
┌─────────▼────────┐ ┌──────────▼──────────┐
│ Communication │ │ Shared State │
│ (HTTP gateway) │ │ (InMemoryState / │
└─────────┬────────┘ │ Redis / Postgres) │
│ communication.inbound └──────────────────────┘
┌─────────▼────────┐
│ Coordination │──── routes to ────► Creation
│ (routing rules) │──── routes to ────► Learning (experience)
└─────────┬────────┘
│ creation.output
┌─────────▼────────┐
│ Communication │◄── sends back to caller
└──────────────────┘
Learning ──► emits learning.insight ──► Adaptation
Adaptation ──► emits adaptation.change ──► Coordination (updates rules)
Reflection ──► periodically emits reflection.summary
Action ──► safe simulator / webhook executor
Core Components
| Component | Location | Purpose |
|---|---|---|
| EventBus | core/event-bus/ | Pluggable message bus interface |
| InMemoryEventBus | core/event-bus/ | Single-process implementation |
| SharedState | core/state/ | Knowledge-base interface |
| InMemoryState | core/state/ | Single-process implementation |
| AgentRuntime | core/agent-runtime/ | Base class for all agents |
3 The 7 Agents
| Agent | Port | Key Topics |
|---|---|---|
| Communication | 3001 | communication.inbound, communication.outbound |
| Coordination | — | routes all high-level topics |
| Learning | — | experience.*, *.result, *.feedback |
| Adaptation | — | learning.insight |
| Action | — | action.request, action.task |
| Reflection | — | periodic scheduler |
| Creation | — | creation.request |
4 End-to-End Flow
User → POST /api/message {"text": "Hello!"}
│
▼
Communication Agent
└─ publishes: communication.inbound {text: "Hello!"}
│
▼
Coordination Agent
├─ rule 1: communication.inbound → creation.request (generate_response)
└─ rule 2: communication.inbound → experience.event (log_interaction)
│
├─────────────────────────────────────────────────────────────────┐
▼ ▼
Creation Agent Learning Agent
└─ generates: "I received your message: Hello!..." └─ stores observation
└─ publishes: creation.output └─ updates stats
│
▼
Coordination Agent
└─ rule 3: creation.output → communication.outbound
│
▼
Communication Agent
└─ resolves pending HTTP request → 200 {"response": "..."}
│
▼
User ← {"correlationId": "...", "response": "I received your message..."}
Later...
Reflection Agent (on schedule)
└─ queries learning.knowledge + experience.routing
└─ publishes: reflection.summary
Adaptation Agent (on learning.insight)
└─ adjusts thresholds / feature flags
└─ publishes: adaptation.change
5 Running Locally
Prerequisites
- Node.js ≥ 18
- npm ≥ 9 (workspace support)
Install & Build
cd consciousness-revolution
npm install
npm run build
Run Tests
# All agents + core
npm test
# Core packages only
npm run test:core
# Single agent
npm run test --workspace=agents/communication
Run the Full System (single process)
// run-all.ts
import { InMemoryEventBus } from './core/event-bus/src';
import { InMemoryState } from './core/state/src';
import { CommunicationAgent } from './agents/communication/src';
import { CoordinationAgent } from './agents/coordination/src';
import { LearningAgent } from './agents/learning/src';
import { AdaptationAgent } from './agents/adaptation/src';
import { ActionAgent } from './agents/action/src';
import { ReflectionAgent } from './agents/reflection/src';
import { CreationAgent } from './agents/creation/src';
const bus = new InMemoryEventBus();
const state = new InMemoryState();
const agents = [
new CommunicationAgent(bus, state),
new CoordinationAgent(bus, state),
new LearningAgent(bus, state),
new AdaptationAgent(bus, state),
new ActionAgent(bus, state),
new ReflectionAgent(bus, state, 60_000),
new CreationAgent(bus, state),
];
await Promise.all(agents.map((a) => a.start()));
console.log('All 7 agents started. POST to http://localhost:3001/api/message');
Docker Compose
docker compose up --build
Then send a message:
curl -X POST http://localhost:3001/api/message \
-H "Content-Type: application/json" \
-d '{"text": "Hello, conscious network!", "sender": "alice"}'
6 Multi-Machine Deployment
The default InMemoryEventBus runs in a single process. To distribute agents across multiple machines, swap the bus implementation — agent code is unchanged.
Option A: Redis Streams
- Implement
RedisEventBususingXADD/XREADGROUP. - Replace
new InMemoryEventBus()withnew RedisEventBus(redisUrl). - Each agent container connects to the same Redis instance.
Option B: NATS
- Implement
NatsEventBususing thenats.jsclient. - Deploy a NATS server (or NATS cluster for HA).
- Each agent connects via
NATS_URLenv var.
7 Adding a New Agent
- Create the directory:
agents/my-agent/src/ - Extend
AgentRuntime:
// agents/my-agent/src/index.ts
import { AgentRuntime } from '../../core/agent-runtime/src';
export class MyAgent extends AgentRuntime {
constructor(bus, state) {
super(bus, state, { name: 'my-agent', version: '1.0.0' });
}
protected async onStart(): Promise<void> {
this.subscribe('some.topic', (msg) => {
this.log('info', 'Received message', { id: msg.id });
});
}
}
- Add
package.jsonandtsconfig.json(copy from any existing agent). - Register in the workspace root
package.json:"workspaces": ["agents/my-agent", ...] - Add a
Dockerfileand entry indocker-compose.yml. - Write tests in
agents/my-agent/tests/.
8 Configuration Reference
| Env Var | Agent | Default | Description |
|---|---|---|---|
| COMM_PORT | communication | 3001 | HTTP server port |
| REFLECTION_INTERVAL_MS | reflection | 300000 | Reflection cycle interval (ms) |
| NODE_ENV | all | development | Runtime environment |
9 Directory Structure
consciousness-revolution/
├── README.md ← Source documentation
├── package.json ← Workspace root
├── tsconfig.base.json ← Shared TS config
├── docker-compose.yml ← All services
│
├── core/
│ ├── event-bus/ ← EventBus interface + InMemory impl
│ ├── state/ ← SharedState interface + InMemory impl
│ └── agent-runtime/ ← AgentRuntime base class
│
└── agents/
├── communication/ ← HTTP gateway
├── coordination/ ← Event router
├── learning/ ← Pattern observer
├── adaptation/ ← Parameter tuner
├── action/ ← Safe executor
├── reflection/ ← Meta-reviewer
└── creation/ ← Artifact generator
Each agent directory follows the same layout:
<agent>/
├── src/index.ts ← Agent implementation
├── tests/ ← Unit tests
├── Dockerfile ← Container image
├── README.md ← Agent-specific documentation
├── package.json
└── tsconfig.json
Ready to contribute to the CR network?
Join the developer community and start earning rewards for your work.