@kontourai/flow-agents 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/.github/dependabot.yml +23 -0
  2. package/.github/workflows/release-please.yml +31 -0
  3. package/.github/workflows/runtime-compat.yml +118 -0
  4. package/CHANGELOG.md +46 -0
  5. package/CONTRIBUTING.md +4 -0
  6. package/README.md +80 -18
  7. package/build/src/cli/flow-kit.js +9 -4
  8. package/build/src/cli/init.js +215 -5
  9. package/build/src/cli/runtime-adapter.js +9 -5
  10. package/build/src/cli/telemetry-doctor.js +4 -1
  11. package/build/src/cli/utterance-check.js +65 -1
  12. package/build/src/runtime-adapters.js +34 -0
  13. package/build/src/tools/build-universal-bundles.js +285 -0
  14. package/build/src/tools/filter-installed-packs.js +3 -0
  15. package/build/src/tools/validate-source-tree.js +5 -1
  16. package/console.telemetry.json +115 -20
  17. package/context/scripts/telemetry/lib/config.sh +5 -1
  18. package/context/settings/flow-agents-settings.json +7 -0
  19. package/docs/_layouts/default.html +2 -0
  20. package/docs/context-map.md +1 -0
  21. package/docs/index.md +53 -4
  22. package/docs/integrations/conformance.md +246 -0
  23. package/docs/integrations/framework-adapter.md +275 -0
  24. package/docs/integrations/harness-install.md +213 -0
  25. package/docs/integrations/index.md +58 -0
  26. package/docs/integrations/knowledge-kit-live.md +211 -0
  27. package/docs/kit-authoring-guide.md +169 -0
  28. package/docs/north-star.md +2 -2
  29. package/docs/spec/runtime-hook-surface.md +525 -0
  30. package/docs/survey-utterance-check.md +211 -94
  31. package/docs/vision.md +45 -0
  32. package/evals/acceptance/run.sh +13 -2
  33. package/evals/acceptance/test_knowledge_kit_live.sh +221 -0
  34. package/evals/acceptance/test_opencode_harness.sh +121 -0
  35. package/evals/acceptance/test_pi_harness.sh +113 -0
  36. package/evals/integration/test_bundle_install.sh +226 -1
  37. package/evals/integration/test_bundle_lifecycle.sh +641 -0
  38. package/evals/integration/test_runtime_adapter_activation.sh +113 -1
  39. package/evals/integration/test_utterance_check.sh +291 -44
  40. package/evals/run.sh +2 -0
  41. package/evals/static/test_universal_bundles.sh +137 -2
  42. package/integrations/strands/README.md +256 -0
  43. package/integrations/strands/example.py +74 -0
  44. package/integrations/strands/examples/knowledge_kit_live.py +461 -0
  45. package/integrations/strands/flow_agents_strands/__init__.py +27 -0
  46. package/integrations/strands/flow_agents_strands/hooks.py +194 -0
  47. package/integrations/strands/flow_agents_strands/policy.py +348 -0
  48. package/integrations/strands/flow_agents_strands/steering.py +225 -0
  49. package/integrations/strands/flow_agents_strands/telemetry.py +238 -0
  50. package/integrations/strands/pyproject.toml +38 -0
  51. package/integrations/strands/tests/__init__.py +0 -0
  52. package/integrations/strands/tests/test_hooks.py +392 -0
  53. package/integrations/strands/tests/test_policy.py +315 -0
  54. package/integrations/strands/tests/test_telemetry.py +184 -0
  55. package/integrations/strands-ts/README.md +224 -0
  56. package/integrations/strands-ts/bin/conformance-shim.mjs +257 -0
  57. package/integrations/strands-ts/package.json +53 -0
  58. package/integrations/strands-ts/src/hooks.ts +312 -0
  59. package/integrations/strands-ts/src/index.ts +22 -0
  60. package/integrations/strands-ts/src/policy.ts +345 -0
  61. package/integrations/strands-ts/src/telemetry.ts +251 -0
  62. package/integrations/strands-ts/test/test-policy.ts +322 -0
  63. package/integrations/strands-ts/test/test-steering.ts +159 -0
  64. package/integrations/strands-ts/test/test-telemetry.ts +226 -0
  65. package/integrations/strands-ts/tsconfig.json +20 -0
  66. package/kits/catalog.json +6 -0
  67. package/kits/knowledge/adapters/default-store/index.js +821 -0
  68. package/kits/knowledge/adapters/flow-runner/index.js +1179 -0
  69. package/kits/knowledge/adapters/flow-runner/telemetry.js +174 -0
  70. package/kits/knowledge/docs/README.md +135 -0
  71. package/kits/knowledge/docs/store-contract.md +526 -0
  72. package/kits/knowledge/evals/consolidation/suite.test.js +1234 -0
  73. package/kits/knowledge/evals/contract-suite/suite.test.js +670 -0
  74. package/kits/knowledge/evals/ingest-compile/suite.test.js +574 -0
  75. package/kits/knowledge/evals/synthesis/suite.test.js +909 -0
  76. package/kits/knowledge/flows/compile.flow.json +60 -0
  77. package/kits/knowledge/flows/consolidate.flow.json +77 -0
  78. package/kits/knowledge/flows/ingest.flow.json +60 -0
  79. package/kits/knowledge/flows/store-contract.flow.json +48 -0
  80. package/kits/knowledge/flows/synthesize.flow.json +77 -0
  81. package/kits/knowledge/kit.json +78 -0
  82. package/package.json +7 -2
  83. package/packaging/conformance/README.md +142 -0
  84. package/packaging/conformance/fixtures/config-protection--allow-no-path.json +18 -0
  85. package/packaging/conformance/fixtures/config-protection--allow-safe-file.json +20 -0
  86. package/packaging/conformance/fixtures/config-protection--block-biome.json +20 -0
  87. package/packaging/conformance/fixtures/config-protection--block-eslintrc.json +20 -0
  88. package/packaging/conformance/fixtures/quality-gate--allow-no-path.json +17 -0
  89. package/packaging/conformance/fixtures/quality-gate--allow-nonexistent-file.json +19 -0
  90. package/packaging/conformance/fixtures/stop-goal-fit--allow-clean-cwd.json +17 -0
  91. package/packaging/conformance/fixtures/stop-goal-fit--block-strict-mode.json +23 -0
  92. package/packaging/conformance/fixtures/stop-goal-fit--warn-active-delivery.json +21 -0
  93. package/packaging/conformance/fixtures/workflow-steering--allow-no-state.json +16 -0
  94. package/packaging/conformance/fixtures/workflow-steering--inject-active-state.json +29 -0
  95. package/packaging/conformance/fixtures/workflow-steering--inject-subagent-steering.json +25 -0
  96. package/packaging/conformance/package.json +4 -0
  97. package/packaging/conformance/run-conformance.js +322 -0
  98. package/packaging/manifest.json +59 -0
  99. package/schemas/flow-agents-settings.schema.json +48 -0
  100. package/scripts/README.md +4 -0
  101. package/scripts/dogfood.js +16 -0
  102. package/scripts/hooks/opencode-hook-adapter.js +123 -0
  103. package/scripts/hooks/opencode-telemetry-hook.js +101 -0
  104. package/scripts/hooks/pi-hook-adapter.js +123 -0
  105. package/scripts/hooks/pi-telemetry-hook.js +105 -0
  106. package/scripts/hooks/run-hook.js +8 -0
  107. package/scripts/hooks/utterance-check.js +124 -22
  108. package/scripts/telemetry/lib/config.sh +5 -1
  109. package/src/cli/flow-kit.ts +10 -4
  110. package/src/cli/init.ts +219 -6
  111. package/src/cli/runtime-adapter.ts +10 -5
  112. package/src/cli/telemetry-doctor.ts +4 -1
  113. package/src/cli/utterance-check.ts +71 -1
  114. package/src/runtime-adapters.ts +35 -0
  115. package/src/tools/build-universal-bundles.ts +283 -0
  116. package/src/tools/filter-installed-packs.ts +3 -0
  117. package/src/tools/validate-source-tree.ts +5 -1
