ruvnet / ruvnet/agentic-flow

hooks intelligence attention throws 'Cannot read properties of undefined (reading MultiHead)' on every --type but prints an empty result list at exit 0; learn reports 'Complete' for a skipped cycle

Open
#206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
812
Forks
175
Avg merge
2m
Merged PRs (30d)
3

Description

Summary

Two hooks intelligence subcommands report success in their default output while --json — same invocation — reports failure or a skipped no-op.

  • attention fails on every documented --type with TypeError: Cannot read properties of undefined (reading 'MultiHead'). The text output shows an empty results section, no error, and exit 0.
  • learn prints 🎓 Learning Cycle Complete ✅ while the JSON says status: skipped: no trajectories to process.

Version: agentic-flow 2.1.2, Node v22.23.0, macOS 15.

1. attention — total failure, invisible in the default output

npx agentic-flow hooks intelligence attention "how do I optimize a slow SQL database query" \
  --candidates "recipe for chocolate cake" "how to train a puppy" \
               "weather forecast for Tuesday" "add an index to speed up a slow database query"
🧠 Attention Scores (moe)
   Query: "how do I optimize a slow SQL database qu..."

   📊 Results:

   ⏱️  Latency: 3.00ms

Exit code 0. The 📊 Results: heading is printed with nothing beneath it, which reads as "ran fine, scored nothing".

The same call with --json:

{
  "success": false,
  "error": "Cannot read properties of undefined (reading 'MultiHead')",
  "latencyMs": 3
}

So the command threw, and the default output neither shows the error nor signals failure through the exit code.

Every documented attention type is affected-t moe|flash|hyperbolic|graph|dual, plus an undocumented value for contrast:

--type moe         FAIL  Cannot read properties of undefined (reading 'MultiHead')
--type flash       FAIL  (same)
--type hyperbolic  FAIL  (same)
--type graph       FAIL  (same)
--type dual        FAIL  (same)
--type nonsense    FAIL  (same)

The identical error for an invalid type suggests the failure occurs before the type is dispatched.

reading 'MultiHead' looks like the same import-shape problem as #191: @ruvector/attention exposes its classes on the module's default export, and dist/core/attention-native.js reads them off the namespace instead, so the object being indexed is undefined.

2. learn — "Complete ✅" for a skipped cycle

🎓 Learning Cycle Complete
   ✅ Learning cycle completed
   Reason: manual test
   Features: micro-lora-batch, ewc++-consolidation, pattern-distillation
   Latency: 2.00ms

--json, same command:

{
  "success": true,
  "message": "Learning cycle completed",
  "result": "Forced learning: 0 trajectories -> 0 patterns, status: skipped: no trajectories to process",
  "features": ["micro-lora-batch", "ewc++-consolidation", "pattern-distillation"]
}

The JSON is honest — 0 trajectories -> 0 patterns, status: skipped. The text drops the result field entirely and prints a completion banner plus a list of features as though they had been applied. intelligence stats is unchanged before and after (Trajectories: 0, Patterns: 0).

Listing micro-lora-batch, ewc++-consolidation, pattern-distillation on a cycle that was skipped is the specific part I would flag: those are named mechanisms, presented as having run.

Suggested fix

  1. Surface error in the text path and exit non-zero when success is false. A thrown TypeError should not render as an empty result list at exit 0.
  2. Print result in learn's text output, or at minimum distinguish "completed" from "skipped".
  3. Fix the underlying MultiHead lookup — see #191 for the namespace-vs-default detail; a one-line change there would restore this command.

Related

  • #191 — @ruvector/attention classes live on .default but are read off the namespace, so every native constructor is undefined. This is the same failure reaching the CLI.
  • #198 / #201 / #202 — explain, metrics and transfer also print [object Object] or undefined in text while --json carries correct values. With attention and learn that is five commands whose default output disagrees with their own JSON.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the hooks intelligence attention and learn command paths, then inspect dist/core/attention-native.js and compare the text and --json output handling described in the issue. Use the documented attention types and the reported learn invocation to verify that attention errors produce a non-zero exit and that skipped learning cycles are represented as skipped rather than complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.