consciousness_sim 1.0.1 copy "consciousness_sim: ^1.0.1" to clipboard
consciousness_sim: ^1.0.1 copied to clipboard

An advanced Dart library simulating machine consciousness based on Global Workspace Theory. Provides a sophisticated information-processing model that mimics attention mechanisms, memory systems, conc [...]

🧠 consciousness_sim #

pub.flutter-io.cn Dart SDK License: MIT Tests

A production-ready Dart library with two integrated layers:

  1. Consciousness engine β€” machine consciousness simulation based on Global Workspace Theory (Baars, 1988): attention spotlight, tri-level memory, semantic inference, cross-modal binding.
  2. Autonomous agent framework β€” a full LLM-driven agent loop wired directly onto the consciousness engine: goal decomposition, execution DAG, tool routing, self-reflection, and memory persistence.

πŸ“¦ Installation #

# pubspec.yaml
dependencies:
  consciousness_sim: ^1.0.0
dart pub get

πŸ—‚οΈ Table of Contents #


🧠 Consciousness Engine #

Quick Start #

import 'package:consciousness_sim/consciousness_sim.dart';

Future<void> main() async {
  final mind = Consciousness();

  await mind.observe('a cat is sitting on the table');
  await mind.observe('the cat looks hungry');
  await mind.observe('there is fish on the table');

  print(mind.think());
  // β†’ "The cat will likely try to eat the fish."
}

Core Features #

Feature Description
🎯 Selective Attention Spotlight model with salience-based concept prioritisation
🧩 Conceptual Binding Temporal + semantic binding engine with co-activation
πŸ—‚οΈ Tri-level Memory Episodic, semantic, and working memory with consolidation
πŸ”— Semantic Graph Directed, weighted concept network with BFS/DFS/spreading activation
πŸ’‘ Inference Engine Rule-based, causal, associative, and memory-driven reasoning
πŸ‘οΈ Multi-Modal Cross-modal binding for visual, auditory, tactile, and other inputs
πŸ“ˆ Pattern Discovery Co-occurrence, sequence, and cluster pattern recognition
πŸ”Œ Plugin System Extensible processing hooks (emotion detection, logging, etc.)
πŸ“Š Metrics & Viz Built-in performance metrics and ASCII workspace visualisation

βš™οΈ Consciousness Configuration #

final mind = Consciousness(
  config: ConsciousnessConfig(
    name: 'MyMind',
    workspaceCapacity: 7,              // Miller's 7Β±2 chunks
    attentionThreshold: 0.30,          // Min salience to enter workspace
    enableLongTermLearning: true,      // Encode to episodic/semantic memory
    enableContinuousDecay: true,       // Background activation decay
    decayIntervalSeconds: 5,           // Decay timer interval
    memoryConsolidationIntervalMinutes: 10, // Episodic→Semantic promotion
    logLevel: LogLevel.info,           // Logging verbosity
  ),
);

πŸ”¬ Consciousness Examples #

Attention control

final mind = Consciousness(
  config: ConsciousnessConfig(workspaceCapacity: 7, attentionThreshold: 0.3),
);

await mind.observe('weather is nice');
await mind.observe('FIRE ALARM!');

print(mind.think()); // "Fire is detected β€” this is dangerous!"

// Redirect attention manually
mind.refocusAttention(['weather', 'temperature']);
print(mind.think()); // Now focuses on weather

Custom inference rules

mind.learn(InferenceRule(
  id: 'rule_low_battery',
  name: 'robot_low_battery',
  conditions: ['battery', 'low'],
  conclusion: 'Robot should return to charging station.',
  weight: 0.95,
));

await mind.observe('battery level is critically low');
print(mind.think()); // "Robot should return to charging station."

Multi-modal perception

await mind.observeVisual('obstacle detected ahead');
await mind.observeAuditory('collision warning beep');
await mind.observeTactile('proximity sensor: 10 cm');

final state = await mind.process();
print(mind.think()); // Synthesised from all three modalities

Memory access

final episodes = mind.recallEpisodes('cat fish');   // episodic
final facts    = mind.recallFacts('hunger');         // semantic
final all      = mind.recall('hungry animal');       // cross-memory

