Commit History
-
[NOTICKET][AI] Planner: drop parallelizable_with from Task
Rifqi Hafizuddin +1: Claude Opus 4.8Remove the unused parallelizable_with field and its validator check (5). TaskRunner derives parallelism from depends_on alone, so the field was redundant. Strips it from schema, validator, all few-shots (A-D), and the planner prompt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>272a186
-
[KM-626][AI] Planner few-shot: add analyze_aggregate (Example D) to fix arg shape
Rifqi Hafizuddin +1: Claude Opus 4.8Live test surfaced an agent-side bug: for group-by questions the Planner emitted analyze_aggregate args as a nested list of metric specs, but the tool expects `aggregations` as an OBJECT {column: [funcs]} with `group_by` as a SEPARATE array. The tool then did aggregations.keys() on a list -> AttributeError. There was no few-shot for analyze_aggregate, so the LLM guessed the wrong structure. Add Example D ("average and total order value per region") demonstrating the exact shape: aggregations={"revenue": ["mean","sum"]}, group_by=["region"]. Verified live: the same question that failed now plans the correct shape ({"base_price": ["mean"]}, group_by=["category"]) and analyze_aggregate succeeds end-to-end. Planner suite green (32 passed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>f07e524 -
[KM-626][AI] Planner few-shot: make describe_source success_criteria checkable
Rifqi Hafizuddin +1: Claude Opus 4.8Live end-to-end test against real user data exposed a Planner robustness bug: the validator requires success_criteria to contain a measurable signal word, but the three describe_source examples modeled "describe_source returns the orders table..." (no signal word). The LLM imitated that phrasing and failed its own validation (3 retries exhausted). Reworded to "Produced the orders table schema..." so the examples are consistent with the validator. After the fix the same question plans in one shot (no retries). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>f87e5ec -
[KM-626][AI] Slow-path wiring prep: context + persistence seams, retrieve_documents few-shot
Rifqi Hafizuddin +1: Claude Opus 4.8Three small steps that de-couple the live wiring from the remaining blockers so flipping enable_slow_path on later is a one-liner. - BusinessContext seam: new get_business_context(user_id) (planner/business_context.py) is the single place context is read — returns a stub today, swap the body when the lead's real source lands. ChatHandler now reads through it. - AnalysisStore seam: new slow_path/store.py (Protocol + NullAnalysisStore no-op that logs only). ChatHandler persists the analysis_record through it after streaming (never breaks the answer on failure). Real Postgres-backed store in the catalog DB (Neon dataeyond) is a TODO — table not created yet. - Planner few-shot: add Example C (retrieve_documents) — a mixed structured + unstructured plan showing an independent document-retrieval branch (NL query, no ${t} placeholder, runs in parallel). The Planner had no retrieve_documents example. Verified: slow_path + planner suites green (52 passed); live RUN_PLANNER_EVAL …3b27b6b
-
[KM-624][AI] Planner: realign stub registry + examples to composite analyze_* tools
Rifqi Hafizuddin +1: Claude Opus 4.8Team decision: v1 uses composite "family" tools (analyze_*), not the atomic compute_* set. Realign the planner-facing stub to the real KM-624 inventory so the Planner plans against tools that exist. - registry.py: replace the 9 atomic entries (compute_median/stddev/percentile/ mode, date_trunc, ...) with 12 composite entries -- 4 data-access (query_structured, retrieve_documents, list_sources, describe_source) + 8 analyze_* (descriptive, aggregate, comparison, contribution, profile, correlation, segment, trend). Each analyze_* takes a `data` "${t<id>}" placeholder (Pattern A, assumed pending the tool team). - examples.py: Example A -> analyze_contribution; Example B -> analyze_trend (drops the removed date_trunc/compute_stddev chain). - planner.md: rewrite the "compute_* tools" bullet as data-access vs analytics. Validator/prompt/service unchanged (generic over the registry). Planner tests updated locally (tests/ is gitignored): 32 passing + 1 gated, ruff clean. Co-Autho…93a24da
-
[KM-567][AI] Planner agent: prompt + few-shot examples
Rifqi Hafizuddin +1: Claude Opus 4.8- prompt.py: build_planner_prompt assembles per-call human content (business context + condensed catalog + tool list + constraints + examples + question, plus prior error on retry). - config/prompts/planner.md: system prompt encoding INV-1/6/7 and the planning principles. - examples.py: two few-shot TaskLists (A exploratory revenue-by-category; B descriptive monthly-trend-by-region with date_trunc), built from the real TaskList schema so they cannot drift from the output contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>83ba6b1