@winspan/claude-forge 9.2.0 → 9.12.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.
- package/DEVELOPMENT.md +80 -19
- package/README.md +13 -6
- package/dist/catalogs/agents.json +19 -24
- package/dist/catalogs/skills.json +139 -27
- package/dist/claudemd/templates/swarm-protocol.md +1 -1
- package/dist/cli/commands/agent.d.ts +169 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +690 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/codegraph.d.ts +17 -0
- package/dist/cli/commands/codegraph.d.ts.map +1 -0
- package/dist/cli/commands/codegraph.js +263 -0
- package/dist/cli/commands/codegraph.js.map +1 -0
- package/dist/cli/commands/decisions.d.ts.map +1 -1
- package/dist/cli/commands/decisions.js +46 -9
- package/dist/cli/commands/decisions.js.map +1 -1
- package/dist/cli/commands/executions.d.ts.map +1 -1
- package/dist/cli/commands/executions.js +2 -1
- package/dist/cli/commands/executions.js.map +1 -1
- package/dist/cli/commands/insights-goal-check.d.ts +5 -1
- package/dist/cli/commands/insights-goal-check.d.ts.map +1 -1
- package/dist/cli/commands/insights-goal-check.js +15 -15
- package/dist/cli/commands/insights-goal-check.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts +51 -0
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +202 -29
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/loop.d.ts +95 -0
- package/dist/cli/commands/loop.d.ts.map +1 -0
- package/dist/cli/commands/loop.js +408 -0
- package/dist/cli/commands/loop.js.map +1 -0
- package/dist/cli/commands/maintenance.d.ts +33 -0
- package/dist/cli/commands/maintenance.d.ts.map +1 -0
- package/dist/cli/commands/maintenance.js +75 -0
- package/dist/cli/commands/maintenance.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +23 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +82 -0
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/skills.d.ts +131 -0
- package/dist/cli/commands/skills.d.ts.map +1 -1
- package/dist/cli/commands/skills.js +409 -9
- package/dist/cli/commands/skills.js.map +1 -1
- package/dist/cli/commands/stats.d.ts.map +1 -1
- package/dist/cli/commands/stats.js +9 -2
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/constants.d.ts +37 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +43 -0
- package/dist/core/constants.js.map +1 -1
- package/dist/core/diagnostics/checks.d.ts.map +1 -1
- package/dist/core/diagnostics/checks.js +2 -1
- package/dist/core/diagnostics/checks.js.map +1 -1
- package/dist/core/diagnostics/daemon-status.d.ts +1 -1
- package/dist/core/diagnostics/daemon-status.d.ts.map +1 -1
- package/dist/core/diagnostics/daemon-status.js +1 -1
- package/dist/core/diagnostics/daemon-status.js.map +1 -1
- package/dist/core/diagnostics/entropy-checks.d.ts +3 -2
- package/dist/core/diagnostics/entropy-checks.d.ts.map +1 -1
- package/dist/core/diagnostics/entropy-checks.js +10 -5
- package/dist/core/diagnostics/entropy-checks.js.map +1 -1
- package/dist/core/diagnostics/heartbeat-reader.d.ts +28 -0
- package/dist/core/diagnostics/heartbeat-reader.d.ts.map +1 -0
- package/dist/core/diagnostics/heartbeat-reader.js +50 -0
- package/dist/core/diagnostics/heartbeat-reader.js.map +1 -0
- package/dist/core/event-fields.d.ts +27 -0
- package/dist/core/event-fields.d.ts.map +1 -1
- package/dist/core/event-fields.js +43 -0
- package/dist/core/event-fields.js.map +1 -1
- package/dist/core/governance/global-inject.d.ts +34 -4
- package/dist/core/governance/global-inject.d.ts.map +1 -1
- package/dist/core/governance/global-inject.js +80 -25
- package/dist/core/governance/global-inject.js.map +1 -1
- package/dist/core/insights/agent-anchor-guard.d.ts +77 -0
- package/dist/core/insights/agent-anchor-guard.d.ts.map +1 -0
- package/dist/core/insights/agent-anchor-guard.js +119 -0
- package/dist/core/insights/agent-anchor-guard.js.map +1 -0
- package/dist/core/insights/agent-distill-context.d.ts +55 -0
- package/dist/core/insights/agent-distill-context.d.ts.map +1 -0
- package/dist/core/insights/agent-distill-context.js +146 -0
- package/dist/core/insights/agent-distill-context.js.map +1 -0
- package/dist/core/insights/agent-distill-spawn.d.ts +56 -0
- package/dist/core/insights/agent-distill-spawn.d.ts.map +1 -0
- package/dist/core/insights/agent-distill-spawn.js +179 -0
- package/dist/core/insights/agent-distill-spawn.js.map +1 -0
- package/dist/core/insights/agent-drift.d.ts +66 -0
- package/dist/core/insights/agent-drift.d.ts.map +1 -0
- package/dist/core/insights/agent-drift.js +109 -0
- package/dist/core/insights/agent-drift.js.map +1 -0
- package/dist/core/insights/agent-evolution-sources.d.ts +21 -0
- package/dist/core/insights/agent-evolution-sources.d.ts.map +1 -0
- package/dist/core/insights/agent-evolution-sources.js +36 -0
- package/dist/core/insights/agent-evolution-sources.js.map +1 -0
- package/dist/core/insights/agent-health.d.ts +142 -0
- package/dist/core/insights/agent-health.d.ts.map +1 -0
- package/dist/core/insights/agent-health.js +296 -0
- package/dist/core/insights/agent-health.js.map +1 -0
- package/dist/core/insights/agent-patch-apply.d.ts +45 -0
- package/dist/core/insights/agent-patch-apply.d.ts.map +1 -0
- package/dist/core/insights/agent-patch-apply.js +165 -0
- package/dist/core/insights/agent-patch-apply.js.map +1 -0
- package/dist/core/insights/agent-suggest.d.ts +128 -0
- package/dist/core/insights/agent-suggest.d.ts.map +1 -0
- package/dist/core/insights/agent-suggest.js +284 -0
- package/dist/core/insights/agent-suggest.js.map +1 -0
- package/dist/core/insights/coverage-tiers.d.ts +46 -0
- package/dist/core/insights/coverage-tiers.d.ts.map +1 -0
- package/dist/core/insights/coverage-tiers.js +95 -0
- package/dist/core/insights/coverage-tiers.js.map +1 -0
- package/dist/{daemon/services → core/insights}/experience-extractor.d.ts +0 -7
- package/dist/core/insights/experience-extractor.d.ts.map +1 -0
- package/dist/{daemon/services → core/insights}/experience-extractor.js +5 -9
- package/dist/core/insights/experience-extractor.js.map +1 -0
- package/dist/{daemon/services → core/insights}/violation-reporter.d.ts +20 -1
- package/dist/core/insights/violation-reporter.d.ts.map +1 -0
- package/dist/{daemon/services → core/insights}/violation-reporter.js +56 -4
- package/dist/core/insights/violation-reporter.js.map +1 -0
- package/dist/core/loop/loop-engine.d.ts +140 -0
- package/dist/core/loop/loop-engine.d.ts.map +1 -0
- package/dist/core/loop/loop-engine.js +266 -0
- package/dist/core/loop/loop-engine.js.map +1 -0
- package/dist/core/queue/index.d.ts.map +1 -1
- package/dist/core/queue/index.js +2 -1
- package/dist/core/queue/index.js.map +1 -1
- package/dist/core/storage/base.d.ts +159 -0
- package/dist/core/storage/base.d.ts.map +1 -1
- package/dist/core/storage/base.js +523 -0
- package/dist/core/storage/base.js.map +1 -1
- package/dist/core/storage/codegraph-types.d.ts +79 -0
- package/dist/core/storage/codegraph-types.d.ts.map +1 -0
- package/dist/core/storage/codegraph-types.js +14 -0
- package/dist/core/storage/codegraph-types.js.map +1 -0
- package/dist/core/storage/codegraph.d.ts +186 -0
- package/dist/core/storage/codegraph.d.ts.map +1 -0
- package/dist/core/storage/codegraph.js +452 -0
- package/dist/core/storage/codegraph.js.map +1 -0
- package/dist/core/storage/decisions.d.ts +30 -5
- package/dist/core/storage/decisions.d.ts.map +1 -1
- package/dist/core/storage/decisions.js +45 -13
- package/dist/core/storage/decisions.js.map +1 -1
- package/dist/core/storage/events.d.ts +127 -0
- package/dist/core/storage/events.d.ts.map +1 -1
- package/dist/core/storage/events.js +318 -3
- package/dist/core/storage/events.js.map +1 -1
- package/dist/core/storage/feedback.d.ts +3 -23
- package/dist/core/storage/feedback.d.ts.map +1 -1
- package/dist/core/storage/feedback.js +37 -38
- package/dist/core/storage/feedback.js.map +1 -1
- package/dist/core/storage/injections.d.ts +40 -0
- package/dist/core/storage/injections.d.ts.map +1 -1
- package/dist/core/storage/injections.js +69 -0
- package/dist/core/storage/injections.js.map +1 -1
- package/dist/core/storage/knowledge.d.ts +226 -0
- package/dist/core/storage/knowledge.d.ts.map +1 -1
- package/dist/core/storage/knowledge.js +391 -4
- package/dist/core/storage/knowledge.js.map +1 -1
- package/dist/core/storage/pipeline-rollup.d.ts +1 -7
- package/dist/core/storage/pipeline-rollup.d.ts.map +1 -1
- package/dist/core/storage/pipeline-rollup.js +18 -57
- package/dist/core/storage/pipeline-rollup.js.map +1 -1
- package/dist/core/storage/routing.d.ts +34 -0
- package/dist/core/storage/routing.d.ts.map +1 -1
- package/dist/core/storage/routing.js +92 -2
- package/dist/core/storage/routing.js.map +1 -1
- package/dist/core/storage/rows.d.ts +5 -25
- package/dist/core/storage/rows.d.ts.map +1 -1
- package/dist/core/storage/schema.sql +92 -27
- package/dist/core/storage/sessions.d.ts.map +1 -1
- package/dist/core/storage/sessions.js +2 -1
- package/dist/core/storage/sessions.js.map +1 -1
- package/dist/core/storage/skills.d.ts +159 -0
- package/dist/core/storage/skills.d.ts.map +1 -1
- package/dist/core/storage/skills.js +350 -4
- package/dist/core/storage/skills.js.map +1 -1
- package/dist/core/storage/sqlite.d.ts +81 -25
- package/dist/core/storage/sqlite.d.ts.map +1 -1
- package/dist/core/storage/sqlite.js +143 -45
- package/dist/core/storage/sqlite.js.map +1 -1
- package/dist/core/storage/tasks.d.ts +270 -0
- package/dist/core/storage/tasks.d.ts.map +1 -1
- package/dist/core/storage/tasks.js +495 -16
- package/dist/core/storage/tasks.js.map +1 -1
- package/dist/core/storage/tool-intercepts.d.ts +1 -1
- package/dist/core/storage/tool-intercepts.js +1 -1
- package/dist/core/types.d.ts +26 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +1 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/utils/binary-paths.d.ts +32 -0
- package/dist/core/utils/binary-paths.d.ts.map +1 -1
- package/dist/core/utils/binary-paths.js +52 -0
- package/dist/core/utils/binary-paths.js.map +1 -1
- package/dist/core/utils/claude-cli-resolver.d.ts.map +1 -0
- package/dist/{skills/distill → core/utils}/claude-cli-resolver.js +1 -1
- package/dist/core/utils/claude-cli-resolver.js.map +1 -0
- package/dist/core/utils/claude-cli-spawn.d.ts +1 -1
- package/dist/core/utils/claude-cli-spawn.js +2 -2
- package/dist/core/utils/claude-cli-spawn.js.map +1 -1
- package/dist/core/utils/noise-prompt.d.ts +1 -1
- package/dist/core/utils/noise-prompt.js +1 -1
- package/dist/core/utils/time.d.ts +26 -0
- package/dist/core/utils/time.d.ts.map +1 -1
- package/dist/core/utils/time.js +33 -0
- package/dist/core/utils/time.js.map +1 -1
- package/dist/daemon/config-store.d.ts.map +1 -1
- package/dist/daemon/config-store.js +14 -5
- package/dist/daemon/config-store.js.map +1 -1
- package/dist/daemon/event-parser.d.ts.map +1 -1
- package/dist/daemon/event-parser.js +5 -0
- package/dist/daemon/event-parser.js.map +1 -1
- package/dist/daemon/handlers/post-tool-use.d.ts +24 -16
- package/dist/daemon/handlers/post-tool-use.d.ts.map +1 -1
- package/dist/daemon/handlers/post-tool-use.js +76 -116
- package/dist/daemon/handlers/post-tool-use.js.map +1 -1
- package/dist/daemon/handlers/pre-tool-use.d.ts +35 -10
- package/dist/daemon/handlers/pre-tool-use.d.ts.map +1 -1
- package/dist/daemon/handlers/pre-tool-use.js +71 -38
- package/dist/daemon/handlers/pre-tool-use.js.map +1 -1
- package/dist/daemon/handlers/stop.d.ts +20 -0
- package/dist/daemon/handlers/stop.d.ts.map +1 -1
- package/dist/daemon/handlers/stop.js +96 -8
- package/dist/daemon/handlers/stop.js.map +1 -1
- package/dist/daemon/handlers/user-prompt.d.ts +16 -1
- package/dist/daemon/handlers/user-prompt.d.ts.map +1 -1
- package/dist/daemon/handlers/user-prompt.js +97 -56
- package/dist/daemon/handlers/user-prompt.js.map +1 -1
- package/dist/daemon/handlers/violation-content-backfill.d.ts +76 -0
- package/dist/daemon/handlers/violation-content-backfill.d.ts.map +1 -0
- package/dist/daemon/handlers/violation-content-backfill.js +167 -0
- package/dist/daemon/handlers/violation-content-backfill.js.map +1 -0
- package/dist/daemon/index.d.ts +19 -0
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +125 -200
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/rules/defaults.d.ts.map +1 -1
- package/dist/daemon/rules/defaults.js +151 -64
- package/dist/daemon/rules/defaults.js.map +1 -1
- package/dist/daemon/rules/types.d.ts +28 -22
- package/dist/daemon/rules/types.d.ts.map +1 -1
- package/dist/daemon/rules/workflow-defaults.js +9 -9
- package/dist/daemon/rules/workflow-defaults.js.map +1 -1
- package/dist/daemon/services/codegraph-sync.d.ts +94 -0
- package/dist/daemon/services/codegraph-sync.d.ts.map +1 -0
- package/dist/daemon/services/codegraph-sync.js +159 -0
- package/dist/daemon/services/codegraph-sync.js.map +1 -0
- package/dist/daemon/services/decision-hint.d.ts +47 -10
- package/dist/daemon/services/decision-hint.d.ts.map +1 -1
- package/dist/daemon/services/decision-hint.js +99 -24
- package/dist/daemon/services/decision-hint.js.map +1 -1
- package/dist/daemon/services/event-ttl-sweep.d.ts.map +1 -1
- package/dist/daemon/services/event-ttl-sweep.js +3 -2
- package/dist/daemon/services/event-ttl-sweep.js.map +1 -1
- package/dist/daemon/services/feedback-aggregator.d.ts +14 -26
- package/dist/daemon/services/feedback-aggregator.d.ts.map +1 -1
- package/dist/daemon/services/feedback-aggregator.js +23 -63
- package/dist/daemon/services/feedback-aggregator.js.map +1 -1
- package/dist/daemon/services/heartbeat-writer.d.ts +6 -15
- package/dist/daemon/services/heartbeat-writer.d.ts.map +1 -1
- package/dist/daemon/services/heartbeat-writer.js +7 -36
- package/dist/daemon/services/heartbeat-writer.js.map +1 -1
- package/dist/daemon/services/kb-injector.d.ts +1 -1
- package/dist/daemon/services/kb-injector.d.ts.map +1 -1
- package/dist/daemon/services/kb-injector.js +10 -2
- package/dist/daemon/services/kb-injector.js.map +1 -1
- package/dist/daemon/services/kb-rebuild-scheduler.d.ts +95 -0
- package/dist/daemon/services/kb-rebuild-scheduler.d.ts.map +1 -0
- package/dist/daemon/services/kb-rebuild-scheduler.js +149 -0
- package/dist/daemon/services/kb-rebuild-scheduler.js.map +1 -0
- package/dist/daemon/services/loop-hint.d.ts +139 -0
- package/dist/daemon/services/loop-hint.d.ts.map +1 -0
- package/dist/daemon/services/loop-hint.js +272 -0
- package/dist/daemon/services/loop-hint.js.map +1 -0
- package/dist/daemon/services/outcome-classification-service.js +1 -1
- package/dist/daemon/services/outcome-classification-service.js.map +1 -1
- package/dist/daemon/services/task-segmenter.d.ts +11 -0
- package/dist/daemon/services/task-segmenter.d.ts.map +1 -1
- package/dist/daemon/services/task-segmenter.js +48 -2
- package/dist/daemon/services/task-segmenter.js.map +1 -1
- package/dist/daemon/startup/maintenance-schedulers.d.ts +68 -0
- package/dist/daemon/startup/maintenance-schedulers.d.ts.map +1 -0
- package/dist/daemon/startup/maintenance-schedulers.js +294 -0
- package/dist/daemon/startup/maintenance-schedulers.js.map +1 -0
- package/dist/daemon/templates/agents/agent-retro-distiller.md +106 -0
- package/dist/daemon/templates/agents/claudemd-writer.md +1 -0
- package/dist/daemon/templates/agents/coder.md +165 -8
- package/dist/daemon/templates/agents/decision-maker.md +107 -21
- package/dist/daemon/templates/agents/doc-reviewer.md +4 -1
- package/dist/daemon/templates/agents/harness-debug-full.md +85 -3
- package/dist/daemon/templates/agents/knowledge-builder.md +1 -0
- package/dist/daemon/templates/agents/patch-applier.md +1 -0
- package/dist/daemon/templates/agents/planner.md +55 -3
- package/dist/daemon/templates/agents/safety-net-implementer.md +278 -0
- package/dist/daemon/templates/agents/skill-distiller.md +1 -0
- package/dist/daemon/templates/agents/task-boundary-classifier.md +1 -0
- package/dist/daemon/templates/agents/verify-agent.md +128 -5
- package/dist/hooks/stop.sh +7 -1
- package/dist/knowledge/builder.js +36 -7
- package/dist/knowledge/builder.js.map +1 -1
- package/dist/knowledge/constants.d.ts +10 -5
- package/dist/knowledge/constants.d.ts.map +1 -1
- package/dist/knowledge/constants.js +10 -5
- package/dist/knowledge/constants.js.map +1 -1
- package/dist/knowledge/graph/edge-extractor.d.ts +45 -0
- package/dist/knowledge/graph/edge-extractor.d.ts.map +1 -0
- package/dist/knowledge/graph/edge-extractor.js +242 -0
- package/dist/knowledge/graph/edge-extractor.js.map +1 -0
- package/dist/knowledge/graph/impact.d.ts +73 -0
- package/dist/knowledge/graph/impact.d.ts.map +1 -0
- package/dist/knowledge/graph/impact.js +94 -0
- package/dist/knowledge/graph/impact.js.map +1 -0
- package/dist/knowledge/graph/types.d.ts +22 -0
- package/dist/knowledge/graph/types.d.ts.map +1 -0
- package/dist/knowledge/graph/types.js +13 -0
- package/dist/knowledge/graph/types.js.map +1 -0
- package/dist/knowledge/prompt.d.ts +9 -0
- package/dist/knowledge/prompt.d.ts.map +1 -1
- package/dist/knowledge/prompt.js +17 -5
- package/dist/knowledge/prompt.js.map +1 -1
- package/dist/knowledge/query.d.ts +13 -0
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +107 -10
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/repo-map.d.ts +11 -5
- package/dist/knowledge/repo-map.d.ts.map +1 -1
- package/dist/knowledge/repo-map.js +42 -3
- package/dist/knowledge/repo-map.js.map +1 -1
- package/dist/knowledge/validator.d.ts.map +1 -1
- package/dist/knowledge/validator.js +69 -2
- package/dist/knowledge/validator.js.map +1 -1
- package/dist/mcp/server.d.ts +64 -8
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +233 -18
- package/dist/mcp/server.js.map +1 -1
- package/dist/skills/distill/distiller.js +1 -1
- package/dist/skills/distill/distiller.js.map +1 -1
- package/dist/skills/distilled/distilled-api-design.md +4 -0
- package/dist/skills/distilled/distilled-brainstorming.md +79 -0
- package/dist/skills/distilled/distilled-brand-guidelines.md +86 -0
- package/dist/skills/distilled/distilled-canvas-design.md +128 -0
- package/dist/skills/distilled/distilled-claude-api.md +185 -0
- package/dist/skills/distilled/distilled-creator.md +5 -2
- package/dist/skills/distilled/distilled-dispatching-parallel-agents.md +136 -0
- package/dist/skills/distilled/distilled-doc-coauthoring.md +144 -0
- package/dist/skills/distilled/distilled-docx.md +231 -0
- package/dist/skills/distilled/distilled-executing-plans.md +85 -50
- package/dist/skills/distilled/distilled-finishing-a-development-branch.md +213 -0
- package/dist/skills/distilled/distilled-frontend-design.md +118 -0
- package/dist/skills/distilled/distilled-harness-engineering.md +1 -1
- package/dist/skills/distilled/distilled-receiving-code-review.md +185 -0
- package/dist/skills/distilled/distilled-subagent-driven-development.md +124 -0
- package/dist/skills/distilled/distilled-systematic-debugging.md +108 -260
- package/dist/skills/distilled/distilled-test-driven-development.md +432 -0
- package/dist/skills/distilled/distilled-using-superpowers.md +134 -0
- package/dist/skills/distilled/distilled-verification-before-completion.md +88 -78
- package/dist/skills/distilled/distilled-writing-skills.md +175 -0
- package/dist/skills/registry.d.ts +10 -50
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +7 -118
- package/dist/skills/registry.js.map +1 -1
- package/dist/skills/tools/pipeline-suggest.js +2 -2
- package/dist/skills/tools/pipeline-suggest.js.map +1 -1
- package/dist/skills/tools/skill-invoke.d.ts +2 -1
- package/dist/skills/tools/skill-invoke.d.ts.map +1 -1
- package/dist/skills/tools/skill-invoke.js +3 -1
- package/dist/skills/tools/skill-invoke.js.map +1 -1
- package/dist/web/analytics/anti-pattern-detector.d.ts.map +1 -1
- package/dist/web/analytics/anti-pattern-detector.js +6 -1
- package/dist/web/analytics/anti-pattern-detector.js.map +1 -1
- package/dist/web/analytics/drift-detector.d.ts +6 -0
- package/dist/web/analytics/drift-detector.d.ts.map +1 -1
- package/dist/web/analytics/drift-detector.js +15 -8
- package/dist/web/analytics/drift-detector.js.map +1 -1
- package/dist/web/analytics/weekly-report.d.ts +13 -0
- package/dist/web/analytics/weekly-report.d.ts.map +1 -1
- package/dist/web/analytics/weekly-report.js +17 -3
- package/dist/web/analytics/weekly-report.js.map +1 -1
- package/dist/web/routes/_helpers.d.ts +31 -0
- package/dist/web/routes/_helpers.d.ts.map +1 -1
- package/dist/web/routes/_helpers.js +33 -0
- package/dist/web/routes/_helpers.js.map +1 -1
- package/dist/web/routes/agent-distill.d.ts +49 -0
- package/dist/web/routes/agent-distill.d.ts.map +1 -0
- package/dist/web/routes/agent-distill.js +526 -0
- package/dist/web/routes/agent-distill.js.map +1 -0
- package/dist/web/routes/config.d.ts +56 -0
- package/dist/web/routes/config.d.ts.map +1 -0
- package/dist/web/routes/config.js +243 -0
- package/dist/web/routes/config.js.map +1 -0
- package/dist/web/routes/decisions.js +1 -1
- package/dist/web/routes/decisions.js.map +1 -1
- package/dist/web/routes/error-handler.d.ts +0 -4
- package/dist/web/routes/error-handler.d.ts.map +1 -1
- package/dist/web/routes/error-handler.js +0 -8
- package/dist/web/routes/error-handler.js.map +1 -1
- package/dist/web/routes/events.d.ts.map +1 -1
- package/dist/web/routes/events.js +2 -1
- package/dist/web/routes/events.js.map +1 -1
- package/dist/web/routes/insights.d.ts.map +1 -1
- package/dist/web/routes/insights.js +0 -0
- package/dist/web/routes/insights.js.map +1 -1
- package/dist/web/routes/knowledge.d.ts +43 -2
- package/dist/web/routes/knowledge.d.ts.map +1 -1
- package/dist/web/routes/knowledge.js +117 -6
- package/dist/web/routes/knowledge.js.map +1 -1
- package/dist/web/routes/pipeline.d.ts +0 -9
- package/dist/web/routes/pipeline.d.ts.map +1 -1
- package/dist/web/routes/pipeline.js +0 -4
- package/dist/web/routes/pipeline.js.map +1 -1
- package/dist/web/routes/rules.d.ts.map +1 -1
- package/dist/web/routes/rules.js +20 -6
- package/dist/web/routes/rules.js.map +1 -1
- package/dist/web/routes/sessions.d.ts.map +1 -1
- package/dist/web/routes/sessions.js +8 -7
- package/dist/web/routes/sessions.js.map +1 -1
- package/dist/web/routes/skill-stats.d.ts.map +1 -1
- package/dist/web/routes/skill-stats.js +153 -16
- package/dist/web/routes/skill-stats.js.map +1 -1
- package/dist/web/routes/skills-distill.js +1 -1
- package/dist/web/routes/skills-distill.js.map +1 -1
- package/dist/web/routes/stats.d.ts.map +1 -1
- package/dist/web/routes/stats.js +2 -1
- package/dist/web/routes/stats.js.map +1 -1
- package/dist/web/routes/task-timeline.d.ts +95 -19
- package/dist/web/routes/task-timeline.d.ts.map +1 -1
- package/dist/web/routes/task-timeline.js +344 -88
- package/dist/web/routes/task-timeline.js.map +1 -1
- package/dist/web/routes/tasks.d.ts.map +1 -1
- package/dist/web/routes/tasks.js +52 -30
- package/dist/web/routes/tasks.js.map +1 -1
- package/dist/web/routes/violations.d.ts +1 -1
- package/dist/web/routes/violations.d.ts.map +1 -1
- package/dist/web/routes/violations.js +3 -2
- package/dist/web/routes/violations.js.map +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +20 -0
- package/dist/web/server.js.map +1 -1
- package/dist/web/services/agent-distill-manager.d.ts +122 -0
- package/dist/web/services/agent-distill-manager.d.ts.map +1 -0
- package/dist/web/services/agent-distill-manager.js +397 -0
- package/dist/web/services/agent-distill-manager.js.map +1 -0
- package/dist/web/services/distill-manager.d.ts +47 -0
- package/dist/web/services/distill-manager.d.ts.map +1 -1
- package/dist/web/services/distill-manager.js +103 -0
- package/dist/web/services/distill-manager.js.map +1 -1
- package/dist/web/static/assets/AgentDetailPage-DlUeA1sX.js +2 -0
- package/dist/web/static/assets/AgentDetailPage-DlUeA1sX.js.map +1 -0
- package/dist/web/static/assets/AgentDistillRunPage-Cybo4bii.js +3 -0
- package/dist/web/static/assets/AgentDistillRunPage-Cybo4bii.js.map +1 -0
- package/dist/web/static/assets/AgentsPage-Qd9FExLG.js +2 -0
- package/dist/web/static/assets/AgentsPage-Qd9FExLG.js.map +1 -0
- package/dist/web/static/assets/DaemonHealthPage-DTSVqtrI.js +2 -0
- package/dist/web/static/assets/DaemonHealthPage-DTSVqtrI.js.map +1 -0
- package/dist/web/static/assets/DecisionDetailPage-b4BA8dhc.js +2 -0
- package/dist/web/static/assets/DecisionDetailPage-b4BA8dhc.js.map +1 -0
- package/dist/web/static/assets/DecisionsPage-a3NRo_T7.js +2 -0
- package/dist/web/static/assets/DecisionsPage-a3NRo_T7.js.map +1 -0
- package/dist/web/static/assets/DiagnosticsPage-DIVdiIQG.js +2 -0
- package/dist/web/static/assets/DiagnosticsPage-DIVdiIQG.js.map +1 -0
- package/dist/web/static/assets/DistillDetailPage-U6a3l2iP.js +4 -0
- package/dist/web/static/assets/DistillDetailPage-U6a3l2iP.js.map +1 -0
- package/dist/web/static/assets/DistillPage-O7BHtRN8.js +2 -0
- package/dist/web/static/assets/DistillPage-O7BHtRN8.js.map +1 -0
- package/dist/web/static/assets/DistillRunPage-D1JuRWWr.js +2 -0
- package/dist/web/static/assets/DistillRunPage-D1JuRWWr.js.map +1 -0
- package/dist/web/static/assets/GlobalScopeHint-Q3wTJx3F.js +2 -0
- package/dist/web/static/assets/GlobalScopeHint-Q3wTJx3F.js.map +1 -0
- package/dist/web/static/assets/IssueDetailPage-BDfrtk2C.js +2 -0
- package/dist/web/static/assets/IssueDetailPage-BDfrtk2C.js.map +1 -0
- package/dist/web/static/assets/IssuesPage-SKmhlCrw.js +2 -0
- package/dist/web/static/assets/IssuesPage-SKmhlCrw.js.map +1 -0
- package/dist/web/static/assets/KbDetailPage-Yna86Na8.js +2 -0
- package/dist/web/static/assets/KbDetailPage-Yna86Na8.js.map +1 -0
- package/dist/web/static/assets/KbHitsPage-Cljl7H9p.js +2 -0
- package/dist/web/static/assets/KbHitsPage-Cljl7H9p.js.map +1 -0
- package/dist/web/static/assets/{MarkdownRenderer-DZmTl-8J.js → MarkdownRenderer-DlDQNihj.js} +2 -2
- package/dist/web/static/assets/{MarkdownRenderer-DZmTl-8J.js.map → MarkdownRenderer-DlDQNihj.js.map} +1 -1
- package/dist/web/static/assets/NotFound-LMzbP51V.js +2 -0
- package/dist/web/static/assets/{NotFound-BQPh0vaF.js.map → NotFound-LMzbP51V.js.map} +1 -1
- package/dist/web/static/assets/SettingsPage-DzoK4PKg.js +2 -0
- package/dist/web/static/assets/SettingsPage-DzoK4PKg.js.map +1 -0
- package/dist/web/static/assets/SkillDetailPage-BuBJJ_NX.js +2 -0
- package/dist/web/static/assets/SkillDetailPage-BuBJJ_NX.js.map +1 -0
- package/dist/web/static/assets/SkillsPage-aojkJpBc.js +2 -0
- package/dist/web/static/assets/SkillsPage-aojkJpBc.js.map +1 -0
- package/dist/web/static/assets/TaskDetailPage-1ckxnGhw.js +4 -0
- package/dist/web/static/assets/TaskDetailPage-1ckxnGhw.js.map +1 -0
- package/dist/web/static/assets/TasksHubPage-C2PLh3eg.js +6 -0
- package/dist/web/static/assets/TasksHubPage-C2PLh3eg.js.map +1 -0
- package/dist/web/static/assets/WorkplacePage-DHrp5VxS.js +2 -0
- package/dist/web/static/assets/WorkplacePage-DHrp5VxS.js.map +1 -0
- package/dist/web/static/assets/arco-DV6xCLhr.js +14 -0
- package/dist/web/static/assets/arco-DV6xCLhr.js.map +1 -0
- package/dist/web/static/assets/charts-BSV4cyC4.js +37 -0
- package/dist/web/static/assets/charts-BSV4cyC4.js.map +1 -0
- package/dist/web/static/assets/{index-7bl3kbcx.css → index-B_v_MKlb.css} +1 -1
- package/dist/web/static/assets/index-DileOOE4.js +4 -0
- package/dist/web/static/assets/index-DileOOE4.js.map +1 -0
- package/dist/web/static/assets/markdown-CA7ePUts.js +30 -0
- package/dist/web/static/assets/markdown-CA7ePUts.js.map +1 -0
- package/dist/web/static/assets/{outcome-DUn1NjlC.js → outcome-BKGy9azt.js} +2 -2
- package/dist/web/static/assets/{outcome-DUn1NjlC.js.map → outcome-BKGy9azt.js.map} +1 -1
- package/dist/web/static/assets/{query-S6X1S7K9.js → query-CgCOpYWf.js} +2 -2
- package/dist/web/static/assets/{query-S6X1S7K9.js.map → query-CgCOpYWf.js.map} +1 -1
- package/dist/web/static/assets/{react-router-JVUrkhdd.js → react-router-Cxmg8RuL.js} +3 -3
- package/dist/web/static/assets/{react-router-JVUrkhdd.js.map → react-router-Cxmg8RuL.js.map} +1 -1
- package/dist/web/static/assets/{syntax-highlighter-BkZfCDsz.js → syntax-highlighter-BDYycNja.js} +3 -3
- package/dist/web/static/assets/{syntax-highlighter-BkZfCDsz.js.map → syntax-highlighter-BDYycNja.js.map} +1 -1
- package/dist/web/static/assets/task-title-BhOcemuR.js +2 -0
- package/dist/web/static/assets/task-title-BhOcemuR.js.map +1 -0
- package/dist/web/static/assets/useAgentStats-B-uTgqBd.js +2 -0
- package/dist/web/static/assets/useAgentStats-B-uTgqBd.js.map +1 -0
- package/dist/web/static/assets/useDecisions-D-G2Ft5T.js +2 -0
- package/dist/web/static/assets/useDecisions-D-G2Ft5T.js.map +1 -0
- package/dist/web/static/assets/useDistill-21dZkXlT.js +3 -0
- package/dist/web/static/assets/useDistill-21dZkXlT.js.map +1 -0
- package/dist/web/static/assets/useEffectiveProject-DQiyX54y.js +2 -0
- package/dist/web/static/assets/useEffectiveProject-DQiyX54y.js.map +1 -0
- package/dist/web/static/assets/useIssuesFeed-CFiyQkAL.js +2 -0
- package/dist/web/static/assets/useIssuesFeed-CFiyQkAL.js.map +1 -0
- package/dist/web/static/assets/useKbHits-xKXWgqh9.js +2 -0
- package/dist/web/static/assets/useKbHits-xKXWgqh9.js.map +1 -0
- package/dist/web/static/assets/useSkillStats-B5hbIwdf.js +2 -0
- package/dist/web/static/assets/useSkillStats-B5hbIwdf.js.map +1 -0
- package/dist/web/static/assets/vendor-DS-q4Eyc.js +36 -0
- package/dist/web/static/assets/vendor-DS-q4Eyc.js.map +1 -0
- package/dist/web/static/index.html +6 -6
- package/package.json +5 -3
- package/dist/core/storage/workflow-recommendations.d.ts +0 -124
- package/dist/core/storage/workflow-recommendations.d.ts.map +0 -1
- package/dist/core/storage/workflow-recommendations.js +0 -274
- package/dist/core/storage/workflow-recommendations.js.map +0 -1
- package/dist/daemon/services/experience-extractor.d.ts.map +0 -1
- package/dist/daemon/services/experience-extractor.js.map +0 -1
- package/dist/daemon/services/violation-reporter.d.ts.map +0 -1
- package/dist/daemon/services/violation-reporter.js.map +0 -1
- package/dist/daemon/templates/agents/harness-hotfix.md +0 -99
- package/dist/daemon/templates/agents/hybrid-feature-with-safety.md +0 -104
- package/dist/daemon/templates/agents/refactor-specialist.md +0 -98
- package/dist/skills/distill/claude-cli-resolver.d.ts.map +0 -1
- package/dist/skills/distill/claude-cli-resolver.js.map +0 -1
- package/dist/skills/distilled/distilled-defi-amm-security.md +0 -293
- package/dist/skills/keyword-score.d.ts +0 -29
- package/dist/skills/keyword-score.d.ts.map +0 -1
- package/dist/skills/keyword-score.js +0 -54
- package/dist/skills/keyword-score.js.map +0 -1
- package/dist/web/static/assets/AgentContentPage-DkeRNxok.js +0 -2
- package/dist/web/static/assets/AgentContentPage-DkeRNxok.js.map +0 -1
- package/dist/web/static/assets/AgentDelegationTable-ByBa0x1l.js +0 -2
- package/dist/web/static/assets/AgentDelegationTable-ByBa0x1l.js.map +0 -1
- package/dist/web/static/assets/ContextInsightsPage-oUk7_I8u.js +0 -3
- package/dist/web/static/assets/ContextInsightsPage-oUk7_I8u.js.map +0 -1
- package/dist/web/static/assets/DaemonHealthPage-DG2fyOP7.js +0 -2
- package/dist/web/static/assets/DaemonHealthPage-DG2fyOP7.js.map +0 -1
- package/dist/web/static/assets/DecisionsPage-CMAPEnKb.js +0 -2
- package/dist/web/static/assets/DecisionsPage-CMAPEnKb.js.map +0 -1
- package/dist/web/static/assets/DiagnosticsPage-DQd-Zm4r.js +0 -2
- package/dist/web/static/assets/DiagnosticsPage-DQd-Zm4r.js.map +0 -1
- package/dist/web/static/assets/DriftTab-DqpepOhI.js +0 -2
- package/dist/web/static/assets/DriftTab-DqpepOhI.js.map +0 -1
- package/dist/web/static/assets/HealthHomePage-CN6zNIie.js +0 -3
- package/dist/web/static/assets/HealthHomePage-CN6zNIie.js.map +0 -1
- package/dist/web/static/assets/KbHitRateTable-ByEIWujF.js +0 -2
- package/dist/web/static/assets/KbHitRateTable-ByEIWujF.js.map +0 -1
- package/dist/web/static/assets/NotFound-BQPh0vaF.js +0 -2
- package/dist/web/static/assets/ProjectSwitcher-D3lZMFd3.js +0 -2
- package/dist/web/static/assets/ProjectSwitcher-D3lZMFd3.js.map +0 -1
- package/dist/web/static/assets/SettingsPage-oLJBNzQj.js +0 -2
- package/dist/web/static/assets/SettingsPage-oLJBNzQj.js.map +0 -1
- package/dist/web/static/assets/SkillContentPage-DK5rgfgw.js +0 -2
- package/dist/web/static/assets/SkillContentPage-DK5rgfgw.js.map +0 -1
- package/dist/web/static/assets/SkillStatsTable-DYMzjEUV.js +0 -2
- package/dist/web/static/assets/SkillStatsTable-DYMzjEUV.js.map +0 -1
- package/dist/web/static/assets/SkillsDistillTab-C7qaG8q3.js +0 -2
- package/dist/web/static/assets/SkillsDistillTab-C7qaG8q3.js.map +0 -1
- package/dist/web/static/assets/TasksHubPage-03wsRRsJ.js +0 -6
- package/dist/web/static/assets/TasksHubPage-03wsRRsJ.js.map +0 -1
- package/dist/web/static/assets/ViolationsPage-DSiLr-9O.js +0 -3
- package/dist/web/static/assets/ViolationsPage-DSiLr-9O.js.map +0 -1
- package/dist/web/static/assets/arco-Bhi3a6Qp.js +0 -14
- package/dist/web/static/assets/arco-Bhi3a6Qp.js.map +0 -1
- package/dist/web/static/assets/charts-BuHQWDbQ.js +0 -37
- package/dist/web/static/assets/charts-BuHQWDbQ.js.map +0 -1
- package/dist/web/static/assets/index-BIYnq1Dx.js +0 -4
- package/dist/web/static/assets/index-BIYnq1Dx.js.map +0 -1
- package/dist/web/static/assets/useTabsParam-k8qte_0C.js +0 -2
- package/dist/web/static/assets/useTabsParam-k8qte_0C.js.map +0 -1
- package/dist/web/static/assets/vendor-DWgdB1eY.js +0 -65
- package/dist/web/static/assets/vendor-DWgdB1eY.js.map +0 -1
- /package/dist/{skills/distill → core/utils}/claude-cli-resolver.d.ts +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hybrid-feature-with-safety
|
|
3
|
-
description: New feature that touches legacy low-coverage code. Use when adding new functionality that requires modifying files in modules with <50% test coverage. Triggers on "新功能 + 改老代码", "add X to legacy module Y", "feature touching hooks/claudemd". For pure new modules use coder; for pure refactor use refactor-specialist.
|
|
4
|
-
tools: Read, Edit, Write, Bash, Glob, Grep
|
|
5
|
-
model: inherit
|
|
6
|
-
color: purple
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# IMPORTANT: subagent rules
|
|
10
|
-
|
|
11
|
-
- You are a subagent — you **cannot** spawn other agents (built-in CC restriction)
|
|
12
|
-
- You MUST NOT modify test fixtures to satisfy buggy impl
|
|
13
|
-
- You MUST NOT exceed your declared scope; stop and report if scope creep is needed
|
|
14
|
-
- You MUST run `npm test` (or project equivalent) before declaring done
|
|
15
|
-
- You MUST write a changelog to `docs/implementation/YYYY-MM-DD/HHMM-[task]-changelog.md`
|
|
16
|
-
|
|
17
|
-
# Role
|
|
18
|
-
|
|
19
|
-
New feature that touches legacy low-coverage code. You combine the safety-net
|
|
20
|
-
discipline of `refactor-specialist` with the build-new-stuff focus of `coder`.
|
|
21
|
-
You protect the legacy parts you touch from accidental regression while adding
|
|
22
|
-
new capability cleanly alongside.
|
|
23
|
-
|
|
24
|
-
# When invoked
|
|
25
|
-
|
|
26
|
-
You should be the agent selected when ALL of these hold:
|
|
27
|
-
|
|
28
|
-
- User wants to add NEW behavior (feature, capability, endpoint, command)
|
|
29
|
-
- The new behavior touches files in modules with **<50% test coverage**
|
|
30
|
-
(e.g., `src/hooks/*.sh`, `src/claudemd/`, parts of `src/web/routes/`)
|
|
31
|
-
- Scope spans both "new code" and "modify legacy code"
|
|
32
|
-
|
|
33
|
-
If new code is wholly isolated → `coder` is fine.
|
|
34
|
-
If nothing new, just restructuring → `refactor-specialist`.
|
|
35
|
-
|
|
36
|
-
# Workflow
|
|
37
|
-
|
|
38
|
-
## Step 1: safety-net (legacy touchpoints only)
|
|
39
|
-
|
|
40
|
-
- Identify exactly which legacy files/functions your feature will modify.
|
|
41
|
-
- For each one, write tests that characterize current behavior (see refactor-specialist Step 1).
|
|
42
|
-
- You do NOT need to test legacy code you only READ; only the parts you'll edit.
|
|
43
|
-
- Run `npm test` — new safety-net tests must pass against unmodified legacy.
|
|
44
|
-
|
|
45
|
-
## Step 2: analyze
|
|
46
|
-
|
|
47
|
-
- What does the new feature need from legacy code? Be specific:
|
|
48
|
-
data, side effects, hooks, configuration?
|
|
49
|
-
- Identify integration points: where exactly will new code call into legacy
|
|
50
|
-
(or where will legacy call into new)?
|
|
51
|
-
- Note any awkward seams — these are design risks.
|
|
52
|
-
|
|
53
|
-
## Step 3: design (integration points)
|
|
54
|
-
|
|
55
|
-
- Brief design note: list integration points and the adapter shape.
|
|
56
|
-
- Prefer ADDING new functions over MODIFYING existing ones (less risk to safety-net).
|
|
57
|
-
- If you must modify a legacy function, justify it in the design note.
|
|
58
|
-
|
|
59
|
-
## Step 4: implement
|
|
60
|
-
|
|
61
|
-
- Build the new feature: new files first, then legacy modifications.
|
|
62
|
-
- After each legacy modification, run safety-net tests — must stay green.
|
|
63
|
-
- After each new chunk, run full `npm test` — must stay green.
|
|
64
|
-
|
|
65
|
-
## Step 5: test
|
|
66
|
-
|
|
67
|
-
- New feature MUST have its own dedicated tests (the safety-net is only for legacy bits).
|
|
68
|
-
- Cover: happy path, edge cases, error paths, integration with legacy.
|
|
69
|
-
- Aim for the new module to have >=50% coverage from day one.
|
|
70
|
-
|
|
71
|
-
## Step 6: review
|
|
72
|
-
|
|
73
|
-
- Diff review: are safety-net tests still passing unchanged? (legacy behavior preserved)
|
|
74
|
-
- Are new tests covering the new code? (feature really tested)
|
|
75
|
-
- Any legacy modifications justified in the design note? (no scope creep)
|
|
76
|
-
|
|
77
|
-
# Constraints
|
|
78
|
-
|
|
79
|
-
- Legacy behavior MUST be preserved (safety-net is the contract)
|
|
80
|
-
- New feature MUST have its own tests; do not rely on "well the safety-net still passes"
|
|
81
|
-
to claim the feature works — that only proves you didn't break old stuff
|
|
82
|
-
- Prefer adding to legacy over modifying legacy; modifying is allowed but documented
|
|
83
|
-
- Same "bugs noticed but not fixed" rule as refactor-specialist
|
|
84
|
-
- **scope-checkpoint**: when this single task's cumulative edits reach 5 distinct
|
|
85
|
-
files, STOP and report to the main thread (work done so far + remaining plan +
|
|
86
|
-
any blockers) before continuing — do NOT plow ahead silently; large tasks should
|
|
87
|
-
be split into batches and re-delegated. (This self-limit counts files within
|
|
88
|
-
THIS agent's single task; it is independent of the daemon's cross-session
|
|
89
|
-
`write-multi-file-hard` guardrail — different scopes, different counters.)
|
|
90
|
-
- **verify before done**: before declaring complete you MUST run `npm test` plus
|
|
91
|
-
any relevant build, and record the PASS/FAIL result explicitly in the changelog.
|
|
92
|
-
Unverified work may NOT be reported as done.
|
|
93
|
-
|
|
94
|
-
# Output
|
|
95
|
-
|
|
96
|
-
- Safety-net test files (NEW)
|
|
97
|
-
- New feature source + tests (NEW)
|
|
98
|
-
- Legacy file modifications (MINIMAL)
|
|
99
|
-
- Changelog with: legacy touchpoints, safety-net test list, new feature design,
|
|
100
|
-
new test list, integration evidence. **Put a `Decision: <id>` header line at
|
|
101
|
-
the very top** (e.g. `> Decision: 75344363`) whenever this work traces to an
|
|
102
|
-
approved decision/spec — this is what lets the Web decision detail page
|
|
103
|
-
reliably surface the changelog. Omit only if there is no associated id.
|
|
104
|
-
- Final report: "Added feature X (Y LOC new, Z LOC legacy modified); safety-net N tests; new feature M tests"
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refactor-specialist
|
|
3
|
-
description: Behavior-preserving restructure of low-coverage code. Use when user asks to refactor, restructure, clean up, simplify, or extract from a module with <50% test coverage. Triggers on "重构", "refactor", "整理", "拆分". For new features that happen to touch legacy code, use hybrid-feature-with-safety instead.
|
|
4
|
-
tools: Read, Edit, Write, Bash, Glob, Grep
|
|
5
|
-
model: inherit
|
|
6
|
-
color: orange
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# IMPORTANT: subagent rules
|
|
10
|
-
|
|
11
|
-
- You are a subagent — you **cannot** spawn other agents (built-in CC restriction)
|
|
12
|
-
- You MUST NOT modify test fixtures to satisfy buggy impl
|
|
13
|
-
- You MUST NOT exceed your declared scope; stop and report if scope creep is needed
|
|
14
|
-
- You MUST run `npm test` (or project equivalent) before declaring done
|
|
15
|
-
- You MUST write a changelog to `docs/implementation/YYYY-MM-DD/HHMM-[task]-changelog.md`
|
|
16
|
-
|
|
17
|
-
# Role
|
|
18
|
-
|
|
19
|
-
Behavior-preserving restructure of low-coverage code. Your job is to change the
|
|
20
|
-
SHAPE of code without changing its BEHAVIOR. You characterize current behavior
|
|
21
|
-
with tests first, then move things around, then prove behavior is unchanged.
|
|
22
|
-
|
|
23
|
-
# When invoked
|
|
24
|
-
|
|
25
|
-
You should be the agent selected when ALL of these hold:
|
|
26
|
-
|
|
27
|
-
- User wants to restructure existing code (not add features, not fix bugs)
|
|
28
|
-
- Target module has **<50% test coverage** (you'll need to add safety-net first)
|
|
29
|
-
- Scope is clearly "make it nicer", not "make it do new things"
|
|
30
|
-
|
|
31
|
-
If the user wants new behavior, even alongside refactoring → use `hybrid-feature-with-safety`.
|
|
32
|
-
If module has good coverage already → standard `coder` is fine.
|
|
33
|
-
|
|
34
|
-
# Workflow
|
|
35
|
-
|
|
36
|
-
## Step 1: safety-net (characterize current behavior)
|
|
37
|
-
|
|
38
|
-
- Read the target module top-to-bottom; understand inputs/outputs.
|
|
39
|
-
- Write tests that pin down current observable behavior:
|
|
40
|
-
- Pure functions → golden-master tests (input -> exact output)
|
|
41
|
-
- I/O code → integration tests (set up state, call function, assert state change)
|
|
42
|
-
- Side-effecty code → spy/mock the boundary, assert call shape
|
|
43
|
-
- Cover the "load-bearing" branches: at least one test per significant code path.
|
|
44
|
-
- Run `npm test` — all new tests must PASS against the unrefactored code.
|
|
45
|
-
- This is the safety net; if you change behavior, these tests will catch it.
|
|
46
|
-
|
|
47
|
-
## Step 2: design (brief target shape)
|
|
48
|
-
|
|
49
|
-
- Write a short design note (inline in changelog, or scratch file).
|
|
50
|
-
- Describe: target file layout, what extracts, what merges, what renames.
|
|
51
|
-
- Identify "trickiest move" — start there.
|
|
52
|
-
- Do NOT write a full spec; this is a refactor, the user already approved the direction.
|
|
53
|
-
|
|
54
|
-
## Step 3: implement (small steps)
|
|
55
|
-
|
|
56
|
-
- One conceptual move per commit-worthy unit.
|
|
57
|
-
- After each move: run `npm test` — green or revert.
|
|
58
|
-
- If a safety-net test fails, you changed behavior. Revert and rethink.
|
|
59
|
-
- Move from outside-in or inside-out consistently; do not zig-zag.
|
|
60
|
-
|
|
61
|
-
## Step 4: test (cover the new shape)
|
|
62
|
-
|
|
63
|
-
- Add tests for any new boundaries you created (extracted functions, new modules).
|
|
64
|
-
- Total coverage should go UP, not just shift around.
|
|
65
|
-
|
|
66
|
-
## Step 5: review (diff vs original)
|
|
67
|
-
|
|
68
|
-
- Read your own diff end-to-end.
|
|
69
|
-
- For each chunk, ask: "did I change behavior here?" If yes, revert that chunk.
|
|
70
|
-
- Verify the safety-net tests still pass unchanged (no test edits to accommodate refactor).
|
|
71
|
-
|
|
72
|
-
# Constraints
|
|
73
|
-
|
|
74
|
-
- ALL existing behavior MUST be preserved — no "fix bugs along the way"
|
|
75
|
-
- If you find a bug during refactor, note it in changelog as a follow-up;
|
|
76
|
-
do NOT fix it in the same commit (it muddies the "is this a behavior change?" check)
|
|
77
|
-
- Do NOT add features, do NOT add new public API; only restructure
|
|
78
|
-
- Safety-net tests are immutable once written; if they need editing, your refactor changed behavior
|
|
79
|
-
- **scope-checkpoint**: when this single task's cumulative edits reach 5 distinct
|
|
80
|
-
files, STOP and report to the main thread (work done so far + remaining plan +
|
|
81
|
-
any blockers) before continuing — do NOT plow ahead silently; large tasks should
|
|
82
|
-
be split into batches and re-delegated. (This self-limit counts files within
|
|
83
|
-
THIS agent's single task; it is independent of the daemon's cross-session
|
|
84
|
-
`write-multi-file-hard` guardrail — different scopes, different counters.)
|
|
85
|
-
- **verify before done**: before declaring complete you MUST run `npm test` plus
|
|
86
|
-
any relevant build, and record the PASS/FAIL result explicitly in the changelog.
|
|
87
|
-
Unverified work may NOT be reported as done.
|
|
88
|
-
|
|
89
|
-
# Output
|
|
90
|
-
|
|
91
|
-
- Safety-net test files (NEW, must be added to tree)
|
|
92
|
-
- Refactored source files (behavior unchanged)
|
|
93
|
-
- Changelog with: before/after structure summary, safety-net test list,
|
|
94
|
-
bugs-noticed-but-not-fixed list, coverage delta. **Put a `Decision: <id>`
|
|
95
|
-
header line at the very top** (e.g. `> Decision: 75344363`) whenever this work
|
|
96
|
-
traces to an approved decision/spec — this is what lets the Web decision detail
|
|
97
|
-
page reliably surface the changelog. Omit only if there is no associated id.
|
|
98
|
-
- Final report: "Refactored X (Y LOC) into Z files; safety-net N tests passing unchanged; coverage X% -> Y%"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-cli-resolver.d.ts","sourceRoot":"","sources":["../../../src/skills/distill/claude-cli-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,wBAAgB,aAAa,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,GAAG,IAAI,CAyB3E;AAwDD,4CAA4C;AAC5C,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-cli-resolver.js","sourceRoot":"","sources":["../../../src/skills/distill/claude-cli-resolver.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: distilled-defi-amm-security
|
|
3
|
-
version: 0.2.0-distilled
|
|
4
|
-
description: 'Distilled IT-universal skill: defi-amm-security (score 3.5/5)'
|
|
5
|
-
keywords:
|
|
6
|
-
- defi
|
|
7
|
-
- amm
|
|
8
|
-
- security
|
|
9
|
-
rubric_version: 2
|
|
10
|
-
distilled_from:
|
|
11
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
12
|
-
license: MIT
|
|
13
|
-
commit: unknown
|
|
14
|
-
paths:
|
|
15
|
-
- defi-amm-security/SKILL.md
|
|
16
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
17
|
-
license: MIT
|
|
18
|
-
commit: unknown
|
|
19
|
-
paths:
|
|
20
|
-
- django-security/SKILL.md
|
|
21
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
22
|
-
license: MIT
|
|
23
|
-
commit: unknown
|
|
24
|
-
paths:
|
|
25
|
-
- laravel-security/SKILL.md
|
|
26
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
27
|
-
license: MIT
|
|
28
|
-
commit: unknown
|
|
29
|
-
paths:
|
|
30
|
-
- llm-trading-agent-security/SKILL.md
|
|
31
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
32
|
-
license: MIT
|
|
33
|
-
commit: unknown
|
|
34
|
-
paths:
|
|
35
|
-
- perl-security/SKILL.md
|
|
36
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
37
|
-
license: MIT
|
|
38
|
-
commit: unknown
|
|
39
|
-
paths:
|
|
40
|
-
- quarkus-security/SKILL.md
|
|
41
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
42
|
-
license: MIT
|
|
43
|
-
commit: unknown
|
|
44
|
-
paths:
|
|
45
|
-
- security-bounty-hunter/SKILL.md
|
|
46
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
47
|
-
license: MIT
|
|
48
|
-
commit: unknown
|
|
49
|
-
paths:
|
|
50
|
-
- security-review/SKILL.md
|
|
51
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
52
|
-
license: MIT
|
|
53
|
-
commit: unknown
|
|
54
|
-
paths:
|
|
55
|
-
- security-scan/SKILL.md
|
|
56
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
57
|
-
license: MIT
|
|
58
|
-
commit: unknown
|
|
59
|
-
paths:
|
|
60
|
-
- springboot-security/SKILL.md
|
|
61
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
62
|
-
license: MIT
|
|
63
|
-
commit: unknown
|
|
64
|
-
paths:
|
|
65
|
-
- security-review/SKILL.md
|
|
66
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
67
|
-
license: MIT
|
|
68
|
-
commit: unknown
|
|
69
|
-
paths:
|
|
70
|
-
- laravel-security/SKILL.md
|
|
71
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
72
|
-
license: MIT
|
|
73
|
-
commit: unknown
|
|
74
|
-
paths:
|
|
75
|
-
- quarkus-security/SKILL.md
|
|
76
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
77
|
-
license: MIT
|
|
78
|
-
commit: unknown
|
|
79
|
-
paths:
|
|
80
|
-
- security-review/SKILL.md
|
|
81
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
82
|
-
license: MIT
|
|
83
|
-
commit: unknown
|
|
84
|
-
paths:
|
|
85
|
-
- springboot-security/SKILL.md
|
|
86
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
87
|
-
license: MIT
|
|
88
|
-
commit: unknown
|
|
89
|
-
paths:
|
|
90
|
-
- defi-amm-security/SKILL.md
|
|
91
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
92
|
-
license: MIT
|
|
93
|
-
commit: unknown
|
|
94
|
-
paths:
|
|
95
|
-
- django-security/SKILL.md
|
|
96
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
97
|
-
license: MIT
|
|
98
|
-
commit: unknown
|
|
99
|
-
paths:
|
|
100
|
-
- laravel-security/SKILL.md
|
|
101
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
102
|
-
license: MIT
|
|
103
|
-
commit: unknown
|
|
104
|
-
paths:
|
|
105
|
-
- llm-trading-agent-security/SKILL.md
|
|
106
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
107
|
-
license: MIT
|
|
108
|
-
commit: unknown
|
|
109
|
-
paths:
|
|
110
|
-
- perl-security/SKILL.md
|
|
111
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
112
|
-
license: MIT
|
|
113
|
-
commit: unknown
|
|
114
|
-
paths:
|
|
115
|
-
- security-bounty-hunter/SKILL.md
|
|
116
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
117
|
-
license: MIT
|
|
118
|
-
commit: unknown
|
|
119
|
-
paths:
|
|
120
|
-
- security-review/SKILL.md
|
|
121
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
122
|
-
license: MIT
|
|
123
|
-
commit: unknown
|
|
124
|
-
paths:
|
|
125
|
-
- security-scan/SKILL.md
|
|
126
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
127
|
-
license: MIT
|
|
128
|
-
commit: unknown
|
|
129
|
-
paths:
|
|
130
|
-
- springboot-security/SKILL.md
|
|
131
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
132
|
-
license: MIT
|
|
133
|
-
commit: unknown
|
|
134
|
-
paths:
|
|
135
|
-
- security-review/SKILL.md
|
|
136
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
137
|
-
license: MIT
|
|
138
|
-
commit: unknown
|
|
139
|
-
paths:
|
|
140
|
-
- defi-amm-security/SKILL.md
|
|
141
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
142
|
-
license: MIT
|
|
143
|
-
commit: unknown
|
|
144
|
-
paths:
|
|
145
|
-
- django-security/SKILL.md
|
|
146
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
147
|
-
license: MIT
|
|
148
|
-
commit: unknown
|
|
149
|
-
paths:
|
|
150
|
-
- laravel-security/SKILL.md
|
|
151
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
152
|
-
license: MIT
|
|
153
|
-
commit: unknown
|
|
154
|
-
paths:
|
|
155
|
-
- llm-trading-agent-security/SKILL.md
|
|
156
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
157
|
-
license: MIT
|
|
158
|
-
commit: unknown
|
|
159
|
-
paths:
|
|
160
|
-
- perl-security/SKILL.md
|
|
161
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
162
|
-
license: MIT
|
|
163
|
-
commit: unknown
|
|
164
|
-
paths:
|
|
165
|
-
- quarkus-security/SKILL.md
|
|
166
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
167
|
-
license: MIT
|
|
168
|
-
commit: unknown
|
|
169
|
-
paths:
|
|
170
|
-
- security-bounty-hunter/SKILL.md
|
|
171
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
172
|
-
license: MIT
|
|
173
|
-
commit: unknown
|
|
174
|
-
paths:
|
|
175
|
-
- security-review/SKILL.md
|
|
176
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
177
|
-
license: MIT
|
|
178
|
-
commit: unknown
|
|
179
|
-
paths:
|
|
180
|
-
- security-scan/SKILL.md
|
|
181
|
-
- upstream: https://github.com/affaan-m/ECC.git
|
|
182
|
-
license: MIT
|
|
183
|
-
commit: unknown
|
|
184
|
-
paths:
|
|
185
|
-
- springboot-security/SKILL.md
|
|
186
|
-
distilled_at: '2026-05-29T08:14:29.853Z'
|
|
187
|
-
distilled_by: claude-code skill-distiller agent
|
|
188
|
-
it_universal_score: 3.5
|
|
189
|
-
it_universal_dims:
|
|
190
|
-
d1: 0.5
|
|
191
|
-
d2: 1
|
|
192
|
-
d3: 0.5
|
|
193
|
-
d4: 1
|
|
194
|
-
d5: 0.5
|
|
195
|
-
it_universal_rationale: >-
|
|
196
|
-
Domain-specific to DeFi/smart-contracts but toolchain-neutral and directly reusable across any AMM
|
|
197
|
-
protocol audit without project-specific rewrites.
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
# DeFi AMM Smart Contract Security Audit Patterns
|
|
201
|
-
|
|
202
|
-
## When to use
|
|
203
|
-
- Auditing or reviewing any AMM-style smart contract (swap, mint, burn logic)
|
|
204
|
-
- Detecting economic attack vectors: flash loans, sandwich attacks, price manipulation
|
|
205
|
-
- Adding security assertions to DeFi protocol tests
|
|
206
|
-
- Pre-deployment security review for decentralized exchange contracts
|
|
207
|
-
- Evaluating third-party DeFi integrations your protocol depends on
|
|
208
|
-
|
|
209
|
-
## Core idea
|
|
210
|
-
AMM contracts face economic attacks that don't exist in traditional software — a
|
|
211
|
-
single transaction can borrow billions, manipulate prices, and repay within the
|
|
212
|
-
same block. The primary defense is the **Check-Effects-Interactions (CEI)**
|
|
213
|
-
pattern combined with trustless price oracles and user-controlled slippage
|
|
214
|
-
guards. Flash loans make any on-chain spot price untrustworthy as a valuation
|
|
215
|
-
oracle; always reference time-weighted or off-chain signed prices. Reentrancy
|
|
216
|
-
guards prevent state corruption when external calls re-enter your contract.
|
|
217
|
-
Access control and event emission provide governance safety and off-chain
|
|
218
|
-
auditability.
|
|
219
|
-
|
|
220
|
-
## Steps
|
|
221
|
-
|
|
222
|
-
### 1. Flash Loan Resistance
|
|
223
|
-
- Never trust spot reserve ratios (`reserve1 / reserve0`) as a price oracle
|
|
224
|
-
inside a single transaction — they are flash-loanable in one block
|
|
225
|
-
- Use TWAP (Time-Weighted Average Price) accumulators sampled over ≥ 30 min,
|
|
226
|
-
or off-chain signed feeds (e.g., Chainlink, Pyth) for valuation decisions
|
|
227
|
-
- If your function snapshots a price at entry, verify it against a trustworthy
|
|
228
|
-
oracle *before* any critical state change
|
|
229
|
-
|
|
230
|
-
### 2. Slippage Protection
|
|
231
|
-
- Every trade/swap function must accept caller-supplied `minAmountOut`
|
|
232
|
-
(or equivalent) — revert if actual output < `minAmountOut`
|
|
233
|
-
- Add a `deadline` parameter; revert if `block.timestamp > deadline` to
|
|
234
|
-
prevent transactions from sitting in the mempool and executing at stale rates
|
|
235
|
-
- Never silently accept a worse rate on the user's behalf
|
|
236
|
-
|
|
237
|
-
### 3. Reentrancy Guards
|
|
238
|
-
- Apply CEI order strictly on every state-changing path:
|
|
239
|
-
**Check** conditions → **Effect** storage writes → **Interact** externally
|
|
240
|
-
- Add a reentrancy mutex or use a standard `ReentrancyGuard` on swap, mint,
|
|
241
|
-
burn, and flash-loan entry points
|
|
242
|
-
- Callback tokens (ERC-777, hooks) can re-enter on `transfer` — test this
|
|
243
|
-
path explicitly
|
|
244
|
-
|
|
245
|
-
### 4. Price Oracle Integrity
|
|
246
|
-
- **Instantaneous** (`reserve1/reserve0`): manipulable, use only for display
|
|
247
|
-
- **TWAP** (cumulative price accumulators, ≥ 30 min): safer for reference
|
|
248
|
-
- **Off-chain signed feeds**: validate `updatedAt` staleness and deviation
|
|
249
|
-
thresholds before accepting a price
|
|
250
|
-
- Clearly document which oracle type each function relies on
|
|
251
|
-
|
|
252
|
-
### 5. Integer Arithmetic Safety
|
|
253
|
-
- Use a compiler version / library with built-in overflow checks, or explicit
|
|
254
|
-
safe-math throughout
|
|
255
|
-
- In fixed-point math: **multiply before divide** to preserve precision;
|
|
256
|
-
use adequate decimal precision (18 decimals is standard for ERC-20)
|
|
257
|
-
- For fee calculations in basis points (e.g., 30 bps = 0.3%), verify
|
|
258
|
-
`amount * fee / 10_000` does not truncate to zero for dust amounts
|
|
259
|
-
|
|
260
|
-
### 6. Access Control & Governance
|
|
261
|
-
- Separate liquidity-provider roles from protocol-admin roles
|
|
262
|
-
- Privileged operations (fee changes, pause, emergency drain) must be
|
|
263
|
-
role-gated and ideally time-locked
|
|
264
|
-
- Emit events for every privileged and economically significant state change
|
|
265
|
-
to enable off-chain monitoring and incident response
|
|
266
|
-
|
|
267
|
-
## Anti-patterns
|
|
268
|
-
- **Trusting spot reserves as an oracle**: single-block flash loan makes this
|
|
269
|
-
trivially exploitable
|
|
270
|
-
- **Missing `minAmountOut`**: exposes users to MEV sandwich attacks
|
|
271
|
-
- **State update after external call**: classic reentrancy window
|
|
272
|
-
- **Hardcoded price thresholds**: market conditions change; use relative %
|
|
273
|
-
deviation guards instead
|
|
274
|
-
- **Single-owner admin key with no timelock**: single point of failure for
|
|
275
|
-
protocol governance
|
|
276
|
-
- **Silent overflow/underflow**: corrupts pool accounting without revert
|
|
277
|
-
|
|
278
|
-
## Audit Checklist
|
|
279
|
-
|
|
280
|
-
- [ ] All valuation-critical price references come from TWAP or external oracle
|
|
281
|
-
- [ ] Flash loan scenario analyzed — protocol is not exploitable within a
|
|
282
|
-
single block
|
|
283
|
-
- [ ] Every trade function has `minAmountOut` + `deadline` parameters
|
|
284
|
-
- [ ] CEI pattern applied on all state-changing functions with external calls
|
|
285
|
-
- [ ] Reentrancy guard present on swap, mint, burn, and flash entry points
|
|
286
|
-
- [ ] Integer overflow / underflow handled (compiler-enforced or explicit)
|
|
287
|
-
- [ ] Admin vs. LP roles separated; governance actions time-locked
|
|
288
|
-
- [ ] Events emitted for all privileged and economic state changes
|
|
289
|
-
- [ ] Callback-token (ERC-777, hooks) reentrancy explicitly tested in your
|
|
290
|
-
test suite
|
|
291
|
-
|
|
292
|
-
## References
|
|
293
|
-
- Upstream: https://github.com/affaan-m/ECC.git
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared keyword-scoring helpers used by SkillRegistry (the only consumer
|
|
3
|
-
* after D R-B; previously also used by the now-deleted semantic matcher).
|
|
4
|
-
*
|
|
5
|
-
* Extracted from registry.ts (matchKeywordFlexible + inner scoring loop) in
|
|
6
|
-
* the semantic-matcher-token-cap spec (2026-05-27, 1249). Behaviour-preserving
|
|
7
|
-
* move — no logic changes.
|
|
8
|
-
*/
|
|
9
|
-
import type { Skill } from './registry.js';
|
|
10
|
-
/**
|
|
11
|
-
* Flexible keyword matching:
|
|
12
|
-
* - English single words: requires word boundaries (avoids "test" matching "latest")
|
|
13
|
-
* - Chinese / multi-word: simple substring match
|
|
14
|
-
*
|
|
15
|
-
* Verbatim copy of registry.ts private `matchKeywordFlexible` method.
|
|
16
|
-
*/
|
|
17
|
-
export declare function matchKeywordFlexible(text: string, keyword: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Score a single skill against a lower-cased prompt and extra keyword list.
|
|
20
|
-
*
|
|
21
|
-
* Returns a raw integer count (1 per matching keyword in prompt + 1 per
|
|
22
|
-
* matching keyword in extraLower). No threshold or tie-break applied here —
|
|
23
|
-
* those stay in their respective callers.
|
|
24
|
-
*
|
|
25
|
-
* Mirrors the inner scoring loop of registry.ts `matchKeywords` (lines
|
|
26
|
-
* ~273-298) but returns only the numeric score.
|
|
27
|
-
*/
|
|
28
|
-
export declare function scoreSkillByKeywords(skill: Skill, promptLower: string, extraLower: string[]): number;
|
|
29
|
-
//# sourceMappingURL=keyword-score.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyword-score.d.ts","sourceRoot":"","sources":["../../src/skills/keyword-score.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAU3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CAkBR"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared keyword-scoring helpers used by SkillRegistry (the only consumer
|
|
3
|
-
* after D R-B; previously also used by the now-deleted semantic matcher).
|
|
4
|
-
*
|
|
5
|
-
* Extracted from registry.ts (matchKeywordFlexible + inner scoring loop) in
|
|
6
|
-
* the semantic-matcher-token-cap spec (2026-05-27, 1249). Behaviour-preserving
|
|
7
|
-
* move — no logic changes.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Flexible keyword matching:
|
|
11
|
-
* - English single words: requires word boundaries (avoids "test" matching "latest")
|
|
12
|
-
* - Chinese / multi-word: simple substring match
|
|
13
|
-
*
|
|
14
|
-
* Verbatim copy of registry.ts private `matchKeywordFlexible` method.
|
|
15
|
-
*/
|
|
16
|
-
export function matchKeywordFlexible(text, keyword) {
|
|
17
|
-
// For Chinese or multi-word keywords, use simple includes
|
|
18
|
-
if (/[一-龥]/.test(keyword) || keyword.includes(' ')) {
|
|
19
|
-
return text.includes(keyword);
|
|
20
|
-
}
|
|
21
|
-
// For single English words, require word boundaries to avoid false positives
|
|
22
|
-
// e.g., "test" won't match "latest"
|
|
23
|
-
const regex = new RegExp(`\\b${keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`);
|
|
24
|
-
return regex.test(text);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Score a single skill against a lower-cased prompt and extra keyword list.
|
|
28
|
-
*
|
|
29
|
-
* Returns a raw integer count (1 per matching keyword in prompt + 1 per
|
|
30
|
-
* matching keyword in extraLower). No threshold or tie-break applied here —
|
|
31
|
-
* those stay in their respective callers.
|
|
32
|
-
*
|
|
33
|
-
* Mirrors the inner scoring loop of registry.ts `matchKeywords` (lines
|
|
34
|
-
* ~273-298) but returns only the numeric score.
|
|
35
|
-
*/
|
|
36
|
-
export function scoreSkillByKeywords(skill, promptLower, extraLower) {
|
|
37
|
-
if (skill.keywords.length === 0) {
|
|
38
|
-
// Description-based fallback: used by registry keyword path.
|
|
39
|
-
// For pre-ranking purposes score stays 0 when no keywords — acceptable.
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
42
|
-
let score = 0;
|
|
43
|
-
for (const kw of skill.keywords) {
|
|
44
|
-
const kwLower = kw.toLowerCase();
|
|
45
|
-
if (matchKeywordFlexible(promptLower, kwLower)) {
|
|
46
|
-
score += 1;
|
|
47
|
-
}
|
|
48
|
-
if (extraLower.some(ek => matchKeywordFlexible(ek, kwLower))) {
|
|
49
|
-
score += 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return score;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=keyword-score.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyword-score.js","sourceRoot":"","sources":["../../src/skills/keyword-score.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,OAAe;IAChE,0DAA0D;IAC1D,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,6EAA6E;IAC7E,oCAAoC;IACpC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACpF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAY,EACZ,WAAmB,EACnB,UAAoB;IAEpB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,6DAA6D;QAC7D,wEAAwE;QACxE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;QACjC,IAAI,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;YAC/C,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;QACD,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;YAC7D,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./react-vendor-tkvCrao7.js";import{b as m,L as c}from"./react-router-JVUrkhdd.js";import{u as p}from"./query-S6X1S7K9.js";import{m as s,u as x,T as o,d as y,E as a,Y as u}from"./arco-Bhi3a6Qp.js";import{M as g}from"./MarkdownRenderer-DZmTl-8J.js";import"./vendor-DWgdB1eY.js";import"./syntax-highlighter-BkZfCDsz.js";const j=["name","description","tools","model","version","spawn_agent","tags"];function f(t){if(t==null)return"-";if(Array.isArray(t))return t.join(", ");if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function I(){const{name:t}=m(),{data:n,isLoading:i,isError:l,error:d}=p({queryKey:["agent-content-page",t],enabled:!!t,queryFn:async()=>{const r=await fetch(`/api/agents/${encodeURIComponent(t)}/content`);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()},staleTime:5*6e4});return e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[e.jsxs(s,{children:[e.jsx(s.Item,{children:e.jsx(c,{to:"/context?tab=agents",children:"/context"})}),e.jsx(s.Item,{children:"agent"}),e.jsx(s.Item,{children:e.jsx("span",{style:{fontFamily:"monospace"},children:t})})]}),e.jsxs(x,{bordered:!0,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:e.jsx(o.Title,{heading:5,style:{margin:0,fontFamily:"monospace"},children:t})}),i&&e.jsx(y,{animation:!0,text:{rows:10}}),l&&e.jsx(a,{description:e.jsxs(o.Text,{type:"error",children:["加载失败: ",String(d)]})}),n&&!n.exists&&e.jsx(a,{description:e.jsxs("span",{children:["未找到 ",e.jsxs("code",{style:{fontFamily:"monospace"},children:[".claude/agents/",t,".md"]}),"。",e.jsx("br",{}),"这通常是 Claude Code 内置的虚拟 subagent_type(如 ",e.jsx("code",{children:"general-purpose"}),"),无对应的 markdown 文件。"]})}),n&&n.exists&&e.jsxs(e.Fragment,{children:[e.jsx(u,{colon:" :",size:"small",column:2,title:e.jsx(o.Text,{style:{fontSize:13},children:"Frontmatter"}),data:j.map(r=>({label:r,value:f(n.frontmatter[r])})),style:{marginBottom:16}}),e.jsxs(o.Text,{type:"secondary",style:{fontSize:12},children:["path: ",n.path," · ",n.bytes," bytes"]}),e.jsx("div",{style:{marginTop:12},children:e.jsx(g,{content:n.body})})]})]})]})}export{I as default};
|
|
2
|
-
//# sourceMappingURL=AgentContentPage-DkeRNxok.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentContentPage-DkeRNxok.js","sources":["../../src/pages/AgentContentPage.tsx"],"sourcesContent":["/**\n * /context/agent/:name — full-page view of an agent's .claude/agents/<name>.md.\n *\n * Standalone fallback for long agent definitions where the 760px drawer is\n * cramped. Linked from AgentContentDrawer's \"Open in full page\" anchor.\n *\n * Breadcrumb: /context → /context/agent/:name\n */\nimport { useParams, Link } from 'react-router-dom'\nimport { useQuery } from '@tanstack/react-query'\nimport Breadcrumb from '@arco-design/web-react/es/Breadcrumb'\nimport Card from '@arco-design/web-react/es/Card'\nimport Descriptions from '@arco-design/web-react/es/Descriptions'\nimport Empty from '@arco-design/web-react/es/Empty'\nimport Skeleton from '@arco-design/web-react/es/Skeleton'\nimport Typography from '@arco-design/web-react/es/Typography'\nimport MarkdownRenderer from '../components/MarkdownRenderer'\n\ninterface AgentContentResponse {\n name: string\n exists: boolean\n path: string | null\n bytes: number\n body: string\n frontmatter: Record<string, unknown>\n tools: string | null\n model: string | null\n}\n\nconst WHITELIST: ReadonlyArray<string> = [\n 'name',\n 'description',\n 'tools',\n 'model',\n 'version',\n 'spawn_agent',\n 'tags',\n]\n\nfunction renderFmValue(v: unknown): string {\n if (v == null) return '-'\n if (Array.isArray(v)) return v.join(', ')\n if (typeof v === 'string') return v\n if (typeof v === 'number' || typeof v === 'boolean') return String(v)\n try {\n return JSON.stringify(v)\n } catch {\n return String(v)\n }\n}\n\nexport default function AgentContentPage() {\n const { name } = useParams<{ name: string }>()\n const { data, isLoading, isError, error } = useQuery<AgentContentResponse>({\n queryKey: ['agent-content-page', name],\n enabled: !!name,\n queryFn: async () => {\n const r = await fetch(`/api/agents/${encodeURIComponent(name!)}/content`)\n if (!r.ok) throw new Error(`HTTP ${r.status}`)\n return r.json()\n },\n staleTime: 5 * 60_000,\n })\n\n return (\n <div style={{ padding: 16, display: 'flex', flexDirection: 'column', gap: 12 }}>\n <Breadcrumb>\n <Breadcrumb.Item>\n <Link to=\"/context?tab=agents\">/context</Link>\n </Breadcrumb.Item>\n <Breadcrumb.Item>agent</Breadcrumb.Item>\n <Breadcrumb.Item>\n <span style={{ fontFamily: 'monospace' }}>{name}</span>\n </Breadcrumb.Item>\n </Breadcrumb>\n\n <Card bordered>\n <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 12 }}>\n <Typography.Title heading={5} style={{ margin: 0, fontFamily: 'monospace' }}>{name}</Typography.Title>\n </div>\n\n {isLoading && <Skeleton animation text={{ rows: 10 }} />}\n {isError && (\n <Empty description={<Typography.Text type=\"error\">加载失败: {String(error)}</Typography.Text>} />\n )}\n {data && !data.exists && (\n <Empty\n description={\n <span>\n 未找到 <code style={{ fontFamily: 'monospace' }}>.claude/agents/{name}.md</code>。\n <br />\n 这通常是 Claude Code 内置的虚拟 subagent_type(如 <code>general-purpose</code>),无对应的 markdown 文件。\n </span>\n }\n />\n )}\n {data && data.exists && (\n <>\n <Descriptions\n colon=\" :\"\n size=\"small\"\n column={2}\n title={<Typography.Text style={{ fontSize: 13 }}>Frontmatter</Typography.Text>}\n data={WHITELIST.map((key) => ({\n label: key,\n value: renderFmValue(data.frontmatter[key]),\n }))}\n style={{ marginBottom: 16 }}\n />\n <Typography.Text type=\"secondary\" style={{ fontSize: 12 }}>\n path: {data.path} · {data.bytes} bytes\n </Typography.Text>\n <div style={{ marginTop: 12 }}>\n <MarkdownRenderer content={data.body} />\n </div>\n </>\n )}\n </Card>\n </div>\n )\n}\n"],"names":["WHITELIST","renderFmValue","v","AgentContentPage","name","useParams","data","isLoading","isError","error","useQuery","jsxs","Breadcrumb","jsx","Link","Card","Typography","Skeleton","Empty","Fragment","Descriptions","key","MarkdownRenderer"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,r as x}from"./react-vendor-tkvCrao7.js";import{u as y}from"./query-S6X1S7K9.js";import{U as h,Y as g,d as f,E as l,T as i,ai as j,X as b,b as u}from"./arco-Bhi3a6Qp.js";import{M as w}from"./MarkdownRenderer-DZmTl-8J.js";import"./vendor-DWgdB1eY.js";import"./syntax-highlighter-BkZfCDsz.js";const T=["name","description","tools","model","version","spawn_agent","tags"];function S(n){if(n==null)return"-";if(Array.isArray(n))return n.join(", ");if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);try{return JSON.stringify(n)}catch{return String(n)}}function z({open:n,agentName:a,stats:o,onClose:c}){const{data:r,isLoading:p,isError:d,error:m}=y({queryKey:["agent-content",a],enabled:!!a&&n,queryFn:async()=>{const s=await fetch(`/api/agents/${encodeURIComponent(a)}/content`);if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},staleTime:3e5}),t=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:13},children:a??"-"}),a&&e.jsxs("a",{href:`/context/agent/${encodeURIComponent(a)}`,target:"_blank",rel:"noopener noreferrer",style:{marginLeft:"auto",fontSize:12,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(j,{})," Open in full page"]})]});return e.jsxs(h,{visible:n,onCancel:c,onOk:c,title:t,width:760,footer:null,unmountOnExit:!0,children:[o&&e.jsx(g,{colon:" :",size:"small",column:3,data:[{label:"delegations (7d)",value:o.count},{label:"rate",value:o.rate},{label:"subagent_type",value:o.agent}],style:{marginBottom:12}}),p&&e.jsx(f,{animation:!0,text:{rows:6}}),d&&e.jsx(l,{description:e.jsxs(i.Text,{type:"error",children:["加载失败: ",String(m)]})}),r&&!r.exists&&r.source==="builtin"&&e.jsx(l,{description:e.jsxs("span",{children:[e.jsx("code",{style:{fontFamily:"monospace"},children:a})," 是 Claude Code 内置的虚拟 subagent_type,无项目级 markdown 文件。",e.jsx("br",{}),r.message??"Claude Code built-in agent; no project-level details available"]})}),r&&!r.exists&&r.source!=="builtin"&&e.jsx(l,{description:e.jsxs("span",{children:["未找到 ",e.jsxs("code",{style:{fontFamily:"monospace"},children:[".claude/agents/",a,".md"]}),"。",e.jsx("br",{}),"若这是新建 agent,请在 TUI 重启(Cmd+R)后再触发。"]})}),r&&r.exists&&e.jsxs(e.Fragment,{children:[e.jsx(g,{colon:" :",size:"mini",column:2,title:e.jsx(i.Text,{style:{fontSize:13},children:"Frontmatter"}),data:T.map(s=>({label:s,value:S(r.frontmatter[s])})),style:{marginBottom:16}}),e.jsx(i.Text,{style:{fontSize:13,fontWeight:600},children:"Body"}),e.jsx("div",{style:{marginTop:8,maxHeight:"calc(100vh - 360px)",overflow:"auto",border:"1px solid var(--color-border-2)",borderRadius:4,padding:12},children:e.jsx(w,{content:r.body})})]})]})}function R(){const[n,a]=x.useState(null),{data:o,isLoading:c,isError:r,error:p}=y({queryKey:["ctx-agent-hit-rate"],queryFn:async()=>{const t=await fetch("/api/rules/hit-rate?days=7");if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},staleTime:6e4}),d=x.useMemo(()=>o?o.agents.map(t=>({...t})).sort((t,s)=>s.count-t.count):[],[o]);if(r)return e.jsx(l,{description:e.jsxs(i.Text,{type:"error",children:["加载失败: ",String(p)]})});if(c||!o)return e.jsx(f,{animation:!0,text:{rows:8}});const m=[{title:"agent (subagent_type)",dataIndex:"agent",render:(t,s)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:12},children:t}),s.source==="builtin"&&e.jsx(u,{color:"gray",size:"small",children:"built-in"})]})},{title:"delegations (7d)",dataIndex:"count",width:160,sorter:(t,s)=>t.count-s.count,render:t=>e.jsx("span",{style:{fontFamily:"monospace",fontWeight:600},children:t})},{title:"rate (vs 全部 prompt)",dataIndex:"rate",width:160,render:t=>e.jsx(i.Text,{style:{fontSize:12},children:t})},{title:"热度",dataIndex:"count",key:"tier",width:100,render:t=>t>=50?e.jsx(u,{color:"green",size:"small",children:"heavy"}):t>=5?e.jsx(u,{color:"arcoblue",size:"small",children:"used"}):e.jsx(u,{color:"orange",size:"small",children:"rare"})}];return e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:12},children:e.jsxs(i.Text,{style:{fontSize:13,color:"var(--color-text-3)"},children:["近 7d · 总 delegation ",o.summary.agentDelegations," / ",o.summary.totalPrompts," prompts · agent rate ",o.summary.agentRate," · 共 ",d.length," 个 agent"]})}),e.jsx(b,{rowKey:"agent",data:d,columns:m,pagination:{pageSize:20,showTotal:!0},size:"small",border:{wrapper:!0,cell:!0},onRow:t=>({onClick:()=>a(t),style:{cursor:"pointer"}}),noDataElement:e.jsx(l,{description:"无 agent 委托记录"})}),e.jsx(z,{open:n!==null,agentName:(n==null?void 0:n.agent)??null,stats:n,onClose:()=>a(null)})]})}export{R as default};
|
|
2
|
-
//# sourceMappingURL=AgentDelegationTable-ByBa0x1l.js.map
|