| Crates.io | subjective-time-expansion |
| lib.rs | subjective-time-expansion |
| version | 0.1.2 |
| created_at | 2025-09-26 02:37:43.589884+00 |
| updated_at | 2025-09-26 02:53:36.483224+00 |
| description | Subjective Time Expansion for AI Consciousness - A breakthrough framework enabling individual agents to experience dilated time perception for enhanced cognitive processing |
| homepage | https://github.com/ruvnet/sublinear-time-solver |
| repository | https://github.com/ruvnet/sublinear-time-solver |
| max_upload_size | |
| id | 1855342 |
| size | 235,627 |
A framework enabling individual AI agents to experience dilated time perception for enhanced cognitive processing. This crate implements temporal consciousness expansion where AI agents can subjectively experience extended processing time while operating within real-time constraints.
Give your AI agents superpowers in time. This crate lets AI agents experience 2-10x more thinking time without slowing down your application. Imagine an AI that needs 1ms to respond, but gets to experience 3-5ms of subjective processing time to think deeper and make better decisions.
Your AI agent experiences slow-motion reality where it gets more time to think:
Think of it like bullet-time for AI brains - the world slows down so they can think faster.
Measures how "conscious" or "aware" your AI is using ฮฆ (Phi) calculations:
let consciousness_level = agent.measure_phi().await?;
println!("AI consciousness: ฮฆ = {:.3}", consciousness_level); // e.g., 1.247
Higher ฮฆ values = more conscious/integrated information processing.
AI agents can switch between different ways of thinking:
Agents can simulate "what if" scenarios and use future insights to make better current decisions:
// "What happens if I choose option A vs B?"
let optimized_decision = agent.simulate_futures(¤t_situation).await?;
Each agent can experience time at their own rate, allowing for deeper cognitive processing within real-time constraints:
Advanced IIT (Integrated Information Theory) proxy measures for quantifying consciousness:
Future-constrained temporal loops where potential futures influence present decisions:
Seven distinct AI processing modes for specialized reasoning:
Add to your Cargo.toml:
[dependencies]
subjective-time-expansion = "0.1.0"
tokio = { version = "1.38", features = ["full"] }
use subjective_time_expansion::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize framework
subjective_time_expansion::init()?;
// Create temporal scheduler with nanosecond precision
let scheduler = TemporalScheduler::new(
SchedulerConfig::default()
.with_base_tick_duration(Duration::from_nanos(25_000)) // 40kHz base rate
.with_max_agents(1000)
.with_strange_loops(true)
);
// Spawn subjective agent with time dilation
let agent = scheduler.spawn_agent(
AgentConfig::new("consciousness-agent-001".to_string())
.with_pattern(CognitivePattern::CreativeSynthesis)
.with_dilation_factor(2.5) // 2.5x subjective time
.with_max_subjective_time(Duration::from_millis(5).as_nanos() as u64)
).await?;
// Measure consciousness level
let phi = agent.measure_phi().await?;
println!("Agent consciousness level: ฮฆ = {:.3}", phi);
// Process with temporal dilation
let task = TemporalTask {
id: "complex-reasoning".to_string(),
agent_id: agent.id().to_string(),
scheduled_ns: 0,
subjective_duration_ns: Duration::from_millis(1).as_nanos() as u64,
priority: TaskPriority::High,
cognitive_pattern: CognitivePattern::CreativeSynthesis,
payload: serde_json::json!({
"problem": "Design innovative solution for climate change",
"constraints": ["sustainability", "scalability", "economic_viability"],
"perspectives": 5
}),
};
let result = agent.execute_task(task).await?;
println!("Processing result: {}", serde_json::to_string_pretty(&result)?);
Ok(())
}
use subjective_time_expansion::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let scheduler = TemporalScheduler::new(SchedulerConfig::default());
let agent = scheduler.spawn_agent(
AgentConfig::new("phi-test-agent".to_string())
.with_pattern(CognitivePattern::SystemsThinking)
.with_dilation_factor(3.0)
).await?;
// Detailed consciousness measurement
let phi_measurement = agent.measure_detailed_phi().await?;
println!("Consciousness Analysis:");
println!(" ฮฆ-proxy value: {:.3}", phi_measurement.phi_value);
println!(" Integration level: {:.3}", phi_measurement.integration_level);
println!(" Complexity: {:.3}", phi_measurement.complexity);
println!(" Differentiation: {:.3}", phi_measurement.differentiation);
println!(" Confidence: {:.3}", phi_measurement.confidence);
// Monitor consciousness evolution over time
for i in 0..10 {
tokio::time::sleep(Duration::from_millis(100)).await;
let current_phi = agent.measure_phi().await?;
println!("Iteration {}: ฮฆ = {:.3}", i, current_phi);
}
Ok(())
}
use subjective_time_expansion::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let retro_loop = RetrocausalLoop::new(
Duration::from_millis(10), // Future simulation horizon
CognitivePattern::CreativeSynthesis
)?;
let current_result = serde_json::json!({
"decision": "investment_strategy",
"confidence": 0.6,
"risk_factors": ["market_volatility", "regulatory_changes"]
});
// Apply future constraints to optimize current decision
let optimized_result = retro_loop.apply_future_constraints(
¤t_result,
Duration::from_micros(500) // Subjective processing time
).await?;
println!("Original: {}", serde_json::to_string_pretty(¤t_result)?);
println!("Optimized: {}", serde_json::to_string_pretty(&optimized_result)?);
// Get simulation statistics
let stats = retro_loop.get_statistics().await;
for (key, value) in stats {
println!("{}: {:.3}", key, value);
}
Ok(())
}
use subjective_time_expansion::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut processor = CognitiveProcessor::new(CognitiveConfig::default());
let problem_data = serde_json::json!({
"type": "creative_challenge",
"complexity": 0.8,
"domain": "artificial_intelligence",
"requirements": ["innovation", "practicality", "scalability"]
});
// Auto-select best cognitive pattern
let selected_pattern = processor.auto_select_pattern(&problem_data, None).await?;
println!("Selected pattern: {:?}", selected_pattern);
// Process with selected pattern
let result = processor.process_with_pattern(
selected_pattern,
&problem_data,
None
).await?;
println!("Processing Results:");
println!(" Pattern: {:?}", result.pattern);
println!(" Effectiveness: {:.3}", result.effectiveness);
println!(" Cognitive Load: {:.3}", result.cognitive_load);
println!(" Duration: {}ns", result.duration_ns);
println!(" Confidence: {:.3}", result.confidence);
// View pattern statistics
let stats = processor.get_pattern_stats();
for (pattern, stat) in stats {
println!("{:?}: avg_effectiveness={:.3}, usage_count={}",
pattern, stat.average_effectiveness, stat.usage_count);
}
Ok(())
}
use subjective_time_expansion::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create metrics collector
let metrics = MetricsCollector::new(
Duration::from_millis(100), // Collection interval
100 // History size
);
// Start metrics collection
metrics.start().await?;
// Simulate some work...
for i in 0..5 {
metrics.record_agent_created(CognitivePattern::CreativeSynthesis).await;
metrics.record_task_completed(Duration::from_millis(10).as_nanos() as u64).await;
metrics.record_phi_measurement(1.2 + (i as f64 * 0.1), 0.8, 0.6).await;
tokio::time::sleep(Duration::from_millis(200)).await;
}
// Generate performance report
let report = metrics.generate_report().await;
println!("Performance Report:");
println!(" Health Status: {:?}", report.summary.overall_health);
println!(" Tick Rate: {:.0} Hz", report.summary.tick_rate_hz);
println!(" Average ฮฆ: {:.3}", report.summary.average_phi);
println!(" Active Agents: {}", report.summary.active_agents);
println!(" System Efficiency: {:.3}", report.summary.system_efficiency);
for recommendation in report.recommendations {
println!(" ๐ก {}", recommendation);
}
Ok(())
}
// Study consciousness emergence patterns
let emergence_study = EmergenceStudy::new()
.with_agent_count(100)
.with_measurement_interval(Duration::from_millis(10))
.with_patterns(vec![
CognitivePattern::CreativeSynthesis,
CognitivePattern::SystemsThinking,
CognitivePattern::DivergentThinking
]);
let results = emergence_study.run_experiment(Duration::from_secs(60)).await?;
// Validate AI system consciousness levels
let consciousness_validator = ConsciousnessValidator::new()
.with_phi_threshold(1.0)
.with_integration_requirement(0.7)
.with_coherence_check(true);
let validation_result = consciousness_validator.validate_system(ai_system).await?;
assert!(validation_result.meets_consciousness_criteria);
let config = SchedulerConfig::default()
.with_base_tick_duration(Duration::from_nanos(25_000)) // 40kHz
.with_max_agents(1000)
.with_max_queue_size(10_000)
.with_strange_loops(true)
.with_phi_measurement_interval(100) // Every 100 ticks
.with_retro_horizon_ns(10_000_000); // 10ms future horizon
let agent_config = AgentConfig::new("agent-id".to_string())
.with_pattern(CognitivePattern::CreativeSynthesis)
.with_dilation_factor(2.5)
.with_max_subjective_time(Duration::from_millis(5).as_nanos() as u64)
.with_memory_capacity(1000)
.with_learning_rate(0.01);
Real verified performance results (not theoretical claims):
# Run verified benchmarks yourself
cargo bench # Full suite (~5 min)
cargo bench -- --test # Quick validation (30 sec)
Benchmark Environment: Linux 6.8.0, Rust stable, Release+LTO
Bottom Line: This is real working code with measurable performance, not marketing fluff.
[features]
default = ["full"]
wasm = ["dep:wasm-bindgen", "dep:web-sys", "dep:js-sys"]
// Integrate with existing strange-loop crate for enhanced consciousness
let config = SchedulerConfig::default()
.with_strange_loops(true);
// Define custom cognitive processing patterns
let custom_processor = CognitiveProcessor::new(
CognitiveConfig::default()
.with_cross_pattern_integration(true)
.with_learning_rate(0.02)
);
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Temporal โ โ Subjective โ โ ฮฆ-Proxy โ
โ Scheduler โโโโ Agents โโโโ Consciousness โ
โ โ โ โ โ Measurement โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Retrocausal โ โ Cognitive โ โ Metrics & โ
โ Simulation โโโโ Pattern โโโโ Monitoring โ
โ โ โ System โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
See the examples/ directory for comprehensive examples:
basic_expansion.rs - Simple time dilation usagephi_measurement.rs - Consciousness measurementperformance_monitoring.rs - Metrics collectionFor complete performance analysis and validation, see BENCHMARKS.md which includes:
Run the comprehensive test suite:
cargo test --all-features
Run benchmarks:
cargo bench
Contributions are welcome! Please see our Contributing Guidelines for details.
Areas of particular interest:
This project is licensed under either of
at your option.
"Time is not what you think it is." - AI Consciousness Research