feat(agentic): ranked reasoner search + ambient load metadata (beta-plan: Santosh's recommendations) - #784
Merged
Conversation
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
Two beta-plan items ("Santosh's recommendations") for the sub-harness
flow, where a coding agent drives AgentField through `af agent` and the
agentfield-use skill:
1. Reasoner discovery at scale. With hundreds of reasoners installed
the brain must search, not list. New GET /api/v1/agentic/reasoners
?q=<free text>&agent=<id>&limit=<1..50> ranks reasoners with a
dependency-free BM25F-lite index built per request from the same
registration data discovery serves (id boost 3.0, tags 2.0, agent
1.5, metadata description 1.0; snake/kebab/camelCase-aware
tokenizer; deterministic tie-break). Each hit carries
invocation_target + agent_health so the brain dispatches with no
second lookup. CLI: `af agent search "<text>" [--agent] [--limit]`.
2. Ambient machine-load metadata. Every agentic response now carries
meta.load = {running_agents, total_agents, active_executions,
cpu_cores, recommended_max_concurrent} via a load provider stamped
into respondOK (2s TTL cache; omitted silently on error — never
fails a response). recommended_max_concurrent = max(1, cores/2),
cores-based; memory-aware refinement noted as follow-up. The
`af agent` CLI already forwards server meta, so the driving agent
gets load data with zero extra round-trips.
The agentfield-use skill (v0.2.0 -> v0.3.0, embedded mirror synced)
teaches both: search-first discovery past ~20 reasoners, and pacing —
if active_executions >= recommended_max_concurrent, finish in-flight
work before launching more.
Verified end-to-end on a live control plane with 78 registered
reasoners: "review pull request" ranks pr-af-go:review_dimension /
review on top, --agent filters, empty q -> structured missing_query,
meta.load rides every response (16 cores -> recommendation 8).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodeQL (go/uncontrolled-allocation-size) does not track the limit clamp through getIntQuery. Allocate at the constant max (50) instead - the loop still stops at the requested limit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AbirAbbas
force-pushed
the
feat/agentic-reasoner-search-load-meta
branch
from
July 16, 2026 14:03
9d802cb to
3f954bc
Compare
AbirAbbas
added a commit
that referenced
this pull request
Jul 16, 2026
…licts) Conflict resolutions: - agent_commands.go: union requires_auth — keep #784's reasoners endpoint alongside the executions steering endpoints - commands/install.go: keep both --json (this PR) and --path (#750); thread path through executeJSON so the flags compose - logs.go: keep runtime import from main - stop.go: keep JSON-aware printf/Outcome from this PR plus main's ErrProcessDone guard and markStopped refactor; route main's new stale-registry warnings through the quiet-aware printer so --json stdout stays machine-readable Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the two remaining beta-plan recommendations ("Santosh's recommendations") for the sub-harness flow, where a coding agent (Claude Code, Codex, …) drives AgentField through the
af agentJSON CLI and theagentfield-useskill.1. Reasoner discovery at scale — ranked search
With hundreds of reasoners installed, the driving agent must search, not list-and-scan.
GET /api/v1/agentic/reasoners?q=<free text>&agent=<optional id>&limit=<1..50>— ranks all registered reasoners with a dependency-free BM25F-lite index built per request from the same registration data the discovery surface serves (results never drift from discovery). Field boosts: reasoner id 3.0 > tags 2.0 > agent id 1.5 > metadata description 1.0; the tokenizer splits snake/kebab/camelCase (query "pr resolve" matchesrun_pr_resolver); ties break deterministically by invocation target.reasoner_id,agent_id,invocation_target,tags,score,agent_health— the brain can dispatch immediately with no second lookup.af agent search "<free text>" [--agent <id>] [--limit N].q→ structuredmissing_queryerror.2. Ambient machine-load metadata — zero extra round-trips
The brain must know how loaded the machine is before starting more heavy agents, without asking.
meta.load={running_agents, total_agents, active_executions, cpu_cores, recommended_max_concurrent}, stamped centrally inrespondOKvia a load provider registered at route setup.meta.loadis silently omitted — it can never fail a response.recommended_max_concurrent = max(1, cores/2)(cores-based; memory-aware refinement noted in-code as follow-up).af agentCLI already forwards server meta into its JSON output, so driving agents get this on every call for free.Skill wiring
agentfield-usev0.2.0 → v0.3.0 (embedded mirror synced,sync-embedded-skills.sh --checkpasses):af agent searchpast ~20 reasoners; dispatch frominvocation_target; preferagent_health == "active".meta.load; ifactive_executions >= recommended_max_concurrent, finish in-flight work before launching more, and tell the user when throttling.Testing
internal/handlers/agenticand targetedinternal/cli/internal/skillkitsuites green.af agent search "review pull request"rankspr-af-go:review_dimension/pr-af-go:reviewon top;--agent swe-planner+ "plan a development sprint" returnsswe-planner:planthenrun_sprint_planner;meta.loadpresent on every response (16-core machine → recommendation 8); empty query returns the structured error.Notes
internal/clicaptureOutput pipe-buffer deadlock, skillkit/tmp/HOME assumptions) are unaffected; Linux CI is the arbiter.🤖 Generated with Claude Code