Plugins

class EmotionLogger extends ConsciousnessPlugin {
  @override String get name => 'EmotionLogger';

  @override
  Future<void> process(ConsciousState state) async {
    print('Workspace size: ${state.workspace.length}');
  }
}

mind.addPlugin(EmotionLogger());

Visualisation

const viz = ConsciousnessVisualizer();
final state = mind.getCurrentState();

print(viz.renderState(state));
print(viz.renderActivationMap(state.activationMap));
print(viz.renderGraph(mind.conceptGraph));

πŸ€– Autonomous Agent Framework #

The agent framework layers a full LLM-driven autonomous loop onto the consciousness engine. One call β€” mind.asAgent(...) β€” wires all subsystems together.

Architecture #

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        AgentMind                                 β”‚
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  LLMCore     β”‚   β”‚PlanningEngineβ”‚   β”‚AgentLoopController β”‚  β”‚
β”‚  β”‚  (reason)    │──▢│  (plan/      │──▢│  observe           β”‚  β”‚
β”‚  β”‚              β”‚   β”‚   replan)    β”‚   β”‚  retrieveMemory     β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  plan              β”‚  β”‚
β”‚         β”‚                              β”‚  decide            β”‚  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚  execute           β”‚  β”‚
β”‚  β”‚ LLMProvider  β”‚   β”‚  ToolRouter  β”‚   β”‚  updateMemory      β”‚  β”‚
β”‚  β”‚ Echoβ”‚Mockβ”‚   β”‚   β”‚  (6 built-in β”‚   β”‚  checkComplete     β”‚  β”‚
β”‚  β”‚ Http         β”‚   β”‚  + custom)   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚               β”‚
β”‚                                                  β–Ό               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚AgentMemory   β”‚   β”‚SelfReflectionβ”‚   β”‚  ExecutionDAG      β”‚  β”‚
β”‚  β”‚Store         β”‚   β”‚Module        β”‚   β”‚  (Kahn topo sort)  β”‚  β”‚
│  │(inverted idx)│   │(4 detectors) │   │  pending→running   │  │
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  β†’succeeded/failed β”‚  β”‚
β”‚                                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚              Consciousness (cognitive substrate)           β”‚ β”‚
β”‚  β”‚  workspace Β· attention Β· memory Β· perception Β· reasoning   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Loop cycle (per iteration):

observe β†’ retrieveMemory β†’ plan β†’ decide β†’ execute β†’ updateMemory β†’ checkComplete

LLM decision types (JSON protocol):

Action Trigger
use_tool Execute a named tool with structured input
think Record an internal thought without side effects
complete Declare the goal achieved β€” loop exits successfully
replan Discard remaining tasks and generate a new plan
error Signal an unrecoverable situation

Agent Quick Start #

import 'package:consciousness_sim/consciousness_sim.dart';

Future<void> main() async {
  final mind = Consciousness();

  final agent = mind.asAgent(
    provider: MockLLMProvider(responses: [
      '{"action":"use_tool","tool":"calculate","input":{"expression":"42*2"},'
          '"thought":"Computing the result."}',
      '{"action":"complete","reason":"Result is 84."}',
    ]),
  );

  final result = await agent.pursue(AgentGoal(
    id: 'g-001',
    description: 'Calculate 42 Γ— 2',
    successCriteria: ['Result returned'],
  ));

  print(result.success ? result.summary : result.error);
  // β†’ "Result is 84."

  await agent.dispose();
  mind.dispose();
}

Agent Components #

Component Class Responsibility
Goal model AgentGoal Typed goal with id, description, criteria, priority, maxIterations
Task graph ExecutionDAG Kahn's topological sort; tracks pending/running/succeeded/failed/skipped
LLM orchestration LLMCore Prompt assembly, context compression, JSON parsing, token tracking
Agent memory AgentMemoryStore Inverted word index; composite score = importance Γ— exp(βˆ’ageH/24); LRU eviction
Tool system ToolRegistry / ToolRouter Registration, catalogue building, dispatch with typed results
Planning PlanningEngine LLM-backed JSON decomposition + rule-based fallback; replan() preserves succeeded tasks
Execution loop AgentLoopController Full autonomous cycle; graceful stop(); AgentLoopEvent broadcast stream
Self-reflection SelfReflectionModule 4 detectors: cascade failures, tool loop, stalled progress, thought spiral; optional LLM deep-reflection
Entry point AgentMind Wires all layers; exposes pursue(), events, memory, llm, tools

LLM Providers #

EchoLLMProvider (debug)

Echoes the last user message back as a complete action. Zero dependencies.

final agent = mind.asAgent(provider: EchoLLMProvider());

MockLLMProvider (testing)

Serves a fixed response queue then cycles. Supports keyword heuristics as fallback.

final provider = MockLLMProvider(
  name: 'mock-gpt',
  responses: [
    '{"action":"use_tool","tool":"calculate","input":{"expression":"2+2"},"thought":"..."}',
    '{"action":"complete","reason":"Done."}',
  ],
);

HttpLLMProvider (production)

OpenAI-compatible HTTP backend. Drop in any endpoint that follows the /v1/chat/completions schema.

final provider = HttpLLMProvider(
  endpoint: 'https://api.openai.com/v1/chat/completions',
  apiKey: Platform.environment['OPENAI_API_KEY']!,
  model: 'gpt-4o',
  maxTokens: 1024,
  temperature: 0.2,
);

πŸ”§ Built-in Tools #

All built-in tools follow the ToolResult.failure() contract β€” they never throw; errors are returned as structured failures.

Tool name Class Description
search_web SearchWebTool Mock/DuckDuckGo-style keyword search
calculate CalculateTool Recursive-descent math: +βˆ’Γ—Γ·, sqrt, pi, nested parens
read_file ReadFileTool Reads a text file from disk (sandbox-restricted)
write_file WriteFileTool Writes/appends text to a file (sandbox-restricted)
call_api CallApiTool HTTP GET/POST with optional headers and body
schedule_task ScheduleTaskTool Schedules a named callback after N seconds

Register all built-in tools in one call:

final registry = ToolRegistry();
BuiltinToolset.registerAll(registry);

Or let AgentMind do it automatically via AgentMindConfig(registerBuiltinTools: true).

βš™οΈ Agent Configuration #

final agent = mind.asAgent(
  provider: myProvider,
  config: AgentMindConfig(
    registerBuiltinTools: true,       // auto-register 6 built-in tools
    extraTools: [MyCustomTool()],     // additional tools
    enableReflection: true,           // self-reflection module
    loopConfig: AgentLoopConfig(
      maxConsecutiveErrors: 3,        // stop if N errors in a row
      emitEvents: true,               // broadcast AgentLoopEvent stream
      iterationDelay: Duration.zero,  // optional throttle between iterations
      reflectionIntervalIterations: 5,// self-reflection every N iterations
    ),
  ),
);

AgentGoal fields:

AgentGoal(
  id: 'g-001',
  description: 'Your goal description',
  successCriteria: ['Criterion 1', 'Criterion 2'],
  maxIterations: 20,      // hard cap (default 20)
  priority: 0.8,          // 0.0–1.0
  timeoutSeconds: 120,    // optional wall-clock limit
  context: {'key': 'val'} // extra context injected into prompts
)

🌐 Production OpenAI Setup #

import 'dart:io';
import 'package:consciousness_sim/consciousness_sim.dart';

Future<void> main() async {
  final mind = Consciousness(
    config: const ConsciousnessConfig(name: 'ProductionAgent'),
  );

  final agent = mind.asAgent(
    provider: HttpLLMProvider(
      endpoint: 'https://api.openai.com/v1/chat/completions',
      apiKey: Platform.environment['OPENAI_API_KEY']!,
      model: 'gpt-4o',
      maxTokens: 1024,
      temperature: 0.1,
    ),
    config: AgentMindConfig(
      registerBuiltinTools: true,
      enableReflection: true,
      loopConfig: const AgentLoopConfig(
        maxConsecutiveErrors: 3,
        emitEvents: true,
        reflectionIntervalIterations: 5,
      ),
    ),
  );

  final result = await agent.pursue(AgentGoal(
    id: 'prod-task-001',
    description: 'Research quantum computing and summarise the key concepts.',
    successCriteria: ['Summary provided', 'Key concepts listed'],
    maxIterations: 15,
  ));

  print(result.success ? result.summary : 'Failed: ${result.error}');
  await agent.dispose();
  mind.dispose();
}

πŸ“‘ Event Stream #

Subscribe to agent.events for real-time observation of the loop:

agent.events.listen((AgentLoopEvent event) {
  switch (event.type) {
    case AgentLoopEventType.iterationStarted:
      print('── Iteration ${event.iteration} ──');
    case AgentLoopEventType.toolExecuted:
      final r = event.data as ToolResult?;
      print('πŸ”§ ${r?.toolName}: ${r?.outputText}');
    case AgentLoopEventType.completed:
      print('🎯 Done: ${event.data}');
    case AgentLoopEventType.reflected:
      print('πŸͺž Reflection: ${event.data}');
    default:
      break;
  }
});

All 14 event types:

Event When emitted
iterationStarted Beginning of each iteration
observed Environment observations received
memoryRetrieved Memory lookup completed
planned DAG (re)planned
decided LLM decision received
toolExecuted Tool call returned
thoughtRecorded think action processed
taskSucceeded A DAG task marked succeeded
taskFailed A DAG task marked failed
memoryUpdated Memory store updated
replanned replan action triggered
reflected Self-reflection module ran
completed Loop exited with success
failed Loop exited with failure

πŸ› οΈ Custom Tools #

Extend the agent with any tool by subclassing Tool:

class WeatherTool extends Tool {
  const WeatherTool();

  @override String get name => 'get_weather';
  @override String get description => 'Returns current weather for a city.';

  @override
  Map<String, String> get inputSchema => {
    'city': 'The city name to look up.',
  };

  @override
  Future<ToolResult> run(Map<String, dynamic> input) async {
    final city = input['city'] as String? ?? '';
    if (city.isEmpty) return ToolResult.failure(name, 'city is required');
    // call your weather API here …
    return ToolResult.success(name, 'Sunny, 22Β°C in $city');
  }
}

// Register it
final agent = mind.asAgent(
  provider: myProvider,
  config: AgentMindConfig(extraTools: const [WeatherTool()]),
);

Custom LLM Provider #

Implement LLMProvider to connect any backend:

class MyProvider implements LLMProvider {
  @override String get name => 'my-llm';

  @override
  Future<LLMResponse> complete(LLMRequest request) async {
    // Call your LLM service with request.messages
    final text = await myLlmClient.chat(request.messages.last.content);
    return LLMResponse(
      content: text,
      promptTokens: 0,
      completionTokens: 0,
      model: name,
    );
  }
}

Custom EnvironmentAdapter #

Inject real-world observations at each iteration:

class SensorAdapter implements EnvironmentAdapter {
  @override
  Future<List<AgentObservation>> poll() async {
    final reading = await sensor.read();
    return [
      AgentObservation(
        content: 'Sensor reading: $reading',
        source: 'sensor',
        salience: 0.8,
      ),
    ];
  }
}

// Pass to AgentLoopController directly, or via AgentMindConfig

πŸ“ Project Layout #

