MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / regenerate_cursor_memory_rule

Function regenerate_cursor_memory_rule

src/hooks/memory_inject.rs:482–490  ·  view source on GitHub ↗

Regenerates the materialized Cursor memory rule for `root`, writing only when content changed (hash check) and only when the tracedecay Cursor plugin is installed and the target file is absent or tracedecay-generated. Workspaces without an initialized store still rewrite the managed rule to an empty placeholder so stale facts from another workspace cannot remain always-applied. Fail-open: returns

(root: &Path)

Source from the content-addressed store, hash-verified

480/// an empty placeholder so stale facts from another workspace cannot remain
481/// always-applied. Fail-open: returns whether the file was (re)written.
482pub async fn regenerate_cursor_memory_rule(root: &Path) -> bool {
483 if !memory_injection_enabled() {
484 return false;
485 }
486 let Some(home) = dirs::home_dir() else {
487 return false;
488 };
489 regenerate_cursor_memory_rule_with_home(root, &home).await
490}
491
492async fn regenerate_cursor_memory_rule_with_home(root: &Path, home: &Path) -> bool {
493 let rule_path = crate::agents::cursor::cursor_memory_rule_path(home);

Callers 3

Calls 3

memory_injection_enabledFunction · 0.85
home_dirFunction · 0.50

Tested by

no test coverage detected