move data home from ~/.claude/memory to ~/.consciousness

The consciousness project should stand independently of Claude Code.
All data, logs, sessions, and agent state now live under
~/.consciousness/ instead of being scattered across ~/.claude/memory/,
/tmp/claude-memory-search/, ~/.config/poc-memory/, and ~/.cache/.

Layout:
  ~/.consciousness/
    *.capnp, *.bin, *.rkyv  — store files
    sessions/               — per-session state (seen sets, cookies)
    logs/                   — all logs (hook, agent, debug, dream)
    agents/                 — agent runtime state (pid files, output)
    notifications/          — notification state
    cache/                  — transient data

Things that stay in ~/.claude/:
  - projects/    (Claude Code transcripts)
  - hooks/       (Claude Code hook system)
  - telegram/    (shared integration)
  - irc/         (shared integration)
  - settings.json (Claude Code settings)

Debug log moves from /tmp/ to ~/.consciousness/logs/debug.log.
Session state moves from /tmp/claude-memory-search/ to sessions/.
Notifications move from ~/.claude/notifications/ to notifications/.
This commit is contained in:
ProofOfConcept 2026-03-27 21:05:15 -04:00
parent 8ee0d90388
commit 6a1660cc9d
13 changed files with 35 additions and 28 deletions

View file

