# How we keep the office kitchen stocked

Anyone can ask for snacks with a Slack shortcut. Once a week an agent rounds up the requests, puts together an order, and posts it for the office manager to approve before a penny is spent.

Canonical page: https://themachine.myapps.ai/use-cases/office-snacks

Somebody always wants more of the good crackers, and nobody quite owns the job
of buying them. Asks turn up in Slack threads, chats by the coffee machine and
notes stuck to the fridge. The office manager pieces it all into an order, and
by the time it goes in, half the asks have been forgotten. Nothing much rides
on it, but it never stops.

These days an agent on Machine looks after it. People ask for snacks with a
Slack shortcut. Once a week the agent pulls every ask together, builds the
order and posts it for the office manager to approve. Nothing gets bought until
a person says yes.

- **Team:** Machine
- **Control surface:** Slack, where people ask and approve
- **Connected systems:** Slack · Ordering account
- **Mode:** One batch a week · a person approves

## The problem

Snack asks trickle in one by one, from all over. One person posts in a
channel, another mentions it walking past, and the office manager is left
building a list from memory. Some asks get lost, some get counted twice, and
the order goes out later than it should.

It's an easy job, just a never-ending one. What it needs is a single place to
ask, a regular moment to gather everything up, and a human yes before money
leaves the account. A shared spreadsheet doesn't give you that, and neither
does a repeating calendar reminder.

## What we built

There is now one way to ask: a Slack shortcut. Each week a cron trigger starts
a fresh, isolated session, a clean cloud computer just for that run. It
gathers the week's asks, builds an order in the ordering account, and posts the
draft in Slack for the office manager to approve. It only places the order once
that approval arrives.

## How it works

### Take asks through a Slack shortcut

We connect Slack as a **channel**, and people make their requests with a
shortcut. Every ask is added to this week's batch. There's a single place to
ask, and nobody has to keep a running list in their head.

### Gather them once a week

A **cron trigger** is a timer that goes off weekly. Each time, Machine starts
a new **session**, a clean sandbox for that run alone. It collects everything
asked for since the last order. One run, one sandbox, thrown away afterwards.

### Hand it the shopping rules

The vendor we prefer, the budget, the staples that always go in, and how to
fold duplicate asks into one line are kept as **skills** and **memory**, the
playbook the agent reads each run. When tastes or the budget change, we update
it.

### Connect Slack and the ordering account

The agent reaches each tool through a **connector**, a narrow link whose keys
stay on our servers, so the model never handles a raw token. With those, it
can:

- **See the asks in Slack.** Everything sent in through the shortcut this week.
- **Fill a cart in the ordering account.** It builds the order with the vendor
but stops short of checkout.
- **Post in Slack.** The draft order, for the office manager to look over.

### Approve before anything is bought

The draft order waits at a **human approval gate** in Slack. The office manager
sees the whole cart and the total, and nothing is bought until they approve.
The ordering account's credentials are stored encrypted in the **Secrets
Manager** and only handed to the agents you grant them to.

> **The pattern**
> Take asks through a Slack **channel** shortcut, gather them with a **cron
> trigger**, keep the vendor and budget rules in **skills** and **memory**, and
> park the order at a **human approval gate** before any money moves. Asks go
> in one door, and one approved order comes out.

## Guardrails

The agent can put together an order that costs real money, so even a small
job like this one gets proper limits:

- **Isolation.** Every weekly run gets a sandbox to itself. The only things
  allowed out are the draft order and the Slack post it is cleared to send.
- **Scoped secrets.** The ordering account's key is stored encrypted in the
  **Secrets Manager** and only handed to the agents you grant it to, when the
  sandbox starts.
- **Human approval gates.** No order is placed until the office manager says
  yes to the draft in Slack.
- **Everything is code.** Vendor, budget, staples and the weekly schedule are
  versioned files in the repo, changed only through a reviewed **change
  request**, never a dashboard toggle.

## The outcome

- **Weekly:** Every ask rolled into one order, on schedule
- **One place:** Each request arrives through the same Slack shortcut
- **Approve first:** No purchase happens without a person's yes

Asks no longer go missing, doubles get merged, and the office manager checks a
ready-made order instead of building one from scratch. Spending still waits for
a person, so the busywork is gone and the agent never buys anything on its own.
