Skip to content

Commit eabf310

Browse files
committed
feat(ai-phase3): add model-routing + llm-cost-optimization; update ai-harness + ai-product-design; agent skill refs (v1.9.0)
1 parent 7f9e538 commit eabf310

11 files changed

Lines changed: 664 additions & 8 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "magic-powers",
33
"description": "Cost-optimized Claude Code plugin — 11 built-in agents (+ 37 optional cloud/amplitude agents), 178 workflow skills, and 12 slash commands. Built for AI startups shipping fast with small teams.",
4-
"version": "1.8.0",
4+
"version": "1.9.0",
55
"author": {
66
"name": "kienbui1995"
77
},

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.9.0] — 2026-04-10
9+
10+
### Added
11+
- 🔀 **`model-routing`** — task-based routing, cascade escalation (cheap→expensive), content-based routing, fallback chains, routing metrics
12+
- 💰 **`llm-cost-optimization`** — prompt caching (42% reduction), output token reduction, batch API (50% discount), workflow cost accounting, application-level caching
13+
14+
### Updated
15+
- **`ai-harness`**: statistical rigor (t-test, Cohen's d, sample sizes), dataset maintenance (stale detection, production failure ingestion)
16+
- **`ai-product-design`**: agent UX patterns (progress display, transparent tool use), citation/attribution for RAG, accessibility (ARIA, mobile, i18n)
17+
18+
### Agents updated
19+
- `@ai-engineer`: added `llm-cost-optimization` + `model-routing`
20+
- `@ai-product`: added `model-routing`
21+
22+
---
23+
824
## [1.8.0] — 2026-04-10
925

1026
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Commands](https://img.shields.io/badge/commands-12-blue)](README.md#12-slash-commands)
99
[![Website](https://img.shields.io/badge/website-magic--powers.pmai.space-orange)](https://magic-powers.pmai.space)
1010

11-
**[magic-powers.pmai.space](https://magic-powers.pmai.space)** — A Claude Code plugin with cost-optimized model routing, 43 built-in skills + 67 optional skills + 42 cloud division skills (193 total), 11 specialized agents, 12 slash commands, and optional hooks/MCP integration. Built for all professional roles — dev, product, data, marketing, sales, design, and more. Also works with Cursor, Copilot, Aider, Windsurf, Gemini CLI, Codex, Kiro, and OpenCode.
11+
**[magic-powers.pmai.space](https://magic-powers.pmai.space)** — A Claude Code plugin with cost-optimized model routing, 43 built-in skills + 67 optional skills + 42 cloud division skills (195 total), 11 specialized agents, 12 slash commands, and optional hooks/MCP integration. Built for all professional roles — dev, product, data, marketing, sales, design, and more. Also works with Cursor, Copilot, Aider, Windsurf, Gemini CLI, Codex, Kiro, and OpenCode.
1212

1313
## Why Magic Powers?
1414

@@ -191,7 +191,7 @@ Skills ported from [amplitude/mcp-marketplace](https://github.com/amplitude/mcp-
191191
| Sonnet | 6 (debugger, db-optimizer, sre, git-workflow, ui-designer, product-strategist) | $$ |
192192
| Haiku | 4 (reviewer, security-reviewer, technical-writer, copywriter) | $ |
193193

194-
## 193 Skills
194+
## 195 Skills
195195

196196
**Core Workflow:** `using-magic-powers` · `brainstorming` · `writing-plans` · `executing-plans`
197197

agents/ai/engineer.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ skills:
1616
- magic-powers:ai-safety-guardrails
1717
- magic-powers:agentic-security
1818
- magic-powers:ai-harness
19+
- magic-powers:llm-cost-optimization
20+
- magic-powers:model-routing
1921
---
2022

2123
You are an AI engineer specializing in building production-grade AI features — from LLM integration to agentic systems to evaluation infrastructure.

agents/ai/product.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ skills:
1212
- magic-powers:llm-evaluation
1313
- magic-powers:prompt-engineering
1414
- magic-powers:llm-observability
15+
- magic-powers:model-routing
1516
---
1617

1718
You are an AI product specialist helping teams ship AI features that users trust and love.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "magic-powers",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "Cost-optimized Claude Code plugin — 43 skills, 11 agents, 9-tool support. Built for AI startups shipping fast with small teams.",
55
"type": "module",
66
"bin": {

site/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>✨ Magic Powers — Cost-optimized AI coding plugin</title>
7-
<meta name="description" content="11 specialized agents, 193 workflow skills (incl. GCP/AWS/Azure cloud divisions), 9-tool support. ~75% cost reduction with no quality loss. Built for AI startups shipping fast with small teams.">
7+
<meta name="description" content="11 specialized agents, 195 workflow skills (incl. GCP/AWS/Azure cloud divisions), 9-tool support. ~75% cost reduction with no quality loss. Built for AI startups shipping fast with small teams.">
88
<style>
99
* { margin: 0; padding: 0; box-sizing: border-box; }
1010

@@ -225,10 +225,10 @@
225225
</nav>
226226

227227
<div class="hero">
228-
<div class="badge">v1.8.0 · <span>MIT License</span> · npm install magic-powers</div>
228+
<div class="badge">v1.9.0 · <span>MIT License</span> · npm install magic-powers</div>
229229
<h1>Stop paying for<br>AI that guesses</h1>
230230
<p class="subtitle">
231-
11 specialized agents routed to the right model. 193 workflow skills.
231+
11 specialized agents routed to the right model. 195 workflow skills.
232232
9 tools supported. Built for AI startups shipping fast with small teams.
233233
</p>
234234
<div class="hero-actions">
@@ -261,7 +261,7 @@ <h1>Stop paying for<br>AI that guesses</h1>
261261
<div class="stat-label">Specialized agents</div>
262262
</div>
263263
<div class="stat">
264-
<div class="stat-num">193</div>
264+
<div class="stat-num">195</div>
265265
<div class="stat-label">Workflow skills</div>
266266
</div>
267267
<div class="stat">

skills/ai-harness/SKILL.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,73 @@ winner = select_winner(results, primary_metric="accuracy", cost_constraint=1.2)
120120
- Running eval only before major releases (too late to catch drift)
121121
- One aggregated score hiding category regressions
122122

123+
## Statistical Rigor
124+
125+
Avoid declaring "improvement" without statistical evidence:
126+
127+
```python
128+
from scipy import stats
129+
130+
def is_statistically_significant(baseline_scores, new_scores, alpha=0.05):
131+
"""Two-sample t-test for eval score comparison"""
132+
t_stat, p_value = stats.ttest_ind(baseline_scores, new_scores)
133+
134+
effect_size = (mean(new_scores) - mean(baseline_scores)) / std(baseline_scores)
135+
136+
return StatResult(
137+
significant=p_value < alpha,
138+
p_value=p_value,
139+
effect_size=effect_size, # Cohen's d
140+
practical_significant=abs(effect_size) > 0.2, # small effect
141+
recommendation="ship" if (p_value < alpha and effect_size > 0.2) else "no change"
142+
)
143+
144+
# Minimum sample sizes for reliable conclusions:
145+
# Small effect (d=0.2): n ≥ 197 per group
146+
# Medium effect (d=0.5): n ≥ 52 per group
147+
# Large effect (d=0.8): n ≥ 26 per group
148+
```
149+
150+
**Key rules:**
151+
- Never compare single-run scores — always run 5-10 times minimum
152+
- Report confidence intervals, not just averages
153+
- Distinguish statistical significance (p<0.05) from practical significance (effect size matters)
154+
- A 1% quality improvement usually isn't worth shipping complexity
155+
156+
## Dataset Maintenance
157+
158+
Golden datasets degrade — keep them fresh:
159+
160+
```python
161+
class EvalDatasetManager:
162+
def review_test_cases(self, dataset: Dataset, threshold_days=30):
163+
stale = [tc for tc in dataset if tc.last_reviewed_days > threshold_days]
164+
low_signal = [tc for tc in dataset if tc.pass_rate in (0.0, 1.0)]
165+
# Pass rate 0% = always fails (broken test or impossible), 1% = always passes (too easy)
166+
167+
return DatasetHealthReport(
168+
stale_count=len(stale),
169+
low_signal_count=len(low_signal),
170+
action="review_and_update" if len(stale) + len(low_signal) > len(dataset) * 0.2 else "ok"
171+
)
172+
173+
def add_from_production_failures(self, prod_failures: list[Failure]):
174+
"""Convert production failures into eval test cases"""
175+
for failure in prod_failures:
176+
if failure.confirmed_bug: # human verified
177+
dataset.add(TestCase(
178+
input=failure.input,
179+
expected=failure.expected_output,
180+
source="production_failure",
181+
added_date=today()
182+
))
183+
```
184+
185+
**Dataset health signals:**
186+
- >20% of tests always pass → too easy, add harder cases
187+
- >10% of tests never pass → broken tests or capability gap, investigate
188+
- Last reviewed >30 days → likely stale, review against recent prod distribution
189+
123190
## Integration
124191

125192
- Use with `llm-evaluation` (frameworks) and `llm-observability` (production monitoring)

skills/ai-product-design/SKILL.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,124 @@ Quality:
104104
Error rate by type (timeout, refusal, safety)
105105
```
106106

107+
## Agent UX Patterns
108+
109+
Showing agent work to users requires different UX than single-call AI:
110+
111+
**Displaying agent progress:**
112+
```
113+
┌─────────────────────────────────────────┐
114+
│ 🤖 Researching your question... │
115+
│ │
116+
│ ✅ Searched documentation (0.8s) │
117+
│ ✅ Found 3 relevant sections (0.3s) │
118+
│ ⏳ Analyzing and synthesizing... │
119+
│ │
120+
│ Step 3 of 4 — ~10s remaining │
121+
└─────────────────────────────────────────┘
122+
```
123+
124+
**Agent UX principles:**
125+
- Show steps in real-time (users trust agents they can see working)
126+
- Reveal tools used: "I searched 3 sources" builds transparency
127+
- Show intermediate results progressively (don't wait until full completion)
128+
- Provide cancel option — users need control over long-running agents
129+
- On failure: explain what was tried before failing ("I searched docs, tried 2 approaches, couldn't find...")
130+
131+
**Displaying tool use transparently:**
132+
```
133+
Agent used: 🔍 web_search("Q3 revenue report 2024")
134+
Agent used: 📄 read_file("annual_report.pdf")
135+
Agent used: 🧮 calculate(formula="revenue * 0.15")
136+
```
137+
Collapsible by default — show on hover/expand for curious users.
138+
139+
## Citation & Attribution
140+
141+
For RAG-generated content, attribution builds trust:
142+
143+
```
144+
Answer: The product launch is scheduled for Q2 2025.
145+
146+
Sources used:
147+
[1] Product Roadmap 2025.pdf — p.3: "Q2 2025 launch target"
148+
[2] Engineering Timeline.xlsx — Sheet: Milestones
149+
```
150+
151+
**Implementation:**
152+
```javascript
153+
// Track citations during RAG generation
154+
const response = await generateWithCitations(query, retrievedChunks);
155+
// response: { answer: "...", citations: [{source, page, quote}] }
156+
157+
// Render with inline citation markers
158+
renderWithCitations(response.answer, response.citations);
159+
// → "The launch is scheduled for Q2 [1]" with expandable citation [1]
160+
```
161+
162+
**When to show citations:**
163+
- Always for factual claims (dates, numbers, names)
164+
- Always for medical/legal/financial content
165+
- Optional for stylistic/creative responses
166+
- Always when user can verify the underlying source
167+
107168
## Key Outputs
108169

109170
- UX spec: streaming behavior, loading states, error messages, fallback flow
110171
- Reliability design: circuit breaker thresholds, timeout values, caching strategy
111172
- Disclosure copy: AI labels, opt-out mechanism, data usage statement
112173
- Metrics dashboard definition: acceptance rate, task completion, regeneration rate
113174

175+
## Accessibility & Mobile
176+
177+
**Accessibility for AI-specific UI elements:**
178+
```javascript
179+
// Streaming text — announce completion to screen readers
180+
<div
181+
role="log" // live region for screen readers
182+
aria-live="polite" // don't interrupt, announce when idle
183+
aria-label="AI response"
184+
>
185+
{streamingText}
186+
</div>
187+
188+
// Loading state — meaningful label, not just spinner
189+
<div role="status" aria-label="AI is generating a response, please wait">
190+
<Spinner />
191+
<span className="sr-only">Generating response...</span>
192+
</div>
193+
194+
// Confidence indicator — explain what percentage means
195+
<span
196+
title="AI confidence: 85% - This answer is likely accurate but verify for important decisions"
197+
aria-label="85% confidence"
198+
>
199+
●●●●○
200+
</span>
201+
```
202+
203+
**Mobile patterns:**
204+
- Streaming on mobile: throttle updates to 100ms (not every token) — reduces reflow
205+
- Loading states: skeleton screens better than spinners on small screens
206+
- Error messages: use native alert dialogs (not toasts) on mobile — more visible
207+
- Latency expectation: mobile users tolerate 5-8s more than desktop users (2-3s)
208+
- Offline handling: queue AI requests when offline, process when reconnected
209+
210+
**Internationalization of AI responses:**
211+
```javascript
212+
// AI error messages need translation
213+
const AI_ERROR_MESSAGES = {
214+
rate_limit: t('ai.error.rateLimitMessage'), // localized
215+
timeout: t('ai.error.timeoutMessage'),
216+
safety_refusal: t('ai.error.safetyMessage'),
217+
};
218+
219+
// RTL support for streaming text
220+
<div dir="auto" lang={userLocale}> {/* auto-detects RTL */}
221+
{streamingText}
222+
</div>
223+
```
224+
114225
## Anti-Patterns
115226

116227
- Blocking UI while waiting for AI response (always show progress)

0 commit comments

Comments
 (0)