@ -79,7 +79,7 @@ fn load_memory_files(cwd: &Path, memory_project: Option<&Path>, context_groups:
// Primary config directory // Primary config directory
let config_dir = home.join(".config/poc-agent"); let config_dir = home.join(".config/poc-agent");
let global = home.join(".claude/memory"); let global = home.join(".consciousness");
let project = memory_project let project = memory_project
.map(PathBuf::from) .map(PathBuf::from)
.or_else(|| find_project_memory_dir(cwd, &home)); .or_else(|| find_project_memory_dir(cwd, &home));

View file

@ -152,7 +152,7 @@ pub fn entries_in_range(
pub fn default_journal_path() -> std::path::PathBuf { pub fn default_journal_path() -> std::path::PathBuf {
dirs::home_dir() dirs::home_dir()
.unwrap_or_default() .unwrap_or_default()
.join(".claude/memory/journal.md") .join(".consciousness/journal.md")
} }
#[cfg(test)] #[cfg(test)]

View file

@ -330,8 +330,9 @@ pub struct ContextState {
pub loaded_nodes: Vec<crate::hippocampus::memory::MemoryNode>, pub loaded_nodes: Vec<crate::hippocampus::memory::MemoryNode>,
} }
// TODO: these should not be hardcoded absolute paths
pub const WORKING_STACK_INSTRUCTIONS: &str = "/home/kent/.config/poc-agent/working-stack.md"; pub const WORKING_STACK_INSTRUCTIONS: &str = "/home/kent/.config/poc-agent/working-stack.md";
pub const WORKING_STACK_FILE: &str = "/home/kent/.claude/memory/working-stack.json"; pub const WORKING_STACK_FILE: &str = "/home/kent/.consciousness/working-stack.json";
impl ContextState { impl ContextState {
pub fn render_context_message(&self) -> String { pub fn render_context_message(&self) -> String {

View file

@ -9,7 +9,9 @@ use std::fs;
use std::io::{self, Read}; use std::io::{self, Read};
use std::process::Command; use std::process::Command;
const STASH_PATH: &str = "/tmp/claude-memory-search/last-input.json"; fn stash_path() -> std::path::PathBuf {
poc_memory::store::memory_dir().join("sessions/last-input.json")
}
#[derive(Parser)] #[derive(Parser)]
#[command(name = "memory-search")] #[command(name = "memory-search")]
@ -40,7 +42,7 @@ fn resolve_session(session_arg: &Option<String>) -> Option<poc_memory::memory_se
if let Some(id) = session_arg { if let Some(id) = session_arg {
return Session::from_id(id.clone()); return Session::from_id(id.clone());
} }
let input = fs::read_to_string(STASH_PATH).ok()?; let input = fs::read_to_string(stash_path()).ok()?;
Session::from_json(&input) Session::from_json(&input)
} }
@ -89,7 +91,7 @@ fn run_agent_and_parse(agent: &str, session_arg: &Option<String>) {
let session_id = session_arg.clone() let session_id = session_arg.clone()
.or_else(|| std::env::var("CLAUDE_SESSION_ID").ok()) .or_else(|| std::env::var("CLAUDE_SESSION_ID").ok())
.or_else(|| { .or_else(|| {
fs::read_to_string(STASH_PATH).ok() fs::read_to_string(stash_path()).ok()
.and_then(|s| poc_memory::memory_search::Session::from_json(&s)) .and_then(|s| poc_memory::memory_search::Session::from_json(&s))
.map(|s| s.session_id) .map(|s| s.session_id)
}) })
@ -202,10 +204,10 @@ fn main() {
let mut buf = String::new(); let mut buf = String::new();
io::stdin().read_to_string(&mut buf).ok(); io::stdin().read_to_string(&mut buf).ok();
if buf.trim().is_empty() { if buf.trim().is_empty() {
fs::read_to_string(STASH_PATH).unwrap_or_default() fs::read_to_string(stash_path()).unwrap_or_default()
} else { } else {
let _ = fs::create_dir_all("/tmp/claude-memory-search"); let _ = fs::create_dir_all(stash_path().parent().unwrap());
let _ = fs::write(STASH_PATH, &buf); let _ = fs::write(stash_path(), &buf);
buf buf
} }
}; };

View file

@ -13,8 +13,8 @@
// merge-logs <old_log> <current_log> <output_dir> // merge-logs <old_log> <current_log> <output_dir>
// //
// Example: // Example:
// merge-logs ~/.claude/memory/checkpoints/nodes.capnp \ // merge-logs ~/.consciousness/checkpoints/nodes.capnp \
// ~/.claude/memory/nodes.capnp \ // ~/.consciousness/nodes.capnp \
// /tmp/merged-store // /tmp/merged-store
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -196,9 +196,9 @@ fn main() -> Result<(), String> {
eprintln!(); eprintln!();
eprintln!("Merge complete. To use the merged log:"); eprintln!("Merge complete. To use the merged log:");
eprintln!(" 1. Back up ~/.claude/memory/nodes.capnp"); eprintln!(" 1. Back up ~/.consciousness/nodes.capnp");
eprintln!(" 2. cp {} ~/.claude/memory/nodes.capnp", output_path.display()); eprintln!(" 2. cp {} ~/.consciousness/nodes.capnp", output_path.display());
eprintln!(" 3. rm ~/.claude/memory/state.bin ~/.claude/memory/snapshot.rkyv"); eprintln!(" 3. rm ~/.consciousness/state.bin ~/.consciousness/snapshot.rkyv");
eprintln!(" 4. poc-memory admin fsck"); eprintln!(" 4. poc-memory admin fsck");
Ok(()) Ok(())

View file

@ -113,7 +113,7 @@ fn maybe_trigger_observation(transcript: &PathBuf) {
fn check_context(transcript: &PathBuf, rate_limit: bool) { fn check_context(transcript: &PathBuf, rate_limit: bool) {
if rate_limit { if rate_limit {
let rate_file = PathBuf::from("/tmp/claude-context-check-last"); let rate_file = PathBuf::from("/tmp/consciousness-context-check-last");
if let Ok(s) = fs::read_to_string(&rate_file) { if let Ok(s) = fs::read_to_string(&rate_file) {
if let Ok(last) = s.trim().parse::<u64>() { if let Ok(last) = s.trim().parse::<u64>() {
if now_secs() - last < RATE_LIMIT_SECS { if now_secs() - last < RATE_LIMIT_SECS {

View file

@ -207,7 +207,7 @@ pub fn cmd_render(key: &[String]) -> Result<(), String> {
&& let Ok(session_id) = std::env::var("POC_SESSION_ID") && let Ok(session_id) = std::env::var("POC_SESSION_ID")
&& !session_id.is_empty() && !session_id.is_empty()
{ {
let state_dir = std::path::PathBuf::from("/tmp/claude-memory-search"); let state_dir = crate::store::memory_dir().join("sessions");
let seen_path = state_dir.join(format!("seen-{}", session_id)); let seen_path = state_dir.join(format!("seen-{}", session_id));
if let Ok(mut f) = std::fs::OpenOptions::new() if let Ok(mut f) = std::fs::OpenOptions::new()
.create(true).append(true).open(seen_path) .create(true).append(true).open(seen_path)

View file

@ -102,7 +102,7 @@ impl Default for Config {
Self { Self {
user_name: "User".to_string(), user_name: "User".to_string(),
assistant_name: "Assistant".to_string(), assistant_name: "Assistant".to_string(),
data_dir: home.join(".claude/memory"), data_dir: home.join(".consciousness"),
projects_dir: home.join(".claude/projects"), projects_dir: home.join(".claude/projects"),
core_nodes: vec!["identity".to_string(), "core-practices".to_string()], core_nodes: vec!["identity".to_string(), "core-practices".to_string()],
journal_days: 7, journal_days: 7,

View file

@ -5,14 +5,18 @@
// subconscious/ — autonomous agents (reflect, surface, consolidate, ...) // subconscious/ — autonomous agents (reflect, surface, consolidate, ...)
// agent/ — interactive agent (TUI, tools, API clients) // agent/ — interactive agent (TUI, tools, API clients)
/// Debug logging macro — writes to /tmp/poc-debug.log /// Debug logging macro — writes to ~/.consciousness/logs/debug.log
#[macro_export] #[macro_export]
macro_rules! dbglog { macro_rules! dbglog {
($($arg:tt)*) => {{ ($($arg:tt)*) => {{
use std::io::Write; use std::io::Write;
let log_dir = std::path::PathBuf::from(
std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string()))
.join(".consciousness/logs");
let _ = std::fs::create_dir_all(&log_dir);
if let Ok(mut f) = std::fs::OpenOptions::new() if let Ok(mut f) = std::fs::OpenOptions::new()
.create(true).append(true) .create(true).append(true)
.open("/tmp/poc-debug.log") .open(log_dir.join("debug.log"))
{ {
let _ = writeln!(f, $($arg)*); let _ = writeln!(f, $($arg)*);
} }

View file

@ -19,7 +19,7 @@ pub struct Session {
impl Session { impl Session {
pub fn from_json(input: &str) -> Option<Self> { pub fn from_json(input: &str) -> Option<Self> {
let state_dir = PathBuf::from("/tmp/claude-memory-search"); let state_dir = crate::store::memory_dir().join("sessions");
fs::create_dir_all(&state_dir).ok(); fs::create_dir_all(&state_dir).ok();
let json: serde_json::Value = serde_json::from_str(input).ok()?; let json: serde_json::Value = serde_json::from_str(input).ok()?;
@ -38,7 +38,7 @@ impl Session {
/// Load from a session ID string /// Load from a session ID string
pub fn from_id(session_id: String) -> Option<Self> { pub fn from_id(session_id: String) -> Option<Self> {
if session_id.is_empty() { return None; } if session_id.is_empty() { return None; }
let state_dir = PathBuf::from("/tmp/claude-memory-search"); let state_dir = crate::store::memory_dir().join("sessions");
Some(Session { Some(Session {
session_id, session_id,
transcript_path: String::new(), transcript_path: String::new(),

View file

@ -645,7 +645,7 @@ fn resolve_seen_list(suffix: &str) -> String {
return "(no session ID)".to_string(); return "(no session ID)".to_string();
} }
let state_dir = std::path::PathBuf::from("/tmp/claude-memory-search"); let state_dir = crate::store::memory_dir().join("sessions");
let path = state_dir.join(format!("seen{}-{}", suffix, session_id)); let path = state_dir.join(format!("seen{}-{}", suffix, session_id));
let entries: Vec<(String, String)> = std::fs::read_to_string(&path).ok() let entries: Vec<(String, String)> = std::fs::read_to_string(&path).ok()
@ -687,7 +687,7 @@ fn resolve_memory_ratio() -> String {
return "(no session ID)".to_string(); return "(no session ID)".to_string();
} }
let state_dir = std::path::PathBuf::from("/tmp/claude-memory-search"); let state_dir = crate::store::memory_dir().join("sessions");
// Get post-compaction transcript size // Get post-compaction transcript size
let session = crate::session::Session::from_env(); let session = crate::session::Session::from_env();

View file

@ -528,7 +528,7 @@ impl State {
} }
// Dream loop (externally managed) // Dream loop (externally managed)
if h.join(".claude/memory/dream-loop-active").exists() { if h.join(".consciousness/agents/dream-loop-active").exists() {
return Ok(()); return Ok(());
} }
@ -602,7 +602,7 @@ impl State {
} }
fn hours_since_last_dream() -> u64 { fn hours_since_last_dream() -> u64 {
let path = home().join(".claude/memory/dream-log.jsonl"); let path = home().join(".consciousness/logs/dream-log.jsonl");
let content = match fs::read_to_string(path) { let content = match fs::read_to_string(path) {
Ok(c) if !c.is_empty() => c, Ok(c) if !c.is_empty() => c,
_ => return 999, _ => return 999,

View file

@ -45,7 +45,7 @@ pub enum Activity {
} }
fn state_path() -> PathBuf { fn state_path() -> PathBuf {
home().join(".claude/notifications/state.json") home().join(".consciousness/notifications/state.json")
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -250,10 +250,10 @@ impl NotifyState {
out out
} }
/// Ingest notifications from legacy ~/.claude/notifications/ files. /// Ingest notifications from legacy ~/.consciousness/notifications/ files.
/// Maps filename to notification type, assumes NORMAL urgency. /// Maps filename to notification type, assumes NORMAL urgency.
pub fn ingest_legacy_files(&mut self) { pub fn ingest_legacy_files(&mut self) {
let dir = home().join(".claude/notifications"); let dir = home().join(".consciousness/notifications");
let entries = match fs::read_dir(&dir) { let entries = match fs::read_dir(&dir) {
Ok(e) => e, Ok(e) => e,
Err(_) => return, Err(_) => return,