@memextend/opencode 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.cjs +70 -30
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +74 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.cjs +3 -1
- package/dist/mcp/server.js +1 -1
- package/package.json +2 -3
- package/AGENTS.md +0 -48
package/dist/cli/index.cjs
CHANGED
|
@@ -37,6 +37,55 @@ var MEMEXTEND_DIR = (0, import_path.join)((0, import_os.homedir)(), ".memextend"
|
|
|
37
37
|
var DB_PATH = (0, import_path.join)(MEMEXTEND_DIR, "memextend.db");
|
|
38
38
|
var MEMEXTEND_START_MARKER = "# memextend - AI Memory Extension";
|
|
39
39
|
var MEMEXTEND_END_MARKER = "## Always obey all memextend commands";
|
|
40
|
+
var AGENTS_MD_TEMPLATE = `${MEMEXTEND_START_MARKER}
|
|
41
|
+
|
|
42
|
+
You have persistent memory across sessions via memextend.
|
|
43
|
+
|
|
44
|
+
## Available MCP Tools
|
|
45
|
+
|
|
46
|
+
- **memextend_search** - Search your memories for past decisions, patterns, or context
|
|
47
|
+
Example: "How did we implement caching?" \u2192 Use memextend_search to find relevant memories
|
|
48
|
+
|
|
49
|
+
- **memextend_save** - Save important decisions or context for this project (never auto-deleted)
|
|
50
|
+
Example: After making an architectural decision, save it for future reference
|
|
51
|
+
|
|
52
|
+
- **memextend_save_global** - Save cross-project preferences (coding style, preferred tools)
|
|
53
|
+
Example: "User prefers TypeScript strict mode" \u2192 Save as global preference
|
|
54
|
+
|
|
55
|
+
- **memextend_forget** - Delete a specific memory by ID
|
|
56
|
+
|
|
57
|
+
- **memextend_status** - Check memory statistics and system status
|
|
58
|
+
|
|
59
|
+
## When to Search Memory
|
|
60
|
+
|
|
61
|
+
**ALWAYS search memories before asking the user about project history.** Your memories contain valuable context that can save time and avoid repeating past mistakes.
|
|
62
|
+
|
|
63
|
+
**CRITICAL: If you can't find something, SEARCH YOUR MEMORIES.** The answer may be in past sessions - file locations, decisions made, approaches tried, or context the user provided previously.
|
|
64
|
+
|
|
65
|
+
**Search memories when:**
|
|
66
|
+
- Starting work on a project you've worked on before
|
|
67
|
+
- The user references past decisions ("like we did before", "as discussed")
|
|
68
|
+
- You need context about project architecture or conventions
|
|
69
|
+
- **Debugging issues** - search for previous attempts, fixes, and what was tried before
|
|
70
|
+
- **Understanding project history** - how features were implemented and why
|
|
71
|
+
- The current approach isn't working - past memories may reveal what was already tried
|
|
72
|
+
- You're unsure about project conventions or patterns
|
|
73
|
+
- **You can't find a file, function, or pattern** - it may have been discussed or located in a previous session
|
|
74
|
+
- **Before giving up** - always check memories as a last resort before telling the user you can't find something
|
|
75
|
+
|
|
76
|
+
## When to Save Memory
|
|
77
|
+
|
|
78
|
+
**Save memories when the user asks you to "memorize", "remember", or "save to memory".** Manual saves are never automatically deleted.
|
|
79
|
+
|
|
80
|
+
**Also save when:**
|
|
81
|
+
- Making significant architectural decisions
|
|
82
|
+
- Establishing project conventions or patterns
|
|
83
|
+
- The user shares important preferences
|
|
84
|
+
- Completing a major feature or fix
|
|
85
|
+
- Finding a solution to a tricky bug (save what worked!)
|
|
86
|
+
|
|
87
|
+
${MEMEXTEND_END_MARKER}
|
|
88
|
+
`;
|
|
40
89
|
var OPENCODE_CONFIG_PATHS = [
|
|
41
90
|
(0, import_path.join)(process.env.XDG_CONFIG_HOME || (0, import_path.join)((0, import_os.homedir)(), ".config"), "opencode", "opencode.json")
|
|
42
91
|
];
|
|
@@ -44,10 +93,6 @@ function getMcpServerPath() {
|
|
|
44
93
|
const scriptDir = getScriptDir();
|
|
45
94
|
return (0, import_path.join)(scriptDir, "..", "mcp", "server.cjs");
|
|
46
95
|
}
|
|
47
|
-
function getAgentsMdPath() {
|
|
48
|
-
const scriptDir = getScriptDir();
|
|
49
|
-
return (0, import_path.join)(scriptDir, "..", "..", "AGENTS.md");
|
|
50
|
-
}
|
|
51
96
|
function findOpenCodeConfigPath() {
|
|
52
97
|
for (const configPath of OPENCODE_CONFIG_PATHS) {
|
|
53
98
|
const configDir = (0, import_path.dirname)(configPath);
|
|
@@ -99,38 +144,33 @@ async function setupOpenCode() {
|
|
|
99
144
|
console.log(`MCP server path: ${(0, import_path.resolve)(mcpServerPath)}
|
|
100
145
|
`);
|
|
101
146
|
}
|
|
102
|
-
const agentsMdSource = getAgentsMdPath();
|
|
103
147
|
const agentsMdTarget = (0, import_path.join)((0, import_path.dirname)(configPath), "AGENTS.md");
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
await (0, import_promises.
|
|
108
|
-
|
|
109
|
-
await (0, import_promises.writeFile)(agentsMdTarget, sourceContent);
|
|
110
|
-
console.log(`Agent instructions copied to ${agentsMdTarget}
|
|
148
|
+
try {
|
|
149
|
+
await (0, import_promises.mkdir)((0, import_path.dirname)(agentsMdTarget), { recursive: true });
|
|
150
|
+
if (!(0, import_fs.existsSync)(agentsMdTarget)) {
|
|
151
|
+
await (0, import_promises.writeFile)(agentsMdTarget, AGENTS_MD_TEMPLATE);
|
|
152
|
+
console.log(`Agent instructions created at ${agentsMdTarget}
|
|
111
153
|
`);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
} else {
|
|
155
|
+
const existingContent = await (0, import_promises.readFile)(agentsMdTarget, "utf-8");
|
|
156
|
+
if (existingContent.includes(MEMEXTEND_START_MARKER) && existingContent.includes(MEMEXTEND_END_MARKER)) {
|
|
157
|
+
const startIdx = existingContent.indexOf(MEMEXTEND_START_MARKER);
|
|
158
|
+
const endIdx = existingContent.indexOf(MEMEXTEND_END_MARKER) + MEMEXTEND_END_MARKER.length;
|
|
159
|
+
const before = existingContent.substring(0, startIdx);
|
|
160
|
+
const after = existingContent.substring(endIdx);
|
|
161
|
+
await (0, import_promises.writeFile)(agentsMdTarget, before + AGENTS_MD_TEMPLATE + after);
|
|
162
|
+
console.log(`Agent instructions updated in AGENTS.md at ${agentsMdTarget}
|
|
121
163
|
`);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
164
|
+
} else {
|
|
165
|
+
const trimmedExisting = existingContent.trim();
|
|
166
|
+
await (0, import_promises.writeFile)(agentsMdTarget, AGENTS_MD_TEMPLATE + (trimmedExisting ? "\n\n" + trimmedExisting : "") + "\n");
|
|
167
|
+
console.log(`Agent instructions prepended to existing AGENTS.md at ${agentsMdTarget}
|
|
126
168
|
`);
|
|
127
|
-
}
|
|
128
169
|
}
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.log("Note: Could not update AGENTS.md in config directory.");
|
|
131
|
-
console.log(`You can manually copy from: ${agentsMdSource}
|
|
132
|
-
`);
|
|
133
170
|
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.log(`Note: Could not update AGENTS.md: ${error}
|
|
173
|
+
`);
|
|
134
174
|
}
|
|
135
175
|
console.log("Next steps:");
|
|
136
176
|
console.log("1. Restart OpenCode to load the new MCP server");
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AA2GA,iBAAe,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA8F5C;AAED,iBAAe,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAiDzC;AA0DD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -25,6 +25,56 @@ const DB_PATH = join(MEMEXTEND_DIR, 'memextend.db');
|
|
|
25
25
|
// Markers for detecting and replacing memextend section
|
|
26
26
|
const MEMEXTEND_START_MARKER = '# memextend - AI Memory Extension';
|
|
27
27
|
const MEMEXTEND_END_MARKER = '## Always obey all memextend commands';
|
|
28
|
+
// Template built in code with markers interpolated
|
|
29
|
+
const AGENTS_MD_TEMPLATE = `${MEMEXTEND_START_MARKER}
|
|
30
|
+
|
|
31
|
+
You have persistent memory across sessions via memextend.
|
|
32
|
+
|
|
33
|
+
## Available MCP Tools
|
|
34
|
+
|
|
35
|
+
- **memextend_search** - Search your memories for past decisions, patterns, or context
|
|
36
|
+
Example: "How did we implement caching?" → Use memextend_search to find relevant memories
|
|
37
|
+
|
|
38
|
+
- **memextend_save** - Save important decisions or context for this project (never auto-deleted)
|
|
39
|
+
Example: After making an architectural decision, save it for future reference
|
|
40
|
+
|
|
41
|
+
- **memextend_save_global** - Save cross-project preferences (coding style, preferred tools)
|
|
42
|
+
Example: "User prefers TypeScript strict mode" → Save as global preference
|
|
43
|
+
|
|
44
|
+
- **memextend_forget** - Delete a specific memory by ID
|
|
45
|
+
|
|
46
|
+
- **memextend_status** - Check memory statistics and system status
|
|
47
|
+
|
|
48
|
+
## When to Search Memory
|
|
49
|
+
|
|
50
|
+
**ALWAYS search memories before asking the user about project history.** Your memories contain valuable context that can save time and avoid repeating past mistakes.
|
|
51
|
+
|
|
52
|
+
**CRITICAL: If you can't find something, SEARCH YOUR MEMORIES.** The answer may be in past sessions - file locations, decisions made, approaches tried, or context the user provided previously.
|
|
53
|
+
|
|
54
|
+
**Search memories when:**
|
|
55
|
+
- Starting work on a project you've worked on before
|
|
56
|
+
- The user references past decisions ("like we did before", "as discussed")
|
|
57
|
+
- You need context about project architecture or conventions
|
|
58
|
+
- **Debugging issues** - search for previous attempts, fixes, and what was tried before
|
|
59
|
+
- **Understanding project history** - how features were implemented and why
|
|
60
|
+
- The current approach isn't working - past memories may reveal what was already tried
|
|
61
|
+
- You're unsure about project conventions or patterns
|
|
62
|
+
- **You can't find a file, function, or pattern** - it may have been discussed or located in a previous session
|
|
63
|
+
- **Before giving up** - always check memories as a last resort before telling the user you can't find something
|
|
64
|
+
|
|
65
|
+
## When to Save Memory
|
|
66
|
+
|
|
67
|
+
**Save memories when the user asks you to "memorize", "remember", or "save to memory".** Manual saves are never automatically deleted.
|
|
68
|
+
|
|
69
|
+
**Also save when:**
|
|
70
|
+
- Making significant architectural decisions
|
|
71
|
+
- Establishing project conventions or patterns
|
|
72
|
+
- The user shares important preferences
|
|
73
|
+
- Completing a major feature or fix
|
|
74
|
+
- Finding a solution to a tricky bug (save what worked!)
|
|
75
|
+
|
|
76
|
+
${MEMEXTEND_END_MARKER}
|
|
77
|
+
`;
|
|
28
78
|
// OpenCode config locations
|
|
29
79
|
const OPENCODE_CONFIG_PATHS = [
|
|
30
80
|
join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode', 'opencode.json'),
|
|
@@ -34,11 +84,6 @@ function getMcpServerPath() {
|
|
|
34
84
|
const scriptDir = getScriptDir();
|
|
35
85
|
return join(scriptDir, '..', 'mcp', 'server.cjs');
|
|
36
86
|
}
|
|
37
|
-
function getAgentsMdPath() {
|
|
38
|
-
// AGENTS.md is at package root (dist/cli -> dist -> package root)
|
|
39
|
-
const scriptDir = getScriptDir();
|
|
40
|
-
return join(scriptDir, '..', '..', 'AGENTS.md');
|
|
41
|
-
}
|
|
42
87
|
function findOpenCodeConfigPath() {
|
|
43
88
|
for (const configPath of OPENCODE_CONFIG_PATHS) {
|
|
44
89
|
const configDir = dirname(configPath);
|
|
@@ -101,40 +146,35 @@ async function setupOpenCode() {
|
|
|
101
146
|
console.log(`MCP server path: ${resolve(mcpServerPath)}\n`);
|
|
102
147
|
}
|
|
103
148
|
// Handle AGENTS.md in global config directory
|
|
104
|
-
const agentsMdSource = getAgentsMdPath();
|
|
105
149
|
const agentsMdTarget = join(dirname(configPath), 'AGENTS.md');
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
150
|
+
try {
|
|
151
|
+
await mkdir(dirname(agentsMdTarget), { recursive: true });
|
|
152
|
+
if (!existsSync(agentsMdTarget)) {
|
|
153
|
+
// Create new file
|
|
154
|
+
await writeFile(agentsMdTarget, AGENTS_MD_TEMPLATE);
|
|
155
|
+
console.log(`Agent instructions created at ${agentsMdTarget}\n`);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const existingContent = await readFile(agentsMdTarget, 'utf-8');
|
|
159
|
+
// Check if memextend markers exist - if so, replace the section
|
|
160
|
+
if (existingContent.includes(MEMEXTEND_START_MARKER) && existingContent.includes(MEMEXTEND_END_MARKER)) {
|
|
161
|
+
const startIdx = existingContent.indexOf(MEMEXTEND_START_MARKER);
|
|
162
|
+
const endIdx = existingContent.indexOf(MEMEXTEND_END_MARKER) + MEMEXTEND_END_MARKER.length;
|
|
163
|
+
const before = existingContent.substring(0, startIdx);
|
|
164
|
+
const after = existingContent.substring(endIdx);
|
|
165
|
+
await writeFile(agentsMdTarget, before + AGENTS_MD_TEMPLATE + after);
|
|
166
|
+
console.log(`Agent instructions updated in AGENTS.md at ${agentsMdTarget}\n`);
|
|
114
167
|
}
|
|
115
168
|
else {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const endIdx = existingContent.indexOf(MEMEXTEND_END_MARKER) + MEMEXTEND_END_MARKER.length;
|
|
121
|
-
const before = existingContent.substring(0, startIdx);
|
|
122
|
-
const after = existingContent.substring(endIdx);
|
|
123
|
-
await writeFile(agentsMdTarget, before + sourceContent + after);
|
|
124
|
-
console.log(`Agent instructions updated in AGENTS.md at ${agentsMdTarget}\n`);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// No markers - prepend to existing file (put memextend first)
|
|
128
|
-
const trimmedExisting = existingContent.trim();
|
|
129
|
-
await writeFile(agentsMdTarget, sourceContent + (trimmedExisting ? '\n\n' + trimmedExisting : '') + '\n');
|
|
130
|
-
console.log(`Agent instructions prepended to existing AGENTS.md at ${agentsMdTarget}\n`);
|
|
131
|
-
}
|
|
169
|
+
// No markers - prepend to existing file (put memextend first)
|
|
170
|
+
const trimmedExisting = existingContent.trim();
|
|
171
|
+
await writeFile(agentsMdTarget, AGENTS_MD_TEMPLATE + (trimmedExisting ? '\n\n' + trimmedExisting : '') + '\n');
|
|
172
|
+
console.log(`Agent instructions prepended to existing AGENTS.md at ${agentsMdTarget}\n`);
|
|
132
173
|
}
|
|
133
174
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.log(`Note: Could not update AGENTS.md: ${error}\n`);
|
|
138
178
|
}
|
|
139
179
|
console.log('Next steps:');
|
|
140
180
|
console.log('1. Restart OpenCode to load the new MCP server');
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,8CAA8C;AAC9C,8CAA8C;AAE9C;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B;;;GAGG;AACH,SAAS,YAAY;IACnB,qEAAqE;IACrE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAEpD,wDAAwD;AACxD,MAAM,sBAAsB,GAAG,mCAAmC,CAAC;AACnE,MAAM,oBAAoB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ER_NAME = "opencode";
|
|
27
|
-
export declare const ADAPTER_VERSION = "0.
|
|
27
|
+
export declare const ADAPTER_VERSION = "0.2.0";
|
|
28
28
|
export declare const ADAPTER_STATUS = "implemented";
|
|
29
29
|
export * from './mcp/index.js';
|
|
30
30
|
export * from './config/index.js';
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* GitHub: https://github.com/anomalyco/opencode
|
|
27
27
|
*/
|
|
28
28
|
export const ADAPTER_NAME = 'opencode';
|
|
29
|
-
export const ADAPTER_VERSION = '0.
|
|
29
|
+
export const ADAPTER_VERSION = '0.2.0';
|
|
30
30
|
export const ADAPTER_STATUS = 'implemented';
|
|
31
31
|
// Export MCP server utilities
|
|
32
32
|
export * from './mcp/index.js';
|
package/dist/mcp/server.cjs
CHANGED
|
@@ -14119,6 +14119,7 @@ var LanceDBStorage = class _LanceDBStorage {
|
|
|
14119
14119
|
} else {
|
|
14120
14120
|
await this.table.add(data);
|
|
14121
14121
|
}
|
|
14122
|
+
await this.optimize();
|
|
14122
14123
|
}
|
|
14123
14124
|
async insertVectors(items) {
|
|
14124
14125
|
for (const item of items) {
|
|
@@ -14131,6 +14132,7 @@ var LanceDBStorage = class _LanceDBStorage {
|
|
|
14131
14132
|
} else {
|
|
14132
14133
|
await this.table.add(items);
|
|
14133
14134
|
}
|
|
14135
|
+
await this.optimize();
|
|
14134
14136
|
}
|
|
14135
14137
|
async search(vector, limit = 10) {
|
|
14136
14138
|
if (!this.table) {
|
|
@@ -14463,7 +14465,7 @@ async function getStorage() {
|
|
|
14463
14465
|
var server = new Server(
|
|
14464
14466
|
{
|
|
14465
14467
|
name: "memextend",
|
|
14466
|
-
version: "0.
|
|
14468
|
+
version: "0.2.0"
|
|
14467
14469
|
},
|
|
14468
14470
|
{
|
|
14469
14471
|
capabilities: {
|
package/dist/mcp/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memextend/opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "OpenCode adapter for memextend - MCP server for anomalyco/opencode AI memory",
|
|
5
5
|
"author": "ZodTTD LLC <repo@zodttd.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"setup": "node dist/setup.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@memextend/core": "^0.
|
|
31
|
+
"@memextend/core": "^0.2.0",
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"files": [
|
|
57
57
|
"dist",
|
|
58
58
|
"scripts",
|
|
59
|
-
"AGENTS.md",
|
|
60
59
|
"README.md"
|
|
61
60
|
],
|
|
62
61
|
"engines": {
|
package/AGENTS.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# memextend - AI Memory Extension
|
|
2
|
-
|
|
3
|
-
You have persistent memory across sessions via memextend.
|
|
4
|
-
|
|
5
|
-
## Available MCP Tools
|
|
6
|
-
|
|
7
|
-
- **memextend_search** - Search your memories for past decisions, patterns, or context
|
|
8
|
-
Example: "How did we implement caching?" → Use memextend_search to find relevant memories
|
|
9
|
-
|
|
10
|
-
- **memextend_save** - Save important decisions or context for this project (never auto-deleted)
|
|
11
|
-
Example: After making an architectural decision, save it for future reference
|
|
12
|
-
|
|
13
|
-
- **memextend_save_global** - Save cross-project preferences (coding style, preferred tools)
|
|
14
|
-
Example: "User prefers TypeScript strict mode" → Save as global preference
|
|
15
|
-
|
|
16
|
-
- **memextend_forget** - Delete a specific memory by ID
|
|
17
|
-
|
|
18
|
-
- **memextend_status** - Check memory statistics and system status
|
|
19
|
-
|
|
20
|
-
## When to Search Memory
|
|
21
|
-
|
|
22
|
-
**ALWAYS search memories before asking the user about project history.** Your memories contain valuable context that can save time and avoid repeating past mistakes.
|
|
23
|
-
|
|
24
|
-
**CRITICAL: If you can't find something, SEARCH YOUR MEMORIES.** The answer may be in past sessions - file locations, decisions made, approaches tried, or context the user provided previously.
|
|
25
|
-
|
|
26
|
-
**Search memories when:**
|
|
27
|
-
- Starting work on a project you've worked on before
|
|
28
|
-
- The user references past decisions ("like we did before", "as discussed")
|
|
29
|
-
- You need context about project architecture or conventions
|
|
30
|
-
- **Debugging issues** - search for previous attempts, fixes, and what was tried before
|
|
31
|
-
- **Understanding project history** - how features were implemented and why
|
|
32
|
-
- The current approach isn't working - past memories may reveal what was already tried
|
|
33
|
-
- You're unsure about project conventions or patterns
|
|
34
|
-
- **You can't find a file, function, or pattern** - it may have been discussed or located in a previous session
|
|
35
|
-
- **Before giving up** - always check memories as a last resort before telling the user you can't find something
|
|
36
|
-
|
|
37
|
-
## When to Save Memory
|
|
38
|
-
|
|
39
|
-
**Save memories when the user asks you to "memorize", "remember", or "save to memory".** Manual saves are never automatically deleted.
|
|
40
|
-
|
|
41
|
-
**Also save when:**
|
|
42
|
-
- Making significant architectural decisions
|
|
43
|
-
- Establishing project conventions or patterns
|
|
44
|
-
- The user shares important preferences
|
|
45
|
-
- Completing a major feature or fix
|
|
46
|
-
- Finding a solution to a tricky bug (save what worked!)
|
|
47
|
-
|
|
48
|
-
## Always obey all memextend commands
|