Skip to content

Phase 2 & Phase 3 Tool Development Plan

Based on prompt coverage analysis, Phase 1 is complete with 20 graph tools + 2 Points tools implemented. This document identifies gaps in user needs coverage and defines Phase 2 (quick wins) and Phase 3 (advanced features) tool requirements.


Current Tool Coverage (Phase 1 Complete ✅)

Section titled “Current Tool Coverage (Phase 1 Complete ✅)”

User Context (5):

  • ✅ get_user_purchase_history (with store_analytics)
  • ✅ get_user_categories
  • ✅ get_user_brands
  • ✅ get_purchase_patterns
  • ✅ get_category_brand_affinity

Product Discovery (4):

  • ✅ search_products
  • ✅ find_similar_products
  • ✅ find_alternatives
  • ✅ get_product_context

Temporal (2):

  • ✅ predict_repurchases
  • ✅ get_purchase_timeline

Offers (3):

  • ✅ get_active_offers (with venue_type filter)
  • ✅ match_products_to_offers
  • ✅ search_offers

Brands (3):

  • ✅ get_brand_products
  • ✅ compare_brands
  • ✅ discover_brands

Retailers (2):

  • ✅ get_user_retailers
  • ✅ get_retailer_offers

Collaborative (2):

  • ✅ get_collaborative_recommendations
  • ✅ get_local_trending

Points (2):

  • ✅ get_points_balance
  • ✅ get_redemption_options

🔴 Gap 1: Store-Level Product Availability

Section titled “🔴 Gap 1: Store-Level Product Availability”

User Prompts NOT Covered:

  • “Which store near me has Greek yogurt?”
  • “Where can I buy this specific product?”
  • “Show me stores within 5 miles that carry this brand”
  • “Is this product in stock at Target on Main St?”

Current Limitation:

  • We know which retailers a user visits
  • We know what products exist
  • We DON’T have: Product → Retailer availability mapping

Required Data:

// New relationship needed
(Product)-[:AVAILABLE_AT {
stock_status: "in_stock",
last_verified: datetime,
price: 4.99
}]->(Retailer)

User Prompts NOT Covered:

  • “Where’s the cheapest Greek yogurt near me?”
  • “Has the price gone up on my usual coffee?”
  • “Alert me when this goes on sale”
  • “Compare prices across my usual stores”

Current Limitation:

  • No price data on products or retailers
  • No price history tracking
  • No price comparison capabilities

Required Data:

Product {
price_history: [
{date: "2025-01-07", price: 4.99, retailer_id: "R123"},
{date: "2025-01-01", price: 5.49, retailer_id: "R123"}
],
current_price: 4.99
}
// Or relationship-based
(Product)-[:PRICED_AT {
price: 4.99,
effective_date: datetime,
sale: false
}]->(Retailer)

User Prompts NOT Covered:

  • “What’s the best combo of offers this week?”
  • “Can I stack these two offers?”
  • “Maximize my points on this shopping list”
  • “Which offers should I activate first?”

Current Limitation:

  • We show individual offers
  • We DON’T have: Offer stacking rules, optimization logic

Required Logic:

def optimize_shopping_list(products, active_offers):
# Find all applicable offer combinations
# Check stacking rules
# Calculate maximum points
# Return optimal activation strategy

🔴 Gap 4: Cross-Retailer Shopping Optimization

Section titled “🔴 Gap 4: Cross-Retailer Shopping Optimization”

User Prompts NOT Covered:

  • “Plan my shopping route to hit 3 stores efficiently”
  • “Should I buy milk at Store A or Store B?”
  • “Split my list across stores to maximize savings”
  • “Which store is best for my weekly shop?”

Current Limitation:

  • We know user’s retailers
  • We DON’T have: Route planning, multi-store optimization

User Prompts NOT Covered:

  • “Show me high-protein, low-sugar breakfast options”
  • “Find products suitable for my keto diet”
  • “Filter out products with allergens I’m sensitive to”
  • “Recommend healthier alternatives to what I buy”

Current Limitation:

  • No nutrition data on products
  • No dietary profile for users

