Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(consolidate): require cross-scope links to appear in the observations

Peterson Salme7b959eed071b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85821214..6a24b812 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,9 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`broken_link`. The single, batch and bootstrap prompts told the model that a
missing link target was acceptable and gave it no list of cross-scope pages,
so it invented targets to meet the 2-5 link guidance. They now allow a
- `project:` or `_global:` link only when the exact target appears in the input,
- matching what lint accepts; a missing same-project target stays a pending
- link. (#1207)
+ `project:` or `_global:` link only when the exact target appears in the
+ session's observations, matching what lint accepts; a missing same-project
+ target stays a pending link. (#1207)
- Fixed the web UI answering HTTP 500 when a signed-in viewer opened a project
or page by a name that two projects answer to. The page and project routes
now return a 400 that names the clash, matching the API and MCP surfaces.
diff --git a/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md b/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
index 04d08d1b..3bfd4102 100644
--- a/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
+++ b/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
@@ -75,20 +75,20 @@ input — reference it inline with a wikilink:
page *path* relative to the project root
(e.g. `[[decisions/0003-no-vector-db]]`), not the display title.
- `[[project:page-path]]` — a page in a sibling project. Use it
- only when the input names both that project and that page path
+ only when the observations name both that project and that page path
— e.g. a fix in this project whose root cause lives in the
sibling project `billing` links `[[billing:audio-pipeline]]`.
Never invent project names or page paths.
- `[[_global:page-path]]` — a cross-cutting principle, convention,
or trap that applies to every project. Use it only when that
- exact path appears in the input.
+ exact path appears in the observations.
A same-project link whose target does not exist yet is acceptable
— it is recorded as a pending link and resolves automatically when
the page appears. A `project:` or `_global:` link is not: lint
reports a missing cross-scope target as broken. 2-5 well-chosen
links per page beat exhaustive linking; zero links should be rare,
-but never pad with a cross-scope link you cannot see in the input.
+but never pad with a cross-scope link you cannot see in the observations.
## OUTPUT LANGUAGE
diff --git a/crates/ai-memory-consolidate/prompts/bootstrap_system.md b/crates/ai-memory-consolidate/prompts/bootstrap_system.md
index 24728af2..013f93e4 100644
--- a/crates/ai-memory-consolidate/prompts/bootstrap_system.md
+++ b/crates/ai-memory-consolidate/prompts/bootstrap_system.md
@@ -66,20 +66,20 @@ input — reference it inline with a wikilink:
page *path* relative to the project root
(e.g. `[[decisions/0003-no-vector-db]]`), not the display title.
- `[[project:page-path]]` — a page in a sibling project. Use it
- only when the input names both that project and that page path
+ only when the observations name both that project and that page path
— e.g. a fix in this project whose root cause lives in the
sibling project `billing` links `[[billing:audio-pipeline]]`.
Never invent project names or page paths.
- `[[_global:page-path]]` — a cross-cutting principle, convention,
or trap that applies to every project. Use it only when that
- exact path appears in the input.
+ exact path appears in the observations.
A same-project link whose target does not exist yet is acceptable
— it is recorded as a pending link and resolves automatically when
the page appears. A `project:` or `_global:` link is not: lint
reports a missing cross-scope target as broken. 2-5 well-chosen
links per page beat exhaustive linking; zero links should be rare,
-but never pad with a cross-scope link you cannot see in the input.
+but never pad with a cross-scope link you cannot see in the observations.
## OUTPUT LANGUAGE
diff --git a/crates/ai-memory-consolidate/prompts/single_consolidate_system.md b/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
index cc35a2e7..6d3038af 100644
--- a/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
+++ b/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
@@ -71,20 +71,20 @@ input — reference it inline with a wikilink:
page *path* relative to the project root
(e.g. `[[decisions/0003-no-vector-db]]`), not the display title.
- `[[project:page-path]]` — a page in a sibling project. Use it
- only when the input names both that project and that page path
+ only when the observations name both that project and that page path
— e.g. a fix in this project whose root cause lives in the
sibling project `billing` links `[[billing:audio-pipeline]]`.
Never invent project names or page paths.
- `[[_global:page-path]]` — a cross-cutting principle, convention,
or trap that applies to every project. Use it only when that
- exact path appears in the input.
+ exact path appears in the observations.
A same-project link whose target does not exist yet is acceptable
— it is recorded as a pending link and resolves automatically when
the page appears. A `project:` or `_global:` link is not: lint
reports a missing cross-scope target as broken. 2-5 well-chosen
links per page beat exhaustive linking; zero links should be rare,
-but never pad with a cross-scope link you cannot see in the input.
+but never pad with a cross-scope link you cannot see in the observations.
## OUTPUT LANGUAGE
diff --git a/crates/ai-memory-consolidate/src/bootstrap.rs b/crates/ai-memory-consolidate/src/bootstrap.rs
index 798deed6..8136bdd5 100644
--- a/crates/ai-memory-consolidate/src/bootstrap.rs
+++ b/crates/ai-memory-consolidate/src/bootstrap.rs
@@ -1805,7 +1805,7 @@ mod tests {
#[test]
fn bootstrap_system_prompt_limits_cross_scope_links_to_input_targets() {
assert!(SYSTEM_PROMPT.contains("Never invent project names or page paths"));
- assert!(SYSTEM_PROMPT.contains("only when that\n exact path appears in the input"));
+ assert!(SYSTEM_PROMPT.contains("only when that\n exact path appears in the observations"));
assert!(SYSTEM_PROMPT.contains("never pad with a cross-scope link"));
assert!(!SYSTEM_PROMPT.contains("A link whose target does not exist yet is acceptable"));
}
diff --git a/crates/ai-memory-consolidate/src/consolidator.rs b/crates/ai-memory-consolidate/src/consolidator.rs
index adc337a2..9a989836 100644
--- a/crates/ai-memory-consolidate/src/consolidator.rs
+++ b/crates/ai-memory-consolidate/src/consolidator.rs
@@ -2968,7 +2968,7 @@ mod tests {
"{name} prompt"
);
assert!(
- prompt.contains("only when that\n exact path appears in the input"),
+ prompt.contains("only when that\n exact path appears in the observations"),
"{name} prompt"
);
assert!(