consciousness_sim/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ consciousness_sim.dart      ← Public API (single import)
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ models.dart             ← Concept, Memory, Inference, ConsciousState
β”‚   β”‚   β”œβ”€β”€ workspace.dart          ← WorkspaceManager (7Β±2 buffer)
β”‚   β”‚   β”œβ”€β”€ attention.dart          ← AttentionSpotlight
β”‚   β”‚   β”œβ”€β”€ binding.dart            ← BindingEngine
β”‚   β”‚   └── consciousness.dart      ← Consciousness + AgentMind extension
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   β”œβ”€β”€ episodic_memory.dart
β”‚   β”‚   β”œβ”€β”€ semantic_memory.dart
β”‚   β”‚   β”œβ”€β”€ working_memory.dart
β”‚   β”‚   └── memory_manager.dart
β”‚   β”œβ”€β”€ perception/
β”‚   β”‚   β”œβ”€β”€ sensory_input.dart
β”‚   β”‚   β”œβ”€β”€ feature_extraction.dart
β”‚   β”‚   └── perception_buffer.dart
β”‚   β”œβ”€β”€ reasoning/
β”‚   β”‚   β”œβ”€β”€ inference_engine.dart
β”‚   β”‚   β”œβ”€β”€ conceptual_graph.dart
β”‚   β”‚   β”œβ”€β”€ causal_inference.dart
β”‚   β”‚   └── pattern_recognizer.dart
β”‚   β”œβ”€β”€ integration/
β”‚   β”‚   β”œβ”€β”€ cross_modal_binding.dart
β”‚   β”‚   β”œβ”€β”€ synchronization.dart
β”‚   β”‚   └── coherence_manager.dart
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ logger.dart
β”‚   β”‚   β”œβ”€β”€ metrics.dart
β”‚   β”‚   └── visualization.dart
β”‚   └── agent/                      ← Autonomous agent framework
β”‚       β”œβ”€β”€ agent_models.dart       ← AgentGoal, AgentTask, AgentDecision, …
β”‚       β”œβ”€β”€ memory/
β”‚       β”‚   └── agent_memory_store.dart
β”‚       β”œβ”€β”€ llm/
β”‚       β”‚   β”œβ”€β”€ llm_provider.dart   ← Echo / Mock / Http providers
β”‚       β”‚   └── llm_core.dart       ← LLMCore (reason, compress, parse)
β”‚       β”œβ”€β”€ tools/
β”‚       β”‚   β”œβ”€β”€ tool_interface.dart ← Tool, ToolResult, ToolRegistry, ToolRouter
β”‚       β”‚   └── builtin_tools.dart  ← 6 built-in tools + _MathParser
β”‚       β”œβ”€β”€ planning/
β”‚       β”‚   └── planning_engine.dart← ExecutionDAG + PlanningEngine
β”‚       β”œβ”€β”€ loop/
β”‚       β”‚   └── agent_loop.dart     ← AgentLoopController + events + adapters
β”‚       └── reflection/
β”‚           └── self_reflection.dart← SelfReflectionModule (4 detectors)
β”œβ”€β”€ example/
β”‚   β”œβ”€β”€ basic_consciousness.dart    ← Consciousness quick-start
β”‚   β”œβ”€β”€ advanced_awareness.dart     ← Attention, plugins, metrics
β”‚   β”œβ”€β”€ learning_simulation.dart    ← Rule learning + inference
β”‚   β”œβ”€β”€ multi_modal_integration.dart← Cross-modal binding
β”‚   β”œβ”€β”€ autonomous_agent.dart       ← Agent with MockLLMProvider + events
β”‚   └── multi_tool_agent.dart       ← All 6 tools + custom tool + reflection
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ core_test.dart
β”‚   β”œβ”€β”€ memory_test.dart
β”‚   β”œβ”€β”€ perception_test.dart
β”‚   β”œβ”€β”€ reasoning_test.dart
β”‚   β”œβ”€β”€ integration_test.dart
β”‚   └── agent/
β”‚       β”œβ”€β”€ agent_models_test.dart
β”‚       β”œβ”€β”€ llm_core_test.dart
β”‚       β”œβ”€β”€ tool_system_test.dart
β”‚       β”œβ”€β”€ planning_engine_test.dart
β”‚       └── agent_loop_test.dart
└── doc/
    β”œβ”€β”€ AGENT_ARCHITECTURE.md       ← Deep-dive agent architecture doc
    β”œβ”€β”€ THEORY.md                   ← Scientific foundations (GWT, binding, …)
    └── PERFORMANCE_GUIDE.md        ← Tuning tips and benchmarks

πŸ§ͺ Running Examples #

# Autonomous agent (MockLLMProvider, no API key needed)
dart run example/autonomous_agent.dart

# All 6 tools + custom tool + self-reflection
dart run example/multi_tool_agent.dart

# Basic consciousness demo
dart run example/basic_consciousness.dart

# Advanced attention & plugins
dart run example/advanced_awareness.dart

βœ… Running Tests #

# All tests
dart test

