一键导入
migrate-create
Create a new sequentially numbered database migration with up/down SQL files
菜单
Create a new sequentially numbered database migration with up/down SQL files
MAD-based outlier detection on session spend. Robust to the very outliers it hunts (unlike mean+sigma). Surfaces specific anomalous sessions with modified-z scores; optional --alert-on-outliers exit code for CI gates. Distinct from cost-burn (aggregate trend) — this answers "which INDIVIDUAL session is the outlier?".
Burn-rate trend over time with optional drift-alert exit code. Bins session spend into buckets, surfaces window-over-window delta, and can exit 1 when latest bucket exceeds prior mean by a configurable %. Distinct from `cost-trend` (benchmark drift); this tracks PRODUCTION spend trajectory.
Multi-baseline counterfactual cost analysis. Compares actual session spend to hypothetical always-haiku / always-sonnet / always-opus routing baselines. Answers "is the routing earning its keep?" Negative savings flag over-escalation; positive savings quantify the router's win.
Snapshot delta between two cost-summary JSON outputs. PR-level cost regression detection — answers "what changed between these two specific snapshots?". Pairs with cost-summary's stable JSON contract.
Composite CI gate — runs cost-budget-check + cost-burn + cost-anomaly + cost-projection in parallel and surfaces a single combined health status with max exit code. The operationally-useful entry point — one shell-out covers all four alert ladders.
Forward-looking spend extrapolation. Computes a USD-per-day rate from the recent measurement window, projects to 7d/30d/90d/365d horizons, and surfaces "days until budget exhausted" when a budget is configured. Predictive counterpart to `cost-budget-check` (reactive).
| name | migrate-create |
| description | Create a new sequentially numbered database migration with up/down SQL files |
| argument-hint | <name> |
| allowed-tools | Read Write Glob Bash mcp__claude-flow__memory_store mcp__claude-flow__memory_search mcp__claude-flow__agentdb_pattern-search |
Generate a new database migration with sequential numbering and up/down SQL file pair.
When you need to create a new database migration for schema changes such as creating tables, adding columns, creating indexes, or modifying constraints.
Glob to scan the migrations directory for existing migration files and find the highest number, then increment by 1 (zero-pad to 3 digits)<name>, choose the appropriate SQL template:
create_ -> CREATE TABLE templateadd_ -> ALTER TABLE ADD COLUMN templatedrop_ -> DROP with safety checksindex -> CREATE INDEX templateNNN_<name>.up.sql with the appropriate SQL using IF NOT EXISTS for idempotencyNNN_<name>.down.sql with the reverse operation using IF EXISTSmcp__claude-flow__agentdb_pattern-search (ReasoningBank-routed; don't pass a namespace argument — pattern-* tools ignore it).mcp__claude-flow__memory_store --namespace migrations to record the migration with number, name, status (pending), and file paths. The memory_* tool family routes by namespace; agentdb_hierarchical-* does NOT (it routes by tier working|episodic|semantic), so use memory_* here. See ruflo-agentdb ADR-0001 §"Namespace convention".npx @claude-flow/cli@latest memory store --namespace migrations --key "migration-NNN_NAME" --value '{"number": NNN, "name": "NAME", "status": "pending"}'