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

feat(ruflo-plugin-creator): v0.2.0 β€” scaffold the canonical contract + MCP-drift warnings (ADR-0001)

Reuven003624f74065
diff --git a/plugins/ruflo-plugin-creator/.claude-plugin/plugin.json b/plugins/ruflo-plugin-creator/.claude-plugin/plugin.json
index e4bcf9cabb..7da3962857 100644
--- a/plugins/ruflo-plugin-creator/.claude-plugin/plugin.json
+++ b/plugins/ruflo-plugin-creator/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-plugin-creator",
- "description": "Scaffold, validate, and publish new Claude Code plugins with proper structure and MCP tool wiring",
- "version": "0.1.0",
+ "description": "Scaffold, validate, and publish new Claude Code plugins with the canonical plugin contract β€” ADR + smoke + Compatibility + namespace coordination + MCP-tool drift warnings",
+ "version": "0.2.0",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
@@ -13,6 +13,9 @@
"plugin",
"scaffold",
"generator",
- "developer-tools"
+ "developer-tools",
+ "mcp",
+ "scaffolding",
+ "contract-bootstrap"
]
}
diff --git a/plugins/ruflo-plugin-creator/README.md b/plugins/ruflo-plugin-creator/README.md
index 71182c0fc0..f3b9499ba0 100644
--- a/plugins/ruflo-plugin-creator/README.md
+++ b/plugins/ruflo-plugin-creator/README.md
@@ -1,6 +1,6 @@
# ruflo-plugin-creator
-Scaffold, validate, and publish new Claude Code plugins with proper structure and MCP tool wiring.
+Scaffold, validate, and publish new Claude Code plugins with proper structure, MCP tool wiring, AND the canonical plugin contract (ADR + smoke + Compatibility + namespace coordination).
## Install
@@ -11,9 +11,9 @@ Scaffold, validate, and publish new Claude Code plugins with proper structure an
## Features
-- **Scaffold plugins**: Generate complete plugin directory structure in seconds
+- **Scaffold plugins**: Generate complete plugin directory structure in seconds, including the canonical contract (ADR-0001, scripts/smoke.sh, README contract sections)
- **Validate format**: Check plugin.json, SKILL.md frontmatter, and file references
-- **MCP tool wiring**: Auto-discover and wire ruflo MCP tools into skills
+- **MCP tool wiring**: Auto-discover and wire ruflo MCP tools into skills, with **drift warnings** for known-broken tool references (`embeddings_embed`, namespace passed to `agentdb_hierarchical-*` / `agentdb_pattern-*`)
- **Marketplace integration**: Update marketplace.json for distribution
## Commands
@@ -22,5 +22,54 @@ Scaffold, validate, and publish new Claude Code plugins with proper structure an
## Skills
-- `create-plugin` -- Generate plugin structure with skills, commands, and agents
+- `create-plugin` -- Generate plugin structure with skills, commands, agents, ADR-0001, smoke test, and contract sections
- `validate-plugin` -- Validate plugin format and catch issues before publishing
+
+## Compatibility
+
+- **CLI:** pinned to `@claude-flow/cli` v3.6 major+minor.
+- **Verification:** `bash plugins/ruflo-plugin-creator/scripts/smoke.sh` is the contract.
+
+## Canonical plugin contract (what gets scaffolded)
+
+Every plugin scaffolded by this plugin inherits the same shape every other plugin in the ruflo family adopted via its own ADR-0001:
+
+```
+plugins/<name>/
+β”œβ”€β”€ .claude-plugin/plugin.json # version, keywords, mcp keyword
+β”œβ”€β”€ skills/<skill>/SKILL.md # name + description + allowed-tools (no wildcards)
+β”œβ”€β”€ commands/<command>.md # name + description + dispatch logic
+β”œβ”€β”€ agents/<agent>.md # name + description + model
+β”œβ”€β”€ docs/adrs/0001-<name>-contract.md # ADR (Proposed) β€” pinning, namespace, smoke scope
+β”œβ”€β”€ scripts/smoke.sh # Structural contract, β‰₯8 checks
+└── README.md # Compatibility + Namespace coordination + Verification + ADR
+```
+
+## MCP-tool drift to avoid
+
+Lessons learned from sibling-ADR fixes β€” the scaffolder warns about these:
+
+| Bug | Real tool / pattern |
+|-----|---------------------|
+| `embeddings_embed` referenced as a tool | Use `embeddings_generate` (the `_embed` name does not exist) |
+| `namespace` arg passed to `agentdb_hierarchical-*` | Use `tier` (working/episodic/semantic), or use `memory_*` for namespaced reads/writes |
+| `namespace` arg passed to `agentdb_pattern-*` | Don't pass it β€” ReasoningBank routes; fallback writes to `pattern` reserved |
+| `pattern` and `patterns` confused | They are **different** reserved namespaces |
+| Hard-coded "19 AgentDB controllers" | Defer to `agentdb_controllers` runtime; real count varies (~15 MCP tools, 29 controller names) |
+
+## Verification
+
+```bash
+bash plugins/ruflo-plugin-creator/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Architecture Decisions
+
+- [`ADR-0001` β€” ruflo-plugin-creator plugin contract (scaffold-the-canonical-contract, MCP-drift warnings, smoke as contract)](./docs/adrs/0001-plugin-creator-contract.md)
+
+## Related Plugins
+
+- `ruflo-agentdb` β€” namespace convention owner; `agentdb_controllers` runtime is the canonical controller list
+- `ruflo-cost-tracker`, `ruflo-market-data`, `ruflo-migrations`, `ruflo-observability` β€” each fixed namespace-routing bugs the scaffolder now warns about
+- `ruflo-knowledge-graph`, `ruflo-market-data` β€” each fixed `embeddings_embed` references the scaffolder now warns about
diff --git a/plugins/ruflo-plugin-creator/docs/adrs/0001-plugin-creator-contract.md b/plugins/ruflo-plugin-creator/docs/adrs/0001-plugin-creator-contract.md
new file mode 100644
index 0000000000..fd6e66afa3
--- /dev/null
+++ b/plugins/ruflo-plugin-creator/docs/adrs/0001-plugin-creator-contract.md
@@ -0,0 +1,83 @@
+---
+id: ADR-0001
+title: ruflo-plugin-creator plugin contract β€” pinning, scaffold-the-canonical-contract, MCP-drift warnings, smoke as contract
+status: Proposed
+date: 2026-05-04
+authors:
+ - reviewer (Claude Code)
+tags: [plugin, plugin-creator, scaffolding, namespace, smoke-test]
+---
+
+## Context
+
+`ruflo-plugin-creator` (v0.1.0) β€” meta-plugin that scaffolds new Claude Code plugins. 1 agent + 2 skills + 1 command.
+
+This plugin is uniquely positioned: every new plugin scaffolded by it inherits whatever contract the scaffolder produces. ADR-0001 must therefore do two things:
+
+1. **Adopt the same plugin contract** every other plugin in this session adopted (pinning, namespace coordination, smoke as contract, sibling-ADR cross-references).
+2. **Update the scaffolding output** so newly-created plugins are born with the contract β€” not retrofitted later.
+
+### Drift fixed
+
+The `create-plugin` skill mentioned "19 AgentDB controllers" β€” a stale count that [ruflo-agentdb ADR-0001 Β§"Today's `ruflo-agentdb`"](../../../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md) declared mythical (real: 15 `agentdb_*` MCP tools, 29 `ControllerName` entries). Fixed in this pass.
+
+## Decision
+
+### 1. Adopt the contract for this plugin
+
+- Add this ADR (Proposed).
+- README augment: Compatibility (pin v3.6); Namespace coordination (no AgentDB writes β€” pure scaffolding plugin); Verification + Architecture Decisions sections.
+- Bump `0.1.0 β†’ 0.2.0`. Keywords add `mcp`, `scaffolding`, `contract-bootstrap`.
+- `scripts/smoke.sh` β€” 10 structural checks.
+
+### 2. Update the scaffolding output
+
+The `create-plugin` skill is updated to scaffold:
+
+- `docs/adrs/0001-<name>-contract.md` (Proposed)
+- `scripts/smoke.sh` (8+ structural checks)
+- README sections: Compatibility, Namespace coordination, Verification, Architecture Decisions
+- A "MCP-tool drift to avoid" section warning new authors about the four real bugs the loop has been fixing across the family:
+ - `embeddings_embed` does not exist β€” use `embeddings_generate`
+ - `agentdb_hierarchical-*` ignores `namespace` arg (routes by tier) β€” use `memory_*` for namespaced reads/writes
+ - `agentdb_pattern-*` ignores `namespace` arg (routes through ReasoningBank)
+ - `pattern` (singular) β‰  `patterns` (plural) β€” different reserved namespaces
+
+### 3. Smoke contract
+
+10 checks:
+
+1. plugin.json declares `0.2.0` with new keywords.
+2. Both skills + agent + command present with valid frontmatter.
+3. `create-plugin` skill scaffolds ADR, smoke, README contract sections.
+4. `create-plugin` skill includes the MCP-tool drift warnings.
+5. `create-plugin` skill no longer claims "19 AgentDB controllers" (regression check).
+6. README pins to `@claude-flow/cli` v3.6.
+7. README has Architecture Decisions section.
+8. ADR-0001 exists with status `Proposed`.
+9. `validate-plugin` skill present.
+10. No skill grants wildcard tool access.
+
+## Consequences
+
+**Positive:**
+- Future scaffolds inherit the canonical contract automatically. The retrofit work the loop is doing right now becomes unnecessary for new plugins.
+- The four MCP-tool drift bugs we keep finding are now warnings in the scaffolder.
+- Plugin joins the cadence.
+
+**Negative:**
+- Existing scaffolds are not updated by this ADR β€” they get retrofitted via the loop's per-plugin pass (already mostly complete).
+
+## Verification
+
+```bash
+bash plugins/ruflo-plugin-creator/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Related
+
+- `plugins/ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md` β€” namespace convention + "19 controllers" myth fix
+- `plugins/ruflo-cost-tracker/docs/adrs/0001-cost-tracker-contract.md` β€” namespace-routing bug class
+- `plugins/ruflo-knowledge-graph/docs/adrs/0001-knowledge-graph-contract.md` β€” `embeddings_embed` rename
+- `plugins/ruflo-ruvector/docs/adrs/0001-pin-ruvector-0.2.25.md` β€” pinning + smoke-as-contract precedent
diff --git a/plugins/ruflo-plugin-creator/scripts/smoke.sh b/plugins/ruflo-plugin-creator/scripts/smoke.sh
new file mode 100755
index 0000000000..6eb378eb0e
--- /dev/null
+++ b/plugins/ruflo-plugin-creator/scripts/smoke.sh
@@ -0,0 +1,83 @@
+#!/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 scaffolding contract-bootstrap; 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 create-plugin validate-plugin; 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/plugin-developer.md" ]] || miss="$miss missing-agent"
+[[ -f "$ROOT/commands/create-plugin.md" ]] || miss="$miss missing-command"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "3. create-plugin scaffolds the canonical contract (ADR + smoke + README sections)"
+F="$ROOT/skills/create-plugin/SKILL.md"
+miss=""
+grep -q "docs/adrs/0001-" "$F" || miss="$miss adr-scaffolded"
+grep -q "scripts/smoke.sh" "$F" || miss="$miss smoke-scaffolded"
+grep -q "Compatibility" "$F" || miss="$miss compat-scaffolded"
+grep -q "Namespace coordination" "$F" || miss="$miss namespace-scaffolded"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "4. create-plugin includes MCP-tool drift warnings"
+F="$ROOT/skills/create-plugin/SKILL.md"
+miss=""
+grep -q "embeddings_embed" "$F" || miss="$miss embed-warning"
+grep -qE "agentdb_hierarchical.*namespace|namespace.*agentdb_hierarchical" "$F" || miss="$miss hierarchical-warning"
+grep -qE "agentdb_pattern.*namespace|namespace.*agentdb_pattern|ReasoningBank routes" "$F" || miss="$miss pattern-warning"
+grep -qE 'pattern.+plural|plural.+pattern|singular.+plural|pattern.+patterns' "$F" || miss="$miss plural-warning"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "5. create-plugin no longer claims '19 AgentDB controllers' (regression check)"
+F="$ROOT/skills/create-plugin/SKILL.md"
+if grep -qE "19 AgentDB controllers|19 controllers" "$F"; then
+ bad "stale '19 controllers' phrasing still present"
+else
+ ok
+fi
+
+step "6. 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 "7. README has Architecture Decisions section"
+grep -q "## Architecture Decisions" "$ROOT/README.md" \
+ && ok || bad "Architecture Decisions section missing"
+
+step "8. ADR-0001 exists with status Proposed"
+ADR="$ROOT/docs/adrs/0001-plugin-creator-contract.md"
+[[ -f "$ADR" ]] && grep -qE "^status:[[:space:]]*Proposed" "$ADR" \
+ && ok || bad "ADR missing or status != Proposed"
+
+step "9. validate-plugin skill present"
+[[ -f "$ROOT/skills/validate-plugin/SKILL.md" ]] && ok || bad "validate-plugin skill missing"
+
+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-plugin-creator/skills/create-plugin/SKILL.md b/plugins/ruflo-plugin-creator/skills/create-plugin/SKILL.md
index 75e7e6ec9c..8c7f208f36 100644
--- a/plugins/ruflo-plugin-creator/skills/create-plugin/SKILL.md
+++ b/plugins/ruflo-plugin-creator/skills/create-plugin/SKILL.md
@@ -17,7 +17,7 @@ When you want to create a new plugin that extends Claude Code with skills, comma
1. **Get plugin name and description** from the user
2. **Check for conflicts** β€” call `mcp__claude-flow__transfer_plugin-search` to ensure the name isn't taken
-3. **Create directory structure**:
+3. **Create directory structure** (follows the canonical plugin contract from sibling plugins' ADR-0001s):
```
plugins/<name>/
β”œβ”€β”€ .claude-plugin/
@@ -29,7 +29,12 @@ When you want to create a new plugin that extends Claude Code with skills, comma
β”‚ └── <command-name>.md
β”œβ”€β”€ agents/
β”‚ └── <agent-name>.md
- └── README.md
+ β”œβ”€β”€ docs/
+ β”‚ └── adrs/
+ β”‚ └── 0001-<name>-contract.md # Plugin-level ADR (Proposed)
+ β”œβ”€β”€ scripts/
+ β”‚ └── smoke.sh # Structural contract (10+ checks)
+ └── README.md # Compatibility + Namespace coordination + Verification + ADR sections
```
4. **Generate plugin.json** with name, description, version, author (do NOT include `skills`, `commands`, or `agents` arrays β€” Claude Code auto-discovers these from directory structure)
5. **Generate SKILL.md files** with proper frontmatter:
@@ -42,8 +47,23 @@ When you want to create a new plugin that extends Claude Code with skills, comma
```
6. **Generate command files** with name and description frontmatter
7. **Generate agent files** with name, description, and `model: sonnet`
-8. **Generate README.md** with install instructions, features, commands, and skills
-9. **Update marketplace.json** if adding to the ruflo marketplace
+8. **Generate README.md** with install instructions, features, commands, skills, AND the canonical plugin-contract sections:
+ - **Compatibility** β€” pin to `@claude-flow/cli` v3.6 major+minor
+ - **Namespace coordination** β€” claim a kebab-case `<plugin-stem>-<intent>` namespace; defer to ruflo-agentdb ADR-0001 Β§"Namespace convention"
+ - **Verification** β€” `bash plugins/<name>/scripts/smoke.sh`
+ - **Architecture Decisions** β€” link to ADR-0001
+9. **Generate ADR-0001 (Proposed)** at `docs/adrs/0001-<name>-contract.md` documenting: pinning, namespace coordination, MCP-tool surface count if applicable, smoke contract scope. Status: `Proposed`.
+10. **Generate scripts/smoke.sh** β€” at minimum 8 structural checks: version + keywords; skills/agents/commands present with valid frontmatter; v3.6 pin in README; namespace coordination block in README; ADR exists with status `Proposed`; no wildcard tools in skills.
+11. **Update marketplace.json** if adding to the ruflo marketplace.
+
+## MCP-tool drift to avoid (per sibling-ADR lessons learned)
+
+Several plugins shipped with subtle MCP bugs the loop has been finding. Don't replicate them:
+
+- **`embeddings_embed` does not exist.** Real tool is `embeddings_generate`. Don't reference `embeddings_embed` in any `allowed-tools` line.
+- **`agentdb_hierarchical-*` does NOT route by namespace.** It routes by tier (`working|episodic|semantic`). Pass `tier`, not `namespace`. For namespaced reads/writes, use `memory_*` instead.
+- **`agentdb_pattern-*` does NOT route by namespace.** It routes through ReasoningBank. Don't pass a `namespace` arg β€” fallback writes to the reserved `pattern` namespace via `memory-store-fallback`.
+- **`pattern` (singular) and `patterns` (plural) are different namespaces.** ReasoningBank fallback writes to `pattern`; `hooks_pretrain` writes to `patterns`. Don't conflate them.
## Plugin.json schema
@@ -64,10 +84,10 @@ Browse available tools: `mcp__claude-flow__transfer_plugin-info`
Common tool categories:
- `memory_*` β€” storage, search, retrieval
-- `agentdb_*` β€” 19 AgentDB controllers
+- `agentdb_*` β€” 15 controller-bridge tools (do NOT pass `namespace` arg β€” they route by tier or ReasoningBank); call `agentdb_controllers` at runtime for the canonical list
- `neural_*` β€” neural training and prediction
- `hooks_*` β€” lifecycle hooks and intelligence
- `browser_*` β€” browser automation
- `workflow_*` β€” workflow management
- `aidefence_*` β€” safety scanning
-- `embeddings_*` β€” vector embeddings
+- `embeddings_*` β€” 10 vector-embedding tools (use `embeddings_generate`, NOT `embeddings_embed` which does not exist)