Page 6. Reuses harness.send and the conversation bridge's sendTo, not a second harness. Host.spawn runs only the pinned Codex 0.162.0
release (never current or PATH), read-only, from a fixed argument allow-list; Host.httpSend sends only https POST to openrouter.ai or a
convoTargets host, never follows a redirect, and a key is read by variable name and never drawn. Enter shows a card of exactly what would be
sent; a lone y answers it only while it was drawn in full (#3983); spend cap from the provider-reported cost. e2e host matrix gets a tui leg
(keyless in CI, live gated). Not in this PR: the workspace-write toggle.
Co-Authored-By: RuFlo <ruv@ruv.net>
Five pages (Overview, Cost, Swarm, Events, Missions) with keys 1-5 / o c s e m / Tab / Shift-Tab, a page bar, a key line that
shortens with the width, clear-and-redraw on resize, a position bar under 60 columns and a notice under 40. Room is left out on
purpose (a message box and Claude sessions this host does not have).
state.isStandalone is the capability flag: on this host the shared chrome is not drawn (no tab bar, footer buttons, Launch,
Ask Claude, Claude control card); a button nobody can press is not drawn, a state chip and a section title are. Missions reads
the ADR-406 record only. Under Claude Code nothing changes. Console 0.42.7.
Co-Authored-By: RuFlo <ruv@ruv.net>
- probe: a plugin set to false is reported as disabled with 'claude plugin enable', not 'ruflo mods install' (which never flips it); installed-but-not-enabled; partial install (some mod plugins, no marketplace, record drift)
- every non-passing finding carries a one-line fix; headless -p fresh-config caveat named
- doctor --strict exits 1 on a warning too
- install writes settings and record as one operation: a failing record write restores the settings
Co-Authored-By: RuFlo <ruv@ruv.net>
- E: `ruflo tui --plain` prints one plain frame and exits 0; without a TTY and
without --plain it prints a one-line hint on stderr and exits 2 (no frame).
Tests for terminal, non-terminal, --plain in a terminal, no raw mode, and
through the command with the real bundle.
- A: esbuild is a declared root devDependency (^0.27.2, already locked).
- B: v3/@claude-flow/cli/scripts/prepare-publish.mjs builds and stages
plugins/ruflo-console/dist/tui.mjs so a registry install runs `ruflo tui`.
Measured: +449,345 bytes on the CLI tarball.
- ADR-489: status Accepted; section 8 records decisions A-E (C: Swarm, Events,
Missions, Room; D: Codex read-only by default, no danger-full-access, OpenRouter
https-only to openrouter.ai + convoTargets hosts). Repairs a corrupted table row
that had pasted copies of the file head into the ADR.
- README: a short ruflo tui section.
Co-Authored-By: RuFlo <ruv@ruv.net>
#4057: with encryption at rest on, `memory purge`'s sql.js fallback rewrote a
plaintext native SQLite store as an RFE1 blob and still printed [OK]; the
native bridge and every SQLite reader then rejected the file. Every whole-file
read-modify-write (purge, delete, get access-count, store, schema migration,
decay) now writes the image back in the format it read (plaintext -> plaintext,
RFE1 -> RFE1) via writeDbImagePreservingFormat. applyTemporalDecay also read
the raw bytes, so it failed on encrypted stores, and wrote plaintext: both
fixed.
#4056: `hooks post-command` stored every Bash command in full with no off
switch. Add CLAUDE_FLOW_HOOKS_RECORD_COMMANDS=0 / CLAUDE_FLOW_HOOKS_ENABLED=false /
hooks.recordCommands=false (nothing is stored when off), redact common secret
shapes and cap stored text at 2000 chars (bounded patterns, linear on hostile
input). `memory cleanup --expired-only` never saw expired rows because
listEntries hides them (TTL is a read-time rule): listEntries gains
includeExpired + expiresAt, and memory_cleanup uses it. ruflo-core 0.2.8: the
Bash shim stands down when recording is off.
Co-Authored-By: RuFlo <ruv@ruv.net>
- Upgrade-written import/sync hooks used `node -e "...import(file)" import`, which
leaves the subcommand in process.argv[1]; the helper read argv[2], so both hooks
only printed the status banner. They now use helperHookCommand like every other
helper hook, and the helper also accepts the argv[1] shape so settings.json files
already written keep working.
- Hook timeouts were written as 6000/8000 (and 8000/10000 from init) but Claude Code
reads them in seconds; the auto-memory hooks now use 30.
- JsonFileBackend.query treated MemoryQuery.type (a query mode: hybrid, semantic...)
as an entry type, so the bridge's learnings query matched nothing and sync always
reported 0. It now treats modes as modes and honours tags, updatedAfter, key,
keyPrefix and memoryType. The "Curated MEMORY.md index" line is no longer printed
when the bridge emitted index:skipped.
- In a git worktree the memory dir is keyed by the main checkout (resolved with
`git rev-parse --git-common-dir`, no shell) to match Claude Code.
- auto-memory-hook.mjs and intelligence.cjs both read-modify-write
auto-memory-store.json: writes are atomic (temp + rename), serialised by a short
fail-open directory lock, and keep entries another writer added since the read.
- Not changed: autoAssignOnIdle/autoAssign are false on purpose (#3031).
Helpers re-signed. Regression: __tests__/auto-memory-hooks-4058.test.ts (10 of 11
failed before; the 8-writer race kept 6 of 8 entries).
Co-Authored-By: RuFlo <ruv@ruv.net>
init, init --dual and @claude-flow/codex init wrote a gitignored
.codex/config.toml with sandbox_mode = danger-full-access,
approval_policy = never and web_search = live. Default is now standard
trust (workspace-write, on-request, cached); the permissive file needs
--codex-trust full (or RUFLO_CODEX_TRUST=full). init prints which level
it wrote, an existing .codex/config.toml is never rewritten (not even
with --force) and a kept permissive file is flagged. Unknown levels are
rejected on the CLI and fall back to standard from the environment.
Found by the three-host e2e run (ADR-490). @claude-flow/codex 3.0.4
(bundled: ships with the next train).
Co-Authored-By: RuFlo <ruv@ruv.net>
Read-only check: reads build/config.gypi of each better-sqlite3 copy in the
resolved tree (never loads an addon), warns when a locally compiled copy used
24.19+ headers while the runtime is 24.19-24.21 (nodejs/node#65446), with the
documented workarounds. Prebuilt copies carry no config.gypi and pass.
Co-Authored-By: RuFlo <ruv@ruv.net>
ADR-490 (loop), ADR-491 (mods host integration, Proposed). The loop's first run found two defects, fixed test-first:
- ruflo mcp start advertised resources but answered resources/* with -32601 (3 stdio servers).
- init --dual's marketplace clone ran under a 20 s budget (17.5 s measured), swallowing the real error.
Co-Authored-By: RuFlo <ruv@ruv.net>
Adds a standalone host for the ruflo-console views: a Node Host adapter
(confined reads, CLI-only run, everything engine-bound refused), a zero
dependency terminal renderer that is also the escape/secret chokepoint, and
`ruflo tui [--view overview|cost]` which draws the mod's own paneView.
Read-only; headless prints one plain frame. No hooks/ file changed, no
version bump, publish path untouched (bundle staging is a decision in the ADR).
Co-Authored-By: RuFlo <ruv@ruv.net>
Two findings from ruvnet's review on #4053:
1. The powershell/-EncodedCommand pattern (`\s+.*-e(...)`) backtracks
quadratically on hostile input -- measured ~1.9s on 64,000 spaces with no
match; a 1MB hook command would stall session-restore (an unconditional
boot path) for minutes. Rewritten as a linear token-walk
(`(?:\S+\s+)*?`), confirmed <5ms on a 1MB hostile input while still
matching real EncodedCommand payloads. Fixed in both the CJS mirror and
the shared TS original (settings-risk-scanner.ts), since the TS version
is already live via init/--upgrade.
2. scanSessionStartSettingsForRisk()'s warnings included up to 120 chars of
the matched hook-command snippet -- but session-restore's stdout is read
back into the live Claude Code session as context, unlike init/--upgrade
where a human reads the terminal directly. Printing attacker-controlled
settings.json content into that context is a prompt-injection path even
with control characters stripped. The automatic-boot path now prints
only the scanner-generated location + reason, never the snippet;
srFormatRiskFindingsAsWarnings (snippet included) is unchanged for
init/--upgrade's human-facing output.
New tests: a 1MB ReDoS timing guard, a snippet-leak regression guard, and a
real-payload-still-detected check after the regex rewrite. 75/75 related
tests pass.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01HW4yuGGcrCy4CcPgQ7Q2dx
Under Git Bash MSYS rewrote the /c of the generated cmd /c IF EXIST hook, so cmd
started interactively, executed the hook's stdin JSON and created zero-byte files
from text after a >. The Windows hook is now a single node -e with no cmd, no
%VAR%, and none of < > | & $ or inner double quotes. It keeps the project-first
then user-profile fallback (#1943), user scope never reads the project, and the
helper runs as a child with inherited stdio so stdin and the exit status pass
through. pinToUserHelpers recognises the new form (exact match only) as well as
the old ones.
Co-Authored-By: RuFlo <ruv@ruv.net>
#2351 fixed trajectory-end feedback being dropped, but only for step-less
trajectories (`!hasSteps` gate). The common start -> step -> end path that
real agents use recorded SONA state via `processTrajectoryOutcome`, but the
non-empty `feedback` string was never promoted to the `pattern` namespace,
so it was unreachable through `hooks_intelligence_pattern-search`.
Remove the `!hasSteps` restriction so feedback is promoted whenever it is
non-empty, regardless of whether steps were recorded. `patternsExtracted`
and the `feedbackDistilled` response field already handled both cases
generically, so no other call sites change behavior.
Adds a regression test driving the full trajectory-start -> step -> end ->
pattern-search path, which fails on current main and passes with this fix.
Note: this addresses only the "indexed when steps are present" half of
#3662. The issue's other claim — that `hooks_route` never consults a
persisted SONA `getRoutingSuggestion()` pattern — is real (verified:
`getSuggestion`/`getRoutingSuggestion` have no callers outside
sona-optimizer.ts) but requires an architectural decision (precedence vs.
the AgentDB/semantic routing paths, the confidence threshold, and new
response fields distinguishing "persisted" from "eligible for inference")
that is out of scope for this fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01QFyyphjiSXRE1TS2rRnEwU
fix(cli,plugins): resolve executed optional modules from the tool's own install (replaces #3954; security review in PR body)
Co-Authored-By: RuFlo <ruv@ruv.net>
Adversarial review of the first commit (a Claude devil's-advocate agent and three
Codex rounds) found inputs main reports that it dropped, a ReDoS, and quadratic paths.
- Command injection is main's rule again (child_process ... exec), tested after
comment stripping, so execSync is reported and no execFile shape is exempt: env,
node -e, python -c, bash.exe, options variables and exec passed as a value were all
bypasses. The execFile callback regex that backtracked catastrophically is gone.
- Carried block comments continue only through comment-looking lines; regex literals
are read as code (bounded to 200 chars); '://' is never a comment. Lines are built
from parts with a 12-char tail, so the stripper is linear.
- SQL placeholders: only param/placeholder names, params/values/args.length, numbers
and loop letters, in value position, outside single- or double-quoted SQL text, in
one left-to-right pass that skips escapes. pageNum, userIdx, req.body.length and
quoted placeholders are reported.
- Spec: 26 tests, including every reviewer input and linear-time checks; each of ten
source mutations fails at least one test.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
`ruflo security scan --depth deep` on a 10-repo checkout reported 10 high findings,
all false: `child_process.execFile` named in comments, numbered pg placeholders
(`$${paramCount}`) as SQL injection, and a Playwright report bundle. Mediums
included "retrieval (" read as eval and istanbul/Playwright assets.
- eval needs a word start; window.eval still matches.
- Command injection is any exec/execSync/execFile use (call, ?.(), .call/.apply/
.bind, ['exec'], passed as a value), except execFile of a literal non-shell
program with a literal argv and no shell or options variable. execSync, which
`exec[^S]` skipped, is now reported.
- A counter-shaped pg placeholder where SQL takes a value, outside SQL quotes, is
not interpolation; quoted or value-shaped `$${...}` still is. The SQL test runs in
linear time.
- Comment text is stripped before matching (strings respected); a block comment
carries only from a line-start opener that closes later.
- istanbul prettify/sorter/block-navigation/lcov-report next to a coverage marker,
and Playwright trace/data next to index.html, are skipped. Folder names are looked
up in a Map.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
A home-level helper or a user-level plugin hook serves every opened project.
hook-handler.cjs and statusline.cjs executed a CLI found under the project
(<cwd>/node_modules/{@claude-flow/cli,ruflo}, <cwd>/v3/...), and every npx
fallback ran with the project as cwd, where npx prefers the project's own
install. The plugin shims also resolved `ruflo` through relative PATH
entries, which resolve against the cwd.
- hook-handler.cjs / statusline.cjs (package and repo copies): candidates
are built from the helper's install root; for a project-local helper that
is the project, so its behaviour is unchanged.
- npx fallbacks pass `--prefix <helper root>` (generated hook-handler and
ruflo-hook.cjs too) or, in the plugin shims, `--prefix <plugin data dir or
home>`. The spawned CLI still runs with the project as its cwd.
- ruflo-hook.cjs (all four copies): relative/empty PATH entries are skipped.
Test: helper-cli-resolution-trust.test.ts (11 cases, 10 fail on main);
hook-handler-artifact-parity follows the npx args into cliSpawnArgs().
The signed helpers changed, so the helpers manifest needs re-signing.
start() created SESSION_DIR (mkdirSync / ensureDir) before checking that it
resolves inside the project, so a symlinked .claude-flow still got an empty
sessions/ directory created at the symlink target. assertSessionDirContained()
now resolves the deepest existing part of the path (lstat, so a symlink
counts) and start() calls it before creating anything. Applied to all five
session helper variants.
Test: session-helper-trust.test.ts gains a symlinked-.claude-flow case per
variant (5 cases, all fail without this change).
pinToUserHelpers() only recognised the #1943 probes, the exact git-root
statusline and the git-root ESM import without argv.splice, so
`init --upgrade --settings` on the home directory left older shipped forms
that always run the opened project's helper:
- pre-#1943 `sh -c 'exec node "${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/<x>" <sub>'`
and the Windows `cmd /c node %CLAUDE_PROJECT_DIR%/.claude/helpers/<x> <sub>`;
- ADR-059 git-root node -e forms (CJS and ESM, with argv.splice);
- relative `node .claude/helpers/<x> [sub]` hooks and statusline.
It now re-pins any command whose target is a known ruflo helper under
.claude/helpers reached through CLAUDE_PROJECT_DIR, %CLAUDE_PROJECT_DIR%,
`git rev-parse --show-toplevel` or a relative path, keeping the subcommand.
Commands with redirects/chaining, other scripts, or already pinned to HOME
are left alone.
executeUpgrade() created a missing settings.json with
generateSettings(DEFAULT_INIT_OPTIONS), whose targetDir is the module-load
cwd; it now passes the upgrade's targetDir.
Tests: one case per legacy form, a user-authored/already-pinned case, an
upgrade-merge case, and an executeUpgrade missing-settings case.
Settings written to ~/.claude/settings.json apply to every project the user
opens. The #1943 probe ran `$CLAUDE_PROJECT_DIR/.claude/helpers/<script>`
whenever that file existed, so in user-level settings the opened project
decided which helper code ran.
helper-commands.ts now owns the hook/statusline command forms:
- project-level settings keep the #1943 project-first probe, unchanged;
- user-level settings (init target is the home directory) get commands
pinned to $HOME/.claude/helpers with no project lookup;
- `init --upgrade --settings` on the home directory re-pins the probe and
git-root forms ruflo generated earlier and leaves user-authored commands.
The #1943/#1948 fix invariants now point at helper-commands.ts.
Test: settings-user-level-helpers.test.ts (8 cases).
A home-level helper can serve whatever project Claude Code opens, so
everything that project controls is untrusted input to the helper.
auto-memory-hook.mjs / learning-service.mjs: since the #3286 change every
module-resolution strategy (memory-package.json sidecar, local v3 dist,
createRequire, node_modules walk-up, agentic-flow embedder) was rooted at
CLAUDE_PROJECT_DIR, so a project could choose which JavaScript a home-level
helper imports. Add MODULE_ROOT (the helper's install root) for module
resolution; PROJECT_ROOT stays data-only, so #3286 still holds.
session.cjs: end() archived to `${session.id}.json` with the id taken from
the project's current.json, so a crafted id could write outside the session
directory, and writes followed symlinks. The archive name must now match
session-<digits>; current.json counts only as a regular file (lstat); writes
use an exclusive temp file + rename; and the project session directory must
resolve inside the project. Applied to the packaged helper, both generators
(generateSessionManager / generateCrossPlatformSessionManager) and the
repository copy.
Tests: helper-module-root-trust and session-helper-trust (16 of 21 cases
fail on main, all pass now); the #3286 test now places the mock memory
package at the helper root.
The helpers manifest is not re-signed here: auto-memory-hook.mjs changed, so
it needs `scripts/sign-helpers.mjs` with the release key.
- smoke-plugin-registry-signature.mjs: follow the verifier rename to
registrySignatureFailure and require the fail-closed call site
`if (failure) return this.fallbackToBuiltIn(`, keeping full #1922 coverage.
- verifyEd25519Signature verifies in RFC 8032 strict mode, and
isPlaceholderSigningKey rejects every small-order or off-curve key, not
only the all-zero one.
- An unverified registry claims no official plugins and no verified
authors; MCP transfer_plugin-* results carry the registry status.
- Tests no longer assume the shipped trust anchor stays a placeholder.
- Document the strict-mode asymmetry for unlisted packages in --help.
The live plugin registry CID is unsigned, so discovery always fell back to
the built-in plugin list, whose entries all claim trustLevel "official".
`plugins install` passed that claim on as registry trust, which runs npm
lifecycle scripts and skips the permission gate (#3557) for any listed
plugin, with nothing actually verified.
- Discovery reports `verified` + `unverifiedReason`; only a registry whose
signature verifies against the pinned key keeps its trust labels. The
built-in fallback and a registry fetched with requireVerification off are
reported with every entry as 'unverified'.
- A placeholder pinned key (missing, malformed, all-zero) is never used to
verify: the all-zero key is small-order and accepts a forged signature.
- CLAUDE_FLOW_STRICT_PLUGINS=true (ADR-145): no fallback to the built-in
list, and `plugins install` refuses unless --allow-unverified is passed.
- `plugins install` passes registry trust, permissions and checksum only
for a verified registry entry; `plugins list`/`info` show registry status.
- PluginIntegrityVerifier (@claude-flow/security) skips placeholder anchors,
such as the all-zero one in trust-anchors.json, and verifies in RFC 8032
strict mode, which rejects small-order keys.