journal: remove all stringly-typed key patterns, use NodeType
- journal_new: key is slugified title (agent names things properly)
- journal_tail: sort by created_at (immutable), not timestamp (mutable)
- journal_update: find latest by created_at
- {{latest_journal}}: query by NodeType::EpisodicSession, not "journal" key
- poc-memory journal write: requires a name argument
- Removed all journal#j-{timestamp}-{slug} patterns from:
- prompts.rs (rename candidates)
- graph.rs (date extraction, organize skip list)
- cursor.rs (date extraction)
- store/mod.rs (doc comment)
- graph.rs organize: filter by NodeType::Semantic instead of key prefix
- cursor.rs: use created_at for date extraction instead of key parsing
Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
85fa54cba9
commit
eac59b423e
9 changed files with 63 additions and 67 deletions
|
|
@ -89,17 +89,13 @@ pub fn digest_parent(store: &Store, key: &str) -> Option<String> {
|
|||
if node.timestamp > 0 {
|
||||
dates.push(store::format_date(node.timestamp));
|
||||
}
|
||||
// Extract date from key patterns like "journal#2026-03-03-..." or "journal#j-2026-03-13t..."
|
||||
if let Some(rest) = key.strip_prefix("journal#j-").or_else(|| key.strip_prefix("journal#"))
|
||||
&& rest.len() >= 10 {
|
||||
let candidate = &rest[..10];
|
||||
if candidate.chars().nth(4) == Some('-') {
|
||||
let date = candidate.to_string();
|
||||
if !dates.contains(&date) {
|
||||
dates.push(date);
|
||||
}
|
||||
}
|
||||
// Extract date from created_at timestamp
|
||||
if node.created_at > 0 {
|
||||
let created_date = store::format_date(node.created_at);
|
||||
if !dates.contains(&created_date) {
|
||||
dates.push(created_date);
|
||||
}
|
||||
}
|
||||
for date in &dates {
|
||||
for prefix in [&format!("daily-{}", date), &format!("digest#daily#{}", date)] {
|
||||
for (k, n) in &store.nodes {
|
||||
|
|
|
|||
|
|
@ -566,19 +566,14 @@ fn add_implicit_temporal_edges(
|
|||
use chrono::{Datelike, DateTime, NaiveDate};
|
||||
|
||||
// Extract the covered date from a key name.
|
||||
// Patterns: "daily-2026-03-06", "daily-2026-03-06-identity",
|
||||
// "weekly-2026-W09", "monthly-2026-02"
|
||||
// "journal#j-2026-03-13t...", "journal#2026-03-13-..."
|
||||
// Patterns: "daily-2026-03-06", "daily-2026-03-06-identity"
|
||||
fn date_from_key(key: &str) -> Option<NaiveDate> {
|
||||
// Try extracting YYYY-MM-DD after known prefixes
|
||||
for prefix in ["daily-", "journal#j-", "journal#"] {
|
||||
if let Some(rest) = key.strip_prefix(prefix)
|
||||
&& rest.len() >= 10
|
||||
&& let Ok(d) = NaiveDate::parse_from_str(&rest[..10], "%Y-%m-%d") {
|
||||
return Some(d);
|
||||
}
|
||||
let rest = key.strip_prefix("daily-")?;
|
||||
if rest.len() >= 10 {
|
||||
NaiveDate::parse_from_str(&rest[..10], "%Y-%m-%d").ok()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn week_from_key(key: &str) -> Option<(i32, u32)> {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ use std::path::Path;
|
|||
use parse::classify_filename;
|
||||
|
||||
/// Strip .md suffix from a key, handling both bare keys and section keys.
|
||||
/// "journal.md#j-2026" → "journal#j-2026", "identity.md" → "identity", "identity" → "identity"
|
||||
/// "identity.md" → "identity", "foo.md#section" → "foo#section", "identity" → "identity"
|
||||
pub fn strip_md_suffix(key: &str) -> String {
|
||||
if let Some((file, section)) = key.split_once('#') {
|
||||
let bare = file.strip_suffix(".md").unwrap_or(file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue