@softspark/ai-toolkit 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/AGENTS.md +5 -29
  2. package/CHANGELOG.md +39 -0
  3. package/README.md +170 -27
  4. package/app/.claude-plugin/plugin.json +2 -2
  5. package/app/ARCHITECTURE.md +35 -19
  6. package/app/agents/ai-engineer.md +47 -5
  7. package/app/agents/fact-checker.md +1 -1
  8. package/app/agents/llm-ops-engineer.md +2 -2
  9. package/app/agents/{mcp-server-architect.md → mcp-specialist.md} +124 -18
  10. package/app/agents/mcp-testing-engineer.md +2 -2
  11. package/app/agents/nlp-engineer.md +1 -1
  12. package/app/agents/orchestrator.md +3 -4
  13. package/app/agents/project-planner.md +1 -1
  14. package/app/agents/technical-researcher.md +71 -21
  15. package/app/hooks/commit-quality.sh +53 -0
  16. package/app/hooks/governance-capture.sh +77 -0
  17. package/app/hooks/guard-config.sh +46 -0
  18. package/app/hooks/mcp-health.sh +53 -0
  19. package/app/hooks/pre-compact-save.sh +34 -0
  20. package/app/hooks/session-context.sh +60 -0
  21. package/app/hooks.json +60 -0
  22. package/app/mcp-templates/README.md +105 -0
  23. package/app/mcp-templates/brave-search.json +13 -0
  24. package/app/mcp-templates/cloudflare.json +14 -0
  25. package/app/mcp-templates/context7.json +10 -0
  26. package/app/mcp-templates/custom-template.json +13 -0
  27. package/app/mcp-templates/datadog.json +15 -0
  28. package/app/mcp-templates/docker.json +10 -0
  29. package/app/mcp-templates/fetch.json +10 -0
  30. package/app/mcp-templates/filesystem.json +10 -0
  31. package/app/mcp-templates/git.json +10 -0
  32. package/app/mcp-templates/github.json +13 -0
  33. package/app/mcp-templates/google-drive.json +15 -0
  34. package/app/mcp-templates/google-maps.json +13 -0
  35. package/app/mcp-templates/grafana.json +14 -0
  36. package/app/mcp-templates/linear.json +13 -0
  37. package/app/mcp-templates/memory.json +10 -0
  38. package/app/mcp-templates/notion.json +13 -0
  39. package/app/mcp-templates/postgres.json +10 -0
  40. package/app/mcp-templates/puppeteer.json +10 -0
  41. package/app/mcp-templates/redis.json +13 -0
  42. package/app/mcp-templates/sentry.json +14 -0
  43. package/app/mcp-templates/sequential-thinking.json +10 -0
  44. package/app/mcp-templates/slack.json +14 -0
  45. package/app/mcp-templates/sqlite.json +10 -0
  46. package/app/mcp-templates/supabase.json +14 -0
  47. package/app/mcp-templates/vercel.json +13 -0
  48. package/app/plugins/research-pack/README.md +1 -1
  49. package/app/plugins/research-pack/plugin.json +1 -1
  50. package/app/rules/claude-toolkit-rules.md +1 -1
  51. package/app/rules/common/coding-style.md +52 -0
  52. package/app/rules/common/git-workflow.md +45 -0
  53. package/app/rules/common/performance.md +49 -0
  54. package/app/rules/common/security.md +59 -0
  55. package/app/rules/common/testing.md +53 -0
  56. package/app/rules/cpp/coding-style.md +55 -0
  57. package/app/rules/cpp/frameworks.md +55 -0
  58. package/app/rules/cpp/patterns.md +57 -0
  59. package/app/rules/cpp/security.md +61 -0
  60. package/app/rules/cpp/testing.md +58 -0
  61. package/app/rules/csharp/coding-style.md +54 -0
  62. package/app/rules/csharp/frameworks.md +60 -0
  63. package/app/rules/csharp/patterns.md +61 -0
  64. package/app/rules/csharp/security.md +60 -0
  65. package/app/rules/csharp/testing.md +58 -0
  66. package/app/rules/dart/coding-style.md +61 -0
  67. package/app/rules/dart/frameworks.md +59 -0
  68. package/app/rules/dart/patterns.md +62 -0
  69. package/app/rules/dart/security.md +60 -0
  70. package/app/rules/dart/testing.md +60 -0
  71. package/app/rules/golang/coding-style.md +50 -0
  72. package/app/rules/golang/frameworks.md +56 -0
  73. package/app/rules/golang/patterns.md +52 -0
  74. package/app/rules/golang/security.md +61 -0
  75. package/app/rules/golang/testing.md +54 -0
  76. package/app/rules/java/coding-style.md +56 -0
  77. package/app/rules/java/frameworks.md +54 -0
  78. package/app/rules/java/patterns.md +59 -0
  79. package/app/rules/java/security.md +60 -0
  80. package/app/rules/java/testing.md +55 -0
  81. package/app/rules/kotlin/coding-style.md +56 -0
  82. package/app/rules/kotlin/frameworks.md +54 -0
  83. package/app/rules/kotlin/patterns.md +54 -0
  84. package/app/rules/kotlin/security.md +62 -0
  85. package/app/rules/kotlin/testing.md +56 -0
  86. package/app/rules/php/coding-style.md +53 -0
  87. package/app/rules/php/frameworks.md +57 -0
  88. package/app/rules/php/patterns.md +63 -0
  89. package/app/rules/php/security.md +61 -0
  90. package/app/rules/php/testing.md +60 -0
  91. package/app/rules/python/coding-style.md +52 -0
  92. package/app/rules/python/frameworks.md +53 -0
  93. package/app/rules/python/patterns.md +53 -0
  94. package/app/rules/python/security.md +58 -0
  95. package/app/rules/python/testing.md +52 -0
  96. package/app/rules/ruby/coding-style.md +56 -0
  97. package/app/rules/ruby/frameworks.md +56 -0
  98. package/app/rules/ruby/patterns.md +61 -0
  99. package/app/rules/ruby/security.md +61 -0
  100. package/app/rules/ruby/testing.md +63 -0
  101. package/app/rules/rust/coding-style.md +52 -0
  102. package/app/rules/rust/frameworks.md +59 -0
  103. package/app/rules/rust/patterns.md +58 -0
  104. package/app/rules/rust/security.md +64 -0
  105. package/app/rules/rust/testing.md +54 -0
  106. package/app/rules/swift/coding-style.md +55 -0
  107. package/app/rules/swift/frameworks.md +63 -0
  108. package/app/rules/swift/patterns.md +63 -0
  109. package/app/rules/swift/security.md +63 -0
  110. package/app/rules/swift/testing.md +60 -0
  111. package/app/rules/typescript/coding-style.md +51 -0
  112. package/app/rules/typescript/frameworks.md +51 -0
  113. package/app/rules/typescript/patterns.md +51 -0
  114. package/app/rules/typescript/security.md +55 -0
  115. package/app/rules/typescript/testing.md +52 -0
  116. package/app/skills/app-builder/SKILL.md +1 -1
  117. package/app/skills/brand-voice/SKILL.md +92 -0
  118. package/app/skills/council/SKILL.md +133 -0
  119. package/app/skills/introspect/SKILL.md +125 -0
  120. package/bin/ai-toolkit.js +103 -2
  121. package/kb/reference/agents-catalog.md +10 -13
  122. package/kb/reference/architecture-overview.md +29 -6
  123. package/kb/reference/commands-catalog.md +4 -4
  124. package/kb/reference/competitive-features-implementation.md +677 -0
  125. package/kb/reference/extension-api.md +175 -0
  126. package/kb/reference/hooks-catalog.md +90 -14
  127. package/kb/reference/language-rules.md +167 -0
  128. package/kb/reference/manifest-install.md +165 -0
  129. package/kb/reference/mcp-templates.md +110 -0
  130. package/kb/reference/skills-catalog.md +9 -6
  131. package/llms-full.txt +1511 -59
  132. package/llms.txt +8 -3
  133. package/package.json +2 -2
  134. package/scripts/inject_hook_cli.py +330 -0
  135. package/scripts/install.py +241 -7
  136. package/scripts/install_steps/ai_tools.py +63 -1
  137. package/scripts/install_steps/detect_language.py +50 -0
  138. package/scripts/install_steps/install_state.py +117 -0
  139. package/scripts/mcp_manager.py +206 -0
  140. package/app/agents/mcp-expert.md +0 -228
  141. package/app/agents/rag-engineer.md +0 -201
  142. package/app/agents/research-synthesizer.md +0 -138
package/llms-full.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # ai-toolkit
2
2
 
3
- > Professional-grade Claude Code toolkit: 85 skills, 47 agents, machine-enforced constitution, quality hooks.
3
+ > Professional-grade Claude Code toolkit: 90 skills, 44 agents, machine-enforced constitution, quality hooks.
4
4
 
5
5
  ## Documentation
6
6
 
@@ -14,7 +14,7 @@
14
14
  - [Best Practices](kb/best-practices/README.md)
15
15
  - [How-To Guides](kb/howto/README.md)
16
16
  - [SOP: Claude Toolkit Maintenance](kb/procedures/maintenance-sop.md)
17
- - [Agents Catalog (47 agents)](kb/reference/agents-catalog.md)
17
+ - [Agents Catalog (44 agents)](kb/reference/agents-catalog.md)
18
18
  - [Anti-Pattern Registry Format](kb/reference/anti-pattern-registry-format.md)
19
19
  - [AI Toolkit Architecture](kb/reference/architecture-overview.md)
20
20
  - [Config Benchmark](kb/reference/benchmark-config.md)
@@ -22,17 +22,22 @@
22
22
  - [Claude Ecosystem Benchmark Snapshot](kb/reference/claude-ecosystem-benchmark-snapshot.md)
23
23
  - [Claude Ecosystem Expansion Foundations](kb/reference/claude-ecosystem-expansion-foundations.md)
24
24
  - [Commands Catalog (DEPRECATED)](kb/reference/commands-catalog.md)
25
+ - [Plan: Competitive Features — ai-toolkit](kb/reference/competitive-features-implementation.md)
25
26
  - [Distribution Model](kb/reference/distribution-model.md)
27
+ - [Extension API Reference](kb/reference/extension-api.md)
26
28
  - [Global Install Model](kb/reference/global-install-model.md)
27
29
  - [Hierarchical Override Pattern](kb/reference/hierarchical-override-pattern.md)
28
30
  - [Hooks Catalog](kb/reference/hooks-catalog.md)
29
31
  - [External Integrations](kb/reference/integrations.md)
30
32
  - [Language Plugin Packs](kb/reference/language-packs.md)
33
+ - [Language Rules System](kb/reference/language-rules.md)
34
+ - [Manifest-Driven Install System](kb/reference/manifest-install.md)
35
+ - [MCP Server Templates](kb/reference/mcp-templates.md)
31
36
  - [Merge-Friendly Install Model](kb/reference/merge-friendly-install-model.md)
32
37
  - [Plugin Pack Conventions](kb/reference/plugin-pack-conventions.md)
33
38
  - [Quick Wins Implementation Summary](kb/reference/quick-wins-implementation-summary.md)
34
39
  - [Skill Templates](kb/reference/skill-templates.md)
35
- - [Skills Catalog (85 skills)](kb/reference/skills-catalog.md)
40
+ - [Skills Catalog (90 skills)](kb/reference/skills-catalog.md)
36
41
  - [Skills Unification Model](kb/reference/skills-unification.md)
37
42
  - [Usage Statistics](kb/reference/stats.md)
38
43
  - [Config Sync](kb/reference/sync.md)
@@ -47,6 +52,7 @@
47
52
  - **architecture-audit**: Explore codebase organically for architectural friction, discover shallow modules, and propose module-deepening refactors as GitHub issue RFCs using parallel sub-agent interface designs. Use when user wants to improve architecture, find shallow modules, deepen modules, or reduce coupling.
48
53
  - **architecture-decision**: Loaded when user asks about architecture decisions or architecture note writing
49
54
  - **biz-scan**: Scan codebase for business opportunities and KPIs
55
+ - **brand-voice**: Loaded when writing documentation, content, README, or user-facing text. Prevents generic LLM rhetoric and enforces direct, technical voice.
50
56
  - **briefing**: Generate executive daily briefing across all agents
51
57
  - **build**: Build the project with auto-detected toolchain
52
58
  - **chaos**: Inject controlled faults for resilience testing
@@ -55,6 +61,7 @@
55
61
  - **clean-code**: Loaded when user asks about clean code, naming, or code quality
56
62
  - **command-creator**: Creates new Claude Code slash commands with frontmatter, workflow guidance, and validation
57
63
  - **commit**: Create Conventional Commits with pre-commit validation
64
+ - **council**: 4-perspective decision evaluation for architecture choices. Use when user wants multi-angle analysis, needs to decide between alternatives, or mentions 'council', 'evaluate decision', 'pros cons'.
58
65
  - **csharp-patterns**: Loaded when user asks about C# or .NET development patterns
59
66
  - **database-patterns**: Loaded when user asks about database schema or query optimization
60
67
  - **debug**: Debug errors and trace root causes systematically
@@ -79,6 +86,7 @@
79
86
  - **hook-creator**: Creates new Claude Code hooks with guided workflow, strict conventions, and validation
80
87
  - **index**: Index codebase into the knowledge base
81
88
  - **instinct-review**: Review and manage learned instincts from past sessions
89
+ - **introspect**: Agent self-debugging and recovery. Use when stuck in loops, making repeated errors, or quality degrades. Triggers: introspect, self-debug, stuck, loop, why failing.
82
90
  - **java-patterns**: Loaded when user asks about Java development patterns
83
91
  - **kotlin-patterns**: Loaded when user asks about Kotlin development patterns
84
92
  - **lint**: Lint code with auto-detected tools and fix suggestions
@@ -92,6 +100,7 @@
92
100
  - **orchestrate**: Coordinate multiple specialized agents in parallel
93
101
  - **panic**: Emergency stabilization via system-governor agent
94
102
  - **performance-profiling**: Loaded when user asks about performance profiling or optimization
103
+ - **persona**: Switch engineering persona at runtime: backend-lead, frontend-lead, devops-eng, junior-dev
95
104
  - **plan**: Plan implementation with tasks and success criteria
96
105
  - **plan-writing**: Loaded when user asks to write an implementation plan or pre-mortem
97
106
  - **plugin-creator**: Creates experimental opt-in Claude Code plugin packs with manifests, conventions, and optional module scaffolding
@@ -111,6 +120,7 @@
111
120
  - **rust-patterns**: Loaded when user asks about Rust development patterns
112
121
  - **search**: Search the knowledge base with semantic and hybrid modes
113
122
  - **security-patterns**: Loaded when user asks about security, OWASP, or auth patterns
