perf(mcp): lower get_guidance default max_items 12 -> 6 (token budget)

Un appel get_guidance par défaut passe de ~3800 à ~2280 tokens (-40%) en gardant
un mix patterns/risques équilibré (3 must_do + 3 red_flags) et confidence HIGH sur
un cas backend réaliste. Les agents qui veulent plus peuvent toujours passer max_items.

Mesuré: lire toute la base = ~131k tokens ; 1 appel ciblé à 6 = ~2,3k (~98% d'économie).
Défaut aligné dans server.get_guidance et knowledge.search_knowledge.
79 tests passent, aucune régression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MaksTinyWorkshop
2026-06-25 01:46:32 +02:00
parent d002435f03
commit 4d0f99d699
2 changed files with 2 additions and 2 deletions
@@ -306,7 +306,7 @@ def _validate_slug(slug: str) -> str:
return slug
def search_knowledge(domain: str, query: str, bucket: str | None = None, max_items: int = 12) -> list[dict[str, str]]:
def search_knowledge(domain: str, query: str, bucket: str | None = None, max_items: int = 6) -> list[dict[str, str]]:
paths = get_paths()
buckets = [bucket] if bucket else ["patterns", "risques"]
tokens = [t.strip().lower() for t in query.split() if t.strip()]
@@ -74,7 +74,7 @@ def resource_conventions() -> str:
@mcp.tool(description="Retourne patterns + risques utiles pour une story BMAD")
def get_guidance(domain: Domain, task_type: TaskType, story_text: str = "", keywords: list[str] | None = None, max_items: int = 12) -> dict:
def get_guidance(domain: Domain, task_type: TaskType, story_text: str = "", keywords: list[str] | None = None, max_items: int = 6) -> dict:
out = _base_output()
query = " ".join(keywords or []) or story_text or task_type
matches = search_knowledge(domain=domain, query=query, max_items=max_items)