# Consciousness-only tests
dart test test/core_test.dart test/memory_test.dart \
          test/perception_test.dart test/reasoning_test.dart \
          test/integration_test.dart

# Agent framework tests
dart test test/agent/

# Single file
dart test test/agent/agent_loop_test.dart

Test coverage:

Suite What is tested
core_test Concept, WorkspaceManager, AttentionSpotlight, BindingEngine
memory_test EpisodicMemory, SemanticMemory, WorkingMemory, MemoryManager
perception_test FeatureExtractor, PerceptionBuffer, SensoryInputProcessor
reasoning_test InferenceEngine, ConceptualGraph, CausalInference, PatternRecognizer
integration_test CrossModalBinding, Synchronization, CoherenceManager, end-to-end
agent_models_test AgentGoal, AgentTask, AgentDecision, AgentContext, AgentRunResult
llm_core_test EchoLLMProvider, MockLLMProvider, LLMCore.reason(), compressContext
tool_system_test ToolResult, ToolRegistry, ToolRouter, all 6 built-in tools
planning_engine_test ExecutionDAG, PlanningEngine (rule-based + LLM-backed + lifecycle)
agent_loop_test AgentLoopController, events, adapters, stop(), SelfReflectionModule

πŸ“š Documentation #

Document Content
README.md This file β€” getting started, API reference
doc/AGENT_ARCHITECTURE.md Deep-dive agent architecture: layers, data flow, extension guide, config tables
THEORY.md Scientific foundations: GWT, binding theory, memory models, inference
PERFORMANCE_GUIDE.md Tuning tips, benchmarks, memory sizing

πŸ—ΊοΈ Roadmap #

v1.0 βœ… (Current) #

  • Core workspace + attention spotlight
  • Tri-level memory (episodic, semantic, working)
  • Rule-based, causal, and associative inference
  • Cross-modal binding and coherence
  • Pattern recognition over concept streams
  • Plugin system
  • Full autonomous agent framework (LLM + tools + planning + loop + reflection)
  • 6 built-in tools + custom tool API
  • MockLLMProvider for zero-config testing
  • HttpLLMProvider for OpenAI-compatible backends

v1.5 🚧 #

  • Reinforcement learning from agent feedback
  • Emotion and mood state modelling with valence tracking
  • Advanced causal chains (Pearl Level 2)
  • Real-time streaming perception pipeline
  • Vector-embedding semantic search in AgentMemoryStore

v2.0 πŸ“‹ #

  • Self-referential awareness (meta-cognition module)
  • Personality and value system encoded as inference rules
  • Social reasoning: multi-agent coordination
  • Gradual consciousness growth simulation

v3.0+ 🎯 #

  • AGI-lite: creative problem solving with hypothesis generation
  • Ethical reasoning and value alignment
  • Full self-model and autobiographical continuity
  • Multi-modal LLM integration (vision, audio)

πŸ“„ License #

MIT Β© 2026 consciousness_sim contributors


πŸ“– References #

  • Baars, B. J. (1988). A cognitive theory of consciousness. Cambridge University Press.
  • Dehaene, S. (2014). Consciousness and the Brain. Viking.
  • Tulving, E. (1972). Episodic and semantic memory. In Organization of Memory (pp. 381–403).
  • Baddeley, A. D. & Hitch, G. (1974). Working memory. Psychology of Learning and Motivation, 8, 47–89.
  • Pearl, J. (2000). Causality: Models, Reasoning, and Inference. Cambridge University Press.
  • Miller, G. A. (1956). The magical number seven. Psychological Review, 63(2), 81–97.

See THEORY.md for the complete annotated bibliography.

0
likes
130
points
26
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An advanced Dart library simulating machine consciousness based on Global Workspace Theory. Provides a sophisticated information-processing model that mimics attention mechanisms, memory systems, conceptual binding, and multi-layered inference β€” moving beyond simple AI recall toward genuine dynamic awareness.

Repository (GitHub)
View/report issues

Topics

#artificial-intelligence #consciousness #cognitive-science #machine-learning #ai

License

MIT (license)

Dependencies

collection, equatable, http, logging, meta, uuid

More

Packages that depend on consciousness_sim