hooks explain prints '[object Object]' for its reasons, always returns an empty ranking, scores only 0 or 1.50, and cites a Cargo.toml fragment as the similar past task
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 812
- Forks
- 175
- Avg merge
- 2m
- Merged PRs (30d)
- 3
Description
Summary
hooks explain prints [object Object] where its reasons should be, always returns an empty agent ranking, reports a score of 0 or 1.50 and nothing else, and cites a Cargo.toml fragment as the "similar past task" justifying a caching recommendation.
The underlying data is not entirely absent — the JSON output shows a structured reasons array — but the text renderer stringifies it incorrectly, and ranking is genuinely empty.
Version: agentic-flow 2.1.2, Node v22.23.0, macOS 15.
Reproduce
npx agentic-flow hooks explain "Implement caching layer"
Actual:
📝 Summary: coder is recommended with score 0
🎯 Recommended: coder
💡 Reasons:
• [object Object]
🏆 Agent Ranking:
Documented:
📝 Summary: Task involves performance optimization and data caching
🎯 Recommended: perf-analyzer
💡 Reasons:
• High performance impact task
• Matches caching patterns from history
• Agent has 94% success rate on similar tasks
🏆 Agent Ranking:
1. perf-analyzer - 92.3%
2. backend-dev - 85.1%
3. coder - 78.4%
1. [object Object] — the reasons are rendered, not formatted
The data has structure. From --json:
"reasons": [
{
"factor": "Memory Similarity",
"weight": 0.5434859115100045,
"evidence": "Similar past task: \"[Cargo.toml] [workspace] resolver = \"2\" members = [ \"v3/crates/ruflo-federation-peer\", ] # gastow...\""
}
]
So the text path is interpolating the object directly instead of reading .factor / .evidence. A one-line formatting fix, but it makes the command's primary output useless.
2. ranking is always empty
"ranking": []
The documented "🏆 Agent Ranking" with three scored candidates never appears, and the heading is printed with nothing under it. Note hooks route does produce a ranked alternatives list for the same task, so the capability exists elsewhere in the codebase.
3. Score takes two values
Across four tasks:
Implement caching layer coder score 0
fix a failing python test test-engineer score 1.50
audit dependencies for vulnerabilities coder score 0
write API documentation documentation-specialist score 1.50
Only 0 and 1.50 appear. A "score" that is one of two values cannot support the documented 92.3% / 85.1% / 78.4% ranking, and a recommendation presented with score 0 is odd on its face — the summary literally reads coder is recommended with score 0.
(This mirrors hooks pre-edit, where confidence only ever takes 0.5 or 0.9 — reported separately.)
4. The cited evidence is unrelated to the task
For "Implement caching layer", the single reason offered is:
Similar past task:
"[Cargo.toml] [workspace] resolver = "2" members = [ "v3/crates/ruflo-federation-peer", ] # gastow..."
A Cargo.toml workspace stanza is not a past task, and has no relationship to caching. memoryCount: 6, patternCount: 45 — so it is selecting from a small pretrained set, and the top match at weight 0.543 is a manifest fragment.
This is consistent with retrieval scores being near-uniform: when everything is roughly equidistant, the "most similar" item is arbitrary. The same symptom appears in hooks pre-edit, whose memories array returns README.md / Cargo.toml / tsconfig.json chunks at 0.46–0.49 when editing an unrelated source file.
Suggested fix
- Format
reasons[]usingfactorandevidencerather than interpolating the object. - Populate
ranking, or remove the heading when it is empty — printing a bare "🏆 Agent Ranking:" with nothing under it reads as a failure. - Investigate why the score is quantised to
{0, 1.50}; as-is it cannot express the documented ranking, andscore 0accompanying a recommendation is self-contradictory. - Filter or threshold retrieved "similar past tasks" — a build manifest surfacing as the top evidence for a caching task suggests the similarity signal is not discriminating.
A snapshot test asserting the rendered output contains no [object Object] would catch item 1 permanently.
Related
- #186 —
hooks route: confidence fixed at 95.0%, factorsNaN, alternatives outrank the recommendation. - #196 —
hooks pre-edit: two-valued confidence, emptyrelatedFiles, unrelatedmemoriesat near-uniform scores.
All three commands share the pattern of emitting a confident-looking structured output whose fields are constants, empty, or unrelated to the input.
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
Run npx agentic-flow hooks explain "Implement caching layer" and inspect the hooks explain entry point alongside hooks route and hooks pre-edit, which exhibit related behavior. Verify the structured reasons, ranking, score, and retrieved evidence against the rendered output. Done means reasons are readable, ranking behavior is coherent, scores are not limited to the reported two values, unrelated evidence is addressed, and a snapshot test prevents [object Object] from returning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- cli, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100