Files
fusion/plugins/fusion-plugin-compound-engineering/src/agent-installation.ts
gsxdsm 5899dca4f8 FN-7094: update Compound Engineering plugin to v3.15.0
Update the Compound Engineering plugin content and installers to the upstream v3.15.0 release.

- Refresh bundled Compound Engineering agents, skills, references, and helper scripts from upstream v3.15.0.
- Add upstream provenance metadata and regression coverage for provenance, agent installation, and skill installation behavior.
- Update plugin registration and installer logic to expose the expanded agent and skill catalog.

Files changed:
 .../fusion-plugin-compound-engineering/README.md   |  18 +-
 .../src/__tests__/agent-installation.test.ts       |  16 +-
 .../src/__tests__/skill-installation.test.ts       |  19 +-
 .../src/__tests__/upstream-provenance.test.ts      |  62 ++
 .../src/agent-installation.ts                      |  66 +-
 .../src/agents/ce-adversarial-document-reviewer.md |  12 +-
 .../src/agents/ce-adversarial-reviewer.md          |  12 +-
 .../agents/ce-agent-native-planning-strategist.md  |  71 ++
 .../src/agents/ce-best-practices-researcher.md     |  23 +-
 .../src/agents/ce-data-integrity-guardian.md       |   4 +
 .../src/agents/ce-deployment-verification-agent.md |   4 +
 .../src/agents/ce-figma-design-sync.md             |   4 +-
 .../src/agents/ce-framework-docs-researcher.md     |   4 +
 .../src/agents/ce-git-history-analyzer.md          |   2 +-
 .../src/agents/ce-issue-intelligence-analyst.md    |   9 +-
 .../src/agents/ce-learnings-researcher.md          |  16 +-
 .../agents/ce-pattern-recognition-specialist.md    |   4 +
 .../src/agents/ce-performance-oracle.md            |   4 +
 .../src/agents/ce-pr-comment-resolver.md           | 120 +--
 .../src/agents/ce-product-lens-reviewer.md         |   2 +-
 .../src/agents/ce-project-standards-reviewer.md    |   8 +-
 .../src/agents/ce-repo-research-analyst.md         |   6 +-
 .../src/agents/ce-scope-guardian-reviewer.md       |   6 +-
 .../src/agents/ce-security-lens-reviewer.md        |   2 +-
 .../src/agents/ce-security-sentinel.md             |   4 +
 .../src/agents/ce-session-historian.md             |  14 +-
 .../src/agents/ce-slack-researcher.md              |  25 +-
 .../src/agents/ce-web-researcher.md                |  13 +-
 .../src/index.ts                                   |  15 +-
 .../src/skill-installation.ts                      |  69 +-
 .../src/skills/ce-brainstorm/SKILL.md              | 125 ++-
 .../references/agents/slack-researcher.md          | 127 +++
 .../references/brainstorm-sections.md              | 161 +++-
 .../src/skills/ce-brainstorm/references/handoff.md | 114 ++-
 .../ce-brainstorm/references/html-rendering.md     | 253 ++++--
 .../ce-brainstorm/references/markdown-rendering.md |  55 +-
 .../ce-brainstorm/references/synthesis-summary.md  |  30 +-
 .../references/universal-brainstorming.md          |  14 +-
 .../ce-brainstorm/references/visual-probes.md      | 128 +++
 .../ce-brainstorm/scripts/visual-probe-server.js   | 419 ++++++++++
 .../src/skills/ce-code-review/SKILL.md             | 921 ++++++++++-----------
 .../references/action-class-rubric.md              |  26 +
 .../references/cross-model-review.md               |  63 ++
 .../skills/ce-code-review/references/diff-scope.md |  12 +-
 .../ce-code-review/references/findings-schema.json |  26 +-
 .../ce-code-review/references/persona-catalog.md   |  54 +-
 .../references/personas/adversarial-reviewer.md    | 102 +++
 .../references/personas/agent-native-reviewer.md   | 173 ++++
 .../references/personas/api-contract-reviewer.md   |  43 +
 .../references/personas/correctness-reviewer.md    |  43 +
 .../references/personas/data-migration-reviewer.md | 111 +++
 .../personas/deployment-verification-agent.md      | 157 ++++
 .../personas/julik-frontend-races-reviewer.md      |  44 +
 .../references/personas/learnings-researcher.md    | 247 ++++++
 .../personas/maintainability-reviewer.md           |  68 ++
 .../references/personas/performance-reviewer.md    |  45 +
 .../personas/previous-comments-reviewer.md         |  59 ++
 .../personas/project-standards-reviewer.md         |  75 ++
 .../references/personas/reliability-reviewer.md    |  43 +
 .../references/personas/security-reviewer.md       |  45 +
 .../references/personas/swift-ios-reviewer.md      |  99 +++
 .../references/personas/testing-reviewer.md        |  43 +
 .../references/review-output-template.md           | 117 +--
 .../ce-code-review/references/subagent-template.md |  51 +-
 .../references/validator-template.md               |   6 +-
 .../scripts/cross-model-adversarial-review.sh      | 218 +++++
 .../src/skills/ce-commit-push-pr/SKILL.md          |  19 +-
 .../references/pr-description-writing.md           |   2 +-
 .../src/skills/ce-commit/SKILL.md                  |   4 +-
 .../src/skills/ce-compound/SKILL.md                | 164 +++-
 .../references/agents/best-practices-researcher.md | 115 +++
 .../references/agents/data-integrity-guardian.md   |  68 ++
 .../references/agents/framework-docs-researcher.md |  93 +++
 .../agents/pattern-recognition-specialist.md       |  55 ++
 .../references/agents/performance-oracle.md        | 108 +++
 .../references/agents/security-sentinel.md         |  91 ++
 .../references/agents/session-historian.md         |  83 ++
 .../scripts/session-history/discover-sessions.sh   | 130 +++
 .../scripts/session-history/extract-errors.py      | 254 ++++++
 .../scripts/session-history/extract-metadata.py    | 456 ++++++++++
 .../scripts/session-history/extract-skeleton.py    | 570 +++++++++++++
 .../src/skills/ce-debug/SKILL.md                   | 286 +++++--
 .../skills/ce-debug/references/anti-patterns.md    |  91 ++
 .../skills/ce-debug/references/defense-in-depth.md |  35 +
 .../references/investigation-techniques.md         | 374 +++++++++
 .../src/skills/ce-ideate/SKILL.md                  | 223 ++---
 .../agents/issue-intelligence-analyst.md           | 200 +++++
 .../references/agents/learnings-researcher.md      | 247 ++++++
 .../references/agents/slack-researcher.md          | 127 +++
 .../ce-ideate/references/agents/web-researcher.md  | 121 +++
 .../ce-ideate/references/divergent-ideation.md     |  89 ++
 .../skills/ce-ideate/references/html-rendering.md  | 631 ++++++++++++++
 .../ce-ideate/references/ideation-sections.md      | 191 +++++
 .../ce-ideate/references/markdown-rendering.md     | 236 ++++++
 .../ce-ideate/references/post-ideation-workflow.md | 246 ++----
 .../ce-ideate/references/universal-ideation.md     |  24 +-
 .../src/skills/ce-plan/SKILL.md                    | 171 ++--
 .../agents/agent-native-planning-strategist.md     |  62 ++
 .../references/agents/architecture-strategist.md   |  46 +
 .../references/agents/best-practices-researcher.md | 114 +++
 .../references/agents/data-integrity-guardian.md   |  68 ++
 .../references/agents/data-migration-reviewer.md   | 103 +++
 .../agents/deployment-verification-agent.md        | 157 ++++
 .../references/agents/framework-docs-researcher.md |  93 +++
 .../references/agents/git-history-analyzer.md      |  40 +
 .../references/agents/learnings-researcher.md      | 247 ++++++
 .../agents/pattern-recognition-specialist.md       |  55 ++
 .../references/agents/performance-oracle.md        | 108 +++
 .../references/agents/repo-research-analyst.md     | 256 ++++++
 .../ce-plan/references/agents/security-sentinel.md |  91 ++
 .../ce-plan/references/agents/slack-researcher.md  | 127 +++
 .../references/agents/spec-flow-analyzer.md        |  80 ++
 .../ce-plan/references/agents/web-researcher.md    | 121 +++
 .../skills/ce-plan/references/approach-altitude.md |  55 ++
 .../ce-plan/references/deepening-workflow.md       |  68 +-
 .../skills/ce-plan/references/html-rendering.md    | 253 ++++--
 .../ce-plan/references/markdown-rendering.md       |  55 +-
 .../src/skills/ce-plan/references/plan-handoff.md  |  81 +-
 .../src/skills/ce-plan/references/plan-sections.md | 231 +++++-
 .../skills/ce-plan/references/synthesis-summary.md |  28 +-
 .../ce-plan/references/universal-planning.md       |   9 +-
 .../src/skills/ce-resolve-pr-feedback/SKILL.md     |  12 +-
 .../references/agents/pr-comment-resolver.md       |  56 ++
 .../references/evaluation-rubric.md                | 106 +++
 .../ce-resolve-pr-feedback/references/full-mode.md | 207 ++---
 .../references/targeted-mode.md                    |  24 +-
 .../ce-resolve-pr-feedback/scripts/get-pr-comments |  13 +-
 .../scripts/get-thread-for-comment                 |  11 +-
 .../src/skills/ce-strategy/SKILL.md                |   4 +-
 .../src/skills/ce-work/SKILL.md                    | 191 +++--
 .../ce-work/references/agents/figma-design-sync.md | 165 ++++
 .../skills/ce-work/references/execution-engines.md |  85 ++
 .../ce-work/references/non-code-execution.md       |  23 +
 .../ce-work/references/review-findings-followup.md | 104 +++
 .../skills/ce-work/references/shipping-workflow.md |  89 +-
 .../src/skills/ce-work/references/tracker-defer.md |  16 +-
 .../src/upstream-provenance.ts                     |  15 +
 137 files changed, 12130 insertions(+), 1994 deletions(-)

