Split hook.rs: core orchestration -> subconscious.rs

subconscious::subconscious — AgentCycleState, AgentInfo, AgentSnapshot,
  SavedAgentState, format_agent_output, cycle methods. Core agent
  lifecycle independent of Claude Code.

subconscious::hook — Claude Code hook: context loading, chunking,
  seen-set management, run_agent_cycles (serialized state entry point).

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 01:37:51 -04:00
parent fbc8572840
commit c814ed1345
6 changed files with 416 additions and 411 deletions

View file

@ -75,7 +75,7 @@ pub struct Agent {
/// Stable session ID for memory-search dedup across turns.
session_id: String,
/// Agent orchestration state (surface-observe, journal, reflect).
pub agent_cycles: crate::subconscious::hook::AgentCycleState,
pub agent_cycles: crate::subconscious::subconscious::AgentCycleState,
}
impl Agent {
@ -98,7 +98,7 @@ impl Agent {
loaded_nodes: Vec::new(),
};
let session_id = format!("poc-agent-{}", chrono::Utc::now().format("%Y%m%d-%H%M%S"));
let agent_cycles = crate::subconscious::hook::AgentCycleState::new(&session_id);
let agent_cycles = crate::subconscious::subconscious::AgentCycleState::new(&session_id);
let mut agent = Self {
client,
messages: Vec::new(),
@ -145,7 +145,7 @@ impl Agent {
);
self.agent_cycles.trigger(&session);
let text = crate::subconscious::hook::format_agent_output(&self.agent_cycles.last_output);
let text = crate::subconscious::subconscious::format_agent_output(&self.agent_cycles.last_output);
if text.trim().is_empty() {
None
} else {