1. Supabase RPC 1:1 Parameter Alignments:
- Aligned all tool schemas in services/tools.py to match exact SQL DDL signatures from all_rpcs.sql.
- Added robust parameter normalization and unknown-parameter stripping in services/supabase_service.py to eliminate PGRST202 schema errors.
2. Context-Enriched Semantic Discovery:
- Enhanced discover_tools() for short queries (e.g. 'Miami') to include previous conversation turn context, accurately retrieving get_market_snapshot.
3. Conversational Tool Carryover:
- Updated forced synthesis to prompt the LLM to invoke suggest_actions for any uncompleted multi-step workflows (e.g. export reports, property comparisons, deep volatility dives).
1. Tool-Set Pruning:
- Replaced full 18-tool array (~3,130 tokens) on every call with intent-based subsets (5-7 tools = ~700-900 tokens).
- Added select_tools(query) covering MARKET_TOOLS, ANOMALY_TOOLS, PROPERTY_TOOLS, and GEO_TOOLS.
- All subsets include generate_data_export.
2. Synthesis Tool Stripping & Dynamic Token Budget:
- Tool-call rounds send selected tools with max_tokens=300 (tool JSONs are small).
- Synthesis round strips all tools completely (saving 3,130 tokens on final generation) and raises max_tokens to 2,000 to prevent report truncation (resolves finish_reason='length').
3. Session History Fact Compression:
- Implemented _compress_for_history() to store factual text summaries in session history while delivering full rich markdown tables to users.
- Saves ~85% history tokens per turn.
4. Hard Cap on Tool Result Payloads:
- Lowered max returned rows from 50 to 30 and enforced a 2,000-character ceiling per tool result in compress_tool_output()…
fix: resolve WhatsApp button URL text artifact, restrict report export to md, and enhance synthesis tool recovery
- Restructured repository to clean production FastAPI package layout
- Moved research docs, scratch scripts, and legacy routes to misc/
- Added COMMERCIAL_TOOLS with generate_contact_buttons for dynamic handoffs
- Configured direct file downloads (/download endpoint) in Appwrite storage
- Fixed middleware compression to preserve tool payload output for python tools
- Updated requirements.txt and verified test suite