moflo 4.8.21 → 4.8.22
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/agents/browser/browser-agent.yaml +182 -182
- package/.claude/agents/core/coder.md +265 -265
- package/.claude/agents/core/planner.md +167 -167
- package/.claude/agents/core/researcher.md +189 -189
- package/.claude/agents/core/reviewer.md +325 -325
- package/.claude/agents/core/tester.md +318 -318
- package/.claude/agents/database-specialist.yaml +21 -21
- package/.claude/agents/dual-mode/codex-coordinator.md +224 -224
- package/.claude/agents/dual-mode/codex-worker.md +211 -211
- package/.claude/agents/dual-mode/dual-orchestrator.md +291 -291
- package/.claude/agents/github/code-review-swarm.md +537 -537
- package/.claude/agents/github/github-modes.md +172 -172
- package/.claude/agents/github/issue-tracker.md +318 -318
- package/.claude/agents/github/multi-repo-swarm.md +552 -552
- package/.claude/agents/github/pr-manager.md +190 -190
- package/.claude/agents/github/project-board-sync.md +508 -508
- package/.claude/agents/github/release-manager.md +366 -366
- package/.claude/agents/github/release-swarm.md +582 -582
- package/.claude/agents/github/repo-architect.md +397 -397
- package/.claude/agents/github/swarm-issue.md +572 -572
- package/.claude/agents/github/swarm-pr.md +427 -427
- package/.claude/agents/github/sync-coordinator.md +451 -451
- package/.claude/agents/github/workflow-automation.md +634 -634
- package/.claude/agents/goal/code-goal-planner.md +445 -445
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -129
- package/.claude/agents/hive-mind/queen-coordinator.md +202 -202
- package/.claude/agents/hive-mind/scout-explorer.md +241 -241
- package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -192
- package/.claude/agents/hive-mind/worker-specialist.md +216 -216
- package/.claude/agents/index.yaml +17 -17
- package/.claude/agents/neural/safla-neural.md +73 -73
- package/.claude/agents/project-coordinator.yaml +15 -15
- package/.claude/agents/python-specialist.yaml +21 -21
- package/.claude/agents/reasoning/goal-planner.md +72 -72
- package/.claude/agents/security-auditor.yaml +20 -20
- package/.claude/agents/swarm/adaptive-coordinator.md +395 -395
- package/.claude/agents/swarm/hierarchical-coordinator.md +326 -326
- package/.claude/agents/swarm/mesh-coordinator.md +391 -391
- package/.claude/agents/templates/migration-plan.md +745 -745
- package/.claude/agents/typescript-specialist.yaml +21 -21
- package/.claude/checkpoints/1767754460.json +8 -8
- package/.claude/commands/agents/agent-spawning.md +28 -28
- package/.claude/commands/github/github-modes.md +146 -146
- package/.claude/commands/github/github-swarm.md +121 -121
- package/.claude/commands/github/issue-tracker.md +291 -291
- package/.claude/commands/github/pr-manager.md +169 -169
- package/.claude/commands/github/release-manager.md +337 -337
- package/.claude/commands/github/repo-architect.md +366 -366
- package/.claude/commands/github/sync-coordinator.md +300 -300
- package/.claude/commands/memory/neural.md +47 -47
- package/.claude/commands/sparc/analyzer.md +51 -51
- package/.claude/commands/sparc/architect.md +53 -53
- package/.claude/commands/sparc/ask.md +97 -97
- package/.claude/commands/sparc/batch-executor.md +54 -54
- package/.claude/commands/sparc/code.md +89 -89
- package/.claude/commands/sparc/coder.md +54 -54
- package/.claude/commands/sparc/debug.md +83 -83
- package/.claude/commands/sparc/debugger.md +54 -54
- package/.claude/commands/sparc/designer.md +53 -53
- package/.claude/commands/sparc/devops.md +109 -109
- package/.claude/commands/sparc/docs-writer.md +80 -80
- package/.claude/commands/sparc/documenter.md +54 -54
- package/.claude/commands/sparc/innovator.md +54 -54
- package/.claude/commands/sparc/integration.md +83 -83
- package/.claude/commands/sparc/mcp.md +117 -117
- package/.claude/commands/sparc/memory-manager.md +54 -54
- package/.claude/commands/sparc/optimizer.md +54 -54
- package/.claude/commands/sparc/orchestrator.md +131 -131
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -83
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -83
- package/.claude/commands/sparc/researcher.md +54 -54
- package/.claude/commands/sparc/reviewer.md +54 -54
- package/.claude/commands/sparc/security-review.md +80 -80
- package/.claude/commands/sparc/sparc-modes.md +174 -174
- package/.claude/commands/sparc/sparc.md +111 -111
- package/.claude/commands/sparc/spec-pseudocode.md +80 -80
- package/.claude/commands/sparc/supabase-admin.md +348 -348
- package/.claude/commands/sparc/swarm-coordinator.md +54 -54
- package/.claude/commands/sparc/tdd.md +54 -54
- package/.claude/commands/sparc/tester.md +54 -54
- package/.claude/commands/sparc/tutorial.md +79 -79
- package/.claude/commands/sparc/workflow-manager.md +54 -54
- package/.claude/commands/sparc.md +166 -166
- package/.claude/commands/swarm/analysis.md +95 -95
- package/.claude/commands/swarm/development.md +96 -96
- package/.claude/commands/swarm/examples.md +168 -168
- package/.claude/commands/swarm/maintenance.md +102 -102
- package/.claude/commands/swarm/optimization.md +117 -117
- package/.claude/commands/swarm/research.md +136 -136
- package/.claude/commands/swarm/testing.md +131 -131
- package/.claude/commands/workflows/development.md +77 -77
- package/.claude/commands/workflows/research.md +62 -62
- package/.claude/guidance/moflo-bootstrap.md +126 -126
- package/.claude/guidance/shipped/agent-bootstrap.md +126 -126
- package/.claude/guidance/shipped/guidance-memory-strategy.md +262 -262
- package/.claude/guidance/shipped/memory-strategy.md +204 -204
- package/.claude/guidance/shipped/moflo.md +668 -653
- package/.claude/guidance/shipped/task-swarm-integration.md +441 -441
- package/.claude/helpers/intelligence.cjs +207 -207
- package/.claude/helpers/statusline.cjs +851 -851
- package/.claude/settings.local.json +18 -0
- package/.claude/skills/fl/SKILL.md +583 -583
- package/.claude/skills/flo/SKILL.md +583 -583
- package/.claude/skills/github-code-review/SKILL.md +1140 -1140
- package/.claude/skills/github-multi-repo/SKILL.md +874 -874
- package/.claude/skills/github-project-management/SKILL.md +1277 -1277
- package/.claude/skills/github-release-management/SKILL.md +1081 -1081
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -1065
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -712
- package/.claude/skills/hooks-automation/SKILL.md +1201 -1201
- package/.claude/skills/performance-analysis/SKILL.md +563 -563
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -1115
- package/.claude/skills/swarm-advanced/SKILL.md +973 -973
- package/.claude/workflow-state.json +4 -4
- package/LICENSE +21 -21
- package/README.md +685 -685
- package/bin/cli.js +0 -0
- package/bin/gate-hook.mjs +50 -50
- package/bin/gate.cjs +138 -138
- package/bin/generate-code-map.mjs +775 -775
- package/bin/hook-handler.cjs +83 -83
- package/bin/hooks.mjs +656 -656
- package/bin/index-guidance.mjs +892 -892
- package/bin/index-tests.mjs +709 -709
- package/bin/lib/process-manager.mjs +243 -243
- package/bin/lib/registry-cleanup.cjs +41 -41
- package/bin/prompt-hook.mjs +72 -72
- package/bin/semantic-search.mjs +472 -472
- package/bin/session-start-launcher.mjs +238 -238
- package/bin/setup-project.mjs +250 -250
- package/package.json +123 -123
- package/src/@claude-flow/cli/README.md +452 -452
- package/src/@claude-flow/cli/bin/cli.js +180 -180
- package/src/@claude-flow/cli/bin/preinstall.cjs +2 -2
- package/src/@claude-flow/cli/dist/src/commands/completions.js +409 -409
- package/src/@claude-flow/cli/dist/src/commands/doctor.js +5 -1
- package/src/@claude-flow/cli/dist/src/commands/embeddings.js +25 -25
- package/src/@claude-flow/cli/dist/src/commands/github.js +61 -61
- package/src/@claude-flow/cli/dist/src/commands/hive-mind.js +90 -90
- package/src/@claude-flow/cli/dist/src/commands/hooks.js +9 -9
- package/src/@claude-flow/cli/dist/src/commands/ruvector/import.js +14 -14
- package/src/@claude-flow/cli/dist/src/commands/ruvector/setup.js +624 -624
- package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +3 -0
- package/src/@claude-flow/cli/dist/src/config/moflo-config.js +101 -91
- package/src/@claude-flow/cli/dist/src/index.d.ts +5 -0
- package/src/@claude-flow/cli/dist/src/index.js +44 -0
- package/src/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +29 -29
- package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +43 -43
- package/src/@claude-flow/cli/dist/src/init/executor.js +453 -453
- package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +482 -482
- package/src/@claude-flow/cli/dist/src/init/moflo-init.d.ts +30 -30
- package/src/@claude-flow/cli/dist/src/init/moflo-init.js +140 -140
- package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +876 -876
- package/src/@claude-flow/cli/dist/src/memory/memory-initializer.js +371 -371
- package/src/@claude-flow/cli/dist/src/runtime/headless.js +28 -28
- package/src/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/src/@claude-flow/cli/dist/src/services/container-worker-pool.js +584 -0
- package/src/@claude-flow/cli/dist/src/services/daemon-lock.d.ts +14 -0
- package/src/@claude-flow/cli/dist/src/services/daemon-lock.js +1 -1
- package/src/@claude-flow/cli/dist/src/services/headless-worker-executor.js +84 -84
- package/src/@claude-flow/cli/package.json +1 -1
- package/src/@claude-flow/guidance/README.md +1195 -1195
- package/src/@claude-flow/guidance/package.json +198 -198
- package/src/@claude-flow/memory/README.md +587 -587
- package/src/@claude-flow/memory/dist/agent-memory-scope.test.js +4 -7
- package/src/@claude-flow/memory/dist/agentdb-backend.d.ts +2 -0
- package/src/@claude-flow/memory/dist/agentdb-backend.js +28 -26
- package/src/@claude-flow/memory/dist/auto-memory-bridge.test.js +36 -39
- package/src/@claude-flow/memory/dist/benchmark.test.js +1 -1
- package/src/@claude-flow/memory/dist/controller-registry.test.js +43 -0
- package/src/@claude-flow/memory/dist/database-provider.d.ts +2 -2
- package/src/@claude-flow/memory/dist/database-provider.js +6 -3
- package/src/@claude-flow/memory/dist/database-provider.test.js +1 -3
- package/src/@claude-flow/memory/dist/hybrid-backend.d.ts +245 -0
- package/src/@claude-flow/memory/dist/hybrid-backend.js +569 -0
- package/src/@claude-flow/memory/dist/hybrid-backend.test.d.ts +8 -0
- package/src/@claude-flow/memory/dist/hybrid-backend.test.js +320 -0
- package/src/@claude-flow/memory/dist/index.d.ts +3 -0
- package/src/@claude-flow/memory/dist/index.js +3 -0
- package/src/@claude-flow/memory/dist/sqlite-backend.d.ts +121 -0
- package/src/@claude-flow/memory/dist/sqlite-backend.js +572 -0
- package/src/@claude-flow/memory/dist/sqljs-backend.d.ts +4 -3
- package/src/@claude-flow/memory/dist/sqljs-backend.js +31 -30
- package/src/@claude-flow/memory/package.json +44 -44
- package/src/@claude-flow/shared/README.md +323 -323
- package/src/@claude-flow/shared/dist/core/config/defaults.js +1 -1
- package/src/@claude-flow/shared/dist/core/config/loader.js +1 -1
- package/src/@claude-flow/shared/dist/core/config/schema.js +1 -1
- package/src/@claude-flow/shared/dist/events/event-store.js +34 -50
- package/src/@claude-flow/shared/dist/events/event-store.test.js +4 -8
- package/src/@claude-flow/shared/dist/hooks/executor.js +4 -7
- package/src/@claude-flow/shared/dist/hooks/safety/file-organization.js +1 -1
- package/src/@claude-flow/shared/dist/hooks/safety/git-commit.js +3 -3
- package/src/@claude-flow/shared/dist/hooks/verify-exports.test.js +6 -6
- package/src/@claude-flow/shared/dist/utils/secure-logger.js +1 -1
- package/src/README.md +493 -493
- package/src/@claude-flow/guidance/dist/adversarial.d.ts +0 -284
- package/src/@claude-flow/guidance/dist/adversarial.js +0 -572
- package/src/@claude-flow/guidance/dist/analyzer.d.ts +0 -530
- package/src/@claude-flow/guidance/dist/analyzer.js +0 -2518
- package/src/@claude-flow/guidance/dist/artifacts.d.ts +0 -283
- package/src/@claude-flow/guidance/dist/artifacts.js +0 -356
- package/src/@claude-flow/guidance/dist/authority.d.ts +0 -290
- package/src/@claude-flow/guidance/dist/authority.js +0 -558
- package/src/@claude-flow/guidance/dist/capabilities.d.ts +0 -209
- package/src/@claude-flow/guidance/dist/capabilities.js +0 -485
- package/src/@claude-flow/guidance/dist/coherence.d.ts +0 -233
- package/src/@claude-flow/guidance/dist/coherence.js +0 -372
- package/src/@claude-flow/guidance/dist/compiler.d.ts +0 -87
- package/src/@claude-flow/guidance/dist/compiler.js +0 -419
- package/src/@claude-flow/guidance/dist/conformance-kit.d.ts +0 -225
- package/src/@claude-flow/guidance/dist/conformance-kit.js +0 -629
- package/src/@claude-flow/guidance/dist/continue-gate.d.ts +0 -214
- package/src/@claude-flow/guidance/dist/continue-gate.js +0 -353
- package/src/@claude-flow/guidance/dist/crypto-utils.d.ts +0 -17
- package/src/@claude-flow/guidance/dist/crypto-utils.js +0 -24
- package/src/@claude-flow/guidance/dist/evolution.d.ts +0 -282
- package/src/@claude-flow/guidance/dist/evolution.js +0 -500
- package/src/@claude-flow/guidance/dist/gates.d.ts +0 -79
- package/src/@claude-flow/guidance/dist/gates.js +0 -302
- package/src/@claude-flow/guidance/dist/gateway.d.ts +0 -206
- package/src/@claude-flow/guidance/dist/gateway.js +0 -452
- package/src/@claude-flow/guidance/dist/generators.d.ts +0 -153
- package/src/@claude-flow/guidance/dist/generators.js +0 -682
- package/src/@claude-flow/guidance/dist/headless.d.ts +0 -177
- package/src/@claude-flow/guidance/dist/headless.js +0 -342
- package/src/@claude-flow/guidance/dist/hooks.d.ts +0 -109
- package/src/@claude-flow/guidance/dist/hooks.js +0 -347
- package/src/@claude-flow/guidance/dist/index.d.ts +0 -205
- package/src/@claude-flow/guidance/dist/index.js +0 -321
- package/src/@claude-flow/guidance/dist/ledger.d.ts +0 -162
- package/src/@claude-flow/guidance/dist/ledger.js +0 -375
- package/src/@claude-flow/guidance/dist/manifest-validator.d.ts +0 -289
- package/src/@claude-flow/guidance/dist/manifest-validator.js +0 -838
- package/src/@claude-flow/guidance/dist/memory-gate.d.ts +0 -222
- package/src/@claude-flow/guidance/dist/memory-gate.js +0 -382
- package/src/@claude-flow/guidance/dist/meta-governance.d.ts +0 -265
- package/src/@claude-flow/guidance/dist/meta-governance.js +0 -348
- package/src/@claude-flow/guidance/dist/optimizer.d.ts +0 -104
- package/src/@claude-flow/guidance/dist/optimizer.js +0 -329
- package/src/@claude-flow/guidance/dist/persistence.d.ts +0 -189
- package/src/@claude-flow/guidance/dist/persistence.js +0 -464
- package/src/@claude-flow/guidance/dist/proof.d.ts +0 -185
- package/src/@claude-flow/guidance/dist/proof.js +0 -238
- package/src/@claude-flow/guidance/dist/retriever.d.ts +0 -116
- package/src/@claude-flow/guidance/dist/retriever.js +0 -394
- package/src/@claude-flow/guidance/dist/ruvbot-integration.d.ts +0 -370
- package/src/@claude-flow/guidance/dist/ruvbot-integration.js +0 -738
- package/src/@claude-flow/guidance/dist/temporal.d.ts +0 -426
- package/src/@claude-flow/guidance/dist/temporal.js +0 -658
- package/src/@claude-flow/guidance/dist/trust.d.ts +0 -283
- package/src/@claude-flow/guidance/dist/trust.js +0 -473
- package/src/@claude-flow/guidance/dist/truth-anchors.d.ts +0 -276
- package/src/@claude-flow/guidance/dist/truth-anchors.js +0 -488
- package/src/@claude-flow/guidance/dist/types.d.ts +0 -378
- package/src/@claude-flow/guidance/dist/types.js +0 -10
- package/src/@claude-flow/guidance/dist/uncertainty.d.ts +0 -372
- package/src/@claude-flow/guidance/dist/uncertainty.js +0 -619
- package/src/@claude-flow/guidance/dist/wasm-kernel.d.ts +0 -48
- package/src/@claude-flow/guidance/dist/wasm-kernel.js +0 -158
package/README.md
CHANGED
|
@@ -1,685 +1,685 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/eric-cielo/moflo/main/docs/Moflo_md.png?v=6" alt="MoFlo" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# MoFlo
|
|
6
|
-
|
|
7
|
-
**An opinionated fork of [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo), optimized for local development.**
|
|
8
|
-
|
|
9
|
-
## TL;DR
|
|
10
|
-
|
|
11
|
-
MoFlo makes your AI coding assistant remember what it learns, check what it knows before exploring files, and get smarter over time — all automatically. Install it, run `flo init`, restart your AI client, and everything just works: your docs and code are indexed on session start so the AI can search them instantly, workflow gates prevent the AI from wasting tokens on blind exploration, task outcomes feed back into routing so it picks the right agent type next time, and context depletion warnings tell you when to start a fresh session. No configuration, no API keys, no cloud services — it all runs locally on your machine.
|
|
12
|
-
|
|
13
|
-
## Opinionated Defaults
|
|
14
|
-
|
|
15
|
-
MoFlo makes deliberate choices so you don't have to:
|
|
16
|
-
|
|
17
|
-
- **Fully self-contained** — No external services, no cloud dependencies, no API keys. Everything runs locally on your machine.
|
|
18
|
-
- **Node.js runtime** — Targets Node.js specifically. All scripts, hooks, and tooling are JavaScript/TypeScript. No Python, no Rust binaries, no native compilation.
|
|
19
|
-
- **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.
|
|
20
|
-
- **Simplified embeddings pipeline** — 384-dimensional neural embeddings via Transformers.js (MiniLM-L6-v2, WASM). Same model and precision as the upstream multi-provider pipeline, but simpler — two scripts instead of an abstraction layer. Runs locally, no API calls.
|
|
21
|
-
- **Full learning stack wired up OOTB** — The following are all configured and functional from `flo init`, no manual setup:
|
|
22
|
-
- **SONA** (Self-Optimizing Neural Architecture) — learns from task trajectories via `@ruvector/sona` (Rust/NAPI)
|
|
23
|
-
- **MicroLoRA** — rank-2 LoRA weight adaptations at ~1µs per adapt via `@ruvector/learning-wasm` (WASM)
|
|
24
|
-
- **EWC++** (Elastic Weight Consolidation) — prevents catastrophic forgetting across sessions
|
|
25
|
-
- **HNSW Vector Search** — fast nearest-neighbor search via `@ruvector/core` VectorDb
|
|
26
|
-
- **Semantic Routing** — maps tasks to agents via `@ruvector/router` SemanticRouter
|
|
27
|
-
- **Trajectory Persistence** — outcomes stored in `routing-outcomes.json`, survive across sessions
|
|
28
|
-
- All WASM/NAPI-based, no GPU, no API keys, no external services.
|
|
29
|
-
- **Memory-first workflow** — Claude must search what it already knows before exploring files. Enforced by hooks, not just instructions.
|
|
30
|
-
- **Task registration before agents** — Sub-agents can't spawn until work is tracked. Prevents runaway agent proliferation.
|
|
31
|
-
- **Learned routing** — Task outcomes feed back into the routing system automatically. No manual configuration needed — it gets smarter with use.
|
|
32
|
-
- **Incremental indexing** — Guidance and code map indexes run on every session start but skip unchanged files. Fast after the first run.
|
|
33
|
-
- **Built for Claude Code, works with others** — We develop and test exclusively with Claude Code. The MCP tools, memory system, and hooks are client-independent and should work with any MCP-capable AI client, but Claude Code is the only tested target.
|
|
34
|
-
- **GitHub-oriented** — The `/flo` skill, PR workflows, and issue tracking are built around GitHub. With Claude's help, you can adapt them to your own issue tracker and source control system.
|
|
35
|
-
- **Cross-platform** — Forward-slash path normalization, no `sh -c` shell commands, `windowsHide` on all spawn calls.
|
|
36
|
-
|
|
37
|
-
## Features
|
|
38
|
-
|
|
39
|
-
| Feature | What It Does |
|
|
40
|
-
|---------|-------------|
|
|
41
|
-
| **Semantic Memory** | 384-dim domain-aware embeddings. Store knowledge, search it instantly. |
|
|
42
|
-
| **Code Navigation** | Indexes your codebase structure so Claude can answer "where does X live?" without Glob/Grep. |
|
|
43
|
-
| **Guidance Indexing** | Chunks your project docs (`.claude/guidance/`, `docs/`) and makes them searchable. |
|
|
44
|
-
| **Workflow Gates** | Enforces memory-first and task-creation patterns via Claude Code hooks. Prevents Claude from skipping steps. |
|
|
45
|
-
| **Learned Routing** | Routes tasks to the right agent type. Learns from outcomes — gets better over time. |
|
|
46
|
-
| **`/flo` Skill** | Execute GitHub issues through a full workflow: research → enhance → implement → test → simplify → PR. (Also available as `/fl`.) |
|
|
47
|
-
| **Context Tracking** | Monitors context window usage (FRESH → MODERATE → DEPLETED → CRITICAL) and advises accordingly. |
|
|
48
|
-
| **Cross-Platform** | Works on macOS, Linux, and Windows. |
|
|
49
|
-
|
|
50
|
-
## Getting Started
|
|
51
|
-
|
|
52
|
-
### 1. Install and init
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install --save-dev moflo
|
|
56
|
-
npx flo init
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
`flo init` automatically scans your project to find where your guidance, code, and tests live, then writes the results into `moflo.yaml`. It looks for:
|
|
60
|
-
|
|
61
|
-
| What | Directories it checks | Default if none found |
|
|
62
|
-
|------|----------------------|----------------------|
|
|
63
|
-
| **Guidance** | `.claude/guidance`, `docs/guides`, `docs`, `architecture`, `adr`, `.cursor/rules` | `.claude/guidance` |
|
|
64
|
-
| **Source code** | `src`, `packages`, `lib`, `app`, `apps`, `services`, `server`, `client` | `src` |
|
|
65
|
-
| **Tests** | `tests`, `test`, `__tests__`, `spec`, `e2e`, plus `__tests__` dirs inside `src/` | `tests` |
|
|
66
|
-
| **Languages** | Scans detected source dirs for file extensions | `.ts`, `.tsx`, `.js`, `.jsx` |
|
|
67
|
-
|
|
68
|
-
It also generates:
|
|
69
|
-
|
|
70
|
-
| Generated File | Purpose |
|
|
71
|
-
|----------------|---------|
|
|
72
|
-
| `moflo.yaml` | Project config with detected guidance/code locations |
|
|
73
|
-
| `.claude/settings.json` | Workflow gate hooks for Claude Code |
|
|
74
|
-
| `.claude/skills/flo/` | The `/flo` issue execution skill (also `/fl`) |
|
|
75
|
-
| `CLAUDE.md` section | Teaches Claude how to use MoFlo |
|
|
76
|
-
| `.gitignore` entries | Excludes MoFlo state directories |
|
|
77
|
-
|
|
78
|
-
In interactive mode (`flo init` without `--yes`), it shows what it found and lets you confirm or adjust before writing.
|
|
79
|
-
|
|
80
|
-
#### Migrating from Claude Flow / Ruflo
|
|
81
|
-
|
|
82
|
-
If `flo init` detects an existing `.claude/settings.json` or `.claude-flow/` directory (from a prior Claude Flow or Ruflo installation), it treats the project as already initialized and runs in **update mode** — merging MoFlo's hooks and configuration into your existing setup without overwriting your data. Specifically:
|
|
83
|
-
|
|
84
|
-
- **Hooks** — If your `.claude/settings.json` already has MoFlo-style gate hooks (`flo gate`), the hooks step is skipped. Otherwise, MoFlo's hooks are written into the file (existing non-MoFlo hooks are not removed).
|
|
85
|
-
- **MCP servers** — MoFlo registers itself as the `moflo` server in `.mcp.json`. If you had `claude-flow` or `ruflo` MCP servers configured previously, those entries remain untouched — you can remove them manually once you've verified MoFlo is working. The `flo doctor` command checks for the `moflo` server specifically.
|
|
86
|
-
- **Config files** — `moflo.yaml`, `CLAUDE.md`, and `.claude/skills/flo/` follow the same skip-if-exists logic. Use `--force` to regenerate them.
|
|
87
|
-
|
|
88
|
-
To force a clean re-initialization over an existing setup:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
npx flo init --force
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### 2. Review your guidance and code settings
|
|
95
|
-
|
|
96
|
-
Open `moflo.yaml` to see what init detected. The two key sections:
|
|
97
|
-
|
|
98
|
-
**Guidance** — documentation that helps Claude understand your project (conventions, architecture, domain context):
|
|
99
|
-
|
|
100
|
-
```yaml
|
|
101
|
-
guidance:
|
|
102
|
-
directories:
|
|
103
|
-
- .claude/guidance # project rules, patterns, conventions
|
|
104
|
-
- docs # general documentation
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Code map** — source files to index for "where does X live?" navigation:
|
|
108
|
-
|
|
109
|
-
```yaml
|
|
110
|
-
code_map:
|
|
111
|
-
directories:
|
|
112
|
-
- src # your source code
|
|
113
|
-
- packages # shared packages (monorepo)
|
|
114
|
-
extensions: [".ts", ".tsx"]
|
|
115
|
-
exclude: [node_modules, dist, .next, coverage]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Tests** — test files to index for "what tests cover X?" reverse mapping:
|
|
119
|
-
|
|
120
|
-
```yaml
|
|
121
|
-
tests:
|
|
122
|
-
directories:
|
|
123
|
-
- tests # your test files
|
|
124
|
-
- __tests__ # jest-style test dirs
|
|
125
|
-
patterns: ["*.test.*", "*.spec.*", "*.test-*"]
|
|
126
|
-
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
127
|
-
exclude: [node_modules, coverage, dist]
|
|
128
|
-
namespace: tests
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
MoFlo chunks your guidance files into semantic embeddings, indexes your code structure, and maps test files back to their source targets — so Claude searches your knowledge base before touching any files. Adjust these directories to match your project:
|
|
132
|
-
|
|
133
|
-
```yaml
|
|
134
|
-
# Monorepo with shared docs
|
|
135
|
-
guidance:
|
|
136
|
-
directories: [.claude/guidance, docs, packages/shared/docs]
|
|
137
|
-
code_map:
|
|
138
|
-
directories: [packages, apps, libs]
|
|
139
|
-
|
|
140
|
-
# Backend + frontend
|
|
141
|
-
code_map:
|
|
142
|
-
directories: [server/src, client/src]
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### 3. Index and verify
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
npx flo memory index-guidance # Index your guidance docs
|
|
149
|
-
npx flo memory code-map # Index your code structure
|
|
150
|
-
npx flo doctor # Verify everything works
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Both indexes run automatically at session start after this, so you only need to run them manually on first setup or after major structural changes. To reindex everything at once:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npx flo memory refresh # Reindex all content, rebuild embeddings, cleanup, vacuum
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Auto-Indexing
|
|
160
|
-
|
|
161
|
-
MoFlo automatically indexes three types of content on every session start, so your AI assistant always has up-to-date knowledge without manual intervention.
|
|
162
|
-
|
|
163
|
-
### What gets indexed
|
|
164
|
-
|
|
165
|
-
| Index | Content | What it produces | Namespace |
|
|
166
|
-
|-------|---------|------------------|-----------|
|
|
167
|
-
| **Guidance** | Markdown files in your guidance directories (`.claude/guidance/`, `docs/`, etc.) | Chunked text with 384-dim semantic embeddings — enables natural-language search across your project documentation | `guidance` |
|
|
168
|
-
| **Code map** | Source files in your code directories (`src/`, `packages/`, etc.) | Structural index of exports, classes, functions, and types — enables "where does X live?" navigation without Glob/Grep | `code-map` |
|
|
169
|
-
| **Tests** | Test files matching configured patterns (`*.test.*`, `*.spec.*`) | Reverse mapping from test files to their source targets — enables "what tests cover X?" lookups | `tests` |
|
|
170
|
-
|
|
171
|
-
### How it works
|
|
172
|
-
|
|
173
|
-
1. **Session start hook** — When your AI client starts a new session, MoFlo's `SessionStart` hook launches three indexers in parallel as background processes.
|
|
174
|
-
2. **Incremental** — Each indexer tracks file modification times. Only files that changed since the last index run are re-processed. The first run takes longer; subsequent runs typically finish in under a second.
|
|
175
|
-
3. **Embedding generation** — Guidance chunks are embedded using MiniLM-L6-v2 (384 dimensions, WASM). These vectors are stored in the SQLite memory database and used for semantic search.
|
|
176
|
-
4. **No blocking** — The indexers run in the background and don't block your session from starting. You can begin working immediately.
|
|
177
|
-
|
|
178
|
-
### Configuration
|
|
179
|
-
|
|
180
|
-
Each indexer can be toggled independently in `moflo.yaml`:
|
|
181
|
-
|
|
182
|
-
```yaml
|
|
183
|
-
auto_index:
|
|
184
|
-
guidance: true # Index docs on session start
|
|
185
|
-
code_map: true # Index code structure on session start
|
|
186
|
-
tests: true # Index test files on session start
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Set any to `false` to disable that indexer. The underlying data remains in memory — you just stop refreshing it automatically. You can still run indexers manually:
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
npx flo memory index-guidance # Manual guidance reindex
|
|
193
|
-
npx flo memory code-map # Manual code map reindex
|
|
194
|
-
npx flo memory refresh # Reindex everything + rebuild embeddings + vacuum
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Why this matters
|
|
198
|
-
|
|
199
|
-
Without auto-indexing, your AI assistant starts every session with a blank slate — it doesn't know what documentation exists, where code lives, or what tests cover which files. It resorts to Glob/Grep exploration, which burns tokens and context window on rediscovery.
|
|
200
|
-
|
|
201
|
-
With auto-indexing, the AI can search semantically ("how does auth work?") and get relevant documentation chunks ranked by similarity, or ask "where is the user model defined?" and get a direct answer from the code map — all without touching the filesystem.
|
|
202
|
-
|
|
203
|
-
## The Gate System
|
|
204
|
-
|
|
205
|
-
MoFlo installs Claude Code hooks that run on every tool call. Together, these gates create a **feedback loop** that prevents Claude from wasting tokens on blind exploration and ensures it builds on prior knowledge.
|
|
206
|
-
|
|
207
|
-
### Gates explained
|
|
208
|
-
|
|
209
|
-
| Gate | What it enforces | When it triggers | Why it matters |
|
|
210
|
-
|------|-----------------|------------------|----------------|
|
|
211
|
-
| **Memory-first** | Claude must search the memory database before using Glob, Grep, or Read on guidance files | Before every Glob/Grep call, and before Read calls targeting `.claude/guidance/` | Prevents the AI from re-exploring files it (or a previous session) already indexed. Forces it to check what it knows first, saving tokens and context window. |
|
|
212
|
-
| **TaskCreate-first** | Claude must call TaskCreate before spawning sub-agents via the Task tool | Before every Task (agent spawn) call | Ensures every piece of delegated work is tracked. Prevents runaway agent proliferation where Claude spawns agents without a clear plan. |
|
|
213
|
-
| **Context tracking** | Tracks conversation length and warns about context depletion | On every user prompt (UserPromptSubmit hook) | As conversations grow, AI quality degrades. MoFlo tracks interaction count and assigns a bracket (FRESH → MODERATE → DEPLETED → CRITICAL), advising Claude to checkpoint progress or start a fresh session before quality drops. |
|
|
214
|
-
| **Routing** | Analyzes each prompt and recommends the optimal agent type and model tier | On every user prompt (UserPromptSubmit hook) | Saves cost by suggesting haiku for simple tasks, sonnet for moderate ones, opus for complex reasoning — without you having to think about model selection. |
|
|
215
|
-
|
|
216
|
-
### Smart classification
|
|
217
|
-
|
|
218
|
-
The memory-first gate doesn't blindly block every request. It classifies each prompt:
|
|
219
|
-
|
|
220
|
-
- **Simple directives** (e.g., "commit", "yes", "continue", "looks good") — skip the gate entirely, no memory search required
|
|
221
|
-
- **Task-oriented prompts** (e.g., "fix the auth bug", "add pagination to the API") — gate enforced, must search memory first
|
|
222
|
-
|
|
223
|
-
### Disabling gates
|
|
224
|
-
|
|
225
|
-
All gates are configurable in `moflo.yaml`:
|
|
226
|
-
|
|
227
|
-
```yaml
|
|
228
|
-
gates:
|
|
229
|
-
memory_first: true # Set to false to disable memory-first enforcement
|
|
230
|
-
task_create_first: true # Set to false to disable TaskCreate enforcement
|
|
231
|
-
context_tracking: true # Set to false to disable context bracket warnings
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
You can also disable individual hooks in `.claude/settings.json` by removing the corresponding hook entries.
|
|
235
|
-
|
|
236
|
-
## The `/flo` Skill
|
|
237
|
-
|
|
238
|
-
Inside your AI client, the `/flo` (or `/fl`) slash command drives GitHub issue workflows:
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
/flo <issue> # Full workflow (research → implement → test → PR)
|
|
242
|
-
/flo -t <issue> # Ticket only (research and update ticket, then stop)
|
|
243
|
-
/flo -r <issue> # Research only (analyze issue, output findings)
|
|
244
|
-
/flo -s <issue> # Swarm mode (multi-agent coordination)
|
|
245
|
-
/flo -h <issue> # Hive-mind mode (consensus-based coordination)
|
|
246
|
-
/flo -n <issue> # Normal mode (default, single agent, no swarm)
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
For full options and details, type `/flo` with no arguments — your AI client will display the complete skill documentation. Also available as `/fl`.
|
|
250
|
-
|
|
251
|
-
### Epic handling
|
|
252
|
-
|
|
253
|
-
When you pass an issue number, `/flo` automatically checks if it's an epic — no extra flag needed. An issue is treated as an epic if any of these are true:
|
|
254
|
-
|
|
255
|
-
- It has a label matching `epic`, `tracking`, `parent`, or `umbrella` (case-insensitive)
|
|
256
|
-
- Its body contains a `## Stories` or `## Tasks` section
|
|
257
|
-
- Its body has checklist-linked issues: `- [ ] #101`
|
|
258
|
-
- Its body has numbered issue references: `1. #101`
|
|
259
|
-
- The issue has GitHub sub-issues (via the API)
|
|
260
|
-
|
|
261
|
-
When an epic is detected, `/flo` processes each child story sequentially — full workflow per story (research → implement → test → PR), one at a time, in the order listed.
|
|
262
|
-
|
|
263
|
-
For simple epics with independent stories, `/flo <epic>` is all you need. For complex features where you want state tracking, resume capability, and auto-merge between stories, use `flo orc` instead.
|
|
264
|
-
|
|
265
|
-
### Feature Orchestration (`flo orc`)
|
|
266
|
-
|
|
267
|
-
`flo orc` is the robust epic runner — it adds persistent state, resume from failure, and auto-merge between stories on top of `/flo`. It accepts either a GitHub issue number or a YAML file:
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
# From a GitHub epic (auto-detects stories)
|
|
271
|
-
flo orc run 42 # Fetch epic #42, run all stories sequentially
|
|
272
|
-
flo orc run 42 --dry-run # Preview execution plan without running
|
|
273
|
-
flo orc run 42 --no-merge # Skip auto-merge between stories
|
|
274
|
-
|
|
275
|
-
# From a YAML definition (explicit dependencies)
|
|
276
|
-
flo orc run feature.yaml # Execute stories in dependency order
|
|
277
|
-
flo orc run feature.yaml --dry-run # Show execution plan
|
|
278
|
-
flo orc run feature.yaml --verbose # Stream Claude output to terminal
|
|
279
|
-
|
|
280
|
-
# State management
|
|
281
|
-
flo orc status epic-42 # Check progress (which stories passed/failed)
|
|
282
|
-
flo orc reset epic-42 # Reset state for re-run
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
When given an issue number, `flo orc` fetches the epic from GitHub, extracts child stories from checklists and numbered references, then runs each through `/flo` with state tracking. If a story fails, you can fix the issue and `flo orc run 42` again — it resumes from where it left off, skipping already-passed stories.
|
|
286
|
-
|
|
287
|
-
For features with inter-story dependencies (story B requires story A to be merged first), use a YAML definition:
|
|
288
|
-
|
|
289
|
-
```yaml
|
|
290
|
-
feature:
|
|
291
|
-
id: my-feature
|
|
292
|
-
name: "My Feature"
|
|
293
|
-
repository: /path/to/project
|
|
294
|
-
base_branch: main
|
|
295
|
-
|
|
296
|
-
stories:
|
|
297
|
-
- id: story-1
|
|
298
|
-
name: "Entity and service"
|
|
299
|
-
issue: 101
|
|
300
|
-
|
|
301
|
-
- id: story-2
|
|
302
|
-
name: "Routes and tests"
|
|
303
|
-
issue: 102
|
|
304
|
-
depends_on: [story-1]
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
| | `/flo <epic>` | `flo orc run <epic>` |
|
|
308
|
-
|---|---|---|
|
|
309
|
-
| **State tracking** | No | Yes (`.claude-orc/state.json`) |
|
|
310
|
-
| **Resume from failure** | No | Yes (skips passed stories) |
|
|
311
|
-
| **Auto-merge PRs** | No | Yes (between stories) |
|
|
312
|
-
| **Dry-run preview** | No | Yes |
|
|
313
|
-
| **Dependency ordering** | No (top-to-bottom) | Yes (YAML only, topological sort) |
|
|
314
|
-
|
|
315
|
-
## Commands
|
|
316
|
-
|
|
317
|
-
You don't need to run these for normal use — `flo init` sets everything up, and the hooks handle memory, routing, and learning automatically. These commands are here for manual setup, debugging, and tweaking.
|
|
318
|
-
|
|
319
|
-
### Memory
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
flo memory store -k "key" --value "data" # Store with 384-dim embedding
|
|
323
|
-
flo memory search -q "auth patterns" # Semantic search
|
|
324
|
-
flo memory index-guidance # Index guidance docs
|
|
325
|
-
flo memory code-map # Index code structure
|
|
326
|
-
flo memory rebuild-index # Regenerate all embeddings
|
|
327
|
-
flo memory refresh # Reindex all + rebuild + cleanup + vacuum
|
|
328
|
-
flo memory stats # Show statistics
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Routing & Learning
|
|
332
|
-
|
|
333
|
-
```bash
|
|
334
|
-
flo hooks route --task "description" # Route task to optimal agent
|
|
335
|
-
flo hooks learn --pattern "..." --domain "." # Store a pattern
|
|
336
|
-
flo hooks patterns # List learned patterns
|
|
337
|
-
flo hooks consolidate # Promote/prune patterns
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Workflow Gates
|
|
341
|
-
|
|
342
|
-
```bash
|
|
343
|
-
flo gate check-before-scan # Blocks Glob/Grep if memory not searched
|
|
344
|
-
flo gate check-before-agent # Blocks Agent tool if no TaskCreate
|
|
345
|
-
flo gate prompt-reminder # Context bracket tracking
|
|
346
|
-
flo gate session-reset # Reset workflow state
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Diagnostics
|
|
350
|
-
|
|
351
|
-
```bash
|
|
352
|
-
flo doctor # Quick health check (environment, deps, config)
|
|
353
|
-
flo doctor --fix # Auto-fix issues (memory DB, daemon, config, MCP, zombies)
|
|
354
|
-
flo diagnose # Full integration test (memory, swarm, hive, hooks, neural)
|
|
355
|
-
flo diagnose --suite memory # Run only memory tests
|
|
356
|
-
flo diagnose --json # JSON output for CI/automation
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
#### `flo doctor` — Health Check
|
|
360
|
-
|
|
361
|
-
`flo doctor` runs 16 parallel health checks against your environment and reports pass/warn/fail for each:
|
|
362
|
-
|
|
363
|
-
| Check | What it verifies |
|
|
364
|
-
|-------|-----------------|
|
|
365
|
-
| **Version Freshness** | Whether your installed MoFlo version matches the latest on npm (detects stale npx cache) |
|
|
366
|
-
| **Node.js Version** | Node.js >= 20 installed |
|
|
367
|
-
| **npm Version** | npm >= 9 installed |
|
|
368
|
-
| **Claude Code CLI** | `claude` command available |
|
|
369
|
-
| **Git** | Git installed and project is a git repository |
|
|
370
|
-
| **Config File** | Valid `moflo.yaml` or `.claude-flow/config.yaml` exists |
|
|
371
|
-
| **Daemon Status** | Background daemon running (checks PID, cleans stale locks) |
|
|
372
|
-
| **Memory Database** | SQLite memory DB exists and is accessible |
|
|
373
|
-
| **Embeddings** | Vectors indexed in memory DB, HNSW index present |
|
|
374
|
-
| **Test Directories** | Test dirs from `moflo.yaml` exist on disk, reports auto-index status |
|
|
375
|
-
| **MCP Servers** | `moflo` MCP server configured in `.mcp.json` |
|
|
376
|
-
| **Disk Space** | Sufficient free disk space (warns at 80%, fails at 90%) |
|
|
377
|
-
| **TypeScript** | TypeScript compiler available |
|
|
378
|
-
| **agentic-flow** | Optional agentic-flow package installed (for enhanced embeddings/routing) |
|
|
379
|
-
| **Zombie Processes** | No orphaned MoFlo node processes running |
|
|
380
|
-
|
|
381
|
-
**Auto-fix mode** (`flo doctor --fix`) attempts to repair each failing check automatically:
|
|
382
|
-
|
|
383
|
-
| Issue | What `--fix` does |
|
|
384
|
-
|-------|------------------|
|
|
385
|
-
| Missing memory database | Creates `.swarm/` directory and initializes the SQLite DB |
|
|
386
|
-
| Embeddings not initialized | Initializes memory DB and runs `embeddings init` |
|
|
387
|
-
| Missing config file | Runs `config init` to generate defaults |
|
|
388
|
-
| Stale daemon lock | Removes stale `.claude-flow/daemon.lock` and restarts daemon |
|
|
389
|
-
| MCP server not configured | Runs `claude mcp add moflo` to register the server |
|
|
390
|
-
| Claude Code CLI missing | Installs `@anthropic-ai/claude-code` globally |
|
|
391
|
-
| Zombie processes | Kills orphaned MoFlo processes (tracked + OS-level scan) |
|
|
392
|
-
|
|
393
|
-
After auto-fixing, doctor re-runs all checks and shows the updated results. Issues that can't be fixed automatically are listed with manual fix commands.
|
|
394
|
-
|
|
395
|
-
Additional flags:
|
|
396
|
-
|
|
397
|
-
```bash
|
|
398
|
-
flo doctor --install # Auto-install missing Claude Code CLI
|
|
399
|
-
flo doctor --kill-zombies # Find and kill orphaned MoFlo processes
|
|
400
|
-
flo doctor -c memory # Check only a specific component
|
|
401
|
-
flo doctor -c embeddings # Check only embeddings health
|
|
402
|
-
flo doctor --verbose # Verbose output
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
#### `flo diagnose` — Integration Tests
|
|
406
|
-
|
|
407
|
-
While `doctor` checks your environment, `diagnose` exercises every subsystem end-to-end: memory CRUD, embedding generation, semantic search, swarm lifecycle, hive-mind consensus, task management, hooks, config, neural patterns, and init idempotency. All test data is cleaned up after each test — nothing is left behind.
|
|
408
|
-
|
|
409
|
-
### GitHub Repository Setup
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
flo github setup # One-shot: generate CI + apply repo settings + branch protection
|
|
413
|
-
flo github setup --dry-run # Preview everything without making changes
|
|
414
|
-
flo github ci # Generate .github/workflows/ci.yml from project config
|
|
415
|
-
flo github ci --dry-run # Print workflow to stdout
|
|
416
|
-
flo github settings # Apply repo settings + branch protection via gh CLI
|
|
417
|
-
flo github settings --dry-run # Preview settings changes
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
`flo github ci` auto-detects your package manager (npm/pnpm/yarn/bun), TypeScript, and test directories from `moflo.yaml` and `package.json`, then generates a CI workflow with install, build, lint, type-check, and test steps.
|
|
421
|
-
|
|
422
|
-
`flo github settings` applies recommended defaults via `gh` CLI: delete-branch-on-merge, squash merge with PR title/body, auto-merge, linear history, and configurable branch protection (required reviews, dismiss stale reviews, block force pushes). Requires `gh auth login`.
|
|
423
|
-
|
|
424
|
-
### System
|
|
425
|
-
|
|
426
|
-
```bash
|
|
427
|
-
flo init # Initialize project (one-time setup)
|
|
428
|
-
flo --version # Show version
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
## What Ships Out of the Box
|
|
432
|
-
|
|
433
|
-
`flo init` wires up the following systems automatically. Here's what each one does, why it matters, and whether it's enabled by default.
|
|
434
|
-
|
|
435
|
-
### Hooks (enabled OOTB)
|
|
436
|
-
|
|
437
|
-
Hooks are shell commands that Claude Code runs automatically at specific points in its workflow. MoFlo installs 14 hooks across 7 lifecycle events. You don't invoke these — they fire automatically.
|
|
438
|
-
|
|
439
|
-
| Hook Event | What fires | What it does | Enabled OOTB |
|
|
440
|
-
|------------|-----------|-------------|:---:|
|
|
441
|
-
| **PreToolUse: Write/Edit** | `flo hooks pre-edit` | Records which file is about to be edited, captures before-state for learning | Yes |
|
|
442
|
-
| **PreToolUse: Glob/Grep** | `flo gate check-before-scan` | Memory-first gate — blocks file exploration until memory is searched | Yes |
|
|
443
|
-
| **PreToolUse: Read** | `flo gate check-before-read` | Blocks reading guidance files directly until memory is searched | Yes |
|
|
444
|
-
| **PreToolUse: Task** | `flo gate check-before-agent` + `flo hooks pre-task` | TaskCreate gate + routing recommendation before agent spawn | Yes |
|
|
445
|
-
| **PreToolUse: Bash** | `flo gate check-dangerous-command` | Safety check on shell commands | Yes |
|
|
446
|
-
| **PostToolUse: Write/Edit** | `flo hooks post-edit` | Records edit outcome, optionally trains neural patterns | Yes |
|
|
447
|
-
| **PostToolUse: Task** | `flo hooks post-task` | Records task completion, feeds outcome into routing learner | Yes |
|
|
448
|
-
| **PostToolUse: TaskCreate** | `flo gate record-task-created` | Records that a task was registered (clears TaskCreate gate) | Yes |
|
|
449
|
-
| **PostToolUse: Bash** | `flo gate check-bash-memory` | Detects memory search commands in Bash (clears memory gate) | Yes |
|
|
450
|
-
| **PostToolUse: memory_search** | `flo gate record-memory-searched` | Records that memory was searched (clears memory-first gate) | Yes |
|
|
451
|
-
| **UserPromptSubmit** | `flo gate prompt-reminder` + `flo hooks route` | Resets per-prompt gate state, tracks context bracket, routes task to agent | Yes |
|
|
452
|
-
| **SessionStart** | `session-start-launcher.mjs` | Launches auto-indexers (guidance, code map, tests), restores session state | Yes |
|
|
453
|
-
| **Stop** | `flo hooks session-end` | Persists session metrics, exports learning data | Yes |
|
|
454
|
-
| **PreCompact** | `flo gate compact-guidance` | Injects guidance summary before context compaction | Yes |
|
|
455
|
-
| **Notification** | `flo hooks notification` | Routes Claude Code notifications through MoFlo | Yes |
|
|
456
|
-
|
|
457
|
-
### Systems (enabled OOTB)
|
|
458
|
-
|
|
459
|
-
These are the backend systems that hooks and commands interact with.
|
|
460
|
-
|
|
461
|
-
| System | What It Does | Why It Matters | Enabled OOTB |
|
|
462
|
-
|--------|-------------|----------------|:---:|
|
|
463
|
-
| **Semantic Memory** | SQLite database (sql.js/WASM) storing knowledge entries with 384-dim vector embeddings | Your AI assistant accumulates project knowledge across sessions instead of starting from scratch each time | Yes |
|
|
464
|
-
| **HNSW Vector Search** | Hierarchical Navigable Small World index for fast nearest-neighbor search | Searches across thousands of stored entries return in milliseconds instead of scanning linearly | Yes |
|
|
465
|
-
| **Guidance Indexing** | Chunks markdown docs into overlapping segments, embeds each with MiniLM-L6-v2 | Your project documentation becomes searchable by meaning ("how does auth work?") not just keywords | Yes |
|
|
466
|
-
| **Code Map** | Parses source files for exports, classes, functions, types | The AI can answer "where is X defined?" from the index instead of running Glob/Grep | Yes |
|
|
467
|
-
| **Test Indexing** | Maps test files to their source targets based on naming patterns | The AI can answer "what tests cover X?" and identify untested code | Yes |
|
|
468
|
-
| **Workflow Gates** | Hook-based enforcement of memory-first and task-registration patterns | Prevents the AI from wasting tokens on blind exploration and untracked agent spawns | Yes |
|
|
469
|
-
| **Context Tracking** | Interaction counter with bracket classification (FRESH/MODERATE/DEPLETED/CRITICAL) | Warns before context quality degrades, suggests when to checkpoint or start fresh | Yes |
|
|
470
|
-
| **Semantic Routing** | Matches task descriptions to agent types using vector similarity against 12 built-in patterns | Routes work to the right specialist (security-architect, tester, coder, etc.) automatically | Yes |
|
|
471
|
-
| **Learned Routing** | Records task outcomes (agent type + success/failure) and feeds them back into routing | Routing gets smarter over time — successful patterns are weighted higher in future recommendations | Yes |
|
|
472
|
-
| **SONA Learning** | Self-Optimizing Neural Architecture that learns from task trajectories | Adapts routing weights based on actual outcomes, not just keyword matching | Yes |
|
|
473
|
-
| **MicroLoRA Adaptation** | Rank-2 LoRA weight updates from successful patterns (~1µs per adapt) | Fine-grained model adaptation without full retraining | Yes |
|
|
474
|
-
| **EWC++ Consolidation** | Elastic Weight Consolidation that prevents catastrophic forgetting | New learning doesn't overwrite patterns from earlier sessions | Yes |
|
|
475
|
-
| **Session Persistence** | Stop hook exports session metrics; SessionStart hook restores prior state | Patterns learned on Monday are available on Friday | Yes |
|
|
476
|
-
| **Status Line** | Live dashboard showing git branch, session state, memory stats, MCP status | At-a-glance visibility into what MoFlo is doing | Yes |
|
|
477
|
-
| **MCP Tool Server** | 150+ MCP tools for memory, hooks, coordination, etc. (schemas deferred by default) | Enables AI clients to interact with MoFlo programmatically | Yes (deferred) |
|
|
478
|
-
|
|
479
|
-
### Systems (available but off by default)
|
|
480
|
-
|
|
481
|
-
| System | What It Does | How to Enable |
|
|
482
|
-
|--------|-------------|---------------|
|
|
483
|
-
| **Model Routing** | Auto-selects haiku/sonnet/opus per task based on complexity analysis | `model_routing.enabled: true` in `moflo.yaml` |
|
|
484
|
-
| **MCP Auto-Start** | Starts MCP server automatically on session begin | `mcp.auto_start: true` in `moflo.yaml` |
|
|
485
|
-
| **Tool Schema Eager Loading** | Loads all 150+ MCP tool schemas at startup (instead of on-demand) | `mcp.tool_defer: false` in `moflo.yaml` |
|
|
486
|
-
|
|
487
|
-
## The Two-Layer Task System
|
|
488
|
-
|
|
489
|
-
MoFlo doesn't replace your AI client's task system — it wraps it. Your client (Claude Code, Cursor, or any MCP-capable tool) handles spawning agents and running code. MoFlo adds a coordination layer on top that handles memory, routing, and learning.
|
|
490
|
-
|
|
491
|
-
```
|
|
492
|
-
┌──────────────────────────────────────────────────┐
|
|
493
|
-
│ YOUR AI CLIENT (Execution Layer) │
|
|
494
|
-
│ Spawns agents, runs code, streams output │
|
|
495
|
-
│ TaskCreate → Agent → TaskUpdate → results │
|
|
496
|
-
├──────────────────────────────────────────────────┤
|
|
497
|
-
│ MOFLO (Knowledge Layer) │
|
|
498
|
-
│ Routes tasks, gates agent spawns, stores │
|
|
499
|
-
│ patterns, learns from outcomes │
|
|
500
|
-
└──────────────────────────────────────────────────┘
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Here's how a typical task flows through both layers:
|
|
504
|
-
|
|
505
|
-
1. **MoFlo routes** — Before work starts, MoFlo analyzes the prompt and recommends an agent type and model tier via hook or MCP tool.
|
|
506
|
-
2. **MoFlo gates** — Before an agent can spawn, MoFlo verifies that memory was searched and a task was registered. This prevents blind exploration.
|
|
507
|
-
3. **Your client executes** — The actual agent runs through your client's native task system. MoFlo doesn't manage the agent — your client handles execution, output, and completion.
|
|
508
|
-
4. **MoFlo learns** — After the agent finishes, MoFlo records what worked (or didn't) in its memory database. Successful patterns feed into future routing.
|
|
509
|
-
|
|
510
|
-
The key insight: **your client handles execution, MoFlo handles knowledge.** Your client is good at spawning agents and running code. MoFlo is good at remembering what happened, routing to the right agent, and ensuring prior knowledge is checked before exploring from scratch.
|
|
511
|
-
|
|
512
|
-
For complex work, MoFlo structures tasks into waves — a research wave discovers context, then an implementation wave acts on it — with dependencies tracked through both the client's task system and MoFlo's coordination layer. The full integration pattern is documented in `.claude/guidance/task-swarm-integration.md`.
|
|
513
|
-
|
|
514
|
-
The `/flo` skill ties both systems together for GitHub issues — driving a full workflow (research → enhance → implement → test → simplify → PR) with your client's agents for execution and MoFlo's memory for continuity.
|
|
515
|
-
|
|
516
|
-
### Intelligent Agent Routing
|
|
517
|
-
|
|
518
|
-
MoFlo ships with 12 built-in task patterns that map common work to the right agent type:
|
|
519
|
-
|
|
520
|
-
| Pattern | Keywords | Primary Agent |
|
|
521
|
-
|---------|----------|---------------|
|
|
522
|
-
| security-task | auth, password, encryption, CVE | security-architect |
|
|
523
|
-
| testing-task | test, spec, coverage, e2e | tester |
|
|
524
|
-
| database-task | schema, migration, SQL, ORM | architect |
|
|
525
|
-
| feature-task | implement, add, create, build | architect → coder |
|
|
526
|
-
| bugfix-task | bug, fix, error, crash, debug | coder |
|
|
527
|
-
| api-task | endpoint, REST, route, handler | architect → coder |
|
|
528
|
-
| ... | | *(12 patterns total)* |
|
|
529
|
-
|
|
530
|
-
When you route a task (`flo hooks route --task "..."` or via MCP), MoFlo runs semantic similarity against these patterns using HNSW vector search and returns a ranked recommendation with confidence scores.
|
|
531
|
-
|
|
532
|
-
**The routing gets smarter over time.** Every time a task completes successfully, MoFlo's post-task hook records the outcome — the full task description, which agent handled it, and whether it succeeded. These learned patterns are combined with the built-in seeds on every future route call. Because learned patterns contain rich task descriptions (not just short keywords), they discriminate better as they accumulate.
|
|
533
|
-
|
|
534
|
-
Routing outcomes are stored in `.claude-flow/routing-outcomes.json` and persist across sessions. You can inspect them with `flo hooks patterns` or transfer them between projects with `flo hooks transfer`.
|
|
535
|
-
|
|
536
|
-
### Memory & Knowledge Storage
|
|
537
|
-
|
|
538
|
-
MoFlo uses a SQLite database (via sql.js/WASM — no native deps) to store three types of knowledge:
|
|
539
|
-
|
|
540
|
-
| Namespace | What's Stored | How It Gets There |
|
|
541
|
-
|-----------|---------------|-------------------|
|
|
542
|
-
| `guidance` | Chunked project docs (`.claude/guidance/`, `docs/`) with 384-dim embeddings | `flo-index` on session start |
|
|
543
|
-
| `code-map` | Structural index of source files (exports, classes, functions) | `flo-codemap` on session start |
|
|
544
|
-
| `patterns` | Learned patterns from successful task outcomes | Post-task hooks after agent work |
|
|
545
|
-
|
|
546
|
-
**Semantic search** uses cosine similarity on neural embeddings (MiniLM-L6-v2, 384 dimensions). When Claude searches memory, it gets the most relevant chunks ranked by semantic similarity — not keyword matching.
|
|
547
|
-
|
|
548
|
-
**Session start indexing** — Three background processes run on every session start: the guidance indexer, the code map generator, and the learning service. All three are incremental (unchanged files are skipped) and run in parallel so they don't block the session.
|
|
549
|
-
|
|
550
|
-
**Cross-session persistence** — Everything stored in the database survives across sessions. Patterns learned on Monday are available on Friday. The stop hook exports session metrics, and the session-restore hook loads prior state.
|
|
551
|
-
|
|
552
|
-
### For Claude
|
|
553
|
-
|
|
554
|
-
When `flo init` runs, it appends a workflow section to your CLAUDE.md that teaches Claude:
|
|
555
|
-
- Always search memory before Glob/Grep/Read (enforced by gates)
|
|
556
|
-
- Use `mcp__moflo__memory_search` for knowledge retrieval
|
|
557
|
-
- Use `/flo <issue>` (or `/fl`) for issue execution
|
|
558
|
-
- Store learnings after task completion
|
|
559
|
-
|
|
560
|
-
## Full Configuration Reference
|
|
561
|
-
|
|
562
|
-
`flo init` generates a `moflo.yaml` at your project root. Here's the complete set of options:
|
|
563
|
-
|
|
564
|
-
```yaml
|
|
565
|
-
project:
|
|
566
|
-
name: "my-project"
|
|
567
|
-
|
|
568
|
-
guidance:
|
|
569
|
-
directories: [.claude/guidance]
|
|
570
|
-
namespace: guidance
|
|
571
|
-
|
|
572
|
-
code_map:
|
|
573
|
-
directories: [src, packages]
|
|
574
|
-
extensions: [".ts", ".tsx"]
|
|
575
|
-
exclude: [node_modules, dist]
|
|
576
|
-
namespace: code-map
|
|
577
|
-
|
|
578
|
-
tests:
|
|
579
|
-
directories: [tests, __tests__]
|
|
580
|
-
patterns: ["*.test.*", "*.spec.*", "*.test-*"]
|
|
581
|
-
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
582
|
-
exclude: [node_modules, coverage, dist]
|
|
583
|
-
namespace: tests
|
|
584
|
-
|
|
585
|
-
gates:
|
|
586
|
-
memory_first: true # Must search memory before file exploration
|
|
587
|
-
task_create_first: true # Must TaskCreate before Agent tool
|
|
588
|
-
context_tracking: true # Track context window depletion
|
|
589
|
-
|
|
590
|
-
auto_index:
|
|
591
|
-
guidance: true # Auto-index docs on session start
|
|
592
|
-
code_map: true # Auto-index code on session start
|
|
593
|
-
tests: true # Auto-index test files on session start
|
|
594
|
-
|
|
595
|
-
mcp:
|
|
596
|
-
tool_defer: true # Defer 150+ tool schemas; loaded on demand via ToolSearch
|
|
597
|
-
auto_start: false # Auto-start MCP server on session begin
|
|
598
|
-
|
|
599
|
-
hooks:
|
|
600
|
-
pre_edit: true # Track file edits for learning
|
|
601
|
-
post_edit: true # Record edit outcomes
|
|
602
|
-
pre_task: true # Agent routing before task spawn
|
|
603
|
-
post_task: true # Record task results for learning
|
|
604
|
-
gate: true # Workflow gate enforcement
|
|
605
|
-
route: true # Intelligent task routing
|
|
606
|
-
stop_hook: true # Session-end persistence
|
|
607
|
-
session_restore: true # Restore session state on start
|
|
608
|
-
|
|
609
|
-
models:
|
|
610
|
-
default: opus
|
|
611
|
-
research: sonnet
|
|
612
|
-
review: opus
|
|
613
|
-
test: sonnet
|
|
614
|
-
|
|
615
|
-
model_routing:
|
|
616
|
-
enabled: false # Set to true for automatic model selection
|
|
617
|
-
confidence_threshold: 0.85
|
|
618
|
-
cost_optimization: true
|
|
619
|
-
circuit_breaker: true
|
|
620
|
-
|
|
621
|
-
status_line:
|
|
622
|
-
enabled: true
|
|
623
|
-
branding: "MoFlo V4"
|
|
624
|
-
mode: compact # single-line, compact, or dashboard
|
|
625
|
-
show_dir: true # current directory name (compact/dashboard only)
|
|
626
|
-
show_git: true
|
|
627
|
-
show_session: true
|
|
628
|
-
show_swarm: true
|
|
629
|
-
show_agentdb: true
|
|
630
|
-
show_mcp: true
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
### Tool Deferral
|
|
634
|
-
|
|
635
|
-
By default, `tool_defer` is `true`. MoFlo exposes 150+ MCP tools — loading all their schemas at conversation start consumes significant context. With deferral enabled, only tool **names** are listed at startup (compact), and full schemas are fetched on demand via `ToolSearch` when actually needed. Hooks and CLI commands continue to work normally since they call the daemon directly, not through MCP tool schemas.
|
|
636
|
-
|
|
637
|
-
Set `tool_defer: false` if you want all tool schemas available immediately (useful for offline/air-gapped environments where `ToolSearch` may not work).
|
|
638
|
-
|
|
639
|
-
### Model Routing
|
|
640
|
-
|
|
641
|
-
By default, MoFlo uses **static model preferences** — each agent role uses the model specified in `models:`. This is predictable and gives you full control.
|
|
642
|
-
|
|
643
|
-
Set `model_routing.enabled: true` to enable **intelligent routing**, which analyzes each task's complexity and auto-selects the cheapest capable model:
|
|
644
|
-
|
|
645
|
-
| Complexity | Model | Example Tasks |
|
|
646
|
-
|-----------|-------|---------------|
|
|
647
|
-
| Low | Haiku | Typos, renames, config changes, formatting |
|
|
648
|
-
| Medium | Sonnet | Implement features, write tests, fix bugs |
|
|
649
|
-
| High | Opus | Architecture, security audits, complex debugging |
|
|
650
|
-
|
|
651
|
-
The router learns from outcomes — if a model fails a task, the circuit breaker penalizes it and escalates to a more capable model.
|
|
652
|
-
|
|
653
|
-
You can pin specific agents even when routing is enabled:
|
|
654
|
-
|
|
655
|
-
```yaml
|
|
656
|
-
model_routing:
|
|
657
|
-
enabled: true
|
|
658
|
-
agent_overrides:
|
|
659
|
-
security-architect: opus # Never downgrade security work
|
|
660
|
-
researcher: sonnet # Pin research to sonnet
|
|
661
|
-
```
|
|
662
|
-
|
|
663
|
-
## Architecture
|
|
664
|
-
|
|
665
|
-
- **7 standalone bin scripts** shipped with npm: `flo-search`, `flo-embeddings`, `flo-index`, `flo-codemap`, `flo-learn`, `flo-setup`, plus the main `flo` CLI
|
|
666
|
-
- **Project config system**: `moflo.yaml` for per-project settings
|
|
667
|
-
- **One-stop init**: `flo init` generates everything needed for OOTB operation
|
|
668
|
-
|
|
669
|
-
## Ruflo / Claude Flow
|
|
670
|
-
|
|
671
|
-
MoFlo builds on top of the full [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) engine. For detailed documentation on the underlying capabilities — swarm topologies, hive-mind consensus, HNSW vector search, neural routing, MCP server internals, and more — check out the [Ruflo repository](https://github.com/ruvnet/ruflo).
|
|
672
|
-
|
|
673
|
-
## Why I Made This
|
|
674
|
-
|
|
675
|
-
[Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) is an incredible piece of work. The engineering that [rUv](https://github.com/ruvnet) and the contributors have put into it — swarm topologies, hive-mind consensus, HNSW vector search, neural routing, and so much more — makes it one of the most comprehensive agent orchestration frameworks available. It's a massive, versatile toolbox built to support a wide range of scenarios: distributed systems, multi-agent swarms, enterprise orchestration, research workflows, and beyond.
|
|
676
|
-
|
|
677
|
-
My use case was just one of those many scenarios: day-to-day local coding, enhancing my normal Claude Code experience on a single project. Claude Flow absolutely supports this — it's all in there — but because the project serves so many different needs, I found myself spending time configuring and tailoring things for my specific workflow each time I pulled in updates. That's not a shortcoming of the project; it's the natural trade-off of a tool designed to be that flexible and powerful.
|
|
678
|
-
|
|
679
|
-
So I forked the excellent foundation and narrowed the focus to my particular corner of it. I baked in the defaults I kept setting manually, added automatic indexing and memory gating at session start, and tuned the out-of-box experience so that `npm install` and `flo init` gets you straight to coding.
|
|
680
|
-
|
|
681
|
-
If you're exploring the full breadth of what agent orchestration can do, go use [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) directly — it's the real deal. But if your needs are similar to mine — a focused, opinionated local dev setup that just works — then hopefully MoFlo saves you the same configuration time it saves me.
|
|
682
|
-
|
|
683
|
-
## License
|
|
684
|
-
|
|
685
|
-
MIT (inherited from [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo))
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/eric-cielo/moflo/main/docs/Moflo_md.png?v=6" alt="MoFlo" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# MoFlo
|
|
6
|
+
|
|
7
|
+
**An opinionated fork of [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo), optimized for local development.**
|
|
8
|
+
|
|
9
|
+
## TL;DR
|
|
10
|
+
|
|
11
|
+
MoFlo makes your AI coding assistant remember what it learns, check what it knows before exploring files, and get smarter over time — all automatically. Install it, run `flo init`, restart your AI client, and everything just works: your docs and code are indexed on session start so the AI can search them instantly, workflow gates prevent the AI from wasting tokens on blind exploration, task outcomes feed back into routing so it picks the right agent type next time, and context depletion warnings tell you when to start a fresh session. No configuration, no API keys, no cloud services — it all runs locally on your machine.
|
|
12
|
+
|
|
13
|
+
## Opinionated Defaults
|
|
14
|
+
|
|
15
|
+
MoFlo makes deliberate choices so you don't have to:
|
|
16
|
+
|
|
17
|
+
- **Fully self-contained** — No external services, no cloud dependencies, no API keys. Everything runs locally on your machine.
|
|
18
|
+
- **Node.js runtime** — Targets Node.js specifically. All scripts, hooks, and tooling are JavaScript/TypeScript. No Python, no Rust binaries, no native compilation.
|
|
19
|
+
- **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.
|
|
20
|
+
- **Simplified embeddings pipeline** — 384-dimensional neural embeddings via Transformers.js (MiniLM-L6-v2, WASM). Same model and precision as the upstream multi-provider pipeline, but simpler — two scripts instead of an abstraction layer. Runs locally, no API calls.
|
|
21
|
+
- **Full learning stack wired up OOTB** — The following are all configured and functional from `flo init`, no manual setup:
|
|
22
|
+
- **SONA** (Self-Optimizing Neural Architecture) — learns from task trajectories via `@ruvector/sona` (Rust/NAPI)
|
|
23
|
+
- **MicroLoRA** — rank-2 LoRA weight adaptations at ~1µs per adapt via `@ruvector/learning-wasm` (WASM)
|
|
24
|
+
- **EWC++** (Elastic Weight Consolidation) — prevents catastrophic forgetting across sessions
|
|
25
|
+
- **HNSW Vector Search** — fast nearest-neighbor search via `@ruvector/core` VectorDb
|
|
26
|
+
- **Semantic Routing** — maps tasks to agents via `@ruvector/router` SemanticRouter
|
|
27
|
+
- **Trajectory Persistence** — outcomes stored in `routing-outcomes.json`, survive across sessions
|
|
28
|
+
- All WASM/NAPI-based, no GPU, no API keys, no external services.
|
|
29
|
+
- **Memory-first workflow** — Claude must search what it already knows before exploring files. Enforced by hooks, not just instructions.
|
|
30
|
+
- **Task registration before agents** — Sub-agents can't spawn until work is tracked. Prevents runaway agent proliferation.
|
|
31
|
+
- **Learned routing** — Task outcomes feed back into the routing system automatically. No manual configuration needed — it gets smarter with use.
|
|
32
|
+
- **Incremental indexing** — Guidance and code map indexes run on every session start but skip unchanged files. Fast after the first run.
|
|
33
|
+
- **Built for Claude Code, works with others** — We develop and test exclusively with Claude Code. The MCP tools, memory system, and hooks are client-independent and should work with any MCP-capable AI client, but Claude Code is the only tested target.
|
|
34
|
+
- **GitHub-oriented** — The `/flo` skill, PR workflows, and issue tracking are built around GitHub. With Claude's help, you can adapt them to your own issue tracker and source control system.
|
|
35
|
+
- **Cross-platform** — Forward-slash path normalization, no `sh -c` shell commands, `windowsHide` on all spawn calls.
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
| Feature | What It Does |
|
|
40
|
+
|---------|-------------|
|
|
41
|
+
| **Semantic Memory** | 384-dim domain-aware embeddings. Store knowledge, search it instantly. |
|
|
42
|
+
| **Code Navigation** | Indexes your codebase structure so Claude can answer "where does X live?" without Glob/Grep. |
|
|
43
|
+
| **Guidance Indexing** | Chunks your project docs (`.claude/guidance/`, `docs/`) and makes them searchable. |
|
|
44
|
+
| **Workflow Gates** | Enforces memory-first and task-creation patterns via Claude Code hooks. Prevents Claude from skipping steps. |
|
|
45
|
+
| **Learned Routing** | Routes tasks to the right agent type. Learns from outcomes — gets better over time. |
|
|
46
|
+
| **`/flo` Skill** | Execute GitHub issues through a full workflow: research → enhance → implement → test → simplify → PR. (Also available as `/fl`.) |
|
|
47
|
+
| **Context Tracking** | Monitors context window usage (FRESH → MODERATE → DEPLETED → CRITICAL) and advises accordingly. |
|
|
48
|
+
| **Cross-Platform** | Works on macOS, Linux, and Windows. |
|
|
49
|
+
|
|
50
|
+
## Getting Started
|
|
51
|
+
|
|
52
|
+
### 1. Install and init
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install --save-dev moflo
|
|
56
|
+
npx flo init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`flo init` automatically scans your project to find where your guidance, code, and tests live, then writes the results into `moflo.yaml`. It looks for:
|
|
60
|
+
|
|
61
|
+
| What | Directories it checks | Default if none found |
|
|
62
|
+
|------|----------------------|----------------------|
|
|
63
|
+
| **Guidance** | `.claude/guidance`, `docs/guides`, `docs`, `architecture`, `adr`, `.cursor/rules` | `.claude/guidance` |
|
|
64
|
+
| **Source code** | `src`, `packages`, `lib`, `app`, `apps`, `services`, `server`, `client` | `src` |
|
|
65
|
+
| **Tests** | `tests`, `test`, `__tests__`, `spec`, `e2e`, plus `__tests__` dirs inside `src/` | `tests` |
|
|
66
|
+
| **Languages** | Scans detected source dirs for file extensions | `.ts`, `.tsx`, `.js`, `.jsx` |
|
|
67
|
+
|
|
68
|
+
It also generates:
|
|
69
|
+
|
|
70
|
+
| Generated File | Purpose |
|
|
71
|
+
|----------------|---------|
|
|
72
|
+
| `moflo.yaml` | Project config with detected guidance/code locations |
|
|
73
|
+
| `.claude/settings.json` | Workflow gate hooks for Claude Code |
|
|
74
|
+
| `.claude/skills/flo/` | The `/flo` issue execution skill (also `/fl`) |
|
|
75
|
+
| `CLAUDE.md` section | Teaches Claude how to use MoFlo |
|
|
76
|
+
| `.gitignore` entries | Excludes MoFlo state directories |
|
|
77
|
+
|
|
78
|
+
In interactive mode (`flo init` without `--yes`), it shows what it found and lets you confirm or adjust before writing.
|
|
79
|
+
|
|
80
|
+
#### Migrating from Claude Flow / Ruflo
|
|
81
|
+
|
|
82
|
+
If `flo init` detects an existing `.claude/settings.json` or `.claude-flow/` directory (from a prior Claude Flow or Ruflo installation), it treats the project as already initialized and runs in **update mode** — merging MoFlo's hooks and configuration into your existing setup without overwriting your data. Specifically:
|
|
83
|
+
|
|
84
|
+
- **Hooks** — If your `.claude/settings.json` already has MoFlo-style gate hooks (`flo gate`), the hooks step is skipped. Otherwise, MoFlo's hooks are written into the file (existing non-MoFlo hooks are not removed).
|
|
85
|
+
- **MCP servers** — MoFlo registers itself as the `moflo` server in `.mcp.json`. If you had `claude-flow` or `ruflo` MCP servers configured previously, those entries remain untouched — you can remove them manually once you've verified MoFlo is working. The `flo doctor` command checks for the `moflo` server specifically.
|
|
86
|
+
- **Config files** — `moflo.yaml`, `CLAUDE.md`, and `.claude/skills/flo/` follow the same skip-if-exists logic. Use `--force` to regenerate them.
|
|
87
|
+
|
|
88
|
+
To force a clean re-initialization over an existing setup:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx flo init --force
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Review your guidance and code settings
|
|
95
|
+
|
|
96
|
+
Open `moflo.yaml` to see what init detected. The two key sections:
|
|
97
|
+
|
|
98
|
+
**Guidance** — documentation that helps Claude understand your project (conventions, architecture, domain context):
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
guidance:
|
|
102
|
+
directories:
|
|
103
|
+
- .claude/guidance # project rules, patterns, conventions
|
|
104
|
+
- docs # general documentation
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Code map** — source files to index for "where does X live?" navigation:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
code_map:
|
|
111
|
+
directories:
|
|
112
|
+
- src # your source code
|
|
113
|
+
- packages # shared packages (monorepo)
|
|
114
|
+
extensions: [".ts", ".tsx"]
|
|
115
|
+
exclude: [node_modules, dist, .next, coverage]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Tests** — test files to index for "what tests cover X?" reverse mapping:
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
tests:
|
|
122
|
+
directories:
|
|
123
|
+
- tests # your test files
|
|
124
|
+
- __tests__ # jest-style test dirs
|
|
125
|
+
patterns: ["*.test.*", "*.spec.*", "*.test-*"]
|
|
126
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
127
|
+
exclude: [node_modules, coverage, dist]
|
|
128
|
+
namespace: tests
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
MoFlo chunks your guidance files into semantic embeddings, indexes your code structure, and maps test files back to their source targets — so Claude searches your knowledge base before touching any files. Adjust these directories to match your project:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
# Monorepo with shared docs
|
|
135
|
+
guidance:
|
|
136
|
+
directories: [.claude/guidance, docs, packages/shared/docs]
|
|
137
|
+
code_map:
|
|
138
|
+
directories: [packages, apps, libs]
|
|
139
|
+
|
|
140
|
+
# Backend + frontend
|
|
141
|
+
code_map:
|
|
142
|
+
directories: [server/src, client/src]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 3. Index and verify
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npx flo memory index-guidance # Index your guidance docs
|
|
149
|
+
npx flo memory code-map # Index your code structure
|
|
150
|
+
npx flo doctor # Verify everything works
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Both indexes run automatically at session start after this, so you only need to run them manually on first setup or after major structural changes. To reindex everything at once:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npx flo memory refresh # Reindex all content, rebuild embeddings, cleanup, vacuum
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Auto-Indexing
|
|
160
|
+
|
|
161
|
+
MoFlo automatically indexes three types of content on every session start, so your AI assistant always has up-to-date knowledge without manual intervention.
|
|
162
|
+
|
|
163
|
+
### What gets indexed
|
|
164
|
+
|
|
165
|
+
| Index | Content | What it produces | Namespace |
|
|
166
|
+
|-------|---------|------------------|-----------|
|
|
167
|
+
| **Guidance** | Markdown files in your guidance directories (`.claude/guidance/`, `docs/`, etc.) | Chunked text with 384-dim semantic embeddings — enables natural-language search across your project documentation | `guidance` |
|
|
168
|
+
| **Code map** | Source files in your code directories (`src/`, `packages/`, etc.) | Structural index of exports, classes, functions, and types — enables "where does X live?" navigation without Glob/Grep | `code-map` |
|
|
169
|
+
| **Tests** | Test files matching configured patterns (`*.test.*`, `*.spec.*`) | Reverse mapping from test files to their source targets — enables "what tests cover X?" lookups | `tests` |
|
|
170
|
+
|
|
171
|
+
### How it works
|
|
172
|
+
|
|
173
|
+
1. **Session start hook** — When your AI client starts a new session, MoFlo's `SessionStart` hook launches three indexers in parallel as background processes.
|
|
174
|
+
2. **Incremental** — Each indexer tracks file modification times. Only files that changed since the last index run are re-processed. The first run takes longer; subsequent runs typically finish in under a second.
|
|
175
|
+
3. **Embedding generation** — Guidance chunks are embedded using MiniLM-L6-v2 (384 dimensions, WASM). These vectors are stored in the SQLite memory database and used for semantic search.
|
|
176
|
+
4. **No blocking** — The indexers run in the background and don't block your session from starting. You can begin working immediately.
|
|
177
|
+
|
|
178
|
+
### Configuration
|
|
179
|
+
|
|
180
|
+
Each indexer can be toggled independently in `moflo.yaml`:
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
auto_index:
|
|
184
|
+
guidance: true # Index docs on session start
|
|
185
|
+
code_map: true # Index code structure on session start
|
|
186
|
+
tests: true # Index test files on session start
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Set any to `false` to disable that indexer. The underlying data remains in memory — you just stop refreshing it automatically. You can still run indexers manually:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npx flo memory index-guidance # Manual guidance reindex
|
|
193
|
+
npx flo memory code-map # Manual code map reindex
|
|
194
|
+
npx flo memory refresh # Reindex everything + rebuild embeddings + vacuum
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Why this matters
|
|
198
|
+
|
|
199
|
+
Without auto-indexing, your AI assistant starts every session with a blank slate — it doesn't know what documentation exists, where code lives, or what tests cover which files. It resorts to Glob/Grep exploration, which burns tokens and context window on rediscovery.
|
|
200
|
+
|
|
201
|
+
With auto-indexing, the AI can search semantically ("how does auth work?") and get relevant documentation chunks ranked by similarity, or ask "where is the user model defined?" and get a direct answer from the code map — all without touching the filesystem.
|
|
202
|
+
|
|
203
|
+
## The Gate System
|
|
204
|
+
|
|
205
|
+
MoFlo installs Claude Code hooks that run on every tool call. Together, these gates create a **feedback loop** that prevents Claude from wasting tokens on blind exploration and ensures it builds on prior knowledge.
|
|
206
|
+
|
|
207
|
+
### Gates explained
|
|
208
|
+
|
|
209
|
+
| Gate | What it enforces | When it triggers | Why it matters |
|
|
210
|
+
|------|-----------------|------------------|----------------|
|
|
211
|
+
| **Memory-first** | Claude must search the memory database before using Glob, Grep, or Read on guidance files | Before every Glob/Grep call, and before Read calls targeting `.claude/guidance/` | Prevents the AI from re-exploring files it (or a previous session) already indexed. Forces it to check what it knows first, saving tokens and context window. |
|
|
212
|
+
| **TaskCreate-first** | Claude must call TaskCreate before spawning sub-agents via the Task tool | Before every Task (agent spawn) call | Ensures every piece of delegated work is tracked. Prevents runaway agent proliferation where Claude spawns agents without a clear plan. |
|
|
213
|
+
| **Context tracking** | Tracks conversation length and warns about context depletion | On every user prompt (UserPromptSubmit hook) | As conversations grow, AI quality degrades. MoFlo tracks interaction count and assigns a bracket (FRESH → MODERATE → DEPLETED → CRITICAL), advising Claude to checkpoint progress or start a fresh session before quality drops. |
|
|
214
|
+
| **Routing** | Analyzes each prompt and recommends the optimal agent type and model tier | On every user prompt (UserPromptSubmit hook) | Saves cost by suggesting haiku for simple tasks, sonnet for moderate ones, opus for complex reasoning — without you having to think about model selection. |
|
|
215
|
+
|
|
216
|
+
### Smart classification
|
|
217
|
+
|
|
218
|
+
The memory-first gate doesn't blindly block every request. It classifies each prompt:
|
|
219
|
+
|
|
220
|
+
- **Simple directives** (e.g., "commit", "yes", "continue", "looks good") — skip the gate entirely, no memory search required
|
|
221
|
+
- **Task-oriented prompts** (e.g., "fix the auth bug", "add pagination to the API") — gate enforced, must search memory first
|
|
222
|
+
|
|
223
|
+
### Disabling gates
|
|
224
|
+
|
|
225
|
+
All gates are configurable in `moflo.yaml`:
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
gates:
|
|
229
|
+
memory_first: true # Set to false to disable memory-first enforcement
|
|
230
|
+
task_create_first: true # Set to false to disable TaskCreate enforcement
|
|
231
|
+
context_tracking: true # Set to false to disable context bracket warnings
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
You can also disable individual hooks in `.claude/settings.json` by removing the corresponding hook entries.
|
|
235
|
+
|
|
236
|
+
## The `/flo` Skill
|
|
237
|
+
|
|
238
|
+
Inside your AI client, the `/flo` (or `/fl`) slash command drives GitHub issue workflows:
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
/flo <issue> # Full workflow (research → implement → test → PR)
|
|
242
|
+
/flo -t <issue> # Ticket only (research and update ticket, then stop)
|
|
243
|
+
/flo -r <issue> # Research only (analyze issue, output findings)
|
|
244
|
+
/flo -s <issue> # Swarm mode (multi-agent coordination)
|
|
245
|
+
/flo -h <issue> # Hive-mind mode (consensus-based coordination)
|
|
246
|
+
/flo -n <issue> # Normal mode (default, single agent, no swarm)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
For full options and details, type `/flo` with no arguments — your AI client will display the complete skill documentation. Also available as `/fl`.
|
|
250
|
+
|
|
251
|
+
### Epic handling
|
|
252
|
+
|
|
253
|
+
When you pass an issue number, `/flo` automatically checks if it's an epic — no extra flag needed. An issue is treated as an epic if any of these are true:
|
|
254
|
+
|
|
255
|
+
- It has a label matching `epic`, `tracking`, `parent`, or `umbrella` (case-insensitive)
|
|
256
|
+
- Its body contains a `## Stories` or `## Tasks` section
|
|
257
|
+
- Its body has checklist-linked issues: `- [ ] #101`
|
|
258
|
+
- Its body has numbered issue references: `1. #101`
|
|
259
|
+
- The issue has GitHub sub-issues (via the API)
|
|
260
|
+
|
|
261
|
+
When an epic is detected, `/flo` processes each child story sequentially — full workflow per story (research → implement → test → PR), one at a time, in the order listed.
|
|
262
|
+
|
|
263
|
+
For simple epics with independent stories, `/flo <epic>` is all you need. For complex features where you want state tracking, resume capability, and auto-merge between stories, use `flo orc` instead.
|
|
264
|
+
|
|
265
|
+
### Feature Orchestration (`flo orc`)
|
|
266
|
+
|
|
267
|
+
`flo orc` is the robust epic runner — it adds persistent state, resume from failure, and auto-merge between stories on top of `/flo`. It accepts either a GitHub issue number or a YAML file:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# From a GitHub epic (auto-detects stories)
|
|
271
|
+
flo orc run 42 # Fetch epic #42, run all stories sequentially
|
|
272
|
+
flo orc run 42 --dry-run # Preview execution plan without running
|
|
273
|
+
flo orc run 42 --no-merge # Skip auto-merge between stories
|
|
274
|
+
|
|
275
|
+
# From a YAML definition (explicit dependencies)
|
|
276
|
+
flo orc run feature.yaml # Execute stories in dependency order
|
|
277
|
+
flo orc run feature.yaml --dry-run # Show execution plan
|
|
278
|
+
flo orc run feature.yaml --verbose # Stream Claude output to terminal
|
|
279
|
+
|
|
280
|
+
# State management
|
|
281
|
+
flo orc status epic-42 # Check progress (which stories passed/failed)
|
|
282
|
+
flo orc reset epic-42 # Reset state for re-run
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
When given an issue number, `flo orc` fetches the epic from GitHub, extracts child stories from checklists and numbered references, then runs each through `/flo` with state tracking. If a story fails, you can fix the issue and `flo orc run 42` again — it resumes from where it left off, skipping already-passed stories.
|
|
286
|
+
|
|
287
|
+
For features with inter-story dependencies (story B requires story A to be merged first), use a YAML definition:
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
feature:
|
|
291
|
+
id: my-feature
|
|
292
|
+
name: "My Feature"
|
|
293
|
+
repository: /path/to/project
|
|
294
|
+
base_branch: main
|
|
295
|
+
|
|
296
|
+
stories:
|
|
297
|
+
- id: story-1
|
|
298
|
+
name: "Entity and service"
|
|
299
|
+
issue: 101
|
|
300
|
+
|
|
301
|
+
- id: story-2
|
|
302
|
+
name: "Routes and tests"
|
|
303
|
+
issue: 102
|
|
304
|
+
depends_on: [story-1]
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| | `/flo <epic>` | `flo orc run <epic>` |
|
|
308
|
+
|---|---|---|
|
|
309
|
+
| **State tracking** | No | Yes (`.claude-orc/state.json`) |
|
|
310
|
+
| **Resume from failure** | No | Yes (skips passed stories) |
|
|
311
|
+
| **Auto-merge PRs** | No | Yes (between stories) |
|
|
312
|
+
| **Dry-run preview** | No | Yes |
|
|
313
|
+
| **Dependency ordering** | No (top-to-bottom) | Yes (YAML only, topological sort) |
|
|
314
|
+
|
|
315
|
+
## Commands
|
|
316
|
+
|
|
317
|
+
You don't need to run these for normal use — `flo init` sets everything up, and the hooks handle memory, routing, and learning automatically. These commands are here for manual setup, debugging, and tweaking.
|
|
318
|
+
|
|
319
|
+
### Memory
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
flo memory store -k "key" --value "data" # Store with 384-dim embedding
|
|
323
|
+
flo memory search -q "auth patterns" # Semantic search
|
|
324
|
+
flo memory index-guidance # Index guidance docs
|
|
325
|
+
flo memory code-map # Index code structure
|
|
326
|
+
flo memory rebuild-index # Regenerate all embeddings
|
|
327
|
+
flo memory refresh # Reindex all + rebuild + cleanup + vacuum
|
|
328
|
+
flo memory stats # Show statistics
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Routing & Learning
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
flo hooks route --task "description" # Route task to optimal agent
|
|
335
|
+
flo hooks learn --pattern "..." --domain "." # Store a pattern
|
|
336
|
+
flo hooks patterns # List learned patterns
|
|
337
|
+
flo hooks consolidate # Promote/prune patterns
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Workflow Gates
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
flo gate check-before-scan # Blocks Glob/Grep if memory not searched
|
|
344
|
+
flo gate check-before-agent # Blocks Agent tool if no TaskCreate
|
|
345
|
+
flo gate prompt-reminder # Context bracket tracking
|
|
346
|
+
flo gate session-reset # Reset workflow state
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Diagnostics
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
flo doctor # Quick health check (environment, deps, config)
|
|
353
|
+
flo doctor --fix # Auto-fix issues (memory DB, daemon, config, MCP, zombies)
|
|
354
|
+
flo diagnose # Full integration test (memory, swarm, hive, hooks, neural)
|
|
355
|
+
flo diagnose --suite memory # Run only memory tests
|
|
356
|
+
flo diagnose --json # JSON output for CI/automation
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### `flo doctor` — Health Check
|
|
360
|
+
|
|
361
|
+
`flo doctor` runs 16 parallel health checks against your environment and reports pass/warn/fail for each:
|
|
362
|
+
|
|
363
|
+
| Check | What it verifies |
|
|
364
|
+
|-------|-----------------|
|
|
365
|
+
| **Version Freshness** | Whether your installed MoFlo version matches the latest on npm (detects stale npx cache) |
|
|
366
|
+
| **Node.js Version** | Node.js >= 20 installed |
|
|
367
|
+
| **npm Version** | npm >= 9 installed |
|
|
368
|
+
| **Claude Code CLI** | `claude` command available |
|
|
369
|
+
| **Git** | Git installed and project is a git repository |
|
|
370
|
+
| **Config File** | Valid `moflo.yaml` or `.claude-flow/config.yaml` exists |
|
|
371
|
+
| **Daemon Status** | Background daemon running (checks PID, cleans stale locks) |
|
|
372
|
+
| **Memory Database** | SQLite memory DB exists and is accessible |
|
|
373
|
+
| **Embeddings** | Vectors indexed in memory DB, HNSW index present |
|
|
374
|
+
| **Test Directories** | Test dirs from `moflo.yaml` exist on disk, reports auto-index status |
|
|
375
|
+
| **MCP Servers** | `moflo` MCP server configured in `.mcp.json` |
|
|
376
|
+
| **Disk Space** | Sufficient free disk space (warns at 80%, fails at 90%) |
|
|
377
|
+
| **TypeScript** | TypeScript compiler available |
|
|
378
|
+
| **agentic-flow** | Optional agentic-flow package installed (for enhanced embeddings/routing) |
|
|
379
|
+
| **Zombie Processes** | No orphaned MoFlo node processes running |
|
|
380
|
+
|
|
381
|
+
**Auto-fix mode** (`flo doctor --fix`) attempts to repair each failing check automatically:
|
|
382
|
+
|
|
383
|
+
| Issue | What `--fix` does |
|
|
384
|
+
|-------|------------------|
|
|
385
|
+
| Missing memory database | Creates `.swarm/` directory and initializes the SQLite DB |
|
|
386
|
+
| Embeddings not initialized | Initializes memory DB and runs `embeddings init` |
|
|
387
|
+
| Missing config file | Runs `config init` to generate defaults |
|
|
388
|
+
| Stale daemon lock | Removes stale `.claude-flow/daemon.lock` and restarts daemon |
|
|
389
|
+
| MCP server not configured | Runs `claude mcp add moflo` to register the server |
|
|
390
|
+
| Claude Code CLI missing | Installs `@anthropic-ai/claude-code` globally |
|
|
391
|
+
| Zombie processes | Kills orphaned MoFlo processes (tracked + OS-level scan) |
|
|
392
|
+
|
|
393
|
+
After auto-fixing, doctor re-runs all checks and shows the updated results. Issues that can't be fixed automatically are listed with manual fix commands.
|
|
394
|
+
|
|
395
|
+
Additional flags:
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
flo doctor --install # Auto-install missing Claude Code CLI
|
|
399
|
+
flo doctor --kill-zombies # Find and kill orphaned MoFlo processes
|
|
400
|
+
flo doctor -c memory # Check only a specific component
|
|
401
|
+
flo doctor -c embeddings # Check only embeddings health
|
|
402
|
+
flo doctor --verbose # Verbose output
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
#### `flo diagnose` — Integration Tests
|
|
406
|
+
|
|
407
|
+
While `doctor` checks your environment, `diagnose` exercises every subsystem end-to-end: memory CRUD, embedding generation, semantic search, swarm lifecycle, hive-mind consensus, task management, hooks, config, neural patterns, and init idempotency. All test data is cleaned up after each test — nothing is left behind.
|
|
408
|
+
|
|
409
|
+
### GitHub Repository Setup
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
flo github setup # One-shot: generate CI + apply repo settings + branch protection
|
|
413
|
+
flo github setup --dry-run # Preview everything without making changes
|
|
414
|
+
flo github ci # Generate .github/workflows/ci.yml from project config
|
|
415
|
+
flo github ci --dry-run # Print workflow to stdout
|
|
416
|
+
flo github settings # Apply repo settings + branch protection via gh CLI
|
|
417
|
+
flo github settings --dry-run # Preview settings changes
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
`flo github ci` auto-detects your package manager (npm/pnpm/yarn/bun), TypeScript, and test directories from `moflo.yaml` and `package.json`, then generates a CI workflow with install, build, lint, type-check, and test steps.
|
|
421
|
+
|
|
422
|
+
`flo github settings` applies recommended defaults via `gh` CLI: delete-branch-on-merge, squash merge with PR title/body, auto-merge, linear history, and configurable branch protection (required reviews, dismiss stale reviews, block force pushes). Requires `gh auth login`.
|
|
423
|
+
|
|
424
|
+
### System
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
flo init # Initialize project (one-time setup)
|
|
428
|
+
flo --version # Show version
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## What Ships Out of the Box
|
|
432
|
+
|
|
433
|
+
`flo init` wires up the following systems automatically. Here's what each one does, why it matters, and whether it's enabled by default.
|
|
434
|
+
|
|
435
|
+
### Hooks (enabled OOTB)
|
|
436
|
+
|
|
437
|
+
Hooks are shell commands that Claude Code runs automatically at specific points in its workflow. MoFlo installs 14 hooks across 7 lifecycle events. You don't invoke these — they fire automatically.
|
|
438
|
+
|
|
439
|
+
| Hook Event | What fires | What it does | Enabled OOTB |
|
|
440
|
+
|------------|-----------|-------------|:---:|
|
|
441
|
+
| **PreToolUse: Write/Edit** | `flo hooks pre-edit` | Records which file is about to be edited, captures before-state for learning | Yes |
|
|
442
|
+
| **PreToolUse: Glob/Grep** | `flo gate check-before-scan` | Memory-first gate — blocks file exploration until memory is searched | Yes |
|
|
443
|
+
| **PreToolUse: Read** | `flo gate check-before-read` | Blocks reading guidance files directly until memory is searched | Yes |
|
|
444
|
+
| **PreToolUse: Task** | `flo gate check-before-agent` + `flo hooks pre-task` | TaskCreate gate + routing recommendation before agent spawn | Yes |
|
|
445
|
+
| **PreToolUse: Bash** | `flo gate check-dangerous-command` | Safety check on shell commands | Yes |
|
|
446
|
+
| **PostToolUse: Write/Edit** | `flo hooks post-edit` | Records edit outcome, optionally trains neural patterns | Yes |
|
|
447
|
+
| **PostToolUse: Task** | `flo hooks post-task` | Records task completion, feeds outcome into routing learner | Yes |
|
|
448
|
+
| **PostToolUse: TaskCreate** | `flo gate record-task-created` | Records that a task was registered (clears TaskCreate gate) | Yes |
|
|
449
|
+
| **PostToolUse: Bash** | `flo gate check-bash-memory` | Detects memory search commands in Bash (clears memory gate) | Yes |
|
|
450
|
+
| **PostToolUse: memory_search** | `flo gate record-memory-searched` | Records that memory was searched (clears memory-first gate) | Yes |
|
|
451
|
+
| **UserPromptSubmit** | `flo gate prompt-reminder` + `flo hooks route` | Resets per-prompt gate state, tracks context bracket, routes task to agent | Yes |
|
|
452
|
+
| **SessionStart** | `session-start-launcher.mjs` | Launches auto-indexers (guidance, code map, tests), restores session state | Yes |
|
|
453
|
+
| **Stop** | `flo hooks session-end` | Persists session metrics, exports learning data | Yes |
|
|
454
|
+
| **PreCompact** | `flo gate compact-guidance` | Injects guidance summary before context compaction | Yes |
|
|
455
|
+
| **Notification** | `flo hooks notification` | Routes Claude Code notifications through MoFlo | Yes |
|
|
456
|
+
|
|
457
|
+
### Systems (enabled OOTB)
|
|
458
|
+
|
|
459
|
+
These are the backend systems that hooks and commands interact with.
|
|
460
|
+
|
|
461
|
+
| System | What It Does | Why It Matters | Enabled OOTB |
|
|
462
|
+
|--------|-------------|----------------|:---:|
|
|
463
|
+
| **Semantic Memory** | SQLite database (sql.js/WASM) storing knowledge entries with 384-dim vector embeddings | Your AI assistant accumulates project knowledge across sessions instead of starting from scratch each time | Yes |
|
|
464
|
+
| **HNSW Vector Search** | Hierarchical Navigable Small World index for fast nearest-neighbor search | Searches across thousands of stored entries return in milliseconds instead of scanning linearly | Yes |
|
|
465
|
+
| **Guidance Indexing** | Chunks markdown docs into overlapping segments, embeds each with MiniLM-L6-v2 | Your project documentation becomes searchable by meaning ("how does auth work?") not just keywords | Yes |
|
|
466
|
+
| **Code Map** | Parses source files for exports, classes, functions, types | The AI can answer "where is X defined?" from the index instead of running Glob/Grep | Yes |
|
|
467
|
+
| **Test Indexing** | Maps test files to their source targets based on naming patterns | The AI can answer "what tests cover X?" and identify untested code | Yes |
|
|
468
|
+
| **Workflow Gates** | Hook-based enforcement of memory-first and task-registration patterns | Prevents the AI from wasting tokens on blind exploration and untracked agent spawns | Yes |
|
|
469
|
+
| **Context Tracking** | Interaction counter with bracket classification (FRESH/MODERATE/DEPLETED/CRITICAL) | Warns before context quality degrades, suggests when to checkpoint or start fresh | Yes |
|
|
470
|
+
| **Semantic Routing** | Matches task descriptions to agent types using vector similarity against 12 built-in patterns | Routes work to the right specialist (security-architect, tester, coder, etc.) automatically | Yes |
|
|
471
|
+
| **Learned Routing** | Records task outcomes (agent type + success/failure) and feeds them back into routing | Routing gets smarter over time — successful patterns are weighted higher in future recommendations | Yes |
|
|
472
|
+
| **SONA Learning** | Self-Optimizing Neural Architecture that learns from task trajectories | Adapts routing weights based on actual outcomes, not just keyword matching | Yes |
|
|
473
|
+
| **MicroLoRA Adaptation** | Rank-2 LoRA weight updates from successful patterns (~1µs per adapt) | Fine-grained model adaptation without full retraining | Yes |
|
|
474
|
+
| **EWC++ Consolidation** | Elastic Weight Consolidation that prevents catastrophic forgetting | New learning doesn't overwrite patterns from earlier sessions | Yes |
|
|
475
|
+
| **Session Persistence** | Stop hook exports session metrics; SessionStart hook restores prior state | Patterns learned on Monday are available on Friday | Yes |
|
|
476
|
+
| **Status Line** | Live dashboard showing git branch, session state, memory stats, MCP status | At-a-glance visibility into what MoFlo is doing | Yes |
|
|
477
|
+
| **MCP Tool Server** | 150+ MCP tools for memory, hooks, coordination, etc. (schemas deferred by default) | Enables AI clients to interact with MoFlo programmatically | Yes (deferred) |
|
|
478
|
+
|
|
479
|
+
### Systems (available but off by default)
|
|
480
|
+
|
|
481
|
+
| System | What It Does | How to Enable |
|
|
482
|
+
|--------|-------------|---------------|
|
|
483
|
+
| **Model Routing** | Auto-selects haiku/sonnet/opus per task based on complexity analysis | `model_routing.enabled: true` in `moflo.yaml` |
|
|
484
|
+
| **MCP Auto-Start** | Starts MCP server automatically on session begin | `mcp.auto_start: true` in `moflo.yaml` |
|
|
485
|
+
| **Tool Schema Eager Loading** | Loads all 150+ MCP tool schemas at startup (instead of on-demand) | `mcp.tool_defer: false` in `moflo.yaml` |
|
|
486
|
+
|
|
487
|
+
## The Two-Layer Task System
|
|
488
|
+
|
|
489
|
+
MoFlo doesn't replace your AI client's task system — it wraps it. Your client (Claude Code, Cursor, or any MCP-capable tool) handles spawning agents and running code. MoFlo adds a coordination layer on top that handles memory, routing, and learning.
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
┌──────────────────────────────────────────────────┐
|
|
493
|
+
│ YOUR AI CLIENT (Execution Layer) │
|
|
494
|
+
│ Spawns agents, runs code, streams output │
|
|
495
|
+
│ TaskCreate → Agent → TaskUpdate → results │
|
|
496
|
+
├──────────────────────────────────────────────────┤
|
|
497
|
+
│ MOFLO (Knowledge Layer) │
|
|
498
|
+
│ Routes tasks, gates agent spawns, stores │
|
|
499
|
+
│ patterns, learns from outcomes │
|
|
500
|
+
└──────────────────────────────────────────────────┘
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
Here's how a typical task flows through both layers:
|
|
504
|
+
|
|
505
|
+
1. **MoFlo routes** — Before work starts, MoFlo analyzes the prompt and recommends an agent type and model tier via hook or MCP tool.
|
|
506
|
+
2. **MoFlo gates** — Before an agent can spawn, MoFlo verifies that memory was searched and a task was registered. This prevents blind exploration.
|
|
507
|
+
3. **Your client executes** — The actual agent runs through your client's native task system. MoFlo doesn't manage the agent — your client handles execution, output, and completion.
|
|
508
|
+
4. **MoFlo learns** — After the agent finishes, MoFlo records what worked (or didn't) in its memory database. Successful patterns feed into future routing.
|
|
509
|
+
|
|
510
|
+
The key insight: **your client handles execution, MoFlo handles knowledge.** Your client is good at spawning agents and running code. MoFlo is good at remembering what happened, routing to the right agent, and ensuring prior knowledge is checked before exploring from scratch.
|
|
511
|
+
|
|
512
|
+
For complex work, MoFlo structures tasks into waves — a research wave discovers context, then an implementation wave acts on it — with dependencies tracked through both the client's task system and MoFlo's coordination layer. The full integration pattern is documented in `.claude/guidance/task-swarm-integration.md`.
|
|
513
|
+
|
|
514
|
+
The `/flo` skill ties both systems together for GitHub issues — driving a full workflow (research → enhance → implement → test → simplify → PR) with your client's agents for execution and MoFlo's memory for continuity.
|
|
515
|
+
|
|
516
|
+
### Intelligent Agent Routing
|
|
517
|
+
|
|
518
|
+
MoFlo ships with 12 built-in task patterns that map common work to the right agent type:
|
|
519
|
+
|
|
520
|
+
| Pattern | Keywords | Primary Agent |
|
|
521
|
+
|---------|----------|---------------|
|
|
522
|
+
| security-task | auth, password, encryption, CVE | security-architect |
|
|
523
|
+
| testing-task | test, spec, coverage, e2e | tester |
|
|
524
|
+
| database-task | schema, migration, SQL, ORM | architect |
|
|
525
|
+
| feature-task | implement, add, create, build | architect → coder |
|
|
526
|
+
| bugfix-task | bug, fix, error, crash, debug | coder |
|
|
527
|
+
| api-task | endpoint, REST, route, handler | architect → coder |
|
|
528
|
+
| ... | | *(12 patterns total)* |
|
|
529
|
+
|
|
530
|
+
When you route a task (`flo hooks route --task "..."` or via MCP), MoFlo runs semantic similarity against these patterns using HNSW vector search and returns a ranked recommendation with confidence scores.
|
|
531
|
+
|
|
532
|
+
**The routing gets smarter over time.** Every time a task completes successfully, MoFlo's post-task hook records the outcome — the full task description, which agent handled it, and whether it succeeded. These learned patterns are combined with the built-in seeds on every future route call. Because learned patterns contain rich task descriptions (not just short keywords), they discriminate better as they accumulate.
|
|
533
|
+
|
|
534
|
+
Routing outcomes are stored in `.claude-flow/routing-outcomes.json` and persist across sessions. You can inspect them with `flo hooks patterns` or transfer them between projects with `flo hooks transfer`.
|
|
535
|
+
|
|
536
|
+
### Memory & Knowledge Storage
|
|
537
|
+
|
|
538
|
+
MoFlo uses a SQLite database (via sql.js/WASM — no native deps) to store three types of knowledge:
|
|
539
|
+
|
|
540
|
+
| Namespace | What's Stored | How It Gets There |
|
|
541
|
+
|-----------|---------------|-------------------|
|
|
542
|
+
| `guidance` | Chunked project docs (`.claude/guidance/`, `docs/`) with 384-dim embeddings | `flo-index` on session start |
|
|
543
|
+
| `code-map` | Structural index of source files (exports, classes, functions) | `flo-codemap` on session start |
|
|
544
|
+
| `patterns` | Learned patterns from successful task outcomes | Post-task hooks after agent work |
|
|
545
|
+
|
|
546
|
+
**Semantic search** uses cosine similarity on neural embeddings (MiniLM-L6-v2, 384 dimensions). When Claude searches memory, it gets the most relevant chunks ranked by semantic similarity — not keyword matching.
|
|
547
|
+
|
|
548
|
+
**Session start indexing** — Three background processes run on every session start: the guidance indexer, the code map generator, and the learning service. All three are incremental (unchanged files are skipped) and run in parallel so they don't block the session.
|
|
549
|
+
|
|
550
|
+
**Cross-session persistence** — Everything stored in the database survives across sessions. Patterns learned on Monday are available on Friday. The stop hook exports session metrics, and the session-restore hook loads prior state.
|
|
551
|
+
|
|
552
|
+
### For Claude
|
|
553
|
+
|
|
554
|
+
When `flo init` runs, it appends a workflow section to your CLAUDE.md that teaches Claude:
|
|
555
|
+
- Always search memory before Glob/Grep/Read (enforced by gates)
|
|
556
|
+
- Use `mcp__moflo__memory_search` for knowledge retrieval
|
|
557
|
+
- Use `/flo <issue>` (or `/fl`) for issue execution
|
|
558
|
+
- Store learnings after task completion
|
|
559
|
+
|
|
560
|
+
## Full Configuration Reference
|
|
561
|
+
|
|
562
|
+
`flo init` generates a `moflo.yaml` at your project root. Here's the complete set of options:
|
|
563
|
+
|
|
564
|
+
```yaml
|
|
565
|
+
project:
|
|
566
|
+
name: "my-project"
|
|
567
|
+
|
|
568
|
+
guidance:
|
|
569
|
+
directories: [.claude/guidance]
|
|
570
|
+
namespace: guidance
|
|
571
|
+
|
|
572
|
+
code_map:
|
|
573
|
+
directories: [src, packages]
|
|
574
|
+
extensions: [".ts", ".tsx"]
|
|
575
|
+
exclude: [node_modules, dist]
|
|
576
|
+
namespace: code-map
|
|
577
|
+
|
|
578
|
+
tests:
|
|
579
|
+
directories: [tests, __tests__]
|
|
580
|
+
patterns: ["*.test.*", "*.spec.*", "*.test-*"]
|
|
581
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"]
|
|
582
|
+
exclude: [node_modules, coverage, dist]
|
|
583
|
+
namespace: tests
|
|
584
|
+
|
|
585
|
+
gates:
|
|
586
|
+
memory_first: true # Must search memory before file exploration
|
|
587
|
+
task_create_first: true # Must TaskCreate before Agent tool
|
|
588
|
+
context_tracking: true # Track context window depletion
|
|
589
|
+
|
|
590
|
+
auto_index:
|
|
591
|
+
guidance: true # Auto-index docs on session start
|
|
592
|
+
code_map: true # Auto-index code on session start
|
|
593
|
+
tests: true # Auto-index test files on session start
|
|
594
|
+
|
|
595
|
+
mcp:
|
|
596
|
+
tool_defer: true # Defer 150+ tool schemas; loaded on demand via ToolSearch
|
|
597
|
+
auto_start: false # Auto-start MCP server on session begin
|
|
598
|
+
|
|
599
|
+
hooks:
|
|
600
|
+
pre_edit: true # Track file edits for learning
|
|
601
|
+
post_edit: true # Record edit outcomes
|
|
602
|
+
pre_task: true # Agent routing before task spawn
|
|
603
|
+
post_task: true # Record task results for learning
|
|
604
|
+
gate: true # Workflow gate enforcement
|
|
605
|
+
route: true # Intelligent task routing
|
|
606
|
+
stop_hook: true # Session-end persistence
|
|
607
|
+
session_restore: true # Restore session state on start
|
|
608
|
+
|
|
609
|
+
models:
|
|
610
|
+
default: opus
|
|
611
|
+
research: sonnet
|
|
612
|
+
review: opus
|
|
613
|
+
test: sonnet
|
|
614
|
+
|
|
615
|
+
model_routing:
|
|
616
|
+
enabled: false # Set to true for automatic model selection
|
|
617
|
+
confidence_threshold: 0.85
|
|
618
|
+
cost_optimization: true
|
|
619
|
+
circuit_breaker: true
|
|
620
|
+
|
|
621
|
+
status_line:
|
|
622
|
+
enabled: true
|
|
623
|
+
branding: "MoFlo V4"
|
|
624
|
+
mode: compact # single-line, compact, or dashboard
|
|
625
|
+
show_dir: true # current directory name (compact/dashboard only)
|
|
626
|
+
show_git: true
|
|
627
|
+
show_session: true
|
|
628
|
+
show_swarm: true
|
|
629
|
+
show_agentdb: true
|
|
630
|
+
show_mcp: true
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### Tool Deferral
|
|
634
|
+
|
|
635
|
+
By default, `tool_defer` is `true`. MoFlo exposes 150+ MCP tools — loading all their schemas at conversation start consumes significant context. With deferral enabled, only tool **names** are listed at startup (compact), and full schemas are fetched on demand via `ToolSearch` when actually needed. Hooks and CLI commands continue to work normally since they call the daemon directly, not through MCP tool schemas.
|
|
636
|
+
|
|
637
|
+
Set `tool_defer: false` if you want all tool schemas available immediately (useful for offline/air-gapped environments where `ToolSearch` may not work).
|
|
638
|
+
|
|
639
|
+
### Model Routing
|
|
640
|
+
|
|
641
|
+
By default, MoFlo uses **static model preferences** — each agent role uses the model specified in `models:`. This is predictable and gives you full control.
|
|
642
|
+
|
|
643
|
+
Set `model_routing.enabled: true` to enable **intelligent routing**, which analyzes each task's complexity and auto-selects the cheapest capable model:
|
|
644
|
+
|
|
645
|
+
| Complexity | Model | Example Tasks |
|
|
646
|
+
|-----------|-------|---------------|
|
|
647
|
+
| Low | Haiku | Typos, renames, config changes, formatting |
|
|
648
|
+
| Medium | Sonnet | Implement features, write tests, fix bugs |
|
|
649
|
+
| High | Opus | Architecture, security audits, complex debugging |
|
|
650
|
+
|
|
651
|
+
The router learns from outcomes — if a model fails a task, the circuit breaker penalizes it and escalates to a more capable model.
|
|
652
|
+
|
|
653
|
+
You can pin specific agents even when routing is enabled:
|
|
654
|
+
|
|
655
|
+
```yaml
|
|
656
|
+
model_routing:
|
|
657
|
+
enabled: true
|
|
658
|
+
agent_overrides:
|
|
659
|
+
security-architect: opus # Never downgrade security work
|
|
660
|
+
researcher: sonnet # Pin research to sonnet
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
## Architecture
|
|
664
|
+
|
|
665
|
+
- **7 standalone bin scripts** shipped with npm: `flo-search`, `flo-embeddings`, `flo-index`, `flo-codemap`, `flo-learn`, `flo-setup`, plus the main `flo` CLI
|
|
666
|
+
- **Project config system**: `moflo.yaml` for per-project settings
|
|
667
|
+
- **One-stop init**: `flo init` generates everything needed for OOTB operation
|
|
668
|
+
|
|
669
|
+
## Ruflo / Claude Flow
|
|
670
|
+
|
|
671
|
+
MoFlo builds on top of the full [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) engine. For detailed documentation on the underlying capabilities — swarm topologies, hive-mind consensus, HNSW vector search, neural routing, MCP server internals, and more — check out the [Ruflo repository](https://github.com/ruvnet/ruflo).
|
|
672
|
+
|
|
673
|
+
## Why I Made This
|
|
674
|
+
|
|
675
|
+
[Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) is an incredible piece of work. The engineering that [rUv](https://github.com/ruvnet) and the contributors have put into it — swarm topologies, hive-mind consensus, HNSW vector search, neural routing, and so much more — makes it one of the most comprehensive agent orchestration frameworks available. It's a massive, versatile toolbox built to support a wide range of scenarios: distributed systems, multi-agent swarms, enterprise orchestration, research workflows, and beyond.
|
|
676
|
+
|
|
677
|
+
My use case was just one of those many scenarios: day-to-day local coding, enhancing my normal Claude Code experience on a single project. Claude Flow absolutely supports this — it's all in there — but because the project serves so many different needs, I found myself spending time configuring and tailoring things for my specific workflow each time I pulled in updates. That's not a shortcoming of the project; it's the natural trade-off of a tool designed to be that flexible and powerful.
|
|
678
|
+
|
|
679
|
+
So I forked the excellent foundation and narrowed the focus to my particular corner of it. I baked in the defaults I kept setting manually, added automatic indexing and memory gating at session start, and tuned the out-of-box experience so that `npm install` and `flo init` gets you straight to coding.
|
|
680
|
+
|
|
681
|
+
If you're exploring the full breadth of what agent orchestration can do, go use [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo) directly — it's the real deal. But if your needs are similar to mine — a focused, opinionated local dev setup that just works — then hopefully MoFlo saves you the same configuration time it saves me.
|
|
682
|
+
|
|
683
|
+
## License
|
|
684
|
+
|
|
685
|
+
MIT (inherited from [Ruflo/Claude Flow](https://github.com/ruvnet/ruflo))
|