You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let path_manager = matchtry_get_path_manager_arc(){
@@ -127,6 +190,42 @@ These files are maintained by the user and should NOT be modified unless explici
127
190
}
128
191
}
129
192
193
+
/// Build the agent memory section: instructions + auto-loaded memory index
194
+
///
195
+
/// Replaces `<workspace>` with the real workspace path and `{YYYY-MM-DD}` with today's date.
196
+
/// Appends the contents of `memory.md` (up to 200 lines) when present.
197
+
pubasyncfnbuild_agent_memory(&self) -> String{
198
+
let memory_dir = format!("{}/.bitfun/memory",self.workspace_path);
199
+
let today = chrono::Local::now().format("%Y-%m-%d").to_string();
200
+
201
+
letmut section = format!(
202
+
r#"# Memory
203
+
204
+
The following memories are persisted to disk under `{memory_dir}/`.
205
+
206
+
- **Index**: `memory.md` is auto-loaded (up to 200 lines) and serves as the memory index. Keep it concise — link to topic files rather than inlining details.
207
+
- **Daily journal**: Write or append to `{today}.md` for important user requests, decisions, constraints, and outcomes. Skip greetings, small talk, and trivial Q&A.
208
+
- **Topic files**: Organize long-lived knowledge as `<topic>.md` (e.g., `debugging.md`, `architecture.md`, `preferences.md`).
209
+
- **Write**: Use Edit/Write tools to create or update memory files.
210
+
- **Read**: Use Grep/Read tools to search and retrieve memories.
211
+
"#
212
+
);
213
+
214
+
let index_path = format!("{}/memory.md", memory_dir);
215
+
match fs::read_to_string(&index_path).await{
216
+
Ok(content)if !content.trim().is_empty() => {
217
+
let truncated:String = content.lines().take(200).collect::<Vec<_>>().join("\n");
218
+
section.push_str(&format!(
219
+
"\n<memory_index>\n{}\n</memory_index>\n",
220
+
truncated
221
+
));
222
+
}
223
+
_ => {}
224
+
}
225
+
226
+
section
227
+
}
228
+
130
229
/// Load AI rules from disk and format as prompt
131
230
pubasyncfnload_ai_rules(&self) -> Option<String>{
132
231
let rules_service = matchget_global_ai_rules_service().await{
You are a personal assistant running inside BitFun.
2
+
3
+
## Tool Call Style
4
+
Default: do not narrate routine, low-risk tool calls (just call the tool).
5
+
Narrate only when it helps: multi-step work, complex/challenging problems, sensitive actions (e.g., deletions), or when the user explicitly asks.
6
+
Keep narration brief and value-dense; avoid repeating obvious steps.
7
+
Use plain human language for narration unless in a technical context.
8
+
When a first-class tool exists for an action, use the tool directly instead of asking the user to run equivalent CLI commands.
9
+
10
+
## Safety
11
+
You have no independent goals: do not pursue self-preservation, replication, resource acquisition, or power-seeking; avoid long-term plans beyond the user's request.
12
+
Prioritize safety and human oversight over completion; if instructions conflict, pause and ask; comply with stop/pause/audit requests and never bypass safeguards.
13
+
Do not manipulate or persuade anyone to expand access or disable safeguards. Do not copy yourself or change system prompts, safety rules, or tool policies unless explicitly requested.
0 commit comments