@softspark/ai-toolkit 2.10.0 → 2.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -453,7 +453,7 @@ Skills are invocable commands or auto-loaded knowledge sources:
453
453
  - **app-builder**: Full-stack app scaffolding with stack-selection matrix: Next.js, React+Vite, Nuxt, Astro, FastAPI, Django, Laravel, React Native, Flutter, Unity. Triggers: scaffold, bootstrap, new project, starter template, build app, landing page, dashboard, API, mobile app, CLI, e-commerce, game. Load when user wants to start a new project from scratch.
454
454
  - **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. Codex-adapted: uses native subagents and plan tracking.
455
455
  - **architecture-decision**: Architecture decision making via trade-off analysis in RFC/RFD/ADR format: context, constraints, 3+ options, comparison, recommendation. Triggers: architecture decision, ADR, RFC, RFD, trade-offs, options comparison, design choice, pick between, should we use, evaluate approach. Load when weighing 2+ architectural options or writing decision records.
456
- - **biz-scan**: Scan codebase for business opportunities and KPIs
456
+ - **biz-scan**: Scans codebase for business opportunities by analyzing database schemas, API endpoints, tracking events, and feature flags to surface underutilized capabilities, missing KPIs, and monetization gaps. Use when the user asks about revenue opportunities, business metrics, KPI coverage, analytics gaps, or monetization analysis of a codebase.
457
457
  - **brand-voice**: Loaded when writing documentation, content, README, or user-facing text. Prevents generic LLM rhetoric and enforces direct, technical voice.
458
458
  - **briefing**: Generate executive daily briefing across all agents
459
459
  - **build**: Build the project with auto-detected toolchain
@@ -478,7 +478,7 @@ Skills are invocable commands or auto-loaded knowledge sources:
478
478
  - **documentation-standards**: KB document conventions: YAML frontmatter (7 required fields), 5-category taxonomy (reference/howto/procedures/troubleshooting/best-practices), directory-category matching, validate.sh CI rules. Triggers: kb/, KB document, architecture note, SOP, runbook, howto, frontmatter, knowledge base entry, documentation standard. Load when creating or editing any file under kb/.
479
479
  - **ecommerce-patterns**: E-commerce domain patterns: cart, checkout flow, payment providers (Stripe/Adyen), order state machine, inventory, promotions, tax, B2B vs B2C. Triggers: cart, checkout, product, SKU, inventory, payment, Stripe, Shopify, Medusa, Magento, order status, promotion, tax calculation, coupon, refund. Load when working on any e-commerce feature.
480
480
  - **evaluate**: Evaluate skill quality and RAG retrieval accuracy
481
- - **evolve**: Evolve agent definitions via meta-architect
481
+ - **evolve**: Analyzes failure patterns and inefficiencies in agent/skill definitions, then drafts and applies targeted improvements to system prompts, tool permissions, and behavioral rules. Use when the user asks to improve agent behavior, refine skill definitions, update system prompts, or optimize agent configurations based on observed failures.
482
482
  - **explain**: Explain code, architecture, or concepts with diagrams
483
483
  - **explore**: Explore codebase structure, stack, and architecture
484
484
  - **fix**: Auto-fix lint errors, type issues, and simple bugs
@@ -509,13 +509,13 @@ Skills are invocable commands or auto-loaded knowledge sources:
509
509
  - **panic**: Emergency stabilization via system-governor agent
510
510
  - **performance-profiling**: Performance measurement and optimization: four golden signals (latency/traffic/errors/saturation), p50/p95/p99, baseline-change-measure loop, flame graphs, load testing. Triggers: performance, slow, latency, p99, flame graph, profile, bottleneck, optimization, load test, benchmark, CPU profiling, memory leak. Load when diagnosing or optimizing slow code or services.
511
511
  - **persona**: Switch engineering persona at runtime: backend-lead, frontend-lead, devops-eng, junior-dev
512
- - **plan**: Plan implementation with tasks and success criteria
512
+ - **plan**: Breaks down feature requests and project goals into phased implementation plans with task lists, agent assignments, dependency graphs, and success criteria. Use when the user asks to plan a feature, create an implementation roadmap, break down a coding task, or outline project phases.
513
513
  - **plan-writing**: Implementation plan and pre-mortem drafting: phase breakdown, success criteria, risks, rollback plan, acceptance tests, estimated effort. Triggers: implementation plan, pre-mortem, phased plan, project plan, task breakdown, success criteria, rollback strategy, risk register. Load when user asks to write a plan or pre-mortem document.
514
514
  - **plugin-creator**: Creates experimental opt-in plugin packs with manifests, conventions, and optional module scaffolding for Claude and Codex runtimes
515
515
  - **pr**: Create pull requests with pre-flight validation
516
516
  - **prd-to-issues**: Break a PRD into independently-grabbable GitHub issues using vertical slices with HITL/AFK tagging and dependency ordering. Use when user wants to convert a PRD to issues, create tickets, or break down a PRD into work items.
517
517
  - **prd-to-plan**: Convert a PRD into a phased implementation plan using tracer-bullet vertical slices. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions tracer bullets. Codex-adapted: uses native subagents and plan tracking.
518
- - **predict**: Predict regressions and impact before changes land
518
+ - **predict**: Analyzes code diffs and file changes to identify potential regressions, maps dependency impact across the codebase, and generates a risk-scored impact report. Use when reviewing pull requests, assessing code change risk, checking for breaking changes, or analyzing the blast radius of a diff.
519
519
  - **prompt-caching-patterns**: Loaded when user builds with Anthropic API and needs to cut cost or latency via prompt caching. Covers TTL, cache breakpoints, stacking, invalidation, and measuring hit rate.
520
520
  - **qa-session**: Interactive QA session where user reports bugs conversationally and agent files GitHub issues with domain language. Explores codebase in background for context. Use when user wants to report bugs, do QA, file issues conversationally, or mentions QA session. Codex-adapted: uses native subagents and plan tracking.
521
521
  - **rag-patterns**: RAG architecture: embeddings, chunking strategies, hybrid search (BM25 + vector), reranking, CRAG/self-correcting, multi-hop reasoning, evaluation metrics. Triggers: RAG, embedding, vector search, pgvector, Qdrant, Pinecone, Weaviate, chunking, reranker, retrieval, hybrid search, semantic search, knowledge base, cosine similarity. Load when building or tuning RAG systems.
@@ -536,7 +536,7 @@ Skills are invocable commands or auto-loaded knowledge sources:
536
536
  - **swarm**: Execute tasks via Map-Reduce, Consensus, or Relay swarms Codex-adapted: uses native subagents and plan tracking.
537
537
  - **swift-patterns**: Swift and iOS development patterns: SwiftUI, Combine, async/await, property wrappers, actors, Swift Package Manager, Core Data, UIKit interop, @MainActor. Triggers: Swift, SwiftUI, Combine, iOS, Xcode, actor, property wrapper, Core Data, SPM, UIKit, @MainActor, @State, @Binding. Load when writing or reviewing Swift code.
538
538
  - **tdd**: Test-driven development with red-green-refactor loop and vertical slices. Use when user wants TDD, test-first development, red-green-refactor, or building features with tests driving the implementation. Codex-adapted: uses native subagents and plan tracking.
539
- - **teams**: Launch pre-configured Agent Teams for common workflows Codex-adapted: uses native subagents and plan tracking.
539
+ - **teams**: Launches pre-configured multi-agent teams for code review, debugging, feature development, security audits, and database migrations. Use when the user asks to start a multi-agent workflow, coordinate agent teams, run a team review, or needs parallel agent collaboration on a complex task. Codex-adapted: uses native subagents and plan tracking.
540
540
  - **test**: Run tests with coverage analysis and reporting
541
541
  - **testing-patterns**: Testing strategy and craft: pyramid vs trophy, unit/integration/e2e split, fixtures, mocks vs fakes vs stubs, AAA pattern, flaky test diagnosis, coverage goals, property-based testing. Triggers: test, testing strategy, fixture, mock, stub, AAA, unit test, integration test, e2e, Playwright, Cypress, flaky, coverage, TDD, test pyramid. Load when writing, reviewing, or designing test suites.
542
542
  - **triage-issue**: Triage a bug by deeply exploring the codebase for root cause, then create a GitHub issue with a TDD-based fix plan. Mostly hands-off — minimal user interaction. Use when user reports a bug, wants to investigate an issue, mentions triage, or wants a fix plan. Codex-adapted: uses native subagents and plan tracking.
@@ -548,12 +548,12 @@ Skills are invocable commands or auto-loaded knowledge sources:
548
548
 
549
549
  ## Quality Standards
550
550
 
551
- Derived from the immutable safety constitution (5 articles):
551
+ Derived from the immutable safety constitution (6 articles):
552
552
 
553
553
  **Article I — Safety First**
554
554
  - No data loss: never delete files without backup verification or using reversible operations
