ruvnet / ruvnet/agentic-flow

hooks pre-edit gets WORSE after pretrain: correct extension routing at 0.5 becomes wrong routing at 0.9; confidence is a two-valued constant, relatedFiles always empty, --json unparseable

Open
#196 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

hooks pre-edit gets worse when the intelligence store is populated. With no store, it routes correctly by file type at confidence 0.5. After hooks pretrain — the documented way to "bootstrap intelligence from your codebase" — the same file routes to the wrong agent at confidence 0.9.

Alongside that: confidence is a two-valued constant rather than a measurement, relatedFiles is empty for every source file tried, and --json emits unparseable output.

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

1. Pretraining degrades routing and raises confidence

Same repository, same files, only difference is whether .agentic-flow/intelligence.json (produced by hooks pretrain) is present:

WITH the pretrained store
  scripts/erp_cli.py       documentation-specialist   0.9
  src/roster.cjs           frontend-developer         0.9

WITHOUT it (file moved aside, then restored)
  scripts/erp_cli.py       python-developer           0.5
  src/roster.cjs           coder                      0.5

scripts/erp_cli.py is a Python CLI; src/roster.cjs is a Node module. The un-trained answers are right. The trained answers are wrong, and carry higher confidence.

In an empty directory with no store at all, routing by extension is entirely sensible:

same.py     python-developer         0.5
same.cjs    coder                    0.5
same.ts     typescript-developer     0.5
same.rs     rust-developer           0.5
same.html   frontend-developer       0.5
same.json   config-specialist        0.5
same.md     documentation-specialist 0.5
same.go     go-developer             0.5

(Eight files, identical one-byte contents, differing only in extension.)

So the baseline behaviour is a clean extension map, and the "intelligence" layer overrides it with a worse answer. Whatever the store contributes, it is not improving the decision — it inverts a correct one while increasing the confidence attached to it.

2. confidence is a constant, not a measurement

It takes exactly two values across everything tested: 0.5 without a store, 0.9 with one.

src/roster.cjs             0.9      src/scoring.cjs            0.9
scripts/erp_cli.py         0.9      scripts/stock_alert.py     0.9
src/weekly-dashboard.html  0.9      package.json               0.9
CLAUDE.md                  0.9

Seven files, four languages, three agents suggested — one confidence value. The README example advertises 📊 Confidence: 94.2%, which suggests a computed score; no input produced anything other than 0.5 or 0.9.

3. relatedFiles is empty for source files

The documented output includes:

📁 Related Files:
   - src/api/validation.ts
   - src/types/user.ts

That section never printed in any run. The JSON confirms the key exists but is unpopulated:

src/roster.cjs              relatedFiles=0
src/scoring.cjs             relatedFiles=0
scripts/erp_cli.py          relatedFiles=0
scripts/stock_alert.py      relatedFiles=0
src/weekly-dashboard.html   relatedFiles=0
package.json                relatedFiles=0
CLAUDE.md                   relatedFiles=2

Only a Markdown file produced any. Meanwhile the memories array is populated — with chunks of README.md, Cargo.toml and tsconfig.json when editing src/roster.cjs, at scores 0.46–0.49. Those are not related to the file being edited, which is consistent with the hash-based embedding producing near-uniform similarity.

4. --json is not parseable

agentic-flow hooks pre-edit src/roster.cjs --json 2>/dev/null | jq .

fails. 118 bytes of banner are written to stdout before the JSON, with stderr already discarded:

[IntelligenceBridge] RuVector intelligence layer initialized
[IntelligenceBridge] Features: Micro-LoRA, MoE Attention
{
  "success": true,
  ...

For a flag whose only purpose is machine consumption, this makes it unusable without a sed '1,/^{/d'-style workaround. The banner should go to stderr, or be suppressed entirely under --json.

5. The known constructor failures fire on every invocation

[RuVectorIntelligence] Attention init failed, using fallback: TypeError: MoEAttention is not a constructor
[RuVectorIntelligence] Optimizer init failed: TypeError: AdamOptimizer is not a constructor
[IntelligenceBridge] RuVector intelligence layer initialized
[IntelligenceBridge] Features: Micro-LoRA, MoE Attention

Both classes exist on the package's default export and are being read off the namespace — see #186 and #191. Worth noting the banner claims "MoE Attention" as an active feature on the line directly after MoE attention failed to construct.

Suggested fix

  1. Investigate why a populated store overrides a correct extension-based route with an incorrect one. If the retrieval scores are near-uniform (as the memories output suggests), the store's contribution is noise and should not outrank the deterministic mapping.
  2. Report a real confidence, or stop reporting one. A field that only ever takes two values invites callers to threshold on it.
  3. Populate relatedFiles, or drop it from the documented output.
  4. Keep --json output pure on stdout.

A regression test worth having: assert that pre-edit on foo.py suggests a Python agent both with and without a pretrained store. That single assertion covers items 1 and 2.

Related

  • #185 — hooks pretrain duplicates its memories on every run; this issue is about what that store then does to routing.
  • #186 — hooks route returns a constant researcher @ 95% with NaN factors. Same "confident constant" shape at a different entry point.
  • #191 — the namespace-vs-default import that causes the constructor failures above.

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 at the hooks pre-edit entry point and inspect .agentic-flow/intelligence.json handling, comparing routing with and without the pretrained store. Reproduce the foo.py case and run agentic-flow hooks pre-edit src/roster.cjs --json | jq .; done should preserve the correct route, provide meaningful output fields, and keep JSON stdout parseable.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
ai, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.