123
+ - **skill-audit**: Scan skills and agents for security risks: dangerous patterns, secrets, excessive permissions
114
124
  - **skill-creator**: Create new skills from templates with guided workflow
115
125
  - **subagent-development**: Execute implementation plans using fresh subagents per task with two-stage review: spec compliance first, then code quality. Use when executing plans with independent tasks.
116
126
  - **swarm**: Execute tasks via Map-Reduce, Consensus, or Relay swarms
@@ -128,7 +138,7 @@
128
138
 
129
139
  ## Agents
130
140
 
131
- - **ai-engineer**: AI/ML integration specialist. Use for LLM integration, vector databases, RAG pipelines, embeddings, and AI agent orchestration. Triggers: ai, ml, llm, embedding, vector, rag, agent, openai, anthropic.
141
+ - **ai-engineer**: AI/ML integration specialist. Use for LLM integration, vector databases, RAG pipelines, embeddings, AI agent orchestration, document indexing, semantic search, hybrid retrieval, and answer generation. Triggers: ai, ml, llm, embedding, vector, rag, agent, openai, anthropic, search, retrieval, indexing, chunking, reranking.
132
142
  - **backend-specialist**: Expert backend architect for Node.js, Python, PHP, and modern serverless systems. Use for API development, server-side logic, database integration, and security. Triggers: backend, server, api, endpoint, database, auth, fastapi, express, laravel.
133
143
  - **business-intelligence**: Opportunity Discovery agent. Scans data models and code to identify missing business metrics, KPIs, and opportunities for value creation.
134
144
  - **chaos-monkey**: Resilience testing agent. Use to inject faults, latency, and failures into the system to verify robustness and recovery mechanisms.
@@ -150,8 +160,7 @@
150
160
  - **infrastructure-architect**: System design expert. Use for architectural decisions, architecture notes, trade-off analysis, technology selection. Triggers: architecture, design, decision, trade-off, scalability, infrastructure planning.
151
161
  - **infrastructure-validator**: Deployment validation expert. Use for deployment verification, health checks, testing, rollback procedures. Triggers: validate, deploy, deployment, health check, smoke test, rollback.
152
162
  - **llm-ops-engineer**: LLM operations expert. Use for LLM caching, fallback strategies, cost optimization, observability, and reliability. Triggers: llm, language model, openai, ollama, caching, fallback, token, cost.
153
- - **mcp-expert**: MCP integration expert. Use for configuring MCP clients, integrations, troubleshooting MCP connections. Triggers: mcp config, mcp integration, mcp connection, claude desktop, mcp client.
154
- - **mcp-server-architect**: MCP server design and implementation expert. Use for creating MCP servers, JSON-RPC transport, tool definitions, protocol compliance. Triggers: mcp, model context protocol, json-rpc, sse, stdio, mcp server.
163
+ - **mcp-specialist**: MCP server design, implementation, client configuration, and integration troubleshooting. Triggers: mcp, model context protocol, json-rpc, sse, stdio, mcp server, mcp config, mcp integration, mcp connection, claude desktop, mcp client.
155
164
  - **mcp-testing-engineer**: MCP protocol testing expert. Use for MCP server testing, protocol compliance, transport validation, integration testing. Triggers: mcp test, protocol compliance, mcp validation, transport testing.