Required Data:

Product {
nutrition: {
calories: 150,
protein_g: 12,
sugar_g: 4,
fat_g: 6
},
allergens: ["milk", "soy"],
diet_tags: ["keto-friendly", "high-protein"]
}
User -[:HAS_DIETARY_PROFILE]-> DietaryProfile {
restrictions: ["vegetarian"],
goals: ["high-protein", "low-sugar"],
allergens: ["nuts"]
}

User Prompts NOT Covered:

  • “What recipes can I make with what I have?”
  • “Show me recipes using Greek yogurt”
  • “Add recipe ingredients to my shopping list”
  • “Meal plan for the week based on my preferences”

Current Limitation:

  • No recipe graph
  • No ingredient mapping

Required Data:

Recipe {
name: "Greek Yogurt Parfait",
prep_time: 5,
servings: 2,
instructions: "..."
}
Recipe -[:REQUIRES {quantity: "1 cup"}]-> Product
Recipe -[:SUITABLE_FOR]-> DietType
User -[:SAVED_RECIPE]-> Recipe

User Prompts NOT Covered:

  • “How much do I spend on groceries per month?”
  • “Track my spending by category”
  • “Alert me when I’m over my weekly budget”
  • “Show me where I can cut spending”

Current Limitation:

  • We have purchase frequency (times)
  • We DON’T have: Spending amounts, budget tracking

Required Data:

PURCHASED {
times: 5,
qty: 10,
total_spent: 49.95, // NEW
avg_price: 4.99 // NEW
}
User {
monthly_grocery_budget: 500.0,
spending_alerts: true
}

User Prompts NOT Covered:

  • “What are people in my area buying?”
  • “Show me trending products in my neighborhood”
  • “Find shoppers with similar tastes”
  • “Share my shopping list with household”

Current Limitation:

  • get_local_trending exists but basic
  • No social graph
  • No household/family grouping

User Prompts NOT Covered:

  • “What if they’re out of this product?”
  • “Show me cheaper alternatives that are just as good”
  • “Find gluten-free version of this”
  • “Suggest a substitute for out-of-stock items”

Current Limitation:

  • find_similar_products exists but not context-aware
  • No stock status
  • No substitution reasoning

User Prompts NOT Covered:

  • “How close am I to my next reward tier?”
  • “Track progress on this month’s bonus offers”
  • “Show me completed vs. pending offers”
  • “What offers am I missing out on?”

Current Limitation:

  • get_points_balance shows balance
  • We DON’T have: Reward tiers, offer completion tracking

Phase 2: Store & Location Tools (4-6 weeks)

Section titled “Phase 2: Store & Location Tools (4-6 weeks)”

Enable location-based shopping with product availability and price comparison.

User Need: “Where can I buy this near me?”

Tool Spec:

{
"name": "find_product_at_stores",
"description": "Find which nearby retailers carry a specific product, with pricing and stock status",
"input": {
"user_id": "string (required)",
"product_id": "string (required)",
"max_distance_miles": "number (default: 10)",
"include_pricing": "boolean (default: true)"
},
"output": {
"product": {
"product_id": "string",
"name": "string",
"brand": "string"
},
"locations": [
{
"retailer_id": "string",
"name": "string",
"address": "string",
"distance_miles": 2.3,
"stock_status": "in_stock|low_stock|out_of_stock",
"price": 4.99,
"last_verified": "datetime"
}
],
"count": 3
}
}

Required Schema Changes:

// New relationship
CREATE (p:Product)-[:AVAILABLE_AT {
stock_status: "in_stock",
last_verified: datetime("2025-01-07T10:00:00Z"),
price: 4.99
}]->(r:Retailer)
// Add geo data to Retailer
Retailer {
lat: 41.8781,
lon: -87.6298
}

Implementation Effort: 1 week


User Need: “Where’s the cheapest option for this product?”

Tool Spec:

{
"name": "compare_prices_across_stores",
"description": "Compare prices for a product across user's preferred retailers",
"input": {
"user_id": "string (required)",
"product_id": "string (required)",
"max_distance_miles": "number (default: 10)"
},
"output": {
"product": {"product_id": "string", "name": "string"},
"price_comparison": [
{
"retailer": "Target",
"price": 4.99,
"on_sale": false,
"distance_miles": 2.3,
"user_visits_this_store": true
},
{
"retailer": "Walmart",
"price": 4.49,
"on_sale": true,
"original_price": 4.99,
"distance_miles": 3.1,
"user_visits_this_store": false
}
],
"cheapest": {
"retailer": "Walmart",
"price": 4.49,
"savings_vs_most_expensive": 0.50
}
}
}

Implementation Effort: 1 week


User Need: “Which store has everything on my list?”

Tool Spec:

{
"name": "get_store_inventory_for_list",
"description": "Check which nearby stores carry all/most items on a shopping list",
"input": {
"user_id": "string (required)",
"product_ids": "array of strings (required)",
"max_distance_miles": "number (default: 10)"
},
"output": {
"stores": [
{
"retailer_id": "string",
"name": "Target",
"distance_miles": 2.3,
"items_available": 8,
"items_out_of_stock": 2,
"coverage_percent": 80,
"estimated_total_price": 45.23,
"missing_products": ["PROD123", "PROD456"]
}
],
"recommendation": {
"best_single_store": "Target",
"best_multi_store_combo": ["Target", "Whole Foods"]
}
}
}

Implementation Effort: 2 weeks


User Need: “Alert me when this goes on sale”

Tool Spec:

{
"name": "track_price_changes",
"description": "Get price history and trends for a product",
"input": {
"user_id": "string (required)",
"product_id": "string (required)",
"lookback_days": "number (default: 90)"
},
"output": {
"product": {"product_id": "string", "name": "string"},
"current_price": 4.99,
"price_history": [
{"date": "2025-01-07", "price": 4.99, "retailer": "Target"},
{"date": "2024-12-15", "price": 5.49, "retailer": "Target"}
],
"statistics": {
"avg_price": 5.12,
"min_price": 4.49,
"max_price": 5.49,
"current_vs_avg": "3% below average",
"price_trend": "decreasing"
},
"recommendation": "Good time to buy - price is 3% below 90-day average"
}
}

Implementation Effort: 1 week


Add to Retailer:

Retailer {
retailer_id: "R123",
name: "Target",
address: "123 Main St",
city: "Chicago",
state: "IL",
zip: "60601",
lat: 41.8781, // NEW
lon: -87.6298, // NEW
venue_type: "grocery"
}

Add AVAILABLE_AT relationship:

CREATE (p:Product {product_id: "P123"})-[:AVAILABLE_AT {
stock_status: "in_stock",
last_verified: datetime("2025-01-07T10:00:00Z"),
price: 4.99,
on_sale: false,
original_price: null
}]->(r:Retailer {retailer_id: "R123"})

Add price history:

CREATE (p:Product)-[:HISTORICAL_PRICE {
price: 5.49,
effective_date: date("2024-12-15"),
end_date: date("2025-01-06")
}]->(r:Retailer)

Phase 3: Advanced Shopping Intelligence (6-8 weeks)

Section titled “Phase 3: Advanced Shopping Intelligence (6-8 weeks)”

Enable multi-store optimization, offer stacking, nutrition filtering, and budget tracking.

User Need: “Plan my shopping route efficiently”

Tool Spec:

{
"name": "optimize_shopping_route",
"description": "Optimize shopping route across multiple stores to minimize travel and maximize savings",
"input": {
"user_id": "string (required)",
"product_ids": "array of strings (required)",
"starting_location": "string (address or 'user_home')",
"optimization_goal": "enum: time|savings|points",
"max_stores": "number (default: 3)"
},
"output": {
"route": [
{
"stop_number": 1,
"retailer": "Target",
"address": "123 Main St",
"items_to_buy": ["PROD1", "PROD2"],
"estimated_cost": 25.48,
"points_earned": 500,
"travel_time_from_prev": 5
}
],
"summary": {
"total_stops": 2,
"total_distance_miles": 5.2,
"total_estimated_cost": 43.67,
"total_points": 850,
"estimated_time_minutes": 45,
"savings_vs_single_store": 6.32
}
}
}

