@claude-flow/cli 3.32.26 → 3.32.30
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.
- package/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +4 -4
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.js +5 -3
- package/dist/src/commands/memory.js +49 -5
- package/dist/src/commands/metaharness.js +25 -5
- package/dist/src/commands/policy.d.ts +4 -0
- package/dist/src/commands/policy.js +107 -0
- package/dist/src/index.js +18 -0
- package/dist/src/init/claudemd-generator.js +53 -2
- package/dist/src/mcp-client.js +25 -1
- package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
- package/dist/src/mcp-tools/capability-brain.js +697 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
- package/dist/src/mcp-tools/guidance-tools.js +369 -37
- package/dist/src/mcp-tools/index.d.ts +4 -1
- package/dist/src/mcp-tools/index.js +3 -1
- package/dist/src/mcp-tools/memory-tools.js +26 -0
- package/dist/src/mcp-tools/metaharness-tools.js +27 -1
- package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
- package/dist/src/mcp-tools/policy-tools.js +121 -0
- package/dist/src/memory/memory-bridge.d.ts +11 -0
- package/dist/src/memory/memory-bridge.js +100 -21
- package/dist/src/memory/memory-initializer.d.ts +22 -1
- package/dist/src/memory/memory-initializer.js +184 -39
- package/dist/src/services/bounded-worker-pool.d.ts +28 -0
- package/dist/src/services/bounded-worker-pool.js +90 -0
- package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
- package/dist/src/services/harness-flywheel-runtime.js +18 -0
- package/dist/src/services/harness-flywheel.d.ts +4 -1
- package/dist/src/services/harness-flywheel.js +27 -6
- package/dist/src/services/policy-runtime.d.ts +38 -0
- package/dist/src/services/policy-runtime.js +340 -0
- package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
- package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
- package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
- package/node_modules/@claude-flow/codex/README.md +1044 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
- package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
- package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
- package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
- package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
- package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
- package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
- package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
- package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
- package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
- package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/index.js +54 -0
- package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
- package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
- package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
- package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
- package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
- package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/types.js +8 -0
- package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
- package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
- package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
- package/node_modules/@claude-flow/codex/package.json +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
- package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
- package/node_modules/@claude-flow/security/README.md +292 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
- package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
- package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
- package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
- package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
- package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
- package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
- package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
- package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/index.js +176 -0
- package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
- package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
- package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
- package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
- package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
- package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
- package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
- package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
- package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
- package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
- package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
- package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
- package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
- package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
- package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
- package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
- package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
- package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
- package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
- package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
- package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
- package/node_modules/@claude-flow/security/package.json +44 -0
- package/package.json +44 -12
- package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
- package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
|
@@ -10,6 +10,7 @@ import { runFlywheelGeneration, checkServedChampionDrift } from './harness-flywh
|
|
|
10
10
|
import { loadFrozenHumanEval } from './harness-frozen-eval.js';
|
|
11
11
|
import { proposeFlywheelCandidates, } from './flywheel-proposer.js';
|
|
12
12
|
import { sha256Ref } from './flywheel-receipt.js';
|
|
13
|
+
import { evaluatePolicyRequest } from './policy-runtime.js';
|
|
13
14
|
/** The human-labeled ADR-081 anchor — the never-regress relevance set. */
|
|
14
15
|
const ANCHOR = [
|
|
15
16
|
['how was the Opus model alias fixed', ['opus 4.8', 'opus alias', 'opus model alias', '#2232']],
|
|
@@ -31,6 +32,18 @@ export async function runFlywheelWorker(projectRoot, opts = {}) {
|
|
|
31
32
|
try {
|
|
32
33
|
if (!(opts.optInOverride ?? harnessLoopOptedIn()))
|
|
33
34
|
return { ran: false, reason: 'opt-in required (RUFLO_HARNESS_LOOP=1)' };
|
|
35
|
+
const policy = await evaluatePolicyRequest({
|
|
36
|
+
identity: { id: process.env.CLAUDE_FLOW_PRINCIPAL_ID ?? 'metaharness-local', type: 'agent', roles: ['optimizer'] },
|
|
37
|
+
action: {
|
|
38
|
+
type: 'metaharness.flywheel.run',
|
|
39
|
+
resource: projectRoot,
|
|
40
|
+
environment: 'development',
|
|
41
|
+
concurrency: opts.maxConcurrency ?? 2,
|
|
42
|
+
},
|
|
43
|
+
}, projectRoot);
|
|
44
|
+
if (policy.enforcedOutcome !== 'allowed') {
|
|
45
|
+
return { ran: false, reason: `policy-${policy.enforcedOutcome}:${policy.reason}; receipt=${policy.receiptId}` };
|
|
46
|
+
}
|
|
34
47
|
const neural = await import('../mcp-tools/neural-tools.js');
|
|
35
48
|
const applier = await import('../config/harness-feedback-applier.js');
|
|
36
49
|
const tool = neural.neuralTools.find((t) => t.name === 'neural_patterns');
|
|
@@ -64,6 +77,7 @@ export async function runFlywheelWorker(projectRoot, opts = {}) {
|
|
|
64
77
|
maxFailureRate: 0.01,
|
|
65
78
|
maxEvaluationCostMicros: 1_000_000,
|
|
66
79
|
};
|
|
80
|
+
// CLI flag opts.proposer takes precedence over RUFLO_FLYWHEEL_PROPOSER.
|
|
67
81
|
const proposerMode = opts.proposer
|
|
68
82
|
?? (process.env.RUFLO_FLYWHEEL_PROPOSER ?? 'auto');
|
|
69
83
|
if (!['auto', 'local', 'darwin'].includes(proposerMode)) {
|
|
@@ -86,6 +100,8 @@ export async function runFlywheelWorker(projectRoot, opts = {}) {
|
|
|
86
100
|
})),
|
|
87
101
|
darwinInvoker: opts.darwinInvoker,
|
|
88
102
|
allowSubstitutionPromotion: opts.allowSubstitutionPromotion,
|
|
103
|
+
maxConcurrency: Math.max(1, Math.min(opts.maxConcurrency ?? 2, 8)),
|
|
104
|
+
maxWallTimeMs: opts.evaluationTimeoutMs ?? 120_000,
|
|
89
105
|
});
|
|
90
106
|
const candidatePolicies = archive.paretoCandidates.map((candidate) => candidate.policy);
|
|
91
107
|
if (!candidatePolicies.length)
|
|
@@ -109,6 +125,8 @@ export async function runFlywheelWorker(projectRoot, opts = {}) {
|
|
|
109
125
|
effectiveProposer: archive.effectiveProposer,
|
|
110
126
|
proposerSubstitution: archive.proposerSubstitution,
|
|
111
127
|
candidatePolicies,
|
|
128
|
+
maxConcurrency: Math.max(1, Math.min(opts.maxConcurrency ?? 2, 8)),
|
|
129
|
+
evaluationTimeoutMs: opts.evaluationTimeoutMs,
|
|
112
130
|
};
|
|
113
131
|
return await runFlywheelTick(projectRoot, deps);
|
|
114
132
|
}
|
|
@@ -22,7 +22,7 @@ export interface AnchorTask {
|
|
|
22
22
|
}
|
|
23
23
|
export interface FlywheelDeps {
|
|
24
24
|
getPatterns: () => HarvestPattern[] | Promise<HarvestPattern[]>;
|
|
25
|
-
search: (query: string, config: RetrievalConfig) => Promise<RankedItem[]> | RankedItem[];
|
|
25
|
+
search: (query: string, config: RetrievalConfig, signal?: AbortSignal) => Promise<RankedItem[]> | RankedItem[];
|
|
26
26
|
anchorTasks: AnchorTask[];
|
|
27
27
|
activeParams?: () => Partial<RetrievalConfig> | null;
|
|
28
28
|
sample?: number;
|
|
@@ -38,6 +38,9 @@ export interface FlywheelDeps {
|
|
|
38
38
|
bootstrapIterations?: number;
|
|
39
39
|
/** Candidate policies supplied by an external proposer archive (ADR-322B). */
|
|
40
40
|
candidatePolicies?: RetrievalConfig[];
|
|
41
|
+
/** ADR-324: hard local cap for concurrent candidate/task evaluation. */
|
|
42
|
+
maxConcurrency?: number;
|
|
43
|
+
evaluationTimeoutMs?: number;
|
|
41
44
|
}
|
|
42
45
|
export interface FlywheelResult {
|
|
43
46
|
ran: boolean;
|
|
@@ -28,6 +28,7 @@ import { applyChampionParams } from '../config/harness-feedback-applier.js';
|
|
|
28
28
|
import { appendLedger, bootstrapDeltaCILow } from './harness-improvement-ledger.js';
|
|
29
29
|
import { createFlywheelReceipt, sha256Ref, } from './flywheel-receipt.js';
|
|
30
30
|
import { readFlywheelTransactionState, registerFlywheelReceipt, } from './flywheel-transaction.js';
|
|
31
|
+
import { runBoundedPool } from './bounded-worker-pool.js';
|
|
31
32
|
export const DEFAULT_CONFIG = { alpha: 0.5, subjectWeight: 2.0, mmrLambda: 0.7, bodyWeight: 1.0, typePenaltyFactor: 1.0 };
|
|
32
33
|
const EPS = 1e-3;
|
|
33
34
|
const cfgCanon = (c) => JSON.stringify(Object.fromEntries(Object.keys(c).sort().map((k) => [k, c[k]])));
|
|
@@ -115,12 +116,32 @@ export async function evaluateFlywheelCandidate(projectRoot, deps) {
|
|
|
115
116
|
// Precompute retrieval for baseline + all candidates over every task (async
|
|
116
117
|
// I/O up front → the harness scoring stays pure/sync).
|
|
117
118
|
const cache = new Map();
|
|
118
|
-
const configs = [baseline, ...candidates];
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
const configs = [...new Map([baseline, ...candidates].map((config) => [cfgKey(config), config])).values()];
|
|
120
|
+
const evalTasks = configs.flatMap((cfg) => blended.tasks.map((t) => {
|
|
121
|
+
const cacheKey = `${t.id}::${cfgKey(cfg)}`;
|
|
122
|
+
return {
|
|
123
|
+
id: cacheKey,
|
|
124
|
+
run: async (signal) => {
|
|
125
|
+
if (signal.aborted)
|
|
126
|
+
throw signal.reason;
|
|
127
|
+
return (await deps.search(t.input.q, cfg, signal)) || [];
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}));
|
|
131
|
+
const batch = await runBoundedPool(evalTasks, {
|
|
132
|
+
maxConcurrency: deps.maxConcurrency ?? 2,
|
|
133
|
+
timeoutMs: deps.evaluationTimeoutMs ?? 120_000,
|
|
134
|
+
});
|
|
135
|
+
for (const item of batch.results) {
|
|
136
|
+
if (item.status === 'fulfilled')
|
|
137
|
+
cache.set(item.id, item.value ?? []);
|
|
138
|
+
}
|
|
139
|
+
const failedEvaluations = batch.results.filter((item) => item.status !== 'fulfilled');
|
|
140
|
+
if (failedEvaluations.length > 0) {
|
|
141
|
+
return {
|
|
142
|
+
ran: false,
|
|
143
|
+
reason: `candidate evaluation incomplete (${failedEvaluations.length}/${batch.results.length}); peak concurrency ${batch.peakConcurrency}`,
|
|
144
|
+
};
|
|
124
145
|
}
|
|
125
146
|
const evalFn = (input, cfg) => cache.get(`${input.id}::${cfgKey(cfg)}`) ?? [];
|
|
126
147
|
const gradeFn = (output, expected) => grade(output, expected);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AgenticPolicyEngine, type BudgetLimit, type CapabilityEnvelope, type PolicyApproval, type PolicyDecision, type PolicyRequest, type PolicyRule, type PolicyState } from '@claude-flow/security';
|
|
2
|
+
export declare function loadPolicyState(projectRoot?: string): PolicyState;
|
|
3
|
+
export declare function autoMigratePolicyStateIfNeeded(projectRoot?: string): Promise<{
|
|
4
|
+
migrated: boolean;
|
|
5
|
+
statePath?: string;
|
|
6
|
+
mode?: PolicyState['mode'];
|
|
7
|
+
}>;
|
|
8
|
+
export declare function withPolicyTransaction<T>(projectRoot: string, operation: (engine: AgenticPolicyEngine) => T | Promise<T>, options?: {
|
|
9
|
+
approvalIssuerVerifier?: (issuer: string) => boolean;
|
|
10
|
+
}): Promise<T>;
|
|
11
|
+
export declare function evaluatePolicyRequest(request: PolicyRequest, projectRoot?: string): Promise<PolicyDecision>;
|
|
12
|
+
export declare function setPolicyMode(mode: PolicyState['mode'], projectRoot?: string): Promise<void>;
|
|
13
|
+
export declare function upsertPolicyRule(rule: PolicyRule, projectRoot?: string): Promise<void>;
|
|
14
|
+
export declare function setPolicyBudget(limit: BudgetLimit, projectRoot?: string): Promise<void>;
|
|
15
|
+
export declare function issuePolicyApproval(approval: Omit<PolicyApproval, 'uses' | 'issuedAt'> & {
|
|
16
|
+
uses?: number;
|
|
17
|
+
issuedAt?: number;
|
|
18
|
+
}, projectRoot?: string, approvalIssuerVerifier?: (issuer: string) => boolean): Promise<PolicyApproval>;
|
|
19
|
+
export declare function revokePolicyApproval(id: string, projectRoot?: string): Promise<boolean>;
|
|
20
|
+
export declare function verifyPolicyLedger(projectRoot?: string): Promise<ReturnType<AgenticPolicyEngine['verifyLedger']>>;
|
|
21
|
+
export declare function authorizeMcpTool(toolName: string, input: Record<string, unknown>, context?: Record<string, unknown>, attributes?: Readonly<{
|
|
22
|
+
actionType?: string;
|
|
23
|
+
network?: boolean;
|
|
24
|
+
destructive?: boolean;
|
|
25
|
+
namespaceAccess?: 'read' | 'write';
|
|
26
|
+
envelope?: CapabilityEnvelope;
|
|
27
|
+
costUsd?: number;
|
|
28
|
+
tokens?: number;
|
|
29
|
+
concurrency?: number;
|
|
30
|
+
}>): Promise<PolicyDecision>;
|
|
31
|
+
/** Trusted classification derived from the registered tool name, never input. */
|
|
32
|
+
export declare function classifyMcpTool(toolName: string): {
|
|
33
|
+
actionType: string;
|
|
34
|
+
network: boolean;
|
|
35
|
+
destructive: boolean;
|
|
36
|
+
namespaceAccess?: 'read' | 'write';
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=policy-runtime.d.ts.map
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { AgenticPolicyEngine, createLegacyCompatibleState, } from '@claude-flow/security';
|
|
2
|
+
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { userInfo } from 'node:os';
|
|
7
|
+
const POLICY_DIR = join('.claude-flow', 'policy');
|
|
8
|
+
const POLICY_FILE = 'state.json';
|
|
9
|
+
const LOCK_FILE = 'state.lock';
|
|
10
|
+
const LOCK_STALE_MS = 30_000;
|
|
11
|
+
const LOCK_WAIT_MS = 5_000;
|
|
12
|
+
function paths(projectRoot) {
|
|
13
|
+
const root = resolve(projectRoot);
|
|
14
|
+
const dir = join(root, POLICY_DIR);
|
|
15
|
+
return { dir, state: join(dir, POLICY_FILE), lock: join(dir, LOCK_FILE) };
|
|
16
|
+
}
|
|
17
|
+
function sleep(ms) {
|
|
18
|
+
return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
|
|
19
|
+
}
|
|
20
|
+
async function acquireLock(lockPath) {
|
|
21
|
+
const started = Date.now();
|
|
22
|
+
while (Date.now() - started < LOCK_WAIT_MS) {
|
|
23
|
+
try {
|
|
24
|
+
const fd = openSync(lockPath, 'wx', 0o600);
|
|
25
|
+
writeFileSync(fd, JSON.stringify({ pid: process.pid, acquiredAt: Date.now() }));
|
|
26
|
+
closeSync(fd);
|
|
27
|
+
return () => {
|
|
28
|
+
try {
|
|
29
|
+
unlinkSync(lockPath);
|
|
30
|
+
}
|
|
31
|
+
catch { /* already released */ }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
try {
|
|
36
|
+
if (Date.now() - statSync(lockPath).mtimeMs > LOCK_STALE_MS)
|
|
37
|
+
unlinkSync(lockPath);
|
|
38
|
+
}
|
|
39
|
+
catch { /* another process changed the lock */ }
|
|
40
|
+
await sleep(10);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw new Error('policy-state-lock-timeout');
|
|
44
|
+
}
|
|
45
|
+
function writeJsonAtomic(file, value) {
|
|
46
|
+
mkdirSync(dirname(file), { recursive: true, mode: 0o700 });
|
|
47
|
+
const temporary = `${file}.${process.pid}.${randomUUID()}.tmp`;
|
|
48
|
+
writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
49
|
+
renameSync(temporary, file);
|
|
50
|
+
}
|
|
51
|
+
function trustPaths(projectRoot) {
|
|
52
|
+
const trustRoot = join(userInfo().homedir, '.config', 'ruflo', 'policy-trust');
|
|
53
|
+
const projectId = createHash('sha256').update(realpathSync(projectRoot)).digest('hex');
|
|
54
|
+
const dir = join(trustRoot, projectId);
|
|
55
|
+
return { key: join(dir, 'anchor.key'), anchor: join(dir, 'state.anchor.json') };
|
|
56
|
+
}
|
|
57
|
+
function trustKey(projectRoot, create) {
|
|
58
|
+
const { key } = trustPaths(projectRoot);
|
|
59
|
+
if (!existsSync(key)) {
|
|
60
|
+
if (!create)
|
|
61
|
+
return undefined;
|
|
62
|
+
mkdirSync(dirname(key), { recursive: true, mode: 0o700 });
|
|
63
|
+
writeFileSync(key, randomBytes(32), { mode: 0o600, flag: 'wx' });
|
|
64
|
+
}
|
|
65
|
+
const material = readFileSync(key);
|
|
66
|
+
if (material.length !== 32)
|
|
67
|
+
throw new Error('invalid-policy-trust-key');
|
|
68
|
+
return material;
|
|
69
|
+
}
|
|
70
|
+
function stateAuthentication(state, key) {
|
|
71
|
+
return createHmac('sha256', key).update(JSON.stringify(state)).digest('hex');
|
|
72
|
+
}
|
|
73
|
+
function verifyStateAnchor(projectRoot, state) {
|
|
74
|
+
const { anchor } = trustPaths(projectRoot);
|
|
75
|
+
if (!existsSync(anchor))
|
|
76
|
+
return;
|
|
77
|
+
if (!state)
|
|
78
|
+
throw new Error('policy-state-missing-for-anchored-project');
|
|
79
|
+
const key = trustKey(projectRoot, false);
|
|
80
|
+
if (!key)
|
|
81
|
+
throw new Error('policy-trust-key-missing');
|
|
82
|
+
const record = JSON.parse(readFileSync(anchor, 'utf8'));
|
|
83
|
+
const expected = stateAuthentication(state, key);
|
|
84
|
+
const actual = record.authentication ?? '';
|
|
85
|
+
if (!/^[a-f0-9]{64}$/.test(actual)
|
|
86
|
+
|| !timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(actual, 'hex'))) {
|
|
87
|
+
throw new Error('policy-state-authentication-failed');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function writePolicyState(projectRoot, statePath, state) {
|
|
91
|
+
const anchorPath = trustPaths(projectRoot).anchor;
|
|
92
|
+
if (state.mode === 'enforce' || existsSync(anchorPath)) {
|
|
93
|
+
const key = trustKey(projectRoot, true);
|
|
94
|
+
const anchor = {
|
|
95
|
+
version: 1,
|
|
96
|
+
projectRoot: realpathSync(projectRoot),
|
|
97
|
+
mode: state.mode,
|
|
98
|
+
authentication: stateAuthentication(state, key),
|
|
99
|
+
updatedAt: Date.now(),
|
|
100
|
+
};
|
|
101
|
+
// On first enforcement, establish the external trust record first. A
|
|
102
|
+
// crash then leaves either a valid pair or an anchored mismatch that
|
|
103
|
+
// fails closed; it can never leave enforce state silently unanchored.
|
|
104
|
+
if (!existsSync(anchorPath)) {
|
|
105
|
+
writeJsonAtomic(anchorPath, anchor);
|
|
106
|
+
writeJsonAtomic(statePath, state);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
writeJsonAtomic(statePath, state);
|
|
110
|
+
writeJsonAtomic(anchorPath, anchor);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
writeJsonAtomic(statePath, state);
|
|
114
|
+
}
|
|
115
|
+
function detectLegacyCapabilities(projectRoot) {
|
|
116
|
+
const candidates = [
|
|
117
|
+
'.swarm/memory.db',
|
|
118
|
+
'.claude-flow/memory.db',
|
|
119
|
+
'.claude-flow/data/memory.db',
|
|
120
|
+
'agentdb.rvf',
|
|
121
|
+
'agentdb-memory.db',
|
|
122
|
+
];
|
|
123
|
+
const found = candidates.filter((candidate) => existsSync(join(projectRoot, candidate)));
|
|
124
|
+
const flags = [
|
|
125
|
+
process.env.CLAUDE_FLOW_STRICT_AUTH === 'true' ? 'strict-auth' : null,
|
|
126
|
+
process.env.CLAUDE_FLOW_STRICT_MEMORY === 'true' ? 'strict-memory' : null,
|
|
127
|
+
].filter(Boolean);
|
|
128
|
+
return `pre-ADR-324; capabilities=${[...found, ...flags].join(',') || 'none-detected'}`;
|
|
129
|
+
}
|
|
130
|
+
function configuredPolicyMode(projectRoot) {
|
|
131
|
+
let configured;
|
|
132
|
+
for (const relative of ['.agents/config.toml', '.codex/config.toml']) {
|
|
133
|
+
const file = join(resolve(projectRoot), relative);
|
|
134
|
+
if (!existsSync(file))
|
|
135
|
+
continue;
|
|
136
|
+
const content = readFileSync(file, 'utf8');
|
|
137
|
+
const section = content.match(/(?:^|\n)\[policy\]\s*\n([\s\S]*?)(?=\n\[[^\]]+\]|\s*$)/)?.[1];
|
|
138
|
+
const mode = section?.match(/(?:^|\n)\s*mode\s*=\s*"(legacy|observe|enforce)"/)?.[1];
|
|
139
|
+
if (mode)
|
|
140
|
+
configured = mode;
|
|
141
|
+
}
|
|
142
|
+
return configured;
|
|
143
|
+
}
|
|
144
|
+
export function loadPolicyState(projectRoot = process.cwd()) {
|
|
145
|
+
const target = paths(projectRoot);
|
|
146
|
+
if (!existsSync(target.state)) {
|
|
147
|
+
verifyStateAnchor(projectRoot, undefined);
|
|
148
|
+
return createLegacyCompatibleState(detectLegacyCapabilities(projectRoot));
|
|
149
|
+
}
|
|
150
|
+
const parsed = JSON.parse(readFileSync(target.state, 'utf8'));
|
|
151
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.rules) || !Array.isArray(parsed.receipts)) {
|
|
152
|
+
throw new Error(`unsupported-policy-state-version:${String(parsed.version)}`);
|
|
153
|
+
}
|
|
154
|
+
verifyStateAnchor(projectRoot, parsed);
|
|
155
|
+
return parsed;
|
|
156
|
+
}
|
|
157
|
+
export async function autoMigratePolicyStateIfNeeded(projectRoot = process.cwd()) {
|
|
158
|
+
const target = paths(projectRoot);
|
|
159
|
+
if (existsSync(target.state)) {
|
|
160
|
+
const configured = configuredPolicyMode(projectRoot);
|
|
161
|
+
const current = loadPolicyState(projectRoot);
|
|
162
|
+
if (configured && current.configuredMode !== configured) {
|
|
163
|
+
await withPolicyTransaction(projectRoot, (engine) => engine.setConfiguredMode(configured));
|
|
164
|
+
}
|
|
165
|
+
return { migrated: false, statePath: target.state, mode: loadPolicyState(projectRoot).mode };
|
|
166
|
+
}
|
|
167
|
+
// Only upgrade existing Ruflo installations. A random directory should not
|
|
168
|
+
// acquire policy state merely because `ruflo --version` ran there.
|
|
169
|
+
if (!existsSync(join(resolve(projectRoot), '.claude-flow'))
|
|
170
|
+
&& !existsSync(join(resolve(projectRoot), '.swarm')))
|
|
171
|
+
return { migrated: false };
|
|
172
|
+
mkdirSync(target.dir, { recursive: true, mode: 0o700 });
|
|
173
|
+
const release = await acquireLock(target.lock);
|
|
174
|
+
try {
|
|
175
|
+
if (!existsSync(target.state)) {
|
|
176
|
+
const state = createLegacyCompatibleState(detectLegacyCapabilities(projectRoot));
|
|
177
|
+
const configured = configuredPolicyMode(projectRoot);
|
|
178
|
+
if (configured) {
|
|
179
|
+
state.mode = configured;
|
|
180
|
+
state.configuredMode = configured;
|
|
181
|
+
}
|
|
182
|
+
writePolicyState(projectRoot, target.state, state);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
release();
|
|
187
|
+
}
|
|
188
|
+
return { migrated: true, statePath: target.state, mode: loadPolicyState(projectRoot).mode };
|
|
189
|
+
}
|
|
190
|
+
export async function withPolicyTransaction(projectRoot, operation, options = {}) {
|
|
191
|
+
const target = paths(projectRoot);
|
|
192
|
+
mkdirSync(target.dir, { recursive: true, mode: 0o700 });
|
|
193
|
+
const release = await acquireLock(target.lock);
|
|
194
|
+
try {
|
|
195
|
+
const engine = AgenticPolicyEngine.fromState(loadPolicyState(projectRoot), {
|
|
196
|
+
signingKey: process.env.CLAUDE_FLOW_POLICY_SIGNING_KEY,
|
|
197
|
+
keyId: process.env.CLAUDE_FLOW_POLICY_KEY_ID,
|
|
198
|
+
evidenceVerifier: verifyPolicyEvidence,
|
|
199
|
+
approvalIssuerVerifier: options.approvalIssuerVerifier,
|
|
200
|
+
});
|
|
201
|
+
const result = await operation(engine);
|
|
202
|
+
const nextState = engine.exportState();
|
|
203
|
+
if (!engine.verifyLedger().valid)
|
|
204
|
+
throw new Error('policy-ledger-verification-failed');
|
|
205
|
+
writePolicyState(projectRoot, target.state, nextState);
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
release();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function verifyPolicyEvidence(evidence) {
|
|
213
|
+
if (!evidence.keyId || !evidence.contentHash || !evidence.signature)
|
|
214
|
+
return false;
|
|
215
|
+
let keys;
|
|
216
|
+
try {
|
|
217
|
+
keys = JSON.parse(process.env.CLAUDE_FLOW_POLICY_EVIDENCE_KEYS ?? '{}');
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
const key = keys[evidence.keyId];
|
|
223
|
+
if (!key || key.length < 16 || !/^sha256:[a-f0-9]{64}$/i.test(evidence.contentHash))
|
|
224
|
+
return false;
|
|
225
|
+
const signedClaims = JSON.stringify({
|
|
226
|
+
id: evidence.id,
|
|
227
|
+
provenance: evidence.provenance,
|
|
228
|
+
attestor: evidence.attestor,
|
|
229
|
+
observedAt: evidence.observedAt,
|
|
230
|
+
contentHash: evidence.contentHash,
|
|
231
|
+
keyId: evidence.keyId,
|
|
232
|
+
});
|
|
233
|
+
const expected = createHmac('sha256', key).update(signedClaims).digest('hex');
|
|
234
|
+
const provided = evidence.signature.replace(/^hmac-sha256:/, '');
|
|
235
|
+
if (!/^[a-f0-9]{64}$/i.test(provided))
|
|
236
|
+
return false;
|
|
237
|
+
return timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(provided, 'hex'));
|
|
238
|
+
}
|
|
239
|
+
export async function evaluatePolicyRequest(request, projectRoot = process.cwd()) {
|
|
240
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.evaluate(request));
|
|
241
|
+
}
|
|
242
|
+
export async function setPolicyMode(mode, projectRoot = process.cwd()) {
|
|
243
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.setMode(mode));
|
|
244
|
+
}
|
|
245
|
+
export async function upsertPolicyRule(rule, projectRoot = process.cwd()) {
|
|
246
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.upsertRule(rule));
|
|
247
|
+
}
|
|
248
|
+
export async function setPolicyBudget(limit, projectRoot = process.cwd()) {
|
|
249
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.setBudget(limit));
|
|
250
|
+
}
|
|
251
|
+
export async function issuePolicyApproval(approval, projectRoot = process.cwd(), approvalIssuerVerifier) {
|
|
252
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.issueApproval(approval), { approvalIssuerVerifier });
|
|
253
|
+
}
|
|
254
|
+
export async function revokePolicyApproval(id, projectRoot = process.cwd()) {
|
|
255
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.revokeApproval(id));
|
|
256
|
+
}
|
|
257
|
+
export async function verifyPolicyLedger(projectRoot = process.cwd()) {
|
|
258
|
+
return withPolicyTransaction(projectRoot, (engine) => engine.verifyLedger());
|
|
259
|
+
}
|
|
260
|
+
export async function authorizeMcpTool(toolName, input, context = {}, attributes = {}) {
|
|
261
|
+
let projectRoot = typeof context.projectRoot === 'string' ? context.projectRoot : process.cwd();
|
|
262
|
+
let processEnvelope;
|
|
263
|
+
if (process.env.CLAUDE_FLOW_CAPABILITY_ENVELOPE) {
|
|
264
|
+
try {
|
|
265
|
+
const parsed = JSON.parse(process.env.CLAUDE_FLOW_CAPABILITY_ENVELOPE);
|
|
266
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
267
|
+
throw new Error('not an object');
|
|
268
|
+
}
|
|
269
|
+
processEnvelope = parsed;
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
throw new Error('invalid-worker-capability-envelope');
|
|
273
|
+
}
|
|
274
|
+
// Linked git worktrees share one immutable common git directory. Derive
|
|
275
|
+
// the coordinator checkout from that directory so a worker cannot fall
|
|
276
|
+
// back to independent legacy policy state in its isolated worktree.
|
|
277
|
+
try {
|
|
278
|
+
const cwd = realpathSync(process.cwd());
|
|
279
|
+
const common = execFileSync('git', ['-C', cwd, 'rev-parse', '--path-format=absolute', '--git-common-dir'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
280
|
+
projectRoot = dirname(realpathSync(common));
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
throw new Error('authoritative-worker-policy-root-unavailable');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return evaluatePolicyRequest({
|
|
287
|
+
identity: {
|
|
288
|
+
id: process.env.CLAUDE_FLOW_PRINCIPAL_ID ?? 'legacy-cli',
|
|
289
|
+
type: process.env.CLAUDE_FLOW_PRINCIPAL_ID ? 'agent' : 'legacy',
|
|
290
|
+
},
|
|
291
|
+
action: {
|
|
292
|
+
type: attributes.actionType ?? 'mcp.tool.call',
|
|
293
|
+
resource: toolName,
|
|
294
|
+
tool: toolName,
|
|
295
|
+
server: typeof context.serverId === 'string' ? context.serverId : 'ruflo',
|
|
296
|
+
namespace: typeof input.namespace === 'string' ? input.namespace : undefined,
|
|
297
|
+
environment: typeof context.environment === 'string' ? context.environment : undefined,
|
|
298
|
+
costUsd: attributes.costUsd,
|
|
299
|
+
tokens: attributes.tokens,
|
|
300
|
+
concurrency: attributes.concurrency,
|
|
301
|
+
network: attributes.network === true,
|
|
302
|
+
destructive: attributes.destructive === true,
|
|
303
|
+
},
|
|
304
|
+
context: {
|
|
305
|
+
envelope: attributes.envelope ?? processEnvelope,
|
|
306
|
+
approvalIds: Array.isArray(context.approvalIds) ? context.approvalIds.map(String) : undefined,
|
|
307
|
+
evidence: Array.isArray(context.evidence) ? context.evidence : undefined,
|
|
308
|
+
metadata: {
|
|
309
|
+
inputDigest: `sha256:${createHash('sha256').update(JSON.stringify(input)).digest('hex')}`,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
}, projectRoot);
|
|
313
|
+
}
|
|
314
|
+
/** Trusted classification derived from the registered tool name, never input. */
|
|
315
|
+
export function classifyMcpTool(toolName) {
|
|
316
|
+
const normalized = toolName.toLowerCase();
|
|
317
|
+
const policyAdmin = normalized.startsWith('policy_')
|
|
318
|
+
&& !['policy_evaluate', 'policy_status'].includes(normalized);
|
|
319
|
+
const memoryRead = /^(?:memory|agentdb)_(?:pattern-)?(?:search|query|get|retrieve|list|status|stats)/.test(normalized);
|
|
320
|
+
const memoryWrite = /^(?:memory|agentdb)_(?:pattern-)?(?:store|insert|update|delete|clear|purge|init)/.test(normalized);
|
|
321
|
+
const terminal = /^(?:terminal_execute|bash|shell|exec)/.test(normalized);
|
|
322
|
+
const destructive = policyAdmin
|
|
323
|
+
|| terminal
|
|
324
|
+
|| /(delete|remove|clear|purge|revoke|promote|deploy|integrate|cleanup|terminate|stop)/.test(normalized);
|
|
325
|
+
const network = terminal
|
|
326
|
+
|| /(github|browser|web_|http_|fetch|managed_agent|federation|ipfs|openrouter|provider)/.test(normalized);
|
|
327
|
+
return {
|
|
328
|
+
actionType: policyAdmin
|
|
329
|
+
? `policy.admin.${normalized.slice('policy_'.length)}`
|
|
330
|
+
: memoryRead
|
|
331
|
+
? 'memory.read'
|
|
332
|
+
: memoryWrite
|
|
333
|
+
? 'memory.write'
|
|
334
|
+
: 'mcp.tool.call',
|
|
335
|
+
network,
|
|
336
|
+
destructive,
|
|
337
|
+
namespaceAccess: memoryRead ? 'read' : memoryWrite ? 'write' : undefined,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=policy-runtime.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory-management
|
|
3
|
+
description: >
|
|
4
|
+
AgentDB memory system with HNSW vector search.
|
|
5
|
+
Use when: need to store patterns, search for solutions, semantic lookup.
|
|
6
|
+
Skip when: no learning needed, ephemeral tasks.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Memory Management Skill
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
AgentDB memory system with HNSW vector search.
|
|
13
|
+
|
|
14
|
+
## When to Trigger
|
|
15
|
+
- need to store patterns
|
|
16
|
+
- search for solutions
|
|
17
|
+
- semantic lookup
|
|
18
|
+
|
|
19
|
+
## When to Skip
|
|
20
|
+
- no learning needed
|
|
21
|
+
- ephemeral tasks
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### Store Data
|
|
26
|
+
Store a pattern in memory
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx @claude-flow/cli memory store --key "key" --value "value" --namespace patterns
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Search Data
|
|
33
|
+
Semantic search in memory
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx @claude-flow/cli memory search --query "search terms" --limit 10
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Best Practices
|
|
42
|
+
1. Check memory for existing patterns before starting
|
|
43
|
+
2. Use hierarchical topology for coordination
|
|
44
|
+
3. Store successful patterns after completion
|
|
45
|
+
4. Document any new learnings
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-audit
|
|
3
|
+
description: >
|
|
4
|
+
Security scanning and vulnerability detection.
|
|
5
|
+
Use when: authentication, authorization, payment processing, user data.
|
|
6
|
+
Skip when: read-only operations, internal tooling.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Security Audit Skill
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
Security scanning and vulnerability detection.
|
|
13
|
+
|
|
14
|
+
## When to Trigger
|
|
15
|
+
- authentication
|
|
16
|
+
- authorization
|
|
17
|
+
- payment processing
|
|
18
|
+
- user data
|
|
19
|
+
|
|
20
|
+
## When to Skip
|
|
21
|
+
- read-only operations
|
|
22
|
+
- internal tooling
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
### Full Security Scan
|
|
27
|
+
Run comprehensive security analysis
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx @claude-flow/cli security scan --depth full
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Input Validation Check
|
|
34
|
+
Check for input validation issues
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx @claude-flow/cli security scan --check input-validation
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Best Practices
|
|
43
|
+
1. Check memory for existing patterns before starting
|
|
44
|
+
2. Use hierarchical topology for coordination
|
|
45
|
+
3. Store successful patterns after completion
|
|
46
|
+
4. Document any new learnings
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sparc-methodology
|
|
3
|
+
description: >
|
|
4
|
+
SPARC development workflow (Specification, Pseudocode, Architecture, Refinement, Completion).
|
|
5
|
+
Use when: new features, complex implementations, architectural changes.
|
|
6
|
+
Skip when: simple fixes, documentation, configuration.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Sparc Methodology Skill
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
SPARC development workflow (Specification, Pseudocode, Architecture, Refinement, Completion).
|
|
13
|
+
|
|
14
|
+
## When to Trigger
|
|
15
|
+
- new features
|
|
16
|
+
- complex implementations
|
|
17
|
+
- architectural changes
|
|
18
|
+
|
|
19
|
+
## When to Skip
|
|
20
|
+
- simple fixes
|
|
21
|
+
- documentation
|
|
22
|
+
- configuration
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
### Specification Phase
|
|
27
|
+
Define requirements and acceptance criteria
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx @claude-flow/cli hooks route --task "specification: [requirements]"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Architecture Phase
|
|
34
|
+
Design system structure
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx @claude-flow/cli hooks route --task "architecture: [design]"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Best Practices
|
|
43
|
+
1. Check memory for existing patterns before starting
|
|
44
|
+
2. Use hierarchical topology for coordination
|
|
45
|
+
3. Store successful patterns after completion
|
|
46
|
+
4. Document any new learnings
|