Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(ruflo-migrations): v0.2.0 β€” namespace-routing fix + adopt plugin contract (ADR-0001)

Reuven894a199ccbd9
diff --git a/plugins/ruflo-migrations/.claude-plugin/plugin.json b/plugins/ruflo-migrations/.claude-plugin/plugin.json
index 682e920d62..c6d4bdfe08 100644
--- a/plugins/ruflo-migrations/.claude-plugin/plugin.json
+++ b/plugins/ruflo-migrations/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-migrations",
"description": "Schema migration management β€” generate, validate, dry-run, and rollback database migrations",
- "version": "0.1.0",
+ "version": "0.2.0",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
@@ -13,6 +13,9 @@
"migrations",
"database",
"schema",
- "rollback"
+ "rollback",
+ "mcp",
+ "dry-run",
+ "up-down-pairs"
]
}
diff --git a/plugins/ruflo-migrations/README.md b/plugins/ruflo-migrations/README.md
index f0b8150deb..0e92f95244 100644
--- a/plugins/ruflo-migrations/README.md
+++ b/plugins/ruflo-migrations/README.md
@@ -59,8 +59,33 @@ migrations/
002_add_email_index.down.sql
```
+## Compatibility
+
+- **CLI:** pinned to `@claude-flow/cli` v3.6 major+minor.
+- **Verification:** `bash plugins/ruflo-migrations/scripts/smoke.sh` is the contract.
+
+## Namespace coordination
+
+This plugin owns the `migrations` AgentDB namespace (kebab-case is implicit when the plugin name is the intent β€” same documented exception as `federation`). Follows the convention from [ruflo-agentdb ADR-0001 Β§"Namespace convention"](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md). Reserved namespaces (`pattern`, `claude-memories`, `default`) MUST NOT be shadowed.
+
+`migrations` is accessed via `memory_*` tools (namespace-routed). Tracks migration metadata, applied/pending status, and validation results.
+
+> **Routing note:** Earlier versions of these skills used `agentdb_hierarchical-*` and `agentdb_pattern-store` with namespace arguments β€” those tool families route by tier/ReasoningBank and ignore namespace strings. ADR-0001 fixed the skills to use `memory_*` for namespaced reads/writes.
+
+## Verification
+
+```bash
+bash plugins/ruflo-migrations/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Architecture Decisions
+
+- [`ADR-0001` β€” ruflo-migrations plugin contract (namespace-routing fix, smoke as contract)](./docs/adrs/0001-migrations-contract.md)
+
## Related Plugins
+- `ruflo-agentdb` β€” namespace convention owner; defines the routing rules ADR-0001 fixes a violation of
- `ruflo-adr` -- Document schema change decisions as ADRs
- `ruflo-ddd` -- Align migration boundaries with aggregate roots
- `ruflo-observability` -- Track migration execution duration and failure rates
diff --git a/plugins/ruflo-migrations/docs/adrs/0001-migrations-contract.md b/plugins/ruflo-migrations/docs/adrs/0001-migrations-contract.md
new file mode 100644
index 0000000000..c3c5c0ff10
--- /dev/null
+++ b/plugins/ruflo-migrations/docs/adrs/0001-migrations-contract.md
@@ -0,0 +1,42 @@
+---
+id: ADR-0001
+title: ruflo-migrations plugin contract β€” pinning, namespace-routing fix, namespace coordination, smoke as contract
+status: Proposed
+date: 2026-05-04
+authors:
+ - reviewer (Claude Code)
+tags: [plugin, migrations, schema, namespace, smoke-test]
+---
+
+## Context
+
+`ruflo-migrations` (v0.1.0) β€” schema migration generator + validator. 1 agent + 2 skills + 1 command.
+
+Same namespace-routing bug class as ruflo-cost-tracker / ruflo-market-data: both skills called `agentdb_hierarchical-*` and `agentdb_pattern-store` with namespace arguments, but those tool families route by tier / ReasoningBank and ignore namespace strings.
+
+## Decision
+
+1. **Functional fix:** switch namespaced reads/writes from `agentdb_hierarchical-*` to `memory_*` (namespace-routed) in both skills. Document the dual pattern-store path (typed via ReasoningBank vs namespace-routable via `memory_store`).
+2. Add this ADR (Proposed).
+3. README augment: Compatibility (pin v3.6); Namespace coordination (claims `migrations`); Verification + Architecture Decisions sections.
+4. Bump `0.1.0 β†’ 0.2.0`. Keywords add `mcp`, `dry-run`, `up-down-pairs`.
+5. `scripts/smoke.sh` β€” 10 structural checks: version + keywords; both skills + agent + command; skills use `memory_*` not `hierarchical-*` with namespace; v3.6 pin; namespace coordination; `migrations` namespace claimed; ADR Proposed; no wildcard tools.
+
+## Consequences
+
+**Positive:** real bugs fixed (silent ignored-namespace writes/reads). Plugin joins the cadence.
+
+**Negative:** none β€” anyone scripting against the broken tool calls was already silently failing.
+
+## Verification
+
+```bash
+bash plugins/ruflo-migrations/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Related
+
+- `plugins/ruflo-cost-tracker/docs/adrs/0001-cost-tracker-contract.md` β€” same bug class
+- `plugins/ruflo-market-data/docs/adrs/0001-market-data-contract.md` β€” same bug class
+- `plugins/ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md` β€” namespace convention this fix observes
diff --git a/plugins/ruflo-migrations/scripts/smoke.sh b/plugins/ruflo-migrations/scripts/smoke.sh
new file mode 100755
index 0000000000..37f8443040
--- /dev/null
+++ b/plugins/ruflo-migrations/scripts/smoke.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+set -u
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+PASS=0
+FAIL=0
+step() { printf "β†’ %s ... " "$1"; }
+ok() { printf "PASS\n"; PASS=$((PASS+1)); }
+bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
+
+step "1. plugin.json declares 0.2.0 with new keywords"
+v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
+if [[ "$v" != "0.2.0" ]]; then bad "expected 0.2.0, got '$v'"; else
+ miss=""
+ for k in mcp dry-run up-down-pairs; do
+ grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k"
+ done
+ [[ -z "$miss" ]] && ok || bad "missing keywords:$miss"
+fi
+
+step "2. both skills + agent + command present with valid frontmatter"
+miss=""
+for s in migrate-create migrate-validate; do
+ f="$ROOT/skills/$s/SKILL.md"
+ [[ -f "$f" ]] || { miss="$miss missing-$s"; continue; }
+ for k in 'name:' 'description:' 'allowed-tools:'; do
+ grep -q "^$k" "$f" || miss="$miss $s-no-$k"
+ done
+done
+[[ -f "$ROOT/agents/migration-engineer.md" ]] || miss="$miss missing-agent"
+[[ -f "$ROOT/commands/migrate.md" ]] || miss="$miss missing-command"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "3. /migrate command covers 6 subcommands"
+F="$ROOT/commands/migrate.md"
+miss=""
+for sub in create up down status validate history; do
+ grep -q "$sub" "$F" || miss="$miss $sub"
+done
+[[ -z "$miss" ]] && ok || bad "missing subcommands:$miss"
+
+step "4. migrate-create uses memory_* (namespace-routed) for store path"
+F="$ROOT/skills/migrate-create/SKILL.md"
+miss=""
+grep -q "memory_store" "$F" || miss="$miss no-memory_store"
+grep -qE 'agentdb_hierarchical-store.+migrations|migrations.+agentdb_hierarchical-store' "$F" && miss="$miss still-uses-hierarchical-store"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "5. migrate-validate uses memory_* for namespaced reads"
+F="$ROOT/skills/migrate-validate/SKILL.md"
+miss=""
+grep -q "memory_search\|memory_list" "$F" || miss="$miss no-memory-load"
+grep -qE 'agentdb_hierarchical-recall.+migrations|migrations.+agentdb_hierarchical-recall' "$F" && miss="$miss still-uses-hierarchical-recall"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "6. migrate-validate documents dual pattern-store path"
+F="$ROOT/skills/migrate-validate/SKILL.md"
+if grep -q "ReasoningBank" "$F" \
+ && grep -q "memory_store --namespace migrations" "$F"; then
+ ok
+else
+ bad "missing dual-path documentation"
+fi
+
+step "7. README pins @claude-flow/cli to v3.6"
+grep -qE "@claude-flow/cli.*v3\.6|v3\.6.*claude-flow/cli" "$ROOT/README.md" \
+ && ok || bad "v3.6 pin missing"
+
+step "8. README defers to ruflo-agentdb namespace convention"
+grep -q "ruflo-agentdb" "$ROOT/README.md" \
+ && grep -q "Namespace convention" "$ROOT/README.md" \
+ && ok || bad "namespace coordination block incomplete"
+
+step "9. ADR-0001 exists with status Proposed"
+ADR="$ROOT/docs/adrs/0001-migrations-contract.md"
+[[ -f "$ADR" ]] && grep -qE "^status:[[:space:]]*Proposed" "$ADR" \
+ && ok || bad "ADR missing or status != Proposed"
+
+step "10. no wildcard tool grants in skills"
+bad_skills=""
+for f in "$ROOT"/skills/*/SKILL.md; do
+ grep -q '^allowed-tools:[[:space:]]*\*' "$f" && bad_skills="$bad_skills $(basename $(dirname "$f"))"
+done
+[[ -z "$bad_skills" ]] && ok || bad "wildcard:$bad_skills"
+
+printf "\n%s passed, %s failed\n" "$PASS" "$FAIL"
+[[ $FAIL -eq 0 ]] || exit 1
diff --git a/plugins/ruflo-migrations/skills/migrate-create/SKILL.md b/plugins/ruflo-migrations/skills/migrate-create/SKILL.md
index 090bcda9f6..adf74a3bbf 100644
--- a/plugins/ruflo-migrations/skills/migrate-create/SKILL.md
+++ b/plugins/ruflo-migrations/skills/migrate-create/SKILL.md
@@ -2,7 +2,7 @@
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__agentdb_hierarchical-store mcp__claude-flow__agentdb_hierarchical-recall mcp__claude-flow__agentdb_pattern-search
+allowed-tools: Read Write Glob Bash mcp__claude-flow__memory_store mcp__claude-flow__memory_search mcp__claude-flow__agentdb_pattern-search
---
# Migrate Create
@@ -24,8 +24,8 @@ When you need to create a new database migration for schema changes such as crea
- Other -> generic migration template with placeholder comments
3. **Generate up migration** -- write `NNN_<name>.up.sql` with the appropriate SQL using IF NOT EXISTS for idempotency
4. **Generate down migration** -- write `NNN_<name>.down.sql` with the reverse operation using IF EXISTS
-5. **Search patterns** -- call `mcp__claude-flow__agentdb_pattern-search` to find similar past migrations for reference
-6. **Store metadata** -- call `mcp__claude-flow__agentdb_hierarchical-store` to record the migration in `migrations` namespace with number, name, status (pending), and file paths
+5. **Search past patterns** -- call `mcp__claude-flow__agentdb_pattern-search` (ReasoningBank-routed; **don't** pass a `namespace` argument β€” pattern-* tools ignore it).
+6. **Store metadata** -- call `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"](../../../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md).
7. **Report** -- display: migration number, file paths created, template used, any similar past migrations found
## CLI alternative
diff --git a/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md b/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md
index 3ce737a7fa..a8b52bc3ff 100644
--- a/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md
+++ b/plugins/ruflo-migrations/skills/migrate-validate/SKILL.md
@@ -2,7 +2,7 @@
name: migrate-validate
description: Validate pending migrations for foreign key consistency, rollback safety, and best practices
argument-hint: ""
-allowed-tools: Read Glob Grep Bash mcp__claude-flow__agentdb_hierarchical-recall mcp__claude-flow__agentdb_pattern-store mcp__claude-flow__agentdb_semantic-route
+allowed-tools: Read Glob Grep Bash mcp__claude-flow__memory_search mcp__claude-flow__memory_list mcp__claude-flow__memory_store mcp__claude-flow__agentdb_pattern-store mcp__claude-flow__agentdb_semantic-route
---
# Migrate Validate
@@ -15,7 +15,7 @@ Before applying migrations to catch issues early -- foreign key references to no
## Steps
-1. **Find pending migrations** -- use `Glob` to list all migration files, cross-reference with applied history via `mcp__claude-flow__agentdb_hierarchical-recall` to identify pending ones
+1. **Find pending migrations** -- use `Glob` to list all migration files, cross-reference with applied history via `mcp__claude-flow__memory_search --namespace migrations` (or `memory_list`) to identify pending ones. The `memory_*` tool family routes by namespace; `agentdb_hierarchical-*` does NOT (it routes by tier), so use `memory_*` here.
2. **Parse SQL** -- use `Read` to load each pending `.up.sql` and `.down.sql` file and parse the SQL statements
3. **Check foreign keys** -- verify that all REFERENCES targets exist in the current schema or in prior migrations (both applied and pending)
4. **Check NOT NULL defaults** -- verify that any ADD COLUMN with NOT NULL has a DEFAULT value
@@ -23,7 +23,9 @@ Before applying migrations to catch issues early -- foreign key references to no
6. **Flag destructive ops** -- warn on DROP TABLE, DROP COLUMN, TRUNCATE without explicit confirmation
7. **Check idempotency** -- verify IF EXISTS / IF NOT EXISTS is used for safety
8. **Check naming** -- verify table names are plural, column names are snake_case, index names follow `idx_table_column` convention
-9. **Store results** -- call `mcp__claude-flow__agentdb_pattern-store` to record validation patterns for future reference
+9. **Store validation patterns** -- two paths (per ruflo-cost-tracker ADR-0001 dual-path pattern):
+ - **Pattern store (typed, recommended)**: `mcp__claude-flow__agentdb_pattern-store` with `type: 'migration-validation'`. No namespace arg β€” ReasoningBank routes it.
+ - **Plain store (namespace-routable)**: `mcp__claude-flow__memory_store --namespace migrations` for validation results tied to a specific migration number.
10. **Report** -- display: errors (must fix), warnings (should fix), info (suggestions), with file path and line number for each issue
## CLI alternative