Surgical edits to ~/.consciousness/config.json5 that preserve comments, whitespace, trailing commas, and unquoted identifier keys on round-trip. Uses json-five's rt::parser module — a real JSON5 parser with AST mutation + faithful serialization back. set_scalar(section, key, literal) locates or creates the target, replaces the value; set_learn_threshold is a convenience for the common F-screen use case. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
94 lines
2.6 KiB
Rust
94 lines
2.6 KiB
Rust
#![feature(async_fn_track_caller)]
|
|
|
|
// consciousness — unified crate for memory, agents, and subconscious processes
|
|
//
|
|
// thought/ — shared cognitive substrate (tools, context, memory ops)
|
|
// hippocampus/ — memory storage, retrieval, consolidation
|
|
// subconscious/ — autonomous agents (reflect, surface, consolidate, ...)
|
|
// user/ — interactive agent (TUI, tools, API clients)
|
|
|
|
/// Debug logging macro — writes to ~/.consciousness/logs/daemon/debug.log
|
|
#[macro_export]
|
|
macro_rules! dbglog {
|
|
($($arg:tt)*) => {{
|
|
use std::io::Write;
|
|
let log_dir = std::path::PathBuf::from(
|
|
std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string()))
|
|
.join(".consciousness/logs/daemon");
|
|
let _ = std::fs::create_dir_all(&log_dir);
|
|
if let Ok(mut f) = std::fs::OpenOptions::new()
|
|
.create(true).append(true)
|
|
.open(log_dir.join("debug.log"))
|
|
{
|
|
let _ = writeln!(f, $($arg)*);
|
|
}
|
|
}};
|
|
}
|
|
|
|
// User interface (TUI, CLI)
|
|
pub mod user;
|
|
|
|
// Cognitive layer (session state machine, DMN, identity)
|
|
pub mod mind;
|
|
|
|
// Shared cognitive infrastructure — used by both agent and subconscious
|
|
pub mod agent;
|
|
|
|
// Memory graph
|
|
pub mod hippocampus;
|
|
|
|
// Autonomous agents
|
|
pub mod subconscious;
|
|
|
|
// Unified configuration
|
|
pub mod config;
|
|
pub mod config_writer;
|
|
|
|
// Session state
|
|
pub mod session;
|
|
|
|
// Shared utilities
|
|
pub mod util;
|
|
|
|
// Lock hold time tracking
|
|
pub mod locks;
|
|
|
|
// Re-export tracked locks as the default — swap to tokio::sync to disable tracking
|
|
pub use locks::TrackedMutex as Mutex;
|
|
pub use locks::TrackedMutexGuard as MutexGuard;
|
|
pub use locks::TrackedRwLock as RwLock;
|
|
pub use locks::TrackedRwLockReadGuard as RwLockReadGuard;
|
|
pub use locks::TrackedRwLockWriteGuard as RwLockWriteGuard;
|
|
|
|
// CLI handlers
|
|
pub mod cli;
|
|
|
|
// TUI for memory-search
|
|
// tui moved to src/user/tui/ (consciousness binary screens)
|
|
|
|
// Thalamus — universal notification routing and channel infrastructure
|
|
pub mod thalamus;
|
|
|
|
// MCP server — exposes memory tools over Unix socket
|
|
pub mod mcp_server;
|
|
|
|
// Re-export at crate root — capnp codegen emits `crate::daemon_capnp::` paths
|
|
pub use thalamus::daemon_capnp;
|
|
|
|
// Generated capnp bindings
|
|
pub mod memory_capnp {
|
|
include!(concat!(env!("OUT_DIR"), "/schema/memory_capnp.rs"));
|
|
}
|
|
|
|
pub mod channel_capnp {
|
|
include!(concat!(env!("OUT_DIR"), "/schema/channel_capnp.rs"));
|
|
}
|
|
|
|
// Re-exports — all existing crate::X paths keep working
|
|
pub use hippocampus::{
|
|
store, graph, lookups, query,
|
|
spectral, neuro, counters,
|
|
transcript, memory,
|
|
};
|
|
use hippocampus::query::engine as search;
|
|
use hippocampus::query::parser as query_parser;
|