Location

Status: built (v0.1). Plugin location, src/location.rs, Android LocationService.

What it does

The phone notes where it is about every 5 minutes and sends the points to the server. The server turns them into visits and places, so the assistant can answer "where was I on Tuesday?", "how long was I at the gym?", and "where do I go most?".

Phone (battery)

Server

POST   /v1/location/points     {points: [{ts, lat, lon, acc}]}   device or client token
GET    /v1/location/points     ?from=&to= (unix seconds)          raw points
GET    /v1/location/now        last point, the place there, since when
GET    /v1/location/visits     ?from=&to= (local dates)           visits, newest first
GET    /v1/places              ?q=                                places by visits
POST   /v1/places              {name, lat?, lon?, radius?}        name where you are now (or a spot)
GET    /v1/places/{id}
PATCH  /v1/places/{id}         {name, radius?}                    your name always wins
DELETE /v1/places/{id}         forget it (its visits stay, without a place)

Stays. Points within 120 m of the stay's middle belong to the same stay. A stay of 15 minutes or more is a visit; a visit belongs to the nearest place whose circle (radius, default 100 m) holds it, or to a new place. Points less exact than 250 m are stored but do not move stays.

Names. A place with no name is looked up once it has a visit of 45 minutes or more, or 3 visits: the core asks OpenStreetMap Nominatim (AGENT_GEOCODE_BASE, default nominatim.openstreetmap.org) with a clear User-Agent, one request a second at most, each place at most once a day.

It keeps the place's own name, else its kind (amenity, shop, leisure), else the street. A name the user gives (POST/PATCH /v1/places, or the name_place tool) is never replaced.

Keeping. Raw points are kept AGENT_LOCATION_KEEP_DAYS (default 90). Visits and places stay until forgotten. Export includes them.

Privacy and trust

Place triggers (automations by telling the assistant)

The user says "remind me to walk the dog when I get home" and the assistant sets it up itself with scheduler tools; nothing is hand-built per request.

Geofences (fast arrive and leave)

The phone watches circles itself, so a place reminder does not wait for the 15 minute batch of points. No Google services: Android's own proximity alerts (Fences.kt).

GET  /v1/location/fences       places an active place job waits on: [{id, name, lat, lon, radius}]   device or client token
POST /v1/location/transitions  {place, what: "arrive"|"leave", ts?}                                  device or client token

Instant delivery and buttons

Place and time together, and ideas

Noticing (leaving home, gym visits, phone notices)

src/detect.rs. Five switches, all on by default: GET /v1/detected/settings (device, client or owner), PATCH /v1/detected/settings {leave_home, gym, parcel, bill, plan, home_place?} (owner or client). Page: Settings, Noticing.

Travel time and "time to leave"

src/travel.rs. Tool travel_time {to, mode?} in the location plugin: from the phone's last point (no older than 2 hours) to to, which is a place the user named or an address.