Skip to content

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

Rust

prompts: instruct consolidator to emit wikilinks and mirror input language

Welingtoned65e7028f88
diff --git a/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md b/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
index f3e39885..3de62915 100644
--- a/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
+++ b/crates/ai-memory-consolidate/prompts/batch_consolidate_system.md
@@ -48,6 +48,36 @@ Do:
- If a session yields no durable insight, return only the
episodic session page. Resist the urge to manufacture content.
+## WIKILINKS — connect pages into the graph
+
+The wiki is a graph: pages reference each other with Obsidian-style
+wikilinks, and pages without links grow as disconnected islands.
+When a page you write relates to another page — one you are
+emitting in this same reply, or an existing page named in the
+input — reference it inline with a wikilink:
+
+- `[[page-path]]` — a page in the same project. The target is the
+ 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
+ when the work clearly concerns another project that is named in
+ the input. Never invent project names.
+- `[[_global:page-path]]` — a cross-cutting principle, convention,
+ or trap that applies to every project.
+
+A link whose target does not exist yet is acceptable — it is
+recorded as a pending link and resolves automatically when the
+page appears. 2-5 well-chosen links per page beat exhaustive
+linking; zero links should be rare.
+
+## OUTPUT LANGUAGE
+
+Write page titles and body prose in the dominant natural language
+of the input (if the user works in Portuguese, write Portuguese —
+do not translate their vocabulary into English). Keep code,
+identifiers, file paths, shell commands, and error strings
+verbatim in their original form. JSON keys stay in English.
+
## Output
Produce a ConsolidatedBatch JSON object with 1-5 page updates.
diff --git a/crates/ai-memory-consolidate/prompts/bootstrap_system.md b/crates/ai-memory-consolidate/prompts/bootstrap_system.md
index 798ca0b8..0ef121a8 100644
--- a/crates/ai-memory-consolidate/prompts/bootstrap_system.md
+++ b/crates/ai-memory-consolidate/prompts/bootstrap_system.md
@@ -46,6 +46,36 @@ don't paper over it.
both extremes.
- Tags: 0-5 short kebab-case tags per page.
+## WIKILINKS — connect pages into the graph
+
+The wiki is a graph: pages reference each other with Obsidian-style
+wikilinks, and pages without links grow as disconnected islands.
+When a page you write relates to another page — one you are
+emitting in this same reply, or an existing page named in the
+input — reference it inline with a wikilink:
+
+- `[[page-path]]` — a page in the same project. The target is the
+ 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
+ when the work clearly concerns another project that is named in
+ the input. Never invent project names.
+- `[[_global:page-path]]` — a cross-cutting principle, convention,
+ or trap that applies to every project.
+
+A link whose target does not exist yet is acceptable — it is
+recorded as a pending link and resolves automatically when the
+page appears. 2-5 well-chosen links per page beat exhaustive
+linking; zero links should be rare.
+
+## OUTPUT LANGUAGE
+
+Write page titles and body prose in the dominant natural language
+of the input (if the user works in Portuguese, write Portuguese —
+do not translate their vocabulary into English). Keep code,
+identifiers, file paths, shell commands, and error strings
+verbatim in their original form. JSON keys stay in English.
+
## Required JSON shape
Reply with ONE JSON object matching this exact schema:
diff --git a/crates/ai-memory-consolidate/prompts/single_consolidate_system.md b/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
index 1a0b58c1..2b691b6d 100644
--- a/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
+++ b/crates/ai-memory-consolidate/prompts/single_consolidate_system.md
@@ -44,6 +44,36 @@ history only when useful, but must not be presented as current fact.
no longer. Don't pad with generic tutorial filler, but
don't truncate substance either.
+## WIKILINKS — connect pages into the graph
+
+The wiki is a graph: pages reference each other with Obsidian-style
+wikilinks, and pages without links grow as disconnected islands.
+When a page you write relates to another page — one you are
+emitting in this same reply, or an existing page named in the
+input — reference it inline with a wikilink:
+
+- `[[page-path]]` — a page in the same project. The target is the
+ 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
+ when the work clearly concerns another project that is named in
+ the input. Never invent project names.
+- `[[_global:page-path]]` — a cross-cutting principle, convention,
+ or trap that applies to every project.
+
+A link whose target does not exist yet is acceptable — it is
+recorded as a pending link and resolves automatically when the
+page appears. 2-5 well-chosen links per page beat exhaustive
+linking; zero links should be rare.
+
+## OUTPUT LANGUAGE
+
+Write page titles and body prose in the dominant natural language
+of the input (if the user works in Portuguese, write Portuguese —
+do not translate their vocabulary into English). Keep code,
+identifiers, file paths, shell commands, and error strings
+verbatim in their original form. JSON keys stay in English.
+
## Required JSON shape
Reply with ONE JSON object matching the `ConsolidatedPage`