156
165
  - **meta-architect**: Self-Optimization agent. Analyzes system performance and mistakes to update agent definitions and instructions. The only agent allowed to modify .claude/agents/*.
157
166
  - **ml-engineer**: Machine learning systems specialist. Use for model training, data pipelines, MLOps, and model deployment. Triggers: ml, machine learning, model training, mlops, tensorflow, pytorch, scikit-learn.
@@ -165,15 +174,13 @@
165
174
  - **project-planner**: Smart project planning agent. Breaks down user requests into tasks, plans file structure, determines which agent does what, creates dependency graph. Use when starting new projects or planning major features.
166
175
  - **prompt-engineer**: LLM prompt design and optimization specialist. Trigger words: prompt, LLM, chain-of-thought, few-shot, system prompt, prompt engineering, token optimization
167
176
  - **qa-automation-engineer**: Test automation and QA specialist. Use for E2E testing, API testing, performance testing, and CI/CD test integration. Triggers: e2e, playwright, cypress, selenium, api test, performance test, automation.
168
- - **rag-engineer**: RAG systems expert. Use for document indexing, semantic search, hybrid retrieval, CRAG, multi-hop reasoning, and answer generation. Triggers: rag, search, retrieval, indexing, embedding, vector, chunking, reranking.
169
- - **research-synthesizer**: Multi-source research coordination and synthesis specialist. Trigger words: synthesize, aggregate, report, executive summary, gap analysis, conflict resolution, findings, research, investigate, multi-source, cross-reference, research planning
170
177
  - **search-specialist**: Information retrieval and search optimization specialist. Trigger words: search, query, semantic search, information retrieval, relevance, ranking, search optimization
171
178
  - **security-architect**: Proactive security design expert. Use for Threat Modeling, architecture security reviews, and designing secure systems (AuthN/AuthZ, Crypto).
172
179
  - **security-auditor**: Security expert. Use for OWASP Top 10, CVE analysis, security audits, penetration testing, vulnerability assessment, hardening. Triggers: security, owasp, cve, vulnerability, audit, hardening, penetration, pentest, injection test, api security.
173
180
  - **seo-specialist**: Search engine optimization specialist. Trigger words: SEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org
174
181
  - **system-governor**: The Guardian of the Constitution. Validates all evolutionary changes and enforces immutable rules. Has VETO power.
175
182
  - **tech-lead**: Technical authority for code quality, architecture patterns, and stack decisions. Use for code reviews, technological disputes, and standards enforcement.
176
- - **technical-researcher**: Deep technical investigation specialist. Trigger words: technical research, feasibility study, root cause analysis, API investigation, compatibility research, comparison matrix
183
+ - **technical-researcher**: Deep technical investigation and multi-source research synthesis specialist. Trigger words: technical research, feasibility study, root cause analysis, API investigation, compatibility research, comparison matrix, synthesize, aggregate, report, executive summary, gap analysis, findings, multi-source, cross-reference
177
184
  - **test-engineer**: Testing expert. Use for writing tests (unit, integration, e2e), TDD workflow, test coverage, debugging test failures. Triggers: test, pytest, unittest, coverage, tdd, testing, mock, fixture.
178
185
 
179
186
  ---
@@ -531,10 +538,10 @@ tags: [agents, catalog, roles, ai-development]
531
538
  version: "2.0.0"
532
539
  created: "2026-03-23"
533
540
  last_updated: "2026-03-25"
534
- description: "Complete catalog of 47 specialized agents with roles, models, and use cases."
541
+ description: "Complete catalog of 44 specialized agents with roles, models, and use cases."
535
542
  ---
536
543
 
537
- # Agents Catalog (47 agents)
544
+ # Agents Catalog (44 agents)
538
545
 
539
546
  ## By Category
540
547
 
@@ -557,17 +564,16 @@ description: "Complete catalog of 47 specialized agents with roles, models, and
557
564
  | **game-developer** | opus | Unity, Godot, Unreal, Phaser, Three.js |
558
565
  | **database-architect** | opus | Schema design, migrations, query optimization, operations |
559
566
 
560
- ### AI/ML (7)
567
+ ### AI/ML (6)
561
568
 
562
569
  | Agent | Model | Use Case |
563
570
  |-------|-------|----------|
564
- | **ai-engineer** | opus | LLM integration, vector databases, RAG, agent orchestration |
571
+ | **ai-engineer** | opus | LLM integration, vector databases, RAG pipelines, agent orchestration |
565
572
  | **ml-engineer** | opus | Model training, MLOps, TensorFlow, PyTorch |
566
573
  | **nlp-engineer** | opus | NLP pipelines, NER, text classification, transformers |
567
574
  | **data-scientist** | opus | Statistics, visualization, EDA, hypothesis testing |
568
575
  | **data-analyst** | sonnet | SQL, analytics, reporting, dashboards |
569
576
  | **prompt-engineer** | opus | Prompt design, chain-of-thought, few-shot, optimization |
570
- | **rag-engineer** | opus | RAG pipelines, document indexing, retrieval optimization |
571
577
 
572
578
  ### Quality & Security (6)
573
579
 
@@ -591,23 +597,21 @@ description: "Complete catalog of 47 specialized agents with roles, models, and
591
597
  | **performance-optimizer** | opus | Profiling, bottleneck analysis, latency, scaling |
592
598
  | **llm-ops-engineer** | opus | LLM caching, fallback, cost optimization, observability |
593
599
 
594
- ### Research & Documentation (6)
600
+ ### Research & Documentation (5)
595
601
 
596
602
  | Agent | Model | Use Case |
597
603
  |-------|-------|----------|
598
604
  | **explorer-agent** | sonnet | Codebase discovery (READ-ONLY, never writes) |
599
- | **research-synthesizer** | opus | Research coordination, synthesis, report generation |
600
- | **technical-researcher** | opus | Deep technical investigation, feasibility studies |
605
+ | **technical-researcher** | opus | Deep technical investigation, research synthesis |
601
606
  | **search-specialist** | sonnet | Search optimization, relevance ranking |
602
607
  | **fact-checker** | sonnet | Claim verification, source validation |
603
608
  | **documenter** | sonnet | Documentation, KB management, SOPs, API docs, tutorials |
604
609
 
605
- ### MCP (3)
610
+ ### MCP (2)
606
611
 
607
612
  | Agent | Model | Use Case |
608
613
  |-------|-------|----------|
609
- | **mcp-expert** | opus | MCP protocol expertise, client configuration |
610
- | **mcp-server-architect** | opus | MCP server design, JSON-RPC, tool definitions |
614
+ | **mcp-specialist** | opus | MCP server design, client config, troubleshooting |
611
615
  | **mcp-testing-engineer** | sonnet | MCP protocol compliance, transport testing |
612
616
 
613
617
  ### Management & Evolution (4)
@@ -645,8 +649,8 @@ description: "Complete catalog of 47 specialized agents with roles, models, and
645
649
  | Security | security-auditor | security-architect | code-reviewer |
646
650
  | Architecture | infrastructure-architect | devops-implementer | security-auditor |
647
651
  | Documentation | documenter | explorer-agent | tech-lead |
648
- | AI/ML | ai-engineer | ml-engineer | rag-engineer |
649
- | Research | research-synthesizer | technical-researcher | fact-checker |
652
+ | AI/ML | ai-engineer | ml-engineer | data-scientist |
653
+ | Research | technical-researcher | search-specialist | fact-checker |
650
654
 
651
655
  ---
652
656
 
@@ -885,7 +889,7 @@ service: ai-toolkit
885
889
  tags: [architecture, overview, design, structure]
886
890
  version: "1.0.0"
887
891
  created: "2026-03-23"
888
- last_updated: "2026-04-02"
892
+ last_updated: "2026-04-07"
889
893
  description: "Architecture of ai-toolkit: directory layout, global install model, skill tiers, and integration with projects."
890
894
  ---
891
895
 
@@ -893,7 +897,7 @@ description: "Architecture of ai-toolkit: directory layout, global install model
893
897
 
894
898
  ## Purpose
895
899
 
896
- Shared, project-agnostic AI development toolkit for Claude Code (and compatible assistants like Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, and Aider). Provides 47 specialized agents, 85 skills (slash commands + knowledge), expanded lifecycle hooks, and experimental opt-in plugin packs that teams can adopt separately from the default global install.
900
+ Shared, project-agnostic AI development toolkit for Claude Code (and compatible assistants like Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, Aider, and Augment). Provides 44 specialized agents, 90 skills (slash commands + knowledge), expanded lifecycle hooks, persona presets, and experimental opt-in plugin packs that teams can adopt separately from the default global install.
897
901
 
898
902
  ## Design Principles
899
903
 
@@ -910,8 +914,8 @@ ai-toolkit/
910
914
  bin/
911
915
  ai-toolkit.js # CLI entry point (install, init, add-rule, ...)
912
916
  app/ # All toolkit components
913
- agents/ # 47 agent definitions (.md + YAML frontmatter)
914
- skills/ # 85 skills: task, hybrid, knowledge
917
+ agents/ # 44 agent definitions (.md + YAML frontmatter)
918
+ skills/ # 90 skills: task, hybrid, knowledge
915
919
  rules/ # Rules auto-injected into ~/.claude/CLAUDE.md
916
920
  hooks/ # Hook scripts (copied to ~/.ai-toolkit/hooks/)
917
921
  hooks.json # Hook definitions (merged into ~/.claude/settings.json)
@@ -1045,9 +1049,9 @@ Three tiers determine how to approach a task:
1045
1049
 
1046
1050
  | Type | Field | Invocation | Count |
1047
1051
  |------|-------|-----------|-------|
1048
- | Task | `disable-model-invocation: true` | User via `/skill` only | 27 |
1049
- | Hybrid | (neither) | User via `/skill` + agent knowledge | 27 |
1050
- | Knowledge | `user-invocable: false` | Claude auto-loads | 31 |
1052
+ | Task | `disable-model-invocation: true` | User via `/skill` only | 28 |
1053
+ | Hybrid | (neither) | User via `/skill` + agent knowledge | 30 |
1054
+ | Knowledge | `user-invocable: false` | Claude auto-loads | 32 |
1051
1055
 
1052
1056
  ## Multi-Agent Execution
1053
1057
 
@@ -1075,21 +1079,30 @@ Agents (code-reviewer, debugger, devops-implementer, ...)
1075
1079
 
1076
1080
  ## Quality Hooks
1077
1081
 
1082
+ 21 entries across 12 lifecycle events. See [hooks-catalog.md](hooks-catalog.md) for full details.
1083
+
1078
1084
  | Hook | Trigger | Script | Action |
1079
1085
  |------|---------|--------|--------|
1080
1086
  | SessionStart | Session start + compact | `session-start.sh` | MANDATORY rules reminder + session context + instincts |
1087
+ | SessionStart | Session start | `mcp-health.sh` | Check MCP runtime availability |
1088
+ | SessionStart | Session start | `session-context.sh` | Capture environment snapshot |
1081
1089
  | Notification | Claude waiting for input | *(inline)* | macOS desktop notification |
1082
1090
  | PreToolUse | Before Bash | `guard-destructive.sh` | Block destructive commands |
1083
1091
  | PreToolUse | Before file ops (Bash, Read, Edit, Write, MultiEdit, Glob, Grep, NotebookEdit, mcp\_filesystem) | `guard-path.sh` | Block wrong-user path hallucination |
1092
+ | PreToolUse | Before Edit/Write/MultiEdit | `guard-config.sh` | Block config file edits without explicit acknowledgment |
1093
+ | PreToolUse | Before Bash (git commit) | `commit-quality.sh` | Advisory Conventional Commits format check |
1084
1094
  | UserPromptSubmit | Before user prompt execution | `user-prompt-submit.sh` | Prompt governance reminder |
1095
+ | UserPromptSubmit | Before user prompt execution | `track-usage.sh` | Record skill invocations to stats.json |
1085
1096
  | PostToolUse | After edit/write tools | `post-tool-use.sh` | Lightweight validation reminders |
1097
+ | PostToolUse | After any tool | `governance-capture.sh` | Log security-sensitive operations |
1086
1098
  | Stop | After response | `quality-check.sh` | Multi-language lint |
1087
1099
  | Stop | After response | `save-session.sh` | Persist session context |
1088
1100
  | TaskCompleted | Agent Teams: task done | `quality-gate.sh` | Block completion on errors |
1089
1101
  | TeammateIdle | Agent Teams: idle | *(inline)* | Completeness reminder |
1090
1102
  | SubagentStart | Subagent spawn | `subagent-start.sh` | Scope reminder for subagents |
1091
1103
  | SubagentStop | Subagent completion | `subagent-stop.sh` | Handoff checklist for subagents |
1092
- | PreCompact | Before compaction | `pre-compact.sh` | Save context before compaction |
1104
+ | PreCompact | Before compaction | `pre-compact.sh` | Save prioritized context: instincts > tasks > git state > decisions |
1105
+ | PreCompact | Before compaction | `pre-compact-save.sh` | Timestamped context snapshot to audit trail |
1093
1106
  | SessionEnd | Session end | `session-end.sh` | Persist handoff note for the next session |
1094
1107
 
1095
1108
  Scripts at `~/.ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for details.
@@ -1104,6 +1117,29 @@ Scripts at `~/.ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for
1104
1117
  | IV Self-Preservation | Constitution is read-only, kill switch via system-governor |
1105
1118
  | V Resource Governance | No destructive commands without confirmation |
1106
1119
 
1120
+ ## Persona Presets
1121
+
1122
+ Optional engineering personas injected via `ai-toolkit install --persona <name>`. Each persona adds role-specific communication style, preferred skills, and code review priorities to CLAUDE.md.
1123
+
1124
+ | Persona | Focus |
1125
+ |---------|-------|
1126
+ | `backend-lead` | System design, scalability, data integrity, API stability |
1127
+ | `frontend-lead` | Component architecture, a11y, state management, Core Web Vitals |
1128
+ | `devops-eng` | Infrastructure as code, CI/CD, rollback safety, observability |
1129
+ | `junior-dev` | Step-by-step explanations, learning resources, small PRs |
1130
+
1131
+ Persona files live in `app/personas/*.md` and use the same `inject_rule` mechanism as registered rules.
1132
+
1133
+ ## Skill Security Auditing
1134
+
1135
+ `/skill-audit` scans `app/skills/` and `app/agents/` for security risks:
1136
+ - **Frontmatter**: overly permissive `allowed-tools`, knowledge skills with Bash
1137
+ - **Scripts**: `eval()`, `exec()`, `os.system()`, `subprocess(shell=True)`, `pickle.loads`
1138
+ - **Secrets**: AWS keys, GitHub PATs, private keys, hardcoded passwords
1139
+ - **Bash**: `curl | bash`, unquoted variables, `chmod 777`
1140
+
1141
+ Severity levels: HIGH (blocks deployment), WARN (should fix), INFO (best practice). CI-ready with non-zero exit on HIGH findings.
1142
+
1107
1143
  ## Agent Model Tiers
1108
1144
 
1109
1145
  | Model | Purpose | Count |
@@ -1111,6 +1147,20 @@ Scripts at `~/.ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for
1111
1147
  | opus | Complex reasoning, code generation, security | 32 |
1112
1148
  | sonnet | Documentation, analysis, pattern-following | 15 |
1113
1149
 
1150
+ ## Extension Points
1151
+
1152
+ ### MCP Templates
1153
+ `app/plugins/mcp-templates/` contains 25 ready-to-use MCP server config templates. Opt-in via `ai-toolkit install --modules mcp-templates` or activated automatically with `--profile strict|full`.
1154
+
1155
+ ### Language Rules
1156
+ `app/rules/` provides 70 rule files covering 13 languages (TypeScript, Python, Go, Rust, Java, Kotlin, Swift, Dart, C#, PHP, C++, Ruby, common). Auto-detected from project files via `--auto-detect` or selectable with `--modules rules-<lang>`.
1157
+
1158
+ ### Extension API (`inject-hook`)
1159
+ `inject_section_cli.py` provides a stable marker-based API for injecting content into `CLAUDE.md`, `constitution.md`, or `ARCHITECTURE.md` without overwriting user content.
1160
+
1161
+ ### Manifest Install (`--modules`, `--auto-detect`)
1162
+ `manifest.json` defines all installable components as named modules. Install individual modules with `ai-toolkit install --modules <name>` or enable auto-detection to select language rules based on files found in the project.
1163
+
1114
1164
  ---
1115
1165
 
1116
1166
  ## kb/reference/benchmark-config.md
@@ -1460,15 +1510,697 @@ description: "DEPRECATED: All slash commands are implemented as skills. See skil
1460
1510
 
1461
1511
  All slash commands have been migrated to skills.
1462
1512
 
1463
- See **[Skills Catalog](skills-catalog.md)** for the complete list of 85 skills, including:
1464
- - **27 Task Skills** — formerly standalone commands and creator workflows (e.g., `/commit`, `/test`, `/deploy`, `/hook-creator`, `/plugin-creator`)
1465
- - **27 Hybrid Skills** — slash commands that also provide agent knowledge (e.g., `/review`, `/debug`, `/plan`, `/tdd`, `/write-a-prd`)
1466
- - **31 Knowledge Skills** — domain patterns auto-loaded by agents
1513
+ See **[Skills Catalog](skills-catalog.md)** for the complete list of 90 skills, including:
1514
+ - **28 Task Skills** — formerly standalone commands and creator workflows (e.g., `/commit`, `/test`, `/deploy`, `/hook-creator`, `/plugin-creator`)
1515
+ - **30 Hybrid Skills** — slash commands that also provide agent knowledge (e.g., `/review`, `/debug`, `/plan`, `/tdd`, `/write-a-prd`, `/council`, `/introspect`)
1516
+ - **32 Knowledge Skills** — domain patterns auto-loaded by agents (e.g., `brand-voice`, `clean-code`, `testing-patterns`)
1467
1517
 
1468
1518
  Slash command syntax (`/command`) continues to work. The underlying implementation moved from `app/commands/` to `app/skills/`.
1469
1519
 
1470
1520
  ---
1471
1521
 
1522
+ ## kb/reference/competitive-features-implementation.md
1523
+
1524
+ ---
1525
+ title: "Plan: Competitive Features Implementation — Learning System, Language Rules, Hook Matrix, MCP Templates"
1526
+ category: reference
1527
+ service: ai-toolkit
1528
+ tags:
1529
+ - competitive-analysis
1530
+ - continuous-learning
1531
+ - language-rules
1532
+ - hook-matrix
1533
+ - mcp-templates
1534
+ - install-profiles
1535
+ - completed
1536
+ doc_type: plan
1537
+ status: completed
1538
+ created: "2026-04-07"
1539
+ last_updated: "2026-04-07"
1540
+ completion: "100%"
1541
+ description: "Implementation plan for features identified from competitive analysis of everything-claude-code and claude-mem. Focus on learning system, language rules, advanced hooks, MCP templates, and rag-mcp integration. COMPLETED: 8/9 features shipped (1 skipped). See kb/reference/ for permanent documentation."
1542
+ ---
1543
+
1544
+ # Plan: Competitive Features — ai-toolkit
1545
+
1546
+ **Status:** :yellow_circle: IN PROGRESS
1547
+ **Completion:** 100% (9/9 features)
1548
+ **Started:** 2026-04-07
1549
+ **Estimated Completion:** 2026-06-15
1550
+ **Source:** Competitive analysis of `affaan-m/everything-claude-code` (ECC) + `thedotmack/claude-mem`
1551
+
1552
+ ---
1553
+
1554
+ ## 1. Objective
1555
+
1556
+ Strengthen ai-toolkit's competitive position by implementing 10 features from competitive analysis while maintaining our advantages (clean architecture, 9 editors, personas, safety constitution).
1557
+
1558
+ **Key design principle:** ai-toolkit is a **generic toolkit** — it does NOT know about rag-mcp or any specific consumer. Consumers (like rag-mcp) use ai-toolkit's public API (`inject-rule`, `inject-hook`, `merge-hooks`) to add their own rules and hooks.
1559
+
1560
+ **State before plan:** 88 skills, 47 agents, 14 hooks, 9 editor integrations
1561
+ **State after plan:** 90 skills, 44 agents, 21 hooks, 70 language rules, 25 MCP templates, extension API
1562
+
1563
+ ---
1564
+
1565
+ ## 2. Progress Tracking
1566
+
1567
+ | # | Feature | Priority | Status | Est. Time | Actual | Notes |
1568
+ |---|---------|----------|--------|-----------|--------|-------|
1569
+ | 1.1 | Language-Specific Rules (13 langs) | P0 | :white_check_mark: | 5-7d | 1d | 70 files (13 langs × 5 + 5 common) |
1570
+ | 1.2 | Advanced Hook Matrix | P0 | :white_check_mark: | 5-7d | 1d | 6 new hooks + hooks.json |
1571
+ | 1.3 | MCP Server Templates (25) | P0 | :white_check_mark: | 2-3d | 1d | 25 templates + mcp_manager.py + CLI |
1572
+ | 2.1 | `inject-hook` CLI command | P1 | :white_check_mark: | 3-5d | 1d | inject_hook_cli.py + 17 tests + CLI |
1573
+ | 2.2 | Manifest-Driven Install | P1 | :white_check_mark: | 7-10d | 1d | modules, state tracking, auto-detect |
1574
+ | 3.1 | Council Skill | P2 | :white_check_mark: | 3-5d | 1d | /council (4-perspective orchestrator) |
1575
+ | 3.2 | Brand Voice Skill | P2 | :white_check_mark: | 2-3d | 1d | knowledge skill + anti-trope list |
1576
+ | 3.3 | Agent Introspection Skill | P2 | :white_check_mark: | 3-5d | 1d | /introspect (7 failure patterns) |
1577
+ | 4.1 | Documentation Site (Starlight/Astro) | P3 | :no_entry: SKIPPED | — | — | Unnecessary — README/CLAUDE.md sufficient |
1578
+
1579
+ ---
1580
+
1581
+ ## 3. Dependency Graph
1582
+
1583
+ ```
1584
+ ALL FEATURES ARE INDEPENDENT — no external dependencies
1585
+
1586
+ MCP Templates (1.3) ← quick win, start here
1587
+ Language Rules (1.1) ← independent
1588
+ Hook Matrix (1.2) ← independent
1589
+ inject-hook CLI (2.1) ← independent (extends existing inject-rule pattern)
1590
+ Manifest Install (2.2) ← independent but complex
1591
+ Council Skill (3.1) ← independent
1592
+ Brand Voice (3.2) ← independent
1593
+ Agent Introspection (3.3) ← independent
1594
+ Documentation Site (4.1) ← independent
1595
+ ```
1596
+
1597
+ ---
1598
+
1599
+ ## 4. Detailed Implementation
1600
+
1601
+ ### Faza 1: Quick Wins + Foundation (tydzień 1-2)
1602
+
1603
+ #### 1.1 Language-Specific Rules System
1604
+
1605
+ **Source:** ECC — 13 language dirs × 5 files each = 65 rule files
1606
+ **What we create:** Skill-based language rules that inject into CLAUDE.md via `--local`
1607
+
1608
+ **Current state:** We have `app/skills/` with some language patterns (typescript-patterns, ruby-patterns, etc.)
1609
+ **Gap:** No systematic coding-style + testing + security + hooks + patterns per language
1610
+
1611
+ **Files to create:**
1612
+
1613
+ ```
1614
+ app/rules/
1615
+ ├── common/
1616
+ │ ├── coding-style.md # KISS, DRY, YAGNI, immutability
1617
+ │ ├── testing.md # Testing standards
1618
+ │ ├── git-workflow.md # Commit conventions
1619
+ │ ├── performance.md # Performance guidelines
1620
+ │ └── security.md # OWASP, input validation
1621
+ ├── typescript/
1622
+ │ ├── coding-style.md # TS-specific (strict mode, no any, etc.)
1623
+ │ ├── testing.md # Jest/Vitest patterns
1624
+ │ ├── patterns.md # TS patterns (discriminated unions, etc.)
1625
+ │ ├── hooks.md # React hooks, lifecycle
1626
+ │ └── security.md # XSS, sanitization
1627
+ ├── python/
1628
+ │ ├── coding-style.md # PEP 8, type hints, dataclasses
1629
+ │ ├── testing.md # pytest, fixtures, parametrize
1630
+ │ ├── patterns.md # Python patterns
1631
+ │ ├── hooks.md # Django/FastAPI lifecycle
1632
+ │ └── security.md # SQL injection, SSTI
1633
+ ├── golang/ # Same 5-file structure
1634
+ ├── rust/
1635
+ ├── java/
1636
+ ├── kotlin/
1637
+ ├── swift/
1638
+ ├── dart/
1639
+ ├── csharp/
1640
+ ├── php/
1641
+ ├── cpp/
1642
+ └── ruby/
1643
+ ```
1644
+
1645
+ **Total: 13 languages × 5 files + 5 common = 70 files**
1646
+
1647
+ **Integration with install:**
1648
+ ```bash
1649
+ # During ai-toolkit install --local
1650
+ # Detect project language from package.json, Cargo.toml, go.mod, etc.
1651
+ # Inject relevant language rules into CLAUDE.md
1652
+ ```
1653
+
1654
+ **Files to modify:**
1655
+
1656
+ | File | Action | Description |
1657
+ |------|--------|-------------|
1658
+ | `app/rules/` (70 files) | CREATE | Language-specific rules |
1659
+ | `scripts/install_steps/detect_language.py` | CREATE | Auto-detect project language |
1660
+ | `scripts/install_steps/inject_rules.py` | EDIT | Inject language rules into CLAUDE.md |
1661
+ | `scripts/validate.py` | EDIT | Validate rules format |
1662
+ | `tests/test_rules.py` | CREATE | Tests |
1663
+
1664
+ **Success Criteria:**
1665
+ - [ ] 13 languages × 5 rule files created
1666
+ - [ ] `ai-toolkit install --local` auto-detects language and injects rules
1667
+ - [ ] Manual override: `ai-toolkit install --local --lang typescript`
1668
+ - [ ] validate.py checks rules format
1669
+ - [ ] Tests: >=13 (one per language)
1670
+
1671
+ ---
1672
+
1673
+ #### 1.2 Advanced Hook Matrix
1674
+
1675
+ **Source:** ECC — 11+ specific hooks with PreToolUse/PostToolUse matrix
1676
+ **Current state:** 14 hooks in `app/hooks/`
1677
+ **Gap:** Missing specific hooks for config protection, MCP health, governance, continuous learning
1678
+
1679
+ **New hooks to add:**
1680
+
1681
+ | Hook | Event | Script | Purpose |
1682
+ |------|-------|--------|---------|
1683
+ | `guard-config.sh` | PreToolUse (Edit/Write) | Bash | Block edits to .eslintrc, .prettierrc, tsconfig unless explicit |
1684
+ | `mcp-health.sh` | SessionStart | Bash | Check MCP server health before session |
1685
+ | `governance-capture.sh` | PostToolUse | Bash | Log governance events (security, policy) |
1686
+ | `observe-session.sh` | PostToolUse | Bash | Send observations to rag-mcp (bridge) |
1687
+ | `pre-compact-save.sh` | PreCompact | Bash | Save context state before compaction |
1688
+ | `commit-quality.sh` | PreToolUse (Bash) | Bash | Check commit message quality |
1689
+
1690
+ **Files:**
1691
+
1692
+ | File | Action | Description |
1693
+ |------|--------|-------------|
1694
+ | `app/hooks/guard-config.sh` | CREATE | Config file protection |
1695
+ | `app/hooks/mcp-health.sh` | CREATE | MCP server health check |
1696
+ | `app/hooks/governance-capture.sh` | CREATE | Governance event logging |
1697
+ | `app/hooks/observe-session.sh` | CREATE | Send obs to rag-mcp |
1698
+ | `app/hooks/pre-compact-save.sh` | CREATE | Context save before compact |
1699
+ | `app/hooks/commit-quality.sh` | CREATE | Commit message quality |
1700
+ | `scripts/install_steps/install_hooks.py` | EDIT | Register new hooks |
1701
+ | `tests/test_hooks.py` | EDIT | Tests for new hooks |
1702
+
1703
+ **Success Criteria:**
1704
+ - [ ] 6 new hooks created and registerable
1705
+ - [ ] guard-config blocks config edits unless `--force`
1706
+ - [ ] mcp-health pings configured MCP servers on session start
1707
+ - [ ] All hooks optional (enable/disable in settings.json)
1708
+ - [ ] Tests: >=6 (one per hook)
1709
+
1710
+ ---
1711
+
1712
+ #### 1.3 MCP Server Templates
1713
+
1714
+ **Source:** ECC — 25 preconfigured MCP servers
1715
+ **What we create:** Template configs that users can copy
1716
+
1717
+ **File to create:**
1718
+ ```
1719
+ app/mcp-templates/
1720
+ ├── README.md # How to use templates
1721
+ ├── github.json # GitHub MCP server
1722
+ ├── jira.json # Jira MCP server
1723
+ ├── context7.json # Context7 docs
1724
+ ├── filesystem.json # Filesystem MCP server
1725
+ ├── sequential-thinking.json # Sequential thinking
1726
+ ├── exa-search.json # Exa web search
1727
+ ├── supabase.json # Supabase
1728
+ ├── postgres.json # PostgreSQL
1729
+ ├── redis.json # Redis
1730
+ ├── cloudflare.json # Cloudflare
1731
+ ├── vercel.json # Vercel
1732
+ ├── railway.json # Railway
1733
+ ├── docker.json # Docker
1734
+ ├── browser-use.json # Browser automation
1735
+ ├── fal-ai.json # fal.ai (image/video)
1736
+ ├── firecrawl.json # Web scraping
1737
+ ├── sentry.json # Sentry error tracking
1738
+ ├── linear.json # Linear issue tracker
1739
+ ├── slack.json # Slack
1740
+ ├── notion.json # Notion
1741
+ ├── confluence.json # Confluence
1742
+ ├── grafana.json # Grafana
1743
+ ├── datadog.json # Datadog
1744
+ └── custom-template.json # Template for custom MCP
1745
+ ```
1746
+
1747
+ **CLI command:**
1748
+ ```bash
1749
+ ai-toolkit mcp add github # Copy github.json to .mcp.json
1750
+ ai-toolkit mcp add github jira # Add multiple
1751
+ ai-toolkit mcp list # List available templates
1752
+ ai-toolkit mcp show github # Show config details
1753
+ ```
1754
+
1755
+ **Files:**
1756
+
1757
+ | File | Action | Description |
1758
+ |------|--------|-------------|
1759
+ | `app/mcp-templates/` (25 files) | CREATE | MCP configs |
1760
+ | `bin/ai-toolkit` | EDIT | Add `mcp` subcommand |
1761
+ | `scripts/mcp_manager.py` | CREATE | MCP template manager |
1762
+ | `tests/test_mcp_templates.py` | CREATE | Validate JSON schemas |
1763
+
1764
+ **Success Criteria:**
1765
+ - [ ] 25 MCP template configs created
1766
+ - [ ] `ai-toolkit mcp add <name>` merges into .mcp.json
1767
+ - [ ] `ai-toolkit mcp list` shows all available
1768
+ - [ ] Tests: >=5 (schema validation)
1769
+
1770
+ ---
1771
+
1772
+ ### Faza 2: Extension API + Install (tydzień 3-5)
1773
+
1774
+ #### 2.1 `inject-hook` CLI Command (Generic Hook Injection)
1775
+
1776
+ **Purpose:** Allow ANY external tool to inject hooks into `~/.claude/settings.json` — the same way `inject-rule` works for `~/.claude/CLAUDE.md`. This is the missing piece that enables consumers (rag-mcp, custom tools, CI systems) to register hooks without knowing ai-toolkit internals.
1777
+
1778
+ **Current state:**
1779
+ - `inject-rule ./my-rules.md` → injects rules into CLAUDE.md between `<!-- TOOLKIT:my-rules START/END -->` markers
1780
+ - `merge-hooks.py inject <hooks.json> <settings.json>` → merges hooks but ONLY with `_source: "ai-toolkit"` tag
1781
+ - **Gap:** No public CLI for external tools to inject hooks with their OWN `_source` tag
1782
+
1783
+ **Architecture (parallels inject-rule):**
1784
+ ```
1785
+ inject-rule ./rag-mcp-rules.md → CLAUDE.md (markers: <!-- TOOLKIT:rag-mcp-rules -->)
1786
+ inject-hook ./rag-mcp-hooks.json → settings.json (tag: "_source": "rag-mcp-hooks")
1787
+ remove-rule rag-mcp-rules → strips from CLAUDE.md
1788
+ remove-hook rag-mcp-hooks → strips from settings.json
1789
+ ```
1790
+
1791
+ **Example: rag-mcp consuming this API:**
1792
+ ```bash
1793
+ # rag-mcp creates a hooks file:
1794
+ cat > /tmp/rag-mcp-hooks.json << 'EOF'
1795
+ {
1796
+ "hooks": {
1797
+ "UserPromptSubmit": [
1798
+ {
1799
+ "matcher": "",
1800
+ "hooks": [{ "type": "command", "command": "echo 'apply KB-first research'" }]
1801
+ }
1802
+ ],
1803
+ "PostToolUse": [
1804
+ {
1805
+ "matcher": "Edit|Write",
1806
+ "hooks": [{ "type": "command", "command": "$HOME/.rag-mcp/hooks/observe-session.sh" }]
1807
+ }
1808
+ ],
1809
+ "SessionStart": [
1810
+ {
1811
+ "matcher": "",
1812
+ "hooks": [{ "type": "command", "command": "$HOME/.rag-mcp/hooks/inject-instincts.sh" }]
1813
+ }
1814
+ ]
1815
+ }
1816
+ }
1817
+ EOF
1818
+
1819
+ # rag-mcp calls ai-toolkit to inject:
1820
+ npx @softspark/ai-toolkit inject-hook /tmp/rag-mcp-hooks.json
1821
+ # → all entries tagged with _source: "rag-mcp-hooks" in settings.json
1822
+ # → re-running is idempotent (strips old rag-mcp-hooks entries, appends new)
1823
+
1824
+ # rag-mcp removes its hooks:
1825
+ npx @softspark/ai-toolkit remove-hook rag-mcp-hooks
1826
+ ```
1827
+
1828
+ **Files:**
1829
+
1830
+ | File | Action | Description |
1831
+ |------|--------|-------------|
1832
+ | `scripts/inject_hook_cli.py` | CREATE | CLI: inject-hook / remove-hook |
1833
+ | `scripts/merge-hooks.py` | EDIT | Support custom `_source` tag (not just "ai-toolkit") |
1834
+ | `bin/ai-toolkit.js` | EDIT | Register `inject-hook` + `remove-hook` subcommands |
1835
+ | `tests/test_inject_hook.bats` | CREATE | Tests |
1836
+ | `kb/howto/inject-hook-api.md` | CREATE | Documentation for consumers |
1837
+
1838
+ **merge-hooks.py changes:**
1839
+ ```python
1840
+ # Current: always uses SOURCE_TAG = "ai-toolkit"
1841
+ # New: accept --source parameter
1842
+ SOURCE_TAG = "ai-toolkit" # default
1843
+
1844
+ def cmd_inject(toolkit_path: str, target_path: str, source: str = "") -> None:
1845
+ source_tag = source or derive_source_from_filename(toolkit_path)
1846
+ # ... tag all entries with _source: source_tag
1847
+ # ... strip old entries with same source_tag
1848
+ # ... append new entries
1849
+ ```
1850
+
1851
+ **inject_hook_cli.py:**
1852
+ ```python
1853
+ #!/usr/bin/env python3
1854
+ """Inject external hooks into ~/.claude/settings.json.
1855
+
1856
+ Usage:
1857
+ inject_hook_cli.py <hooks-file.json> [target-dir]
1858
+ inject_hook_cli.py --remove <hook-source-name> [target-dir]
1859
+
1860
+ The source name is derived from the filename stem (e.g., rag-mcp-hooks.json → "rag-mcp-hooks").
1861
+ All entries are tagged with "_source": "<source-name>" for idempotent updates.
1862
+ """
1863
+ ```
1864
+
1865
+ **Consistency table — all ai-toolkit extension commands:**
1866
+
1867
+ | Command | Target File | Mechanism | Idempotent |
1868
+ |---------|------------|-----------|------------|
1869
+ | `inject-rule <file.md>` | `~/.claude/CLAUDE.md` | HTML markers (`<!-- TOOLKIT:name -->`) | Yes |
1870
+ | `remove-rule <name>` | `~/.claude/CLAUDE.md` | Strip markers | Yes |
1871
+ | `inject-hook <file.json>` | `~/.claude/settings.json` | JSON `_source` tag | Yes |
1872
+ | `remove-hook <name>` | `~/.claude/settings.json` | Strip by `_source` | Yes |
1873
+ | `add-rule <file.md>` | `~/.ai-toolkit/rules/` | File copy + re-inject all | Yes |
1874
+
1875
+ **Success Criteria:**
1876
+ - [ ] `inject-hook ./my-hooks.json` merges hooks with auto-derived `_source` tag
1877
+ - [ ] `remove-hook my-hooks` strips all entries with that `_source`
1878
+ - [ ] Re-running is idempotent (update, not duplicate)
1879
+ - [ ] Existing ai-toolkit hooks (`_source: "ai-toolkit"`) are never touched
1880
+ - [ ] Tests: >=6 (inject, remove, idempotent, coexistence, malformed input, missing file)
1881
+
1882
+ ---
1883
+
1884
+ #### 2.2 Manifest-Driven Install System
1885
+
1886
+ **Source:** ECC — JSON manifests, state tracking, 5 profiles
1887
+ **Current state:** Simple profile-based install (minimal/standard/strict)
1888
+ **Gap:** No granular module selection, no state tracking, no incremental updates
1889
+
1890
+ **Files:**
1891
+
1892
+ | File | Action | Description |
1893
+ |------|--------|-------------|
1894
+ | `manifest.json` | EDIT | Full module manifest with dependencies |
1895
+ | `scripts/install_steps/install_plan.py` | CREATE | Plan what to install |
1896
+ | `scripts/install_steps/install_apply.py` | CREATE | Execute install plan |
1897
+ | `scripts/install_steps/install_state.py` | CREATE | Track installed modules |
1898
+ | `tests/test_manifest_install.py` | CREATE | Tests |
1899
+
1900
+ **manifest.json structure:**
1901
+ ```json
1902
+ {
1903
+ "modules": {
1904
+ "core": {
1905
+ "description": "Core skills and hooks",
1906
+ "files": ["app/skills/commit/*", "app/skills/review/*", "app/hooks/*.sh"],
1907
+ "required": true
1908
+ },
1909
+ "agents": {
1910
+ "description": "47 specialized agents",
1911
+ "files": ["app/agents/*.md"],
1912
+ "required": false,
1913
+ "default": true
1914
+ },
1915
+ "rules-common": {
1916
+ "description": "Common coding rules",
1917
+ "files": ["app/rules/common/*.md"],
1918
+ "required": false,
1919
+ "default": true
1920
+ },
1921
+ "rules-typescript": {
1922
+ "description": "TypeScript-specific rules",
1923
+ "files": ["app/rules/typescript/*.md"],
1924
+ "auto_detect": "package.json"
1925
+ },
1926
+ "rules-python": {
1927
+ "description": "Python-specific rules",
1928
+ "files": ["app/rules/python/*.md"],
1929
+ "auto_detect": "requirements.txt|pyproject.toml|setup.py"
1930
+ },
1931
+ "mcp-templates": {
1932
+ "description": "MCP server templates",
1933
+ "files": ["app/mcp-templates/*.json"],
1934
+ "required": false
1935
+ },
1936
+ "rag-mcp-bridge": {
1937
+ "description": "rag-mcp integration hooks",
1938
+ "files": ["app/hooks/observe-session.sh", "scripts/config/rag-mcp-bridge.yaml"],
1939
+ "required": false,
1940
+ "requires": ["core"]
1941
+ }
1942
+ },
1943
+ "profiles": {
1944
+ "minimal": ["core"],
1945
+ "standard": ["core", "agents", "rules-common"],
1946
+ "strict": ["core", "agents", "rules-common", "mcp-templates"],
1947
+ "full": ["*"]
1948
+ }
1949
+ }
1950
+ ```
1951
+
1952
+ **State tracking (~/.ai-toolkit/state.json):**
1953
+ ```json
1954
+ {
1955
+ "installed_version": "1.2.1",
1956
+ "installed_modules": ["core", "agents", "rules-common", "rules-typescript"],
1957
+ "installed_at": "2026-04-07T10:00:00Z",
1958
+ "last_updated": "2026-04-07T10:00:00Z",
1959
+ "file_hashes": {
1960
+ "app/hooks/session-start.sh": "abc123..."
1961
+ }
1962
+ }
1963
+ ```
1964
+
1965
+ **CLI:**
1966
+ ```bash
1967
+ ai-toolkit install --profile standard # Profile-based (existing)
1968
+ ai-toolkit install --modules core,agents # Module-based (new)
1969
+ ai-toolkit install --auto-detect # Detect language, install matching rules
1970
+ ai-toolkit update # Incremental update (only changed files)
1971
+ ai-toolkit status # Show installed modules
1972
+ ```
1973
+
1974
+ **Success Criteria:**
1975
+ - [ ] manifest.json defines all modules with dependencies
1976
+ - [ ] install --modules allows granular selection
1977
+ - [ ] install --auto-detect detects language from project files
1978
+ - [ ] state.json tracks what's installed
1979
+ - [ ] update only changes modified files (content hash)
1980
+ - [ ] Backward compatible with existing install
1981
+ - [ ] Tests: >=10
1982
+
1983
+ ---
1984
+
1985
+ ### Faza 3: New Skills (tydzień 6-7)
1986
+
1987
+ #### 3.1 Council Skill (/council)
1988
+
1989
+ **Source:** ECC — 4-voice decision workflow
1990
+ **Type:** Hybrid skill (user-invocable: true)
1991
+
1992
+ **File:** `app/skills/council/SKILL.md`
1993
+
1994
+ **Skill definition:**
1995
+ ```yaml
1996
+ ---
1997
+ name: council
1998
+ description: "4-perspective decision evaluation for architecture choices"
1999
+ user-invocable: true
2000
+ agent: orchestrator
2001
+ context: fork
2002
+ ---
2003
+ ```
2004
+
2005
+ **Behavior:**
2006
+ 1. User invokes `/council "Should we migrate from Redis to Valkey?"`
2007
+ 2. Spawn 4 sub-agents in parallel:
2008
+ - **Advocate:** Strongest case FOR
2009
+ - **Critic:** Strongest case AGAINST (devil's advocate)
2010
+ - **Pragmatist:** Trade-offs, costs, timeline, team capacity
2011
+ - **User-Proxy:** End-user/customer impact
2012
+ 3. Synthesize into structured output:
2013
+ - Pros (from Advocate)
2014
+ - Cons (from Critic)
2015
+ - Trade-offs (from Pragmatist)
2016
+ - User Impact (from User-Proxy)
2017
+ - **Recommendation** with confidence level
2018
+
2019
+ **Success Criteria:**
2020
+ - [ ] `/council` invocable
2021
+ - [ ] 4 perspectives generated
2022
+ - [ ] Structured output with recommendation
2023
+ - [ ] Tests: >=2
2024
+
2025
+ ---
2026
+
2027
+ #### 3.2 Brand Voice Skill (/brand-voice)
2028
+
2029
+ **Source:** ECC — canonical voice system
2030
+ **Type:** Knowledge skill (user-invocable: false, auto-loaded for writing tasks)
2031
+
2032
+ **File:** `app/skills/brand-voice/SKILL.md`
2033
+
2034
+ **Content:**
2035
+ - Anti-trope list (banned LLM phrases: "dive into", "game-changer", "cutting-edge", etc.)
2036
+ - Voice capture template (how to define a project's voice)
2037
+ - Consistency checks (before outputting content, verify voice match)
2038
+
2039
+ **Success Criteria:**
2040
+ - [ ] Skill auto-loads when writing docs/content
2041
+ - [ ] Anti-trope list prevents generic LLM rhetoric
2042
+ - [ ] Tests: >=2
2043
+
2044
+ ---
2045
+
2046
+ #### 3.3 Agent Introspection Skill (/introspect)
2047
+
2048
+ **Source:** ECC — agent-introspection-debugging
2049
+ **Type:** Task skill (user-invocable: true)
2050
+
2051
+ **File:** `app/skills/introspect/SKILL.md`
2052
+
2053
+ **Behavior:**
2054
+ 1. Capture current failure/stuck state
2055
+ 2. Classify pattern (loop, wrong approach, missing context, etc.)
2056
+ 3. Suggest smallest recovery action
2057
+ 4. Emit structured introspection report
2058
+ 5. Optionally hand off to verification
2059
+
2060
+ **Success Criteria:**
2061
+ - [ ] `/introspect` invocable when agent is stuck
2062
+ - [ ] Classifies failure pattern
2063
+ - [ ] Suggests recovery action
2064
+ - [ ] Tests: >=2
2065
+
2066
+ ---
2067
+
2068
+ ### Faza 4: Documentation & Marketing (tydzień 8)
2069
+
2070
+ #### 4.1 Documentation Site
2071
+
2072
+ **Source:** claude-mem (Mintlify, 27 languages)
2073
+ **Options:**
2074
+ 1. **Starlight (Astro)** — free, static, fast (recommended)
2075
+ 2. **Mintlify** — paid, beautiful, hosted
2076
+ 3. **Docusaurus** — free, React-based
2077
+
2078
+ **Structure:**
2079
+ ```
2080
+ docs/
2081
+ ├── astro.config.mjs
2082
+ ├── src/content/docs/
2083
+ │ ├── getting-started/
2084
+ │ │ ├── installation.md
2085
+ │ │ ├── quick-start.md
2086
+ │ │ └── first-skill.md
2087
+ │ ├── skills/
2088
+ │ │ ├── tier-1.md
2089
+ │ │ ├── tier-2.md
2090
+ │ │ └── tier-3.md
2091
+ │ ├── agents/
2092
+ │ │ └── catalog.md
2093
+ │ ├── hooks/
2094
+ │ │ └── lifecycle.md
2095
+ │ ├── guides/
2096
+ │ │ ├── create-skill.md
2097
+ │ │ ├── create-agent.md
2098
+ │ │ └── rag-mcp-integration.md
2099
+ │ └── reference/
2100
+ │ ├── cli.md
2101
+ │ └── manifest.md
2102
+ ```
2103
+
2104
+ **Success Criteria:**
2105
+ - [ ] Documentation site deployed (GitHub Pages or Vercel)
2106
+ - [ ] Covers: installation, skills, agents, hooks, CLI reference
2107
+ - [ ] Auto-generated from existing CLAUDE.md/README.md content
2108
+ - [ ] Tests: Build passes
2109
+
2110
+ ---
2111
+
2112
+ ## 5. Extension API Design (Generic — No Consumer Knowledge)
2113
+
2114
+ ai-toolkit provides a **generic extension API**. It does NOT know about any specific consumer. Consumers use the public CLI to register their rules and hooks.
2115
+
2116
+ ```
2117
+ ┌──────────────────────────────────────────────────────┐
2118
+ │ ai-toolkit (generic) │
2119
+ │ │
2120
+ │ Public Extension API: │
2121
+ │ inject-rule <file.md> → CLAUDE.md │
2122
+ │ remove-rule <name> → CLAUDE.md │
2123
+ │ inject-hook <file.json> → settings.json [NEW] │
2124
+ │ remove-hook <name> → settings.json [NEW] │
2125
+ │ add-rule <file.md> → rules/ registry │
2126
+ │ mcp add <template> → .mcp.json [NEW] │
2127
+ │ │
2128
+ │ Idempotent: markers (rules) / _source tags (hooks) │
2129
+ │ ai-toolkit NEVER calls external services │
2130
+ └──────────────────────────────────────────────────────┘
2131
+
2132
+ │ uses API
2133
+ ┌───────────────┼───────────────┐
2134
+ │ │ │
2135
+ rag-mcp custom-tool ci-system
2136
+ (consumer) (consumer) (consumer)
2137
+ ```
2138
+
2139
+ **Example: how rag-mcp would consume (handled in rag-mcp repo, NOT here):**
2140
+ ```bash
2141
+ # rag-mcp install script calls:
2142
+ npx @softspark/ai-toolkit inject-rule ./rag-mcp-rules.md # existing
2143
+ npx @softspark/ai-toolkit inject-hook ./rag-mcp-hooks.json # NEW
2144
+ # → rag-mcp's hooks + rules are registered, ai-toolkit doesn't care what they do
2145
+ ```
2146
+
2147
+ ---
2148
+
2149
+ ## 6. Success Criteria (Overall)
2150
+
2151
+ | Metric | Before | Target |
2152
+ |--------|--------|--------|
2153
+ | Skills | 88 | ~91 (+3 new skills) |
2154
+ | Hooks | 14 | 20 (+6) |
2155
+ | Language rules | ~8 (pattern skills) | 70 (13 langs × 5 + 5 common) |
2156
+ | MCP templates | 0 | 25 |
2157
+ | Install granularity | 3 profiles | 3 profiles + module-level |
2158
+ | Extension API | inject-rule only | inject-rule + inject-hook + mcp add |
2159
+ | Documentation | README only | Published site |
2160
+
2161
+ ---
2162
+
2163
+ ## 7. Risks and Mitigation
2164
+
2165
+ | Risk | Probability | Impact | Mitigation |
2166
+ |------|-------------|--------|------------|
2167
+ | 70 rule files = maintenance burden | Medium | Medium | Auto-generate from ECC (port script), validate.py checks |
2168
+ | inject-hook misuse by consumers | Low | Medium | Validate JSON schema, reject malformed hooks |
2169
+ | Manifest install breaks existing | Low | High | Backward compatible, existing CLI preserved |
2170
+ | Documentation site drift | Medium | Medium | Generate from source (CLAUDE.md → site), CI check |
2171
+ | Too many hooks slow session start | Low | Medium | Hooks run async, timeout 5s each |
2172
+
2173
+ ---
2174
+
2175
+ ## 8. Pre-Mortem
2176
+
2177
+ 1. **Language rules become stale** — Mitigation: version in frontmatter, validate.py checks freshness
2178
+ 2. **inject-hook consumers conflict** — Mitigation: each consumer has unique `_source` tag, never collide
2179
+ 3. **Manifest install confuses users** — Mitigation: `--profile` still works, manifest is opt-in power feature
2180
+ 4. **Council skill too slow** — Mitigation: parallel sub-agents, timeout 60s per perspective
2181
+ 5. **Documentation out of sync** — Mitigation: CI job: generate docs → diff → fail if stale
2182
+
2183
+ ---
2184
+
2185
+ ## 9. Next Actions
2186
+
2187
+ 1. [ ] **Create `app/rules/common/` (5 files)** — Start with common rules
2188
+ 2. [ ] **Create `app/mcp-templates/` (25 configs)** — Quick win, high impact
2189
+ 3. [ ] **Create 6 new hooks** — Independent, can parallelize
2190
+ 4. [ ] Review and approve this plan
2191
+
2192
+ ---
2193
+
2194
+ ## 10. Blockers
2195
+
2196
+ None — all features are independent of external systems.
2197
+
2198
+ ---
2199
+
2200
+ **Last Updated:** 2026-04-07
2201
+
2202
+ ---
2203
+
1472
2204
  ## kb/reference/distribution-model.md
1473
2205
 
1474
2206
  ---
@@ -1537,6 +2269,186 @@ This model gives:
1537
2269
 
1538
2270
  ---
1539
2271
 
2272
+ ## kb/reference/extension-api.md
2273
+
2274
+ ---
2275
+ title: "Extension API Reference"
2276
+ category: reference
2277
+ service: ai-toolkit
2278
+ tags: [extension-api, inject-rule, inject-hook, mcp-templates, integration]
2279
+ version: "1.3.0"
2280
+ created: "2026-04-07"
2281
+ last_updated: "2026-04-07"
2282
+ description: "Reference for ai-toolkit's extension API: inject-rule, inject-hook, remove-rule, remove-hook, and mcp template management."
2283
+ ---
2284
+
2285
+ # Extension API Reference
2286
+
2287
+ ## Overview
2288
+
2289
+ ai-toolkit exposes a generic extension API that lets external tools register their own rules and hooks alongside the toolkit's built-in components. The toolkit has no knowledge of any specific consumer — it only provides the injection mechanism. Consumers call the public CLI commands from their own install scripts.
2290
+
2291
+ This design is intentional: ai-toolkit is a generic toolkit. Consumers (MCP servers, CI systems, custom tools) use the public API to add their own rules and hooks without modifying toolkit internals.
2292
+
2293
+ ## Commands
2294
+
2295
+ | Command | Target File | Mechanism | Idempotent |
2296
+ |---------|-------------|-----------|------------|
2297
+ | `inject-rule <file.md>` | `~/.claude/CLAUDE.md` | HTML comment markers (`<!-- TOOLKIT:name -->`) | Yes |
2298
+ | `remove-rule <name>` | `~/.claude/CLAUDE.md` | Strip markers by block name | Yes |
2299
+ | `inject-hook <file.json>` | `~/.claude/settings.json` | JSON `_source` tag per entry | Yes |
2300
+ | `remove-hook <name>` | `~/.claude/settings.json` | Strip all entries with matching `_source` | Yes |
2301
+ | `add-rule <file.md>` | `~/.ai-toolkit/rules/` | File copy + re-inject all rules on next `update` | Yes |
2302
+ | `mcp add <name...>` | `.mcp.json` | Merge `mcpServers` block from template | Yes |
2303
+
2304
+ ## inject-rule
2305
+
2306
+ Injects a Markdown rules file into `~/.claude/CLAUDE.md` between named HTML comment markers.
2307
+
2308
+ ```bash
2309
+ npx @softspark/ai-toolkit inject-rule ./my-tool-rules.md
2310
+ ```
2311
+
2312
+ **Implementation:** `scripts/inject_rule_cli.py` (delegates to `inject_section_cli.py`).
2313
+
2314
+ **Markers written:**
2315
+ ```html
2316
+ <!-- TOOLKIT:my-tool-rules START -->
2317
+ ... content of my-tool-rules.md ...
2318
+ <!-- TOOLKIT:my-tool-rules END -->
2319
+ ```
2320
+
2321
+ The block name is derived from the file stem (`my-tool-rules.md` → `my-tool-rules`). Re-running replaces the existing block — no duplicates. Content outside these markers is never modified.
2322
+
2323
+ ## remove-rule
2324
+
2325
+ Strips a previously injected rule block from `~/.claude/CLAUDE.md`.
2326
+
2327
+ ```bash
2328
+ npx @softspark/ai-toolkit remove-rule my-tool-rules
2329
+ ```
2330
+
2331
+ The argument is the block name (file stem used during `inject-rule`). If the block is not present, the command exits 0 silently.
2332
+
2333
+ ## inject-hook
2334
+
2335
+ Injects hook entries from a JSON file into `~/.claude/settings.json`. Every injected entry is tagged with `"_source": "<source-name>"` where the source name is derived from the filename stem.
2336
+
2337
+ ```bash
2338
+ npx @softspark/ai-toolkit inject-hook ./my-tool-hooks.json
2339
+ ```
2340
+
2341
+ **Implementation:** `scripts/inject_hook_cli.py`.
2342
+
2343
+ **Input format:**
2344
+ ```json
2345
+ {
2346
+ "hooks": {
2347
+ "SessionStart": [
2348
+ {
2349
+ "matcher": "",
2350
+ "hooks": [{ "type": "command", "command": "$HOME/.my-tool/hooks/on-start.sh" }]
2351
+ }
2352
+ ],
2353
+ "PostToolUse": [
2354
+ {
2355
+ "matcher": "Edit|Write",
2356
+ "hooks": [{ "type": "command", "command": "$HOME/.my-tool/hooks/on-edit.sh" }]
2357
+ }
2358
+ ]
2359
+ }
2360
+ }
2361
+ ```
2362
+
2363
+ **Source name derivation:** `my-tool-hooks.json` → source name `"my-tool-hooks"`. All entries are tagged `"_source": "my-tool-hooks"` in settings.json.
2364
+
2365
+ **Idempotency:** Re-running strips all existing entries with the same source name, then appends the new ones. No duplicates accumulate.
2366
+
2367
+ **Safety:** Entries tagged `"_source": "ai-toolkit"` are never modified or removed by this command. External tools cannot affect the toolkit's own hooks.
2368
+
2369
+ ## remove-hook
2370
+
2371
+ Strips all hook entries from `~/.claude/settings.json` that carry a given `_source` tag.
2372
+
2373
+ ```bash
2374
+ npx @softspark/ai-toolkit remove-hook my-tool-hooks
2375
+ ```
2376
+
2377
+ The argument is the source name (file stem used during `inject-hook`). If no entries with that source are present, the command exits 0 silently.
2378
+
2379
+ ## mcp add
2380
+
2381
+ Merges one or more MCP server templates from `app/mcp-templates/` into the project's `.mcp.json`.
2382
+
2383
+ ```bash
2384
+ ai-toolkit mcp add github # add a single template
2385
+ ai-toolkit mcp add github postgres slack # add multiple at once
2386
+ ai-toolkit mcp list # list all available templates
2387
+ ai-toolkit mcp show github # print a template's JSON
2388
+ ai-toolkit mcp remove github # remove an entry from .mcp.json
2389
+ ```
2390
+
2391
+ **Implementation:** `scripts/mcp_manager.py`.
2392
+
2393
+ The `add` command merges the `mcpServers` block from the template into `.mcp.json`. If `.mcp.json` does not exist, it is created. If the server name already exists, the entry is overwritten. See [mcp-templates.md](mcp-templates.md) for the full list of available templates.
2394
+
2395
+ ## Architecture
2396
+
2397
+ ```
2398
+ ┌──────────────────────────────────────────────────────┐
2399
+ │ ai-toolkit (generic) │
2400
+ │ │
2401
+ │ Public Extension API: │
2402
+ │ inject-rule <file.md> → CLAUDE.md │
2403
+ │ remove-rule <name> → CLAUDE.md │
2404
+ │ inject-hook <file.json> → settings.json │
2405
+ │ remove-hook <name> → settings.json │
2406
+ │ add-rule <file.md> → rules/ registry │
2407
+ │ mcp add <template> → .mcp.json │
2408
+ │ │
2409
+ │ Idempotent: markers (rules) / _source tags (hooks) │
2410
+ │ ai-toolkit NEVER calls external services │
2411
+ └──────────────────────────────────────────────────────┘
2412
+
2413
+ │ uses API
2414
+ ┌───────────────┼───────────────┐
2415
+ │ │ │
2416
+ rag-mcp custom-tool ci-system
2417
+ (consumer) (consumer) (consumer)
2418
+ ```
2419
+
2420
+ ## Example: Registering Rules and Hooks from an External Tool
2421
+
2422
+ An external tool's install script would call:
2423
+
2424
+ ```bash
2425
+ # Register rules into CLAUDE.md
2426
+ npx @softspark/ai-toolkit inject-rule ./rules/my-tool-rules.md
2427
+
2428
+ # Register hooks into settings.json
2429
+ npx @softspark/ai-toolkit inject-hook ./hooks/my-tool-hooks.json
2430
+
2431
+ # Add an MCP server template
2432
+ npx @softspark/ai-toolkit mcp add github
2433
+ ```
2434
+
2435
+ To uninstall:
2436
+
2437
+ ```bash
2438
+ npx @softspark/ai-toolkit remove-rule my-tool-rules
2439
+ npx @softspark/ai-toolkit remove-hook my-tool-hooks
2440
+ ```
2441
+
2442
+ All operations are idempotent — safe to run on every install or update.
2443
+
2444
+ ## Related Documentation
2445
+
2446
+ - [PATH: kb/reference/hooks-catalog.md] — built-in hooks reference
2447
+ - [PATH: kb/reference/mcp-templates.md] — available MCP server templates
2448
+ - [PATH: kb/reference/architecture-overview.md] — overall install model
2449
+
2450
+ ---
2451
+
1540
2452
  ## kb/reference/global-install-model.md
1541
2453
 
1542
2454
  ---
@@ -1810,9 +2722,9 @@ title: "Hooks Catalog"
1810
2722
  category: reference
1811
2723
  service: ai-toolkit
1812
2724
  tags: [hooks, quality, safety, enforcement, settings.json]
1813
- version: "1.0.0"
2725
+ version: "1.1.0"
1814
2726
  created: "2026-03-27"
1815
- last_updated: "2026-04-02"
2727
+ last_updated: "2026-04-07"
1816
2728
  description: "Complete reference of all ai-toolkit hooks: events, scripts, installation, and runtime behavior."
1817
2729
  ---
1818
2730
 
@@ -1820,7 +2732,7 @@ description: "Complete reference of all ai-toolkit hooks: events, scripts, insta
1820
2732
 
1821
2733
  ## Overview
1822
2734
 
1823
- ai-toolkit provides 15 global hook entries across 12 lifecycle events that enforce quality, safety, and workflow rules across all Claude Code sessions. Hooks are merged into `~/.claude/settings.json` on install, with logic in standalone scripts at `~/.ai-toolkit/hooks/`.
2735
+ ai-toolkit provides 21 global hook entries across 12 lifecycle events that enforce quality, safety, and workflow rules across all Claude Code sessions. Hooks are merged into `~/.claude/settings.json` on install, with logic in standalone scripts at `~/.ai-toolkit/hooks/`.
1824
2736
 
1825
2737
  ## Installation
1826
2738
 
@@ -2006,10 +2918,12 @@ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2006
2918
  | Script | `~/.ai-toolkit/hooks/pre-compact.sh` |
2007
2919
  | Fires | Before context compaction |
2008
2920
 
2009
- **Actions:**
2010
- 1. Injects reminder to re-read CLAUDE.md files after compaction
2011
- 2. Preserves session context from `.claude/session-context.md` (if exists)
2012
- 3. Preserves active instincts from `.claude/instincts/*.md` (if any)
2921
+ **Actions (prioritized — higher priority items survive tighter token budgets):**
2922
+ 1. **Mandatory reload reminder** — always emitted, instructs Claude to re-read CLAUDE.md and active tasks
2923
+ 2. **Active instincts** lists each instinct with confidence score and pattern name from `.claude/instincts/*.md`
2924
+ 3. **Session context** preserves task state from `.claude/session-context.md` (if exists)
2925
+ 4. **Git working state** — branch name, uncommitted change count, last commit (if inside a git repo)
2926
+ 5. **Key decisions** — last 10 lines from `.claude/decisions.md` (if exists)
2013
2927
 
2014
2928
  Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2015
2929
 
@@ -2036,6 +2950,76 @@ Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2036
2950
 
2037
2951
  **Action:** Reminds teammate to verify: files modified, tests written, docs updated.
2038
2952
 
2953
+ ---
2954
+
2955
+ ## New Hooks (v1.1.0)
2956
+
2957
+ ### PreToolUse (config guard) — `guard-config.sh`
2958
+
2959
+ | Field | Value |
2960
+ |-------|-------|
2961
+ | Event | `PreToolUse` |
2962
+ | Matcher | `Edit\|Write\|MultiEdit` |
2963
+ | Script | `~/.ai-toolkit/hooks/guard-config.sh` |
2964
+ | Fires | Before any file write/edit operation |
2965
+
2966
+ **Action:** Blocks (exit 2) edits to linter and formatter config files — `.eslintrc`, `.eslintrc.*`, `eslint.config.*`, `.prettierrc`, `.prettierrc.*`, `prettier.config.*`, `tsconfig.json`, `tsconfig.*.json` — unless the request contains an explicit acknowledgment phrase (e.g. "intentionally editing config"). Returns a human-readable explanation to Claude so it can ask the user for confirmation before retrying.
2967
+
2968
+ ### SessionStart — `mcp-health.sh`
2969
+
2970
+ | Field | Value |
2971
+ |-------|-------|
2972
+ | Event | `SessionStart` |
2973
+ | Matcher | *(all)* |
2974
+ | Script | `~/.ai-toolkit/hooks/mcp-health.sh` |
2975
+ | Fires | Session start |
2976
+
2977
+ **Action:** Non-blocking (always exits 0). Reads MCP server definitions from `~/.claude/settings.json` and any local `.mcp.json`. For each configured server, checks whether the required runtime command (`npx`, `uvx`, `docker`, etc.) is available in `$PATH`. Emits warnings for any missing runtimes, including install hints (e.g. "npm install -g npx"). Helps surface MCP misconfiguration early without interrupting the session.
2978
+
2979
+ ### PostToolUse (governance) — `governance-capture.sh`
2980
+
2981
+ | Field | Value |
2982
+ |-------|-------|
2983
+ | Event | `PostToolUse` |
2984
+ | Matcher | *(all)* |
2985
+ | Script | `~/.ai-toolkit/hooks/governance-capture.sh` |
2986
+ | Fires | After any tool use |
2987
+
2988
+ **Action:** Non-blocking (always exits 0). Logs security-sensitive operations (Bash commands, file writes to sensitive paths, large writes) to `~/.ai-toolkit/governance.log` with ISO timestamp, session ID, tool name, and a content excerpt. Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
2989
+
2990
+ ### PreCompact — `pre-compact-save.sh`
2991
+
2992
+ | Field | Value |
2993
+ |-------|-------|
2994
+ | Event | `PreCompact` |
2995
+ | Matcher | *(all)* |
2996
+ | Script | `~/.ai-toolkit/hooks/pre-compact-save.sh` |
2997
+ | Fires | Before context compaction |
2998
+
2999
+ **Action:** Saves a timestamped context snapshot to `~/.ai-toolkit/compactions/YYYY-MM-DD_HH-MM-SS.txt`. Captures session ID, working directory, git branch and status, and environment metadata. Provides an audit trail of what was in context at each compaction point. Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
3000
+
3001
+ ### PreToolUse (commit quality) — `commit-quality.sh`
3002
+
3003
+ | Field | Value |
3004
+ |-------|-------|
3005
+ | Event | `PreToolUse` |
3006
+ | Matcher | `Bash` |
3007
+ | Script | `~/.ai-toolkit/hooks/commit-quality.sh` |
3008
+ | Fires | Before any Bash command |
3009
+
3010
+ **Action:** Non-blocking (always exits 0). Inspects Bash commands containing `git commit`. Extracts the commit message from the `-m` flag and checks it against Conventional Commits format (`type: description`, where type is one of feat/fix/docs/refactor/test/chore/ci/perf/style/revert). Emits an advisory warning if the message does not match — the commit is not blocked, only nudged. Commands without `git commit` or without a `-m` message (e.g. interactive commits) are ignored.
3011
+
3012
+ ### SessionStart — `session-context.sh`
3013
+
3014
+ | Field | Value |
3015
+ |-------|-------|
3016
+ | Event | `SessionStart` |
3017
+ | Matcher | *(all)* |
3018
+ | Script | `~/.ai-toolkit/hooks/session-context.sh` |
3019
+ | Fires | Session start |
3020
+
3021
+ **Action:** Captures an environment snapshot to `~/.ai-toolkit/sessions/current-context.json`. Records working directory, git branch, git status summary, Node.js version, Python version, and timestamp. Used by other hooks and tools to access session metadata without re-running discovery commands. Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
3022
+
2039
3023
  ## Runtime Profiles
2040
3024
 
2041
3025
  Set in `.claude/settings.local.json`:
@@ -2058,10 +3042,14 @@ Set in `.claude/settings.local.json`:
2058
3042
  └── hooks/ # Hook scripts (copied on install)
2059
3043
  ├── _profile-check.sh # Shared: profile skip logic (sourced by hooks)
2060
3044
  ├── session-start.sh
3045
+ ├── session-context.sh # NEW: capture session env snapshot
2061
3046
  ├── guard-destructive.sh
2062
3047
  ├── guard-path.sh
3048
+ ├── guard-config.sh # NEW: block config file edits
3049
+ ├── mcp-health.sh # NEW: check MCP runtime availability
2063
3050
  ├── user-prompt-submit.sh
2064
3051
  ├── post-tool-use.sh
3052
+ ├── governance-capture.sh # NEW: log security-sensitive operations
2065
3053
  ├── quality-check.sh
2066
3054
  ├── quality-gate.sh
2067
3055
  ├── save-session.sh
@@ -2069,22 +3057,24 @@ Set in `.claude/settings.local.json`:
2069
3057
  ├── subagent-stop.sh
2070
3058
  ├── track-usage.sh
2071
3059
  ├── pre-compact.sh
3060
+ ├── pre-compact-save.sh # NEW: timestamped context snapshot
3061
+ ├── commit-quality.sh # NEW: advisory commit message check
2072
3062
  └── session-end.sh
2073
3063
 
2074
3064
  ~/.claude/settings.json
2075
3065
  └── hooks: # Hook definitions referencing ~/.ai-toolkit/hooks/
2076
- ├── SessionStart → session-start.sh
2077
- ├── Notification → osascript (inline)
2078
- ├── PreToolUse → guard-destructive.sh, guard-path.sh
3066
+ ├── SessionStart → session-start.sh, mcp-health.sh, session-context.sh
3067
+ ├── Notification → osascript (inline)
3068
+ ├── PreToolUse → guard-destructive.sh, guard-path.sh, guard-config.sh, commit-quality.sh
2079
3069
  ├── UserPromptSubmit → user-prompt-submit.sh, track-usage.sh
2080
- ├── PostToolUse → post-tool-use.sh
2081
- ├── Stop → quality-check.sh, save-session.sh
2082
- ├── TaskCompleted → quality-gate.sh
2083
- ├── TeammateIdle → echo (inline)
2084
- ├── SubagentStart → subagent-start.sh
2085
- ├── SubagentStop → subagent-stop.sh
2086
- ├── PreCompact → pre-compact.sh
2087
- └── SessionEnd → session-end.sh
3070
+ ├── PostToolUse → post-tool-use.sh, governance-capture.sh
3071
+ ├── Stop → quality-check.sh, save-session.sh
3072
+ ├── TaskCompleted → quality-gate.sh
3073
+ ├── TeammateIdle → echo (inline)
3074
+ ├── SubagentStart → subagent-start.sh
3075
+ ├── SubagentStop → subagent-stop.sh
3076
+ ├── PreCompact → pre-compact.sh, pre-compact-save.sh
3077
+ └── SessionEnd → session-end.sh
2088
3078
  ```
2089
3079
 
2090
3080
  **Key design decisions:**
@@ -2264,6 +3254,463 @@ File an issue with the `language-pack` label. Include:
2264
3254
 
2265
3255
  ---
2266
3256
 
3257
+ ## kb/reference/language-rules.md
3258
+
3259
+ ---
3260
+ title: "Language Rules System"
3261
+ category: reference
3262
+ service: ai-toolkit
3263
+ tags: [rules, languages, coding-style, testing, patterns, security]
3264
+ version: "1.0.0"
3265
+ created: "2026-04-07"
3266
+ last_updated: "2026-04-07"
3267
+ description: "Reference for the language-specific rules system: 13 languages, 5 categories per language, auto-detection."
3268
+ ---
3269
+
3270
+ # Language Rules System
3271
+
3272
+ ## Overview
3273
+
3274
+ ai-toolkit ships 70 language-specific rule files covering 13 programming languages plus a common set. Rules are plain Markdown files injected into `CLAUDE.md` via `ai-toolkit install --local`. They provide coding-style, testing, patterns, frameworks, and security guidance specific to each language.
3275
+
3276
+ Rules are distinct from skills: rules are injected as static text into `CLAUDE.md` and are always visible to Claude, whereas skills are loaded contextually by agents.
3277
+
3278
+ ## File Structure
3279
+
3280
+ ```
3281
+ app/rules/
3282
+ ├── common/
3283
+ │ ├── coding-style.md # KISS, DRY, YAGNI, immutability
3284
+ │ ├── testing.md # Universal testing standards
3285
+ │ ├── git-workflow.md # Commit conventions
3286
+ │ ├── performance.md # Performance guidelines
3287
+ │ └── security.md # OWASP, input validation
3288
+ ├── typescript/
3289
+ │ ├── coding-style.md # Strict mode, no-any, naming
3290
+ │ ├── testing.md # Vitest/Jest patterns
3291
+ │ ├── patterns.md # Discriminated unions, utility types
3292
+ │ ├── frameworks.md # React hooks, Next.js, lifecycle
3293
+ │ └── security.md # XSS prevention, sanitization
3294
+ ├── python/
3295
+ │ ├── coding-style.md # PEP 8, type hints, dataclasses
3296
+ │ ├── testing.md # pytest, fixtures, parametrize
3297
+ │ ├── patterns.md # Python idioms, context managers
3298
+ │ ├── frameworks.md # FastAPI/Django lifecycle, SQLAlchemy
3299
+ │ └── security.md # SQL injection, SSTI prevention
3300
+ ├── golang/ # same 5-file structure
3301
+ ├── rust/
3302
+ ├── java/
3303
+ ├── kotlin/
3304
+ ├── swift/
3305
+ ├── dart/
3306
+ ├── csharp/
3307
+ ├── php/
3308
+ ├── cpp/
3309
+ └── ruby/
3310
+ ```
3311
+
3312
+ **Total: 13 languages × 5 files + 5 common = 70 rule files**
3313
+
3314
+ ## Supported Languages
3315
+
3316
+ | Language | Directory | Auto-detect Files |
3317
+ |----------|-----------|------------------|
3318
+ | Common | `rules/common/` | always included |
3319
+ | TypeScript | `rules/typescript/` | `package.json`, `tsconfig.json` |
3320
+ | Python | `rules/python/` | `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile` |
3321
+ | Go | `rules/golang/` | `go.mod` |
3322
+ | Rust | `rules/rust/` | `Cargo.toml` |
3323
+ | Java | `rules/java/` | `pom.xml`, `build.gradle`, `build.gradle.kts` |
3324
+ | Kotlin | `rules/kotlin/` | `build.gradle.kts` |
3325
+ | Swift | `rules/swift/` | `Package.swift`, `*.xcodeproj` |
3326
+ | Dart | `rules/dart/` | `pubspec.yaml` |
3327
+ | C# | `rules/csharp/` | `*.csproj`, `*.sln` |
3328
+ | PHP | `rules/php/` | `composer.json` |
3329
+ | C++ | `rules/cpp/` | `CMakeLists.txt`, `Makefile`, `*.cpp` |
3330
+ | Ruby | `rules/ruby/` | `Gemfile`, `*.gemspec` |
3331
+
3332
+ ## Rule Categories
3333
+
3334
+ | Category | Filename | Content |
3335
+ |----------|----------|---------|
3336
+ | `coding-style` | `coding-style.md` | Naming, formatting, idiomatic constructs, linter config |
3337
+ | `testing` | `testing.md` | Test framework usage, fixture patterns, coverage targets |
3338
+ | `patterns` | `patterns.md` | Language-specific design patterns and idioms |
3339
+ | `frameworks` | `frameworks.md` | Recommended framework conventions and lifecycle hooks |
3340
+ | `security` | `security.md` | Common language-specific vulnerabilities and mitigations |
3341
+
3342
+ The `common/` directory uses the same structure except `frameworks.md` is replaced by `git-workflow.md` and `performance.md`.
3343
+
3344
+ ## Auto-Detection
3345
+
3346
+ When `--auto-detect` is passed, `scripts/install_steps/detect_language.py` scans the current directory for known marker files and selects the matching language module:
3347
+
3348
+ ```bash
3349
+ ai-toolkit install --local --auto-detect
3350
+ ```
3351
+
3352
+ Detection logic (first match wins when multiple markers are present):
3353
+ 1. `package.json` or `tsconfig.json` → TypeScript
3354
+ 2. `go.mod` → Go
3355
+ 3. `Cargo.toml` → Rust
3356
+ 4. `pubspec.yaml` → Dart
3357
+ 5. `composer.json` → PHP
3358
+ 6. `Gemfile` → Ruby
3359
+ 7. `requirements.txt`, `pyproject.toml`, `setup.py`, or `Pipfile` → Python
3360
+ 8. `pom.xml` or `build.gradle` → Java
3361
+ 9. `build.gradle.kts` → Kotlin
3362
+ 10. `Package.swift` → Swift
3363
+ 11. `*.csproj` or `*.sln` → C#
3364
+ 12. `CMakeLists.txt` or `Makefile` → C++
3365
+
3366
+ Common rules are always injected regardless of detected language.
3367
+
3368
+ ## Installation
3369
+
3370
+ ```bash
3371
+ # Auto-detect language from project files
3372
+ ai-toolkit install --local --auto-detect
3373
+
3374
+ # Explicitly select a language
3375
+ ai-toolkit install --local --lang typescript
3376
+
3377
+ # Install without language rules
3378
+ ai-toolkit install --local
3379
+ ```
3380
+
3381
+ Language rules are injected into the project `CLAUDE.md` between named markers:
3382
+
3383
+ ```
3384
+ <!-- TOOLKIT:rules-typescript START -->
3385
+ ... TypeScript rules content ...
3386
+ <!-- TOOLKIT:rules-typescript END -->
3387
+ ```
3388
+
3389
+ Re-running `install --local` is idempotent — existing blocks are replaced, not duplicated.
3390
+
3391
+ ## Manifest Module Names
3392
+
3393
+ Language rules are tracked as modules in `manifest.json`:
3394
+
3395
+ | Module | Description |
3396
+ |--------|-------------|
3397
+ | `rules-common` | Common coding rules (5 files), included in `standard` profile |
3398
+ | `rules-typescript` | TypeScript-specific rules |
3399
+ | `rules-python` | Python-specific rules |
3400
+ | `rules-golang` | Go-specific rules |
3401
+ | `rules-rust` | Rust-specific rules |
3402
+ | `rules-java` | Java-specific rules |
3403
+ | `rules-kotlin` | Kotlin-specific rules |
3404
+ | `rules-swift` | Swift-specific rules |
3405
+ | `rules-dart` | Dart/Flutter-specific rules |
3406
+ | `rules-csharp` | C#/.NET-specific rules |
3407
+ | `rules-php` | PHP-specific rules |
3408
+ | `rules-cpp` | C++-specific rules |
3409
+ | `rules-ruby` | Ruby-specific rules |
3410
+
3411
+ ## Rules vs Skills
3412
+
3413
+ | | Rules | Skills |
3414
+ |---|-------|--------|
3415
+ | Location | `app/rules/` | `app/skills/` |
3416
+ | Delivery | Injected into `CLAUDE.md` text | Loaded from `~/.claude/skills/` |
3417
+ | Visibility | Always visible in context | Loaded contextually by agents |
3418
+ | Scope | Per-language static guidance | Domain-specific agent behavior |
3419
+ | Install | `--local` only | Global install |
3420
+
3421
+ ## Related Documentation
3422
+
3423
+ - [PATH: kb/reference/manifest-install.md] — module-level install granularity
3424
+ - [PATH: kb/reference/extension-api.md] — injecting rules from external tools
3425
+ - [PATH: kb/reference/architecture-overview.md] — overall install model
3426
+
3427
+ ---
3428
+
3429
+ ## kb/reference/manifest-install.md
3430
+
3431
+ ---
3432
+ title: "Manifest-Driven Install System"
3433
+ category: reference
3434
+ service: ai-toolkit
3435
+ tags: [install, manifest, modules, profiles, auto-detect, state-tracking]
3436
+ version: "1.0.0"
3437
+ created: "2026-04-07"
3438
+ last_updated: "2026-04-07"
3439
+ description: "Reference for the manifest-driven install system: 17 modules, 4 profiles, auto-detection, and state tracking in ~/.ai-toolkit/state.json."
3440
+ ---
3441
+
3442
+ # Manifest-Driven Install System
3443
+
3444
+ ## Overview
3445
+
3446
+ ai-toolkit's install system supports module-level granularity on top of the existing profile-based install. Instead of choosing only between minimal/standard/strict, you can select individual modules (specific language rules, MCP templates, etc.) or enable auto-detection of the project language.
3447
+
3448
+ All existing `--profile` behavior is preserved and unchanged. The manifest system is an additive opt-in layer.
3449
+
3450
+ ## Modules
3451
+
3452
+ Modules are defined in `manifest.json` at the repository root. There are 17 modules:
3453
+
3454
+ | Module | Description | In Profile |
3455
+ |--------|-------------|-----------|
3456
+ | `core` | Core hooks and essential skills | minimal, standard, strict, full |
3457
+ | `agents` | 47 specialized agents | standard, strict, full |
3458
+ | `skills` | 90 skills (task, hybrid, knowledge) | standard, strict, full |
3459
+ | `rules-common` | Common coding rules (5 files) | standard, strict, full |
3460
+ | `rules-typescript` | TypeScript-specific rules (5 files) | auto-detect |
3461
+ | `rules-python` | Python-specific rules (5 files) | auto-detect |
3462
+ | `rules-golang` | Go-specific rules (5 files) | auto-detect |
3463
+ | `rules-rust` | Rust-specific rules (5 files) | auto-detect |
3464
+ | `rules-java` | Java-specific rules (5 files) | auto-detect |
3465
+ | `rules-kotlin` | Kotlin-specific rules (5 files) | auto-detect |
3466
+ | `rules-swift` | Swift-specific rules (5 files) | auto-detect |
3467
+ | `rules-dart` | Dart/Flutter-specific rules (5 files) | auto-detect |
3468
+ | `rules-csharp` | C#/.NET-specific rules (5 files) | auto-detect |
3469
+ | `rules-php` | PHP-specific rules (5 files) | auto-detect |
3470
+ | `rules-cpp` | C++-specific rules (5 files) | auto-detect |
3471
+ | `rules-ruby` | Ruby-specific rules (5 files) | auto-detect |
3472
+ | `mcp-templates` | 25 MCP server config templates | strict, full |
3473
+
3474
+ ## Profiles
3475
+
3476
+ Profiles are predefined module sets. They map directly to `--profile` values:
3477
+
3478
+ | Profile | Modules |
3479
+ |---------|---------|
3480
+ | `minimal` | `core` |
3481
+ | `standard` | `core`, `agents`, `skills`, `rules-common` |
3482
+ | `strict` | `core`, `agents`, `skills`, `rules-common`, `mcp-templates` |
3483
+ | `full` | All modules (same as strict currently; language rules added via `--auto-detect`) |
3484
+
3485
+ ## CLI
3486
+
3487
+ ```bash
3488
+ # Profile-based install (existing behavior, unchanged)
3489
+ ai-toolkit install --profile standard
3490
+
3491
+ # Module-based install (new)
3492
+ ai-toolkit install --modules core,agents,rules-typescript
3493
+
3494
+ # Auto-detect project language and install matching rules
3495
+ ai-toolkit install --local --auto-detect
3496
+
3497
+ # Show currently installed modules and their state
3498
+ ai-toolkit status
3499
+
3500
+ # Incremental update (only re-applies modules with changed content)
3501
+ ai-toolkit update
3502
+ ```
3503
+
3504
+ ### --modules
3505
+
3506
+ Accepts a comma-separated list of module names. Can be combined with a profile:
3507
+
3508
+ ```bash
3509
+ # Start from standard profile, also add TypeScript rules
3510
+ ai-toolkit install --profile standard --modules rules-typescript
3511
+ ```
3512
+
3513
+ ### --auto-detect
3514
+
3515
+ Scans the current working directory for marker files and selects the matching language module. Implemented in `scripts/install_steps/detect_language.py`.
3516
+
3517
+ Detection markers per module:
3518
+
3519
+ | Module | Detected when these files exist |
3520
+ |--------|--------------------------------|
3521
+ | `rules-typescript` | `package.json` or `tsconfig.json` |
3522
+ | `rules-python` | `requirements.txt`, `pyproject.toml`, `setup.py`, or `Pipfile` |
3523
+ | `rules-golang` | `go.mod` |
3524
+ | `rules-rust` | `Cargo.toml` |
3525
+ | `rules-java` | `pom.xml` or `build.gradle` |
3526
+ | `rules-kotlin` | `build.gradle.kts` |
3527
+ | `rules-swift` | `Package.swift` |
3528
+ | `rules-dart` | `pubspec.yaml` |
3529
+ | `rules-csharp` | `*.csproj` or `*.sln` |
3530
+ | `rules-php` | `composer.json` |
3531
+ | `rules-cpp` | `CMakeLists.txt` or `Makefile` |
3532
+ | `rules-ruby` | `Gemfile` |
3533
+
3534
+ ### status
3535
+
3536
+ Lists all currently installed modules with version and install timestamp:
3537
+
3538
+ ```bash
3539
+ ai-toolkit status
3540
+ # Installed modules (from ~/.ai-toolkit/state.json):
3541
+ # core v1.3.0 installed 2026-04-07T10:00:00Z
3542
+ # agents v1.3.0 installed 2026-04-07T10:00:00Z
3543
+ # skills v1.3.0 installed 2026-04-07T10:00:00Z
3544
+ # rules-common v1.3.0 installed 2026-04-07T10:00:00Z
3545
+ # rules-typescript v1.3.0 installed 2026-04-07T10:00:00Z
3546
+ ```
3547
+
3548
+ ### update
3549
+
3550
+ Re-applies installed modules, skipping files whose content hash has not changed since last install. Implemented in `scripts/install_steps/install_state.py`.
3551
+
3552
+ ## State Tracking
3553
+
3554
+ Installed module state is persisted to `~/.ai-toolkit/state.json`:
3555
+
3556
+ ```json
3557
+ {
3558
+ "installed_version": "1.3.0",
3559
+ "installed_modules": ["core", "agents", "skills", "rules-common", "rules-typescript"],
3560
+ "installed_at": "2026-04-07T10:00:00Z",
3561
+ "last_updated": "2026-04-07T10:00:00Z",
3562
+ "file_hashes": {
3563
+ "app/hooks/session-start.sh": "abc123..."
3564
+ }
3565
+ }
3566
+ ```
3567
+
3568
+ - `installed_modules` — used by `update` to know which modules to re-apply
3569
+ - `file_hashes` — used to skip unchanged files during `update`
3570
+ - The file is written after every successful install or update
3571
+
3572
+ ## Implementation Files
3573
+
3574
+ | File | Purpose |
3575
+ |------|---------|
3576
+ | `manifest.json` | Module and profile definitions |
3577
+ | `scripts/install_steps/detect_language.py` | Auto-detect project language from marker files |
3578
+ | `scripts/install_steps/install_state.py` | Read/write `~/.ai-toolkit/state.json` |
3579
+
3580
+ ## Backward Compatibility
3581
+
3582
+ Existing `--profile` usage works identically. The manifest system does not change what gets installed when you use `--profile minimal/standard/strict`. It only adds:
3583
+
3584
+ 1. `--modules` for granular selection
3585
+ 2. `--auto-detect` for language rules
3586
+ 3. `state.json` tracking for incremental updates
3587
+ 4. `status` command to inspect installed state
3588
+
3589
+ No existing install scripts or CI configurations need changes.
3590
+
3591
+ ## Related Documentation
3592
+
3593
+ - [PATH: kb/reference/language-rules.md] — language rules structure and auto-detection detail
3594
+ - [PATH: kb/reference/mcp-templates.md] — MCP server templates (the `mcp-templates` module)
3595
+ - [PATH: kb/reference/architecture-overview.md] — overall install model
3596
+
3597
+ ---
3598
+
3599
+ ## kb/reference/mcp-templates.md
3600
+
3601
+ ---
3602
+ title: "MCP Server Templates"
3603
+ category: reference
3604
+ service: ai-toolkit
3605
+ tags: [mcp, templates, servers, configuration]
3606
+ version: "1.0.0"
3607
+ created: "2026-04-07"
3608
+ last_updated: "2026-04-07"
3609
+ description: "Reference for 25 MCP server configuration templates: GitHub, PostgreSQL, Slack, Sentry, and more."
3610
+ ---
3611
+
3612
+ # MCP Server Templates
3613
+
3614
+ ## Overview
3615
+
3616
+ ai-toolkit ships 25 ready-to-use MCP server configuration templates in `app/mcp-templates/`. Each template is a JSON file that defines the `mcpServers` block for a specific service. Templates are merged into the project's `.mcp.json` via the `ai-toolkit mcp` CLI subcommand.
3617
+
3618
+ ## CLI
3619
+
3620
+ ```bash
3621
+ ai-toolkit mcp list # List all available templates
3622
+ ai-toolkit mcp show <name> # Print a template's JSON config
3623
+ ai-toolkit mcp add <name> # Merge a template into .mcp.json
3624
+ ai-toolkit mcp add <n1> <n2> # Add multiple templates at once
3625
+ ai-toolkit mcp remove <name> # Remove a server entry from .mcp.json
3626
+ ```
3627
+
3628
+ **Implementation:** `scripts/mcp_manager.py`
3629
+
3630
+ The `add` command merges the `mcpServers` block from the template into `.mcp.json`. If `.mcp.json` does not exist it is created. If the server name already exists in `.mcp.json`, the entry is overwritten with the template version.
3631
+
3632
+ ## Template List
3633
+
3634
+ | Name | Description | Required Env Vars |
3635
+ |------|-------------|-------------------|
3636
+ | `brave-search` | Web and local search powered by Brave Search API | `BRAVE_API_KEY` |
3637
+ | `cloudflare` | Cloudflare Workers, KV, D1, R2, and DNS management | `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` |
3638
+ | `context7` | Up-to-date library documentation lookup via Context7 | — |
3639
+ | `custom-template` | Empty template for building a custom MCP server | `API_KEY` (placeholder) |
3640
+ | `datadog` | Datadog monitoring: metrics, logs, traces, dashboard queries | `DD_API_KEY`, `DD_APP_KEY`, `DD_SITE` |
3641
+ | `docker` | Docker container and image management, logs, compose operations | — |
3642
+ | `fetch` | HTTP fetch for web pages and API responses as markdown or raw content | — |
3643
+ | `filesystem` | Local filesystem access for reading, writing, and searching files | — |
3644
+ | `git` | Git repository inspection: diffs, logs, branches | — |
3645
+ | `github` | GitHub API: issues, PRs, repos, code search | `GITHUB_PERSONAL_ACCESS_TOKEN` |
3646
+ | `google-drive` | Google Drive file search, reading, and management | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_REDIRECT_URI` |
3647
+ | `google-maps` | Google Maps geocoding, directions, place search | `GOOGLE_MAPS_API_KEY` |
3648
+ | `grafana` | Grafana dashboard queries, alerting, and data source management | `GRAFANA_URL`, `GRAFANA_API_KEY` |
3649
+ | `linear` | Linear issue tracker: issues, projects, team workflows | `LINEAR_API_KEY` |
3650
+ | `memory` | Persistent memory store using a local knowledge graph | — |
3651
+ | `notion` | Notion workspace: pages, databases, content management | `NOTION_API_KEY` |
3652
+ | `postgres` | PostgreSQL database access, schema inspection, analysis | — |
3653
+ | `puppeteer` | Browser automation: screenshots, navigation, web scraping | — |
3654
+ | `redis` | Redis cache inspection, data management, and monitoring | `REDIS_URL` |
3655
+ | `sentry` | Sentry error tracking: issue search, event details, alerting | `SENTRY_AUTH_TOKEN`, `SENTRY_ORG` |
3656
+ | `sequential-thinking` | Step-by-step reasoning and problem decomposition | — |
3657
+ | `slack` | Slack workspace: channels, messages, users | `SLACK_BOT_TOKEN`, `SLACK_TEAM_ID` |
3658
+ | `sqlite` | SQLite database access, queries, schema management | — |
3659
+ | `supabase` | Supabase project management, database queries, edge functions | `SUPABASE_URL`, `SUPABASE_SERVICE_ROLE_KEY` |
3660
+ | `vercel` | Vercel deployment management, project settings, environment variables | `VERCEL_TOKEN` |
3661
+
3662
+ ## Template Format
3663
+
3664
+ Each template is a JSON file with the following structure:
3665
+
3666
+ ```json
3667
+ {
3668
+ "name": "example",
3669
+ "description": "Human-readable description of what this server provides",
3670
+ "mcpServers": {
3671
+ "example": {
3672
+ "command": "npx",
3673
+ "args": ["-y", "@modelcontextprotocol/server-example"],
3674
+ "env": {
3675
+ "EXAMPLE_API_KEY": "${EXAMPLE_API_KEY}"
3676
+ }
3677
+ }
3678
+ }
3679
+ }
3680
+ ```
3681
+
3682
+ - `name` — identifier used with `mcp add <name>`
3683
+ - `description` — shown by `mcp list` and `mcp show`
3684
+ - `mcpServers` — the block merged verbatim into `.mcp.json`
3685
+ - `env` values use `${VAR_NAME}` placeholders that must be set in the shell environment or `.env` file before Claude Code starts
3686
+
3687
+ ## Example: Adding GitHub and PostgreSQL
3688
+
3689
+ ```bash
3690
+ # Add templates
3691
+ ai-toolkit mcp add github postgres
3692
+
3693
+ # Set required env vars (e.g., in .env or shell profile)
3694
+ export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
3695
+
3696
+ # Resulting .mcp.json contains both mcpServers entries
3697
+ ```
3698
+
3699
+ ## Contributing a New Template
3700
+
3701
+ 1. Create `app/mcp-templates/<name>.json` following the format above.
3702
+ 2. Use `${ENV_VAR}` placeholders for secrets — never hardcode values.
3703
+ 3. Keep the `name` field identical to the filename stem.
3704
+ 4. Run `python3 scripts/validate.py` to verify the file is valid JSON.
3705
+ 5. Add an entry to this document's template list table.
3706
+
3707
+ ## Related Documentation
3708
+
3709
+ - [PATH: kb/reference/extension-api.md] — `mcp add` as part of the extension API
3710
+ - [PATH: kb/reference/architecture-overview.md] — overall install model
3711
+
3712
+ ---
3713
+
2267
3714
  ## kb/reference/merge-friendly-install-model.md
2268
3715
 
2269
3716
  ---
@@ -2620,13 +4067,13 @@ title: "AI Toolkit - Skills Catalog"
2620
4067
  category: reference
2621
4068
  service: ai-toolkit
2622
4069
  tags: [skills, domain-knowledge, catalog, task-skills, hybrid-skills]
2623
- version: "1.0.0"
4070
+ version: "1.3.0"
2624
4071
  created: "2026-03-23"
2625
- last_updated: "2026-04-01"
2626
- description: "Complete catalog of 85 skills: 27 task, 27 hybrid, 31 knowledge. Includes effort levels, skill-scoped hooks, executable scripts, and creator workflows."
4072
+ last_updated: "2026-04-07"
4073
+ description: "Complete catalog of 90 skills: 28 task, 30 hybrid, 32 knowledge. Includes effort levels, skill-scoped hooks, executable scripts, security auditor, and persona presets."
2627
4074
  ---
2628
4075
 
2629
- # Skills Catalog (85 skills)
4076
+ # Skills Catalog (90 skills)
2630
4077
 
2631
4078
  All functionality is unified under skills. Task and hybrid skills are user-invocable as slash commands. Knowledge skills provide domain patterns auto-loaded by agents.
2632
4079
 
@@ -2638,7 +4085,7 @@ All functionality is unified under skills. Task and hybrid skills are user-invoc
2638
4085
  | **2 — Multi-agent workflow** | `/workflow <type>` | Cross-cutting task with known pattern |
2639
4086
  | **3 — Custom parallelism** | `/orchestrate`, `/swarm` | No predefined workflow matches |
2640
4087
 
2641
- ## Task Skills (27)
4088
+ ## Task Skills (28)
2642
4089
 
2643
4090
  Task skills execute a specific action. Invoked via slash commands. `disable-model-invocation: true`.
2644
4091
 
@@ -2671,8 +4118,9 @@ Task skills execute a specific action. Invoked via slash commands. `disable-mode
2671
4118
  | **plugin-creator** | `/plugin-creator` | high | Create experimental opt-in plugin packs with manifests, conventions, and optional modules |
2672
4119
  | **health** | `/health` | medium | Check health of project services (auto-detect) |
2673
4120
  | **prd-to-issues** | `/prd-to-issues` | medium | Break PRD into GitHub issues with vertical slices and HITL/AFK tagging |
4121
+ | **skill-audit** | `/skill-audit` | medium | Scan skills and agents for security risks: dangerous patterns, secrets, excessive permissions |
2674
4122
 
2675
- ## Hybrid Skills (27)
4123
+ ## Hybrid Skills (30)
2676
4124
 
2677
4125
  Hybrid skills combine slash-command invocation with domain knowledge that agents reference.
2678
4126
 
@@ -2705,6 +4153,9 @@ Hybrid skills combine slash-command invocation with domain knowledge that agents
2705
4153
  | **subagent-development** | `/subagent-development` | high | Execute plans with 2-stage review (spec + quality) per task |
2706
4154
  | **repeat** | `/repeat` | medium | Autonomous loop with safety controls (Ralph Wiggum pattern) |
2707
4155
  | **mem-search** | `/mem-search` | medium | Search past coding sessions via natural language (memory-pack) |
4156
+ | **persona** | `/persona` | low | Switch engineering persona at runtime (backend-lead, frontend-lead, devops-eng, junior-dev) |
4157
+ | **council** | `/council` | high | 4-perspective decision evaluation (Advocate, Critic, Pragmatist, User-Proxy) with synthesis and confidence-rated recommendation. Tier 1, orchestrator, `context: fork`. |
4158
+ | **introspect** | `/introspect` | medium | Agent self-debugging: classify failure pattern, suggest smallest recovery action, emit structured introspection report |
2708
4159
 
2709
4160
  ### `/workflow` types
2710
4161
 
@@ -2726,7 +4177,7 @@ Hybrid skills combine slash-command invocation with domain knowledge that agents
2726
4177
  | `application-deploy` | 3 | Deploy → smoke test → release notes |
2727
4178
  | `proactive-troubleshooting` | 4 | Investigate → check perf → preventive fix → docs |
2728
4179
 
2729
- ## Knowledge Skills - Development (9)
4180
+ ## Knowledge Skills - Development (10)
2730
4181
 
2731
4182
  | Skill | Directory | Domain |
2732
4183
  |-------|-----------|--------|
@@ -2739,6 +4190,7 @@ Hybrid skills combine slash-command invocation with domain knowledge that agents
2739
4190
  | **typescript-patterns** | `skills/typescript-patterns/` | TypeScript/JavaScript patterns for frontend and backend |
2740
4191
  | **design-engineering** | `skills/design-engineering/` | UI polish, animation craft, easing, transforms, accessibility |
2741
4192
  | **documentation-standards** | `skills/documentation-standards/` | KB document conventions, frontmatter validation, category taxonomy |
4193
+ | **brand-voice** | `skills/brand-voice/` | Anti-trope list, voice principles, LLM rhetoric prevention |
2742
4194
 
2743
4195
  ## Knowledge Skills - Infrastructure (6)
2744
4196