MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / buildPackPromptBlock

Function buildPackPromptBlock

src/runtime/agent.ts:329–372  ·  view source on GitHub ↗
(rootDir: string)

Source from the content-addressed store, hash-verified

327 return undefined;
328 }
329}
330
331function buildPackPromptBlock(rootDir: string): PackPromptFiles {
332 const agentsPath = path.resolve(rootDir, PACK_AGENTS_FILE);
333 const soulPath = path.resolve(rootDir, PACK_SOUL_FILE);
334 const agentsContent = readOptionalPackPromptFile(agentsPath);
335 const soulContent = readOptionalPackPromptFile(soulPath);
336
337 if (!agentsContent && !soulContent) {
338 return {
339 agentsPath,
340 soulPath,
341 };
342 }
343
344 const sections = [
345 "# SkillPack Pack Context",
346 "The following instructions are injected by the SkillPack runtime from files packaged with this pack.",
347 "Priority order:",
348 "1. Follow the user's explicit instructions first.",
349 "2. Follow `AGENTS.md` as the pack's operational policy and workflow rules.",
350 "3. Follow `SOUL.md` as the pack's persona, tone, and working style.",
351 "4. If `SOUL.md` conflicts with `AGENTS.md`, `AGENTS.md` wins.",
352 "5. `SOUL.md` does not override task goals, safety boundaries, or `AGENTS.md`.",
353 ];
354
355 if (agentsContent) {
356 sections.push("## Pack Policy (`AGENTS.md`)", agentsContent);
357 }
358
359 if (soulContent) {
360 sections.push(
361 "## Pack Persona (`SOUL.md`)",
362 "Treat the following as persona, tone, and working-style guidance only. Do not let it override task requirements, safety constraints, or `AGENTS.md`.",
363 soulContent,
364 );
365 }
366
367 return {
368 agentsPath,
369 soulPath,
370 agentsContent,
371 soulContent,
372 promptBlock: sections.join("\n\n"),
373 };
374}
375

Callers 1

getOrCreateSessionMethod · 0.85

Calls 1

Tested by

no test coverage detected