Loki Docs
Tools › Habits › Update a habit

Update a habit

update_habitChanges
What it does
Changes or deletes something you had. Your assistant can ask you to confirm first. Safe to retry: the same call twice changes nothing more.
Permission
Habits, change habits:write

What your assistant is told

Edit an existing habit. Every field except habit_id is optional — pass only what changes (null/omitted = leave as-is). You can adjust the target, unit, schedule, colour/icon, or replace the reminder set. Editing a schedule is SAFE and is the right tool here. Schedules are versioned with effective dates: a change applies from today FORWARD and never rewrites how past days were judged. Do NOT archive and recreate a habit in order to change it — that abandons the user's history for no reason. schedule_type is only needed when the CADENCE SHAPE changes. Adjusting the current shape — a different weekday_mask on a weekdays habit, a new per_week on a per-week one, a new interval_days — takes effect on its own. Send schedule_type when you mean to switch shapes, because a field the current shape has no room for (a weekday mask on an every-N-days habit) is ignored. FLIPPING THE GOAL'S DIRECTION NEEDS A CLEAR FLAG. Omitting a bound means "leave it alone", so target_max: 2 on an "at least 8" habit keeps the floor and stores min 8 / max 8 — "exactly 8", which is not what anyone asked for. Say which bound goes away: - floor → ceiling: target_max: 2, clear_target_min: true - ceiling → floor: target_min: 10, clear_target_max: true - either → no target at all: clear_target_min: true, clear_target_max: true - a band ("sleep 7-9h"): both bounds, no flags Setting a bound and clearing it in the same call is invalid_target, and so is an upper bound below a lower one when you pass both. Two consequences worth telling the user BEFORE you commit an edit: - Changing the scoring unit (a day-based schedule ↔ a weekly one) or flipping the target's direction (do-more ↔ ceiling) RESETS the streak. The previous run is preserved as its own record, but the visible number starts again. - Everything else — a bigger target, a different weekday mask, a new unit label — leaves the streak intact. Confirm changes with the user first, and say which of the two applies. Then read back the returned sentence and edge_case verbatim — they describe the habit as it now stands, not as you intended it.

Parameters

  • habit_idid, requiredThe habit to edit.
  • nametext, optionalNew name.
  • target_minwhole number, optionalNew lower bound per day/period ("at least this much").
  • target_maxwhole number, optionalNew upper bound per day/period (a ceiling; 0 with no target_min means abstinence).
  • clear_target_mintrue or false, optionalRemove the lower bound entirely — what turns a "do at least N" habit into a ceiling. Omitting target_min only leaves it unchanged.
  • clear_target_maxtrue or false, optionalRemove the upper bound entirely — what turns a ceiling or a band into a plain "do at least N". Omitting target_max only leaves it unchanged.
  • entry_filter_minwhole number, optionalNew minimum size for a single entry to count.
  • entry_filter_maxwhole number, optionalNew maximum size for a single entry to count.
  • gap_minuteswhole number, optionalNew minimum minutes between entries.
  • timer_minuteswhole number, optionalNew timer length in minutes; 0 removes the timer.
  • unittext, optionalNew unit label.
  • schedule_typetext, optionalNew schedule: daily | weekdays | everyndays | timesperweek | sessionsperweek | weeklytotal | none.
  • weekday_maskwhole number, optionalNew weekday bitmask (bit 0 = Mon … bit 6 = Sun).
  • per_weekwhole number, optionalNew per-week count (times/sessions per week).
  • interval_dayswhole number, optionalNew every-N-days interval.
  • since_lasttrue or false, optionalNew every-N-days anchoring: true re-anchors on each completion.
  • colortext, optionalNew colour hex.
  • icontext, optionalNew icon token.
  • descriptiontext, optionalNew description.
  • reminderslist of object, optionalReplace the reminder set with these (omit to leave reminders unchanged).
  • tztext, optionalIANA time zone, e.g. "Europe/Bucharest". Omit to use the user's profile zone; the schedule change takes effect from that zone's today.