An open-source, faster Devin alternative
TypeScript
Strip internal context from user-facing usage docs
Igor Zalutski69370e40f412
diff --git a/AGENTS.md b/AGENTS.mdindex 6b391d2f..537b02c5 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -183,6 +183,14 @@ just a refactor.rearranging internals for neatness.- **Docs navigation is explicit.** Adding a page without wiring it into`docs/mint.json` leaves it effectively invisible.+- **User-facing docs describe the product, not the implementation.**+ Files under `docs/` are read by customers. Do not leak internal+ context: roadmap labels ("v1", "follow-up"), schema names+ (`sandbox_scale_events`, `cgroup memory.current`), build artifacts+ (`worker`, `usage_collector`), or "for backwards compatibility"+ rationale. Describe observable behavior in the user's vocabulary.+ Internal context belongs in `.agents/design/*`, `.agents/work/*`,+ commit messages, and code comments.## CLI boundarydiff --git a/docs/api-reference/usage/get-sandbox-usage.mdx b/docs/api-reference/usage/get-sandbox-usage.mdxindex 4ce95679..29e514f2 100644--- a/docs/api-reference/usage/get-sandbox-usage.mdx+++ b/docs/api-reference/usage/get-sandbox-usage.mdx@@ -4,15 +4,9 @@ api: 'GET /api/sandboxes/{id}/usage'---Per-sandbox memory usage over a window, as 1-minute points plus-envelope totals. Allocation is integrated from scale events (same-math the billing pipeline uses); used memory is sampled every 60s-from the qemu process's cgroup `memory.current`.--<Note>-v1 is memory only. CPU mirrors this shape (`cpuUsedCoreSeconds`,-`usedCpuPctAvg`, etc.) once the worker collector starts populating-cgroup `cpu.stat` — additive change, no shape break.-</Note>+envelope totals. Allocated memory is the tier the sandbox was+provisioned at, integrated over time; used memory is the actual+resident memory consumed by the sandbox process, sampled every 60s.<ParamField path="id" type="string" required>Sandbox ID.@@ -67,11 +61,10 @@ cgroup `cpu.stat` — additive change, no shape break.### UnitsAll `*GbSeconds` fields are **GiB-seconds** (binary, 2<sup>30</sup>-bytes/GiB). For a sandbox provisioned at 1024 MiB running for one-minute, `memoryAllocatedGbSeconds` is `1024/1024 × 60 = 60`. For an-RSS sample of 612 MiB, `memoryUsedGbSeconds` is `612/1024 × 60 ≈-35.86`. The wire name uses `Gb` for backwards compatibility with the-billing aggregator; do not interpret it as decimal GB.+bytes/GiB), not decimal GB. For a sandbox provisioned at 1024 MiB+running for one minute, `memoryAllocatedGbSeconds` is+`1024/1024 × 60 = 60`. For a measured RSS of 612 MiB,+`memoryUsedGbSeconds` is `612/1024 × 60 ≈ 35.86`.### Reading the responsediff --git a/docs/api-reference/usage/get-usage.mdx b/docs/api-reference/usage/get-usage.mdxindex 9e162c08..20e9e6b7 100644--- a/docs/api-reference/usage/get-usage.mdx+++ b/docs/api-reference/usage/get-usage.mdx@@ -10,8 +10,7 @@ quantities the invoice is computed from.<Note>All `*GbSeconds` fields are **GiB-seconds** (binary, 2<sup>30</sup>bytes/GiB), not decimal GB. For a sandbox provisioned at 1024 MiB-running for one second, `memoryGbSeconds` is 1. The wire name uses-`Gb` for backwards compatibility.+running for one second, `memoryGbSeconds` is 1.</Note><Note>diff --git a/docs/sandboxes/usage.mdx b/docs/sandboxes/usage.mdxindex 73a6d112..4b89c347 100644--- a/docs/sandboxes/usage.mdx+++ b/docs/sandboxes/usage.mdx@@ -6,8 +6,7 @@ description: "Inspect a sandbox's memory allocation and actual utilization overEvery sandbox emits resource samples while it runs. The platformexposes them as a per-minute time series plus envelope totals — soyou can answer "is this sandbox actually using the memory I'm paying-for?" or "show me memory pressure over the last hour" without-running your own collector.+for?" or "show me memory pressure over the last hour."The API surface is one endpoint: [`GET /api/sandboxes/:id/usage`](/api-reference/usage/get-sandbox-usage).A separate aggregator at [`GET /api/usage`](/api-reference/usage/get-usage)@@ -46,14 +45,13 @@ The two memory metrics answer different questions, and the gapbetween them is usually where the interesting signal lives.- **`memoryAllocatedGbSeconds`** — what the sandbox's plan promised,- integrated over time. Comes from `sandbox_scale_events` and is- the same physical quantity the billing pipeline reports. If you- resized the sandbox mid-window, the points reflect the- time-weighted blend.-- **`memoryUsedGbSeconds`** — what the qemu process's cgroup actually- reported as `memory.current`, sampled every 60s and integrated.- This is the "headroom" signal — if it's much lower than the- allocated number, you're over-provisioned.+ integrated over time. This is the same physical quantity the bill+ is computed from. If you resized the sandbox mid-window, the+ points reflect the time-weighted blend.+- **`memoryUsedGbSeconds`** — what the sandbox process actually+ consumed, sampled every 60s and integrated. This is the headroom+ signal — if it's much lower than the allocated number, you're+ over-provisioned.Ratios are stable: both are in **GiB-seconds** (binary,2<sup>30</sup> bytes/GiB), so `used / allocated` gives you a clean@@ -107,10 +105,11 @@ curl -s "$OC_API_URL/api/sandboxes/sb-abc/usage?from=2026-05-27T00:00:00Z&to=202- Minutes where the sandbox isn't running emit zero-points(`uptimeSeconds: 0`, all integrals `0`) rather than nulls — chartsread continuous x-axes without phantom interpolation.-- During collector outages (the worker dies or restarts), `uptimeSeconds`- still reads 60 because a scale event is open. `usedMemoryMbAvg` will- be 0 for those minutes — that's how you spot "we should have data- but don't" on a chart.+- If a sampling gap appears (e.g., the platform missed a measurement+ window), `uptimeSeconds` still reads 60 because the sandbox was+ running, but `usedMemoryMbAvg` reads 0 for those minutes — visible+ as a brief flat-zero stretch under an otherwise continuous+ allocated line.- Window max is **30 days**. For longer-range questions, use theaggregator at `/api/usage` and sum across sandboxes there.@@ -123,8 +122,3 @@ filter/sort/cursor and doesn't materialize point-level data — muchcheaper at scale. The per-sandbox endpoint here is the drilldownafter you've picked one to look at.-<Note>-v1 ships memory only. CPU mirrors the same shape (`cpuUsedCoreSeconds`,-`usedCpuPctAvg`, etc.) once the worker collector starts populating-cgroup `cpu.stat` — additive change, no shape break.-</Note>