Fusion-Task-Id: FN-7094

Fusion-Task-Lineage: 85df8f84-86f1-496a-953a-e4cf5a9da596

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-27 09:28:30 -07:00

190 lines
7.0 KiB
TypeScript

import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { dirname, isAbsolute, join, resolve, sep } from "node:path";
import { fileURLToPath } from "node:url";
import { CE_UPSTREAM_PROVENANCE } from "./upstream-provenance.js";
/**
* Physical install of the bundled Compound Engineering agent persona
* definitions (the `ce-*` reviewer/research personas the CE skills fan out to).
*
* WHY A PHYSICAL INSTALL + ENV, NOT A PLUGIN CONTRIBUTION (spike finding):
* Fusion has no plugin agent-contribution channel — `FusionPlugin` contributes
* skills/workflowSteps/traits but not agents, and `fn_spawn_agent` resolves no
* persona by name. So the CE skills running inside a workflow step read a
* persona def from disk and pass its body to `fn_spawn_agent` via the
* `systemPromptOverride` param. For the skill to find the defs, they are
* installed into a plugin-local directory whose path is exported to step
* sessions through the plugin's `executorRuntimeEnv` hook (FUSION_CE_AGENTS_DIR).
*
* Mirrors `skill-installation.ts`: cpSync into a plugin-local directory, never a
* global `<home>/.claude/agents` path. Existing plugin-local copies are refreshed
* when their provenance marker is absent or stale so prompt persona updates reach
* existing enabled plugins.
*/
export type CeAgentInstallOutcome = "installed" | "refreshed" | "skipped" | "error";
export interface CeAgentInstallResult {
agentId: string;
sourceFile: string;
targetFile: string;
outcome: CeAgentInstallOutcome;
reason?: string;
}
export interface InstallBundledCeAgentsResult {
targetRoot: string;
results: CeAgentInstallResult[];
}
/** Absolute path to the plugin's bundled `src/agents` directory (source of truth). */
export function resolveBundledAgentsRoot(): string {
const here = fileURLToPath(import.meta.url);
const dir = dirname(here);
const local = resolve(dir, "agents");
if (existsSync(local)) return local;
return resolve(dir, "..", "src", "agents");
}
/**
* Default plugin-local install target (`.fusion-ce-agents/`). ALWAYS plugin-local
* — never a global client agents directory.
*/
export function resolveDefaultAgentsInstallTargetRoot(): string {
const here = fileURLToPath(import.meta.url);
return resolve(dirname(here), "..", ".fusion-ce-agents");
}
const GLOBAL_AGENT_DIR_PATTERN = /[\\/]\.(claude|codex|gemini)[\\/]agents([\\/]|$)/;
/** Guard: refuse to install into a global client agents directory. */
export function assertPluginLocalAgentsTarget(targetRoot: string): void {
const normalized = resolve(targetRoot);
if (GLOBAL_AGENT_DIR_PATTERN.test(normalized + sep)) {
throw new Error(
`Refusing to install Compound Engineering agents into a global client agents directory: ${normalized}. ` +
`Install target MUST be plugin-local (never <home>/.claude|.codex|.gemini/agents).`,
);
}
}
/** A bundled agent def must exist and carry a frontmatter `name:`. */
function assertValidAgentSource(agentId: string, sourceFile: string): void {
if (!existsSync(sourceFile)) {
throw new Error(`Bundled agent def missing for '${agentId}': ${sourceFile}`);
}
const content = readFileSync(sourceFile, "utf-8");
if (!/^---[\s\S]*?\bname\s*:\s*\S/m.test(content)) {
throw new Error(`Bundled agent def '${agentId}' at ${sourceFile} is missing a frontmatter 'name:' field`);
}
}
export interface InstallBundledCeAgentsOptions {
/** Override the install target root (must be plugin-local). */
targetRoot?: string;
/** Override the bundled source root (tests). */
sourceRoot?: string;
}
const AGENT_INSTALL_PROVENANCE_FILE = ".fusion-ce-upstream-provenance.json";
function installProvenancePath(targetRoot: string): string {
return join(targetRoot, AGENT_INSTALL_PROVENANCE_FILE);
}
function isCurrentInstalledProvenance(targetRoot: string): boolean {
try {
const marker = JSON.parse(readFileSync(installProvenancePath(targetRoot), "utf-8")) as Partial<
typeof CE_UPSTREAM_PROVENANCE
>;
return (
marker.releaseTag === CE_UPSTREAM_PROVENANCE.releaseTag &&
marker.tarballSha256 === CE_UPSTREAM_PROVENANCE.tarballSha256
);
} catch {
return false;
}
}
function writeInstalledProvenance(targetRoot: string): void {
mkdirSync(targetRoot, { recursive: true });
writeFileSync(
installProvenancePath(targetRoot),
`${JSON.stringify(
{
repo: CE_UPSTREAM_PROVENANCE.repo,
releaseTag: CE_UPSTREAM_PROVENANCE.releaseTag,
commit: CE_UPSTREAM_PROVENANCE.commit,
tarballSha256: CE_UPSTREAM_PROVENANCE.tarballSha256,
installedAt: new Date().toISOString(),
},
null,
2,
)}\n`,
);
}
/**
* Copy each bundled `ce-*.md` agent def into the plugin-local install target.
*
* FNXC:CompoundEngineering 2026-06-26-23:55:
* Persona prompts are part of the pinned upstream bundle, so the plugin-local agent install uses the same provenance-aware refresh policy as skills. This prevents stale skip-if-exists installs from continuing to dispatch old personas after a vendored refresh.
*/
export function installBundledCeAgents(
options: InstallBundledCeAgentsOptions = {},
): InstallBundledCeAgentsResult {
const targetRoot = options.targetRoot
? resolve(options.targetRoot)
: resolveDefaultAgentsInstallTargetRoot();
assertPluginLocalAgentsTarget(targetRoot);
const sourceRoot = options.sourceRoot ? resolve(options.sourceRoot) : resolveBundledAgentsRoot();
const installIsCurrent = isCurrentInstalledProvenance(targetRoot);
const sourceFiles = existsSync(sourceRoot)
? readdirSync(sourceRoot).filter((f) => f.endsWith(".md"))
: [];
const results = sourceFiles.map<CeAgentInstallResult>((file) => {
const agentId = file.replace(/\.md$/, "");
const sourceFile = join(sourceRoot, file);
const targetFile = join(targetRoot, file);
try {
assertValidAgentSource(agentId, sourceFile);
if (existsSync(targetFile)) {
if (installIsCurrent) {
return { agentId, sourceFile, targetFile, outcome: "skipped", reason: "current install preserved" };
}
rmSync(targetFile, { force: true });
mkdirSync(targetRoot, { recursive: true });
cpSync(sourceFile, targetFile);
return { agentId, sourceFile, targetFile, outcome: "refreshed", reason: "stale install refreshed" };
}
mkdirSync(targetRoot, { recursive: true });
cpSync(sourceFile, targetFile);
return { agentId, sourceFile, targetFile, outcome: "installed" };
} catch (error) {
return {
agentId,
sourceFile,
targetFile,
outcome: "error",
reason: error instanceof Error ? error.message : String(error),
};
}
});
if (results.length > 0 && results.every((result) => result.outcome !== "error")) {
writeInstalledProvenance(targetRoot);
}
return { targetRoot, results };
}
/** True if the given path is absolute and not inside a global client agents dir. */
export function isPluginLocalAgentsPath(p: string): boolean {
return isAbsolute(p) && !GLOBAL_AGENT_DIR_PATTERN.test(resolve(p) + sep);
}