Skip to content

ctx-inspired improvements: routing feedback, session dedup, slug-token scoring, quality grades #3

Description

@MaTriXy

Summary

A review of stevesolun/ctx (MIT — graph-backed skill/agent recommendation engine for Claude Code, forked at MaTriXy/ctx) surfaced working solutions to several limitations Agent Registry's own README acknowledges: no relevance feedback, fixed scoring that doesn't learn, and no visibility into dead-weight agents.

Full plan (committed to this repo): docs/plans/ctx-inspired-improvements.md

We port ctx's feedback-loop principles only — no Python code, no graph artifacts, no new runtime dependencies. Everything stays zero-dep Bun + local JSONL.

Proposed changes (one PR per phase)

Phase Change Key files
1 Routing telemetry — local JSONL logging considered (hook injected) vs picked (get.js loaded); hit-rate with neutral 0.5 prior under 3 observations; 30-day truncation new lib/routing-log.js, hooks/user_prompt_search.js, bin/get.js
2 Session dedup — don't re-inject the same agents on every prompt within one session_id; 24h pruning hooks/user_prompt_search.js
3 Slug-token scoring — exact name-token matches ≫ substring, simple IDF over registry; folds into existing 0.6*BM25 + 0.4*keyword formula lib/search.js
4 Hit-rate feedback in ranking — bounded multiplier final = combined * (0.85 + 0.3*hitRate) applied hook-side only; CLI search stays pure relevance lib/search.js, hook
5 Quality grades — A–F per agent from usage (0.45) + routing hit-rate (0.30) + structure (0.25); hard floors: missing file ⇒ F, never-used ⇒ max D new bin/quality.js, lib/quality.js
6 (stretch, parked) optional cosine/semantic ranker — deferred; breaks zero-dep promise, revisit after 1–5 ship

Dependency order: 1 → 4 → 5; phases 2 and 3 are independent and can ship anytime.

Note: this is distinct from the existing lib/telemetry.js (opt-in anonymous network analytics). All new state is local-only, lives under references/, and is git-ignored like registry.json.

Build & test

bun install                      # only dep: @clack/prompts (init UI)
bun test                         # full suite (101 tests today; each phase adds its own file)
bun bin/search.js "query"        # manual smoke
bun bin/quality.js               # after Phase 5
./install.sh                     # user-level install to ~/.claude/skills/agent-registry/

Constraints to preserve: Bun built-ins only for search/scoring, CommonJS in lib/, silent-fail hooks, user data stays git-ignored.

Attribution

Mechanisms adapted from ctx (MIT): routing-trace hit rate with minimum-observation prior, session suggest-shown flag, slug-token tiered scoring, multi-signal quality grades with hard floors, log truncation windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions