Guide · Quips & the coordinator

Push, don't pull

Quips are short messages the pet says while idle. Instead of plugins returning static lists that the host polls on every tick, Petty uses a push model: call petty.quips.suggest() when you have something to say, and the host QuipCoordinator decides when (and whether) to show it.

The mental model

  • You push suggestions into the coordinator as context changes.
  • The host picks one per cadence tick, scoring by urgency minus plugin/category cooldowns, filtering anything recently shown.
  • High urgency preempts. A suggestion with urgency ≥ 80 fires immediately, bypassing the tick.
  • Expired suggestions self-prune. Default TTL is 5 minutes, configurable per suggestion.
  • Stable ids replace in place. Re-submitting with an existing id overwrites the prior entry — the natural way to keep state-tracked quips in sync.

Contributing quips

Declare the quips capability (informational only) and call suggest() from wherever your context updates.

function onLoad() {
  petty.schedule.interval("hydrate-push", 300000, pushHydrate);
  pushHydrate();
}

function pushHydrate() {
  petty.quips.suggest("Did you remember to hydrate?", {
    category: "wellness:hydrate",
    urgency: 5,
    expiresIn: 1800
  });
}

State-tracking quips (replace-by-id)

When your plugin's state changes, re-submit with the same id and the coordinator replaces the previous entry. When the state goes away, retract() the id.

function poll() {
  var dirty = checkGitDirty();
  if (dirty > 0) {
    petty.quips.suggest("You have " + dirty + " uncommitted files.", {
      id: "git-dirty",
      urgency: 15,
      category: "git:dirty",
      expiresIn: 600
    });
  } else {
    petty.quips.retract("git-dirty");
  }
}

Refreshing a batch

When you pull a fresh batch from the network, clear() the previous batch and push the new one. Per-plugin scope means you only affect your own suggestions.

function onQuotesFetched(quotes) {
  petty.quips.clear();
  for (var i = 0; i < quotes.length; i++) {
    petty.quips.suggest(quotes[i], {
      id: "quote-" + i,
      category: "flavor:quote",
      urgency: 5
    });
  }
}

Urgency tiers

RangeUse for
0–20Ambient / flavor chatter
21–50Contextual (“3 dirty files”, “weather is raining”)
51–79Notable but not urgent (“meeting in 15 min”, “stale uncommitted changes”)
80–100Must-see, preempts the cadence immediately (“meeting in 1 min”, “battery at 5%”)

Direct showBubble still exists

For synchronous event reactions (pomodoro break, claude-code task-complete, spotify track change), keep calling petty.pet.showBubble() directly. The coordinator is specifically for ambient/contextual chatter where you want the host to decide timing.

Chattiness

Users control overall cadence via Settings → Chatter → Chattiness (low / medium / high). The host picks it up automatically — plugins don't need to know about it.