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
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.
attentionfails on every documented--typewithTypeError: Cannot read properties of undefined (reading 'MultiHead'). The text output shows an empty results section, no error, and exit 0.learnprints🎓 Learning Cycle Complete ✅while the JSON saysstatus: 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
- Surface
errorin the text path and exit non-zero whensuccessis false. A thrownTypeErrorshould not render as an empty result list at exit 0. - Print
resultinlearn's text output, or at minimum distinguish "completed" from "skipped". - Fix the underlying
MultiHeadlookup — see #191 for the namespace-vs-defaultdetail; a one-line change there would restore this command.
Related
- #191 —
@ruvector/attentionclasses live on.defaultbut are read off the namespace, so every native constructor isundefined. This is the same failure reaching the CLI. - #198 / #201 / #202 —
explain,metricsandtransferalso print[object Object]orundefinedin text while--jsoncarries correct values. Withattentionandlearnthat is five commands whose default output disagrees with their own JSON.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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