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:
parent
8ee0d90388
commit
6a1660cc9d
13 changed files with 35 additions and 28 deletions
|
|
@ -9,7 +9,9 @@ use std::fs;
|
|||
use std::io::{self, Read};
|
||||
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)]
|
||||
#[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 {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +91,7 @@ fn run_agent_and_parse(agent: &str, session_arg: &Option<String>) {
|
|||
let session_id = session_arg.clone()
|
||||
.or_else(|| std::env::var("CLAUDE_SESSION_ID").ok())
|
||||
.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))
|
||||
.map(|s| s.session_id)
|
||||
})
|
||||
|
|
@ -202,10 +204,10 @@ fn main() {
|
|||
let mut buf = String::new();
|
||||
io::stdin().read_to_string(&mut buf).ok();
|
||||
if buf.trim().is_empty() {
|
||||
fs::read_to_string(STASH_PATH).unwrap_or_default()
|
||||
fs::read_to_string(stash_path()).unwrap_or_default()
|
||||
} else {
|
||||
let _ = fs::create_dir_all("/tmp/claude-memory-search");
|
||||
let _ = fs::write(STASH_PATH, &buf);
|
||||
let _ = fs::create_dir_all(stash_path().parent().unwrap());
|
||||
let _ = fs::write(stash_path(), &buf);
|
||||
buf
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
// merge-logs <old_log> <current_log> <output_dir>
|
||||
//
|
||||
// Example:
|
||||
// merge-logs ~/.claude/memory/checkpoints/nodes.capnp \
|
||||
// ~/.claude/memory/nodes.capnp \
|
||||
// merge-logs ~/.consciousness/checkpoints/nodes.capnp \
|
||||
// ~/.consciousness/nodes.capnp \
|
||||
// /tmp/merged-store
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
|
@ -196,9 +196,9 @@ fn main() -> Result<(), String> {
|
|||
|
||||
eprintln!();
|
||||
eprintln!("Merge complete. To use the merged log:");
|
||||
eprintln!(" 1. Back up ~/.claude/memory/nodes.capnp");
|
||||
eprintln!(" 2. cp {} ~/.claude/memory/nodes.capnp", output_path.display());
|
||||
eprintln!(" 3. rm ~/.claude/memory/state.bin ~/.claude/memory/snapshot.rkyv");
|
||||
eprintln!(" 1. Back up ~/.consciousness/nodes.capnp");
|
||||
eprintln!(" 2. cp {} ~/.consciousness/nodes.capnp", output_path.display());
|
||||
eprintln!(" 3. rm ~/.consciousness/state.bin ~/.consciousness/snapshot.rkyv");
|
||||
eprintln!(" 4. poc-memory admin fsck");
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ fn maybe_trigger_observation(transcript: &PathBuf) {
|
|||
|
||||
fn check_context(transcript: &PathBuf, rate_limit: bool) {
|
||||
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(last) = s.trim().parse::<u64>() {
|
||||
if now_secs() - last < RATE_LIMIT_SECS {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue