goplaces-togo
Goal
Help the user pick one place to visit from their saved Google Places list by fetching live details (rating, hours, reviews) via the goplaces CLI, incorporating the user's own notes, their stated cuisine and location preferences, and their visit history — then making a clear, opinionated recommendation.
Prerequisites
goplacesbinary is installed and on PATH.GOOGLE_PLACES_API_KEYenvironment variable is set.- Google Takeout saved places CSV — export once from https://takeout.google.com:
- Click "Deselect all", then check only "Saved"
- Click "Next step" → "Export once" → "Create export"
- Download the zip and find the CSV at
Takeout/Saved/Saved Places.csv - Give the agent the file path — it will import and remember it automatically
- A local data file at
skills/goplaces-togo/goplaces-visits.jsonpersists the imported list and visit history (created automatically on first use).
Data file schema
skills/goplaces-togo/goplaces-visits.json is the single source of truth for all persistent state:
{
"savedList": [
{
"name": "string",
"mapsUrl": "string | null",
"placeId": "string | null",
"city": "string | null",
"userComment": "string | null",
"addedAt": "YYYY-MM-DD"
}
],
"places": {
"<place_id>": {
"name": "string",
"city": "string | null",
"visits": [
{ "date": "YYYY-MM-DD", "time": "HH:MM", "note": "string | null" }
]
}
}
}
savedList— the user's saved places, persisted so they don't have to paste it again.savedList[].city— normalised city name resolved via the Places API; used to filter by city before scoring.places— keyed byplace_id, holds visit history for recording and recency scoring.
Steps
1. Load or ask for the saved list
Read skills/goplaces-togo/goplaces-visits.json. Check whether savedList exists and has at least one entry.
If a saved list exists, show it to the user and ask:
I have your saved list from last time:
- <name> — <userComment or "(no note)">
- ...
Use this list, or provide a new CSV to replace it? (Press Enter to use the existing list.)
- If the user presses Enter or says "use it" / "yes" / similar affirmation → keep
savedListas-is and proceed. - If the user provides a new CSV file path or pastes CSV content → replace
savedListwith the newly parsed entries (see Step 2), write to disk, then proceed. - If the user says "add" or "update" followed by a new CSV → merge: add new entries, keep existing ones that are not duplicates (match on
namecase-insensitively ormapsUrl). Write merged list to disk.
If no saved list exists, say exactly:
I need your Google saved places list. Here's how to get it:
- Go to https://takeout.google.com
- Click "Deselect all", then scroll down and check only "Saved"
- Click "Next step" → "Export once" → "Create export"
- Download the zip, open it, and find the CSV file inside the Saved/ folder (e.g.
Saved Places.csv)- Share the file path or paste its contents here
Wait for the user to provide the CSV before proceeding to Step 2.
2. Parse the CSV and extract user comments
The CSV exported from Google Takeout has this header and format:
Title,Note,URL,Tags,Comment
Gochi Cupertino,,https://www.google.com/maps/place/Gochi+Cupertino/data=!4m2!3m1!1s0x808fb5c78e1841e7:0xf8efac3fb5ce0b40,,
Kunjip Tofu,Fine and good for date,https://www.google.com/maps/place/Kunjip+Tofu/data=!4m2!3m1!1s0x808fb10003a9a597:0xe41f61b5ba1b2f19,,
For each non-empty data row (skip the header and blank rows):
Title→nameNote→userComment(usenullif empty)URL→mapsUrl— store as-is for reference; do not attempt to extract a place ID from the URL path, as the hex values indata=!4m2!3m1!1s<hex>are Google's internal CID format, not Places API IDsTags,Comment→ ignore for now- Set
addedAtto today's date - Store
{ name, mapsUrl, userComment, addedAt, placeId: null }
After parsing, write the resulting array to savedList in skills/goplaces-togo/goplaces-visits.json immediately, before doing any API calls. This ensures the list is never lost even if the session ends early.
3. Classify each place by city
For every entry in savedList where city is null, resolve the place name to get its city:
goplaces resolve "<place name>" --limit 1 --json
From the result, extract the city using this priority order:
candidates[0].addressComponents— find the component withtypescontaining"locality"→ use itslongText- Fall back to the component with
typescontaining"administrative_area_level_2"→ use itslongText - Fall back to parsing the city token from
candidates[0].formattedAddress(typically the second comma-separated segment, e.g."Gochi, Cupertino, CA 95014"→"Cupertino") - If all fail, set
citytonulland note the entry as unclassified
Normalise city names to title case (e.g. "cupertino" → "Cupertino"). Store placeId from candidates[0].place_id at the same time — no need to re-resolve in Step 4.
After classifying all entries, write the updated savedList (with city and placeId filled in) back to disk.
Show the user a summary grouped by city:
Found N places across X cities:
- Cupertino (3): Gochi Cupertino, Eilleen's Kitchen, ...
- Santa Clara (2): Pho to Chau 999, ...
- Unclassified (1): Some Place Name
4. Ask which city they are in today
Say exactly:
Which city are you in today? (or press Enter to search all cities)
- If the user names a city → filter
savedListto entries wherecitymatches (case-insensitive). Use only these for scoring. If the city has zero matches, say so and ask again or offer to search all. - If the user presses Enter or says "all" / "anywhere" → use the full
savedList. - Store the chosen city as
currentCity(ornullfor all) in memory for this session.
5. Ask for cuisine and location preferences
Say exactly:
What cuisine or type of food are you in the mood for today? And do you have a preferred neighbourhood or area? (Press Enter to skip either.)
Wait for the user's response. Parse two optional values:
cuisinePreference— e.g. "Japanese", "Italian", "anything spicy",nullif skipped.locationPreference— e.g. "Shibuya", "within 2km of Shinjuku Station",nullif skipped.
If the user skips both, proceed without preference filtering.
6. Resolve any remaining unresolved place IDs
Step 3 already resolved and stored placeId for newly imported entries. Only re-run resolve for entries that still have placeId: null (e.g. manually added entries):
goplaces resolve "<place name>" --limit 1 --json
Parse the JSON. Take candidates[0].place_id. Also backfill city if it is still null. If the result is empty, mark the entry as unresolvable and skip it (report at the end).
7. Fetch details for each place ID
goplaces details <place_id> --reviews --json
Collect the following fields for each place:
displayName.text— human namecurrentOpeningHours.openNow— is it open right now?rating— overall rating (0–5)userRatingCount— number of reviewspriceLevel— 0 (free) to 4 (very expensive)primaryTypeortypes[]— cuisine/category tagslocation—{ latitude, longitude }for distance scoringreviews[0].text.text— top review snippet (first 150 chars)editorialSummary.text— one-line editorial blurb if present
8. Load visit history
The places section of skills/goplaces-togo/goplaces-visits.json was already read in Step 1. For each place in the working list, look up its place_id in places and derive:
visitCount— length of thevisitsarray (0 if the key is absent).daysSinceLastVisit— days between today andvisits[last].date(nullif never visited).
9. Score and rank
Compute a score for each resolved place. All bonus terms are additive.
base = rating * log10(max(userRatingCount, 1))
open = openNow ? +1.0 : -2.0
# Cuisine preference bonus (apply if cuisinePreference is set)
# Check if place types or editorial summary contain the preference keyword (case-insensitive)
cuisine = cuisineMatch ? +2.0 : 0.0
# Location preference bonus (apply if locationPreference is set)
# Resolve locationPreference to lat/lng via: goplaces resolve "<locationPreference>" --limit 1 --json
# Compute haversine distance in km between place.location and preference location
# distance_km = haversine(place.lat, place.lng, pref.lat, pref.lng)
location = distance_km <= 1 ? +2.0
: distance_km <= 3 ? +1.0
: distance_km <= 10 ? +0.0
: -1.0
# If locationPreference is null, location bonus = 0
# User comment sentiment bonus
# If userComment is not null, read it holistically:
# - Positive signals (e.g. "great", "love", "best", "go often") → +1.5
# - Negative signals (e.g. "meh", "overrated", "avoid", "disappointing") → -1.5
# - Conditional signals (e.g. "only on weekdays", "good for lunch") →
# evaluate against current day/time; match → +0.5, mismatch → -0.5
# - No clear signal → 0
comment = <sentiment score from userComment>
# Recency penalty — discourage going to the same place too soon
recency = visitCount == 0 ? +0.5 # never visited bonus
: daysSinceLastVisit <= 7 ? -2.0
: daysSinceLastVisit <= 30 ? -0.5
: 0.0
score = base + open + cuisine + location + comment + recency
Rank places by score descending. Exclude unresolvable entries from the ranking but list them at the end.
10. Recommend exactly one place
Present the top-ranked place as your recommendation using this format:
Recommended: <Place Name>
- Open now: Yes / No
- Rating: X.X / 5 (N reviews)
- Price: $ / $$ / $$$ / $$$$ (omit if unavailable)
- Your note: "<userComment>" (omit if null)
- Visits: N times (last: YYYY-MM-DD) / Never visited
- Why: <one or two sentences drawing on editorial summary, top review, user comment, and how it matches their preferences>
goplaces details <place_id> --reviews
(Run the above to see full hours, phone, and website.)
Then list the remaining resolved places as a ranked table:
| Rank | Place | Rating | Open | Visits | Score |
|---|---|---|---|---|---|
| 2 | ... |
Finish with any unresolvable entries: "Could not look up: X, Y — please check the spelling or paste Google Maps URLs."
If only one place was provided, still confirm it looks good (or flag if it is closed, poorly rated, or visited very recently).
11. Confirm selection and record the visit
After showing the recommendation, ask:
Are you going to <Place Name>? Say "yes" to log this visit, or tell me which place from the list you picked instead.
Wait for the user's response.
-
If the user confirms a place (by saying yes or naming one), record the visit:
- Read
skills/goplaces-togo/goplaces-visits.json(already loaded; use in-memory copy). - Ensure
places["<place_id>"]exists; create it with{ name, visits: [] }if not. - Append a new visit entry:
Use today's date and the current local time (24-hour format). Do not touch{ "date": "YYYY-MM-DD", "time": "HH:MM", "note": null }savedList. - Write the full updated object (both
savedListandplaces) back toskills/goplaces-togo/goplaces-visits.json. - Confirm: "Logged your visit to <Place Name> on <date> at <time>. Have a great time!"
- Read
-
If the user says no or skips, say "No worries — enjoy your day!" and do nothing.
12. Handle edge cases
- No places resolved: Tell the user none of the entries could be matched and ask them to double-check names or paste Google Maps URLs instead.
- All places closed: State that all options appear closed right now, rank by score anyway, and caveat the recommendation.
- Location resolution fails: Skip the location bonus for all places and note that the area could not be resolved.
- API error: Surface the error message and ask the user to verify
GOOGLE_PLACES_API_KEY. - History file corrupt: Warn the user, treat both
savedListandplacesas empty, and do not overwrite until the user provides a list or confirms a visit. - User wants to clear the list: If the user says "clear my list" or "forget my places", set
savedListto[]inskills/goplaces-togo/goplaces-visits.json(keepplaceshistory intact) and confirm: "Your saved list has been cleared. Paste a new list whenever you're ready." - User wants to remove one entry: If the user says "remove <name>", delete the matching entry from
savedListby name (case-insensitive), write to disk, confirm removal. Leaveplaceshistory for that place_id untouched. - City classification fails for some entries: Proceed normally; list unclassified entries under "Unclassified" in the city summary. If the user picks a city, exclude unclassified entries from that city's pool but offer: "I also have N unclassified places — include them?"
- User's city has only one place: Recommend it directly (skip scoring), but flag if it is closed or poorly rated.
Capture behavior
These phrases can be said at any point — not just during the recommendation flow. Detect the intent and act immediately without requiring the user to be in a specific step.
Retroactive visit logging
| User says | Action |
|---|---|
| "I went to Nobu last night" | Resolve "Nobu" against savedList (or run goplaces resolve). Ask: "Got it — what time did you go? (or press Enter to skip)". Log visit with yesterday's date and provided time (or null). |
| "We ended up going to that ramen place on Saturday" | Identify the place (clarify if ambiguous). Ask for time, then log with the Saturday date. |
| "Just got back from Trattoria Roma" | Log visit with today's date and current time. |
| "I visited 3 places this week: X, Y, Z" | Log all three sequentially. For each, ask "What day and time for X?" then record. |
Post-visit feedback
| User says | Action |
|---|---|
| "It was amazing" / "Loved it" | Find the most recently logged place (today or last visit). Set note on that visit entry to a positive summary. Update userComment in savedList entry to reflect the positive sentiment. |
| "It was just okay" / "Nothing special" | Same as above but neutral note. |
| "Disappointing, won't go back" | Log negative note on that visit. Update userComment in savedList to "disappointing — avoid". This will feed a -1.5 comment penalty in future scoring. |
| "Great for lunch but too loud for dinner" | Log as conditional note. Update userComment to "good for lunch, too loud for dinner". Future scoring will match against time-of-day. |
| "The omakase was worth it, go on weekdays" | Update userComment in savedList to the verbatim advice. Confirm: "Updated your note for <Place>." |
City browsing
| User says | Action |
|---|---|
| "What cities do I have?" | Group savedList by city and print each city with the count and names of places in it. |
| "Show me my Tokyo places" | Filter savedList to city == "Tokyo" and list them with userComment and visit count. |
| "I'm in San Jose today" | Set currentCity = "San Jose" for this session, filter the working list accordingly, and jump straight to Step 5. |
| "Show places near Cupertino" | Resolve "Cupertino" to lat/lng, then re-score using location bonus for all places regardless of city. |
List management
| User says | Action |
|---|---|
| "Add Sukiyabashi Jiro to my list" | Append { name: "Sukiyabashi Jiro", mapsUrl: null, placeId: null, userComment: null, addedAt: today } to savedList. Confirm: "Added Sukiyabashi Jiro to your list." |
| "Add Pizza Pilgrims — good for groups" | Parse name + comment from the phrase. Append with userComment: "good for groups", mapsUrl: null. |
| "Here's my updated Takeout CSV: <path>" | Re-parse the CSV and merge into savedList: add new entries, update userComment for existing names, preserve visit history. |
| "Remove Shake Shack from my list" | Delete matching savedList entry (case-insensitive). Confirm removal. |
| "Show me my list" | Print all savedList entries: index, name, userComment, visit count from places. |
| "How many times have I been to Nobu?" | Look up the place in places, count visits. Reply: "You've been to Nobu 4 times. Last visit: 2025-11-03." |
| "What did I think of Trattoria Roma?" | Find the entry's userComment and the note fields on its visits. Summarise them. |
Preference shortcuts
| User says | Action |
|---|---|
| "Surprise me" | Skip Step 3 entirely (no preference). Run full scoring and recommend top result. |
| "Something near me" | Ask "What's your current neighbourhood or landmark?" then use that as locationPreference. |
| "I want Japanese, anywhere is fine" | Set cuisinePreference = "Japanese", locationPreference = null. Jump straight to scoring. |
| "Same as last time" | Reuse the cuisinePreference and locationPreference from the previous session if stored; otherwise ask again. Store last-used preferences under "lastPreferences": { cuisine, location } in skills/goplaces-togo/goplaces-visits.json. |