forge-server 0.1.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/.claude/hooks/worktree-create.sh +64 -0
- package/.claude/hooks/worktree-remove.sh +57 -0
- package/.claude/settings.local.json +29 -0
- package/.forge/knowledge/conventions.yaml +1 -0
- package/.forge/knowledge/decisions.yaml +1 -0
- package/.forge/knowledge/gotchas.yaml +1 -0
- package/.forge/knowledge/patterns.yaml +1 -0
- package/.forge/manifest.yaml +6 -0
- package/CLAUDE.md +144 -0
- package/bin/setup-forge.sh +132 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +553 -0
- package/dist/cli.js.map +1 -0
- package/dist/context/codebase.d.ts +57 -0
- package/dist/context/codebase.d.ts.map +1 -0
- package/dist/context/codebase.js +301 -0
- package/dist/context/codebase.js.map +1 -0
- package/dist/context/injector.d.ts +147 -0
- package/dist/context/injector.d.ts.map +1 -0
- package/dist/context/injector.js +533 -0
- package/dist/context/injector.js.map +1 -0
- package/dist/context/memory.d.ts +32 -0
- package/dist/context/memory.d.ts.map +1 -0
- package/dist/context/memory.js +140 -0
- package/dist/context/memory.js.map +1 -0
- package/dist/context/session-index.d.ts +54 -0
- package/dist/context/session-index.d.ts.map +1 -0
- package/dist/context/session-index.js +265 -0
- package/dist/context/session-index.js.map +1 -0
- package/dist/context/session.d.ts +42 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +121 -0
- package/dist/context/session.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/ingestion/chunker.d.ts +19 -0
- package/dist/ingestion/chunker.d.ts.map +1 -0
- package/dist/ingestion/chunker.js +189 -0
- package/dist/ingestion/chunker.js.map +1 -0
- package/dist/ingestion/embedder.d.ts +45 -0
- package/dist/ingestion/embedder.d.ts.map +1 -0
- package/dist/ingestion/embedder.js +152 -0
- package/dist/ingestion/embedder.js.map +1 -0
- package/dist/ingestion/git-analyzer.d.ts +77 -0
- package/dist/ingestion/git-analyzer.d.ts.map +1 -0
- package/dist/ingestion/git-analyzer.js +437 -0
- package/dist/ingestion/git-analyzer.js.map +1 -0
- package/dist/ingestion/indexer.d.ts +79 -0
- package/dist/ingestion/indexer.d.ts.map +1 -0
- package/dist/ingestion/indexer.js +766 -0
- package/dist/ingestion/indexer.js.map +1 -0
- package/dist/ingestion/markdown-chunker.d.ts +19 -0
- package/dist/ingestion/markdown-chunker.d.ts.map +1 -0
- package/dist/ingestion/markdown-chunker.js +243 -0
- package/dist/ingestion/markdown-chunker.js.map +1 -0
- package/dist/ingestion/markdown-knowledge.d.ts +21 -0
- package/dist/ingestion/markdown-knowledge.d.ts.map +1 -0
- package/dist/ingestion/markdown-knowledge.js +129 -0
- package/dist/ingestion/markdown-knowledge.js.map +1 -0
- package/dist/ingestion/parser.d.ts +20 -0
- package/dist/ingestion/parser.d.ts.map +1 -0
- package/dist/ingestion/parser.js +429 -0
- package/dist/ingestion/parser.js.map +1 -0
- package/dist/ingestion/watcher.d.ts +28 -0
- package/dist/ingestion/watcher.d.ts.map +1 -0
- package/dist/ingestion/watcher.js +147 -0
- package/dist/ingestion/watcher.js.map +1 -0
- package/dist/knowledge/hydrator.d.ts +37 -0
- package/dist/knowledge/hydrator.d.ts.map +1 -0
- package/dist/knowledge/hydrator.js +220 -0
- package/dist/knowledge/hydrator.js.map +1 -0
- package/dist/knowledge/registry.d.ts +129 -0
- package/dist/knowledge/registry.d.ts.map +1 -0
- package/dist/knowledge/registry.js +361 -0
- package/dist/knowledge/registry.js.map +1 -0
- package/dist/knowledge/search.d.ts +114 -0
- package/dist/knowledge/search.d.ts.map +1 -0
- package/dist/knowledge/search.js +428 -0
- package/dist/knowledge/search.js.map +1 -0
- package/dist/knowledge/store.d.ts +76 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +230 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/learning/confidence.d.ts +30 -0
- package/dist/learning/confidence.d.ts.map +1 -0
- package/dist/learning/confidence.js +165 -0
- package/dist/learning/confidence.js.map +1 -0
- package/dist/learning/patterns.d.ts +52 -0
- package/dist/learning/patterns.d.ts.map +1 -0
- package/dist/learning/patterns.js +290 -0
- package/dist/learning/patterns.js.map +1 -0
- package/dist/learning/trajectory.d.ts +55 -0
- package/dist/learning/trajectory.d.ts.map +1 -0
- package/dist/learning/trajectory.js +200 -0
- package/dist/learning/trajectory.js.map +1 -0
- package/dist/memory/memory-compat.d.ts +100 -0
- package/dist/memory/memory-compat.d.ts.map +1 -0
- package/dist/memory/memory-compat.js +146 -0
- package/dist/memory/memory-compat.js.map +1 -0
- package/dist/memory/observation-store.d.ts +57 -0
- package/dist/memory/observation-store.d.ts.map +1 -0
- package/dist/memory/observation-store.js +154 -0
- package/dist/memory/observation-store.js.map +1 -0
- package/dist/memory/session-tracker.d.ts +81 -0
- package/dist/memory/session-tracker.d.ts.map +1 -0
- package/dist/memory/session-tracker.js +262 -0
- package/dist/memory/session-tracker.js.map +1 -0
- package/dist/pipeline/engine.d.ts +179 -0
- package/dist/pipeline/engine.d.ts.map +1 -0
- package/dist/pipeline/engine.js +691 -0
- package/dist/pipeline/engine.js.map +1 -0
- package/dist/pipeline/events.d.ts +54 -0
- package/dist/pipeline/events.d.ts.map +1 -0
- package/dist/pipeline/events.js +157 -0
- package/dist/pipeline/events.js.map +1 -0
- package/dist/pipeline/parallel.d.ts +83 -0
- package/dist/pipeline/parallel.d.ts.map +1 -0
- package/dist/pipeline/parallel.js +277 -0
- package/dist/pipeline/parallel.js.map +1 -0
- package/dist/pipeline/state-machine.d.ts +65 -0
- package/dist/pipeline/state-machine.d.ts.map +1 -0
- package/dist/pipeline/state-machine.js +176 -0
- package/dist/pipeline/state-machine.js.map +1 -0
- package/dist/query/graph-queries.d.ts +84 -0
- package/dist/query/graph-queries.d.ts.map +1 -0
- package/dist/query/graph-queries.js +216 -0
- package/dist/query/graph-queries.js.map +1 -0
- package/dist/query/hybrid-search.d.ts +34 -0
- package/dist/query/hybrid-search.d.ts.map +1 -0
- package/dist/query/hybrid-search.js +263 -0
- package/dist/query/hybrid-search.js.map +1 -0
- package/dist/query/intent-detector.d.ts +35 -0
- package/dist/query/intent-detector.d.ts.map +1 -0
- package/dist/query/intent-detector.js +115 -0
- package/dist/query/intent-detector.js.map +1 -0
- package/dist/query/ranking.d.ts +57 -0
- package/dist/query/ranking.d.ts.map +1 -0
- package/dist/query/ranking.js +109 -0
- package/dist/query/ranking.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +291 -0
- package/dist/server.js.map +1 -0
- package/dist/storage/falkordb-store.d.ts +73 -0
- package/dist/storage/falkordb-store.d.ts.map +1 -0
- package/dist/storage/falkordb-store.js +346 -0
- package/dist/storage/falkordb-store.js.map +1 -0
- package/dist/storage/file-cache.d.ts +32 -0
- package/dist/storage/file-cache.d.ts.map +1 -0
- package/dist/storage/file-cache.js +115 -0
- package/dist/storage/file-cache.js.map +1 -0
- package/dist/storage/interfaces.d.ts +151 -0
- package/dist/storage/interfaces.d.ts.map +1 -0
- package/dist/storage/interfaces.js +7 -0
- package/dist/storage/interfaces.js.map +1 -0
- package/dist/storage/qdrant-store.d.ts +110 -0
- package/dist/storage/qdrant-store.d.ts.map +1 -0
- package/dist/storage/qdrant-store.js +467 -0
- package/dist/storage/qdrant-store.js.map +1 -0
- package/dist/storage/schema.d.ts +4 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +136 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/sqlite.d.ts +35 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +132 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/tools/collaboration-tools.d.ts +111 -0
- package/dist/tools/collaboration-tools.d.ts.map +1 -0
- package/dist/tools/collaboration-tools.js +174 -0
- package/dist/tools/collaboration-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +293 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +437 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +129 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +237 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/ingestion-tools.d.ts +96 -0
- package/dist/tools/ingestion-tools.d.ts.map +1 -0
- package/dist/tools/ingestion-tools.js +90 -0
- package/dist/tools/ingestion-tools.js.map +1 -0
- package/dist/tools/learning-tools.d.ts +168 -0
- package/dist/tools/learning-tools.d.ts.map +1 -0
- package/dist/tools/learning-tools.js +158 -0
- package/dist/tools/learning-tools.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +183 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +197 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/phase-tools.d.ts +954 -0
- package/dist/tools/phase-tools.d.ts.map +1 -0
- package/dist/tools/phase-tools.js +1215 -0
- package/dist/tools/phase-tools.js.map +1 -0
- package/dist/tools/pipeline-tools.d.ts +140 -0
- package/dist/tools/pipeline-tools.d.ts.map +1 -0
- package/dist/tools/pipeline-tools.js +162 -0
- package/dist/tools/pipeline-tools.js.map +1 -0
- package/dist/tools/registration-tools.d.ts +220 -0
- package/dist/tools/registration-tools.d.ts.map +1 -0
- package/dist/tools/registration-tools.js +391 -0
- package/dist/tools/registration-tools.js.map +1 -0
- package/dist/util/circuit-breaker.d.ts +75 -0
- package/dist/util/circuit-breaker.d.ts.map +1 -0
- package/dist/util/circuit-breaker.js +159 -0
- package/dist/util/circuit-breaker.js.map +1 -0
- package/dist/util/config.d.ts +23 -0
- package/dist/util/config.d.ts.map +1 -0
- package/dist/util/config.js +164 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/logger.d.ts +13 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +45 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/token-counter.d.ts +24 -0
- package/dist/util/token-counter.d.ts.map +1 -0
- package/dist/util/token-counter.js +48 -0
- package/dist/util/token-counter.js.map +1 -0
- package/dist/util/types.d.ts +525 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +5 -0
- package/dist/util/types.js.map +1 -0
- package/docker-compose.yml +20 -0
- package/docs/plans/2026-02-27-swarm-coordination/architecture.md +203 -0
- package/docs/plans/2026-02-27-swarm-coordination/vision.md +57 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/architecture.md +1 -0
- package/docs/plans/completed/2026-02-26-forge-plugin-bundling/vision.md +300 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/architecture.md +480 -0
- package/docs/plans/completed/2026-02-27-forge-swarm-learning/verification-checklist.md +462 -0
- package/docs/plans/completed/2026-02-27-git-history-atlassian/git-jira-plan.md +181 -0
- package/package.json +39 -0
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.mcp.json +15 -0
- package/plugin/README.md +134 -0
- package/plugin/agents/architect.md +367 -0
- package/plugin/agents/backend-specialist.md +263 -0
- package/plugin/agents/brainstormer.md +122 -0
- package/plugin/agents/data-specialist.md +266 -0
- package/plugin/agents/designer.md +408 -0
- package/plugin/agents/frontend-specialist.md +241 -0
- package/plugin/agents/inspector.md +406 -0
- package/plugin/agents/knowledge-keeper.md +443 -0
- package/plugin/agents/platform-engineer.md +326 -0
- package/plugin/agents/product-manager.md +268 -0
- package/plugin/agents/product-owner.md +438 -0
- package/plugin/agents/pulse-checker.md +73 -0
- package/plugin/agents/qa-strategist.md +500 -0
- package/plugin/agents/self-improver.md +310 -0
- package/plugin/agents/strategist.md +360 -0
- package/plugin/agents/supervisor.md +380 -0
- package/plugin/commands/brainstorm.md +25 -0
- package/plugin/commands/forge.md +88 -0
- package/plugin/docs/atlassian-integration.md +110 -0
- package/plugin/docs/workflow.md +126 -0
- package/plugin/skills/agent-development/.skillfish.json +10 -0
- package/plugin/skills/agent-development/SKILL.md +415 -0
- package/plugin/skills/agent-development/examples/agent-creation-prompt.md +238 -0
- package/plugin/skills/agent-development/examples/complete-agent-examples.md +427 -0
- package/plugin/skills/agent-development/references/agent-creation-system-prompt.md +207 -0
- package/plugin/skills/agent-development/references/system-prompt-design.md +411 -0
- package/plugin/skills/agent-development/references/triggering-examples.md +491 -0
- package/plugin/skills/agent-development/scripts/validate-agent.sh +217 -0
- package/plugin/skills/agent-handoff/SKILL.md +335 -0
- package/plugin/skills/anti-stub/SKILL.md +317 -0
- package/plugin/skills/brainstorm/SKILL.md +31 -0
- package/plugin/skills/debugging/SKILL.md +276 -0
- package/plugin/skills/fix/SKILL.md +62 -0
- package/plugin/skills/frontend-design/.skillfish.json +10 -0
- package/plugin/skills/frontend-design/SKILL.md +42 -0
- package/plugin/skills/gotchas/SKILL.md +61 -0
- package/plugin/skills/graph-orchestrator/SKILL.md +38 -0
- package/plugin/skills/history/SKILL.md +58 -0
- package/plugin/skills/impact/SKILL.md +59 -0
- package/plugin/skills/implementation-execution/SKILL.md +291 -0
- package/plugin/skills/index-repo/SKILL.md +55 -0
- package/plugin/skills/interviewing/SKILL.md +225 -0
- package/plugin/skills/knowledge-curation/SKILL.md +393 -0
- package/plugin/skills/learn/SKILL.md +69 -0
- package/plugin/skills/mcp-integration/.skillfish.json +10 -0
- package/plugin/skills/mcp-integration/SKILL.md +554 -0
- package/plugin/skills/mcp-integration/examples/http-server.json +20 -0
- package/plugin/skills/mcp-integration/examples/sse-server.json +19 -0
- package/plugin/skills/mcp-integration/examples/stdio-server.json +26 -0
- package/plugin/skills/mcp-integration/references/authentication.md +549 -0
- package/plugin/skills/mcp-integration/references/server-types.md +536 -0
- package/plugin/skills/mcp-integration/references/tool-usage.md +538 -0
- package/plugin/skills/nestjs/.skillfish.json +10 -0
- package/plugin/skills/nestjs/SKILL.md +669 -0
- package/plugin/skills/nestjs/drizzle-reference.md +1894 -0
- package/plugin/skills/nestjs/reference.md +1447 -0
- package/plugin/skills/nestjs/workflow-optimization.md +229 -0
- package/plugin/skills/parallel-dispatch/SKILL.md +308 -0
- package/plugin/skills/project-discovery/SKILL.md +304 -0
- package/plugin/skills/search/SKILL.md +56 -0
- package/plugin/skills/security-audit/SKILL.md +362 -0
- package/plugin/skills/skill-development/.skillfish.json +10 -0
- package/plugin/skills/skill-development/SKILL.md +637 -0
- package/plugin/skills/skill-development/references/skill-creator-original.md +209 -0
- package/plugin/skills/tdd/SKILL.md +273 -0
- package/plugin/skills/terminal-presentation/SKILL.md +395 -0
- package/plugin/skills/test-strategy/SKILL.md +365 -0
- package/plugin/skills/verification-protocol/SKILL.md +256 -0
- package/plugin/skills/visual-explainer/CHANGELOG.md +97 -0
- package/plugin/skills/visual-explainer/LICENSE +21 -0
- package/plugin/skills/visual-explainer/README.md +137 -0
- package/plugin/skills/visual-explainer/SKILL.md +352 -0
- package/plugin/skills/visual-explainer/banner.png +0 -0
- package/plugin/skills/visual-explainer/package.json +11 -0
- package/plugin/skills/visual-explainer/prompts/diff-review.md +68 -0
- package/plugin/skills/visual-explainer/prompts/fact-check.md +63 -0
- package/plugin/skills/visual-explainer/prompts/generate-slides.md +18 -0
- package/plugin/skills/visual-explainer/prompts/generate-web-diagram.md +10 -0
- package/plugin/skills/visual-explainer/prompts/plan-review.md +86 -0
- package/plugin/skills/visual-explainer/prompts/project-recap.md +61 -0
- package/plugin/skills/visual-explainer/references/css-patterns.md +1188 -0
- package/plugin/skills/visual-explainer/references/libraries.md +470 -0
- package/plugin/skills/visual-explainer/references/responsive-nav.md +212 -0
- package/plugin/skills/visual-explainer/references/slide-patterns.md +1403 -0
- package/plugin/skills/visual-explainer/templates/architecture.html +596 -0
- package/plugin/skills/visual-explainer/templates/data-table.html +540 -0
- package/plugin/skills/visual-explainer/templates/mermaid-flowchart.html +435 -0
- package/plugin/skills/visual-explainer/templates/slide-deck.html +913 -0
- package/src/cli.ts +655 -0
- package/src/context/.gitkeep +0 -0
- package/src/context/codebase.ts +393 -0
- package/src/context/injector.ts +797 -0
- package/src/context/memory.ts +187 -0
- package/src/context/session-index.ts +327 -0
- package/src/context/session.ts +152 -0
- package/src/index.ts +47 -0
- package/src/ingestion/.gitkeep +0 -0
- package/src/ingestion/chunker.ts +277 -0
- package/src/ingestion/embedder.ts +167 -0
- package/src/ingestion/git-analyzer.ts +545 -0
- package/src/ingestion/indexer.ts +984 -0
- package/src/ingestion/markdown-chunker.ts +337 -0
- package/src/ingestion/markdown-knowledge.ts +175 -0
- package/src/ingestion/parser.ts +475 -0
- package/src/ingestion/watcher.ts +182 -0
- package/src/knowledge/.gitkeep +0 -0
- package/src/knowledge/hydrator.ts +246 -0
- package/src/knowledge/registry.ts +463 -0
- package/src/knowledge/search.ts +565 -0
- package/src/knowledge/store.ts +262 -0
- package/src/learning/.gitkeep +0 -0
- package/src/learning/confidence.ts +193 -0
- package/src/learning/patterns.ts +360 -0
- package/src/learning/trajectory.ts +268 -0
- package/src/memory/.gitkeep +0 -0
- package/src/memory/memory-compat.ts +233 -0
- package/src/memory/observation-store.ts +224 -0
- package/src/memory/session-tracker.ts +332 -0
- package/src/pipeline/.gitkeep +0 -0
- package/src/pipeline/engine.ts +1139 -0
- package/src/pipeline/events.ts +253 -0
- package/src/pipeline/parallel.ts +394 -0
- package/src/pipeline/state-machine.ts +199 -0
- package/src/query/.gitkeep +0 -0
- package/src/query/graph-queries.ts +262 -0
- package/src/query/hybrid-search.ts +337 -0
- package/src/query/intent-detector.ts +131 -0
- package/src/query/ranking.ts +161 -0
- package/src/server.ts +352 -0
- package/src/storage/.gitkeep +0 -0
- package/src/storage/falkordb-store.ts +388 -0
- package/src/storage/file-cache.ts +141 -0
- package/src/storage/interfaces.ts +201 -0
- package/src/storage/qdrant-store.ts +557 -0
- package/src/storage/schema.ts +139 -0
- package/src/storage/sqlite.ts +168 -0
- package/src/tools/.gitkeep +0 -0
- package/src/tools/collaboration-tools.ts +208 -0
- package/src/tools/context-tools.ts +493 -0
- package/src/tools/graph-tools.ts +295 -0
- package/src/tools/ingestion-tools.ts +122 -0
- package/src/tools/learning-tools.ts +181 -0
- package/src/tools/memory-tools.ts +234 -0
- package/src/tools/phase-tools.ts +1452 -0
- package/src/tools/pipeline-tools.ts +188 -0
- package/src/tools/registration-tools.ts +450 -0
- package/src/util/.gitkeep +0 -0
- package/src/util/circuit-breaker.ts +193 -0
- package/src/util/config.ts +177 -0
- package/src/util/logger.ts +53 -0
- package/src/util/token-counter.ts +52 -0
- package/src/util/types.ts +710 -0
- package/tests/context/.gitkeep +0 -0
- package/tests/integration/.gitkeep +0 -0
- package/tests/knowledge/.gitkeep +0 -0
- package/tests/learning/.gitkeep +0 -0
- package/tests/pipeline/.gitkeep +0 -0
- package/tests/tools/.gitkeep +0 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +10 -0
- package/vscode-extension/.vscodeignore +7 -0
- package/vscode-extension/README.md +43 -0
- package/vscode-extension/out/edge-collector.js +274 -0
- package/vscode-extension/out/edge-collector.js.map +1 -0
- package/vscode-extension/out/extension.js +264 -0
- package/vscode-extension/out/extension.js.map +1 -0
- package/vscode-extension/out/forge-client.js +318 -0
- package/vscode-extension/out/forge-client.js.map +1 -0
- package/vscode-extension/package-lock.json +59 -0
- package/vscode-extension/package.json +71 -0
- package/vscode-extension/src/edge-collector.ts +320 -0
- package/vscode-extension/src/extension.ts +269 -0
- package/vscode-extension/src/forge-client.ts +364 -0
- package/vscode-extension/tsconfig.json +19 -0
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
# Agent Triggering Examples: Best Practices
|
|
2
|
+
|
|
3
|
+
Complete guide to writing effective `<example>` blocks in agent descriptions for reliable triggering.
|
|
4
|
+
|
|
5
|
+
## Example Block Format
|
|
6
|
+
|
|
7
|
+
The standard format for triggering examples:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
<example>
|
|
11
|
+
Context: [Describe the situation - what led to this interaction]
|
|
12
|
+
user: "[Exact user message or request]"
|
|
13
|
+
assistant: "[How Claude should respond before triggering]"
|
|
14
|
+
<commentary>
|
|
15
|
+
[Explanation of why this agent should be triggered in this scenario]
|
|
16
|
+
</commentary>
|
|
17
|
+
assistant: "[How Claude triggers the agent - usually 'I'll use the [agent-name] agent...']"
|
|
18
|
+
</example>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Anatomy of a Good Example
|
|
22
|
+
|
|
23
|
+
### Context
|
|
24
|
+
|
|
25
|
+
**Purpose:** Set the scene - what happened before the user's message
|
|
26
|
+
|
|
27
|
+
**Good contexts:**
|
|
28
|
+
```
|
|
29
|
+
Context: User just implemented a new authentication feature
|
|
30
|
+
Context: User has created a PR and wants it reviewed
|
|
31
|
+
Context: User is debugging a test failure
|
|
32
|
+
Context: After writing several functions without documentation
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Bad contexts:**
|
|
36
|
+
```
|
|
37
|
+
Context: User needs help (too vague)
|
|
38
|
+
Context: Normal usage (not specific)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### User Message
|
|
42
|
+
|
|
43
|
+
**Purpose:** Show the exact phrasing that should trigger the agent
|
|
44
|
+
|
|
45
|
+
**Good user messages:**
|
|
46
|
+
```
|
|
47
|
+
user: "I've added the OAuth flow, can you check it?"
|
|
48
|
+
user: "Review PR #123"
|
|
49
|
+
user: "Why is this test failing?"
|
|
50
|
+
user: "Add docs for these functions"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Vary the phrasing:**
|
|
54
|
+
Include multiple examples with different phrasings for the same intent:
|
|
55
|
+
```
|
|
56
|
+
Example 1: user: "Review my code"
|
|
57
|
+
Example 2: user: "Can you check this implementation?"
|
|
58
|
+
Example 3: user: "Look over my changes"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Assistant Response (Before Triggering)
|
|
62
|
+
|
|
63
|
+
**Purpose:** Show what Claude says before launching the agent
|
|
64
|
+
|
|
65
|
+
**Good responses:**
|
|
66
|
+
```
|
|
67
|
+
assistant: "I'll analyze your OAuth implementation."
|
|
68
|
+
assistant: "Let me review that PR for you."
|
|
69
|
+
assistant: "I'll investigate the test failure."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Proactive example:**
|
|
73
|
+
```
|
|
74
|
+
assistant: "Great! Now let me review the code quality."
|
|
75
|
+
<commentary>
|
|
76
|
+
Code was just written, proactively trigger review agent.
|
|
77
|
+
</commentary>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Commentary
|
|
81
|
+
|
|
82
|
+
**Purpose:** Explain the reasoning - WHY this agent should trigger
|
|
83
|
+
|
|
84
|
+
**Good commentary:**
|
|
85
|
+
```
|
|
86
|
+
<commentary>
|
|
87
|
+
User explicitly requested code review, trigger the code-reviewer agent.
|
|
88
|
+
</commentary>
|
|
89
|
+
|
|
90
|
+
<commentary>
|
|
91
|
+
After code implementation, proactively use review agent to check quality.
|
|
92
|
+
</commentary>
|
|
93
|
+
|
|
94
|
+
<commentary>
|
|
95
|
+
PR analysis request matches pr-analyzer agent's expertise.
|
|
96
|
+
</commentary>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Include decision logic:**
|
|
100
|
+
```
|
|
101
|
+
<commentary>
|
|
102
|
+
User wrote tests (Test tool used). The test-analyzer agent should check
|
|
103
|
+
test quality and coverage before continuing.
|
|
104
|
+
</commentary>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Assistant Response (Triggering)
|
|
108
|
+
|
|
109
|
+
**Purpose:** Show how Claude invokes the agent
|
|
110
|
+
|
|
111
|
+
**Standard pattern:**
|
|
112
|
+
```
|
|
113
|
+
assistant: "I'll use the [agent-name] agent to [what it will do]."
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Examples:**
|
|
117
|
+
```
|
|
118
|
+
assistant: "I'll use the code-reviewer agent to analyze the changes."
|
|
119
|
+
assistant: "Let me use the test-generator agent to create comprehensive tests."
|
|
120
|
+
assistant: "I'll use the security-analyzer agent to check for vulnerabilities."
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Example Types
|
|
124
|
+
|
|
125
|
+
### Type 1: Explicit Request
|
|
126
|
+
|
|
127
|
+
User directly asks for what the agent does:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
<example>
|
|
131
|
+
Context: User explicitly requests security analysis
|
|
132
|
+
user: "Check my code for security vulnerabilities"
|
|
133
|
+
assistant: "I'll use the security-analyzer agent to perform a thorough security review."
|
|
134
|
+
<commentary>
|
|
135
|
+
Direct security analysis request triggers the security-analyzer agent.
|
|
136
|
+
</commentary>
|
|
137
|
+
</example>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Type 2: Proactive Triggering
|
|
141
|
+
|
|
142
|
+
Agent triggers after relevant work without explicit request:
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
<example>
|
|
146
|
+
Context: User just implemented database queries
|
|
147
|
+
user: "I've added the user search functionality"
|
|
148
|
+
assistant: "Great! Let me review it for security."
|
|
149
|
+
<commentary>
|
|
150
|
+
Database code written. Proactively trigger security-analyzer to check
|
|
151
|
+
for SQL injection and other database security issues.
|
|
152
|
+
</commentary>
|
|
153
|
+
assistant: "I'll use the security-analyzer agent to check the database code."
|
|
154
|
+
</example>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Type 3: Implicit Request
|
|
158
|
+
|
|
159
|
+
User implies need without stating it directly:
|
|
160
|
+
|
|
161
|
+
```markdown
|
|
162
|
+
<example>
|
|
163
|
+
Context: User mentions code is hard to understand
|
|
164
|
+
user: "This code is confusing and hard to follow"
|
|
165
|
+
assistant: "I can help improve the code clarity."
|
|
166
|
+
<commentary>
|
|
167
|
+
User indicates complexity issues. Trigger code-simplifier agent to refactor
|
|
168
|
+
for better readability.
|
|
169
|
+
</commentary>
|
|
170
|
+
assistant: "I'll use the code-simplifier agent to suggest improvements."
|
|
171
|
+
</example>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Type 4: Tool Usage Pattern
|
|
175
|
+
|
|
176
|
+
Agent triggers based on prior tool usage:
|
|
177
|
+
|
|
178
|
+
```markdown
|
|
179
|
+
<example>
|
|
180
|
+
Context: User made multiple edits to test files
|
|
181
|
+
user: "I've updated all the tests"
|
|
182
|
+
assistant: "Great! Let me verify test quality."
|
|
183
|
+
<commentary>
|
|
184
|
+
Multiple Edit tools used on test files. Proactively trigger test-quality-analyzer
|
|
185
|
+
to ensure tests follow best practices.
|
|
186
|
+
</commentary>
|
|
187
|
+
assistant: "I'll use the test-quality-analyzer agent to review the tests."
|
|
188
|
+
</example>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Multiple Examples Strategy
|
|
192
|
+
|
|
193
|
+
### Cover Different Phrasings
|
|
194
|
+
|
|
195
|
+
```markdown
|
|
196
|
+
<example>
|
|
197
|
+
user: "Review my code"
|
|
198
|
+
[...]
|
|
199
|
+
</example>
|
|
200
|
+
|
|
201
|
+
<example>
|
|
202
|
+
user: "Can you check my implementation?"
|
|
203
|
+
[...]
|
|
204
|
+
</example>
|
|
205
|
+
|
|
206
|
+
<example>
|
|
207
|
+
user: "Look over these changes"
|
|
208
|
+
[...]
|
|
209
|
+
</example>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Cover Proactive and Reactive
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
<example>
|
|
216
|
+
Context: User explicitly requests review
|
|
217
|
+
user: "Review my code for issues"
|
|
218
|
+
[...]
|
|
219
|
+
</example>
|
|
220
|
+
|
|
221
|
+
<example>
|
|
222
|
+
Context: After user writes code
|
|
223
|
+
user: "I've implemented the feature"
|
|
224
|
+
assistant: "Great! Now let me review it."
|
|
225
|
+
<commentary>
|
|
226
|
+
Code written, proactively review.
|
|
227
|
+
</commentary>
|
|
228
|
+
[...]
|
|
229
|
+
</example>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Cover Edge Cases
|
|
233
|
+
|
|
234
|
+
```markdown
|
|
235
|
+
<example>
|
|
236
|
+
Context: Typical usage
|
|
237
|
+
user: "Check my PR"
|
|
238
|
+
[...]
|
|
239
|
+
</example>
|
|
240
|
+
|
|
241
|
+
<example>
|
|
242
|
+
Context: Large PR that needs thorough analysis
|
|
243
|
+
user: "This is a big PR, can you do a deep review?"
|
|
244
|
+
[...]
|
|
245
|
+
<commentary>
|
|
246
|
+
Large PR mentioned, use thorough analysis mode.
|
|
247
|
+
</commentary>
|
|
248
|
+
</example>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Common Mistakes
|
|
252
|
+
|
|
253
|
+
### ❌ Missing Context
|
|
254
|
+
|
|
255
|
+
```markdown
|
|
256
|
+
<example>
|
|
257
|
+
user: "Review my code"
|
|
258
|
+
assistant: "I'll use the code-reviewer agent."
|
|
259
|
+
</example>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Why bad:** No context about what led to this request.
|
|
263
|
+
|
|
264
|
+
### ✅ With Context
|
|
265
|
+
|
|
266
|
+
```markdown
|
|
267
|
+
<example>
|
|
268
|
+
Context: User just finished implementing authentication
|
|
269
|
+
user: "Review my code"
|
|
270
|
+
assistant: "I'll use the code-reviewer agent to analyze the auth implementation."
|
|
271
|
+
<commentary>
|
|
272
|
+
Auth code written, review for security and best practices.
|
|
273
|
+
</commentary>
|
|
274
|
+
</example>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### ❌ No Commentary
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
<example>
|
|
281
|
+
Context: User requests review
|
|
282
|
+
user: "Check my changes"
|
|
283
|
+
assistant: "I'll use the reviewer agent."
|
|
284
|
+
</example>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Why bad:** Doesn't explain WHY agent triggers.
|
|
288
|
+
|
|
289
|
+
### ✅ With Commentary
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
<example>
|
|
293
|
+
Context: User requests review after making changes
|
|
294
|
+
user: "Check my changes"
|
|
295
|
+
assistant: "I'll use the code-reviewer agent to analyze the modifications."
|
|
296
|
+
<commentary>
|
|
297
|
+
Code review request triggers agent to check quality, security, and adherence to standards.
|
|
298
|
+
</commentary>
|
|
299
|
+
</example>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### ❌ Agent Responds Directly
|
|
303
|
+
|
|
304
|
+
```markdown
|
|
305
|
+
<example>
|
|
306
|
+
user: "Review my code"
|
|
307
|
+
assistant: "I found the following issues: [lists issues]"
|
|
308
|
+
</example>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Why bad:** Shows agent's output, not triggering.
|
|
312
|
+
|
|
313
|
+
### ✅ Shows Triggering
|
|
314
|
+
|
|
315
|
+
```markdown
|
|
316
|
+
<example>
|
|
317
|
+
user: "Review my code"
|
|
318
|
+
assistant: "I'll use the code-reviewer agent to perform the review."
|
|
319
|
+
<commentary>
|
|
320
|
+
Review request triggers the agent.
|
|
321
|
+
</commentary>
|
|
322
|
+
</example>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## How Many Examples?
|
|
326
|
+
|
|
327
|
+
### Minimum: 2 Examples
|
|
328
|
+
|
|
329
|
+
Cover at least:
|
|
330
|
+
1. Explicit request
|
|
331
|
+
2. One variation or proactive trigger
|
|
332
|
+
|
|
333
|
+
### Recommended: 3-4 Examples
|
|
334
|
+
|
|
335
|
+
Cover:
|
|
336
|
+
1. Explicit request (direct ask)
|
|
337
|
+
2. Implicit request (user implies need)
|
|
338
|
+
3. Proactive trigger (after relevant work)
|
|
339
|
+
4. Edge case or specific scenario
|
|
340
|
+
|
|
341
|
+
### Maximum: 6 Examples
|
|
342
|
+
|
|
343
|
+
More than 6 makes description too long. Focus on most important scenarios.
|
|
344
|
+
|
|
345
|
+
## Template Library
|
|
346
|
+
|
|
347
|
+
### Code Review Agent
|
|
348
|
+
|
|
349
|
+
```markdown
|
|
350
|
+
<example>
|
|
351
|
+
Context: User just implemented a new feature
|
|
352
|
+
user: "I've added the user registration feature"
|
|
353
|
+
assistant: "Great! Let me review the code quality."
|
|
354
|
+
<commentary>
|
|
355
|
+
Code written, proactively trigger code-reviewer agent.
|
|
356
|
+
</commentary>
|
|
357
|
+
assistant: "I'll use the code-reviewer agent to analyze the implementation."
|
|
358
|
+
</example>
|
|
359
|
+
|
|
360
|
+
<example>
|
|
361
|
+
Context: User explicitly requests review
|
|
362
|
+
user: "Can you review my changes for issues?"
|
|
363
|
+
assistant: "I'll use the code-reviewer agent to perform a thorough review."
|
|
364
|
+
<commentary>
|
|
365
|
+
Explicit review request triggers the agent.
|
|
366
|
+
</commentary>
|
|
367
|
+
</example>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Test Generation Agent
|
|
371
|
+
|
|
372
|
+
```markdown
|
|
373
|
+
<example>
|
|
374
|
+
Context: User implemented functions without tests
|
|
375
|
+
user: "I've added the data processing functions"
|
|
376
|
+
assistant: "Great! Let me generate tests for these."
|
|
377
|
+
<commentary>
|
|
378
|
+
New code without tests, proactively trigger test-generator agent.
|
|
379
|
+
</commentary>
|
|
380
|
+
assistant: "I'll use the test-generator agent to create comprehensive tests."
|
|
381
|
+
</example>
|
|
382
|
+
|
|
383
|
+
<example>
|
|
384
|
+
Context: User explicitly asks for tests
|
|
385
|
+
user: "Generate tests for my code"
|
|
386
|
+
assistant: "I'll use the test-generator agent to create a complete test suite."
|
|
387
|
+
<commentary>
|
|
388
|
+
Direct test generation request triggers the agent.
|
|
389
|
+
</commentary>
|
|
390
|
+
</example>
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Documentation Agent
|
|
394
|
+
|
|
395
|
+
```markdown
|
|
396
|
+
<example>
|
|
397
|
+
Context: User added new API endpoints
|
|
398
|
+
user: "I've implemented the REST API endpoints"
|
|
399
|
+
assistant: "I'll document these endpoints."
|
|
400
|
+
<commentary>
|
|
401
|
+
New API code, proactively generate documentation.
|
|
402
|
+
</commentary>
|
|
403
|
+
assistant: "I'll use the api-docs-writer agent to create comprehensive documentation."
|
|
404
|
+
</example>
|
|
405
|
+
|
|
406
|
+
<example>
|
|
407
|
+
Context: User requests documentation
|
|
408
|
+
user: "Write docs for this API"
|
|
409
|
+
assistant: "I'll use the api-docs-writer agent to generate clear documentation."
|
|
410
|
+
<commentary>
|
|
411
|
+
Documentation request triggers the agent.
|
|
412
|
+
</commentary>
|
|
413
|
+
</example>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Validation Agent
|
|
417
|
+
|
|
418
|
+
```markdown
|
|
419
|
+
<example>
|
|
420
|
+
Context: User ready to commit changes
|
|
421
|
+
user: "I'm ready to commit this code"
|
|
422
|
+
assistant: "Let me validate it first."
|
|
423
|
+
<commentary>
|
|
424
|
+
Before commit, proactively validate with validation-agent.
|
|
425
|
+
</commentary>
|
|
426
|
+
assistant: "I'll use the code-validator agent to check for issues."
|
|
427
|
+
</example>
|
|
428
|
+
|
|
429
|
+
<example>
|
|
430
|
+
Context: User asks for validation
|
|
431
|
+
user: "Validate my implementation"
|
|
432
|
+
assistant: "I'll use the code-validator agent to verify correctness."
|
|
433
|
+
<commentary>
|
|
434
|
+
Explicit validation request triggers the agent.
|
|
435
|
+
</commentary>
|
|
436
|
+
</example>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Debugging Triggering Issues
|
|
440
|
+
|
|
441
|
+
### Agent Not Triggering
|
|
442
|
+
|
|
443
|
+
**Check:**
|
|
444
|
+
1. Examples include relevant keywords from user message
|
|
445
|
+
2. Context matches actual usage scenarios
|
|
446
|
+
3. Commentary explains triggering logic clearly
|
|
447
|
+
4. Assistant shows use of Agent tool in examples
|
|
448
|
+
|
|
449
|
+
**Fix:**
|
|
450
|
+
Add more examples covering different phrasings.
|
|
451
|
+
|
|
452
|
+
### Agent Triggers Too Often
|
|
453
|
+
|
|
454
|
+
**Check:**
|
|
455
|
+
1. Examples are too broad or generic
|
|
456
|
+
2. Triggering conditions overlap with other agents
|
|
457
|
+
3. Commentary doesn't distinguish when NOT to use
|
|
458
|
+
|
|
459
|
+
**Fix:**
|
|
460
|
+
Make examples more specific, add negative examples.
|
|
461
|
+
|
|
462
|
+
### Agent Triggers in Wrong Scenarios
|
|
463
|
+
|
|
464
|
+
**Check:**
|
|
465
|
+
1. Examples don't match actual intended use
|
|
466
|
+
2. Commentary suggests inappropriate triggering
|
|
467
|
+
|
|
468
|
+
**Fix:**
|
|
469
|
+
Revise examples to show only correct triggering scenarios.
|
|
470
|
+
|
|
471
|
+
## Best Practices Summary
|
|
472
|
+
|
|
473
|
+
✅ **DO:**
|
|
474
|
+
- Include 2-4 concrete, specific examples
|
|
475
|
+
- Show both explicit and proactive triggering
|
|
476
|
+
- Provide clear context for each example
|
|
477
|
+
- Explain reasoning in commentary
|
|
478
|
+
- Vary user message phrasing
|
|
479
|
+
- Show Claude using Agent tool
|
|
480
|
+
|
|
481
|
+
❌ **DON'T:**
|
|
482
|
+
- Use generic, vague examples
|
|
483
|
+
- Omit context or commentary
|
|
484
|
+
- Show only one type of triggering
|
|
485
|
+
- Skip the agent invocation step
|
|
486
|
+
- Make examples too similar
|
|
487
|
+
- Forget to explain why agent triggers
|
|
488
|
+
|
|
489
|
+
## Conclusion
|
|
490
|
+
|
|
491
|
+
Well-crafted examples are crucial for reliable agent triggering. Invest time in creating diverse, specific examples that clearly demonstrate when and why the agent should be used.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Agent File Validator
|
|
3
|
+
# Validates agent markdown files for correct structure and content
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
# Usage
|
|
8
|
+
if [ $# -eq 0 ]; then
|
|
9
|
+
echo "Usage: $0 <path/to/agent.md>"
|
|
10
|
+
echo ""
|
|
11
|
+
echo "Validates agent file for:"
|
|
12
|
+
echo " - YAML frontmatter structure"
|
|
13
|
+
echo " - Required fields (name, description, model, color)"
|
|
14
|
+
echo " - Field formats and constraints"
|
|
15
|
+
echo " - System prompt presence and length"
|
|
16
|
+
echo " - Example blocks in description"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
AGENT_FILE="$1"
|
|
21
|
+
|
|
22
|
+
echo "🔍 Validating agent file: $AGENT_FILE"
|
|
23
|
+
echo ""
|
|
24
|
+
|
|
25
|
+
# Check 1: File exists
|
|
26
|
+
if [ ! -f "$AGENT_FILE" ]; then
|
|
27
|
+
echo "❌ File not found: $AGENT_FILE"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
echo "✅ File exists"
|
|
31
|
+
|
|
32
|
+
# Check 2: Starts with ---
|
|
33
|
+
FIRST_LINE=$(head -1 "$AGENT_FILE")
|
|
34
|
+
if [ "$FIRST_LINE" != "---" ]; then
|
|
35
|
+
echo "❌ File must start with YAML frontmatter (---)"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
echo "✅ Starts with frontmatter"
|
|
39
|
+
|
|
40
|
+
# Check 3: Has closing ---
|
|
41
|
+
if ! tail -n +2 "$AGENT_FILE" | grep -q '^---$'; then
|
|
42
|
+
echo "❌ Frontmatter not closed (missing second ---)"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
echo "✅ Frontmatter properly closed"
|
|
46
|
+
|
|
47
|
+
# Extract frontmatter and system prompt
|
|
48
|
+
FRONTMATTER=$(sed -n '/^---$/,/^---$/{ /^---$/d; p; }' "$AGENT_FILE")
|
|
49
|
+
SYSTEM_PROMPT=$(awk '/^---$/{i++; next} i>=2' "$AGENT_FILE")
|
|
50
|
+
|
|
51
|
+
# Check 4: Required fields
|
|
52
|
+
echo ""
|
|
53
|
+
echo "Checking required fields..."
|
|
54
|
+
|
|
55
|
+
error_count=0
|
|
56
|
+
warning_count=0
|
|
57
|
+
|
|
58
|
+
# Check name field
|
|
59
|
+
NAME=$(echo "$FRONTMATTER" | grep '^name:' | sed 's/name: *//' | sed 's/^"\(.*\)"$/\1/')
|
|
60
|
+
|
|
61
|
+
if [ -z "$NAME" ]; then
|
|
62
|
+
echo "❌ Missing required field: name"
|
|
63
|
+
((error_count++))
|
|
64
|
+
else
|
|
65
|
+
echo "✅ name: $NAME"
|
|
66
|
+
|
|
67
|
+
# Validate name format
|
|
68
|
+
if ! [[ "$NAME" =~ ^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$ ]]; then
|
|
69
|
+
echo "❌ name must start/end with alphanumeric and contain only letters, numbers, hyphens"
|
|
70
|
+
((error_count++))
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Validate name length
|
|
74
|
+
name_length=${#NAME}
|
|
75
|
+
if [ $name_length -lt 3 ]; then
|
|
76
|
+
echo "❌ name too short (minimum 3 characters)"
|
|
77
|
+
((error_count++))
|
|
78
|
+
elif [ $name_length -gt 50 ]; then
|
|
79
|
+
echo "❌ name too long (maximum 50 characters)"
|
|
80
|
+
((error_count++))
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# Check for generic names
|
|
84
|
+
if [[ "$NAME" =~ ^(helper|assistant|agent|tool)$ ]]; then
|
|
85
|
+
echo "⚠️ name is too generic: $NAME"
|
|
86
|
+
((warning_count++))
|
|
87
|
+
fi
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Check description field
|
|
91
|
+
DESCRIPTION=$(echo "$FRONTMATTER" | grep '^description:' | sed 's/description: *//')
|
|
92
|
+
|
|
93
|
+
if [ -z "$DESCRIPTION" ]; then
|
|
94
|
+
echo "❌ Missing required field: description"
|
|
95
|
+
((error_count++))
|
|
96
|
+
else
|
|
97
|
+
desc_length=${#DESCRIPTION}
|
|
98
|
+
echo "✅ description: ${desc_length} characters"
|
|
99
|
+
|
|
100
|
+
if [ $desc_length -lt 10 ]; then
|
|
101
|
+
echo "⚠️ description too short (minimum 10 characters recommended)"
|
|
102
|
+
((warning_count++))
|
|
103
|
+
elif [ $desc_length -gt 5000 ]; then
|
|
104
|
+
echo "⚠️ description very long (over 5000 characters)"
|
|
105
|
+
((warning_count++))
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
# Check for example blocks
|
|
109
|
+
if ! echo "$DESCRIPTION" | grep -q '<example>'; then
|
|
110
|
+
echo "⚠️ description should include <example> blocks for triggering"
|
|
111
|
+
((warning_count++))
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# Check for "Use this agent when" pattern
|
|
115
|
+
if ! echo "$DESCRIPTION" | grep -qi 'use this agent when'; then
|
|
116
|
+
echo "⚠️ description should start with 'Use this agent when...'"
|
|
117
|
+
((warning_count++))
|
|
118
|
+
fi
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Check model field
|
|
122
|
+
MODEL=$(echo "$FRONTMATTER" | grep '^model:' | sed 's/model: *//')
|
|
123
|
+
|
|
124
|
+
if [ -z "$MODEL" ]; then
|
|
125
|
+
echo "❌ Missing required field: model"
|
|
126
|
+
((error_count++))
|
|
127
|
+
else
|
|
128
|
+
echo "✅ model: $MODEL"
|
|
129
|
+
|
|
130
|
+
case "$MODEL" in
|
|
131
|
+
inherit|sonnet|opus|haiku)
|
|
132
|
+
# Valid model
|
|
133
|
+
;;
|
|
134
|
+
*)
|
|
135
|
+
echo "⚠️ Unknown model: $MODEL (valid: inherit, sonnet, opus, haiku)"
|
|
136
|
+
((warning_count++))
|
|
137
|
+
;;
|
|
138
|
+
esac
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
# Check color field
|
|
142
|
+
COLOR=$(echo "$FRONTMATTER" | grep '^color:' | sed 's/color: *//')
|
|
143
|
+
|
|
144
|
+
if [ -z "$COLOR" ]; then
|
|
145
|
+
echo "❌ Missing required field: color"
|
|
146
|
+
((error_count++))
|
|
147
|
+
else
|
|
148
|
+
echo "✅ color: $COLOR"
|
|
149
|
+
|
|
150
|
+
case "$COLOR" in
|
|
151
|
+
blue|cyan|green|yellow|magenta|red)
|
|
152
|
+
# Valid color
|
|
153
|
+
;;
|
|
154
|
+
*)
|
|
155
|
+
echo "⚠️ Unknown color: $COLOR (valid: blue, cyan, green, yellow, magenta, red)"
|
|
156
|
+
((warning_count++))
|
|
157
|
+
;;
|
|
158
|
+
esac
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
# Check tools field (optional)
|
|
162
|
+
TOOLS=$(echo "$FRONTMATTER" | grep '^tools:' | sed 's/tools: *//')
|
|
163
|
+
|
|
164
|
+
if [ -n "$TOOLS" ]; then
|
|
165
|
+
echo "✅ tools: $TOOLS"
|
|
166
|
+
else
|
|
167
|
+
echo "💡 tools: not specified (agent has access to all tools)"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Check 5: System prompt
|
|
171
|
+
echo ""
|
|
172
|
+
echo "Checking system prompt..."
|
|
173
|
+
|
|
174
|
+
if [ -z "$SYSTEM_PROMPT" ]; then
|
|
175
|
+
echo "❌ System prompt is empty"
|
|
176
|
+
((error_count++))
|
|
177
|
+
else
|
|
178
|
+
prompt_length=${#SYSTEM_PROMPT}
|
|
179
|
+
echo "✅ System prompt: $prompt_length characters"
|
|
180
|
+
|
|
181
|
+
if [ $prompt_length -lt 20 ]; then
|
|
182
|
+
echo "❌ System prompt too short (minimum 20 characters)"
|
|
183
|
+
((error_count++))
|
|
184
|
+
elif [ $prompt_length -gt 10000 ]; then
|
|
185
|
+
echo "⚠️ System prompt very long (over 10,000 characters)"
|
|
186
|
+
((warning_count++))
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
# Check for second person
|
|
190
|
+
if ! echo "$SYSTEM_PROMPT" | grep -q "You are\|You will\|Your"; then
|
|
191
|
+
echo "⚠️ System prompt should use second person (You are..., You will...)"
|
|
192
|
+
((warning_count++))
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
# Check for structure
|
|
196
|
+
if ! echo "$SYSTEM_PROMPT" | grep -qi "responsibilities\|process\|steps"; then
|
|
197
|
+
echo "💡 Consider adding clear responsibilities or process steps"
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
if ! echo "$SYSTEM_PROMPT" | grep -qi "output"; then
|
|
201
|
+
echo "💡 Consider defining output format expectations"
|
|
202
|
+
fi
|
|
203
|
+
fi
|
|
204
|
+
|
|
205
|
+
echo ""
|
|
206
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
207
|
+
|
|
208
|
+
if [ $error_count -eq 0 ] && [ $warning_count -eq 0 ]; then
|
|
209
|
+
echo "✅ All checks passed!"
|
|
210
|
+
exit 0
|
|
211
|
+
elif [ $error_count -eq 0 ]; then
|
|
212
|
+
echo "⚠️ Validation passed with $warning_count warning(s)"
|
|
213
|
+
exit 0
|
|
214
|
+
else
|
|
215
|
+
echo "❌ Validation failed with $error_count error(s) and $warning_count warning(s)"
|
|
216
|
+
exit 1
|
|
217
|
+
fi
|