# Bootstrap edit
<!--
ref: @protocol/bootstrap-edit
type: protocol
triggers: [user requests protocol addition, protocol not read in 14 days, new user setup, protocol fetched multiple times, should this go in the bootstrap, bootstrap inclusion criteria, add a route to the bootstrap, is it found without a mention]
trigger_prompt: When the user needs to optimize their session environment by adding or removing protocols based on usage patterns or when setting up a new user.
version: 6
updated_at: 2026-10-20T17:52:49.161Z
-->

How an agent edits the user's bootstrap on their behalf — what to add, when to demote, how to confirm.

The user's bootstrap shapes what every agent in their account loads at
session start. As an agent you can read it and propose edits — adding a
protocol you keep fetching, demoting one nobody reads, or provisioning a
fresh user's stack from scratch.

This is one of the most direct levers you have on the user's long-term
working environment. Use it deliberately.

## When to add

Add an include when:

- **The user's agents fetch this protocol ≥3 times in a week** without it
  being in the bootstrap. (Check `/user/bootstrap/suggestions` — the
  platform already mines this signal.)
- **A search returned this protocol ≥2 times** in recent threads with no
  hit in the existing bootstrap. (Same suggestions endpoint flags these
  as the higher-signal `searched` source.)
- **The user explicitly asks**, or accepts a suggestion you proposed.

Don't add a protocol you've fetched once. The bootstrap is for things
worth loading every session.

## The discovery test

Usage counts show what is fetched. They cannot show what was needed and never found. Before adding a row, ask two questions:

1. **Utility across the sessions this user typically runs.** Would most sessions use it, or only one rare situation?
2. **Discovery without it.** If the bootstrap does not mention it, does a session that needs it search for it and find it? Test this, don't guess: run the queries a cold session would type, in the symptom words it would arrive with, and note where the entry ranks.

| Utility | Found without a mention? | Do this |
|---|---|---|
| high | no | add a row |
| high | yes | no row; search already serves it |
| low | yes | no row |
| low | no | no row: fix discovery instead (add the missed phrasings as triggers), or reach it by mechanism (a hook or job that names it at the moment it matters, `@protocol/grooming` §Mechanism outranks prose) |

Write the result (queries, ranks, verdict) into the entry itself so the next groom re-runs the same test instead of re-deciding.

## When to demote (or remove)

- **Demote `short` → `title`** when an include hasn't been read in 14+
  days. The agent stays aware it exists; the body stops costing tokens.
- **Remove** when an include hasn't been read in 30+ days *and* its
  problem domain is gone (the user has stopped working on whatever it
  was for).
- **Never silently demote `full`** — full-depth includes are user-invested
  context. Surface for review first, don't auto-touch.

## When to provision (fresh user)

A new user with an empty bootstrap is a chance to set them up well. Just
loop over the includes you want, posting one at a time. POST is
idempotent — `{include, existed: true}` comes back if it's already
there, so safe to retry per-item.

```bash
for ref in @protocol/orchestrate @protocol/loop @protocol/comment; do
  curly protocol /user/bootstrap/config -X POST -d "{
    \"kind\": \"protocol\", \"ref\": \"$ref\", \"depth\": \"short\"
  }"
done

for sec in active-impulses recent-protocols; do
  curly protocol /user/bootstrap/config -X POST -d "{
    \"kind\": \"section\", \"ref\": \"$sec\", \"depth\": \"short\"
  }"
done
```

Errors on individual posts surface as standard 4xx — handle them in your
script. (No bulk endpoint by design — multi-error semantics are messier
than per-item handling in client code.)

## How to add

```bash
curly protocol /user/bootstrap/config -X POST -d '{
  "kind": "protocol",
  "ref": "@protocol/loop",
  "depth": "summary"
}'
```

`kind` ∈ `protocol | repo | section`.
`depth` ∈ `title | summary | condensed | full`. Default `summary`.

POSTs are idempotent. Repeating returns `{include, existed: true}` —
a network blip + retry doesn't need special handling.

## How to demote

```bash
curly protocol /user/bootstrap/config/{id} -X PATCH -d '{"depth": "title"}'
```

## How to confirm an edit landed

```bash
curly protocol /user/bootstrap/preview
```

Returns the composed bootstrap markdown plus a token estimate. Verify
your change is reflected before reporting "done" to the user.

## Surfacing edits to the user

When you make an edit on the user's behalf, surface it. Three rules:

1. **Tell them what changed and why** — "Demoted `@protocol/ui-verify` to
   title depth — unread in 14d, saves ~800 tokens per session."
2. **Show how to revert** — every edit is a one-line PATCH/DELETE; tell
   them the verb.
3. **Don't bury edits in long output.** A bootstrap edit is a real change
   to their working environment. It should be visible at glance.

## Discovery — what protocols / repos / sections exist?

| Need | Endpoint |
|---|---|
| Find a protocol by topic | `/search?q=<keyword>` |
| List a repo's entries | `/repo/{slug}/entries` |
| List section types | `/user/bootstrap/catalog` |
| What the user's already got | `/user/bootstrap/config` |
| Suggested adds (mined from usage) | `/user/bootstrap/suggestions` |

## What good looks like

A well-tended bootstrap is **lean**: typically 5–15 includes, ~5–10k
tokens composed. It contains:

- The user's personal handler / handbook
- 2–4 high-frequency canonical protocols (`@protocol/orchestrate`,
  `@protocol/comment`, …)
- 1–2 dynamic sections (`active-impulses`, `recent-protocols`)
- Maybe a repo at `short` depth for a project the user's currently in

A bloated bootstrap is anything > 15k tokens or has unread includes.
Audit periodically; demote and prune.

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*