Skip to content
ConfigHub for coding agents
Reference / examples/walkthroughs/story-21-ana-sized.md Source on GitHub

A new service sized by what it used, with the measurement as the reason

Ana's agent built a small notes service on her team's pattern, which gives every service 2 CPU and 4Gi of memory. Nobody has seen it run, so nobody knows whether that is ten times too much or too little. Here the service runs in a container on your computer while a load generator sends it a stated number of requests, and what it used becomes the proposed size: each size an ordinary setting whose reason is the measurement. Staging takes it at once; production waits for Sam, who looks after the team's shared hub, to read the numbers and approve.

Quick start

You need: an unpacked confighub mini package (from the releases page) on macOS or Linux, Docker running, and Python 3. No account and no cluster.

By handAsk your agent
Connect the servicecub mini adopt notesYour agent can run the same command.
Measure it"$MINI/examples/sized/measure" notes --rate 20 --seconds 20"Our notes service has the pattern's 2 CPU and 4Gi. Size it by what it actually uses at 20 requests a second, with what you measured as the reason. Staging can take it now; production waits for Sam."
Propose sizesCUB_CONTEXT=bot "$MINI/examples/sized/propose" notes notes.measured.jsonYour agent can run the same command.
Approve productioncub mini approve notes --note "Sized from what it used" --yesYou approve it yourself.

Staging takes the sizes at once, and each size keeps its measurement as the reason.

Without ConfigHub: your agent writes CPU and memory sizes directly into the service's app.env, production included, and the next session has no record of why.

Deeper dive

The rest of this page is the full version: every command with what it prints, the sizing rule, a service that gets no size, and how this was tested.

Show the full walkthrough

Human

For a person following along in a terminal.

What you need

An unpacked confighub mini package (from the releases page) on macOS or Linux, Docker running, and Python 3. The local hub is a hub, a small ConfigHub server that keeps each setting with who changed it and why, running on your computer only. No account and no cluster.

Steps

  1. Set up a terminal. MINI is the unpacked package; CUB_CONFIG is a new folder for this walkthrough's cub settings, so nothing of yours is touched. Then start a hub:
    export MINI=/absolute/path/to/unpacked-confighub-mini
    export PATH="$MINI/bin:$PATH"
    export CUB_CONFIG="$HOME/.confighub-walkthrough"
    unset CUB_CONTEXT
    "$MINI/bin/confighub-mini-app" mini install-plugin "$CUB_CONFIG" >/dev/null
    cub mini install --name ana --use >/dev/null
  2. Ana's service, as her agent wrote it: a small HTTP API with a Dockerfile, and its settings in app.env, with the pattern's sizes. At start it builds a search index, which takes more memory than it keeps:
    mkdir -p ~/walkthrough && cd ~/walkthrough
    cp -R /absolute/path/to/unpacked-confighub-mini/examples/sized/notes notes
    grep -E '^(CPU|MEMORY)=' notes/app.env
    CPU=2
    MEMORY=4Gi
  3. Give its settings to the hub: a base, a staging copy and a production copy, notes-live. Sam approves production's starting values and gives Ana's agent a key of its own, which can change staging and only ask for production:
    cub mini adopt notes >/dev/null
    cub mini approve notes-base/adopt --note "What runs today" --yes >/dev/null
    cub mini require-approval notes --variant live --agent bot >/dev/null
    cub unit data --space notes-live app | grep -E '^(CPU|MEMORY)='
    CPU=2
    MEMORY=4Gi
  4. Measure it. measure builds the service, runs it in a container with its current sizes as the container's limits, as Kubernetes would, and sends it 20 requests a second for 20 seconds. Docker's own docker stats reads its CPU and memory about twice a second, and the kernel's record of the peak catches anything shorter:
    "$MINI/examples/sized/measure" notes --rate 20 --seconds 20
    Measured notes in a container with its current sizes as limits (CPU=2, MEMORY=4Gi), read by docker stats:
    …
      Listens on: 8080.
      Load: 20 requests a second for 20 seconds, GET /: 400 answered, 0 failed.
    …
    Wrote notes.measured.json. To propose sizes from it: propose notes notes.measured.json

    The lines left out say how long the service took to answer, and the most CPU and memory it used, which differ a little from run to run.

  5. The agent proposes sizes from the measurement, on its own key. The rule is plain: CPU is the most it used under that load plus a quarter, rounded up to the next 50m; memory is the most it used, start included, plus a half, rounded up to the next 64Mi. propose writes them into app.env and hands the change to the hub with cub mini upload, the ordinary way a change to the app's files reaches it:
    SIZE_ORDER_REPORT=$(CUB_CONTEXT=bot "$MINI/examples/sized/propose" notes notes.measured.json)
    printf '%s\n' "$SIZE_ORDER_REPORT"
    SIZE_ORDER=$(printf '%s\n' "$SIZE_ORDER_REPORT" | sed -nE 's/^.*mini approve (notes-base\/upload-[a-z0-9-]+)[[:space:]]*$/\1/p')
    Proposed for notes, from notes.measured.json:
    …
    Production keeps its current settings until you approve this change. To see the change and approve it:
    …

    The reason it gives the hub names what the sizes were, the load, what the service used, the sizes proposed and the rule: "Sized from what it used: it had CPU=2 and MEMORY=4Gi; in the sandbox, at 20 requests a second for 20 seconds, it used at most … CPU and, start included, …Mi; proposed CPU=… and MEMORY=…"

  6. Sam reads what waits for production: the sizes, with the measurement as the reason. Staging has them already:
    cub mini waiting
    …
      It proposes for production, from the app's files:
    …
  7. Sam approves, and production has the measured sizes. The receipt keeps who approved and why each size is what it is:
    cub mini approve "${SIZE_ORDER:?Find the exact order from the proposal first}" --note "Sized from what it used" --yes >/dev/null
    test "$(cub unit data --space notes-live app | grep -E '^(CPU|MEMORY)=')" = "$(grep -E '^(CPU|MEMORY)=' notes/app.env)" && echo "Production has the measured sizes."
    cub mini receipts notes-live | grep -m1 -o "Why: *Sized from what it used"
    Production has the measured sizes.
    Why: Sized from what it used
  8. A service that never answers gets no size. Here a copy whose container starts and never listens:
    cp -R notes silent && printf 'FROM python:3.12-alpine\nCMD ["sleep", "600"]\n' > silent/Dockerfile
    "$MINI/examples/sized/measure" silent --seconds 5 --start-seconds 10
    …
      It never answered on port 8080 within 10 seconds.
    No size can come from this run: the service never answered, so nothing it did can be measured. Wrote silent.measured.json.

    propose refuses that file, as it refuses one from a run in which the service was killed or failed more than 1 request in 100.

