moflo 4.9.20 → 4.9.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/analysis/analyze-code-quality.md +0 -121
- package/.claude/agents/analysis/code-analyzer.md +5 -26
- package/.claude/agents/architecture/system-design/arch-system-design.md +0 -119
- package/.claude/agents/base-template-generator.md +0 -1
- package/.claude/agents/core/coder.md +0 -22
- package/.claude/agents/core/planner.md +0 -16
- package/.claude/agents/core/researcher.md +0 -16
- package/.claude/agents/core/reviewer.md +0 -17
- package/.claude/agents/core/tester.md +0 -19
- package/.claude/agents/custom/test-long-runner.md +0 -2
- package/.claude/agents/development/dev-backend-api.md +0 -167
- package/.claude/agents/development/dev-database.md +43 -0
- package/.claude/agents/development/dev-frontend.md +42 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +0 -112
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +0 -111
- package/.claude/agents/security/security-auditor.md +45 -0
- package/.claude/guidance/shipped/moflo-agent-rules.md +172 -0
- package/.claude/guidance/shipped/moflo-claude-swarm-cohesion.md +73 -265
- package/.claude/guidance/shipped/moflo-cli-reference.md +6 -6
- package/.claude/guidance/shipped/moflo-core-guidance.md +66 -184
- package/.claude/guidance/shipped/moflo-cross-platform.md +1 -1
- package/.claude/guidance/shipped/moflo-error-handling.md +3 -3
- package/.claude/guidance/shipped/moflo-guidance-rules.md +17 -7
- package/.claude/guidance/shipped/moflo-memory-strategy.md +76 -182
- package/.claude/guidance/shipped/moflo-memorydb-maintenance.md +6 -8
- package/.claude/guidance/shipped/moflo-settings-injection.md +7 -9
- package/.claude/guidance/shipped/moflo-source-hygiene.md +5 -5
- package/.claude/guidance/shipped/moflo-spell-connectors.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-custom-steps.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-engine.md +40 -162
- package/.claude/guidance/shipped/moflo-spell-runner.md +134 -0
- package/.claude/guidance/shipped/moflo-spell-sandboxing.md +10 -57
- package/.claude/guidance/shipped/moflo-spell-troubleshooting.md +149 -0
- package/.claude/guidance/shipped/moflo-subagents.md +43 -114
- package/.claude/guidance/shipped/moflo-task-icons.md +4 -4
- package/.claude/guidance/shipped/moflo-user-facing-language.md +3 -3
- package/.claude/guidance/shipped/moflo-verbose-command-filtering.md +3 -3
- package/.claude/guidance/shipped/moflo-yaml-reference.md +4 -5
- package/.claude/helpers/gate.cjs +192 -15
- package/.claude/helpers/prompt-hook.mjs +4 -38
- package/.claude/helpers/simplify-classify.cjs +32 -11
- package/.claude/helpers/subagent-bootstrap.json +1 -1
- package/.claude/helpers/subagent-start.cjs +1 -1
- package/.claude/skills/connector-builder/SKILL.md +42 -429
- package/.claude/skills/connector-builder/templates/connector.md +189 -0
- package/.claude/skills/connector-builder/templates/step-command.md +176 -0
- package/.claude/skills/eldar/SKILL.md +7 -7
- package/.claude/skills/fl/SKILL.md +3 -3
- package/.claude/skills/fl/execution-modes.md +39 -16
- package/.claude/skills/fl/phases.md +3 -3
- package/.claude/skills/{simplify → flo-simplify}/SKILL.md +11 -11
- package/.claude/skills/guidance/SKILL.md +17 -9
- package/.claude/skills/memory-patterns/SKILL.md +1 -1
- package/.claude/skills/publish/SKILL.md +121 -36
- package/.claude/skills/reset-epic/SKILL.md +2 -2
- package/.claude/skills/spell-builder/SKILL.md +39 -226
- package/.claude/skills/spell-builder/architecture.md +1 -1
- package/.claude/skills/spell-builder/permissions.md +107 -0
- package/.claude/skills/spell-builder/preflight.md +101 -0
- package/.claude/skills/spell-schedule/SKILL.md +2 -3
- package/bin/gate.cjs +192 -15
- package/bin/lib/retired-files.mjs +146 -0
- package/bin/prompt-hook.mjs +4 -38
- package/bin/session-start-launcher.mjs +120 -1
- package/bin/setup-project.mjs +63 -69
- package/bin/simplify-classify.cjs +32 -11
- package/dist/src/cli/appliance/rvfa-builder.js +1 -1
- package/dist/src/cli/commands/agent.js +3 -9
- package/dist/src/cli/commands/doctor-checks-deep.js +4 -0
- package/dist/src/cli/commands/hooks.js +1 -3
- package/dist/src/cli/commands/index.js +2 -0
- package/dist/src/cli/commands/retire.js +111 -0
- package/dist/src/cli/hooks/reasoningbank/index.js +7 -7
- package/dist/src/cli/init/claudemd-generator.js +30 -33
- package/dist/src/cli/init/executor.js +53 -69
- package/dist/src/cli/init/helpers-generator.js +165 -52
- package/dist/src/cli/init/moflo-init.js +41 -114
- package/dist/src/cli/init/settings-generator.js +44 -14
- package/dist/src/cli/mcp-tools/agent-tools.js +9 -27
- package/dist/src/cli/mcp-tools/hooks-tools.js +23 -21
- package/dist/src/cli/memory/controllers/semantic-router.js +18 -12
- package/dist/src/cli/memory/sona-optimizer.js +6 -6
- package/dist/src/cli/neural/domain/services/learning-service.js +3 -3
- package/dist/src/cli/services/agent-router.js +2 -5
- package/dist/src/cli/services/hook-block-hash.js +11 -2
- package/dist/src/cli/services/hook-wiring.js +86 -3
- package/dist/src/cli/services/subagent-bootstrap.js +1 -1
- package/dist/src/cli/shared/events/example-usage.js +6 -6
- package/dist/src/cli/shared/hooks/task-hooks.js +8 -8
- package/dist/src/cli/version.js +1 -1
- package/package.json +3 -2
- package/retired-files.json +1989 -0
- package/scripts/post-install-bootstrap.mjs +19 -0
- package/src/cli/data/model-registry.json +2 -2
- package/.claude/agents/consensus/byzantine-coordinator.md +0 -63
- package/.claude/agents/consensus/crdt-synchronizer.md +0 -997
- package/.claude/agents/consensus/gossip-coordinator.md +0 -63
- package/.claude/agents/consensus/performance-benchmarker.md +0 -851
- package/.claude/agents/consensus/quorum-manager.md +0 -823
- package/.claude/agents/consensus/raft-manager.md +0 -63
- package/.claude/agents/consensus/security-manager.md +0 -622
- package/.claude/agents/data/ml/data-ml-model.md +0 -193
- package/.claude/agents/github/code-review-swarm.md +0 -538
- package/.claude/agents/github/github-modes.md +0 -172
- package/.claude/agents/github/issue-tracker.md +0 -311
- package/.claude/agents/github/multi-repo-swarm.md +0 -551
- package/.claude/agents/github/pr-manager.md +0 -183
- package/.claude/agents/github/project-board-sync.md +0 -508
- package/.claude/agents/github/release-manager.md +0 -360
- package/.claude/agents/github/release-swarm.md +0 -580
- package/.claude/agents/github/repo-architect.md +0 -391
- package/.claude/agents/github/swarm-issue.md +0 -566
- package/.claude/agents/github/swarm-pr.md +0 -414
- package/.claude/agents/github/sync-coordinator.md +0 -426
- package/.claude/agents/github/workflow-automation.md +0 -606
- package/.claude/agents/goal/code-goal-planner.md +0 -440
- package/.claude/agents/goal/goal-planner.md +0 -168
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -127
- package/.claude/agents/hive-mind/queen-coordinator.md +0 -198
- package/.claude/agents/hive-mind/scout-explorer.md +0 -233
- package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -184
- package/.claude/agents/hive-mind/worker-specialist.md +0 -208
- package/.claude/agents/neural/safla-neural.md +0 -73
- package/.claude/agents/optimization/benchmark-suite.md +0 -665
- package/.claude/agents/optimization/load-balancer.md +0 -431
- package/.claude/agents/optimization/performance-monitor.md +0 -672
- package/.claude/agents/optimization/resource-allocator.md +0 -674
- package/.claude/agents/optimization/topology-optimizer.md +0 -808
- package/.claude/agents/reasoning/goal-planner.md +0 -67
- package/.claude/agents/sona/sona-learning-optimizer.md +0 -74
- package/.claude/agents/sparc/architecture.md +0 -472
- package/.claude/agents/sparc/pseudocode.md +0 -318
- package/.claude/agents/sparc/refinement.md +0 -525
- package/.claude/agents/sparc/specification.md +0 -276
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -225
- package/.claude/agents/swarm/adaptive-coordinator.md +0 -391
- package/.claude/agents/swarm/hierarchical-coordinator.md +0 -321
- package/.claude/agents/swarm/mesh-coordinator.md +0 -383
- package/.claude/agents/testing/production-validator.md +0 -395
- package/.claude/agents/testing/tdd-london-swarm.md +0 -244
- package/.claude/agents/v3/adr-architect.md +0 -184
- package/.claude/agents/v3/aidefence-guardian.md +0 -277
- package/.claude/agents/v3/claims-authorizer.md +0 -208
- package/.claude/agents/v3/collective-intelligence-coordinator.md +0 -988
- package/.claude/agents/v3/ddd-domain-expert.md +0 -220
- package/.claude/agents/v3/injection-analyst.md +0 -232
- package/.claude/agents/v3/memory-specialist.md +0 -987
- package/.claude/agents/v3/performance-engineer.md +0 -1225
- package/.claude/agents/v3/pii-detector.md +0 -146
- package/.claude/agents/v3/reasoningbank-learner.md +0 -213
- package/.claude/agents/v3/security-architect-aidefence.md +0 -405
- package/.claude/agents/v3/security-architect.md +0 -865
- package/.claude/agents/v3/security-auditor.md +0 -771
- package/.claude/agents/v3/sparc-orchestrator.md +0 -182
- package/.claude/agents/v3/swarm-memory-manager.md +0 -142
- package/.claude/agents/v3/v3-integration-architect.md +0 -205
- package/.claude/commands/claude-flow-help.md +0 -103
- package/.claude/commands/claude-flow-memory.md +0 -107
- package/.claude/commands/claude-flow-swarm.md +0 -205
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/github/code-review-swarm.md +0 -514
- package/.claude/commands/github/code-review.md +0 -25
- package/.claude/commands/github/github-modes.md +0 -146
- package/.claude/commands/github/github-swarm.md +0 -113
- package/.claude/commands/github/issue-tracker.md +0 -284
- package/.claude/commands/github/issue-triage.md +0 -25
- package/.claude/commands/github/multi-repo-swarm.md +0 -519
- package/.claude/commands/github/pr-enhance.md +0 -26
- package/.claude/commands/github/pr-manager.md +0 -164
- package/.claude/commands/github/project-board-sync.md +0 -471
- package/.claude/commands/github/release-manager.md +0 -332
- package/.claude/commands/github/release-swarm.md +0 -544
- package/.claude/commands/github/repo-analyze.md +0 -25
- package/.claude/commands/github/repo-architect.md +0 -361
- package/.claude/commands/github/swarm-issue.md +0 -482
- package/.claude/commands/github/swarm-pr.md +0 -285
- package/.claude/commands/github/sync-coordinator.md +0 -294
- package/.claude/commands/github/workflow-automation.md +0 -442
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/hooks/overview.md +0 -58
- package/.claude/commands/hooks/post-edit.md +0 -117
- package/.claude/commands/hooks/post-task.md +0 -112
- package/.claude/commands/hooks/pre-edit.md +0 -113
- package/.claude/commands/hooks/pre-task.md +0 -111
- package/.claude/commands/hooks/session-end.md +0 -118
- package/.claude/commands/hooks/setup.md +0 -103
- package/.claude/commands/simplify.md +0 -101
- package/.claude/commands/sparc/analyzer.md +0 -42
- package/.claude/commands/sparc/architect.md +0 -43
- package/.claude/commands/sparc/ask.md +0 -86
- package/.claude/commands/sparc/batch-executor.md +0 -44
- package/.claude/commands/sparc/code.md +0 -78
- package/.claude/commands/sparc/coder.md +0 -44
- package/.claude/commands/sparc/debug.md +0 -72
- package/.claude/commands/sparc/debugger.md +0 -44
- package/.claude/commands/sparc/designer.md +0 -43
- package/.claude/commands/sparc/devops.md +0 -98
- package/.claude/commands/sparc/docs-writer.md +0 -69
- package/.claude/commands/sparc/documenter.md +0 -44
- package/.claude/commands/sparc/innovator.md +0 -44
- package/.claude/commands/sparc/integration.md +0 -72
- package/.claude/commands/sparc/mcp.md +0 -106
- package/.claude/commands/sparc/memory-manager.md +0 -44
- package/.claude/commands/sparc/optimizer.md +0 -44
- package/.claude/commands/sparc/orchestrator.md +0 -116
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -72
- package/.claude/commands/sparc/refinement-optimization-mode.md +0 -72
- package/.claude/commands/sparc/researcher.md +0 -44
- package/.claude/commands/sparc/reviewer.md +0 -44
- package/.claude/commands/sparc/security-review.md +0 -69
- package/.claude/commands/sparc/sparc-modes.md +0 -139
- package/.claude/commands/sparc/sparc.md +0 -99
- package/.claude/commands/sparc/spec-pseudocode.md +0 -69
- package/.claude/commands/sparc/spell-manager.md +0 -44
- package/.claude/commands/sparc/supabase-admin.md +0 -337
- package/.claude/commands/sparc/swarm-coordinator.md +0 -44
- package/.claude/commands/sparc/tdd.md +0 -44
- package/.claude/commands/sparc/tester.md +0 -44
- package/.claude/commands/sparc/tutorial.md +0 -68
- package/.claude/commands/sparc.md +0 -151
- package/.claude/guidance/shipped/moflo-session-start.md +0 -154
- package/.claude/guidance/shipped/moflo-spell-engine-architecture.md +0 -145
- package/.claude/skills/browser/SKILL.md +0 -204
- package/.claude/skills/github-code-review/SKILL.md +0 -1140
- package/.claude/skills/github-multi-repo/SKILL.md +0 -866
- package/.claude/skills/github-project-management/SKILL.md +0 -1272
- package/.claude/skills/github-release-management/SKILL.md +0 -1074
- package/.claude/skills/github-workflow-automation/SKILL.md +0 -1060
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
- package/.claude/skills/hooks-automation/SKILL.md +0 -1193
- package/.claude/skills/pair-programming/SKILL.md +0 -1202
- package/.claude/skills/performance-analysis/SKILL.md +0 -563
- package/.claude/skills/skill-builder/SKILL.md +0 -910
- package/.claude/skills/sparc-methodology/SKILL.md +0 -904
- package/.claude/skills/stream-chain/SKILL.md +0 -563
- package/.claude/skills/swarm-advanced/SKILL.md +0 -811
- package/.claude/skills/swarm-orchestration/SKILL.md +0 -179
- package/.claude/skills/verification-quality/SKILL.md +0 -649
- package/.claude/skills/worker-benchmarks/skill.md +0 -135
- package/.claude/skills/worker-integration/skill.md +0 -154
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# MoFlo Session-Start Lifecycle
|
|
2
|
-
|
|
3
|
-
**Purpose:** Document everything that runs when Claude Code fires the `SessionStart` hook in a moflo-enabled project. The launcher does substantially more than "start the daemon" — it heals stale state, migrates DBs, syncs scripts, and reconciles hook wiring. Knowing what runs (and in what order) makes diagnosis fast.
|
|
4
|
-
|
|
5
|
-
**Audience:** Agents and developers diagnosing slow session starts, unexpected mutations to `.claude/`, embedded migrations, daemon recycling, and post-upgrade behaviour.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Quick reference
|
|
10
|
-
|
|
11
|
-
The launcher (`bin/session-start-launcher.mjs`, synced to `.claude/scripts/session-start-launcher.mjs`) is the single SessionStart hook moflo registers. Everything below runs in one process, in the listed order, before Claude Code begins the session. Total cost on a healthy install with no version change is typically < 200 ms; an upgrade or DB heal can extend it to several seconds.
|
|
12
|
-
|
|
13
|
-
When anything runs, the launcher prints `moflo: <action> (<details>)` to stdout. Claude Code captures stdout as session-start `additionalContext`, so the agent sees every mutation. Failures land on stderr and similarly surface.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Stages, in execution order
|
|
18
|
-
|
|
19
|
-
### 0. Headless skip
|
|
20
|
-
|
|
21
|
-
If `CLAUDE_CODE_HEADLESS=true` is set in the environment, the launcher exits immediately. The moflo daemon spawns headless Claude processes (for indexing, pretraining, etc.); without this guard each spawned Claude would re-enter the launcher and fork the indexer chain on every daemon worker tick. ([#860](https://github.com/eric-cielo/moflo/issues/860).)
|
|
22
|
-
|
|
23
|
-
### 0-pre. Drop stale upgrade-notice files
|
|
24
|
-
|
|
25
|
-
`.moflo/upgrade-notice.json` is a transient handshake between launcher and statusline. Pre-#738 launchers wrote a 1-hour-TTL "complete" notice that could survive past the launcher run that wrote it. The launcher unconditionally removes any leftover before its own run begins.
|
|
26
|
-
|
|
27
|
-
### 0c. Memory DB index repair
|
|
28
|
-
|
|
29
|
-
Probes `.moflo/moflo.db` for `sqlite_autoindex_memory_entries_1` corruption and runs `REINDEX` in place if found. Must run before any sql.js consumer (embeddings migration, ephemeral-namespace purge, MCP server, daemon) — those swallow corruption errors and silently drop work otherwise. Cost on the happy path: one PRAGMA check (~10 ms). ([#743](https://github.com/eric-cielo/moflo/issues/743).)
|
|
30
|
-
|
|
31
|
-
### 0d. Clear post-install restart notice
|
|
32
|
-
|
|
33
|
-
If `.moflo/restart-pending.json` was written by `scripts/post-install-notice.mjs` after the last `npm install moflo` and the running version now matches the pending version, the file is removed. The user has restarted; the notice has done its job. ([#867](https://github.com/eric-cielo/moflo/issues/867).)
|
|
34
|
-
|
|
35
|
-
### 2. Reset workflow state
|
|
36
|
-
|
|
37
|
-
Writes a fresh `.claude/workflow-state.json` for the new session: `tasksCreated: false`, `memorySearched: false`, `sessionStart: <ISO timestamp>`. The gate scripts read this on every tool call.
|
|
38
|
-
|
|
39
|
-
### 3. Auto-sync on version change (or drift)
|
|
40
|
-
|
|
41
|
-
This is the biggest stage. It fires when **either** condition is true:
|
|
42
|
-
|
|
43
|
-
- The installed version (`node_modules/moflo/package.json`) differs from the cached version stamp (`.moflo/moflo-version`), OR
|
|
44
|
-
- Any file in `.moflo/installed-files.json` (the manifest from the previous successful sync) is missing or has drifted in size since we last wrote it.
|
|
45
|
-
|
|
46
|
-
When triggered, the launcher walks the following sub-steps in order:
|
|
47
|
-
|
|
48
|
-
| Sub-step | What runs | Why |
|
|
49
|
-
|---------|-----------|-----|
|
|
50
|
-
| Stop daemon | Kills the daemon recorded in `.moflo/daemon.lock` | The daemon was started under the previous moflo image; old module-cache + path resolution would clobber the upgrade. ([#851](https://github.com/eric-cielo/moflo/issues/851).) |
|
|
51
|
-
| Cherry-pick learnings | `cherry-pick-learnings.js` reads legacy `.swarm/memory.db` and `INSERT OR IGNORE`s into `.moflo/moflo.db` | Carries user-authored knowledge forward across the v3 DB rename. Idempotent. |
|
|
52
|
-
| Sync scripts | Copy `bin/*.mjs` and `bin/lib/**` and `bin/migrations/**` into `.claude/scripts/` | Hooks always run the latest version |
|
|
53
|
-
| Sync helpers | Copy `bin/{gate.cjs,gate-hook.mjs,prompt-hook.mjs,hook-handler.cjs}` plus `.claude/helpers/{auto-memory-hook.mjs,statusline.cjs,...}` into `.claude/helpers/` | Same |
|
|
54
|
-
| Sync shipped guidance | Copy every `node_modules/moflo/.claude/guidance/shipped/moflo-*.md` into `.claude/guidance/`, prefixing each with the auto-generated mirror header | These are the files indexed by the consumer's memory namespace |
|
|
55
|
-
| Cleanup retired files | Anything in the OLD manifest but NOT in the new manifest is unlinked | Auto-removes files moflo no longer ships |
|
|
56
|
-
| Per-file retry/circuit | Each copy retries `[50, 200, 800] ms` on `EBUSY`/`EPERM`/`EACCES` (Windows file lock, AV scan); after 5 distinct failures the circuit opens and the rest of the sync runs without retries | Prevents a sick host from compounding wall-clock cost; persistent failures land on stderr |
|
|
57
|
-
| Manifest write | New `{path, size}` manifest committed to `.moflo/installed-files.json` | Drift detection on next launcher run |
|
|
58
|
-
| Defer version stamp | Pending write of `.moflo/moflo-version` queued for stage 3g | Stamp is "launcher fully completed" — writing it mid-flight strands consumers on a half-applied upgrade ([#730](https://github.com/eric-cielo/moflo/issues/730)) |
|
|
59
|
-
|
|
60
|
-
### 3a-pre. Recycle stale daemons
|
|
61
|
-
|
|
62
|
-
Even when the version hasn't changed, the daemon-lock's `startedAt` is compared against `node_modules/moflo`'s install mtime. If the daemon predates the current install (with a 5 s skew margin), it's recycled. This catches the "user upgraded ages ago, ran one session that bumped the stamp + recycled the daemon, but the daemon they started long-ago is still alive holding stale module cache" failure mode.
|
|
63
|
-
|
|
64
|
-
### 3a. Settings.json migration and self-heal
|
|
65
|
-
|
|
66
|
-
See `moflo-settings-injection.md` for the full mechanism. The launcher applies, in order:
|
|
67
|
-
|
|
68
|
-
1. **Drop stale `PATH` override** — pre-4.x settings injected `${PATH}` which Claude Code didn't expand, breaking node resolution.
|
|
69
|
-
2. **Replace `npx flo` hook commands with direct `node "$CLAUDE_PROJECT_DIR/..."` invocations** — saves 2–5 s of `npx` cold-start per hook.
|
|
70
|
-
3. **Ensure `statusLine` is wired** — the helper script is synced by stage 3 but the config block may be absent.
|
|
71
|
-
4. **Repair + rewrite hook wirings** — `repairHookWiring()` adds missing required hooks; `rewriteIncorrectHookWiring()` rewrites known-stale hook commands (e.g. [#879](https://github.com/eric-cielo/moflo/issues/879) `gate.cjs record-memory-searched` → `gate-hook.mjs record-memory-searched`).
|
|
72
|
-
|
|
73
|
-
### 3b. Restore + prune shipped guidance mirrors
|
|
74
|
-
|
|
75
|
-
Even when stage 3 didn't fire (no version change, no drift), the launcher checks that every `moflo-*.md` from `node_modules/moflo/.claude/guidance/shipped/` exists at `.claude/guidance/<file>` with the auto-generated mirror header. Missing files are restored; mirror files whose source has been removed (and which still carry the `<!-- AUTO-GENERATED by moflo session-start.` marker) are pruned. ([#839](https://github.com/eric-cielo/moflo/issues/839).)
|
|
76
|
-
|
|
77
|
-
### 3b-714, 3c. Legacy cleanup
|
|
78
|
-
|
|
79
|
-
- `.swarm/vector-stats.json` (replaced by `.moflo/vector-stats.json` post-#699) is unlinked.
|
|
80
|
-
- Pre-4.8.45 double-prefixed guidance files (`moflo-moflo-*.md`) are unlinked.
|
|
81
|
-
|
|
82
|
-
### 3d-yaml. Append missing top-level sections to `moflo.yaml`
|
|
83
|
-
|
|
84
|
-
`bin/lib/yaml-upgrader.mjs` walks the user's `moflo.yaml` and idempotently appends any registered top-level section that's absent (e.g., `sandbox:`, `auto_update:`, `daemon:`). Never modifies user-set values; never reorders or reformats. Surfaces appended section names so the user can find what changed. (Pattern documented in `internal/upgrade-contract.md` "Yaml upgrade pattern".)
|
|
85
|
-
|
|
86
|
-
### 3d. Install global `flo` shim
|
|
87
|
-
|
|
88
|
-
Best-effort install of a shim into npm's global bin so bare `flo` resolves to the local project's `node_modules/.bin/flo`. Idempotent — skips when already present. Non-fatal on failure: `flo` still works via `npx`.
|
|
89
|
-
|
|
90
|
-
### 3e. Foreground embeddings migration
|
|
91
|
-
|
|
92
|
-
`runEmbeddingsMigrationIfNeeded` checks `.moflo/moflo.db` for embeddings-version drift and, if needed, re-embeds rows in chunks. Runs synchronously with piped stdio so the renderer's progress bar reaches the user. Returns fast (~ms) when no migration is needed.
|
|
93
|
-
|
|
94
|
-
### 3e-728, 3e-729. Hard-purge legacy memory rows
|
|
95
|
-
|
|
96
|
-
- Soft-deleted tombstones (status='deleted' rows from pre-#728 builds) are hard-deleted and the DB is VACUUMed.
|
|
97
|
-
- Ephemeral-namespace rows (`hive-mind`, `tasklist`, `epic-state`, `test-bridge-fix`) accumulated by pre-#729 builds are hard-deleted; going forward, writes to those namespaces skip embedding generation entirely.
|
|
98
|
-
|
|
99
|
-
Both run **before** the daemon is restarted in stage 4 so a concurrent sql.js flush can't clobber the foreground purge.
|
|
100
|
-
|
|
101
|
-
### 3f. Flip upgrade notice to "completed"
|
|
102
|
-
|
|
103
|
-
If stage 3 wrote an "in-progress" upgrade notice for the statusline, it's flipped to "completed" with a 2-minute TTL. The next session-start's stage 0-pre wipes any leftover.
|
|
104
|
-
|
|
105
|
-
### 3g. Commit deferred version stamp
|
|
106
|
-
|
|
107
|
-
`.moflo/moflo-version` is finally written with the installed version. Any abort above leaves the stamp unchanged so the next launcher re-detects the upgrade and re-runs stage 3. ([#730](https://github.com/eric-cielo/moflo/issues/730).)
|
|
108
|
-
|
|
109
|
-
### 4. Spawn background tasks
|
|
110
|
-
|
|
111
|
-
- `node bin/hooks.mjs session-start` is spawned detached + unref'd. That script starts the daemon, the indexer, the pretrain pass, the HNSW build, and the neural-pattern training. None of it blocks the session.
|
|
112
|
-
- Migrations (`run-migrations.mjs`) consult `.moflo/migrations.json` and run any unmigrated steps synchronously, then announce completed migrations via `moflo:` mutation lines.
|
|
113
|
-
|
|
114
|
-
### 5. Exit
|
|
115
|
-
|
|
116
|
-
`process.exit(0)`. Claude Code now begins the session with the launcher's stdout captured as additionalContext.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Diagnosing slow session starts
|
|
121
|
-
|
|
122
|
-
Bottlenecks, in rough order of likelihood:
|
|
123
|
-
|
|
124
|
-
| Symptom | Likely stage | Mitigation |
|
|
125
|
-
|---------|-------------|------------|
|
|
126
|
-
| Several-second delay on first start after `npm install` | Stage 3 (script + helper + guidance sync) | Expected — one-shot cost. Subsequent starts are ms. |
|
|
127
|
-
| 30–60 s delay on first start after a major upgrade | Stage 3e (embeddings migration) | Surfaces a progress bar via stderr; cannot be skipped. |
|
|
128
|
-
| Repeated multi-second delay on every start | Stage 3 firing every time = manifest drift loop | Check `moflo: repaired stale install` lines on stdout — usually means a file copy keeps failing (Windows AV, file lock). Run `flo doctor --fix`. |
|
|
129
|
-
| Daemon appears to restart on every start | Stage 3a-pre — daemon predates install | Expected if you just upgraded; should stop after one session. |
|
|
130
|
-
|
|
131
|
-
If a stage hangs, the launcher's per-step timeouts (5–30 s depending on the operation) protect against deadlock. A blocked stage that times out lands an error on stderr; the next launcher run retries.
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Adding a new stage (developer note)
|
|
136
|
-
|
|
137
|
-
Before adding work to the launcher, ask:
|
|
138
|
-
|
|
139
|
-
1. Is this **per-session** work (hook reset, mirror restore) or **per-version** work (script sync, manifest)? Per-version belongs in stage 3 under the version-change gate; per-session goes in stage 2 or as its own gated stage.
|
|
140
|
-
2. Does it touch `sql.js`? It must run **before** stage 4's daemon spawn — concurrent flushes from a long-lived sql.js consumer will clobber a foreground write.
|
|
141
|
-
3. Does it mutate consumer state? It must `emitMutation()` so the user sees what changed via additionalContext. Silent mutations are a regression of the upgrade contract.
|
|
142
|
-
4. Does it depend on a fresh-state invariant (e.g., daemon stopped, manifest written, version stamp committed)? Order matters — see the existing 3 → 3a → 3a-pre → ... → 3g → 4 sequence and slot in accordingly.
|
|
143
|
-
|
|
144
|
-
Full ordering rules and historical violations live in `internal/upgrade-contract.md`.
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## See Also
|
|
149
|
-
|
|
150
|
-
- `moflo-settings-injection.md` — the contract for what moflo writes into `.claude/settings.json` and how the surgical self-heal works.
|
|
151
|
-
- `moflo-core-guidance.md` (Helper Script Auto-Sync) — the file lists for stage 3.
|
|
152
|
-
- `moflo-memorydb-maintenance.md` — what runs against `.moflo/moflo.db` (embeddings, soft-delete, ephemeral purge).
|
|
153
|
-
- Internal-only: `internal/upgrade-contract.md` — the "user must never re-run init" invariant the launcher enforces, with historical violations to learn from.
|
|
154
|
-
- Internal-only: `internal/guidance-sync.md` — Stages 3 and 3b documented end-to-end as part of the three-layer guidance sync (filesystem → DB → HNSW).
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# Spell Engine & Messaging Architecture
|
|
2
|
-
|
|
3
|
-
**Purpose:** Architectural decisions and analysis findings for Epic #100 (Generalized Spell Engine) and Epic #110 (Messaging Migration). Reference when working on stories #100-#117.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Epic #100: Generalized Spell Engine
|
|
8
|
-
|
|
9
|
-
**Ships as part of moflo** — not a separate project. Heavy deps (Playwright, isolated-vm) are optional peer dependencies, same pattern as cli's embeddings module requiring `sql.js`.
|
|
10
|
-
|
|
11
|
-
### Command Pattern for Steps
|
|
12
|
-
|
|
13
|
-
Every spell step type implements a `StepCommand` interface with `execute()`, `validate()`, `describeOutputs()`, and optional `rollback()`. Register step commands via a plugin-style `StepCommandRegistry` — follow the existing `PluginRegistry` pattern in `src/cli/plugins/`.
|
|
14
|
-
|
|
15
|
-
### Spell Definitions
|
|
16
|
-
|
|
17
|
-
Spells are YAML/JSON files in `workflows/` or `.claude/workflows/`. Each declares:
|
|
18
|
-
- `name` and `abbreviation` (short name for `/flo -wf {abbrev}`)
|
|
19
|
-
- Typed `arguments` with `required`, `default`, `enum`, `description`
|
|
20
|
-
- Ordered `steps` with `{stepId.outputKey}` variable interpolation
|
|
21
|
-
|
|
22
|
-
### MoFlo Integration Levels Per Step
|
|
23
|
-
|
|
24
|
-
| Level | Capabilities | Default For |
|
|
25
|
-
|-------|-------------|-------------|
|
|
26
|
-
| `none` | No MoFlo access | `bash`, `condition`, `wait` |
|
|
27
|
-
| `memory` | search/store/list | `agent` steps |
|
|
28
|
-
| `hooks` | Above + pre/post task hooks | — |
|
|
29
|
-
| `full` | Above + swarm/hive-mind spawning | — |
|
|
30
|
-
| `recursive` | Above + nested `/flo -wf` invocation | — |
|
|
31
|
-
|
|
32
|
-
Capabilities only narrow going deeper — a nested spell cannot escalate beyond its parent.
|
|
33
|
-
|
|
34
|
-
### Sandboxing Tiers
|
|
35
|
-
|
|
36
|
-
| Tier | Mechanism | Status |
|
|
37
|
-
|------|-----------|--------|
|
|
38
|
-
| 1 | Capability declarations + enforcement | Build first |
|
|
39
|
-
| 2 | Node `--experimental-permission` for bash steps | Build second |
|
|
40
|
-
| 3 | `isolated-vm` for expression evaluation | Build third |
|
|
41
|
-
| 4 | Linux namespaces (optional) | Defer |
|
|
42
|
-
| 5 | WASM sandbox for community commands | Defer |
|
|
43
|
-
|
|
44
|
-
### Build Order (no circular dependencies)
|
|
45
|
-
|
|
46
|
-
| Phase | Stories | Can Start |
|
|
47
|
-
|-------|---------|-----------|
|
|
48
|
-
| 1 | #101 (Interface), #103 (Schema) | Immediately |
|
|
49
|
-
| 2 | #102 (Commands), #106 (Credentials) | After Phase 1 |
|
|
50
|
-
| 3 | #104 (Runner) | After Phase 2 |
|
|
51
|
-
| 4 | #105 (Registry), #108 (Sandboxing T1-2), #107 (Playwright) | After Phase 3 |
|
|
52
|
-
| 5 | #109 (Integration Levels), #117 (Scheduling) | After Phase 4 + Epic #110 |
|
|
53
|
-
|
|
54
|
-
### Critical Findings
|
|
55
|
-
|
|
56
|
-
- **Existing `spell_execute` is a no-op placeholder.** The engine is greenfield.
|
|
57
|
-
- **`js-yaml` already a dependency** — used in `moflo-config.ts` and `epic.ts`.
|
|
58
|
-
- **Plugin registry pattern is directly reusable** for `StepCommandRegistry`.
|
|
59
|
-
- **No cron support exists** — needs `node-cron` dependency for #117.
|
|
60
|
-
- **Retry logic is consumer-side**, not bus-side. Steps implement their own retry.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Epic #110: Messaging Migration to Memory DB
|
|
65
|
-
|
|
66
|
-
**Migrate inter-agent messaging** from in-memory EventEmitter bus to memory DB namespace. The current bus only works within a single process — spawned subagents cannot participate.
|
|
67
|
-
|
|
68
|
-
### Session Isolation
|
|
69
|
-
|
|
70
|
-
All messages scoped by `sessionId`. Queries implicitly filter by current session. `endSession()` expires unhandled messages. `gc()` cleans up abandoned sessions after configurable TTL.
|
|
71
|
-
|
|
72
|
-
### Build Order
|
|
73
|
-
|
|
74
|
-
| Phase | Stories |
|
|
75
|
-
|-------|---------|
|
|
76
|
-
| 1 | #111 (Schema + CRUD) |
|
|
77
|
-
| 2 | #112 (Notification/Pub-Sub) |
|
|
78
|
-
| 3 | #113, #114, #115 (parallel) |
|
|
79
|
-
| 4 | #116 (Deprecate old bus — last) |
|
|
80
|
-
|
|
81
|
-
**Minimum viable to unblock Epic #100:** #111 + #112 only.
|
|
82
|
-
|
|
83
|
-
### Critical Findings
|
|
84
|
-
|
|
85
|
-
- **`queen-coordinator.ts` does NOT use MessageBus.** Hive-mind operates via MCP tools. Story #114 is greenfield, not migration.
|
|
86
|
-
- **`unified-coordinator.ts` is coupled to concrete `MessageBus` class**, not `IMessageBus` interface. Must refactor.
|
|
87
|
-
- **Zero existing message bus tests.** Write baseline suite first, then verify both backends pass.
|
|
88
|
-
- **Two competing Message types:** `SwarmMessage` (shared/types.ts) vs `Message` (swarm/types.ts). Story #111 must reconcile.
|
|
89
|
-
- **Memory DB supports namespaces and TTL** but needs queue semantics and metadata indexing added.
|
|
90
|
-
- **`enablePersistence` config flag exists but was never implemented** — now being properly built.
|
|
91
|
-
|
|
92
|
-
### Interface Incompatibility: Not a Clean Swap
|
|
93
|
-
|
|
94
|
-
The `MemoryDbMessageBus` adapter (~300 lines) must handle:
|
|
95
|
-
|
|
96
|
-
| Aspect | Current `IMessageBus` | New `MessageStore` |
|
|
97
|
-
|--------|----------------------|-------------------|
|
|
98
|
-
| Subscribe | Push-based callback | Pull-based `receive()` |
|
|
99
|
-
| Acknowledge | `acknowledge(ack)` | `markRead()` |
|
|
100
|
-
| Timestamps | `Date` objects | `number` (epoch ms) |
|
|
101
|
-
| Sessions | None | `sessionId` required |
|
|
102
|
-
| Channels | None (per-agent queues) | Channel-based routing |
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Epic #118: Consolidate Messaging Systems (Pre-req for #110)
|
|
107
|
-
|
|
108
|
-
**Three messaging systems → one layered broker.** Must complete before Epic #110 migration.
|
|
109
|
-
|
|
110
|
-
| Story | What | Depends On |
|
|
111
|
-
|-------|------|------------|
|
|
112
|
-
| #119 | Unified Message Type & Extended IMessageBus | — |
|
|
113
|
-
| #120 | SwarmCommunication → MessageBus consumer | #119 |
|
|
114
|
-
| #121 | Hive-Mind → MessageBus + Memory DB write-through | #119, #120 |
|
|
115
|
-
|
|
116
|
-
**Key decisions:**
|
|
117
|
-
- MessageBus keeps its Deque hot path for delivery (~1000+ msg/sec)
|
|
118
|
-
- Memory DB write-through is fire-and-forget, initially only for hive-mind namespace
|
|
119
|
-
- TTL reaper lives in the broker (60s sweep), not the daemon
|
|
120
|
-
- Daemon can do deeper GC pass but system must not depend on it
|
|
121
|
-
|
|
122
|
-
**Build order:** Epic #118 → remaining #110 stories (#111, #115, #116) → Epic #100 Phase 5.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Cross-Epic Dependencies
|
|
127
|
-
|
|
128
|
-
**Most of Epic #100 can proceed without Epic #110.** Only two things are hard-blocked:
|
|
129
|
-
|
|
130
|
-
| Blocked Story | Needs from #110 | Why |
|
|
131
|
-
|--------------|-----------------|-----|
|
|
132
|
-
| #109 `full` tier | #113 (Swarm Migration) | Swarm spawning needs DB-backed messaging |
|
|
133
|
-
| #109 `recursive` tier | #113 + #114 | Nested spells with hive-mind need consensus messaging |
|
|
134
|
-
|
|
135
|
-
Stories #101-#108, #105, #117 have no dependency on Epic #110.
|
|
136
|
-
|
|
137
|
-
**Epic #118 simplifies #110:** #112 (pub/sub) largely solved, #113 (swarm) done via #120, #114 (hive-mind) done via #121.
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## See Also
|
|
142
|
-
|
|
143
|
-
- `.claude/guidance/shipped/moflo-core-guidance.md` — CLI, hooks, swarm, memory reference
|
|
144
|
-
- `.claude/guidance/shipped/moflo-claude-swarm-cohesion.md` — Task & swarm coordination
|
|
145
|
-
- `.claude/guidance/shipped/moflo-subagents.md` — Subagents protocol
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: browser
|
|
3
|
-
description: Web browser automation with AI-optimized snapshots for claude-flow agents
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
triggers:
|
|
6
|
-
- /browser
|
|
7
|
-
- browse
|
|
8
|
-
- web automation
|
|
9
|
-
- scrape
|
|
10
|
-
- navigate
|
|
11
|
-
- screenshot
|
|
12
|
-
tools:
|
|
13
|
-
- browser/open
|
|
14
|
-
- browser/snapshot
|
|
15
|
-
- browser/click
|
|
16
|
-
- browser/fill
|
|
17
|
-
- browser/screenshot
|
|
18
|
-
- browser/close
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
# Browser Automation Skill
|
|
22
|
-
|
|
23
|
-
Web browser automation using agent-browser with AI-optimized snapshots. Reduces context by 93% using element refs (@e1, @e2) instead of full DOM.
|
|
24
|
-
|
|
25
|
-
## Core Workflow
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# 1. Navigate to page
|
|
29
|
-
agent-browser open <url>
|
|
30
|
-
|
|
31
|
-
# 2. Get accessibility tree with element refs
|
|
32
|
-
agent-browser snapshot -i # -i = interactive elements only
|
|
33
|
-
|
|
34
|
-
# 3. Interact using refs from snapshot
|
|
35
|
-
agent-browser click @e2
|
|
36
|
-
agent-browser fill @e3 "text"
|
|
37
|
-
|
|
38
|
-
# 4. Re-snapshot after page changes
|
|
39
|
-
agent-browser snapshot -i
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Quick Reference
|
|
43
|
-
|
|
44
|
-
### Navigation
|
|
45
|
-
| Command | Description |
|
|
46
|
-
|---------|-------------|
|
|
47
|
-
| `open <url>` | Navigate to URL |
|
|
48
|
-
| `back` | Go back |
|
|
49
|
-
| `forward` | Go forward |
|
|
50
|
-
| `reload` | Reload page |
|
|
51
|
-
| `close` | Close browser |
|
|
52
|
-
|
|
53
|
-
### Snapshots (AI-Optimized)
|
|
54
|
-
| Command | Description |
|
|
55
|
-
|---------|-------------|
|
|
56
|
-
| `snapshot` | Full accessibility tree |
|
|
57
|
-
| `snapshot -i` | Interactive elements only (buttons, links, inputs) |
|
|
58
|
-
| `snapshot -c` | Compact (remove empty elements) |
|
|
59
|
-
| `snapshot -d 3` | Limit depth to 3 levels |
|
|
60
|
-
| `screenshot [path]` | Capture screenshot (base64 if no path) |
|
|
61
|
-
|
|
62
|
-
### Interaction
|
|
63
|
-
| Command | Description |
|
|
64
|
-
|---------|-------------|
|
|
65
|
-
| `click <sel>` | Click element |
|
|
66
|
-
| `fill <sel> <text>` | Clear and fill input |
|
|
67
|
-
| `type <sel> <text>` | Type with key events |
|
|
68
|
-
| `press <key>` | Press key (Enter, Tab, etc.) |
|
|
69
|
-
| `hover <sel>` | Hover element |
|
|
70
|
-
| `select <sel> <val>` | Select dropdown option |
|
|
71
|
-
| `check/uncheck <sel>` | Toggle checkbox |
|
|
72
|
-
| `scroll <dir> [px]` | Scroll page |
|
|
73
|
-
|
|
74
|
-
### Get Info
|
|
75
|
-
| Command | Description |
|
|
76
|
-
|---------|-------------|
|
|
77
|
-
| `get text <sel>` | Get text content |
|
|
78
|
-
| `get html <sel>` | Get innerHTML |
|
|
79
|
-
| `get value <sel>` | Get input value |
|
|
80
|
-
| `get attr <sel> <attr>` | Get attribute |
|
|
81
|
-
| `get title` | Get page title |
|
|
82
|
-
| `get url` | Get current URL |
|
|
83
|
-
|
|
84
|
-
### Wait
|
|
85
|
-
| Command | Description |
|
|
86
|
-
|---------|-------------|
|
|
87
|
-
| `wait <selector>` | Wait for element |
|
|
88
|
-
| `wait <ms>` | Wait milliseconds |
|
|
89
|
-
| `wait --text "text"` | Wait for text |
|
|
90
|
-
| `wait --url "pattern"` | Wait for URL |
|
|
91
|
-
| `wait --load networkidle` | Wait for load state |
|
|
92
|
-
|
|
93
|
-
### Sessions
|
|
94
|
-
| Command | Description |
|
|
95
|
-
|---------|-------------|
|
|
96
|
-
| `--session <name>` | Use isolated session |
|
|
97
|
-
| `session list` | List active sessions |
|
|
98
|
-
|
|
99
|
-
## Selectors
|
|
100
|
-
|
|
101
|
-
### Element Refs (Recommended)
|
|
102
|
-
```bash
|
|
103
|
-
# Get refs from snapshot
|
|
104
|
-
agent-browser snapshot -i
|
|
105
|
-
# Output: button "Submit" [ref=e2]
|
|
106
|
-
|
|
107
|
-
# Use ref to interact
|
|
108
|
-
agent-browser click @e2
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### CSS Selectors
|
|
112
|
-
```bash
|
|
113
|
-
agent-browser click "#submit"
|
|
114
|
-
agent-browser fill ".email-input" "test@test.com"
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Semantic Locators
|
|
118
|
-
```bash
|
|
119
|
-
agent-browser find role button click --name "Submit"
|
|
120
|
-
agent-browser find label "Email" fill "test@test.com"
|
|
121
|
-
agent-browser find testid "login-btn" click
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Examples
|
|
125
|
-
|
|
126
|
-
### Login Flow
|
|
127
|
-
```bash
|
|
128
|
-
agent-browser open https://example.com/login
|
|
129
|
-
agent-browser snapshot -i
|
|
130
|
-
agent-browser fill @e2 "user@example.com"
|
|
131
|
-
agent-browser fill @e3 "password123"
|
|
132
|
-
agent-browser click @e4
|
|
133
|
-
agent-browser wait --url "**/dashboard"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Form Submission
|
|
137
|
-
```bash
|
|
138
|
-
agent-browser open https://example.com/contact
|
|
139
|
-
agent-browser snapshot -i
|
|
140
|
-
agent-browser fill @e1 "John Doe"
|
|
141
|
-
agent-browser fill @e2 "john@example.com"
|
|
142
|
-
agent-browser fill @e3 "Hello, this is my message"
|
|
143
|
-
agent-browser click @e4
|
|
144
|
-
agent-browser wait --text "Thank you"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Data Extraction
|
|
148
|
-
```bash
|
|
149
|
-
agent-browser open https://example.com/products
|
|
150
|
-
agent-browser snapshot -i
|
|
151
|
-
# Iterate through product refs
|
|
152
|
-
agent-browser get text @e1 # Product name
|
|
153
|
-
agent-browser get text @e2 # Price
|
|
154
|
-
agent-browser get attr @e3 href # Link
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Multi-Session (Swarm)
|
|
158
|
-
```bash
|
|
159
|
-
# Session 1: Navigator
|
|
160
|
-
agent-browser --session nav open https://example.com
|
|
161
|
-
agent-browser --session nav state save auth.json
|
|
162
|
-
|
|
163
|
-
# Session 2: Scraper (uses same auth)
|
|
164
|
-
agent-browser --session scrape state load auth.json
|
|
165
|
-
agent-browser --session scrape open https://example.com/data
|
|
166
|
-
agent-browser --session scrape snapshot -i
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Integration with Claude Flow
|
|
170
|
-
|
|
171
|
-
### MCP Tools
|
|
172
|
-
All browser operations are available as MCP tools with `browser/` prefix:
|
|
173
|
-
- `browser/open`
|
|
174
|
-
- `browser/snapshot`
|
|
175
|
-
- `browser/click`
|
|
176
|
-
- `browser/fill`
|
|
177
|
-
- `browser/screenshot`
|
|
178
|
-
- etc.
|
|
179
|
-
|
|
180
|
-
### Memory Integration
|
|
181
|
-
```bash
|
|
182
|
-
# Store successful patterns
|
|
183
|
-
npx moflo memory store --namespace browser-patterns --key "login-flow" --value "snapshot->fill->click->wait"
|
|
184
|
-
|
|
185
|
-
# Retrieve before similar task
|
|
186
|
-
npx moflo memory search --query "login automation"
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Hooks
|
|
190
|
-
```bash
|
|
191
|
-
# Pre-browse hook (get context)
|
|
192
|
-
npx moflo hooks pre-edit --file "browser-task.ts"
|
|
193
|
-
|
|
194
|
-
# Post-browse hook (record success)
|
|
195
|
-
npx moflo hooks post-task --task-id "browse-1" --success true
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Tips
|
|
199
|
-
|
|
200
|
-
1. **Always use snapshots** - They're optimized for AI with refs
|
|
201
|
-
2. **Prefer `-i` flag** - Gets only interactive elements, smaller output
|
|
202
|
-
3. **Use refs, not selectors** - More reliable, deterministic
|
|
203
|
-
4. **Re-snapshot after navigation** - Page state changes
|
|
204
|
-
5. **Use sessions for parallel work** - Each session is isolated
|