@@ -332,6 +332,285 @@ function buildCodex(agents: Agent[]): void {
332
332
  writeText(path.join(bundle, "install.sh"), installScript("Codex", "/path/to/workspace"));
333
333
  fs.chmodSync(path.join(bundle, "install.sh"), 0o755);
334
334
  }
335
+ function exportOpencodeAgent(spec: Agent): string {
336
+ // Determine agent mode: orchestrator-like agents -> primary, others -> subagent
337
+ const primaryAgents = new Set(["dev"]);
338
+ const mode = primaryAgents.has(spec.name) ? "primary" : "subagent";
339
+ const prompt = appendExportNote(sanitizeText(spec.prompt, "opencode", "<bundle-root>"), "Kiro hook wiring and JSON-only runtime fields were omitted. If this agent mentions Kiro-specific scheduler or hook behavior, treat that as optional operational guidance rather than a hard dependency.");
340
+ const lines: string[] = ["---"];
341
+ lines.push(`description: ${String(spec.description ?? "").trim()}`);
342
+ lines.push(`mode: ${mode}`);
343
+ lines.push(`model: ${mapped("claude_model_map", spec.model)}`);
344
+ lines.push("---");
345
+ lines.push("");
346
+ lines.push(prompt);
347
+ return lines.join("\n");
348
+ }
349
+ function exportOpencodePlugin(): string {
350
+ // Generate the Flow Agents opencode plugin.
351
+ // opencode plugins are auto-loaded from .opencode/plugins/*.js at startup.
352
+ //
353
+ // NOTE: opencode has no direct user-prompt-submit hook. For prompt-submit
354
+ // workflow steering, we wire the steering command behind session.created
355
+ // (for session-start steering context) and tool.execute.before (for
356
+ // policy). This is the closest reasonable approximation — documented here
357
+ // as an honest gap matching the codex live-hook-influence caveat pattern.
358
+ //
359
+ // KNOWN GAP (verified 2026-06-11, opencode v1.16.2): session.created is NOT
360
+ // delivered to plugin event handlers in opencode (non-interactive) mode.
361
+ // The session IS created server-side but the event fires before the plugin
362
+ // hook dispatch loop is active. As a result, agentSpawn telemetry (session.start)
363
+ // is never emitted in run-mode sessions — only tool.invoke/tool.result appear.
364
+ // This is an opencode runtime limitation, not a bug in this plugin.
365
+ // Session.start telemetry carries L1 conformance but is unavailable in run mode.
366
+ // See docs/spec/runtime-hook-surface.md opencode mapping row for the full gap note.
367
+ return `/**
368
+ * Flow Agents opencode plugin.
369
+ *
370
+ * Auto-loaded from .opencode/plugins/flow-agents.js at opencode startup.
371
+ * Delegates policy and telemetry decisions to shared scripts in scripts/hooks/
372
+ * using the same payload contract as the claude/codex adapters.
373
+ *
374
+ * EVENT MAPPING NOTE: opencode has no direct user-prompt-submit hook.
375
+ * Workflow steering (workflow-steering.js) is wired to session.created
376
+ * (session-start context) and tool.execute.before (per-tool policy).
377
+ * This approximates the UserPromptSubmit behavior in other runtimes but
378
+ * cannot intercept mid-session user messages before they are processed.
379
+ * This is an accepted gap documented here analogously to the codex
380
+ * live-hook-influence caveat.
381
+ *
382
+ * KNOWN GAP: session.created is NOT delivered to plugin handlers in opencode
383
+ * run (non-interactive) mode (verified v1.16.2, 2026-06-11). agentSpawn
384
+ * telemetry (session.start) is therefore absent from run-mode sessions.
385
+ * tool.invoke and tool.result events (L1) are still recorded normally.
386
+ * This is an opencode runtime limitation; no workaround is available without
387
+ * a different hook surface. See docs/spec/runtime-hook-surface.md for details.
388
+ */
389
+
390
+ import { spawnSync } from 'node:child_process';
391
+ import { join, basename } from 'node:path';
392
+
393
+ // opencode runs plugins inside its own compiled (Bun-based) binary, so
394
+ // process.execPath points at opencode itself — spawning it with a script
395
+ // path silently does nothing (caught by live acceptance smoke 2026-06-11).
396
+ // Resolve a real node binary instead; fall back to PATH lookup.
397
+ const NODE_BIN = basename(process.execPath).startsWith('node') ? process.execPath : 'node';
398
+
399
+ export const FlowAgentsPlugin = async ({ project, client, $, directory, worktree }) => {
400
+ const root = directory || process.cwd();
401
+
402
+ // The hook scripts read the event payload from stdin; an empty stdin makes
403
+ // the telemetry pipeline silently skip the emit (fail-open), so every spawn
404
+ // must pass a payload (caught by live acceptance smoke 2026-06-11).
405
+ function hookPayload(eventName, detail) {
406
+ return JSON.stringify({ hook_event_name: eventName, cwd: root, ...(detail || {}) });
407
+ }
408
+
409
+ function runAdapter(adapterScript, eventName, detail, ...args) {
410
+ const adapterPath = join(root, 'scripts', 'hooks', adapterScript);
411
+ const result = spawnSync(NODE_BIN, [adapterPath, eventName, ...args], {
412
+ input: hookPayload(eventName, detail),
413
+ encoding: 'utf8',
414
+ cwd: root,
415
+ env: { ...process.env, FLOW_AGENTS_HOOK_RUNTIME: 'opencode' },
416
+ timeout: 30000,
417
+ });
418
+ try {
419
+ return JSON.parse(result.stdout || '{}');
420
+ } catch {
421
+ return { allow: true };
422
+ }
423
+ }
424
+
425
+ function runTelemetry(eventName, detail) {
426
+ const telemetryPath = join(root, 'scripts', 'hooks', 'opencode-telemetry-hook.js');
427
+ spawnSync(NODE_BIN, [telemetryPath, eventName, 'dev'], {
428
+ input: hookPayload(eventName, detail),
429
+ encoding: 'utf8',
430
+ cwd: root,
431
+ env: { ...process.env, FLOW_AGENTS_TELEMETRY_RUNTIME: 'opencode' },
432
+ timeout: 10000,
433
+ });
434
+ }
435
+
436
+ return {
437
+ 'session.created': async (_input, _output) => {
438
+ runTelemetry('session.created');
439
+ // Wire workflow steering on session start for context injection
440
+ runAdapter('opencode-hook-adapter.js', 'session.created', null, 'workflow-steering', 'workflow-steering.js', 'default');
441
+ },
442
+ 'tool.execute.before': async (input, output) => {
443
+ const detail = { tool: input && input.tool, args: output && output.args };
444
+ runTelemetry('tool.execute.before', detail);
445
+ const policyResult = runAdapter('opencode-hook-adapter.js', 'tool.execute.before', detail, 'config-protection', 'config-protection.js', 'default');
446
+ if (policyResult && policyResult.allow === false) {
447
+ throw new Error(policyResult.reason || 'Blocked by Flow Agents hook policy.');
448
+ }
449
+ },
450
+ 'tool.execute.after': async (input, output) => {
451
+ const detail = { tool: input && input.tool };
452
+ runTelemetry('tool.execute.after', detail);
453
+ runAdapter('opencode-hook-adapter.js', 'tool.execute.after', detail, 'quality-gate', 'quality-gate.js', 'default');
454
+ },
455
+ 'session.idle': async (_input, _output) => {
456
+ runTelemetry('session.idle');
457
+ runAdapter('opencode-hook-adapter.js', 'session.idle', null, 'stop-goal-fit', 'stop-goal-fit.js', 'default');
458
+ },
459
+ 'session.error': async (_input, _output) => {
460
+ runTelemetry('session.error');
461
+ },
462
+ 'session.compacted': async (_input, _output) => {
463
+ runTelemetry('session.compacted');
464
+ },
465
+ 'permission.asked': async (_input, _output) => {
466
+ runTelemetry('permission.asked');
467
+ },
468
+ 'file.edited': async (_input, _output) => {
469
+ runTelemetry('file.edited');
470
+ },
471
+ };
472
+ };
473
+ `;
474
+ }
475
+ function exportOpencodeConfig(): string {
476
+ // opencode's config schema requires `instructions` to be an ARRAY of
477
+ // instruction file paths/globs (a bare string fails validation and aborts
478
+ // startup). AGENTS.md is loaded natively by opencode, so the config stays
479
+ // minimal rather than double-including it.
480
+ return `${JSON.stringify({
481
+ $schema: "https://opencode.ai/config.json",
482
+ }, null, 2)}\n`;
483
+ }
484
+ function buildOpencode(agents: Agent[]): void {
485
+ const bundle = path.join(dist, "opencode");
486
+ resetDir(bundle);
487
+ copySharedContent(bundle, "opencode", "<bundle-root>");
488
+ writeText(path.join(bundle, manifest.opencode.task_dir, ".gitkeep"), "");
489
+ for (const spec of agents) {
490
+ writeText(path.join(bundle, ".opencode/agents", `${spec.name}.md`), exportOpencodeAgent(spec));
491
+ }
492
+ for (const skill of fs.readdirSync(path.join(root, "skills"))) {
493
+ const skillPath = path.join(root, "skills", skill, "SKILL.md");
494
+ if (fs.existsSync(skillPath)) writeText(path.join(bundle, ".opencode/skills", skill, "SKILL.md"), sanitizeText(readText(skillPath), "opencode", "<bundle-root>"));
495
+ }
496
+ writeText(path.join(bundle, ".opencode/plugins/flow-agents.js"), exportOpencodePlugin());
497
+ writeText(path.join(bundle, "opencode.json"), exportOpencodeConfig());
498
+ writeText(path.join(bundle, "AGENTS.md"), exportRootAgentsMd("opencode", agents, manifest.opencode.task_dir));
499
+ writeText(path.join(bundle, "README.md"), exportTargetReadme("opencode", "bash install.sh /path/to/workspace"));
500
+ writeText(path.join(bundle, "install.sh"), installScript("opencode", "/path/to/workspace"));
501
+ fs.chmodSync(path.join(bundle, "install.sh"), 0o755);
502
+ }
503
+ function exportPiExtension(): string {
504
+ // Generate the Flow Agents pi extension.
505
+ // pi extensions are auto-discovered from .pi/extensions/*.ts (needs project trust).
506
+ // pi has no named-subagent registry; agents are not exported. The extension
507
+ // provides workflow steering (via before_agent_start context injection),
508
+ // tool-call policy (via tool_call event), and telemetry delegation to shared scripts.
509
+ return `/**
510
+ * Flow Agents pi extension.
511
+ *
512
+ * Auto-discovered from .pi/extensions/flow-agents.ts at startup (needs project trust).
513
+ * Delegates policy and telemetry to shared scripts/hooks/ using spawnSync,
514
+ * mirroring the payload contract used by the claude/codex adapters.
515
+ *
516
+ * NOTE: pi has no named-subagent registry. Agents are not exported for pi.
517
+ * Rely on AGENTS.md + skills + this extension for workflow guidance.
518
+ */
519
+
520
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
521
+ import { spawnSync } from "node:child_process";
522
+ import { join, basename } from "node:path";
523
+
524
+ // pi may run extensions under a non-node runtime (Bun), where process.execPath
525
+ // is not a node binary and spawning it with a script path silently fails.
526
+ // Same failure class the opencode live smoke caught on 2026-06-11.
527
+ const NODE_BIN = basename(process.execPath).startsWith("node") ? process.execPath : "node";
528
+
529
+ export default function (pi: ExtensionAPI) {
530
+ const root = process.cwd();
531
+
532
+ function runAdapter(adapterScript: string, eventName: string, hookId: string, relScript: string): { allow: boolean; context?: string; reason?: string } {
533
+ const adapterPath = join(root, "scripts", "hooks", adapterScript);
534
+ const payload = JSON.stringify({ hook_event_name: eventName, cwd: root });
535
+ const result = spawnSync(NODE_BIN, [adapterPath, eventName, hookId, relScript, "default"], {
536
+ input: payload,
537
+ encoding: "utf8",
538
+ cwd: root,
539
+ env: { ...process.env, FLOW_AGENTS_HOOK_RUNTIME: "pi" },
540
+ timeout: 30000,
541
+ });
542
+ try {
543
+ return JSON.parse(result.stdout || "{}") as { allow: boolean; context?: string; reason?: string };
544
+ } catch {
545
+ return { allow: true };
546
+ }
547
+ }
548
+
549
+ function runTelemetry(eventName: string): void {
550
+ const telemetryPath = join(root, "scripts", "hooks", "pi-telemetry-hook.js");
551
+ const payload = JSON.stringify({ hook_event_name: eventName, cwd: root });
552
+ spawnSync(NODE_BIN, [telemetryPath, eventName, "dev"], {
553
+ input: payload,
554
+ encoding: "utf8",
555
+ cwd: root,
556
+ env: { ...process.env, FLOW_AGENTS_TELEMETRY_RUNTIME: "pi" },
557
+ timeout: 10000,
558
+ });
559
+ }
560
+
561
+ pi.on("session_start", async (_event, _ctx) => {
562
+ runTelemetry("session_start");
563
+ });
564
+
565
+ pi.on("before_agent_start", async (event, _ctx) => {
566
+ // Telemetry for agentSpawn is emitted by session_start above; do not repeat it here
567
+ // to avoid duplicate session.start events in the telemetry log.
568
+ // Inject workflow steering context at agent start
569
+ const result = runAdapter("pi-hook-adapter.js", "before_agent_start", "workflow-steering", "workflow-steering.js");
570
+ if (result.context) {
571
+ return {
572
+ systemPrompt: event.systemPrompt + "\\n\\n" + result.context,
573
+ };
574
+ }
575
+ });
576
+
577
+ pi.on("tool_call", async (event, _ctx) => {
578
+ runTelemetry("tool_call");
579
+ const result = runAdapter("pi-hook-adapter.js", "tool_call", "config-protection", "config-protection.js");
580
+ if (result && result.allow === false) {
581
+ return { block: true, reason: result.reason || "Blocked by Flow Agents hook policy." };
582
+ }
583
+ });
584
+
585
+ pi.on("tool_result", async (_event, _ctx) => {
586
+ runTelemetry("tool_result");
587
+ runAdapter("pi-hook-adapter.js", "tool_result", "quality-gate", "quality-gate.js");
588
+ });
589
+
590
+ pi.on("session_shutdown", async (_event, _ctx) => {
591
+ runTelemetry("session_shutdown");
592
+ runAdapter("pi-hook-adapter.js", "session_shutdown", "stop-goal-fit", "stop-goal-fit.js");
593
+ });
594
+ }
595
+ `;
596
+ }
597
+ function buildPi(agents: Agent[]): void {
598
+ const bundle = path.join(dist, "pi");
599
+ resetDir(bundle);
600
+ copySharedContent(bundle, "pi", "<bundle-root>");
601
+ writeText(path.join(bundle, manifest.pi.task_dir, ".gitkeep"), "");
602
+ // pi has no named-subagent registry; agents are left canonical/unexported.
603
+ // Skills are exported to .pi/skills/ (direct .md files supported in that dir).
604
+ for (const skill of fs.readdirSync(path.join(root, "skills"))) {
605
+ const skillPath = path.join(root, "skills", skill, "SKILL.md");
606
+ if (fs.existsSync(skillPath)) writeText(path.join(bundle, ".pi/skills", skill, "SKILL.md"), sanitizeText(readText(skillPath), "pi", "<bundle-root>"));
607
+ }
608
+ writeText(path.join(bundle, ".pi/extensions/flow-agents.ts"), exportPiExtension());
609
+ writeText(path.join(bundle, "AGENTS.md"), exportRootAgentsMd("pi", agents, manifest.pi.task_dir));
610
+ writeText(path.join(bundle, "README.md"), exportTargetReadme("pi", "bash install.sh /path/to/workspace"));
611
+ writeText(path.join(bundle, "install.sh"), installScript("pi", "/path/to/workspace"));
612
+ fs.chmodSync(path.join(bundle, "install.sh"), 0o755);
613
+ }
335
614
  function buildCatalog(agents: Agent[]): Record<string, unknown> {
336
615
  const kitsCatalog = path.join(root, "kits/catalog.json");
337
616
  return {
@@ -350,6 +629,8 @@ export function main(): number {
350
629
  buildKiro(agents);
351
630
  buildClaudeCode(agents);
352
631
  buildCodex(agents);
632
+ buildOpencode(agents);
633
+ buildPi(agents);
353
634
  writeText(path.join(dist, "catalog.json"), `${JSON.stringify(buildCatalog(agents), null, 2)}\n`);
354
635
  writeText(path.join(dist, "README.md"), "# Universal Bundles\n\nRun `npm run build:bundles` from the repo root to regenerate these bundles.\n");
355
636
  console.log("Built bundles:");
@@ -357,6 +638,8 @@ export function main(): number {
357
638
  console.log(" - dist/kiro");
358
639
  console.log(" - dist/claude-code");
359
640
  console.log(" - dist/codex");
641
+ console.log(" - dist/opencode");
642
+ console.log(" - dist/pi");
360
643
  if (printDiagnostics && dropDiagnostics.length) {
361
644
  console.error("Export sanitization diagnostics:");
362
645
  for (const item of dropDiagnostics) console.error(` - ${item}`);
@@ -107,10 +107,13 @@ export function main(argv = process.argv.slice(2)): number {
107
107
  removed += pruneNamedDirs(rootDir, "skills", allPackMembers(packs, "skills"), selected.skills, dryRun);
108
108
  removed += pruneNamedDirs(rootDir, ".claude/skills", allPackMembers(packs, "skills"), selected.skills, dryRun);
109
109
  removed += pruneNamedDirs(rootDir, ".codex/skills", allPackMembers(packs, "skills"), selected.skills, dryRun);
110
+ removed += pruneNamedDirs(rootDir, ".opencode/skills", allPackMembers(packs, "skills"), selected.skills, dryRun);
111
+ removed += pruneNamedDirs(rootDir, ".pi/skills", allPackMembers(packs, "skills"), selected.skills, dryRun);
110
112
  removed += pruneNamedDirs(rootDir, "powers", allPackMembers(packs, "powers"), selected.powers, dryRun);
111
113
  removed += pruneAgentFiles(rootDir, "agents", ".json", allPackMembers(packs, "agents"), selected.agents, dryRun);
112
114
  removed += pruneAgentFiles(rootDir, ".claude/agents", ".md", allPackMembers(packs, "agents"), selected.agents, dryRun);
113
115
  removed += pruneAgentFiles(rootDir, ".codex/agents", ".toml", allPackMembers(packs, "agents"), selected.agents, dryRun);
116
+ removed += pruneAgentFiles(rootDir, ".opencode/agents", ".md", allPackMembers(packs, "agents"), selected.agents, dryRun);
114
117
  const summary = {
115
118
  selected_packs: [...selectedNames].sort(),
116
119
  removed_entries: removed,
@@ -62,6 +62,10 @@ const hookFilePolicies = new Map<string, { category: string; requiredNeedles: st
62
62
  ["scripts/hooks/run-hook.js", { category: "hook runner", requiredNeedles: ["isHookEnabled", "Path traversal rejected"] }],
63
63
  ["scripts/hooks/config-protection.js", { category: "policy hook", requiredNeedles: ["Config Protection Hook"] }],
64
64
  ["scripts/hooks/governance-audit.sh", { category: "policy hook", requiredNeedles: ["governance-audit.sh", "audit_emit"] }],
65
+ ["scripts/hooks/opencode-hook-adapter.js", { category: "runtime adapter", requiredNeedles: ["opencode", "run-hook.js"] }],
66
+ ["scripts/hooks/opencode-telemetry-hook.js", { category: "telemetry shim", requiredNeedles: ["opencode", "telemetry"] }],
67
+ ["scripts/hooks/pi-hook-adapter.js", { category: "runtime adapter", requiredNeedles: ["pi", "run-hook.js"] }],
68
+ ["scripts/hooks/pi-telemetry-hook.js", { category: "telemetry shim", requiredNeedles: ["pi", "telemetry"] }],
65
69
  ["scripts/hooks/post-edit-accumulator.js", { category: "policy hook", requiredNeedles: ["Post-Edit"] }],
66
70
  ["scripts/hooks/pre-commit-quality.js", { category: "repo guardrail hook", requiredNeedles: ["staged"] }],
67
71
  ["scripts/hooks/quality-gate.js", { category: "policy hook", requiredNeedles: ["Quality"] }],
@@ -95,7 +99,7 @@ const requiredUsageFeedbackFiles = [
95
99
  const fixtureOwnershipSelfAuditRefs = new Set([
96
100
  "evals/integration/test_fixture_retirement_audit.sh",
97
101
  ]);
98
- const pythonInventoryExcludes = new Set([".git", ".flow-agents", "node_modules", ".venv", "dist", "__pycache__", ".pytest_cache", ".cache", "build"]);
102
+ const pythonInventoryExcludes = new Set([".git", ".flow-agents", "node_modules", ".venv", "dist", "__pycache__", ".pytest_cache", ".cache", "build", "integrations"]);
99
103
  const pythonCommandScanRoots = ["README.md", "docs", "context", "skills", "prompts", "agents", "evals", "scripts", "packaging", "package.json"];
100
104
  const allowedPythonCommandFiles = [
101
105
  /^agents\/tool-explore-deps\.json$/,