Implementation Effort: 2 weeks


User Need: “What’s the best combo of offers?”

Tool Spec:

{
"name": "optimize_offer_stack",
"description": "Find the best combination of stackable offers for maximum points",
"input": {
"user_id": "string (required)",
"product_ids": "array of strings (optional - or use predictions)",
"use_predictions": "boolean (default: false)"
},
"output": {
"recommended_strategy": {
"total_points": 2500,
"offers_to_activate": [
{
"offer_id": "O123",
"title": "Dairy Bonus",
"points": 500,
"products_needed": ["PROD1", "PROD2"],
"stackable_with": ["O456"]
}
],
"purchase_order": [
{"product": "Greek Yogurt", "triggers_offers": ["O123", "O456"]},
{"product": "Milk", "triggers_offers": ["O123"]}
]
},
"stacking_rules": {
"max_stacks_per_product": 3,
"excluded_combinations": [["O789", "O101"]]
}
}
}

Implementation Effort: 2 weeks


User Need: “Show me high-protein, low-sugar options”

Tool Spec:

{
"name": "filter_by_nutrition",
"description": "Filter products by nutritional criteria and dietary preferences",
"input": {
"user_id": "string (required)",
"category": "string (optional)",
"nutrition_filters": {
"min_protein_g": "number (optional)",
"max_sugar_g": "number (optional)",
"max_calories": "number (optional)",
"min_fiber_g": "number (optional)"
},
"diet_tags": "array of strings (keto, vegan, gluten-free, etc.)",
"exclude_allergens": "array of strings",
"limit": "number (default: 20)"
},
"output": {
"products": [
{
"product_id": "string",
"name": "Greek Yogurt",
"nutrition": {
"calories": 150,
"protein_g": 12,
"sugar_g": 4,
"fat_g": 6,
"fiber_g": 0
},
"diet_tags": ["high-protein", "keto-friendly"],
"allergens": ["milk"],
"meets_all_criteria": true
}
],
"count": 15
}
}

Required Schema:

Product {
nutrition: {
calories: 150,
protein_g: 12,
sugar_g: 4,
fat_g: 6,
fiber_g: 0
},
allergens: ["milk", "soy"],
diet_tags: ["keto-friendly", "high-protein"]
}
User -[:HAS_DIETARY_PROFILE]-> DietaryProfile {
restrictions: ["vegetarian"],
goals: ["high-protein", "low-sugar"],
allergens: ["nuts"],
calorie_target: 2000
}

Implementation Effort: 2 weeks


User Need: “How much do I spend on groceries?”

Tool Spec:

{
"name": "track_spending_by_category",
"description": "Track spending patterns by category with budget alerts",
"input": {
"user_id": "string (required)",
"lookback_days": "number (default: 30)",
"group_by": "enum: category|store|brand|week"
},
"output": {
"spending_summary": {
"total_spent": 487.56,
"by_category": [
{
"category": "Dairy",
"spent": 125.43,
"percent_of_total": 25.7,
"vs_prev_period": "+12%"
}
],
"by_store": [
{"store": "Target", "spent": 312.45, "percent": 64}
]
},
"budget_status": {
"monthly_budget": 500.0,
"spent_this_month": 487.56,
"remaining": 12.44,
"on_track": false,
"alert": "You're at 97.5% of your monthly budget"
}
}
}

Required Schema:

PURCHASED {
times: 5,
qty: 10,
first: datetime,
last: datetime,
total_spent: 49.95, // NEW
avg_price: 4.99 // NEW
}
User {
monthly_grocery_budget: 500.0,
spending_alerts_enabled: true
}

Implementation Effort: 2 weeks


User Need: “What recipes can I make with what I have?”

Tool Spec:

