| 106 | # DIAGRAM 1 — Before vs After |
| 107 | # ════════════════════════════════════════════ |
| 108 | def d1(): |
| 109 | els = [] |
| 110 | LC = 420 # left panel center-x |
| 111 | RC = 1420 # right panel center-x |
| 112 | |
| 113 | # Title |
| 114 | els.append(TC(920, 25, "The Token Problem", 40, sc=DRK)) |
| 115 | |
| 116 | # Dashed divider |
| 117 | els.append(LN(920, 80, [[0,0],[0,680]], ss="dashed", sc=GRY, sw=1, op=40)) |
| 118 | |
| 119 | # ── LEFT: Without Graph ── |
| 120 | els.append(TC(LC, 85, "Without Graph", 28, sc=RED)) |
| 121 | |
| 122 | # Claude Code box |
| 123 | els.append(R(295, 140, 250, 48, bg=GRY_BG, fs="solid")) |
| 124 | els.append(TC(LC, 150, "Claude Code", 20)) |
| 125 | |
| 126 | # Arrow + label |
| 127 | els.append(A(LC, 195, [[0,0],[0,55]], sc=RED)) |
| 128 | els.append(TC(LC, 215, "reads entire codebase", 14, sc=RED)) |
| 129 | |
| 130 | # File grid container |
| 131 | els.append(R(195, 275, 450, 240, sc=GRY, bg="#f8f9fa", fs="solid", op=80)) |
| 132 | |
| 133 | # 20 small file rects (4×5 grid) |
| 134 | for row in range(4): |
| 135 | for col in range(5): |
| 136 | fx = 218 + col * 85 |
| 137 | fy = 292 + row * 52 |
| 138 | shade = random.choice(["#dee2e6", "#e9ecef", "#ced4da"]) |
| 139 | els.append(R(fx, fy, 62, 32, bg=shade, fs="solid", sc=GRY, sw=1, rough=0)) |
| 140 | |
| 141 | els.append(TC(LC, 528, "Entire Codebase", 16, sc=GRY)) |
| 142 | |
| 143 | # Red badge |
| 144 | els.append(R(295, 565, 250, 48, bg=RED_BG, fs="solid", sc=RED)) |
| 145 | els.append(TC(LC, 575, "125,022 tokens", 22, sc=RED)) |
| 146 | |
| 147 | # Impact detection |
| 148 | els.append(TC(LC, 630, "Impact detection: unknown", 16, sc=GRY)) |
| 149 | |
| 150 | # ── RIGHT: With Graph ── |
| 151 | els.append(TC(RC, 85, "With Graph", 28, sc=GRN)) |
| 152 | |
| 153 | # Claude Code box |
| 154 | els.append(R(1295, 140, 250, 48, bg=GRY_BG, fs="solid")) |
| 155 | els.append(TC(RC, 150, "Claude Code", 20)) |
| 156 | |
| 157 | # Arrow + label |
| 158 | els.append(A(RC, 195, [[0,0],[0,40]], sc=GRN)) |
| 159 | els.append(TC(RC, 210, "queries graph", 14, sc=GRN)) |
| 160 | |
| 161 | # Diamond: Graph |
| 162 | els.append(D(1378, 255, 84, 58, bg=PRP_BG, fs="solid", sc=PRP)) |
| 163 | els.append(TC(RC, 269, "Graph", 16, sc=PRP)) |
| 164 | |
| 165 | # Arrow + label |