feat(agents): deepseek_local טוען פרומפט מקובץ — איחוד מקור-אמת לפרומפט של Hermes (G2)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 8s

כל סוכני המערכת טוענים את ה-system prompt מקובץ תחת .claude/agents/ דרך
instructionsFilePath (claude_local + gemini_local), פרט ל-Hermes/curator על
deepseek_local שתמך רק ב-promptTemplate inline ב-DB — מסלול-פרומפט מקביל (הפרת G2),
לא מגורסת ב-git, ושני המקורות (DB ↔ hermes-curator.md) כבר התפצלו בתוכן.

מה השתנה:
- adapters/deepseek-paperclip-adapter: buildPrompt קורא instructionsFilePath אם הוגדר
  (resolveTemplate; עדיפות file > promptTemplate > DEFAULT). הקובץ עובר renderTemplate
  כך ש-{{wakeReason}}/{{#taskId}}/… ממשיכים לעבוד. כשל-רועש אם הקובץ הוגדר ואינו
  קריא — לא fallback שקט (כלל-הנדסה §6, feedback_silent_swallow).
- hermes-curator.md הופך ממסמך-תיעוד למקור-האמת בפועל: מיזוג current-from-both —
  ה-runbook התפעולי מה-DB (PIPELINE-WAKE/X16 + §A/§B + interactions) + שער
  anti-hallucination (INV-AH) וקריאת-ספ (INV-AG1) שהיו רק ב-md ומעולם לא הגיעו
  ל-runtime של הרמס. ה-ingest_final_version/lessons הידני הושמט — ה-pipeline (X16)
  כבר מריץ אותו durably; הרצה ידנית הייתה כפילה.

נותר תפעולי (לא ב-git): עדכון 2 רשומות deepseek_local ב-Paperclip DB
(instructionsFilePath=.../hermes-curator.md, ריקון promptTemplate) + git pull בעץ
הראשי + pm2 restart paperclip + sync-agents.

Invariants: מקיים G2 (ביטול מסלול-פרומפט מקביל), G12/X15 (מגע-פלטפורמה רק במעטפת
המוצהרת — adapter), INV-AH + INV-AG1 (מגיעים סוף-סוף ל-Hermes), כלל-הנדסה §6
(כשל-רועש). ללא שינוי התנהגות-runtime פרט להוספת שער-ה-AH (כוונה מפורשת, אישור יו"ר).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 12:16:33 +00:00
parent 33663b9816
commit a4e006ab50
3 changed files with 274 additions and 152 deletions

View File

@@ -9,6 +9,7 @@
* and toolsets from <HERMES_HOME>/config.yaml + <HERMES_HOME>/.env.
*/
import { readFileSync } from "node:fs";
import {
runChildProcess,
buildPaperclipEnv,
@@ -84,8 +85,37 @@ Address the comment, POST a reply if needed, then continue working.
3. If nothing to do, report briefly what you checked.
{{/noTask}}`;
/**
* Resolve the prompt template, preferring a versioned file over an inline DB
* string. Precedence: instructionsFilePath > promptTemplate > DEFAULT.
*
* This brings deepseek_local into line with claude_local / gemini_local, whose
* system prompts live as files under .claude/agents/. Keeping the prompt in one
* git-versioned place (not split between a file and an inline DB column) is the
* single-source-of-truth the other adapters already enforce.
*
* Fail loud: if instructionsFilePath is set but unreadable we throw rather than
* silently falling back — a wrong/missing prompt file must surface as an error,
* not run the agent on a stale inline copy. The loaded file still flows through
* renderTemplate(), so {{wakeReason}}/{{#taskId}}/… placeholders keep working.
*/
export function resolveTemplate(config) {
const filePath = cfgString(config.instructionsFilePath);
if (filePath) {
try {
return readFileSync(filePath, "utf8");
} catch (err) {
throw new Error(
`deepseek_local: instructionsFilePath is set ("${filePath}") but could not be read: ${err.message}. ` +
`Refusing to fall back to promptTemplate/default — fix the path or unset instructionsFilePath.`,
);
}
}
return cfgString(config.promptTemplate) || DEFAULT_PROMPT_TEMPLATE;
}
function buildPrompt(ctx, config) {
const template = cfgString(config.promptTemplate) || DEFAULT_PROMPT_TEMPLATE;
const template = resolveTemplate(config);
const taskId = cfgString(ctx.context?.taskId);
const taskTitle = cfgString(ctx.context?.taskTitle) || "";
const taskBody = cfgString(ctx.context?.taskBody) || "";