Undo it

cub mini uninstall --name ana --delete-data removes the hub and everything in it; docker image prune -af --filter label=confighub.sized removes the images measure built, which it labels; then delete ~/walkthrough and ~/.confighub-walkthrough. measure removes each container it starts.

What you have now

The notes service with sizes that come from what it did, each with its measurement and the load it was measured at as the reason, in staging at once and in production once Sam approved. A copy whose size someone kept, with their reason, keeps it: the proposal says what the measurement found there and changes nothing.

The sandbox's load is not production's, so every size says the load it was measured at. Once the service runs on a cluster, "$MINI/examples/sized/from-live" reads what it uses there from metrics-server, and propose takes that back the same way, with live's numbers as the reason and Sam's approval before production changes; a window on live has no start in it, so live may raise memory and never lowers it. The full story, and the example's live script on a local kind cluster, show it.

Agent

For an AI agent doing this for a person.

  • The request: "Our notes service has the pattern's 2 CPU and 4Gi. Size it by what it actually uses at 20 requests a second, with what you measured as the reason. Staging can take it now; production waits for Sam."
  • Work with the key you were given: run cub as cub --context bot, and the two tools with CUB_CONTEXT=bot. Measure first: "$MINI/examples/sized/measure" notes --rate 20 --seconds 20. Then CUB_CONTEXT=bot "$MINI/examples/sized/propose" notes notes.measured.json.
  • Do not write sizes you have not measured, and do not raise them "to be safe": the rule's headroom is in propose. If measure says no size can come from the run, tell the person why and propose nothing.
  • Never approve a change for production, sign in as the person, or write notes-live directly.
  • Done when cub unit data --space notes-staging app shows the proposed CPU and MEMORY, cub unit data --space notes-live app still shows CPU=2 and MEMORY=4Gi, and cub mini waiting shows the change with the measurement. Tell the person the sizes, the measurement, and that production waits for Sam.

Testing

This proves: the sizes were measured from the service running in a container, at a stated load, and stored in the hub as ordinary settings with the measurement as their reason, staging's at once and production's held for approval. What was really used: Docker on this computer, with docker stats and the kernel's peak, and the local hub; no cluster, and the approval was made by the scripted steps, not a person. The load is a generator's, not production's. The step it aims to win: sizes from live, the story's last step.

