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-market-data): v0.2.0 β€” fix 3 functional bugs (embeddings_embed + namespace-routing) + adopt plugin contract (ADR-0001)

Reuven75d57c4ec048
diff --git a/plugins/ruflo-market-data/.claude-plugin/plugin.json b/plugins/ruflo-market-data/.claude-plugin/plugin.json
index 28246f5727..9ab08dd890 100644
--- a/plugins/ruflo-market-data/.claude-plugin/plugin.json
+++ b/plugins/ruflo-market-data/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-market-data",
"description": "Market data ingestion β€” feed normalization, OHLCV vectorization, and HNSW-indexed pattern matching",
- "version": "0.1.0",
+ "version": "0.2.0",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
@@ -13,6 +13,9 @@
"market-data",
"ohlcv",
"time-series",
- "patterns"
+ "patterns",
+ "mcp",
+ "candlestick-patterns",
+ "namespace-routing"
]
}
diff --git a/plugins/ruflo-market-data/README.md b/plugins/ruflo-market-data/README.md
index 0e902bac0d..2f737628bf 100644
--- a/plugins/ruflo-market-data/README.md
+++ b/plugins/ruflo-market-data/README.md
@@ -59,8 +59,36 @@ market compare <sym1> <sym2> # Compare pattern profiles between symb
Each pattern is encoded as a 64-dimension padded vector for HNSW indexing.
+## Compatibility
+
+- **CLI:** pinned to `@claude-flow/cli` v3.6 major+minor.
+- **Verification:** `bash plugins/ruflo-market-data/scripts/smoke.sh` is the contract.
+
+## Namespace coordination
+
+This plugin owns two AgentDB namespaces (kebab-case, follows the convention from [ruflo-agentdb ADR-0001 Β§"Namespace convention"](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md)):
+
+- `market-data` β€” normalized OHLCV vectors per symbol+date
+- `market-patterns` β€” detected candlestick patterns with reliability scores
+
+Both accessed via `memory_*` (namespace-routed). Reserved namespaces (`pattern`, `claude-memories`, `default`) MUST NOT be shadowed.
+
+> **Routing note:** Earlier versions of these skills used `agentdb_hierarchical-*` and `agentdb_pattern-*` 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-market-data/scripts/smoke.sh
+# Expected: "11 passed, 0 failed"
+```
+
+## Architecture Decisions
+
+- [`ADR-0001` β€” ruflo-market-data plugin contract (3 functional bug fixes + namespace coordination + smoke as contract)](./docs/adrs/0001-market-data-contract.md)
+
## Related Plugins
+- `ruflo-agentdb` β€” namespace convention owner; defines the routing rules ADR-0001 fixes violations of
- `ruflo-neural-trader` -- Consumes market patterns as strategy signals
- `ruflo-ruvector` -- HNSW indexing engine for pattern similarity search
- `ruflo-observability` -- Data feed health and ingestion latency dashboards
diff --git a/plugins/ruflo-market-data/agents/data-engineer.md b/plugins/ruflo-market-data/agents/data-engineer.md
index 265f813805..c640b03a19 100644
--- a/plugins/ruflo-market-data/agents/data-engineer.md
+++ b/plugins/ruflo-market-data/agents/data-engineer.md
@@ -55,7 +55,7 @@ Each candlestick pattern is encoded as a fixed-length vector:
- `mcp__claude-flow__agentdb_pattern-store` -- store detected candlestick patterns with vectors
- `mcp__claude-flow__agentdb_pattern-search` -- search for similar patterns via HNSW
- `mcp__claude-flow__agentdb_semantic-route` -- route queries to relevant market data sources
-- `mcp__claude-flow__embeddings_embed` -- generate embeddings for pattern descriptions
+- `mcp__claude-flow__embeddings_generate` -- generate embeddings for pattern descriptions
- `mcp__claude-flow__ruvllm_hnsw_create` -- create HNSW index for pattern vectors
- `mcp__claude-flow__ruvllm_hnsw_add` -- add pattern vectors to HNSW index
- `mcp__claude-flow__ruvllm_hnsw_route` -- nearest-neighbor search in pattern index
diff --git a/plugins/ruflo-market-data/docs/adrs/0001-market-data-contract.md b/plugins/ruflo-market-data/docs/adrs/0001-market-data-contract.md
new file mode 100644
index 0000000000..25d29e0b22
--- /dev/null
+++ b/plugins/ruflo-market-data/docs/adrs/0001-market-data-contract.md
@@ -0,0 +1,56 @@
+---
+id: ADR-0001
+title: ruflo-market-data plugin contract β€” pinning, namespace coordination, namespace-routing fix, embeddings_generate fix, smoke as contract
+status: Proposed
+date: 2026-05-04
+authors:
+ - reviewer (Claude Code)
+tags: [plugin, market-data, ohlcv, candlestick, namespace, hnsw, smoke-test]
+---
+
+## Context
+
+`ruflo-market-data` (v0.1.0) β€” feed ingestion, OHLCV normalization, candlestick pattern detection. 1 agent + 2 skills + 1 command (5 subcommands).
+
+### Three real bugs found in skills
+
+1. `market-ingest/SKILL.md` referenced `mcp__claude-flow__embeddings_embed` β€” that tool name does not exist. Real tool is `embeddings_generate` (per [ruflo-knowledge-graph ADR-0001](../../ruflo-knowledge-graph/docs/adrs/0001-knowledge-graph-contract.md), same fix).
+2. `market-ingest/SKILL.md` used `agentdb_hierarchical-store` with `namespace: 'market-data'`. Per [ruflo-agentdb ADR-0001 Β§"Namespace convention"](../../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md), `agentdb_hierarchical-*` routes by **tier** (`working|episodic|semantic`), not namespace. The namespace arg was silently ignored.
+3. `market-pattern/SKILL.md` had the same hierarchical-recall + namespace bug **plus** the same pattern-store + namespace bug as ruflo-cost-tracker (`agentdb_pattern-store` with `namespace: 'market-patterns'` β€” ReasoningBank ignores namespace).
+
+All three fixed in this ADR pass by switching to `memory_*` (namespace-routed) for the load/store paths and documenting the dual write path for optimization-style patterns (per the cost-tracker precedent).
+
+### Other gaps
+
+1. No plugin-level ADR.
+2. No smoke test.
+3. No Compatibility section.
+
+## Decision
+
+1. **Functional fixes:**
+ - `market-ingest`: rename `embeddings_embed` β†’ `embeddings_generate`; switch load/store from `agentdb_hierarchical-*` to `memory_*` (namespace-routed).
+ - `market-pattern`: switch load from `agentdb_hierarchical-recall` to `memory_search`; document the dual write path for pattern-store (typed via ReasoningBank vs. namespace-routable via `memory_store`).
+2. Add this ADR (Proposed).
+3. README augment: Compatibility (pin v3.6); Namespace coordination (claims `market-data` and `market-patterns`); Verification + Architecture Decisions sections.
+4. Bump `0.1.0 β†’ 0.2.0`. Keywords add `mcp`, `candlestick-patterns`, `namespace-routing`.
+5. `scripts/smoke.sh` β€” 11 structural checks: version + keywords; both skills + agent + command with valid frontmatter; **regression checks**: `embeddings_embed` not at any tool-call site, skills use `memory_*` for namespaced reads (not `agentdb_hierarchical-*` with namespace arg); 5 subcommands documented; v3.6 pin; namespace coordination; `market-data` + `market-patterns` claimed; ADR Proposed; no wildcard tools.
+
+## Consequences
+
+**Positive:** three real bugs fixed. Plugin joins the cadence. Sibling pattern from cost-tracker ADR-0001 (dual write path) and knowledge-graph ADR-0001 (embeddings_generate rename) is now applied consistently.
+
+**Negative:** anyone scripting against the broken tool calls was already silently failing. Net zero on real impact.
+
+## Verification
+
+```bash
+bash plugins/ruflo-market-data/scripts/smoke.sh
+# Expected: "11 passed, 0 failed"
+```
+
+## Related
+
+- `plugins/ruflo-cost-tracker/docs/adrs/0001-cost-tracker-contract.md` β€” same namespace-routing bug class
+- `plugins/ruflo-knowledge-graph/docs/adrs/0001-knowledge-graph-contract.md` β€” same `embeddings_embed` rename
+- `plugins/ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md` β€” namespace convention this ADR fixes a violation of
diff --git a/plugins/ruflo-market-data/scripts/smoke.sh b/plugins/ruflo-market-data/scripts/smoke.sh
new file mode 100755
index 0000000000..b36811256c
--- /dev/null
+++ b/plugins/ruflo-market-data/scripts/smoke.sh
@@ -0,0 +1,88 @@
+#!/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 candlestick-patterns namespace-routing; 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 market-ingest market-pattern; 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/data-engineer.md" ]] || miss="$miss missing-agent"
+[[ -f "$ROOT/commands/market.md" ]] || miss="$miss missing-command"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "3. embeddings_embed (non-existent tool) NOT at any tool-call site (excludes ADR + README call-outs)"
+hits=$(grep -rE 'mcp__claude-flow__embeddings_embed' "$ROOT" \
+ --include='*.md' --include='*.json' \
+ --exclude-dir='adrs' 2>/dev/null \
+ | grep -v 'NOT \`embeddings_embed\`\|embeddings_embed.*does not exist\|fixes prior references' \
+ || true)
+[[ -z "$hits" ]] && ok || bad "embeddings_embed reference present at tool-call site"
+
+step "4. market-ingest uses memory_* (namespace-routed) for store path"
+F="$ROOT/skills/market-ingest/SKILL.md"
+miss=""
+grep -q "memory_store" "$F" || miss="$miss no-memory_store"
+grep -qE 'agentdb_hierarchical-store.+market-data|market-data.+agentdb_hierarchical-store' "$F" && miss="$miss still-uses-hierarchical-store"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "5. market-pattern uses memory_* for namespaced reads"
+F="$ROOT/skills/market-pattern/SKILL.md"
+miss=""
+grep -q "memory_search\|memory_list" "$F" || miss="$miss no-memory-load"
+grep -qE 'agentdb_hierarchical-recall.+market-data|market-data.+agentdb_hierarchical-recall' "$F" && miss="$miss still-uses-hierarchical-recall"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "6. market-pattern documents dual pattern-store path (ReasoningBank vs namespace)"
+F="$ROOT/skills/market-pattern/SKILL.md"
+if grep -q "ReasoningBank" "$F" \
+ && grep -q "memory_store --namespace market-patterns" "$F"; then
+ ok
+else
+ bad "missing dual-path documentation"
+fi
+
+step "7. embeddings_generate (real tool) referenced in market-ingest"
+grep -q "embeddings_generate" "$ROOT/skills/market-ingest/SKILL.md" \
+ && ok || bad "embeddings_generate not referenced in market-ingest"
+
+step "8. 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 "9. 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 "10. market-data + market-patterns namespaces claimed"
+F="$ROOT/README.md"
+grep -q "market-data" "$F" && grep -q "market-patterns" "$F" \
+ && ok || bad "namespace claims missing"
+
+step "11. ADR-0001 exists with status Proposed"
+ADR="$ROOT/docs/adrs/0001-market-data-contract.md"
+[[ -f "$ADR" ]] && grep -qE "^status:[[:space:]]*Proposed" "$ADR" \
+ && ok || bad "ADR missing or status != Proposed"
+
+printf "\n%s passed, %s failed\n" "$PASS" "$FAIL"
+[[ $FAIL -eq 0 ]] || exit 1
diff --git a/plugins/ruflo-market-data/skills/market-ingest/SKILL.md b/plugins/ruflo-market-data/skills/market-ingest/SKILL.md
index 29b5591153..bd3a7c49e5 100644
--- a/plugins/ruflo-market-data/skills/market-ingest/SKILL.md
+++ b/plugins/ruflo-market-data/skills/market-ingest/SKILL.md
@@ -2,7 +2,7 @@
name: market-ingest
description: Ingest and normalize market data into OHLCV vectors with HNSW indexing
argument-hint: "<symbol> [--source api]"
-allowed-tools: Bash mcp__claude-flow__agentdb_hierarchical-store mcp__claude-flow__agentdb_hierarchical-recall mcp__claude-flow__ruvllm_hnsw_create mcp__claude-flow__ruvllm_hnsw_add mcp__claude-flow__embeddings_embed
+allowed-tools: Bash mcp__claude-flow__memory_store mcp__claude-flow__memory_search mcp__claude-flow__ruvllm_hnsw_create mcp__claude-flow__ruvllm_hnsw_add mcp__claude-flow__embeddings_generate
---
# Market Ingest
@@ -22,9 +22,9 @@ When you need to ingest raw market data (price and volume) for a symbol and prep
- Low: `(low - open) / open`
- Close: `(close - open) / open`
- Volume: Z-score against rolling mean/std
-3. **Vectorize** -- encode each candle as a 64-dimension padded vector (5 normalized OHLCV values + padding)
-4. **Store** -- call `mcp__claude-flow__agentdb_hierarchical-store` to persist normalized OHLCV data in the `market-data` namespace with symbol and date as keys
-5. **Index** -- call `mcp__claude-flow__ruvllm_hnsw_add` to add vectors to the HNSW index for nearest-neighbor search
+3. **Vectorize** -- encode each candle as a 64-dimension padded vector (5 normalized OHLCV values + padding). For semantic embeddings of pattern descriptions, use `mcp__claude-flow__embeddings_generate` (NOT `embeddings_embed` β€” that tool name does not exist).
+4. **Store** -- call `mcp__claude-flow__memory_store --namespace market-data` to persist normalized OHLCV data with symbol+date keys. The `memory_*` tool family routes by namespace; the `agentdb_hierarchical-*` family routes by tier (`working|episodic|semantic`) and ignores namespace strings, so use `memory_*` here.
+5. **Index** -- call `mcp__claude-flow__ruvllm_hnsw_add` to add vectors to the HNSW index for nearest-neighbor search.
6. **Report** -- summarize: candles ingested, date range, price range, average volume
## CLI alternative
diff --git a/plugins/ruflo-market-data/skills/market-pattern/SKILL.md b/plugins/ruflo-market-data/skills/market-pattern/SKILL.md
index 97438dd09c..4f61bcf894 100644
--- a/plugins/ruflo-market-data/skills/market-pattern/SKILL.md
+++ b/plugins/ruflo-market-data/skills/market-pattern/SKILL.md
@@ -2,7 +2,7 @@
name: market-pattern
description: Detect and classify candlestick patterns from ingested OHLCV data
argument-hint: "<symbol> [--period 1D]"
-allowed-tools: mcp__claude-flow__agentdb_hierarchical-recall mcp__claude-flow__agentdb_pattern-store mcp__claude-flow__agentdb_pattern-search mcp__claude-flow__ruvllm_hnsw_route Bash
+allowed-tools: 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_pattern-search mcp__claude-flow__ruvllm_hnsw_route Bash
---
# Market Pattern
@@ -15,7 +15,7 @@ When you need to identify candlestick patterns (doji, hammer, engulfing, head-sh
## Steps
-1. **Load candles** -- call `mcp__claude-flow__agentdb_hierarchical-recall` to retrieve normalized OHLCV data for the symbol and period from `market-data` namespace
+1. **Load candles** -- call `mcp__claude-flow__memory_search` (or `memory_list`) on the `market-data` namespace to retrieve normalized OHLCV data for the symbol and period. The `memory_*` tool family routes by namespace; the `agentdb_hierarchical-*` family does NOT (it routes by tier), so use `memory_*` for namespaced reads.
2. **Scan for patterns** -- iterate through candle sequences looking for:
- Single-candle: doji (open ~= close), hammer (long lower wick), inverted hammer
- Two-candle: bullish/bearish engulfing
@@ -23,11 +23,14 @@ When you need to identify candlestick patterns (doji, hammer, engulfing, head-sh
- Multi-candle: head & shoulders, double top/bottom, cup & handle
3. **Classify** -- for each detection, assign: pattern name, type (reversal/continuation), direction (bullish/bearish), reliability score (0.0-1.0)
4. **Rank** -- sort by reliability score descending
-5. **Store** -- call `mcp__claude-flow__agentdb_pattern-store` to persist each detected pattern in `market-patterns` namespace with the pattern vector
+5. **Store** -- two paths (per ruflo-cost-tracker ADR-0001 dual-path pattern):
+ - **Pattern-store (typed, recommended)**: `mcp__claude-flow__agentdb_pattern-store` with `type: 'market-pattern'`. Don't pass a `namespace` arg β€” ReasoningBank routes it; on bridge unavailability the fallback writes to the reserved `pattern` namespace with `controller: 'memory-store-fallback'` (see ruflo-agentdb ADR-0001).
+ - **Plain store (namespace-routable)**: `mcp__claude-flow__memory_store --namespace market-patterns` β€” this DOES respect the `market-patterns` namespace because `memory_*` is namespace-routed.
6. **Report** -- display: pattern name, date range, direction, reliability, suggested action
## CLI alternative
```bash
npx @claude-flow/cli@latest memory search --query "bullish reversal patterns" --namespace market-patterns
+npx @claude-flow/cli@latest memory store --key "pattern-AAPL-2026-05-04-doji" --value '{...}' --namespace market-patterns
```