total-recall-brain 3.6.6 → 3.6.8
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/package.json +1 -1
- package/src/core/surface.mjs +38 -9
package/package.json
CHANGED
package/src/core/surface.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import crypto from 'crypto';
|
|
4
4
|
import { loadSkills, atomicWrite, walkMd } from './vault.mjs';
|
|
5
5
|
import { getNodes } from './vault-cache.mjs';
|
|
6
|
+
import matter from 'gray-matter';
|
|
6
7
|
import {
|
|
7
8
|
buildMemoryLayerIndex,
|
|
8
9
|
inferMemoryLayer,
|
|
@@ -362,6 +363,32 @@ Show all available commands.
|
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
|
|
366
|
+
// 3. Inject Installed Skills Inventory
|
|
367
|
+
if (skillsDir && fs.existsSync(skillsDir)) {
|
|
368
|
+
const installedSkills = [];
|
|
369
|
+
try {
|
|
370
|
+
const entries = fs.readdirSync(skillsDir);
|
|
371
|
+
for (const entry of entries) {
|
|
372
|
+
const fullPath = path.join(skillsDir, entry);
|
|
373
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
374
|
+
const skillMdPath = path.join(fullPath, 'SKILL.md');
|
|
375
|
+
if (fs.existsSync(skillMdPath)) {
|
|
376
|
+
const raw = fs.readFileSync(skillMdPath, 'utf8');
|
|
377
|
+
const { data } = matter(raw);
|
|
378
|
+
if (data && data.name && data.description) {
|
|
379
|
+
installedSkills.push(`- **${data.name}** (\`.agent/skills/${entry}/SKILL.md\`): ${data.description}`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (installedSkills.length > 0) {
|
|
385
|
+
combined += `\n\n## Installed Agent Skills\n\nYou have access to specialized 'skills' to help you with complex tasks. If a skill seems relevant to your current task, you MUST read its SKILL.md file before proceeding.\n\nAvailable skills:\n${installedSkills.join('\n')}`;
|
|
386
|
+
}
|
|
387
|
+
} catch (err) {
|
|
388
|
+
console.error('Error in skills injection:', err);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
365
392
|
return combined.trim();
|
|
366
393
|
}
|
|
367
394
|
|
|
@@ -395,8 +422,9 @@ async function writeShim(shimPath, skillsDir, nodes = [], { vaultDir, derivedDir
|
|
|
395
422
|
if (fs.existsSync(shimPath)) {
|
|
396
423
|
const stat = fs.lstatSync(shimPath);
|
|
397
424
|
if (stat.isSymbolicLink()) {
|
|
398
|
-
|
|
399
|
-
|
|
425
|
+
// If it's a symlink, DO NOT destroy it. It likely points to INSTRUCTIONS.md natively,
|
|
426
|
+
// and its content will update automatically when the target updates.
|
|
427
|
+
return;
|
|
400
428
|
} else {
|
|
401
429
|
const raw = fs.readFileSync(shimPath, 'utf8');
|
|
402
430
|
let cleaned = raw;
|
|
@@ -424,14 +452,14 @@ async function writeShim(shimPath, skillsDir, nodes = [], { vaultDir, derivedDir
|
|
|
424
452
|
*/
|
|
425
453
|
const CLIENT_SHIMS = {
|
|
426
454
|
cursor: ['.cursorrules'],
|
|
427
|
-
'claude-code': ['
|
|
428
|
-
antigravity: [
|
|
429
|
-
gemini: [
|
|
430
|
-
codex: ['
|
|
455
|
+
'claude-code': ['.clauderules'],
|
|
456
|
+
antigravity: [],
|
|
457
|
+
gemini: [],
|
|
458
|
+
codex: ['.codexrules'],
|
|
431
459
|
vscode: ['.github/copilot-instructions.md', '.vscode/copilot-instructions.md'],
|
|
432
|
-
pi: [
|
|
460
|
+
pi: [],
|
|
433
461
|
aider: ['.aider.rules.md'],
|
|
434
|
-
windsurf: ['.windsurfrules'
|
|
462
|
+
windsurf: ['.windsurfrules'],
|
|
435
463
|
};
|
|
436
464
|
|
|
437
465
|
/**
|
|
@@ -465,7 +493,8 @@ async function compilePointers(instructionsFile, skillsDir, nodes = [], { vaultD
|
|
|
465
493
|
const connectedClients = readConnectedClients(clientsPath);
|
|
466
494
|
|
|
467
495
|
if (connectedClients === null) {
|
|
468
|
-
//
|
|
496
|
+
// Write out-of-the-box dotfiles to support IDEs automatically,
|
|
497
|
+
// avoiding duplicate .md files to prevent Antigravity context bloat.
|
|
469
498
|
for (const files of Object.values(CLIENT_SHIMS)) {
|
|
470
499
|
for (const file of files) {
|
|
471
500
|
await writeShim(path.join(baseDir, file), skillsDir, nodes, { vaultDir, derivedDir });
|