Agent Skillsmonotykamary/pi-fabric › fabric-workflow

fabric-workflow

GitHub

用于运行动态工作流,支持代码定义阶段、并行扇出、流水线及结构化Agent。适用于大型审计、迁移、并行研究等需要复杂编排和预算控制的场景。

skills/fabric-workflow/SKILL.md monotykamary/pi-fabric

Trigger Scenarios

大型审计任务 数据迁移 并行研究请求 显式的工作流编排需求

Install

npx skills add monotykamary/pi-fabric --skill fabric-workflow -g -y
More Options

Use without installing

npx skills use monotykamary/pi-fabric@fabric-workflow

指定 Agent (Claude Code)

npx skills add monotykamary/pi-fabric --skill fabric-workflow -a claude-code -g -y

安装 repo 全部 skill

npx skills add monotykamary/pi-fabric --all -g -y

预览 repo 内 skill

npx skills add monotykamary/pi-fabric --list

SKILL.md

Frontmatter
{
    "name": "fabric-workflow",
    "description": "Runs a dynamic Pi Fabric workflow with code-held phases, fan-out, pipelines, structured agents, and best-effort verification. Use for large audits, migrations, parallel research, or explicit workflow requests.",
    "disable-model-invocation": true
}

Fabric Dynamic Workflow

Put the complete loop, phases, and branches in one type-checked fabric_exec program. Pass the objective as strings.task.

Core surfaces:

  • agent(prompt, { label, tools?, schema?, ... }) for a bounded worker; label every call.
  • parallel(thunks, { concurrency }) for fan-out; pass functions, not promises.
  • pipeline(items, ...stages) for sequential stages per item with cross-item concurrency.
  • workflow.configure, phase, workflow.item, workflow.event, and workflow.log for dashboard progress.
  • workflow.budget plus top-level agentBudget/tokenBudget for bounded runs.

Use JSON Schema when machine-readable output makes aggregation safer. A reliable shape is discover → analyze in checked batches → verify available findings:

type WorkOutcome =
  | { item: string; status: "completed"; finding: string }
  | { item: string; status: "failed" | "not_started"; error: string };

await workflow.configure({
  name: "Request analysis",
  description: "Discover, analyze, and verify bounded work items",
});
await phase("Discover", { total: 1 });
const inventory = await agent<{ items: string[] }>(
  `Discover the bounded work items for this objective.\n\nObjective:\n${π.task}`,
  {
    label: "inventory",
    tools: ["read", "grep", "find", "ls"],
    schema: {
      type: "object",
      properties: {
        items: { type: "array", maxItems: 32, items: { type: "string" } },
      },
      required: ["items"],
      additionalProperties: false,
    },
  },
);
const items = [...new Set(inventory.items.map((item) => item.trim()).filter(Boolean))];
if (items.length === 0) {
  return {
    status: "success",
    coverage: { requested: 0, completed: 0 },
    failures: [],
    result: "No bounded work items were found.",
  };
}

await phase("Analyze", { total: items.length });
const outcomes: WorkOutcome[] = [];
const batchSize = 8;
for (let offset = 0; offset < items.length; offset += batchSize) {
  const batch = items.slice(offset, offset + batchSize);
  const settled = await parallel(
    batch.map((item) => async (): Promise<WorkOutcome> => {
      try {
        const finding = await agent(
          `Analyze this bounded item with evidence: ${item}\n\nObjective:\n${π.task}`,
          {
            label: `analyze ${item}`.slice(0, 50),
            tools: ["read", "grep", "find", "ls"],
          },
        );
        return { item, status: "completed", finding };
      } catch (error) {
        return {
          item,
          status: "failed",
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }),
    { concurrency: batch.length },
  );
  outcomes.push(...settled);
  if (settled.every((outcome) => outcome.status === "failed")) {
    outcomes.push(...items.slice(offset + batch.length).map((item): WorkOutcome => ({
      item,
      status: "not_started",
      error: "not started after an all-failed batch",
    })));
    break;
  }
}

const completed = outcomes.filter(
  (outcome): outcome is Extract<WorkOutcome, { status: "completed" }> =>
    outcome.status === "completed",
);
const failures = outcomes.filter(
  (outcome): outcome is Extract<WorkOutcome, { status: "failed" | "not_started" }> =>
    outcome.status !== "completed",
);
const coverage = { requested: items.length, completed: completed.length };
if (completed.length === 0) {
  return { status: "failed", coverage, failures, result: null };
}

await phase("Verify", { total: 1 });
try {
  const result = await agent(
    `Adversarially verify only these completed findings, remove unsupported claims, and do not infer anything about failed items.\n\nObjective:\n${π.task}\n\nFindings:\n${JSON.stringify(completed)}`,
    { label: "verify synthesis", tools: ["read", "grep", "find", "ls"] },
  );
  await workflow.event({ message: "Verification complete", level: "success" });
  return {
    status: failures.length === 0 ? "success" : "partial",
    coverage,
    failures,
    result,
  };
} catch (error) {
  return {
    status: "partial",
    coverage,
    failures,
    result: null,
    verificationError: error instanceof Error ? error.message : String(error),
    fallback: completed,
  };
}

Adapt phases and tools to the request. For edits, partition path ownership or use worktree: true; never let concurrent workers edit the same files. Successful verification returns compact output; raw findings return only if verification fails. partial is usable and must not trigger an automatic whole-workflow rerun—retry only failed items when their coverage matters.

Use agents.spawn plus status/steer instead of blocking agent() only when a valuable long-running worker must be observed and redirected between turns. Inventory is capped and checked batches stop new work after a systemic all-failed batch. Concurrent calls can still overshoot observational budgets because usage settles afterward.

Version History

  • 843dadb Current 2026-08-16 15:40

Same Skill Collection

skills/fabric-advisor/SKILL.md
skills/fabric-ambient/SKILL.md
skills/fabric-council/SKILL.md
skills/fabric-exec/SKILL.md
skills/fabric-fusion/SKILL.md
skills/fabric-guide/SKILL.md
skills/fabric-rlm/SKILL.md
skills/fabric-schema/SKILL.md
skills/fabric-spec/SKILL.md
skills/fabric-supervisor/SKILL.md
skills/fabric-swarm/SKILL.md

Metadata

Files
0
Version
843dadb
Hash
2bdf6768
Indexed
2026-08-16 15:40

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 17:17
浙ICP备14020137号-1 $mapa de visitantes$