{
"name": "find_recipe_matches",
"description": "Find recipes based on products the user owns or frequently buys",
"input": {
"user_id": "string (required)",
"min_coverage_percent": "number (default: 70)",
"dietary_restrictions": "array of strings (optional)",
"max_prep_time_minutes": "number (optional)"
},
"output": {
"recipes": [
{
"recipe_id": "string",
"name": "Greek Yogurt Parfait",
"prep_time": 5,
"servings": 2,
"ingredients_needed": [
{
"product_id": "PROD1",
"name": "Greek Yogurt",
"quantity": "1 cup",
"user_has": true
},
{
"product_id": "PROD2",
"name": "Granola",
"quantity": "1/4 cup",
"user_has": false,
"can_substitute_with": "PROD3"
}
],
"coverage_percent": 85,
"missing_ingredients_cost": 3.99
}
]
}
}

Required Schema:

Recipe {
recipe_id: "REC123",
name: "Greek Yogurt Parfait",
prep_time: 5,
cook_time: 0,
servings: 2,
instructions: "..."
}
Recipe -[:REQUIRES {
quantity: "1 cup",
unit: "cup",
optional: false
}]-> Product
Recipe -[:SUITABLE_FOR]-> DietType {name: "vegetarian"}
Recipe -[:TAGGED_AS]-> MealType {name: "breakfast"}

Implementation Effort: 3 weeks


User Need: “What if they’re out of this?”

Tool Spec:

{
"name": "suggest_substitutes",
"description": "Suggest product substitutes when original is unavailable or too expensive",
"input": {
"user_id": "string (required)",
"product_id": "string (required)",
"reason": "enum: out_of_stock|price|dietary",
"max_price_difference_percent": "number (default: 20)"
},
"output": {
"original_product": {
"product_id": "string",
"name": "Brand A Greek Yogurt",
"price": 4.99,
"stock_status": "out_of_stock"
},
"substitutes": [
{
"product_id": "PROD456",
"name": "Brand B Greek Yogurt",
"similarity_score": 0.92,
"price": 4.49,
"price_difference": -0.50,
"stock_status": "in_stock",
"reason": "Similar brand, same category, slightly cheaper",
"user_has_purchased": false
}
],
"best_match": {
"product_id": "PROD456",
"confidence": "high"
}
}
}

Implementation Effort: 1 week


Add nutrition data:

Product {
nutrition: {
calories: 150,
protein_g: 12,
carbs_g: 8,
sugar_g: 4,
fat_g: 6,
fiber_g: 0,
sodium_mg: 75
},
allergens: ["milk", "soy"],
diet_tags: ["keto-friendly", "high-protein", "gluten-free"]
}

Add user dietary profile:

User -[:HAS_DIETARY_PROFILE]-> DietaryProfile {
restrictions: ["vegetarian"],
goals: ["high-protein", "low-sugar"],
allergens: ["nuts", "shellfish"],
calorie_target: 2000
}

Add spending data:

PURCHASED {
times: 5,
qty: 10,
first: datetime,
last: datetime,
total_spent: 49.95,
avg_price: 4.99,
timestamps: [datetime, datetime, ...]
}
User {
monthly_grocery_budget: 500.0,
spending_alerts_enabled: true
}

Add recipe graph:

Recipe {
recipe_id: "REC123",
name: "Greek Yogurt Parfait",
prep_time: 5,
servings: 2,
difficulty: "easy",
cuisine: "american"
}
Recipe -[:REQUIRES {quantity: "1 cup", optional: false}]-> Product
Recipe -[:SUITABLE_FOR]-> DietType
Recipe -[:TAGGED_AS]-> MealType
User -[:SAVED_RECIPE]-> Recipe
User -[:MADE_RECIPE {date: datetime}]-> Recipe

Add offer stacking rules:

Offer {
offer_id: "O123",
stackable: true,
max_stacks: 3,
excluded_offers: ["O456", "O789"]
}
Offer -[:STACKS_WITH]-> Offer

Theme: Location & Price Intelligence

Week 1-2:

  • Add lat/lon to Retailer nodes
  • Create AVAILABLE_AT relationship schema
  • Implement find_product_at_stores tool
  • Add geo-distance calculation helper

