moflo 4.8.86 → 4.8.87-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/guidance/shipped/moflo-core-guidance.md +1 -1
- package/.claude/guidance/shipped/moflo-memory-strategy.md +12 -26
- package/README.md +2 -2
- package/bin/build-embeddings.mjs +112 -336
- package/bin/generate-code-map.mjs +1 -1
- package/bin/semantic-search.mjs +71 -273
- package/bin/session-start-launcher.mjs +30 -0
- package/package.json +11 -14
- package/scripts/prune-native-binaries.mjs +449 -0
- package/src/modules/cli/dist/src/appliance/rvfa-builder.js +8 -13
- package/src/modules/cli/dist/src/benchmarks/pretrain/index.js +12 -30
- package/src/modules/cli/dist/src/commands/benchmark.js +6 -14
- package/src/modules/cli/dist/src/commands/doctor.js +13 -2
- package/src/modules/cli/dist/src/commands/embeddings.js +60 -7
- package/src/modules/cli/dist/src/commands/guidance.js +3 -2
- package/src/modules/cli/dist/src/commands/memory.js +3 -6
- package/src/modules/cli/dist/src/epic/spells/auto-merge.yaml +26 -0
- package/src/modules/cli/dist/src/epic/spells/single-branch.yaml +26 -0
- package/src/modules/cli/dist/src/mcp-tools/hive-mind-tools.js +13 -6
- package/src/modules/cli/dist/src/mcp-tools/hooks-tools.js +29 -48
- package/src/modules/cli/dist/src/mcp-tools/spell-tools.js +16 -5
- package/src/modules/cli/dist/src/memory/bridge-core.js +2 -2
- package/src/modules/cli/dist/src/memory/embedding-errors.js +117 -0
- package/src/modules/cli/dist/src/memory/memory-initializer.js +63 -217
- package/src/modules/cli/dist/src/movector/vector-db.js +0 -33
- package/src/modules/cli/dist/src/services/atomic-file-write.js +37 -0
- package/src/modules/cli/dist/src/services/embeddings-migration.js +124 -0
- package/src/modules/cli/dist/src/services/grimoire-builder.js +12 -6
- package/src/modules/cli/dist/src/services/headless-worker-executor.js +39 -13
- package/src/modules/cli/dist/src/services/index.js +1 -1
- package/src/modules/cli/dist/src/services/learning-service.js +18 -33
- package/src/modules/cli/dist/src/services/moflo-require.js +83 -25
- package/src/modules/cli/dist/src/services/neural-embedding-provider.js +55 -0
- package/src/modules/cli/dist/src/services/sqljs-migration-store.js +181 -0
- package/src/modules/cli/dist/src/version.js +1 -1
- package/src/modules/cli/package.json +1 -1
- package/src/modules/embeddings/dist/embedding-service.js +127 -598
- package/src/modules/embeddings/dist/fastembed-embedding-service.js +161 -0
- package/src/modules/embeddings/dist/index.js +11 -11
- package/src/modules/embeddings/dist/migration/in-memory-store.js +140 -0
- package/src/modules/embeddings/dist/migration/index.js +13 -0
- package/src/modules/embeddings/dist/migration/migrate-store.js +256 -0
- package/src/modules/embeddings/dist/migration/sqljs-helpers.js +110 -0
- package/src/modules/embeddings/dist/migration/types.js +19 -0
- package/src/modules/embeddings/dist/migration/upgrade-coordinator.js +180 -0
- package/src/modules/embeddings/dist/migration/upgrade-messages.js +93 -0
- package/src/modules/embeddings/dist/migration/upgrade-renderer.js +162 -0
- package/src/modules/embeddings/dist/neural-integration.js +44 -179
- package/src/modules/embeddings/dist/persistent-cache.js +20 -5
- package/src/modules/embeddings/dist/types.js +4 -5
- package/src/modules/embeddings/dist/utils/atomic-file-write.js +50 -0
- package/src/modules/embeddings/package.json +2 -7
- package/src/modules/guidance/dist/index.js +7 -2
- package/src/modules/guidance/dist/retriever.js +12 -55
- package/src/modules/hooks/dist/reasoningbank/__mocks__/test-embedding-service.js +48 -0
- package/src/modules/hooks/dist/reasoningbank/embedding-service-types.js +3 -0
- package/src/modules/hooks/dist/reasoningbank/index.js +20 -80
- package/src/modules/hooks/dist/swarm/index.js +46 -21
- package/src/modules/memory/dist/controllers/_shared.js +16 -40
- package/src/modules/memory/dist/controllers/_test-embedder.js +26 -0
- package/src/modules/memory/dist/controllers/hierarchical-memory.js +3 -3
- package/src/modules/memory/dist/controllers/reflexion.js +3 -3
- package/src/modules/memory/dist/controllers/skills.js +3 -3
- package/src/modules/memory/dist/learning-bridge.js +53 -23
- package/src/modules/memory/dist/persistent-sona.js +52 -19
- package/src/modules/memory/dist/rvf-migration.js +19 -2
- package/src/modules/shared/dist/events/rvf-event-log.js +4 -7
- package/src/modules/shared/dist/index.js +4 -0
- package/src/modules/shared/dist/utils/atomic-file-write.js +36 -0
- package/src/modules/spells/dist/commands/prompt-command.js +1 -25
- package/src/modules/spells/dist/core/interpolation.js +10 -2
- package/src/modules/spells/dist/core/prerequisite-checker.js +181 -12
- package/src/modules/spells/dist/core/runner.js +8 -5
- package/src/modules/spells/dist/core/stdin-reader.js +33 -0
- package/src/modules/spells/dist/index.js +1 -1
- package/src/modules/spells/dist/schema/validator.js +13 -393
- package/src/modules/spells/dist/schema/validators/jumps.js +67 -0
- package/src/modules/spells/dist/schema/validators/prerequisites.js +71 -0
- package/src/modules/spells/dist/schema/validators/references.js +124 -0
- package/src/modules/spells/dist/schema/validators/steps.js +145 -0
- package/src/modules/spells/dist/schema/validators/top-level.js +71 -0
- package/src/modules/swarm/dist/attention-coordinator.js +63 -34
- package/src/modules/swarm/dist/queen-coordinator.js +25 -35
- package/src/modules/embeddings/dist/rvf-embedding-cache.js +0 -458
- package/src/modules/embeddings/dist/rvf-embedding-service.js +0 -318
|
@@ -644,7 +644,7 @@ All code changes MUST work on Windows, macOS, and Linux. Follow these rules:
|
|
|
644
644
|
| Low search quality | Guidance docs missing `**Purpose:**` lines or generic headings | Follow guidance optimization rules in `guidance-memory-strategy.md` |
|
|
645
645
|
| Session start slow | All three indexers running | Set `auto_index.code_map: false` in `moflo.yaml` if code map not needed |
|
|
646
646
|
| Status line not showing | `statusline.cjs` error or `status_line.enabled: false` | Run `node .claude/helpers/statusline.cjs` to test, check `moflo.yaml` |
|
|
647
|
-
| Embeddings
|
|
647
|
+
| Embeddings fail on first run (offline / air-gapped) | `fastembed` model cache missing | Pre-populate `~/.cache/fastembed` or set `FASTEMBED_CACHE` to a pre-baked cache dir — see `docs/modules/embeddings.md` "Sandbox & air-gapped first-run" |
|
|
648
648
|
| `flo` command not found | Not in PATH | Use `npx flo` or `node node_modules/moflo/bin/index-guidance.mjs` |
|
|
649
649
|
| Bundled guidance not indexed | Running inside moflo repo (same dir) | Bundled guidance only indexes when installed as a dependency in a different project |
|
|
650
650
|
|
|
@@ -105,42 +105,28 @@ ASCII boxes, excessive emoji, rhetorical questions, and motivational text all wa
|
|
|
105
105
|
|
|
106
106
|
## Embedding Strategy
|
|
107
107
|
|
|
108
|
-
### Embedding
|
|
108
|
+
### Embedding Model
|
|
109
109
|
|
|
110
|
-
| Model |
|
|
111
|
-
|
|
112
|
-
| `
|
|
113
|
-
| `domain-aware-hash-v1` | Good (domain clustering) | <1s for 1000 entries | Fallback when Transformers.js unavailable |
|
|
110
|
+
| Model | Runtime | Speed | Notes |
|
|
111
|
+
|-------|---------|-------|-------|
|
|
112
|
+
| `fast-all-MiniLM-L6-v2` | `fastembed` (native ONNX + Rust tokenizer) | ~3s for 1000 entries | The only supported model — neural embeddings are mandatory (ADR-EMB-001) |
|
|
114
113
|
|
|
115
|
-
**Neural embeddings (
|
|
116
|
-
- Uses
|
|
114
|
+
**Neural embeddings (fast-all-MiniLM-L6-v2):**
|
|
115
|
+
- Uses the `fastembed` npm package (Qdrant's embeddings-only ONNX client)
|
|
117
116
|
- 384-dimensional vectors, L2-normalized
|
|
118
117
|
- True semantic understanding — "soft delete" matches "mark as deleted" without keyword overlap
|
|
119
|
-
-
|
|
118
|
+
- Model auto-downloads to `~/.cache/fastembed` on first use; cached for subsequent queries
|
|
119
|
+
- For offline / air-gapped / sandboxed runs, pre-populate the cache or set `FASTEMBED_CACHE` — see `docs/modules/embeddings.md` "Sandbox & air-gapped first-run"
|
|
120
120
|
|
|
121
|
-
**
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
- Good at keyword-level matching but misses semantic paraphrases
|
|
125
|
-
- No external dependencies — always available
|
|
121
|
+
**Legacy-compatible model names:** Entries embedded by earlier moflo versions may be tagged `Xenova/all-MiniLM-L6-v2` or `onnx`. These share the same vector space as `fast-all-MiniLM-L6-v2`, so search treats them as compatible (`semantic-search.mjs` `COMPATIBLE_MODELS`).
|
|
122
|
+
|
|
123
|
+
**No hash fallback.** Epic #527 removed every hash-embedding path. If the `fastembed` model cannot load, memory operations fail loudly rather than silently degrading to FNV-1a pseudo-vectors. See [ADR-EMB-001](../../../src/modules/embeddings/docs/adrs/ADR-EMB-001-neural-embeddings-mandatory.md).
|
|
126
124
|
|
|
127
125
|
### The Embedding Alignment Problem
|
|
128
126
|
|
|
129
127
|
**Critical rule:** Query embeddings MUST match stored embeddings. Computing cosine similarity between vectors from different models produces meaningless scores.
|
|
130
128
|
|
|
131
|
-
Both the search scripts and the MCP memory tools
|
|
132
|
-
|
|
133
|
-
### Domain Cluster Tuning
|
|
134
|
-
|
|
135
|
-
The hash fallback's domain clusters can be extended with project-specific terms:
|
|
136
|
-
|
|
137
|
-
| Cluster | Example Terms |
|
|
138
|
-
|---------|--------------|
|
|
139
|
-
| `database` | your ORM, database engine, schema terms |
|
|
140
|
-
| `frontend` | UI framework, component library terms |
|
|
141
|
-
| `backend` | DI container, API framework terms |
|
|
142
|
-
| `testing` | test framework, assertion library terms |
|
|
143
|
-
| `security` | auth system, permission model terms |
|
|
129
|
+
Both the search scripts and the MCP memory tools use `fastembed` for query vectors and filter stored entries by `embedding_model` (via the legacy-compatible alias list above), so a mixed-version database remains coherent.
|
|
144
130
|
|
|
145
131
|
---
|
|
146
132
|
|
package/README.md
CHANGED
|
@@ -28,10 +28,10 @@ To verify everything is running, ask Claude to run `flo doctor` with full diagno
|
|
|
28
28
|
MoFlo makes deliberate choices so you don't have to:
|
|
29
29
|
|
|
30
30
|
- **Fully self-contained** — No external services, no cloud dependencies, no API keys. Everything runs locally on your machine.
|
|
31
|
-
- **Minimal dependencies** —
|
|
31
|
+
- **Minimal dependencies** — small runtime dep set (`fastembed` for embeddings, plus `js-yaml`, `semver`, `sql.js`, `valibot`). The upstream Ruflo/Claude Flow packages pull in multiple internal scoped packages (`@claude-flow/cli`, `@claude-flow/mcp`, `@claude-flow/shared`) plus native crypto libraries. MoFlo consolidates everything into a single package with no native compilation on install — `fastembed`'s `onnxruntime-node` ships prebuilt binaries, and `sql.js` is WASM.
|
|
32
32
|
- **Node.js runtime** — Targets Node.js specifically. All scripts, hooks, and tooling are JavaScript/TypeScript. No Python, no Rust binaries, no native compilation.
|
|
33
33
|
- **sql.js (WASM)** — The memory database uses sql.js, a pure WebAssembly build of SQLite. No native `better-sqlite3` bindings to compile, no platform-specific build steps. Works identically on Windows, macOS, and Linux.
|
|
34
|
-
- **
|
|
34
|
+
- **Neural embeddings by default** — 384-dimensional embeddings via [`fastembed`](https://www.npmjs.com/package/fastembed) (Qdrant's embeddings-only ONNX client) with `all-MiniLM-L6-v2`. No hash fallback, no peer-optional setup, no install prompts — real semantic search works out of the box. Install footprint: **~60–100 MB** post-prune (a `postinstall` script trims `onnxruntime-node` to the current platform's binaries and strips GPU-only provider libraries that fastembed never loads; unpruned it would be ~430 MB on Linux). The prune is scoped to ORT copies moflo actually owns and never touches foreign installs (e.g. an Electron cross-compile packager pulling its own ORT); set `MOFLO_NO_PRUNE=1` to disable pruning entirely, or `ONNXRUNTIME_NODE_INSTALL_CUDA=true` to keep the prune but re-enable the CUDA GPU provider. For context, the upstream Ruflo default install is ~1.1 GB. See [ADR-EMB-001](src/modules/embeddings/docs/adrs/ADR-EMB-001-neural-embeddings-mandatory.md).
|
|
35
35
|
- **Full learning stack wired up OOTB** — The following are all configured and functional from `flo init`, no manual setup:
|
|
36
36
|
- **SONA** (Self-Optimizing Neural Architecture) — learns from task trajectories via pure TypeScript SONA implementation in `@moflo/neural`
|
|
37
37
|
- **MicroLoRA** — rank-2 LoRA weight adaptations at ~1µs per adapt via pure TypeScript MicroLoRA in `@moflo/neural`
|