@geminilight/mindos 0.5.19 → 0.5.21
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/app/app/api/ask/route.ts +308 -172
- package/app/app/api/file/route.ts +35 -11
- package/app/app/api/skills/route.ts +22 -3
- package/app/components/SettingsModal.tsx +52 -58
- package/app/components/Sidebar.tsx +21 -1
- package/app/components/settings/AiTab.tsx +4 -25
- package/app/components/settings/AppearanceTab.tsx +31 -13
- package/app/components/settings/KnowledgeTab.tsx +13 -28
- package/app/components/settings/McpAgentInstall.tsx +227 -0
- package/app/components/settings/McpServerStatus.tsx +172 -0
- package/app/components/settings/McpSkillsSection.tsx +583 -0
- package/app/components/settings/McpTab.tsx +16 -728
- package/app/components/settings/PluginsTab.tsx +4 -27
- package/app/components/settings/Primitives.tsx +69 -0
- package/app/components/settings/ShortcutsTab.tsx +2 -4
- package/app/components/settings/SyncTab.tsx +8 -24
- package/app/components/settings/types.ts +116 -2
- package/app/lib/agent/context.ts +151 -87
- package/app/lib/agent/index.ts +4 -3
- package/app/lib/agent/model.ts +76 -10
- package/app/lib/agent/stream-consumer.ts +73 -77
- package/app/lib/agent/to-agent-messages.ts +106 -0
- package/app/lib/agent/tools.ts +260 -266
- package/app/lib/i18n-en.ts +480 -0
- package/app/lib/i18n-zh.ts +505 -0
- package/app/lib/i18n.ts +4 -947
- package/app/next-env.d.ts +1 -1
- package/app/next.config.ts +7 -0
- package/app/package-lock.json +3258 -3093
- package/app/package.json +6 -3
- package/bin/cli.js +140 -5
- package/package.json +4 -1
- package/scripts/setup.js +13 -0
- package/skills/mindos/SKILL.md +10 -168
- package/skills/mindos-zh/SKILL.md +14 -172
- package/templates/skill-rules/en/skill-rules.md +222 -0
- package/templates/skill-rules/en/user-rules.md +20 -0
- package/templates/skill-rules/zh/skill-rules.md +222 -0
- package/templates/skill-rules/zh/user-rules.md +20 -0
package/app/package.json
CHANGED
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
"test": "vitest run"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ai-sdk/anthropic": "^3.0.58",
|
|
15
|
-
"@ai-sdk/openai": "^3.0.41",
|
|
16
14
|
"@base-ui/react": "^1.2.0",
|
|
17
15
|
"@codemirror/lang-markdown": "^6.5.0",
|
|
18
16
|
"@codemirror/state": "^6.5.4",
|
|
19
17
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
20
18
|
"@codemirror/view": "^6.39.16",
|
|
19
|
+
"@mariozechner/pi-agent-core": "^0.60.0",
|
|
20
|
+
"@mariozechner/pi-ai": "^0.60.0",
|
|
21
|
+
"@sinclair/typebox": "^0.34.33",
|
|
21
22
|
"@tiptap/extension-image": "^3.20.1",
|
|
22
23
|
"@tiptap/extension-link": "^3.20.1",
|
|
23
24
|
"@tiptap/extension-placeholder": "^3.20.1",
|
|
@@ -30,7 +31,6 @@
|
|
|
30
31
|
"@tiptap/react": "^3.20.1",
|
|
31
32
|
"@tiptap/starter-kit": "^3.20.1",
|
|
32
33
|
"@xyflow/react": "^12.10.1",
|
|
33
|
-
"ai": "^6.0.116",
|
|
34
34
|
"class-variance-authority": "^0.7.1",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"codemirror": "^6.0.2",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"papaparse": "^5.5.3",
|
|
42
42
|
"pdf-parse": "^2.4.5",
|
|
43
43
|
"pdfjs-dist": "^4.10.38",
|
|
44
|
+
"picocolors": "^1.1.1",
|
|
44
45
|
"react": "19.2.3",
|
|
45
46
|
"react-dom": "19.2.3",
|
|
46
47
|
"react-markdown": "^10.1.0",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"rehype-raw": "^7.0.0",
|
|
49
50
|
"rehype-slug": "^6.0.0",
|
|
50
51
|
"remark-gfm": "^4.0.1",
|
|
52
|
+
"source-map-js": "^1.2.1",
|
|
51
53
|
"tailwind-merge": "^3.5.0",
|
|
52
54
|
"tiptap-markdown": "^0.9.0",
|
|
53
55
|
"tw-animate-css": "^1.4.0",
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
"@types/papaparse": "^5.5.2",
|
|
60
62
|
"@types/react": "^19",
|
|
61
63
|
"@types/react-dom": "^19",
|
|
64
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
62
65
|
"eslint": "^9",
|
|
63
66
|
"eslint-config-next": "16.1.6",
|
|
64
67
|
"playwright": "^1.58.2",
|
package/bin/cli.js
CHANGED
|
@@ -39,12 +39,15 @@
|
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
import { execSync } from 'node:child_process';
|
|
42
|
-
import { existsSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
|
|
42
|
+
import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync, cpSync } from 'node:fs';
|
|
43
43
|
import { resolve } from 'node:path';
|
|
44
44
|
import { homedir } from 'node:os';
|
|
45
45
|
|
|
46
46
|
import { ROOT, CONFIG_PATH, BUILD_STAMP, LOG_PATH, MINDOS_DIR } from './lib/constants.js';
|
|
47
47
|
import { bold, dim, cyan, green, red, yellow } from './lib/colors.js';
|
|
48
|
+
|
|
49
|
+
// Resolve the local next binary to avoid npx pulling a mismatched global version
|
|
50
|
+
const NEXT_BIN = resolve(ROOT, 'app', 'node_modules', '.bin', 'next');
|
|
48
51
|
import { run, npmInstall } from './lib/utils.js';
|
|
49
52
|
import { loadConfig, getStartMode, isDaemonMode } from './lib/config.js';
|
|
50
53
|
import { needsBuild, writeBuildStamp, clearBuildLock, cleanNextDir, ensureAppDeps } from './lib/build.js';
|
|
@@ -214,7 +217,7 @@ const commands = {
|
|
|
214
217
|
startSyncDaemon(devMindRoot).catch(() => {});
|
|
215
218
|
}
|
|
216
219
|
await printStartupInfo(webPort, mcpPort);
|
|
217
|
-
run(
|
|
220
|
+
run(`${NEXT_BIN} dev -p ${webPort} ${extra}`, resolve(ROOT, 'app'));
|
|
218
221
|
},
|
|
219
222
|
|
|
220
223
|
// ── start ──────────────────────────────────────────────────────────────────
|
|
@@ -268,6 +271,41 @@ const commands = {
|
|
|
268
271
|
const webPort = process.env.MINDOS_WEB_PORT || '3456';
|
|
269
272
|
const mcpPort = process.env.MINDOS_MCP_PORT || '8781';
|
|
270
273
|
|
|
274
|
+
// ── Auto-migrate skill rules (v3 split → v4 merged) ──────────────────
|
|
275
|
+
try {
|
|
276
|
+
const cfg = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
|
|
277
|
+
const mr = cfg.mindRoot;
|
|
278
|
+
if (mr && existsSync(mr)) {
|
|
279
|
+
const isZh = cfg.disabledSkills?.includes('mindos');
|
|
280
|
+
const sName = isZh ? 'mindos-zh' : 'mindos';
|
|
281
|
+
const lang = isZh ? 'zh' : 'en';
|
|
282
|
+
const sDir = resolve(mr, '.agents', 'skills', sName);
|
|
283
|
+
const merged = resolve(sDir, 'skill-rules.md');
|
|
284
|
+
const legacyRules = resolve(sDir, 'rules.md');
|
|
285
|
+
// Migrate if legacy exists but merged doesn't
|
|
286
|
+
if (existsSync(legacyRules) && !existsSync(merged)) {
|
|
287
|
+
const tpl = resolve(ROOT, 'templates', 'skill-rules', lang, 'skill-rules.md');
|
|
288
|
+
if (existsSync(tpl)) {
|
|
289
|
+
cpSync(tpl, merged);
|
|
290
|
+
for (const f of ['rules.md', 'patterns.md', 'proactive.md']) {
|
|
291
|
+
const p = resolve(sDir, f);
|
|
292
|
+
if (existsSync(p)) rmSync(p);
|
|
293
|
+
}
|
|
294
|
+
console.log(` ${green('✓')} ${dim('Skill rules migrated to skill-rules.md')}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Init if .agents/skills/ doesn't exist at all
|
|
298
|
+
if (!existsSync(sDir)) {
|
|
299
|
+
const srcDir = resolve(ROOT, 'templates', 'skill-rules', lang);
|
|
300
|
+
if (existsSync(srcDir)) {
|
|
301
|
+
mkdirSync(sDir, { recursive: true });
|
|
302
|
+
cpSync(srcDir, sDir, { recursive: true });
|
|
303
|
+
console.log(` ${green('✓')} ${dim('Skill rules initialized')}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
} catch { /* best-effort, don't block startup */ }
|
|
308
|
+
|
|
271
309
|
// When launched by a daemon manager (launchd/systemd), wait for ports to
|
|
272
310
|
// free instead of exiting immediately — the previous instance may still be
|
|
273
311
|
// shutting down after a restart/update.
|
|
@@ -292,7 +330,7 @@ const commands = {
|
|
|
292
330
|
console.log(yellow('Building MindOS (first run or new version detected)...\n'));
|
|
293
331
|
cleanNextDir();
|
|
294
332
|
run('node scripts/gen-renderer-index.js', ROOT);
|
|
295
|
-
run(
|
|
333
|
+
run(`${NEXT_BIN} build`, resolve(ROOT, 'app'));
|
|
296
334
|
writeBuildStamp();
|
|
297
335
|
}
|
|
298
336
|
const mcp = spawnMcp(isVerbose);
|
|
@@ -304,7 +342,7 @@ const commands = {
|
|
|
304
342
|
startSyncDaemon(mindRoot).catch(() => {});
|
|
305
343
|
}
|
|
306
344
|
await printStartupInfo(webPort, mcpPort);
|
|
307
|
-
run(
|
|
345
|
+
run(`${NEXT_BIN} start -p ${webPort} ${extra}`, resolve(ROOT, 'app'));
|
|
308
346
|
},
|
|
309
347
|
|
|
310
348
|
// ── build ──────────────────────────────────────────────────────────────────
|
|
@@ -312,7 +350,7 @@ const commands = {
|
|
|
312
350
|
ensureAppDeps();
|
|
313
351
|
cleanNextDir();
|
|
314
352
|
run('node scripts/gen-renderer-index.js', ROOT);
|
|
315
|
-
run(
|
|
353
|
+
run(`${NEXT_BIN} build ${extra}`, resolve(ROOT, 'app'));
|
|
316
354
|
writeBuildStamp();
|
|
317
355
|
},
|
|
318
356
|
|
|
@@ -400,6 +438,80 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
400
438
|
await runGatewayCommand(sub);
|
|
401
439
|
},
|
|
402
440
|
|
|
441
|
+
// ── init-skills ──────────────────────────────────────────────────────────
|
|
442
|
+
'init-skills': async () => {
|
|
443
|
+
const force = process.argv.includes('--force');
|
|
444
|
+
console.log(`\n${bold('📦 Initialize Skill Rules')}\n`);
|
|
445
|
+
|
|
446
|
+
if (!existsSync(CONFIG_PATH)) {
|
|
447
|
+
console.log(` ${red('✘')} Config not found. Run ${cyan('mindos onboard')} first.\n`);
|
|
448
|
+
process.exit(1);
|
|
449
|
+
}
|
|
450
|
+
let config;
|
|
451
|
+
try {
|
|
452
|
+
config = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
|
|
453
|
+
} catch {
|
|
454
|
+
console.log(` ${red('✘')} Failed to parse config at ${dim(CONFIG_PATH)}\n`);
|
|
455
|
+
process.exit(1);
|
|
456
|
+
}
|
|
457
|
+
const mindRoot = config.mindRoot;
|
|
458
|
+
if (!mindRoot || !existsSync(mindRoot)) {
|
|
459
|
+
console.log(` ${red('✘')} Knowledge base not found: ${dim(mindRoot || '(not set)')}\n`);
|
|
460
|
+
process.exit(1);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const isZh = config.disabledSkills?.includes('mindos');
|
|
464
|
+
const skillName = isZh ? 'mindos-zh' : 'mindos';
|
|
465
|
+
const lang = isZh ? 'zh' : 'en';
|
|
466
|
+
const skillDir = resolve(mindRoot, '.agents', 'skills', skillName);
|
|
467
|
+
const sourceDir = resolve(ROOT, 'templates', 'skill-rules', lang);
|
|
468
|
+
|
|
469
|
+
if (!existsSync(sourceDir)) {
|
|
470
|
+
console.log(` ${red('✘')} Template not found: ${dim(sourceDir)}\n`);
|
|
471
|
+
process.exit(1);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const files = ['skill-rules.md', 'user-rules.md'];
|
|
475
|
+
mkdirSync(skillDir, { recursive: true });
|
|
476
|
+
|
|
477
|
+
let count = 0;
|
|
478
|
+
for (const file of files) {
|
|
479
|
+
const dest = resolve(skillDir, file);
|
|
480
|
+
const src = resolve(sourceDir, file);
|
|
481
|
+
if (!existsSync(src)) continue;
|
|
482
|
+
|
|
483
|
+
// Never overwrite user-rules.md even with --force
|
|
484
|
+
if (file === 'user-rules.md' && existsSync(dest)) {
|
|
485
|
+
console.log(` ${dim('skip')} ${file} (user rules preserved)`);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (existsSync(dest) && !force) {
|
|
490
|
+
console.log(` ${dim('skip')} ${file} (already exists)`);
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
cpSync(src, dest);
|
|
495
|
+
console.log(` ${green('✓')} ${file}${force ? ' (reset)' : ''}`);
|
|
496
|
+
count++;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Clean up legacy split files from v3
|
|
500
|
+
for (const legacy of ['rules.md', 'patterns.md', 'proactive.md']) {
|
|
501
|
+
const legacyPath = resolve(skillDir, legacy);
|
|
502
|
+
if (existsSync(legacyPath)) {
|
|
503
|
+
rmSync(legacyPath);
|
|
504
|
+
console.log(` ${dim('cleanup')} ${legacy} (merged into skill-rules.md)`);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (count === 0) {
|
|
509
|
+
console.log(`\n ${dim('All files already exist. Use --force to reset defaults (user-rules.md is always preserved).')}\n`);
|
|
510
|
+
} else {
|
|
511
|
+
console.log(`\n ${green('✔')} Skill rules initialized at ${dim(skillDir)}\n`);
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
|
|
403
515
|
// ── doctor ─────────────────────────────────────────────────────────────────
|
|
404
516
|
doctor: async () => {
|
|
405
517
|
const ok = (msg) => console.log(` ${green('✔')} ${msg}`);
|
|
@@ -634,6 +746,28 @@ ${dim('Shortcut: mindos start --daemon → install + start in one step')}
|
|
|
634
746
|
console.log(dim(' Run `mindos start` — it will rebuild automatically.'));
|
|
635
747
|
console.log(` ${dim('View changelog:')} ${cyan('https://github.com/GeminiLight/MindOS/releases')}\n`);
|
|
636
748
|
}
|
|
749
|
+
|
|
750
|
+
// ── Check if skill rules need updating ──────────────────────────────────
|
|
751
|
+
try {
|
|
752
|
+
const updateCfg = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
|
|
753
|
+
const mindRoot = updateCfg.mindRoot;
|
|
754
|
+
if (mindRoot && existsSync(mindRoot)) {
|
|
755
|
+
const isZh = updateCfg.disabledSkills?.includes('mindos');
|
|
756
|
+
const sName = isZh ? 'mindos-zh' : 'mindos';
|
|
757
|
+
const lang = isZh ? 'zh' : 'en';
|
|
758
|
+
const installedRules = resolve(mindRoot, '.agents', 'skills', sName, 'skill-rules.md');
|
|
759
|
+
const tplRules = resolve(ROOT, 'templates', 'skill-rules', lang, 'skill-rules.md');
|
|
760
|
+
if (existsSync(installedRules) && existsSync(tplRules)) {
|
|
761
|
+
const uVer = readFileSync(installedRules, 'utf-8').match(/<!--\s*version:\s*(\S+)\s*-->/)?.[1];
|
|
762
|
+
const tVer = readFileSync(tplRules, 'utf-8').match(/<!--\s*version:\s*(\S+)\s*-->/)?.[1];
|
|
763
|
+
if (uVer && tVer && uVer !== tVer) {
|
|
764
|
+
console.log(` ${yellow('!')} Skill rules ${dim(uVer)} → ${bold(tVer)} available. Run ${cyan('mindos init-skills --force')} to update ${dim('(user-rules.md preserved)')}\n`);
|
|
765
|
+
}
|
|
766
|
+
} else if (!existsSync(resolve(mindRoot, '.agents', 'skills', sName))) {
|
|
767
|
+
console.log(` ${dim('Tip:')} Run ${cyan('mindos init-skills')} to enable skill rules in your knowledge base.\n`);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
} catch {}
|
|
637
771
|
},
|
|
638
772
|
|
|
639
773
|
// ── uninstall ──────────────────────────────────────────────────────────────
|
|
@@ -1078,6 +1212,7 @@ ${row('mindos gateway <subcommand>', 'Manage background service (install/u
|
|
|
1078
1212
|
${bold('Config & Diagnostics:')}
|
|
1079
1213
|
${row('mindos config <subcommand>', 'View/update config (show/validate/set/unset)')}
|
|
1080
1214
|
${row('mindos doctor', 'Health check (config, ports, build, daemon)')}
|
|
1215
|
+
${row('mindos init-skills [--force]', 'Initialize skill rules in knowledge base')}
|
|
1081
1216
|
${row('mindos update', 'Update MindOS to the latest version')}
|
|
1082
1217
|
${row('mindos uninstall', 'Fully uninstall MindOS (stop, remove daemon, npm uninstall)')}
|
|
1083
1218
|
${row('mindos logs', 'Tail service logs (~/.mindos/mindos.log)')}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geminilight/mindos",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
4
4
|
"description": "MindOS — Human-Agent Collaborative Mind System. Local-first knowledge base that syncs your mind to all AI Agents via MCP.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mindos",
|
|
@@ -73,5 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"chokidar": "^5.0.0"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"source-map-js": "^1.2.1"
|
|
76
79
|
}
|
|
77
80
|
}
|
package/scripts/setup.js
CHANGED
|
@@ -1205,6 +1205,19 @@ async function main() {
|
|
|
1205
1205
|
writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n');
|
|
1206
1206
|
console.log(`\n${c.green(t('cfgSaved'))}: ${c.dim(CONFIG_PATH)}`);
|
|
1207
1207
|
|
|
1208
|
+
// ── Init skill rules in knowledge base ────────────────────────────────────
|
|
1209
|
+
const skillName = selectedTemplate === 'zh' ? 'mindos-zh' : 'mindos';
|
|
1210
|
+
const skillRulesDir = resolve(mindDir, '.agents', 'skills', skillName);
|
|
1211
|
+
if (!existsSync(skillRulesDir)) {
|
|
1212
|
+
const skillRulesLang = selectedTemplate === 'zh' ? 'zh' : 'en';
|
|
1213
|
+
const skillRulesSource = resolve(ROOT, 'templates', 'skill-rules', skillRulesLang);
|
|
1214
|
+
if (existsSync(skillRulesSource)) {
|
|
1215
|
+
mkdirSync(skillRulesDir, { recursive: true });
|
|
1216
|
+
cpSync(skillRulesSource, skillRulesDir, { recursive: true });
|
|
1217
|
+
console.log(`${c.green('✓')} ${c.dim(`Skill rules initialized: ${skillRulesDir}`)}`);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1208
1221
|
// ── Step 7: MCP Agent Install ──────────────────────────────────────────────
|
|
1209
1222
|
write('\n');
|
|
1210
1223
|
stepHeader(7);
|
package/skills/mindos/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mindos
|
|
3
3
|
description: >
|
|
4
|
-
MindOS knowledge base operation guide, only for agent tasks on files inside the MindOS knowledge base
|
|
4
|
+
MindOS knowledge base operation guide, only for agent tasks on files inside the MindOS knowledge base.
|
|
5
5
|
Trigger only when the target files are inside the MindOS knowledge base directory.
|
|
6
6
|
Typical requests: "update notes", "search knowledge base", "organize files", "execute SOP",
|
|
7
7
|
"review with our standards", "handoff to another agent", "sync decisions", "append CSV",
|
|
@@ -12,173 +12,15 @@ description: >
|
|
|
12
12
|
or the task involves modifying project source code or project documentation.
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# MindOS
|
|
15
|
+
# MindOS Skill
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Load operating rules from the knowledge base, then execute the user's task.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Protocol
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Startup Protocol
|
|
28
|
-
|
|
29
|
-
Run this sequence before substantive edits:
|
|
30
|
-
|
|
31
|
-
1. Load root guidance.
|
|
32
|
-
- Prefer `mindos_bootstrap`.
|
|
33
|
-
- If unavailable, read root `INSTRUCTION.md` and root `README.md` directly.
|
|
34
|
-
|
|
35
|
-
2. Discover current structure dynamically.
|
|
36
|
-
- Use `mindos_list_files` and targeted `mindos_search_notes`.
|
|
37
|
-
- Do not assume fixed top-level directory names.
|
|
38
|
-
|
|
39
|
-
3. Load local guidance around target paths.
|
|
40
|
-
- Read nearby `README.md` / `INSTRUCTION.md` when present.
|
|
41
|
-
- Follow local conventions over global assumptions.
|
|
42
|
-
|
|
43
|
-
4. Execute edits.
|
|
44
|
-
|
|
45
|
-
If required context is missing, continue with best effort and state assumptions explicitly.
|
|
46
|
-
|
|
47
|
-
## Dynamic Structure Rules
|
|
48
|
-
|
|
49
|
-
- Do not hardcode a canonical directory tree.
|
|
50
|
-
- Infer conventions from neighboring files before creating or rewriting content.
|
|
51
|
-
- Mirror existing local patterns for naming, heading structure, CSV schema, and references.
|
|
52
|
-
- For new files, follow sibling style rather than inventing a new standard.
|
|
53
|
-
- **Never create files or directories in the root directory unless the user explicitly requests it.** The root is reserved for top-level governance files (README, INSTRUCTION, CONFIG). New content should be placed under the most semantically appropriate existing subdirectory. Reason from the directory tree in context to find the right home.
|
|
54
|
-
- When creating a new file or directory, always determine the best parent directory first by reviewing the existing structure. If no existing directory is a clear fit, propose 1-2 candidate locations and ask the user before creating.
|
|
55
|
-
- **After any file create/delete/move/rename, always sync affected README files.** READMEs serve as directory indexes and navigation entry points. Any operation that changes a directory's contents (creating, deleting, moving, or renaming files or subdirectories) must trigger an automatic check and update of the README in that directory and its parent directory, so they accurately reflect the current structure. This requires no user prompting — it is basic structural consistency discipline.
|
|
56
|
-
|
|
57
|
-
## Pre-Write Checklist
|
|
58
|
-
|
|
59
|
-
Before any non-trivial write, confirm all checks:
|
|
60
|
-
|
|
61
|
-
1. Target file/path is confirmed and exists or should be created.
|
|
62
|
-
2. **Target location is under an appropriate subdirectory, not the root.** If unsure which directory fits best, propose candidates and ask the user.
|
|
63
|
-
3. Current content has been read, or absence is explicitly confirmed.
|
|
64
|
-
4. Local governance docs near the target path are considered.
|
|
65
|
-
5. Edit scope is minimal and aligned with user intent.
|
|
66
|
-
6. Reference/backlink impact is evaluated for path changes.
|
|
67
|
-
|
|
68
|
-
## Tool Selection Guide
|
|
69
|
-
|
|
70
|
-
### Discovery
|
|
71
|
-
|
|
72
|
-
- `mindos_bootstrap`: Load startup context.
|
|
73
|
-
- `mindos_list_files`: Inspect file tree.
|
|
74
|
-
- `mindos_search_notes`: Locate relevant files by keyword/scope/type/date. **When searching, always issue multiple parallel searches with different keywords upfront** — synonyms, abbreviations, English/Chinese variants, and broader/narrower terms. A single keyword is fragile; casting a wider net on the first try avoids wasted rounds.
|
|
75
|
-
- `mindos_get_recent`: Inspect latest activity.
|
|
76
|
-
- `mindos_get_backlinks`: Assess impact before rename/move/delete.
|
|
77
|
-
|
|
78
|
-
### Read and write
|
|
79
|
-
|
|
80
|
-
- `mindos_read_file`: Read file content.
|
|
81
|
-
- `mindos_write_file`: Use only for true full replacement.
|
|
82
|
-
- `mindos_create_file`: Create `.md`/`.csv` files.
|
|
83
|
-
- `mindos_delete_file`: Delete only with explicit user intent.
|
|
84
|
-
- `mindos_rename_file`, `mindos_move_file`: Structural edits with follow-up reference checks.
|
|
85
|
-
|
|
86
|
-
### Precise editing
|
|
87
|
-
|
|
88
|
-
- `mindos_read_lines`: Locate exact lines.
|
|
89
|
-
- `mindos_insert_lines`: Insert at index.
|
|
90
|
-
- `mindos_update_lines`: Replace specific range.
|
|
91
|
-
- `mindos_append_to_file`: Append to end.
|
|
92
|
-
- `mindos_insert_after_heading`: Insert under heading.
|
|
93
|
-
- `mindos_update_section`: Replace one markdown section.
|
|
94
|
-
|
|
95
|
-
### History and tables
|
|
96
|
-
|
|
97
|
-
- `mindos_get_history`, `mindos_get_file_at_version`: Investigate/recover history.
|
|
98
|
-
- `mindos_append_csv`: Append validated row after header check.
|
|
99
|
-
|
|
100
|
-
## Fallback Rules
|
|
101
|
-
|
|
102
|
-
- If some `mindos_*` tools are unavailable, use equivalent available tools while preserving the same safety discipline.
|
|
103
|
-
- If `mindos_bootstrap` is unavailable, do manual startup reads.
|
|
104
|
-
- If line/section edit tools are unavailable, emulate minimal edits through read plus constrained rewrite.
|
|
105
|
-
- If `mindos_search_notes` returns no results, do not give up. The directory tree loaded at bootstrap is already in your context — directory names, file names, and their hierarchy are semantically rich and often enough to infer where content lives. Escalate progressively:
|
|
106
|
-
1. Review the directory structure already in context. Reason about which directories and files are likely relevant based on naming, hierarchy, and topic proximity.
|
|
107
|
-
2. Read the most promising candidate files directly to confirm relevance.
|
|
108
|
-
3. If candidates are unclear, use `mindos_list_files` on a specific subdirectory for finer-grained structure not captured at bootstrap.
|
|
109
|
-
4. Try alternative search terms (synonyms, broader/narrower keywords, English/Chinese variants) as a parallel strategy.
|
|
110
|
-
|
|
111
|
-
## Execution Patterns
|
|
112
|
-
|
|
113
|
-
Select the matching pattern below. All patterns share a common discipline: search → read → minimal edit → verify → summarize.
|
|
114
|
-
|
|
115
|
-
### Core patterns (high-frequency)
|
|
116
|
-
|
|
117
|
-
#### Capture or update notes
|
|
118
|
-
Search → read target + local rules → apply minimal edit → keep references consistent.
|
|
119
|
-
|
|
120
|
-
#### Context-aware question answering
|
|
121
|
-
Reason from directory tree → read relevant files → answer grounded in stored content with file citations → if info is missing, say so explicitly.
|
|
122
|
-
|
|
123
|
-
#### Structure-aware multi-file routing
|
|
124
|
-
For unstructured inputs (meeting notes, braindumps, chat exports) that belong in multiple places:
|
|
125
|
-
1. Parse input into semantic units (facts, decisions, action items, ideas).
|
|
126
|
-
2. For each unit, search + read candidate destination files.
|
|
127
|
-
3. **Present routing plan to user for approval** (table: what → which file → where).
|
|
128
|
-
4. Apply minimal edits. Create new files only when no existing file fits.
|
|
129
|
-
5. Summarize all changes for audit.
|
|
130
|
-
|
|
131
|
-
#### Conversation retrospective
|
|
132
|
-
1. Confirm scope with user.
|
|
133
|
-
2. Extract reusable artifacts: decisions, rationale, pitfalls, next actions.
|
|
134
|
-
3. Route each to the best existing file (or create near related docs).
|
|
135
|
-
4. Add trace note of what changed and why. Ask user when routing confidence is low.
|
|
136
|
-
|
|
137
|
-
### Structural change patterns (always apply after file create/delete/move/rename)
|
|
138
|
-
|
|
139
|
-
- **Rename/move**: `get_backlinks` → report impact → confirm → execute → update all references → verify no orphans.
|
|
140
|
-
- **Auto-sync READMEs**: After any structural change, update README in affected directories + parent directories to reflect current contents. This is automatic — no separate user request needed.
|
|
141
|
-
|
|
142
|
-
### Reference patterns (use when task matches)
|
|
143
|
-
|
|
144
|
-
| Pattern | Key steps |
|
|
145
|
-
|---------|-----------|
|
|
146
|
-
| CSV operations | Read header → validate fields → append row |
|
|
147
|
-
| TODO/task management | Locate list → read format → minimal edit preserving conventions |
|
|
148
|
-
| SOP/workflow execution | Read doc fully → execute stepwise → update only affected section |
|
|
149
|
-
| Cross-agent handoff | Read task state + decisions → continue without re-discovery → write back progress |
|
|
150
|
-
| Knowledge conflict resolution | Multi-term search for old info → list all affected files → present change plan → update after approval |
|
|
151
|
-
| Distill experience into SOP | Extract procedure → generalize → create under Workflows/ with prerequisites, steps, pitfalls |
|
|
152
|
-
| Periodic review/summary | `get_recent`/`get_history` → read changed files → categorize → structured summary |
|
|
153
|
-
| Handoff document synthesis | Identify sources → read → synthesize (background, decisions, status, open items) → place in project dir |
|
|
154
|
-
| Relationship management | Extract updates from notes → update contact records → generate next-step strategy |
|
|
155
|
-
| Information collection | Locate sources → read outreach docs → personalize per target → write back outcomes |
|
|
156
|
-
| Project bootstrap | Read preference/stack docs → scaffold aligned with standards → record decisions |
|
|
157
|
-
| Code review | Read review standards → check naming/security/performance → output actionable findings |
|
|
158
|
-
| Distill cross-agent discussion | Confirm decisions with user → structure as problem/decision/rationale/next-actions → minimal write-back |
|
|
159
|
-
|
|
160
|
-
## Interaction Rules
|
|
161
|
-
|
|
162
|
-
- **When a request is ambiguous or too broad (e.g., "help me organize things"), always ask for clarification before acting.** Propose specific options based on what you see in the knowledge base (recent changes, directory structure), but do not start reorganizing or rewriting without understanding the user's intent and scope.
|
|
163
|
-
- When presenting search results or options, prioritize brevity and relevance. Show the most likely match first.
|
|
164
|
-
- When answering questions from stored knowledge, always cite the source file path so the user can verify.
|
|
165
|
-
|
|
166
|
-
## Safety Rules
|
|
167
|
-
|
|
168
|
-
- By default, treat root `INSTRUCTION.md`, root `README.md`, and any directory-level `INSTRUCTION.md` governance docs as high-sensitivity; ask for confirmation before modifying them.
|
|
169
|
-
- Ask before editing high-sensitivity governance files.
|
|
170
|
-
- Ask before high-impact actions.
|
|
171
|
-
- High-impact actions include bulk deletion, large-scale rename/move, broad directory restructuring, and cross-file mass rewrites.
|
|
172
|
-
- **When an operation will touch multiple files, always present the full change plan to the user first.** List each target file, what will change, and why. Wait for approval before executing. This is non-negotiable — users must be able to see and control multi-file updates before they happen.
|
|
173
|
-
- Never store secrets, tokens, or passwords.
|
|
174
|
-
- Never delete or rewrite outside user intent.
|
|
175
|
-
|
|
176
|
-
## Quality Gates
|
|
177
|
-
|
|
178
|
-
Before finishing any operation, verify:
|
|
179
|
-
|
|
180
|
-
1. Result directly answers user intent.
|
|
181
|
-
2. Updated content matches local style and structure.
|
|
182
|
-
3. References/links remain valid after structural edits.
|
|
183
|
-
4. No sensitive information was introduced.
|
|
184
|
-
5. Summary to user is specific enough for quick audit.
|
|
21
|
+
1. Read `.agents/skills/mindos/skill-rules.md` — operating rules.
|
|
22
|
+
- If not found: fall back to `mindos_bootstrap` (or read root INSTRUCTION.md
|
|
23
|
+
+ README.md). Inform user: "Run `mindos init-skills` for full skill rules."
|
|
24
|
+
2. If `.agents/skills/mindos/user-rules.md` exists and is non-empty:
|
|
25
|
+
read it. User rules override default rules on conflict.
|
|
26
|
+
3. Execute task following loaded rules. After completion, evaluate proactive hooks.
|