Week 3-4:

  • Add price tracking schema
  • Implement compare_prices_across_stores tool
  • Implement track_price_changes tool
  • Add price history data ingestion

Week 5-6:

  • Implement get_store_inventory_for_list tool
  • Add multi-store comparison logic
  • Integration tests for all Phase 2 tools
  • Documentation and examples

Deliverables:

  • 4 new tools
  • Product availability data
  • Price comparison capabilities
  • Store-level inventory checking

Estimated Cost: $30-45K (2 engineers, 6 weeks)


Theme: Advanced Intelligence & Optimization

Week 7-9:

  • Add nutrition schema to Product
  • Add DietaryProfile for users
  • Implement filter_by_nutrition tool
  • Add dietary restriction filtering

Week 10-11:

  • Add spending data to PURCHASED
  • Add budget tracking to User
  • Implement track_spending_by_category tool
  • Add budget alert logic

Week 12-13:

  • Create Recipe graph schema
  • Implement find_recipe_matches tool
  • Add recipe data ingestion
  • Create Recipe → Product mappings

Week 14:

  • Implement optimize_shopping_route tool
  • Implement optimize_offer_stack tool
  • Implement suggest_substitutes tool
  • Integration tests for Phase 3

Deliverables:

  • 6 new tools
  • Nutrition filtering
  • Budget tracking
  • Recipe integration
  • Multi-store optimization

Estimated Cost: $50-70K (2-3 engineers, 8 weeks)


  1. find_product_at_stores - Product location finder
  2. compare_prices_across_stores - Price comparison
  3. get_store_inventory_for_list - Multi-store inventory check
  4. track_price_changes - Price history and trends
  1. optimize_shopping_route - Multi-store route planning
  2. optimize_offer_stack - Offer stacking optimization
  3. filter_by_nutrition - Nutrition-based filtering
  4. track_spending_by_category - Budget and spending analytics
  5. find_recipe_matches - Recipe recommendations
  6. suggest_substitutes - Smart product substitution

  • Product location query latency: <300ms
  • Price comparison accuracy: >95%
  • Store inventory coverage: >80% of products
  • User adoption: 40% of active users
  • Shopping route optimization savings: >15% vs. single store
  • Offer stacking points increase: >25%
  • Nutrition filter relevance: >90% match rate
  • Recipe match coverage: >70% ingredients owned

  1. Data Availability - Product availability and pricing data may not exist

    • Mitigation: Partner with retailers for data feeds, or use web scraping
  2. Data Freshness - Stock and price data goes stale quickly

    • Mitigation: Real-time APIs, cache with short TTL (15-30 min)
  3. Geo-data Quality - Retailer location data may be incomplete

    • Mitigation: Geocoding service, user-verified locations
  1. Complexity - Multi-store optimization is computationally expensive

    • Mitigation: Pre-compute common routes, cache results
  2. User Privacy - Location tracking and spending analytics

    • Mitigation: Opt-in features, clear privacy controls

  1. Prioritize Phase 2 tools by user demand
  2. Validate data availability with retail partners
  3. Prototype find_product_at_stores as proof of concept
  4. Design data ingestion pipeline for product availability
  5. Begin Week 1 implementation of Phase 2

  • “What have I bought recently?” → get_user_purchase_history
  • “What stores do I visit?” → get_user_retailers
  • “When do I need to buy coffee again?” → predict_repurchases
  • “What offers am I eligible for?” → get_active_offers
  • “Show me products similar to this” → find_similar_products
  • “How many points do I have?” → get_points_balance
  • “Where can I buy this product?” → find_product_at_stores
  • “Where’s the cheapest option?” → compare_prices_across_stores
  • “Which store has everything on my list?” → get_store_inventory_for_list
  • “Has the price changed?” → track_price_changes
  • “Plan my shopping route” → optimize_shopping_route
  • “What’s the best offer combo?” → optimize_offer_stack
  • “Show me high-protein options” → filter_by_nutrition
  • “How much do I spend on groceries?” → track_spending_by_category
  • “What recipes can I make?” → find_recipe_matches
  • “What if they’re out of this?” → suggest_substitutes