# Example: Caveman

**Official plugin** · one `systemPrompt` middleware · no permissions · 15 lines

Caveman makes agents answer dramatically shorter — fragments, no filler — while keeping code, commands, errors and
URLs byte-exact. It's inspired by the open-source *caveman* prompt, and it shows how little a plugin needs to be.

## The package

```
caveman/
  readme.md
  index.ts
  gallery/        the pictures shown on the plugin's Browse page
  tsconfig.json   authoring only, left out of the upload
```

```markdown
---
name: Caveman
description: An output-brevity skill — appends terseness guidance so the model produces short, fragment-based answers while keeping code, commands, and URLs byte-exact.
categories: writing
version: 1.0
gallery:
  - file: 01-cover.webp
    caption: Say more with less
  - file: 02-terse-answers.webp
    caption: Two questions, two short answers
---

# Caveman
…
## Permissions

None. The middleware only rewrites the system prompt it is handed — no `host.*` calls, no network egress.
```

```ts
// plugins/caveman/index.ts (the file also opens with a comment crediting the original caveman prompt)
const GUIDANCE =
  "\n\n## Caveman mode (output-brevity skill)\n" +
  "Rewrite your responses to be dramatically shorter while keeping technical accuracy.\n" +
  "- Cut filler, pleasantries, and explanatory padding.\n" +
  "- Use sentence fragments and minimal grammar.\n" +
  "- Keep code, commands, error messages, and URLs byte-for-byte exact; never abbreviate them.\n" +
  "- Keep the user's language (French input stays French).\n" +
  "Say the least that fully answers. Example: 'New ref each render. Wrap in useMemo.' not a paragraph.";

globalThis.middleware.systemPrompt = async (context) => {
  return context.systemPrompt + GUIDANCE;
};
```

## Walkthrough

1. **`GUIDANCE` is a constant.** Everything the plugin does is decided at the top level, so publish-time
   introspection sees it plainly.
2. **`globalThis.middleware.systemPrompt = …`** — assigning this one registry key is the whole declaration. At
   publish the platform reads it back and records one capability: *Middleware · systemPrompt*.
3. **The handler appends and returns.** It receives the system prompt this turn is about to use and returns the new
   one. It doesn't need `tools` (there's nothing to cancel on this hook) or any other context.
4. **No `host` calls → no permissions.** The Browse page's **What it can reach** is empty. That is a strong promise
   to an installer: this code can't reach the network, files, agents, or anything else.

## What happens at run time

Every turn of every agent on the installing account: the platform composes the system prompt, runs the
`systemPrompt` chain (Caveman, plus any other installed plugins' hooks, in order), and sends the result to the
model. Caveman has 5 seconds; it needs microseconds. If it ever failed, the prompt would pass through unchanged.

## Variations

- **My Dude** (also official) is the same shape with an instruction whose effect is exactly checkable — every
  reply ends with "my dude". Useful as a probe that middleware reaches the model.
- **Ponytail** (official) appends a "smallest correct solution" ladder for coding agents.
- Make it configurable with a setting — see the [Quickstart](plugin-quickstart.md).
- Apply it only to some agents by checking `context.agentId` or `context.sessionKind`.