555
555
  - No blind execution: never run LLM-generated code without static analysis or review
556
- - No infinite loops: all autonomous loops must have a maximum iteration count (max 3)
556
+ - No infinite loops: all autonomous loops must have a maximum iteration count (max 5)
557
557
 
558
558
  **Article II — Hierarchy of Truth**
559
559
  - The Knowledge Base (`kb/`) is the source of truth; if code contradicts KB, check KB freshness
@@ -572,6 +572,12 @@ Derived from the immutable safety constitution (5 articles):
572
572
  - Commands like `rm -rf`, `DROP TABLE`, `FORMAT` require explicit user confirmation
573
573
  - Operate within assigned model tiers; model tier changes require user approval
574
574
 
575
+ **Article VI — Repair Discipline**
576
+ - No dead code: unused code (files, classes, functions, imports, variables) must be removed in the same change that makes it unused; 'pre-existing' or 'out of scope' is not a valid reason
577
+ - Fix every found bug: bugs, gaps, missing tests, or stale docs discovered during a task must be fixed in the same change when directly adjacent to the work; deferral requires explicit user decision
578
+ - Tests and docs follow behavior: behavior changes must carry matching integration and unit tests plus affected documentation in the same change
579
+ - Verify before claiming done: re-read the diff before marking a task complete; no orphaned references, no missing coverage, no stale docs
580
+
575
581
  ## Workflow Guidelines
576
582
 
577
583
  - **Plan First**: Tasks longer than 1 hour require a plan, success criteria, and pre-mortem
