Skip to content

feat(recall): enrich Sources with descriptions and add complexity gating - #276

Open
m0Nst3r873 wants to merge 1 commit into
Tencent:mainfrom
m0Nst3r873:feature/recall-source-desc-and-complexity-gating
Open

feat(recall): enrich Sources with descriptions and add complexity gating#276
m0Nst3r873 wants to merge 1 commit into
Tencent:mainfrom
m0Nst3r873:feature/recall-source-desc-and-complexity-gating

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Collaborator

Summary

Building on Q1 (#240, source-file anchors) and Q3 (#234, --check precheck), this adds three improvements to recall quality:

  • Sources functional descriptions: Each source-file anchor now carries a ≤40-char description extracted from wiki component facts (e.g. src/api.ts (请求发送与重试逻辑)), helping agents distinguish similarly-named files
  • --check output enrichment: RELEVANT verdicts now include the top-1 hit's title and sources, enabling the LOW-complexity fast path without a full recall round-trip
  • Complexity-aware gating: The recall subagent gains a complexity quick-judge in Step 0 — LOW-complexity tasks (single-file/field changes) take a fast path returning only the top-1 suggestion, skipping Steps 1-5 entirely

Motivation (from recall-Q1Q3 benchmark)

Task Complexity Opus TeamAI Δ
modify-charge-type high 0.494 0.568 +0.074
scale-replica-flow high 0.423 0.525 +0.102
modify-name low 0.501 空产出
renew-flow low 0.658 0.632 -0.025

Q1 source anchors boosted high-complexity tasks significantly, but low-complexity tasks regressed — recall injected unnecessary context that distracted the agent. This PR addresses both the precision gap (descriptions) and the efficiency gap (complexity gating).

Test plan

  • npx tsc --noEmit — zero type errors
  • npx vitest run — 144 files, 1891 tests passed
  • Manual: teamai recall --check "modify service name" shows RELEVANT score=X.X title="..." sources=...
  • Manual: teamai recall "restart precheck controller" shows Sources: path (description) format

🤖 Generated with Claude Code

@m0Nst3r873
m0Nst3r873 force-pushed the feature/recall-source-desc-and-complexity-gating branch 2 times, most recently from fd66b77 to 5bb6625 Compare August 4, 2026 07:38
…hment

Three groups of changes to improve recall precision and efficiency,
based on recall-Q1Q3 benchmark findings:

**Q1 — Candidate change files** (from worktree-recall-quality-q1q3):
- queryCodeKnowledge() extracts forward-dependency neighbors from
  graph-index for each codebase hit
- formatResults() surfaces them as a "Candidate change files" section
- teamai-recall.md instructs the subagent to reproduce this section

**Q3 — Task-type depth heuristic** (from worktree-recall-quality-q1q3):
- teamai-recall.md Step 1 differentiates depth by task type
  (feature→lookup, bugfix→context)
- compileRecallRulesBlock() hints the main conversation to leverage
  or skip recall accordingly

**Sources enrichment** (new in this PR):
- SourceAnchor type replaces plain string[] for sources, carrying
  per-file functional descriptions (≤40 chars) extracted from wiki
  component facts
- --check verdict for RELEVANT queries now includes top-1 hit's
  title and sources, enabling LOW-complexity fast path
- teamai-recall.md gains complexity quick-judge in Step 0: LOW tasks
  skip Steps 1-5, returning only top-1 suggestion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@m0Nst3r873
m0Nst3r873 force-pushed the feature/recall-source-desc-and-complexity-gating branch from 5bb6625 to de0b3aa Compare August 4, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant