v3/docs/adr/ADR-329-ruflo-capability-brain-mcp-guidance.md
Status: Accepted
Date: 2026-07-28
Owners: Ruflo CLI, Guidance, Security, and Release Maintainers
Related: ADR-150, ADR-176, ADR-320, ADR-322, ADR-324, ADR-325, ADR-327, ADR-328
Ruflo exposes a broad system through MCP tools, CLI commands, agents, skills, packages, and plugins. The previous guidance catalog described 16 hand-written areas and referenced 99 tool names. An audit of the current server found:
testgen_tdd_repair tool that is not registered by the MCP
client;.agents/skills, package ownership, plugin ownership,
authority, risk, degraded behavior, and implementation-loop placement absent
from discovery.This created two failures. Users could not discover most of Ruflo, and agents could mistake catalog text or MCP registration for proof that a provider was configured, reachable, healthy, and authorized.
Ruflo will ship a capability brain behind guidance_brain and enhance the
existing guidance tools without removing their compatibility surface.
The brain is generated from the completed live MCP registry. A static domain definition supplies semantics; it does not supply runtime presence. The MCP client injects its registry into guidance after all conditional and filtered tools have been registered. This avoids a circular import and makes silent catalog drift testable.
Every domain reports these facts independently:
| Fact | Meaning |
|---|---|
catalogued | This Ruflo version describes the capability. |
registered | The tool exists in this MCP process. |
configured | Required settings/providers are present. |
reachable | A non-mutating dependency probe succeeds. |
healthy | The dependency satisfies its health contract. |
authorized | Current subject may perform the exact action on the resource. |
Only registered can be derived from the MCP registry. The other dimensions
remain unknown until their dedicated adapters evaluate them. No single
“available” badge may collapse these dimensions.
guidance_brain exposes:
.claude, .agents, and plugin roots;The major domains deliberately distinguish:
The compatibility guidance_capabilities response remains available, but its
old string catalog is labeled compatibility-only and each legacy reference is
marked registered or unregistered. New routing consumes the live brain.
The brain includes Ruflo's implemented Cognitum identity lifecycle from ADR-306 as a distinct control-plane domain:
ruflo auth login uses loopback PKCE on an interactive desktop;ruflo auth login --no-browser uses the implemented OOB/manual-paste flow;--token-stdin is explicit;ruflo auth status is offline-safe, while --check may perform
demand-driven keychain refresh;account.create does not
imply hosted memory, routing, telemetry, deployment, IAM, or billing;RFC 8628 polling, a new Ruflo-specific OAuth client registration, automatic existing-install prompts, and hosted memory/device-flow contracts remain upstream work. Guidance must report those as unavailable rather than inventing endpoints or silently broadening scope. Authenticated identity is still independent of service configuration, reachability, health, and action authorization.
The v1 brain uses domain-derived metadata for tools:
name
domain
packageOwner
pluginOwner
availabilityMode
authority
risk
riskFlags
loopPhases
health.registered
health.configured
health.reachable
health.healthy
health.authorized
Availability modes are always-local, conditional-registration,
registered-degraded, configured-remote, and policy-filtered.
Risk flags cover read, local write, memory poisoning, process execution, network, credentials/PII, spending, concurrency, destructive actions, approval, and promotion. V1 supplies conservative domain defaults. A future generated per-tool descriptor may narrow those defaults, but may never silently lower risk.
Guidance recommendations and generated AGENTS.md files use this loop:
Self-learning follows recall → propose/branch → evaluate/critique → commit-validated. A memory or policy mutation requires a content digest and
validation receipt. No memory, neural, MetaHarness, Darwin, Flywheel, claims,
or consensus tool may authorize its own promotion.
guidance_brain supports:
| Mode | Result |
|---|---|
overview | Truth model, coverage, commands, registered domains, loop |
capabilities | Full domain/tool descriptors, optionally one domain |
coverage | Exact tool-to-domain assignments and gaps |
ecosystem | Agents, skills, plugins, packages, and commands |
recommend | Task-ranked live capabilities and guarded loop |
implementation-loop | Normative stages, evidence, mutation class, invariants |
guidance_discover also discovers agents, skills, plugins, and packages.
guidance_brain is additive.testgen_tdd_repair is catalogued but honestly reports unregistered until a
separate decision registers it.Acceptance tests must prove:
registered: false;.claude, .agents, packages, and plugins;The initial implementation classifies all 353 tools observed on Node 22/Linux with the browser runtime installed, with no fallback classifications or duplicates. This count is an environment observation, not a fixed protocol constant; the coverage invariant is percentage and exact assignment.
Brain construction and recommendation are local metadata operations. The benchmark profile must measure the maximum live registry, report median and tail latency, and fail if a future catalog change introduces an accidental network call or tool execution. Filesystem ecosystem discovery is measured separately because it performs bounded local I/O.
Users and agents can now ask Ruflo what it can actually do, receive safe workflow guidance, and see capability gaps without reading hundreds of source files. The cost is a maintained semantic domain map and mandatory coverage tests. Service-specific health and authorization probes remain adapter work; the brain exposes those unknowns instead of inventing a positive answer.