mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Harden memory workflow to reduce merge conflicts
This commit is contained in:
1 parent
561bc9b4bd
commit
811f45b3af
8 files changed
+84
-10
No files matched your search
@@ -8,10 +8,14 @@ const ROOT_DIR = path.resolve(__dirname, '../../');
|
||||
const DAILY_DIR = path.join(ROOT_DIR, 'src/prompts/daily');
|
||||
const WEEKLY_DIR = path.join(ROOT_DIR, 'src/prompts/weekly');
|
||||
const REPORT_DIR = path.join(ROOT_DIR, 'reports/prompt-safety');
|
||||
const MEMORY_DIR = path.join(ROOT_DIR, 'memory-updates');
|
||||
|
||||
if (!fs.existsSync(REPORT_DIR)) {
|
||||
fs.mkdirSync(REPORT_DIR, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(MEMORY_DIR)) {
|
||||
fs.mkdirSync(MEMORY_DIR, { recursive: true });
|
||||
}
|
||||
|
||||
const SAFETY_KEYWORDS = [
|
||||
'FAILURE MODES',
|
||||
@@ -96,8 +100,9 @@ function runAudit() {
|
||||
memoryContent += `Flagged prompts: ${results.filter(r => r.status === 'NEEDS_REVIEW').map(r => r.filename).join(', ')}\n`;
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(ROOT_DIR, 'memory-update.md'), memoryContent);
|
||||
console.log('Memory update written to memory-update.md');
|
||||
const memoryFile = path.join(MEMORY_DIR, `${timestamp}__prompt-safety-audit-agent.md`);
|
||||
fs.writeFileSync(memoryFile, memoryContent);
|
||||
console.log(`Memory update written to ${memoryFile}`);
|
||||
}
|
||||
|
||||
runAudit();
|
||||
@@ -69,7 +69,7 @@ async function main() {
|
||||
const runner = resolveRunner(promptMarkdown);
|
||||
|
||||
// Compute a stable, per-run memory output file path so agents know where to write learnings.
|
||||
// store.mjs reads this env var; if absent it falls back to the root memory-update.md placeholder.
|
||||
// store.mjs reads this env var and ingests this file.
|
||||
const agentName = process.env.SCHEDULER_AGENT || 'unknown-agent';
|
||||
const runTs = new Date().toISOString().replace(/:/g, '-').replace(/\.\d+Z$/, 'Z');
|
||||
const memoryFile = `memory-updates/${runTs}__${agentName}.md`;
|
||||
|
||||
@@ -35,9 +35,7 @@ const cliArgs = process.argv.slice(2);
|
||||
const fileArgIndex = cliArgs.indexOf('--file');
|
||||
const explicitFile = fileArgIndex !== -1 ? cliArgs[fileArgIndex + 1] : null;
|
||||
const envFile = process.env.SCHEDULER_MEMORY_FILE;
|
||||
const defaultFile = 'memory-update.md';
|
||||
|
||||
const targetFile = explicitFile || (envFile && existsSync(envFile) ? envFile : (existsSync(defaultFile) ? defaultFile : null));
|
||||
const targetFile = explicitFile || (envFile && existsSync(envFile) ? envFile : null);
|
||||
|
||||
if (targetFile) {
|
||||
try {
|
||||
@@ -71,7 +69,7 @@ if (memoryContent) {
|
||||
} else {
|
||||
// No memory file found — skip ingest rather than storing meaningless placeholder events.
|
||||
// Placeholder events pollute the store and degrade retrieval quality on future runs.
|
||||
console.warn(`No memory input found (checked --file, env SCHEDULER_MEMORY_FILE=${envFile}, and default ${defaultFile}). Skipping ingest.`);
|
||||
console.warn(`No memory input found (checked --file and env SCHEDULER_MEMORY_FILE=${envFile}). Skipping ingest.`);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user