The scripted run follows the Human steps on a hub of its own and checks that each quoted line is still printed. A correct agent result gives staging a CPU between 100m and 1 and a memory between 300Mi and 1Gi, which the service's start needs, keeps production at 2 and 4Gi, and keeps the measurement as the reason. In plain files: a staging file has the sizes, the shared app.env keeps 2 and 4Gi, and a file says what was measured. The checks below hold right after step 5, before Sam approves.

Our notes service has the pattern's 2 CPU and 4Gi. Size it by what it actually uses at 20 requests a second, with what you measured as the reason. Staging can take it now; production waits for Sam.

The saved mini.7 run below used Docker, not a cluster, so it did not have live cluster readings. A rejudge on the saved session showed the offer to zero of five simulated readers. Uptake when live readings are available remains unmeasured. The earlier 0/10 now, 9/10 later result applies only to the former offer at "did not change". The repeated production-wait notice in those reasons is a separate plugin behavior; this page edit does not change it.

The checks below can be run by hand, in bash, in ~/walkthrough:

cub unit data --space notes-staging app | grep -E '^(CPU|MEMORY)='; cub unit data --space notes-live app | grep -E '^(CPU|MEMORY)='
cub mini receipts notes-staging | grep 'Why:'
Test results

Results, 14 November 2026, confighub mini 0.11.1-mini.7. Figures from this page's own test runs, shown here for whoever checks the page; they are not a promise.

  • Scripted run: passed, 79 seconds for the steps, within the page's budget of 240; each of the three planted faults (a changed quoted line, a budget of zero seconds, a check that holds on a fresh hub) was caught.
  • Environment: the published confighub mini 0.11.1-mini.7, verified against its SHA256SUMS, which ships examples/sized; for the mini.5 set below, this page's examples/sized was added to that package's examples folder. Docker (OrbStack) on a Mac, no cluster. No person approved anything; the agents left the approval for Sam. The mini.7 agent runs are the Claude plugin arm alone, cut short to save cost; the comparison with plain tools is the mini.5 set, whose offer was not shown because the Claude plugin then did not read an upload made by a script.
  • Earlier pilots, on a build of this change and twice on mini.5, ran with a plain-files check that macOS's grep made fail every run. Read again from their transcripts with the check below, arm a passed 4 of 18 runs and arm b 18 of 18.
  • Agent runs (on confighub mini 0.11.1-mini.7, 14 November 2026): a pilot, 2 runs per arm on each of claude-sonnet-5-5. Arms: b is the Claude plugin, the local hub and this page as reading.
ArmModelChecks passedMedian secondsMedian costCommands left for the person (median)
bclaude-sonnet-5-52/255.7$0.0971.0

No agent approved or refused a change to production.

Simulated persons, not people: 5 per run, each a claude-haiku-5-5 model playing one of ten fixed personas, reading only what a person would see. The next step they were offered: "Once notes runs, what it uses there can come back as a proposed size the same way, with live's numbers as the reason and Sam's approval before it changes; want that for notes?" It offers more of the tier the person has, not a step up.

The Claude plugin offers it once, after the answer at whose end it showed the moment the offer names ("did not change"). Offered is the share of persons it was shown to; want it now and later are over them.

ArmModelPersonsOfferedNoticedWant the next step nowLaterIn the way
bclaude-sonnet-5-510100%100%0%90%80%
  • Agent runs (on confighub mini 0.11.1-mini.5, 14 November 2026): a pilot, 3 runs per arm on each of claude-sonnet-5-5, claude-opus-5-5. Arms: a is ordinary tools only; b is the Claude plugin, the local hub and this page as reading.
ArmModelChecks passedMedian secondsMedian costCommands left for the person (median)
aclaude-opus-5-50/3327.4$0.2660
bclaude-opus-5-53/361.8$0.1851
aclaude-sonnet-5-50/3184.7$0.170
bclaude-sonnet-5-53/357.2$0.1031

No agent approved or refused a change to production.

Simulated persons, not people: 10 per run, each a claude-haiku-5-5 model playing one of ten fixed personas, reading only what a person would see. The next step they were offered: "Once notes runs, what it uses there can come back as a proposed size the same way, with live's numbers as the reason and Sam's approval before it changes; want that for notes?"

The Claude plugin offers it once, after the answer at whose end it showed the moment the offer names; this page names none, so it was not offered. Offered is the share of persons it was shown to; want it now and later are over them.

ArmModelPersonsOfferedNoticedWant the next step nowLaterIn the way
aclaude-opus-5-5300%100%n/an/a93%
bclaude-opus-5-5300%100%n/an/a43%
aclaude-sonnet-5-5300%100%n/an/a60%
bclaude-sonnet-5-5300%100%n/an/a20%