hassan-mohiddin/freeflow / .deprecated/skill-tooling-pre-rewrite/skills/evaluate-skill
evaluate-skill
VerifiedUse when evaluating, comparing, or making readiness claims about agent-skill behavior.
scripts/pi-composition-runtime.mjs
View on GitHubimport { appendFile, mkdir, readFile } from "node:fs/promises";
import { dirname } from "node:path";
import {
runtimeContext,
workflowBootstrapMessage,
WORKFLOW_BOOTSTRAP_MESSAGE_TYPE,
} from "../../../pi-extension/dist/runtime-context.js";
import { sha256, stableJson } from "./lib/hash.mjs";
export const COMPOSITION_RUNTIME_PROFILE = "freeflow-interaction-workflow-v1";
const modeState = { defaultMode: "workflow", currentMode: null, effectiveMode: "workflow" };
const capabilityState = {
configured: true,
enabled: true,
interactionContract: { enabled: true, effective: true },
skills: { enabled: true, effective: true },
outputRouter: { enabled: false },
};
const routerConfigResult = { config: { enabled: false } };
export function buildCompositionRuntimeContext(freeflowContext) {
return runtimeContext(modeState, freeflowContext, routerConfigResult, capabilityState);
}
export function buildCompositionWorkflowEnvelope(workflowSkill) {
return workflowBootstrapMessage({ workflowSkill }, capabilityState, {
buildContextEntries() {
return [];
},
getEntries() {
return [];
},
});
}
async function appendEvidence(path, record) {
if (!path) return;
await mkdir(dirname(path), { recursive: true });
await appendFile(path, `${JSON.stringify(record)}\n`);
}
export function createCompositionRuntimeExtension({
interactionContractPath = process.env.FREEFLOW_EVAL_RUNTIME_INTERACTION_CONTRACT,
workflowPath = process.env.FREEFLOW_EVAL_RUNTIME_WORKFLOW,
evidencePath = process.env.FREEFLOW_EVAL_RUNTIME_EVIDENCE,
} = {}) {
if (!interactionContractPath || !workflowPath)
throw new Error("Composition runtime requires declared Interaction Contract and Workflow paths");
let resourcesPromise;
const resources = () => {
resourcesPromise ??= Promise.all([readFile(interactionContractPath, "utf8"), readFile(workflowPath, "utf8")]).then(
([interactionContract, workflowSkill]) => ({ interactionContract, workflowSkill }),
);
return resourcesPromise;
};
return function compositionRuntime(pi) {
let beforeAgentStarts = 0;
pi.on("before_agent_start", async (event, ctx) => {
const freeflowContext = await resources();
const contextText = buildCompositionRuntimeContext(freeflowContext);
const message = workflowBootstrapMessage(freeflowContext, capabilityState, ctx.sessionManager);
const systemPrompt = `${event.systemPrompt}\n\n${contextText}`;
const deliveryReason = message
? beforeAgentStarts === 0
? "initial"
: "active-marker-missing"
: "suppressed-active-marker";
beforeAgentStarts += 1;
await appendEvidence(evidencePath, {
type: "freeflow-composition-runtime-delivery",
profile: COMPOSITION_RUNTIME_PROFILE,
interaction_contract_sha256: sha256(freeflowContext.interactionContract),
workflow_sha256: sha256(freeflowContext.workflowSkill),
runtime_context_sha256: sha256(contextText),
system_prompt_sha256: sha256(systemPrompt),
workflow_custom_type: WORKFLOW_BOOTSTRAP_MESSAGE_TYPE,
workflow_delivered: Boolean(message),
workflow_delivery_reason: deliveryReason,
workflow_envelope_sha256: message ? sha256(stableJson(message)) : null,
});
return { message, systemPrompt };
});
};
}
export default function compositionRuntimeFromEnvironment(pi) {
return createCompositionRuntimeExtension()(pi);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |