Skip to content

Commit 70737ef

Browse files
maphewampagent
andauthored
Add retrospective orb sizing skill (#40)
* Add retrospective orb sizing skill Agent-Signature: amp-gpt-5.6-medium on behalf of maphew Amp-Thread-ID: https://ampcode.com/threads/T-019f8cb6-a6f7-77ab-a6d7-ea71e143dc9d Co-authored-by: Matt Wilkie <maphew@gmail.com> * Bootstrap Beads from Dolt in fresh orbs Agent-Signature: amp-gpt-5.6-medium on behalf of maphew Amp-Thread-ID: https://ampcode.com/threads/T-019f8cb6-a6f7-77ab-a6d7-ea71e143dc9d Co-authored-by: Matt Wilkie <maphew@gmail.com> * fix: handle current Amp thread exports Parse Bash and top-level tool results while retaining legacy export support. Surface manual escalation at the largest orb size and ensure setup validates the bd binary it invokes. Agent-Signature: codex-gpt-5.6-sol-medium on behalf of maphew * fix: align orb evidence and bootstrap roots Pair each GNU time RSS sample with its own preceding CPU and elapsed values, and bootstrap Beads at the common repository root used by the linked-worktree guard. Agent-Signature: codex-gpt-5.6-sol-medium on behalf of maphew --------- Co-authored-by: Amp <amp@ampcode.com>
1 parent 0b8f05d commit 70737ef

4 files changed

Lines changed: 653 additions & 1 deletion

File tree

‎.agents/setup‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ mkdir -p "$HOME/.local/bin"
1919
ln -sfn "$go_root/bin/go" "$HOME/.local/bin/go"
2020
ln -sfn "$go_root/bin/gofmt" "$HOME/.local/bin/gofmt"
2121

22-
if ! "$go_root/bin/go" version -m "$(command -v bd 2>/dev/null || echo /dev/null)" 2>/dev/null | grep -q "${bd_commit:0:12}"; then
22+
if ! "$go_root/bin/go" version -m "$HOME/.local/bin/bd" 2>/dev/null | grep -q "${bd_commit:0:12}"; then
2323
CGO_ENABLED=1 GOFLAGS=-tags=gms_pure_go GOBIN="$HOME/.local/bin" \
2424
"$go_root/bin/go" install "github.com/steveyegge/beads/cmd/bd@$bd_commit"
2525
ln -sfn "$HOME/.local/bin/bd" "$HOME/.local/bin/beads"
2626
fi
27+
28+
repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
29+
git_common_dir="$(git -C "$repo_root" rev-parse --path-format=absolute --git-common-dir)"
30+
beads_repo_root="$(dirname -- "$git_common_dir")"
31+
if [[ ! -d "$beads_repo_root/.beads/embeddeddolt/beads/.dolt" ]]; then
32+
"$HOME/.local/bin/bd" --directory "$beads_repo_root" bootstrap --yes
33+
fi
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
name: analyzing-orb-sizing
3+
description: Retrospectively assesses whether an Amp orb was under-sized, over-sized, or appropriately sized from thread tool output and measured workloads. Use when reviewing orb size, resource pressure, OOM failures, build performance, or orb cost efficiency.
4+
compatibility: Requires Python 3.9+ and the Amp CLI when analyzing a thread ID.
5+
argument-hint: <thread-id-or-export.json> --size <a0.tiny|a0.small|a0.medium|a0.large>
6+
---
7+
8+
# Analyzing Orb Sizing
9+
10+
Assess orb sizing from evidence, not repository type alone. Run the bundled analyzer first, then use `read_thread` when semantic context is needed to decide whether observed workloads were representative.
11+
12+
## Run the analyzer
13+
14+
From the repository root:
15+
16+
```bash
17+
python3 .agents/skills/analyzing-orb-sizing/scripts/analyze.py \
18+
T-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --size a0.small
19+
```
20+
21+
It also accepts an existing export, which is useful offline:
22+
23+
```bash
24+
amp threads export T-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /tmp/thread.json
25+
python3 .agents/skills/analyzing-orb-sizing/scripts/analyze.py \
26+
/tmp/thread.json --size a0.small --json
27+
```
28+
29+
Always pass the size used by that thread. Project defaults are prospective and may not match an existing orb.
30+
31+
## Interpret the result
32+
33+
- **under-sized**: hard resource-pressure evidence such as OOM, exit 137, allocation failure, or measured usage that reaches the orb limit. Move up one size, then repeat the representative workload.
34+
- **over-sized**: representative measured workloads fit comfortably on the next smaller size with CPU and memory headroom. Move down one size and verify there.
35+
- **right-sized**: representative measurements use meaningful capacity without pressure and do not safely fit the next smaller size.
36+
- **insufficient-evidence**: the transcript lacks trustworthy resource measurements or hard pressure signals. Do not interpret an uneventful thread as proof of over-sizing.
37+
38+
The analyzer only treats shell/tool results as machine evidence. User and assistant prose can describe the task but must not be counted as telemetry.
39+
40+
## Add evidence to a future thread
41+
42+
Run the slowest representative build or test under GNU `time` inside the orb:
43+
44+
```bash
45+
/usr/bin/time -v cargo test
46+
/usr/bin/time -v ./gradlew test
47+
```
48+
49+
For parallel builds, also record the orb identity and capacity:
50+
51+
```bash
52+
printf 'orb-capacity cpus=%s memory_kb=%s\n' "$(nproc)" "$(awk '/MemTotal/ {print $2}' /proc/meminfo)"
53+
```
54+
55+
Use a clean and an incremental build when both matter. One trivial command, setup/install work, model thinking time, network waits, and idle thread duration are not representative sizing measurements.
56+
57+
## Apply judgment after the script
58+
59+
1. Use `read_thread` to identify what the measured command did and whether it represents normal project work.
60+
2. Separate compute delay from dependency downloads, network services, lock contention, and test sleeps.
61+
3. Prefer multiple representative samples. A hard OOM is decisive; an over-sizing recommendation needs measured headroom.
62+
4. Mention confidence, evidence, and missing evidence in the final recommendation.
63+
5. Disk is 40 GB for every documented size, so changing size does not solve disk pressure.
64+
65+
## Size reference
66+
67+
| Size | CPUs | Memory | Hourly price |
68+
|---|---:|---:|---:|
69+
| `a0.tiny` | 1 | 2 GB | $0.10 |
70+
| `a0.small` | 2 | 4 GB | $0.21 |
71+
| `a0.medium` | 8 | 16 GB | $0.83 |
72+
| `a0.large` | 16 | 32 GB | $1.66 |
73+
74+
Treat prices as a dated reference and verify current Amp pricing before making a cost forecast.

0 commit comments

Comments
 (0)