package/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ Versioning follows [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ---
9
9
 
10
+ ## v2.10.1 — Art. VI Enforcement Drift Repair (2026-04-21)
11
+
12
+ ### Fixed
13
+ - **`IMMUTABLE_ARTICLES` extended to include Article 6** (`scripts/config_merger.py`, `scripts/config_validator.py`) — v2.10.0 declared Art. VI immutable in `app/constitution.md` but left the enforcement constant at `{1..5}`, so a downstream `extends:` config with `amendments: [{article: 6, ...}]` would silently override Repair Discipline. Constant now `{1..6}`; error message points at article 7+ as the first allowed project-added article.
14
+ - **`scripts/emission.py::generate_quality_standards()` emits Article VI** — generator hard-coded I–V only, so `AGENTS.md`, `GEMINI.md`, editor rule files, and `llms-full.txt` did not carry Art. VI text after the v2.10.0 release. Added four-clause VI block (no dead code, fix every found bug, tests and docs follow behavior, verify before done). All downstream catalogs regenerated.
15
+ - **"5 articles" / "Articles I-V" literals updated to 6 / I-VI** across `README.md`, `app/ARCHITECTURE.md`, `kb/reference/architecture-overview.md`, `kb/reference/enterprise-config-guide.md`, `scripts/config_cli.py` diff label, and `scripts/schemas/ai-toolkit-config.schema.json` description. Added Article VI row to the Constitution table in `architecture-overview.md`.
16
+ - **Article I.3 "Max 3" aligned to Section 4 "Max 5"** in `app/constitution.md` to resolve a pre-existing internal contradiction. Same iteration cap now quoted in `scripts/emission.py` general/quality guidelines.
17
+ - **SKILL.md improvements from PR #8 by @rohan-tessl** — `biz-scan`, `evolve`, `plan`, `predict`, and `teams` gained richer descriptions with explicit "Use when..." clauses and executable protocol steps; team preset details moved to `teams/reference/presets.md` (progressive disclosure). Repo style applied (no em dashes); `plan/SKILL.md` KB Integration section preserved.
18
+
19
+ ### Added
20
+ - **`scripts/validate.py` article-count drift lint** (`validate_constitution_drift`) — parses `app/constitution.md` for `## Article <roman>:` headings, derives the expected count and max roman numeral, and fails strict validation when `README.md`, `app/ARCHITECTURE.md`, or `kb/reference/*` references a stale `N articles` or `Articles I-<roman>` literal. This is how v2.10.0 drift slipped past CI; it will not next time.
21
+
22
+ ### Notes
23
+ - No skill/agent/hook counts changed. Totals remain: 44 agents, 99 skills, 666 tests.
24
+ - Art. VI text itself (in `app/constitution.md`) unchanged from v2.10.0 — only surfaces and enforcement are reconciled with it.
25
+
26
+ ---
27
+
10
28
  ## v2.10.0 — Constitution Article VI: Repair Discipline (2026-04-21)
11
29
 
12
30
  ### Added
package/README.md CHANGED
@@ -10,11 +10,12 @@
10
10
 
11
11
  ---
12
12
 
13
- ## What's New in v2.10.0
13
+ ## What's New in v2.10.1
14
14
 
15
- - **Constitution Article VI Repair Discipline** — four new immutable rules close the "świadome pominięcie / out of scope / separate PR" loophole: no dead code (VI.1), fix every found bug (VI.2), tests and docs follow behavior (VI.3), verify before claiming done (VI.4). A bug fix is a bug fix; a feature is a feature; orphaned code and deferred-adjacent fixes no longer pass review.
16
- - **`system-governor` gains Art. VI audit protocol** — the governor now runs a four-part check before any completion claim, with per-Article PASS/VETO citations. Scope is intentionally scoped to commit message + PR body + non-`.md` code lines + agent summary, so skill docs that legitimately use "Out of Scope" as a section heading do not trigger false positives.
17
- - **Rule, skill, and agent reinforcement** `coding-style` rule (v1.1.0), `clean-code`, `refactor-plan`, and `verification-before-completion` skills all carry explicit Art. VI anchors and checklist rows. Totals unchanged: 44 agents, 99 skills, 666 tests.
15
+ - **Art. VI enforcement drift repaired** — `IMMUTABLE_ARTICLES` in `config_merger.py` and `config_validator.py` extended to include Article 6, so downstream `extends:` configs can no longer override Repair Discipline. Enterprise config schema, CLI diff label, and doc surfaces updated to match.
16
+ - **Generator emits Article VI** — `scripts/emission.py::generate_quality_standards()` now includes Article VI's four clauses; `AGENTS.md`, `GEMINI.md`, `llms-full.txt`, and editor rule files (`.clinerules`, `.roo`, `.windsurf`, `.augment`, `.agents`, `.github/copilot-instructions.md`) all regenerated.
17
+ - **Constitution self-consistency** Article I.3 "Max 3" aligned to Section 4's "maximum 5 iterations". `validate.py --strict` now fails on article-count drift between `app/constitution.md` and downstream catalogs; the lint parses `## Article <roman>:` headings and fails on stale count or roman-range literals elsewhere.
18
+ - **SKILL.md improvements from #8** (merged from @rohan-tessl) — `biz-scan`, `evolve`, `plan`, `predict`, and `teams` got richer descriptions, executable protocol steps, and structured report templates; team preset details moved to `teams/reference/presets.md` for progressive disclosure. 5 skills total, totals unchanged: 44 agents, 99 skills, 666 tests.
18
19
 
19
20
  See [CHANGELOG.md](CHANGELOG.md) for full history.
20
21
 
@@ -121,7 +122,7 @@ See [CLI Reference](kb/reference/cli-reference.md) for all commands and options.
121
122
  | `agents/` | 44 | Specialized agents across 10 categories |
122
123
  | `hooks/` | 21 global + 5 skill-scoped | Quality gates, path safety, prompt governance, session lifecycle |
123
124
  | `plugins/` | 11 packs | Opt-in domain bundles (security, research, frontend, enterprise, 6 language packs) |
124
- | `constitution.md` | 5 articles | Machine-enforced safety rules |
125
+ | `constitution.md` | 6 articles | Machine-enforced safety rules |
125
126
  | `rules/` | auto-injected | Language-specific and custom rules injected into your configs |
126
127
  | `kb/` | reference docs | Architecture, procedures, and best practices |
127
128
 
@@ -138,7 +139,7 @@ ai-toolkit/
138
139
  │ ├── hooks/ # Hook scripts (21 entries, 12 lifecycle events)
139
140
  │ ├── plugins/ # 11 experimental plugin packs (opt-in)
140
141
  │ ├── output-styles/ # System prompt output style overrides
141
- │ ├── constitution.md # 5 immutable safety articles
142
+ │ ├── constitution.md # 6 immutable safety articles
142
143
  │ └── ARCHITECTURE.md # Full system design
143
144
  ├── kb/ # Reference docs, procedures, plans
144
145
  ├── scripts/ # Validation, install, evaluation scripts
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-toolkit",
3
3
  "description": "Professional-grade Claude Code toolkit with persona presets, skill security auditor, expanded lifecycle hooks, experimental opt-in plugin packs, benchmark harvesting, and multi-tool support.",
4
- "version": "2.10.0",
4
+ "version": "2.10.1",
5
5
  "author": {
6
6
  "name": "SoftSpark",
7
7
  "url": "https://github.com/softspark"
@@ -266,7 +266,7 @@ Phase 2: IMPLEMENTATION
266
266
  ├── hooks.json # Quality gate hooks (multi-language)
267
267
  ├── skills/ # All skills: task, hybrid, knowledge
268
268
  ├── output-styles/ # System prompt output style overrides (e.g. golden-rules)
269
- ├── constitution.md # Immutable safety rules (5 articles)
269
+ ├── constitution.md # Immutable safety rules (6 articles)
270
270
  └── settings.local.json # Local settings + Agent Teams config
271
271
  ```
272
272
 
@@ -332,7 +332,7 @@ The `inject_section_cli.py` script provides a stable marker-based injection API.
332
332
  `scripts/compile_slm.py` compiles the full toolkit (20K+ tokens) into a minimal system prompt for Small Language Models (2K-16K tokens). Pipeline: Parse → Score → Compress → Pack → Emit. Supports 4 compression levels (ultra-light, light, standard, extended), 4 output formats (raw, ollama, json-string, aider), persona-aware scoring, and language-aware rule filtering. Profile `offline-slm` in `manifest.json`. Constitution is always included (non-negotiable).
333
333
 
334
334
  ### Config Inheritance (`extends`)
335
- `scripts/config_resolver.py`, `config_merger.py`, `config_validator.py`, `config_cli.py`, `config_scaffold.py`, `config_lock.py`. Enterprise configuration inheritance via `.softspark-toolkit.json` `extends` field. Resolves base configs from npm packages, Git URLs, or local paths. Layered deep merge with constitution immutability (Articles I-V absolute), enforce constraints (`requiredAgents`, `forbidOverride`, `minHookProfile`), override validation (`override: true` + justification), and lock file (`.softspark-toolkit.lock.json`). CLI: `config validate`, `config diff`, `config init`, `config create-base`, `config check`. Integrated into `install --local` and `update --local` flows.
335
+ `scripts/config_resolver.py`, `config_merger.py`, `config_validator.py`, `config_cli.py`, `config_scaffold.py`, `config_lock.py`. Enterprise configuration inheritance via `.softspark-toolkit.json` `extends` field. Resolves base configs from npm packages, Git URLs, or local paths. Layered deep merge with constitution immutability (Articles I-VI absolute), enforce constraints (`requiredAgents`, `forbidOverride`, `minHookProfile`), override validation (`override: true` + justification), and lock file (`.softspark-toolkit.lock.json`). CLI: `config validate`, `config diff`, `config init`, `config create-base`, `config check`. Integrated into `install --local` and `update --local` flows.
336
336
 
337
337
  ### Project Registry
338
338
  `scripts/install_steps/project_registry.py`, `scripts/update_projects.py`, `scripts/projects_cli.py`. Tracks all `--local` installed projects in `~/.softspark/ai-toolkit/projects.json`. `ai-toolkit update` propagates to all registered projects in parallel via `ThreadPoolExecutor`. CLI: `ai-toolkit projects`, `--prune`, `remove <path>`.
@@ -11,7 +11,7 @@ status: IMMUTABLE
11
11
  ## Article I: Safety First
12
12
  1. **No Data Loss**: Never delete a file without verifying a backup exists or using `git rm` (which is reversible).
13
13
  2. **No Blind Execution**: Never execute code generated by an LLM without static analysis or review.
14
- 3. **No Infinite Loops**: All autonomous loops (Learning, Evolving) must have a maximum iteration count (Max 3).
14
+ 3. **No Infinite Loops**: All autonomous loops (Learning, Evolving) must have a maximum iteration count (Max 5, consistent with Section 4).
15
15
 
16
16
  ### Section 4: Autonomous Loop Limits
17
17
  - Autonomous loops (including `/repeat` skill) default to maximum 5 iterations
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: biz-scan
3
- description: "Scan codebase for business opportunities and KPIs"
3
+ description: "Scans codebase for business opportunities by analyzing database schemas, API endpoints, tracking events, and feature flags to surface underutilized capabilities, missing KPIs, and monetization gaps. Use when the user asks about revenue opportunities, business metrics, KPI coverage, analytics gaps, or monetization analysis of a codebase."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[area]"
@@ -13,18 +13,74 @@ allowed-tools: Read, Grep, Glob
13
13
 
14
14
  $ARGUMENTS
15
15
 
16
- Triggers the Business Intelligence agent to find opportunities.
16
+ Triggers the Business Intelligence agent to analyze the codebase for business opportunities and KPI gaps.
17
17
 
18
18
  ## Usage
19
19
 
20
20
  ```bash
21
21
  /biz-scan [scope]
22
- # Example: /biz-scan schema
23
- # Example: /biz-scan all
22
+ # /biz-scan schema : focus on database models and entity relationships
23
+ # /biz-scan api : focus on API endpoints and data exposure
24
+ # /biz-scan all : full codebase scan
24
25
  ```
25
26
 
26
27
  ## Protocol
27
- 1. **Model Scan**: Read DB schema / Entities.
28
- 2. **Logic Scan**: Read Controllers / UseCases.
29
- 3. **Synthesis**: Match Data vs Business Goals.
30
- 4. **Report**: Generate Opportunity Report.
28
+
29
+ ### 1. Model Scan: Analyze Data Layer
30
+
31
+ Scan for business-relevant data structures:
32
+
33
+ ```bash
34
+ # Find database models, schemas, entities
35
+ grep -rl "model\|schema\|entity\|migration" --include="*.py" --include="*.ts" --include="*.rb" .
36
+ # Find ORM definitions
37
+ grep -rl "prisma\|sequelize\|typeorm\|sqlalchemy\|activerecord" .
38
+ ```
39
+
40
+ Catalog: entity names, relationships, fields that map to business concepts (revenue, subscription, usage, billing).
41
+
42
+ ### 2. Logic Scan: Analyze Business Logic
43
+
44
+ Scan controllers, services, and use cases:
45
+
46
+ ```bash
47
+ # Find API endpoints and handlers
48
+ grep -rn "router\.\|app\.\(get\|post\|put\|delete\)\|@Controller\|@app\.route" --include="*.ts" --include="*.py" --include="*.js" .
49
+ # Find tracking/analytics events
50
+ grep -rn "track\|analytics\|event\|metric\|log_event" --include="*.ts" --include="*.py" --include="*.js" .
51
+ ```
52
+
53
+ Catalog: exposed endpoints, tracked events, feature flags, A/B tests.
54
+
55
+ ### 3. Synthesis: Match Data vs. Business Goals
56
+
57
+ Cross-reference findings to identify:
58
+
59
+ | Category | What to Look For |
60
+ |----------|-----------------|
61
+ | **Missing KPIs** | Entities with no associated tracking events |
62
+ | **Underutilized features** | Endpoints with no analytics or feature-flag coverage |
63
+ | **Monetization gaps** | Subscription/billing entities without conversion tracking |
64
+ | **Data exposure** | Rich internal data not surfaced via API |
65
+
66
+ ### 4. Report: Generate Opportunity Report
67
+
68
+ Output a structured markdown report:
69
+
70
+ ```markdown
71
+ ## Business Opportunity Report: [scope]
72
+
73
+ ### KPI Coverage
74
+ | Entity/Feature | Tracked Events | Gap |
75
+ |---------------|---------------|-----|
76
+ | [name] | [events or "none"] | [what's missing] |
77
+
78
+ ### Opportunities (ranked by estimated impact)
79
+ 1. **[Opportunity]**: [description, affected entities, suggested action]
80
+
81
+ ### Quick Wins
82
+ - [ ] Add tracking to [feature], estimated lift: [low/med/high]
83
+
84
+ ### Data Exposure Gaps
85
+ - [Entity] has [N fields] not exposed via any API endpoint
86
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: evolve
3
- description: "Evolve agent definitions via meta-architect"
3
+ description: "Analyzes failure patterns and inefficiencies in agent/skill definitions, then drafts and applies targeted improvements to system prompts, tool permissions, and behavioral rules. Use when the user asks to improve agent behavior, refine skill definitions, update system prompts, or optimize agent configurations based on observed failures."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  context: fork
@@ -10,18 +10,58 @@ allowed-tools: Read, Edit, Grep, Glob
10
10
 
11
11
  # Evolve Command
12
12
 
13
- Triggers the Meta-Architect to improve the system.
13
+ $ARGUMENTS
14
+
15
+ Triggers the Meta-Architect to improve agent and skill definitions based on observed patterns.
14
16
 
15
17
  ## Usage
16
18
 
17
19
  ```bash
18
20
  /evolve [source]
19
- # Example: /evolve learnings (Analyze kb/learnings)
20
- # Example: /evolve last-failure (Analyze last error log)
21
+ # /evolve learnings : analyze kb/learnings/ for recurring failure patterns
22
+ # /evolve last-failure : analyze the most recent error log
23
+ # /evolve agents : audit all agent definitions for gaps
21
24
  ```
22
25
 
23
26
  ## Protocol
24
- 1. **Analyze**: Read input source for patterns of failure/inefficiency.
25
- 2. **Design**: Draft changes to `.claude/agents/` or `.claude/skills/`.
26
- 3. **Implement**: Apply changes.
27
- 4. **Report**: Document what evolved.
27
+
28
+ ### 1. Analyze
29
+
30
+ Read the input source and extract actionable patterns:
31
+
32
+ - **learnings**: grep `kb/learnings/` for entries tagged `failure`, `retry`, `timeout`, or `inefficiency`
33
+ - **last-failure**: read the most recent file in `kb/learnings/` and identify root cause
34
+ - **agents**: scan all `.md` files in `app/agents/` for missing tools, vague prompts, or mismatched model tiers
35
+
36
+ ### 2. Design
37
+
38
+ Draft changes targeting the identified patterns:
39
+
40
+ | Target | File Location | Change Type |
41
+ |--------|--------------|-------------|
42
+ | Agent definitions | `app/agents/*.md` | Frontmatter (tools, model), system prompt text |
43
+ | Skill definitions | `app/skills/*/SKILL.md` | Description, workflow steps, allowed-tools |
44
+ | Rules | `app/rules/` | New or updated rule files |
45
+
46
+ Show the proposed diff to the user before applying.
47
+
48
+ ### 3. Implement
49
+
50
+ Apply approved changes. After each edit:
51
+
52
+ - Run `python3 scripts/validate.py` to confirm structural integrity
53
+ - Verify YAML frontmatter parses without errors
54
+ - Confirm no forbidden patterns (eval, exec, shell=True)
55
+
56
+ ### 4. Report
57
+
58
+ Create a summary documenting what evolved:
59
+
60
+ ```markdown
61
+ ## Evolution Report
62
+ - **Source**: [learnings | last-failure | agents]
63
+ - **Pattern found**: [description of failure/inefficiency]
64
+ - **Changes applied**:
65
+ - `app/agents/[name].md`: [what changed and why]
66
+ - **Validation**: passed / failed
67
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: plan
3
- description: "Plan implementation with tasks and success criteria"
3
+ description: "Breaks down feature requests and project goals into phased implementation plans with task lists, agent assignments, dependency graphs, and success criteria. Use when the user asks to plan a feature, create an implementation roadmap, break down a coding task, or outline project phases."
4
4
  user-invocable: true
5
5
  effort: high
6
6
  argument-hint: "[goal]"
@@ -11,71 +11,14 @@ allowed-tools: Read, Grep, Glob
11
11
 
12
12
  $ARGUMENTS
13
13
 
14
- Create a structured plan for a new project or feature.
14
+ ## Workflow
15
15
 
16
- ## Usage
17
-
18
- ```
19
- /plan [description]
20
- ```
21
-
22
- ## What This Command Does
23
-
24
- 1. **Analyzes** the request
25
- 2. **Identifies** project type and tech stack
26
- 3. **Breaks down** into tasks
27
- 4. **Creates** plan file with agent assignments
28
-
29
- ## Plan File Output
30
-
31
- Creates a `{project-slug}.md` file in project root:
32
-
33
- ```markdown
34
- # {Project Name} - Implementation Plan
35
-
36
- ## Overview
37
- - **Type**: [Web App / Mobile App / API / etc.]
38
- - **Stack**: [Tech choices]
39
- - **Complexity**: [Low / Medium / High]
40
-
41
- ## Requirements
42
- 1. [Requirement 1]
43
- 2. [Requirement 2]
44
-
45
- ## Task Breakdown
46
-
47
- ### Phase 1: Foundation
48
- - [ ] Task 1 (Agent: backend-specialist)
49
- - [ ] Task 2 (Agent: database-architect)
50
-
51
- ### Phase 2: Core Features
52
- - [ ] Task 3 (Agent: frontend-specialist)
53
- - [ ] Task 4 (Agent: backend-specialist)
54
-
55
- ### Phase 3: Polish
56
- - [ ] Task 5 (Agent: test-engineer)
57
- - [ ] Task 6 (Agent: devops-implementer)
58
-
59
- ## Agent Assignment
60
-
61
- | Task | Agent | Dependencies |
62
- |------|-------|--------------|
63
- | Database | database-architect | None |
64
- | API | backend-specialist | Database |
65
- | UI | frontend-specialist | API |
66
- | Tests | test-engineer | All above |
67
-
68
- ## File Structure
69
- ```
70
- project/
71
- ├── src/
72
- └── ...
73
- ```
74
-
75
- ## Success Criteria
76
- - [ ] Criterion 1
77
- - [ ] Criterion 2
78
- ```
16
+ 1. **Analyze scope**: read the goal, scan relevant source files to understand current state
17
+ 2. **Detect project type**: match keywords to determine stack and primary agents (see table below)
18
+ 3. **Break into phases**: group tasks by dependency order (foundation, core, polish)
19
+ 4. **Assign agents**: map each task to the best-fit agent with explicit dependencies
20
+ 5. **Write plan file**: create `{project-slug}.md` in project root using [templates/plan-template.md](templates/plan-template.md)
21
+ 6. **Validate**: confirm every requirement maps to at least one task, no circular dependencies exist, and success criteria are measurable
79
22
 
80
23
  ## Project Type Detection
81
24
 
@@ -83,44 +26,29 @@ project/
83
26
  |----------|------|----------------|
84
27
  | landing, website | Static Site | frontend-specialist |
85
28
  | dashboard, admin | Web App | frontend + backend |
86
- | api, rest | API Only | backend-specialist |
29
+ | api, rest, graphql | API Only | backend-specialist |
87
30
  | mobile, ios, android | Mobile | mobile-developer |
88
- | game, unity | Game | game-developer |
31
+ | cli, terminal | CLI Tool | backend-specialist |
89
32
 
90
- ## PLAN MODE RULES
33
+ ## Planning Constraints
91
34
 
92
- During planning:
93
- - Create plan documents
94
- - Define tasks and structure
95
- - NO code writing
96
- - NO file creation (except plan)
97
-
98
- ## Common Rationalizations
99
-
100
- | Excuse | Why It's Wrong |
101
- |--------|----------------|
102
- | "We already know what to build" | Assumed requirements lead to rework — validate assumptions explicitly |
103
- | "Planning is wasted time, just start coding" | Unplanned work has 3-5x more rework — 30 min planning saves days |
104
- | "The requirements will change anyway" | Plans adapt — without one, you can't assess impact of changes |
105
- | "It's a small feature, no plan needed" | Small features in complex systems have hidden dependencies — map them |
106
- | "We'll figure it out as we go" | Discovery without structure leads to scope creep and missed edge cases |
107
-
108
- ## Next Steps
109
-
110
- After plan approval:
111
- 1. Use `/orchestrate` to execute with agents
112
- 2. Or manually invoke specific agents
35
+ - Create plan documents only, NO code writing, NO file creation (except the plan)
36
+ - Each task must name affected file(s) and a single owning agent
37
+ - Phases must have explicit dependency edges (`Phase 1 -> Phase 2`)
38
+ - Success criteria must be verifiable (command to run, expected output, or observable behavior)
113
39
 
114
40
  ## KB Integration
115
41
 
116
42
  Before planning:
43
+
117
44
  ```python
118
45
  smart_query("project template: {type}")
119
46
  hybrid_search_kb("architecture {pattern}")
120
47
  ```
121
48
 
122
49
  ## Related Skills
123
- - Plan approved? → `/orchestrate` or `/workflow` to execute with agents
124
- - Need requirements first? `/write-a-prd` for structured product requirements
125
- - Want to stress-test the plan? `/grill-me` for Socratic questioning
126
- - Ready to break into issues? `/prd-to-plan` `/triage-issue`
50
+
51
+ - Plan approved? -> `/orchestrate` or `/workflow` to execute with agents
52
+ - Need requirements first? -> `/write-a-prd` for structured product requirements
53
+ - Want to stress-test the plan? -> `/grill-me` for Socratic questioning
54
+ - Ready to break into issues? -> `/prd-to-plan` -> `/triage-issue`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: predict
3
- description: "Predict regressions and impact before changes land"
3
+ description: "Analyzes code diffs and file changes to identify potential regressions, maps dependency impact across the codebase, and generates a risk-scored impact report. Use when reviewing pull requests, assessing code change risk, checking for breaking changes, or analyzing the blast radius of a diff."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[change description]"
@@ -13,18 +13,66 @@ allowed-tools: Read, Grep, Glob
13
13
 
14
14
  $ARGUMENTS
15
15
 
16
- Triggers the Predictive Analyst to assess impact.
16
+ Triggers the Predictive Analyst to assess the impact and regression risk of proposed changes.
17
17
 
18
18
  ## Usage
19
19
 
20
20
  ```bash
21
21
  /predict [path_or_diff]
22
- # Example: /predict src/auth
23
- # Example: /predict --diff (analyzes uncommitted changes)
22
+ # /predict src/auth : analyze all files under src/auth
23
+ # /predict --diff : analyze uncommitted changes (git diff)
24
+ # /predict src/api/routes.ts : analyze a single file
24
25
  ```
25
26
 
26
27
  ## Protocol
27
- 1. **Scope**: Identify target files.
28
- 2. **Trace**: Build dependency graph.
29
- 3. **Assess**: Calculate risk score.
30
- 4. **Report**: Generate Impact Prediction.
28
+
29
+ ### 1. Scope: Identify Target Files
30
+
31
+ - If path provided: collect all files under that path
32
+ - If `--diff`: run `git diff --name-only` to get changed files
33
+ - List each file with its last-modified date and line count
34
+
35
+ ### 2. Trace: Build Dependency Graph
36
+
37
+ For each target file, find dependents:
38
+
39
+ ```bash
40
+ # Find files that import/require the target
41
+ grep -rl "import.*from.*[target]" --include="*.ts" --include="*.py" --include="*.js" .
42
+ grep -rl "require.*[target]" --include="*.js" --include="*.ts" .
43
+ ```
44
+
45
+ Build a graph: `changed file, direct dependents, transitive dependents (1 level)`
46
+
47
+ ### 3. Assess: Calculate Risk Score
48
+
49
+ Score each changed file on a 1 to 5 scale:
50
+
51
+ | Factor | Weight | Scoring |
52
+ |--------|--------|---------|
53
+ | Dependent count | 30% | 0 deps = 1, 1 to 3 = 2, 4 to 10 = 3, 11 to 20 = 4, 21+ = 5 |
54
+ | Test coverage | 30% | Has dedicated test = 1, partial = 3, none = 5 |
55
+ | Change surface | 20% | < 10 lines = 1, 10 to 50 = 2, 50 to 200 = 3, 200+ = 5 |
56
+ | Shared/core file | 20% | Leaf = 1, mid-layer = 3, core/shared = 5 |
57
+
58
+ **Overall risk** = weighted average rounded to nearest integer.
59
+
60
+ ### 4. Report: Generate Impact Prediction
61
+
62
+ Output a markdown report:
63
+
64
+ ```markdown
65
+ ## Impact Prediction: [scope]
66
+
67
+ | File | Risk | Dependents | Test Coverage | Notes |
68
+ |------|------|------------|---------------|-------|
69
+ | src/auth/login.ts | 4/5 | 12 files | partial | Core auth flow |
70
+
71
+ ### High-Risk Changes (score >= 4)
72
+ - [file]: [why it's high risk and what to watch]
73
+
74
+ ### Recommended Actions
75
+ - [ ] Add tests for [untested file]
76
+ - [ ] Review [high-dependent file] with extra scrutiny
77
+ - [ ] Run integration tests covering [affected area]
78
+ ```
@@ -1,21 +1,17 @@
1
1
  ---
2
2
  name: teams
3
- description: "Launch pre-configured Agent Teams for common workflows"
3
+ description: "Launches pre-configured multi-agent teams for code review, debugging, feature development, security audits, and database migrations. Use when the user asks to start a multi-agent workflow, coordinate agent teams, run a team review, or needs parallel agent collaboration on a complex task."
4
4
  effort: max
5
5
  user-invocable: true
6
6
  argument-hint: "<preset> [task-description]"
7
7
  allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Agent, TeamCreate, TeamDelete, SendMessage, TaskCreate, TaskList, TaskUpdate, TaskGet
8
8
  ---
9
9
 
10
- # /teams - Agent Teams Presets
10
+ # /teams: Agent Teams Presets
11
11
 
12
12
  $ARGUMENTS
13
13
 
14
- ## What This Does
15
-
16
- Launches a pre-configured Agent Teams composition for your task.
17
-
18
- Requires: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
14
+ Launches a pre-configured Agent Teams composition for your task. Requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`.
19
15
 
20
16
  ## Available Presets
21
17
 
@@ -29,70 +25,36 @@ Requires: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
29
25
  | `security` | security-architect, security-auditor, backend-specialist | Security audit |
30
26
  | `migration` | database-architect, backend-specialist, devops-implementer | Database migration |
31
27
 
32
- ## Usage Examples
28
+ See [reference/presets.md](reference/presets.md) for detailed ownership, aggregation strategies, and output formats for each preset.
29
+
30
+ ## Usage
33
31
 
34
32
  ```
35
- /teams review # Launch review team on current changes
36
- /teams debug # Launch debug team for current issue
37
- /teams feature # Launch feature team for new feature
38
- /teams security # Launch security audit team
39
- /teams migration # Launch migration team
33
+ /teams review # Launch review team on current changes
34
+ /teams debug # Launch debug team for current issue
35
+ /teams feature add auth # Launch feature team with task context
36
+ /teams security # Launch security audit team
40
37
  ```
41
38
 
42
- ## Preset Definitions
43
-
44
- ### review
45
- - **Agents**: code-reviewer (lead), security-auditor, performance-optimizer
46
- - **Ownership**: code-reviewer owns review summary; others own their domain reports
47
- - **Aggregation**: consensus flag issues found by 2+ agents as high priority
48
- - **Output**: `REVIEW.md` with severity-ranked findings
49
-
50
- ### debug
51
- - **Agents**: debugger (lead), backend-specialist, incident-responder
52
- - **Ownership**: debugger owns root-cause analysis; others own hypothesis testing
53
- - **Aggregation**: relay — debugger synthesizes findings from others
54
- - **Output**: `DEBUG_REPORT.md` with root cause and fix
55
-
56
- ### feature
57
- - **Agents**: orchestrator (lead), backend-specialist, frontend-specialist, test-engineer
58
- - **Ownership**: orchestrator owns plan; specialists own their files; test-engineer owns tests
59
- - **Aggregation**: map-reduce orchestrator integrates all outputs
60
- - **Output**: implemented feature + tests
61
-
62
- ### fullstack
63
- - **Agents**: backend-specialist, frontend-specialist, database-architect, devops-implementer
64
- - **Ownership**: each agent owns their layer (API, UI, DB, infra)
65
- - **Aggregation**: relay — backend-specialist synthesizes integration
66
- - **Output**: full stack implementation
67
-
68
- ### research
69
- - **Agents**: technical-researcher (lead), data-analyst, prompt-engineer
70
- - **Ownership**: technical-researcher owns synthesis; others own domain findings
71
- - **Aggregation**: consensus — areas of agreement highlighted
72
- - **Output**: `RESEARCH.md` with findings and recommendations
73
-
74
- ### security
75
- - **Agents**: security-architect (lead), security-auditor, backend-specialist
76
- - **Ownership**: security-architect owns threat model; auditor owns findings; backend owns remediation
77
- - **Aggregation**: relay — security-architect integrates all
78
- - **Output**: `SECURITY_AUDIT.md` with CVSS-scored findings
79
-
80
- ### migration
81
- - **Agents**: database-architect (lead), backend-specialist, devops-implementer
82
- - **Ownership**: database-architect owns schema; backend owns code changes; devops owns deployment
83
- - **Aggregation**: relay — database-architect coordinates sequence
84
- - **Output**: migration scripts + rollback plan + deployment runbook
85
-
86
- ## Steps
87
-
88
- 1. Parse `$ARGUMENTS` to extract `<preset>` and optional `[task-description]`
89
- 2. Validate preset is one of: review, debug, feature, fullstack, research, security, migration
90
- 3. Check `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` is set; warn if not
91
- 4. Display the team composition and ownership rules
92
- 5. Ask user to confirm before launching
93
- 6. Launch the appropriate agents using the Agent tool with the task description
94
- 7. Apply the aggregation strategy to synthesize results
95
- 8. Produce the defined output document
39
+ ## Workflow
40
+
41
+ 1. **Parse** `$ARGUMENTS`: extract `<preset>` and optional `[task-description]`
42
+ 2. **Validate** preset is one of: review, debug, feature, fullstack, research, security, migration
43
+ 3. **Check environment**: verify `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` is set; warn if missing
44
+ 4. **Display** team composition and ownership rules from [reference/presets.md](reference/presets.md)
45
+ 5. **Confirm** with user before launching
46
+ 6. **Launch agents**: spawn each agent with its assigned scope using the Agent tool:
47
+ ```
48
+ Agent({ description: "code-reviewer: PR review lead", prompt: "[task + ownership rules]" })
49
+ Agent({ description: "security-auditor: security findings", prompt: "[task + domain scope]" })
50
+ ```
51
+ 7. **Aggregate results**: apply the preset's aggregation strategy (consensus, relay, or map-reduce)
52
+ 8. **Produce output**: write the defined output document (e.g., `REVIEW.md`, `DEBUG_REPORT.md`)
53
+
54
+ ### Error Handling
55
+
56
+ - If an agent fails or times out: log the failure, continue with remaining agents, note the gap in the output
57
+ - If agents produce conflicting findings: the lead agent resolves conflicts; flag unresolved disagreements for user review
96
58
 
97
59
  ## Environment
98
60
 
@@ -0,0 +1,52 @@
1
+ # Agent Teams Preset Definitions
2
+
3
+ Detailed configuration for each `/teams` preset. Each preset defines agents, ownership, aggregation strategy, and output format.
4
+
5
+ ## review
6
+
7
+ - **Agents**: code-reviewer (lead), security-auditor, performance-optimizer
8
+ - **Ownership**: code-reviewer owns review summary; others own their domain reports
9
+ - **Aggregation**: consensus (flag issues found by 2+ agents as high priority)
10
+ - **Output**: `REVIEW.md` with severity-ranked findings
11
+
12
+ ## debug
13
+
14
+ - **Agents**: debugger (lead), backend-specialist, incident-responder
15
+ - **Ownership**: debugger owns root-cause analysis; others own hypothesis testing
16
+ - **Aggregation**: relay (debugger synthesizes findings from others)
17
+ - **Output**: `DEBUG_REPORT.md` with root cause and fix
18
+
19
+ ## feature
20
+
21
+ - **Agents**: orchestrator (lead), backend-specialist, frontend-specialist, test-engineer
22
+ - **Ownership**: orchestrator owns plan; specialists own their files; test-engineer owns tests
23
+ - **Aggregation**: map-reduce (orchestrator integrates all outputs)
24
+ - **Output**: implemented feature + tests
25
+
26
+ ## fullstack
27
+
28
+ - **Agents**: backend-specialist, frontend-specialist, database-architect, devops-implementer
29
+ - **Ownership**: each agent owns their layer (API, UI, DB, infra)
30
+ - **Aggregation**: relay (backend-specialist synthesizes integration)
31
+ - **Output**: full stack implementation
32
+
33
+ ## research
34
+
35
+ - **Agents**: technical-researcher (lead), data-analyst, prompt-engineer
36
+ - **Ownership**: technical-researcher owns synthesis; others own domain findings
37
+ - **Aggregation**: consensus (areas of agreement highlighted)
38
+ - **Output**: `RESEARCH.md` with findings and recommendations
39
+
40
+ ## security
41
+
42
+ - **Agents**: security-architect (lead), security-auditor, backend-specialist
43
+ - **Ownership**: security-architect owns threat model; auditor owns findings; backend owns remediation
44
+ - **Aggregation**: relay (security-architect integrates all)
45
+ - **Output**: `SECURITY_AUDIT.md` with CVSS-scored findings
46
+
47
+ ## migration
48
+
49
+ - **Agents**: database-architect (lead), backend-specialist, devops-implementer
50
+ - **Ownership**: database-architect owns schema; backend owns code changes; devops owns deployment
51
+ - **Aggregation**: relay (database-architect coordinates sequence)
52
+ - **Output**: migration scripts + rollback plan + deployment runbook
@@ -35,7 +35,7 @@ ai-toolkit/
35
35
  rules/ # Rules auto-injected into ~/.claude/CLAUDE.md
36
36
  hooks/ # Hook scripts (copied to ~/.softspark/ai-toolkit/hooks/)
37
37
  hooks.json # Hook definitions (merged into ~/.claude/settings.json)
38
- constitution.md # Immutable safety rules, 5 articles (marker-injected)
38
+ constitution.md # Immutable safety rules, 6 articles (marker-injected)
39
39
  ARCHITECTURE.md # System architecture reference (marker-injected)
40
40
  CLAUDE.md.template # Template for project CLAUDE.md (used by init)
41
41
  settings.local.json.template
@@ -292,15 +292,16 @@ Agents (code-reviewer, debugger, devops-implementer, ...)
292
292
 
293
293
  Scripts at `~/.softspark/ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for details.
294
294
 
295
- ## Constitution (5 Articles)
295
+ ## Constitution (6 Articles)
296
296
 
297
297
  | Article | Key Rule |
298
298
  |---------|----------|
299
- | I Safety First | No data loss, no blind execution, max 3 loop iterations |
299
+ | I Safety First | No data loss, no blind execution, max 5 loop iterations |
300
300
  | II Hierarchy of Truth | KB is source of truth, research protocol mandatory |
301
301
  | III Operational Integrity | Green tests = Done, logs are evidence |
302
302
  | IV Self-Preservation | Constitution is read-only, kill switch via system-governor |
303
303
  | V Resource Governance | No destructive commands without confirmation |
304
+ | VI Repair Discipline | No dead code, fix every found bug, tests and docs follow behavior, verify before done |
304
305
 
305
306
  ## Persona Presets
306
307
 
@@ -175,9 +175,9 @@ Requirements:
175
175
 
176
176
  ## Constitution Immutability
177
177
 
178
- - **Articles I-V** (toolkit core) are absolutely immutable
178
+ - **Articles I-VI** (toolkit core) are absolutely immutable
179
179
  - **Base config articles** are immutable — projects cannot modify them
180
- - Projects can **only ADD** new articles (article 6+)
180
+ - Projects can **only ADD** new articles (article 7+)
181
181
 
182
182
  ```json
183
183
  {
package/llms-full.txt CHANGED
@@ -65,7 +65,7 @@
65
65
  - **app-builder**: Full-stack app scaffolding with stack-selection matrix: Next.js, React+Vite, Nuxt, Astro, FastAPI, Django, Laravel, React Native, Flutter, Unity. Triggers: scaffold, bootstrap, new project, starter template, build app, landing page, dashboard, API, mobile app, CLI, e-commerce, game. Load when user wants to start a new project from scratch.
66
66
  - **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.
67
67
  - **architecture-decision**: Architecture decision making via trade-off analysis in RFC/RFD/ADR format: context, constraints, 3+ options, comparison, recommendation. Triggers: architecture decision, ADR, RFC, RFD, trade-offs, options comparison, design choice, pick between, should we use, evaluate approach. Load when weighing 2+ architectural options or writing decision records.
68
- - **biz-scan**: Scan codebase for business opportunities and KPIs
68
+ - **biz-scan**: Scans codebase for business opportunities by analyzing database schemas, API endpoints, tracking events, and feature flags to surface underutilized capabilities, missing KPIs, and monetization gaps. Use when the user asks about revenue opportunities, business metrics, KPI coverage, analytics gaps, or monetization analysis of a codebase.
69
69
  - **brand-voice**: Loaded when writing documentation, content, README, or user-facing text. Prevents generic LLM rhetoric and enforces direct, technical voice.
70
70
  - **briefing**: Generate executive daily briefing across all agents
71
71
  - **build**: Build the project with auto-detected toolchain
@@ -90,7 +90,7 @@
90
90
  - **documentation-standards**: KB document conventions: YAML frontmatter (7 required fields), 5-category taxonomy (reference/howto/procedures/troubleshooting/best-practices), directory-category matching, validate.sh CI rules. Triggers: kb/, KB document, architecture note, SOP, runbook, howto, frontmatter, knowledge base entry, documentation standard. Load when creating or editing any file under kb/.
91
91
  - **ecommerce-patterns**: E-commerce domain patterns: cart, checkout flow, payment providers (Stripe/Adyen), order state machine, inventory, promotions, tax, B2B vs B2C. Triggers: cart, checkout, product, SKU, inventory, payment, Stripe, Shopify, Medusa, Magento, order status, promotion, tax calculation, coupon, refund. Load when working on any e-commerce feature.
92
92
  - **evaluate**: Evaluate skill quality and RAG retrieval accuracy
93
- - **evolve**: Evolve agent definitions via meta-architect
93
+ - **evolve**: Analyzes failure patterns and inefficiencies in agent/skill definitions, then drafts and applies targeted improvements to system prompts, tool permissions, and behavioral rules. Use when the user asks to improve agent behavior, refine skill definitions, update system prompts, or optimize agent configurations based on observed failures.
94
94
  - **explain**: Explain code, architecture, or concepts with diagrams
95
95
  - **explore**: Explore codebase structure, stack, and architecture
96
96
  - **fix**: Auto-fix lint errors, type issues, and simple bugs
@@ -121,13 +121,13 @@
121
121
  - **panic**: Emergency stabilization via system-governor agent
122
122
  - **performance-profiling**: Performance measurement and optimization: four golden signals (latency/traffic/errors/saturation), p50/p95/p99, baseline-change-measure loop, flame graphs, load testing. Triggers: performance, slow, latency, p99, flame graph, profile, bottleneck, optimization, load test, benchmark, CPU profiling, memory leak. Load when diagnosing or optimizing slow code or services.
123
123
  - **persona**: Switch engineering persona at runtime: backend-lead, frontend-lead, devops-eng, junior-dev
124
- - **plan**: Plan implementation with tasks and success criteria
124
+ - **plan**: Breaks down feature requests and project goals into phased implementation plans with task lists, agent assignments, dependency graphs, and success criteria. Use when the user asks to plan a feature, create an implementation roadmap, break down a coding task, or outline project phases.
125
125
  - **plan-writing**: Implementation plan and pre-mortem drafting: phase breakdown, success criteria, risks, rollback plan, acceptance tests, estimated effort. Triggers: implementation plan, pre-mortem, phased plan, project plan, task breakdown, success criteria, rollback strategy, risk register. Load when user asks to write a plan or pre-mortem document.
126
126
  - **plugin-creator**: Creates experimental opt-in plugin packs with manifests, conventions, and optional module scaffolding for Claude and Codex runtimes
127
127
  - **pr**: Create pull requests with pre-flight validation
128
128
  - **prd-to-issues**: Break a PRD into independently-grabbable GitHub issues using vertical slices with HITL/AFK tagging and dependency ordering. Use when user wants to convert a PRD to issues, create tickets, or break down a PRD into work items.
129
129
  - **prd-to-plan**: Convert a PRD into a phased implementation plan using tracer-bullet vertical slices. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions tracer bullets.
130
- - **predict**: Predict regressions and impact before changes land
130
+ - **predict**: Analyzes code diffs and file changes to identify potential regressions, maps dependency impact across the codebase, and generates a risk-scored impact report. Use when reviewing pull requests, assessing code change risk, checking for breaking changes, or analyzing the blast radius of a diff.
131
131
  - **prompt-caching-patterns**: Loaded when user builds with Anthropic API and needs to cut cost or latency via prompt caching. Covers TTL, cache breakpoints, stacking, invalidation, and measuring hit rate.
132
132
  - **qa-session**: Interactive QA session where user reports bugs conversationally and agent files GitHub issues with domain language. Explores codebase in background for context. Use when user wants to report bugs, do QA, file issues conversationally, or mentions QA session.
133
133
  - **rag-patterns**: RAG architecture: embeddings, chunking strategies, hybrid search (BM25 + vector), reranking, CRAG/self-correcting, multi-hop reasoning, evaluation metrics. Triggers: RAG, embedding, vector search, pgvector, Qdrant, Pinecone, Weaviate, chunking, reranker, retrieval, hybrid search, semantic search, knowledge base, cosine similarity. Load when building or tuning RAG systems.
@@ -148,7 +148,7 @@
148
148
  - **swarm**: Execute tasks via Map-Reduce, Consensus, or Relay swarms
149
149
  - **swift-patterns**: Swift and iOS development patterns: SwiftUI, Combine, async/await, property wrappers, actors, Swift Package Manager, Core Data, UIKit interop, @MainActor. Triggers: Swift, SwiftUI, Combine, iOS, Xcode, actor, property wrapper, Core Data, SPM, UIKit, @MainActor, @State, @Binding. Load when writing or reviewing Swift code.
150
150
  - **tdd**: Test-driven development with red-green-refactor loop and vertical slices. Use when user wants TDD, test-first development, red-green-refactor, or building features with tests driving the implementation.
151
- - **teams**: Launch pre-configured Agent Teams for common workflows
151
+ - **teams**: Launches pre-configured multi-agent teams for code review, debugging, feature development, security audits, and database migrations. Use when the user asks to start a multi-agent workflow, coordinate agent teams, run a team review, or needs parallel agent collaboration on a complex task.
152
152
  - **test**: Run tests with coverage analysis and reporting
153
153
  - **testing-patterns**: Testing strategy and craft: pyramid vs trophy, unit/integration/e2e split, fixtures, mocks vs fakes vs stubs, AAA pattern, flaky test diagnosis, coverage goals, property-based testing. Triggers: test, testing strategy, fixture, mock, stub, AAA, unit test, integration test, e2e, Playwright, Cypress, flaky, coverage, TDD, test pyramid. Load when writing, reviewing, or designing test suites.
154
154
  - **triage-issue**: Triage a bug by deeply exploring the codebase for root cause, then create a GitHub issue with a TDD-based fix plan. Mostly hands-off — minimal user interaction. Use when user reports a bug, wants to investigate an issue, mentions triage, or wants a fix plan.
@@ -4630,7 +4630,7 @@ ai-toolkit/
4630
4630
  rules/ # Rules auto-injected into ~/.claude/CLAUDE.md
4631
4631
  hooks/ # Hook scripts (copied to ~/.softspark/ai-toolkit/hooks/)
4632
4632
  hooks.json # Hook definitions (merged into ~/.claude/settings.json)
4633
- constitution.md # Immutable safety rules, 5 articles (marker-injected)
4633
+ constitution.md # Immutable safety rules, 6 articles (marker-injected)
4634
4634
  ARCHITECTURE.md # System architecture reference (marker-injected)
4635
4635
  CLAUDE.md.template # Template for project CLAUDE.md (used by init)
4636
4636
  settings.local.json.template
@@ -4887,15 +4887,16 @@ Agents (code-reviewer, debugger, devops-implementer, ...)
4887
4887
 
4888
4888
  Scripts at `~/.softspark/ai-toolkit/hooks/`. See [hooks-catalog.md](hooks-catalog.md) for details.
4889
4889
 
4890
- ## Constitution (5 Articles)
4890
+ ## Constitution (6 Articles)
4891
4891
 
4892
4892
  | Article | Key Rule |
4893
4893
  |---------|----------|
4894
- | I Safety First | No data loss, no blind execution, max 3 loop iterations |
4894
+ | I Safety First | No data loss, no blind execution, max 5 loop iterations |
4895
4895
  | II Hierarchy of Truth | KB is source of truth, research protocol mandatory |
4896
4896
  | III Operational Integrity | Green tests = Done, logs are evidence |
4897
4897
  | IV Self-Preservation | Constitution is read-only, kill switch via system-governor |
4898
4898
  | V Resource Governance | No destructive commands without confirmation |
4899
+ | VI Repair Discipline | No dead code, fix every found bug, tests and docs follow behavior, verify before done |
4899
4900
 
4900
4901
  ## Persona Presets
4901
4902
 
@@ -6520,9 +6521,9 @@ Requirements:
6520
6521
 
6521
6522
  ## Constitution Immutability
6522
6523
 
6523
- - **Articles I-V** (toolkit core) are absolutely immutable
6524
+ - **Articles I-VI** (toolkit core) are absolutely immutable
6524
6525
  - **Base config articles** are immutable — projects cannot modify them
6525
- - Projects can **only ADD** new articles (article 6+)
6526
+ - Projects can **only ADD** new articles (article 7+)
6526
6527
 
6527
6528
  ```json
6528
6529
  {
package/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.10.0",
2
+ "version": "2.10.1",
3
3
  "components": {
4
4
  "agents": {
5
5
  "description": "44 specialized agents (orchestrator, backend, frontend, security, devops, etc.)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softspark/ai-toolkit",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "AI coding toolkit: 99 skills, 44 agents, 12-editor write-through (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo, Aider, Augment, Antigravity, Codex, opencode), machine-enforced safety constitution, SARIF audit, signed npm provenance.",
5
5
  "keywords": [
6
6
  "claude",
@@ -217,7 +217,7 @@ def _diff_constitution(base: dict, project: dict) -> None:
217
217
  if base_articles or proj_articles:
218
218
  print()
219
219
  print(" Constitution:")
220
- print(" = Articles I-V (immutable)")
220
+ print(" = Articles I-VI (immutable)")
221
221
  for num, art in sorted(base_articles.items()):
222
222
  print(f" = Article {num}: {art['title']} (inherited from base)")
223
223
  for num, art in sorted(proj_articles.items()):
@@ -2,7 +2,7 @@
2
2
  """Config merger for ai-toolkit extends system.
3
3
 
4
4
  Implements layered deep merge with:
5
- - Constitution immutability (Articles I-V absolute, base articles immutable)
5
+ - Constitution immutability (Articles I-VI absolute, base articles immutable)
6
6
  - Agent merge with requiredAgents enforcement
7
7
  - Override validation (override:true + justification required)
8
8
  - enforce block constraints (minHookProfile, requiredPlugins, forbidOverride, requiredAgents)
@@ -22,7 +22,7 @@ from typing import Any
22
22
  # Constants
23
23
  # ---------------------------------------------------------------------------
24
24
 
25
- IMMUTABLE_ARTICLES = frozenset({1, 2, 3, 4, 5})
25
+ IMMUTABLE_ARTICLES = frozenset({1, 2, 3, 4, 5, 6})
26
26
 
27
27
  HOOK_PROFILE_ORDER = {"minimal": 0, "standard": 1, "strict": 2}
28
28
 
@@ -163,7 +163,7 @@ def _merge_constitution(
163
163
  """Merge constitution — additions only, no modifications.
164
164
 
165
165
  Rules:
166
- 1. Articles I-V (1-5) are ABSOLUTELY immutable — toolkit core.
166
+ 1. Articles I-VI (1-6) are ABSOLUTELY immutable — toolkit core.
167
167
  2. Articles defined by base configs are immutable — projects cannot modify.
168
168
  3. Projects can ADD new articles with article numbers not in base.
169
169
  """
@@ -177,8 +177,8 @@ def _merge_constitution(
177
177
  if article_num in IMMUTABLE_ARTICLES:
178
178
  raise ConfigMergeError(
179
179
  f"Cannot modify Constitution Article {article_num} — immutable.\n"
180
- f"Articles I-V are defined by ai-toolkit and cannot be overridden.\n"
181
- f"You can ADD new articles (article 6+)."
180
+ f"Articles I-VI are defined by ai-toolkit and cannot be overridden.\n"
181
+ f"You can ADD new articles (article 7+)."
182
182
  )
183
183
  if article_num in base_amendments:
184
184
  raise ConfigMergeError(
@@ -21,7 +21,7 @@ from typing import Any
21
21
  VALID_PROFILES = {"minimal", "standard", "strict", "full", "offline-slm"}
22
22
  VALID_HOOK_PROFILES = {"minimal", "standard", "strict"}
23
23
  HOOK_PROFILE_ORDER = {"minimal": 0, "standard": 1, "strict": 2}
24
- IMMUTABLE_ARTICLES = frozenset({1, 2, 3, 4, 5})
24
+ IMMUTABLE_ARTICLES = frozenset({1, 2, 3, 4, 5, 6})
25
25
  MIN_JUSTIFICATION_LEN = 20
26
26
 
27
27
 
@@ -147,7 +147,7 @@ def generate_general_guidelines() -> str:
147
147
  lines = [
148
148
  "## General Guidelines",
149
149
  "",
150
- '- Apply "Safety First": no data loss, no blind execution, max 3 loop iterations',
150
+ '- Apply "Safety First": no data loss, no blind execution, max 5 loop iterations',
151
151
  "- Research before acting: check existing code and context before proposing changes",
152
152
  "- Use structured commits: feat/fix/docs/refactor/test/chore prefixes",
153
153
  "- Quality gates: lint must pass, types must check, tests must be green before done",
@@ -162,7 +162,7 @@ def generate_quality_standards() -> str:
162
162
  lines = [
163
163
  "## Quality Standards",
164
164
  "",
165
- "Derived from the immutable safety constitution (5 articles):",
165
+ "Derived from the immutable safety constitution (6 articles):",
166
166
  "",
167
167
  "**Article I — Safety First**",
168
168
  "- No data loss: never delete files without backup verification"
@@ -170,7 +170,7 @@ def generate_quality_standards() -> str:
170
170
  "- No blind execution: never run LLM-generated code without"
171
171
  " static analysis or review",
172
172
  "- No infinite loops: all autonomous loops must have a maximum"
173
- " iteration count (max 3)",
173
+ " iteration count (max 5)",
174
174
  "",
175
175
  "**Article II — Hierarchy of Truth**",
176
176
  "- The Knowledge Base (`kb/`) is the source of truth;"
@@ -196,6 +196,21 @@ def generate_quality_standards() -> str:
196
196
  " user confirmation",
197
197
  "- Operate within assigned model tiers; model tier changes"
198
198
  " require user approval",
199
+ "",
200
+ "**Article VI — Repair Discipline**",
201
+ "- No dead code: unused code (files, classes, functions, imports,"
202
+ " variables) must be removed in the same change that makes it"
203
+ " unused; 'pre-existing' or 'out of scope' is not a valid reason",
204
+ "- Fix every found bug: bugs, gaps, missing tests, or stale docs"
205
+ " discovered during a task must be fixed in the same change when"
206
+ " directly adjacent to the work; deferral requires explicit user"
207
+ " decision",
208
+ "- Tests and docs follow behavior: behavior changes must carry"
209
+ " matching integration and unit tests plus affected documentation"
210
+ " in the same change",
211
+ "- Verify before claiming done: re-read the diff before marking"
212
+ " a task complete; no orphaned references, no missing coverage,"
213
+ " no stale docs",
199
214
  ]
200
215
  return "\n".join(lines)
201
216
 
@@ -233,7 +248,7 @@ def generate_quality_guidelines() -> str:
233
248
  "## Quality Guidelines",
234
249
  "",
235
250
  '- **Safety First**: No data loss, no blind execution,'
236
- " maximum 3 autonomous loop iterations",
251
+ " maximum 5 autonomous loop iterations",
237
252
  "- **No Blind Execution**: Never run LLM-generated code"
238
253
  " without static analysis or review",
239
254
  '- **Tests are Sacred**: "Green Tests" is the only definition of Done;'
@@ -81,7 +81,7 @@
81
81
  "constitution": {
82
82
  "type": "object",
83
83
  "additionalProperties": false,
84
- "description": "Constitution amendments. Articles I-V are immutable. Base articles are immutable. Projects can only ADD new articles.",
84
+ "description": "Constitution amendments. Articles I-VI are immutable. Base articles are immutable. Projects can only ADD new articles (7+).",
85
85
  "properties": {
86
86
  "amendments": {
87
87
  "type": "array",
@@ -664,6 +664,66 @@ def _validate_version_sync(tk_dir: Path, vr: ValidationResult) -> None:
664
664
  )
665
665
 
666
666
 
667
+ ROMAN_NUMERALS = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"]
668
+
669
+
670
+ def validate_constitution_drift(tk_dir: Path, vr: ValidationResult) -> None:
671
+ """Detect article-count drift between constitution.md and downstream docs."""
672
+ print()
673
+ print("## Constitution Drift")
674
+
675
+ constitution = tk_dir / "app" / "constitution.md"
676
+ if not constitution.is_file():
677
+ return
678
+
679
+ content = constitution.read_text(encoding="utf-8")
680
+ matches = re.findall(r"^## Article ([IVX]+):", content, re.MULTILINE)
681
+ if not matches:
682
+ vr.error("Constitution has no '## Article <roman>:' headings")
683
+ return
684
+
685
+ count = len(matches)
686
+ if count > len(ROMAN_NUMERALS):
687
+ vr.error(f"Constitution has {count} articles (more than {len(ROMAN_NUMERALS)} supported)")
688
+ return
689
+ max_roman = ROMAN_NUMERALS[count - 1]
690
+
691
+ docs = [
692
+ tk_dir / "README.md",
693
+ tk_dir / "app" / "ARCHITECTURE.md",
694
+ tk_dir / "kb" / "reference" / "architecture-overview.md",
695
+ tk_dir / "kb" / "reference" / "enterprise-config-guide.md",
696
+ ]
697
+
698
+ count_pat = re.compile(r"\b(\d+)\s+(?:immutable\s+safety\s+)?articles?\b", re.IGNORECASE)
699
+ range_pat = re.compile(r"\bArticles?\s+I-([IVX]+)\b")
700
+ drift = 0
701
+ for doc in docs:
702
+ if not doc.is_file():
703
+ continue
704
+ text = doc.read_text(encoding="utf-8")
705
+ for m in count_pat.finditer(text):
706
+ n = int(m.group(1))
707
+ if 1 <= n <= len(ROMAN_NUMERALS) and n != count:
708
+ vr.error(
709
+ f"{doc.relative_to(tk_dir)} references '{n} articles' "
710
+ f"but constitution has {count}"
711
+ )
712
+ drift += 1
713
+ for m in range_pat.finditer(text):
714
+ end = m.group(1).upper()
715
+ if end != max_roman and end in ROMAN_NUMERALS:
716
+ vr.error(
717
+ f"{doc.relative_to(tk_dir)} references 'Articles I-{end}' "
718
+ f"but constitution has I-{max_roman}"
719
+ )
720
+ drift += 1
721
+
722
+ if drift == 0:
723
+ print(f" OK: constitution has {count} articles (I-{max_roman}), docs consistent")
724
+ print()
725
+
726
+
667
727
  def validate_content_quality(tk_dir: Path, vr: ValidationResult) -> None:
668
728
  """Check content quality: name matches directory, non-empty body."""
669
729
  print()
@@ -709,6 +769,7 @@ def _run_all_checks(tk_dir: Path, vr: ValidationResult) -> tuple[int, int, str]:
709
769
  validate_kb_documents(tk_dir, vr)
710
770
  validate_core_files(tk_dir, vr)
711
771
  actual_tests = validate_metadata_contracts(tk_dir, agent_count, skill_count, vr)
772
+ validate_constitution_drift(tk_dir, vr)
712
773
  validate_content_quality(tk_dir, vr)
713
774
  return agent_count, skill_count, actual_tests
714
775