Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(config): add heartbeat cron and subconscious schema types

Steven Enamakel23b8dc0dca93
diff --git a/crates/openhuman-core/src/config/schema/cron.rs b/crates/openhuman-core/src/config/schema/cron.rs
new file mode 100644
index 0000000000..e810da11b2
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/cron.rs
@@ -0,0 +1,31 @@
+//! Cron scheduler configuration.
+
+use schemars::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+/// The `[cron]` config block.
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
+#[serde(default)]
+pub struct CronConfig {
+ #[serde(default = "default_cron_enabled")]
+ pub enabled: bool,
+ #[serde(default = "default_cron_max_run_history")]
+ pub max_run_history: usize,
+}
+
+fn default_cron_enabled() -> bool {
+ true
+}
+
+fn default_cron_max_run_history() -> usize {
+ 50
+}
+
+impl Default for CronConfig {
+ fn default() -> Self {
+ Self {
+ enabled: default_cron_enabled(),
+ max_run_history: default_cron_max_run_history(),
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/config/schema/heartbeat_cron.rs b/crates/openhuman-core/src/config/schema/heartbeat_cron.rs
deleted file mode 100644
index 1ad8daaad9..0000000000
--- a/crates/openhuman-core/src/config/schema/heartbeat_cron.rs
+++ /dev/null
@@ -1,249 +0,0 @@
-//! Heartbeat, cron, and subconscious mode configuration.
-
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-
-/// Subconscious operating mode — controls tool access and tick frequency.
-#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
-#[serde(rename_all = "lowercase")]
-pub enum SubconsciousMode {
- /// Disabled — the subconscious loop does not run.
- #[default]
- Off,
- /// Read-only observation every 30 minutes. Memory recall and file
- /// reading only — no writes, no sub-agent spawning.
- Simple,
- /// Full tool access every 5 minutes. Can write, spawn sub-agents,
- /// and delegate tasks to the orchestrator.
- Aggressive,
- /// Event-driven: full tool access, woken by the trigger pipeline (cron /
- /// user message / Composio webhook / sub-agent conclusion) rather than a
- /// fixed interval. The cron cadence is the periodic-heartbeat fallback.
- #[serde(rename = "event_driven")]
- EventDriven,
-}
-
-impl SubconsciousMode {
- pub fn is_enabled(self) -> bool {
- !matches!(self, Self::Off)
- }
-
- pub fn default_interval_minutes(self) -> u32 {
- match self {
- Self::Off => 5,
- Self::Simple => 30,
- Self::Aggressive => 5,
- // Periodic heartbeat fallback cadence; real reactivity comes
- // from the event pipeline, not the timer.
- Self::EventDriven => 5,
- }
- }
-
- pub fn is_read_only(self) -> bool {
- matches!(self, Self::Simple)
- }
-
- /// Whether this mode runs the event-driven trigger pipeline.
- pub fn is_event_driven(self) -> bool {
- matches!(self, Self::EventDriven)
- }
-
- pub fn as_str(self) -> &'static str {
- match self {
- Self::Off => "off",
- Self::Simple => "simple",
- Self::Aggressive => "aggressive",
- Self::EventDriven => "event_driven",
- }
- }
-
- pub fn from_str_lossy(s: &str) -> Self {
- match s {
- "simple" => Self::Simple,
- "aggressive" => Self::Aggressive,
- "event_driven" => Self::EventDriven,
- _ => Self::Off,
- }
- }
-}
-
-/// Heartbeat configuration — periodic background loop that evaluates
-/// HEARTBEAT.md tasks and proactive notification sources.
-#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
-#[serde(default)]
-pub struct HeartbeatConfig {
- /// Enable the heartbeat loop. Opt-in because ticks may call hosted models
- /// and integration APIs depending on routing and enabled collectors.
- #[serde(default)]
- pub enabled: bool,
- /// Tick interval in minutes (minimum 5).
- #[serde(default = "default_interval_minutes")]
- pub interval_minutes: u32,
- /// Enable subconscious inference. When false, heartbeat only counts tasks
- /// without model-backed reasoning.
- #[serde(default)]
- pub inference_enabled: bool,
- /// Maximum token budget for the situation report (default 40k).
- #[serde(default = "default_context_budget")]
- pub context_budget_tokens: u32,
- /// Enable proactive notifications for upcoming meetings.
- #[serde(default)]
- pub notify_meetings: bool,
- /// Enable proactive notifications for reminders and scheduled items.
- #[serde(default)]
- pub notify_reminders: bool,
- /// Enable proactive notifications for urgent/relevant events.
- #[serde(default)]
- pub notify_relevant_events: bool,
- /// Allow heartbeat proactive events to also deliver to active external channel.
- /// Defaults to false and acts as an explicit consent gate.
- #[serde(default)]
- pub external_delivery_enabled: bool,
- /// Maximum lookahead window for meeting notifications.
- #[serde(default = "default_meeting_lookahead_minutes")]
- pub meeting_lookahead_minutes: u32,
- /// Maximum active calendar connections polled per heartbeat planner tick.
- #[serde(
- default = "default_max_calendar_connections_per_tick",
- deserialize_with = "deserialize_calendar_connection_limit"
- )]
- pub max_calendar_connections_per_tick: u32,
- /// Maximum lookahead window for reminder notifications.
- #[serde(default = "default_reminder_lookahead_minutes")]
- pub reminder_lookahead_minutes: u32,
- /// Subconscious operating mode. Controls tool access and tick frequency.
- /// Off (default) = disabled. Simple = read-only every 30 min.
- /// Aggressive = full access every 5 min.
- #[serde(default)]
- pub subconscious_mode: SubconsciousMode,
- /// Enable the event-driven subconscious trigger pipeline (cron / user
- /// message / Composio webhook / sub-agent conclusion → LLM gate →
- /// long-lived orchestrator session). Opt-in: when false, the legacy
- /// interval-only heartbeat path is unchanged.
- #[serde(default)]
- pub triggers_enabled: bool,
- /// Per-hour cap on trigger promotions (long-lived session runs). Bounds
- /// the always-on loop's spend ceiling.
- #[serde(default = "default_max_promotions_per_hour")]
- pub max_promotions_per_hour: u32,
- /// Enable Codex-style autonomous continuation of thread goals: when a thread
- /// with an `active` goal goes idle (no in-flight turn, no recent activity),
- /// the heartbeat injects one continuation turn to keep working it. Opt-in
- /// (default false) because it spends model/integration budget without a user
- /// present — matching the project's stance on autonomous features.
- #[serde(default)]
- pub goal_continuation_enabled: bool,
- /// Minutes a thread goal must be idle before a continuation turn may fire.
- /// Clamped to at least 1.
- #[serde(default = "default_goal_idle_minutes")]
- pub goal_idle_minutes: u32,
-}
-
-fn default_max_promotions_per_hour() -> u32 {
- 30
-}
-
-fn default_goal_idle_minutes() -> u32 {
- 10
-}
-
-fn default_context_budget() -> u32 {
- 40_000
-}
-
-fn default_interval_minutes() -> u32 {
- 5
-}
-
-fn default_meeting_lookahead_minutes() -> u32 {
- 120
-}
-
-fn default_max_calendar_connections_per_tick() -> u32 {
- 2
-}
-
-fn deserialize_calendar_connection_limit<'de, D>(deserializer: D) -> Result<u32, D::Error>
-where
- D: serde::Deserializer<'de>,
-{
- let value = Option::<u32>::deserialize(deserializer)?;
- Ok(value
- .unwrap_or_else(default_max_calendar_connections_per_tick)
- .max(1))
-}
-
-fn default_reminder_lookahead_minutes() -> u32 {
- 30
-}
-
-impl Default for HeartbeatConfig {
- fn default() -> Self {
- Self {
- enabled: false,
- interval_minutes: default_interval_minutes(),
- inference_enabled: false,
- context_budget_tokens: default_context_budget(),
- notify_meetings: false,
- notify_reminders: false,
- notify_relevant_events: false,
- external_delivery_enabled: false,
- meeting_lookahead_minutes: default_meeting_lookahead_minutes(),
- max_calendar_connections_per_tick: default_max_calendar_connections_per_tick(),
- reminder_lookahead_minutes: default_reminder_lookahead_minutes(),
- subconscious_mode: SubconsciousMode::Off,
- triggers_enabled: false,
- max_promotions_per_hour: default_max_promotions_per_hour(),
- goal_continuation_enabled: false,
- goal_idle_minutes: default_goal_idle_minutes(),
- }
- }
-}
-
-impl HeartbeatConfig {
- /// Resolve the effective subconscious mode, handling backward
- /// compatibility for configs that pre-date the `subconscious_mode`
- /// field. If `subconscious_mode` is explicitly set (not Off-by-default),
- /// use it. Otherwise, if the legacy `enabled && inference_enabled`
- /// flags are true, treat as `Simple`.
- pub fn effective_subconscious_mode(&self) -> SubconsciousMode {
- if self.subconscious_mode != SubconsciousMode::Off {
- return self.subconscious_mode;
- }
- if self.enabled && self.inference_enabled {
- SubconsciousMode::Simple
- } else {
- SubconsciousMode::Off
- }
- }
-}
-
-#[cfg(test)]
-#[path = "heartbeat_cron_tests.rs"]
-mod tests;
-
-#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
-#[serde(default)]
-pub struct CronConfig {
- #[serde(default = "default_cron_enabled")]
- pub enabled: bool,
- #[serde(default = "default_cron_max_run_history")]
- pub max_run_history: usize,
-}
-
-fn default_cron_enabled() -> bool {
- true
-}
-
-fn default_cron_max_run_history() -> usize {
- 50
-}
-
-impl Default for CronConfig {
- fn default() -> Self {
- Self {
- enabled: default_cron_enabled(),
- max_run_history: default_cron_max_run_history(),
- }
- }
-}
diff --git a/crates/openhuman-core/src/config/schema/heartbeat_cron_tests.rs b/crates/openhuman-core/src/config/schema/heartbeat_cron_tests.rs
deleted file mode 100644
index e3dc40cde0..0000000000
--- a/crates/openhuman-core/src/config/schema/heartbeat_cron_tests.rs
+++ /dev/null
@@ -1,131 +0,0 @@
-use super::*;
-
-#[test]
-fn heartbeat_defaults_are_opt_in() {
- let config = HeartbeatConfig::default();
- assert!(!config.enabled);
- assert!(!config.inference_enabled);
- assert!(!config.notify_meetings);
- assert!(!config.notify_reminders);
- assert!(!config.notify_relevant_events);
- assert!(!config.external_delivery_enabled);
- assert_eq!(config.interval_minutes, 5);
- assert_eq!(config.max_calendar_connections_per_tick, 2);
- assert_eq!(config.subconscious_mode, SubconsciousMode::Off);
- // Event-driven trigger pipeline is opt-in (back-compat: old configs
- // without these keys deserialize to the legacy interval-only path).
- assert!(!config.triggers_enabled);
- assert_eq!(config.max_promotions_per_hour, 30);
-}
-
-#[test]
-fn legacy_config_without_trigger_keys_deserializes() {
- // A config file predating the trigger pipeline must still parse and
- // default to the disabled (legacy) path.
- let legacy = r#"{ "enabled": true, "inference_enabled": true }"#;
- let config: HeartbeatConfig = serde_json::from_str(legacy).unwrap();
- assert!(!config.triggers_enabled);
- assert_eq!(config.max_promotions_per_hour, 30);
- assert_eq!(
- config.effective_subconscious_mode(),
- SubconsciousMode::Simple
- );
-}
-
-#[test]
-fn event_driven_mode_serde_and_helpers() {
- assert_eq!(
- serde_json::to_string(&SubconsciousMode::EventDriven).unwrap(),
- r#""event_driven""#
- );
- assert_eq!(
- serde_json::from_str::<SubconsciousMode>(r#""event_driven""#).unwrap(),
- SubconsciousMode::EventDriven
- );
- assert!(SubconsciousMode::EventDriven.is_enabled());
- assert!(SubconsciousMode::EventDriven.is_event_driven());
- assert!(!SubconsciousMode::Aggressive.is_event_driven());
- assert!(!SubconsciousMode::EventDriven.is_read_only());
- assert_eq!(
- SubconsciousMode::from_str_lossy("event_driven"),
- SubconsciousMode::EventDriven
- );
-}
-
-#[test]
-fn subconscious_mode_serde_round_trip() {
- assert_eq!(
- serde_json::to_string(&SubconsciousMode::Simple).unwrap(),
- r#""simple""#
- );
- assert_eq!(
- serde_json::from_str::<SubconsciousMode>(r#""aggressive""#).unwrap(),
- SubconsciousMode::Aggressive
- );
- assert_eq!(SubconsciousMode::default(), SubconsciousMode::Off);
-}
-
-#[test]
-fn subconscious_mode_helpers() {
- assert!(!SubconsciousMode::Off.is_enabled());
- assert!(SubconsciousMode::Simple.is_enabled());
- assert!(SubconsciousMode::Aggressive.is_enabled());
- assert!(SubconsciousMode::Simple.is_read_only());
- assert!(!SubconsciousMode::Aggressive.is_read_only());
- assert_eq!(SubconsciousMode::Simple.default_interval_minutes(), 30);
- assert_eq!(SubconsciousMode::Aggressive.default_interval_minutes(), 5);
-}
-
-#[test]
-fn effective_mode_backward_compat() {
- let mut config = HeartbeatConfig::default();
- assert_eq!(config.effective_subconscious_mode(), SubconsciousMode::Off);
-
- config.enabled = true;
- config.inference_enabled = true;
- assert_eq!(
- config.effective_subconscious_mode(),
- SubconsciousMode::Simple
- );
-
- config.subconscious_mode = SubconsciousMode::Aggressive;
- assert_eq!(
- config.effective_subconscious_mode(),
- SubconsciousMode::Aggressive
- );
-}
-
-#[test]
-fn heartbeat_deserialization_fills_opt_in_defaults() {
- let config: HeartbeatConfig = serde_json::from_str("{}").unwrap();
- assert!(!config.enabled);
- assert!(!config.inference_enabled);
- assert!(!config.notify_meetings);
- assert!(!config.notify_reminders);
- assert!(!config.notify_relevant_events);
- assert!(!config.external_delivery_enabled);
- assert_eq!(config.interval_minutes, 5);
- assert_eq!(config.max_calendar_connections_per_tick, 2);
- assert_eq!(config.meeting_lookahead_minutes, 120);
- assert_eq!(config.reminder_lookahead_minutes, 30);
-
- let partial: HeartbeatConfig =
- serde_json::from_str(r#"{"enabled":true,"interval_minutes":15}"#).unwrap();
- assert!(partial.enabled);
- assert_eq!(partial.interval_minutes, 15);
- assert!(!partial.inference_enabled);
- assert!(!partial.notify_meetings);
- assert_eq!(partial.max_calendar_connections_per_tick, 2);
-
- let zero_cap: HeartbeatConfig =
- serde_json::from_str(r#"{"max_calendar_connections_per_tick":0}"#).unwrap();
- assert_eq!(zero_cap.max_calendar_connections_per_tick, 1);
-
- let null_cap: HeartbeatConfig =
- serde_json::from_str(r#"{"max_calendar_connections_per_tick":null}"#).unwrap();
- assert_eq!(null_cap.max_calendar_connections_per_tick, 2);
-
- let explicit_cap: HeartbeatConfig =
- serde_json::from_str(r#"{"max_calendar_connections_per_tick":4}"#).unwrap();
- assert_eq!(explicit_cap.max_calendar_connections_per_tick, 4);
-}
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index 27cf866420..470124a11b 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -9,8 +9,6 @@ pub use cloud_providers::{
};
pub mod ephemeral_route;
pub use ephemeral_route::{EphemeralRoute, EPHEMERAL_ROUTE_SLUG};
-pub mod subconscious;
-pub use subconscious::{SubconsciousConfig, SubconsciousEngine};
mod agent;
mod autonomy;
mod capability_providers;
@@ -21,6 +19,7 @@ pub use cli_overrides::AppliedInferenceOverride;
mod computer;
pub use computer::{ComputerConfig, DecisionModel};
mod context;
+mod cron;
mod dashboard;
mod desktop;
pub use desktop::DesktopConfig;
@@ -28,7 +27,6 @@ mod defaults;
mod dictation;
mod hooks;
pub use hooks::HooksConfig;
-mod heartbeat_cron;
pub mod hosting;
pub use hosting::HostingConfig;
mod identity_cost;
@@ -90,7 +88,7 @@ pub(crate) use cli_overrides::set_cli_inference_overrides;
pub use context::ContextConfig;
pub use dashboard::{DashboardConfig, DiagramViewerConfig, EventStreamConfig, ModelHealthConfig};
pub use dictation::{DictationActivationMode, DictationConfig};
-pub use heartbeat_cron::{CronConfig, HeartbeatConfig, SubconsciousMode};
+pub use cron::CronConfig;
pub use identity_cost::{CostConfig, ModelPricing};
pub use learning::{LearningConfig, ReflectionSource};
pub use local_ai::{LocalAiConfig, LocalAiUsage};
diff --git a/crates/openhuman-core/src/config/schema/subconscious.rs b/crates/openhuman-core/src/config/schema/subconscious.rs
deleted file mode 100644
index a25fbab453..0000000000
--- a/crates/openhuman-core/src/config/schema/subconscious.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-//! Subconscious engine selection. The local graph is the supported engine.
-
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-
-/// Which engine runs the subconscious reflect/commit cognition.
-#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
-#[serde(rename_all = "lowercase")]
-pub enum SubconsciousEngine {
- /// The local tinyagents subconscious graph.
- /// Accept the retired name when loading old configuration, then persist
- /// the supported value on the next save.
- #[default]
- #[serde(alias = "medulla")]
- Local,
-}
-
-/// The `[subconscious]` config block.
-#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema)]
-#[serde(default)]
-pub struct SubconsciousConfig {
- /// Which engine drives the subconscious tick. Default `local`.
- #[serde(default)]
- pub engine: SubconsciousEngine,
-}
-
-#[cfg(test)]
-#[path = "subconscious_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/config/schema/subconscious_tests.rs b/crates/openhuman-core/src/config/schema/subconscious_tests.rs
deleted file mode 100644
index 3b5ae76fb6..0000000000
--- a/crates/openhuman-core/src/config/schema/subconscious_tests.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use super::*;
-
-#[test]
-fn default_engine_is_local() {
- assert_eq!(
- SubconsciousConfig::default().engine,
- SubconsciousEngine::Local
- );
-}
-
-#[test]
-fn legacy_engine_deserializes_as_local_and_serializes_as_local() {
- let config: SubconsciousConfig =
- serde_json::from_str(r#"{"engine":"medulla","medulla_local":{"serve_entry":"retired"}}"#)
- .unwrap();
- assert_eq!(config.engine, SubconsciousEngine::Local);
- assert_eq!(serde_json::to_string(&config.engine).unwrap(), r#""local""#);
-}
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index 5940f4e742..67e791a84f 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -225,15 +225,6 @@ pub struct Config {
#[serde(default)]
pub embedding_routes: Vec<EmbeddingRouteConfig>,
- #[serde(default)]
- pub heartbeat: HeartbeatConfig,
-
- /// Subconscious engine selection (local tinyagents graph vs. local
- /// retired engine). Default `local` — omitting this block preserves
- /// the historical behavior exactly.
- #[serde(default)]
- pub subconscious: crate::config::schema::SubconsciousConfig,
-
#[serde(default)]
pub cron: CronConfig,
@@ -419,18 +410,10 @@ pub struct Config {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_embeddings: Option<CustomEmbeddingsConfig>,
- /// Provider string for the heartbeat background-reasoning loop.
- #[serde(default)]
- pub heartbeat_provider: Option<String>,
-
/// Provider string for learning / reflection passes.
#[serde(default)]
pub learning_provider: Option<String>,
- /// Provider string for subconscious evaluation and drift checks.
- #[serde(default)]
- pub subconscious_provider: Option<String>,
-
/// Node.js managed runtime configuration (skills that need `node`/`npm`).
#[serde(default)]
pub node: NodeConfig,
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index 5460060b4a..871d37ff98 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -61,8 +61,6 @@ impl Default for Config {
context: ContextConfig::default(),
model_routes: Vec::new(),
embedding_routes: Vec::new(),
- heartbeat: HeartbeatConfig::default(),
- subconscious: crate::config::schema::SubconsciousConfig::default(),
cron: CronConfig::default(),
task_sources: TaskSourcesConfig::default(),
channels_config: ChannelsConfig::default(),
@@ -102,9 +100,7 @@ impl Default for Config {
memory_provider: None,
embeddings_provider: None,
custom_embeddings: None,
- heartbeat_provider: None,
learning_provider: None,
- subconscious_provider: None,
node: NodeConfig::default(),
runtime_python: RuntimePythonConfig::default(),
runtime_pool: RuntimePoolConfig::default(),