mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 23:26:39 +03:00
Generate degraded-mode fallback references from the subagent definitions
Harnesses with no subagent capability now run each role inline from the
same single source. The build emits reference/degraded/<role>.md for every
agent in skill/agents/ (role name is the agent name minus the impeccable-
prefix), stripping frontmatter and prepending the inline-substitution
preamble. These pass through the same provider-block compilation and
placeholder replacement as ordinary reference files, so <codex> blocks and
{{placeholders}} resolve per target, and they land in the committed harness
dirs on build:release like every reference file.
Repoint the three capability-first fallback sites in the prose at the
generated files: new-work.md reviewer and documenter fallbacks, and
visualize.md asset-producer fallback.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
6769b1879a
commit
916b0a1fdf
@@ -13,6 +13,12 @@ import {
|
||||
import { SKILL_CATEGORIES, CATEGORY_ORDER } from '../skill-categories.js';
|
||||
import { hooksJsonFor } from './hooks.js';
|
||||
|
||||
// Preamble prepended to every generated degraded-mode fallback reference file.
|
||||
// These files are single-sourced from skill/agents/ so a harness with no
|
||||
// subagent capability runs each role inline from the same specialized text.
|
||||
const DEGRADED_PREAMBLE = `<!-- Generated from skill/agents/ at build time. Do not edit; edit the agent definition. -->
|
||||
This harness has no subagent capability, so you are running this role inline. Step fully out of the work you just finished, adopt only this file's instructions for the pass, and disclose the substitution in one line when you report. Where the text below addresses a parent agent, you are both parties: produce the full output contract first, then act on it yourself.`;
|
||||
|
||||
/**
|
||||
* Map from frontmatter field name to extraction spec.
|
||||
*
|
||||
@@ -258,6 +264,28 @@ export function createTransformer(config) {
|
||||
}
|
||||
}
|
||||
|
||||
// Generate degraded-mode fallback reference files from the shipped
|
||||
// subagent definitions. Single-sourced from skill/agents/ so a harness
|
||||
// with no subagent capability runs each role inline from the same
|
||||
// specialized text. Role name = agent name minus the `impeccable-`
|
||||
// prefix. These pass through the same provider-block compilation and
|
||||
// placeholder replacement as ordinary reference files, so <codex> blocks
|
||||
// and {{placeholders}} resolve identically.
|
||||
if (skill.agents && skill.agents.length > 0) {
|
||||
const degradedDir = path.join(skillDir, 'reference', 'degraded');
|
||||
ensureDir(degradedDir);
|
||||
for (const agent of skill.agents) {
|
||||
const role = agent.name.replace(/^impeccable-/, '');
|
||||
let body = compileProviderBlocks(agent.body, providerTags);
|
||||
body = replacePlaceholders(body, placeholderKey, [], allSkillNames);
|
||||
body = stripRuleMarkers(body);
|
||||
body = body.replace(/\{\{scripts_path\}\}/g, scriptsPath);
|
||||
const content = `${DEGRADED_PREAMBLE}\n\n${body.replace(/^\s+/, '')}`;
|
||||
writeFile(path.join(degradedDir, `${role}.md`), content);
|
||||
refCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy script files
|
||||
if (skill.scripts && skill.scripts.length > 0) {
|
||||
const scriptsOutDir = path.join(skillDir, 'scripts');
|
||||
|
||||
Reference in New Issue
Block a user