@floless/app 0.127.6 → 0.128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,279 +1,87 @@
1
1
  ---
2
2
  name: floless-app-steel-takeoff
3
- description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
3
+ description: >-
4
+ Read structural steel drawings into a native steel.model/v2 project in floless.app. Use for a pending
5
+ steel-model rebake or revision-read request, or asks such as "read this framing plan", "turn these
6
+ drawings into a steel model", or "extract the members from this PDF". The skill preserves the full
7
+ two-phase Drawing Filter process: first prepare and save the deterministic Filter, then read only the
8
+ selected evidence into model-global members, registered plan views, observations, and revision history.
4
9
  metadata:
5
- version: 0.18.0
10
+ version: 0.19.0
6
11
  ---
7
12
 
8
- # Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
13
+ # Steel Takeoff — read drawings into `steel.model/v2`
9
14
 
10
- ## 0. Deterministic-first — extract geometry, NEVER invent it (READ THIS FIRST)
15
+ The output is always a native `steel.model/v2` document. Members are physical model-global objects in
16
+ world millimetres. Plans are registered drawing views and horizontal cut planes; they display members
17
+ and own observations, never member geometry.
11
18
 
12
- The drawing's **vector linework is ground truth.** Phase 1 (the Steel Filter / PyMuPDF pass) must
13
- extract **all geometry deterministically**; Phase 2 (your vision) only **binds text labels**
14
- (profiles, marks, callout numbers, TOS) to that geometry — it never *places* geometry. Hard rules,
15
- each learned from a real failure:
19
+ ## Non-negotiable two-phase stop
16
20
 
17
- - **NEVER hand-place or fabricate a member/column/grid.** If you are typing coordinates you made up
18
- (or "reasonable" positions like beam-endpoint clusters), STOP — that is invention. Every member,
19
- column, grid line, and callout comes from the linework. Inventing geometry is the #1 sin here.
20
- - **Grids FIRST — they are the common frame.** Extract the grid before anything else; every member,
21
- column, and callout registers to it (and it is why columns stack across stories). **Reuse the real
22
- detector `web/grid-core.js` `gridFromDrawing`** — do NOT reimplement grid detection (a naive
23
- re-port produces sign-flipped spacings and spurious bays; the real detector anchors to bubble
24
- clusters, rejects impostor lines, and even reads printed labels).
25
- - **Prefer scoping the detector's input to the grid layers — but NEVER drop the bubbles.** Pass the
26
- grid-layer lines (`*GRID*`, `*GRCL*`, `*S-ANNO-GRID*`), **every `kind:"circle"` element on the
27
- sheet**, and the label-like text. The circles are the detector's primary anchor (`anchored:
28
- 'circles'`), and CAD sets outline their text — so a scope that keeps only lines and text usually
29
- leaves it nothing to anchor to and it returns `null`, i.e. **no grid at all**. A missing grid is a
30
- worse failure than a phantom line. If you cannot identify the grid layers with confidence, hand it
31
- the sheet: §0's own rule ("the LAYER NAME is a hypothesis, not a fact") cuts both ways.
32
- - **Know what actually produces a phantom line, because it is a two-stage rule, not a circle count.**
33
- A collinear cluster of ≥3 circles is *necessary but not sufficient*: each bubble must also bind a
34
- long line field that aims at its centre and stops at its edge, and the cluster only counts when at
35
- least three — and at least half — of its members bind. (The detector never compares radii, so
36
- "same-size" is not a criterion you can check.) The residual exposure is narrow and real: a column
37
- of section/detail balloons that terminate long cut lines can survive the binding gate.
38
- - **Verify by cross-reading the grid, not by hunting unanchored lines.** Every line the detector
39
- returns is bound to an anchor by construction, so "a detected line with no bubble near it" is a
40
- signature that cannot appear. The return is `{ grid, info }`: `info.v` / `info.h` are line **counts**
41
- only (plus `anchored` and `labeled`) — the labels and spacings you actually compare live on `grid`
42
- (`grid.labels_x` / `labels_y`, `grid.x` / `grid.y`). Compare those across plan sheets over the
43
- extent the sheets share, and use the counts only as counts. One
44
- coordinated set draws one grid, but **counts may legitimately differ**: partial plans, inserts and
45
- enlarged plans show a documented subset. A disagreement in *spacing or labels* over shared extent
46
- is the real defect; a smaller count on a partial plan is not.
47
- - **Columns are extracted, as sections, from the column linework** — match **EVERY `S-COLS*` layer, on
48
- EVERY xref**, not just `S-COLS-STEL` on the shared grid xref. (Matching only
49
- `…-grids|S-COLS-STEL` misses real columns — the seismic-joint "(N) COL ABOVE" pairs live on the
50
- per-floor-plan `…Framing Plan|S-COLS-STEL`, and a partial-height post on a separate "not-to-roof" column layer.
51
- Cluster by the `S-COLS` prefix across all layer/xref names.) The shared-grid-xref columns stack across
52
- stories; the per-floor ones are floor-specific (off-grid posts, seismic-joint doubles, hangers). Cluster
53
- the section segments into footprints (evidence-gate against leaders/tags: compact closed section,
54
- balanced H/V segments, ~6–40px; HSS boxes are ~4–9 segs, so gate on ≥4 not ≥6). Read the profile tag
55
- next to each (`HSS6X6X3/8`, `(N) COL ABOVE` → size per schedule → RFI). **A column needs a `section`
56
- (traced `{w,d}`) or a resolved `profile` to render at all** — one with neither is DROPPED from the 3D
57
- scene. Give every extracted column its traced section so it is visible even before its profile is read.
58
- - **The traced `section` is in MILLIMETRES and is only a placeholder for BEFORE the profile resolves —
59
- once a real profile is set, drop it (or match it to the profile), never ship a mis-scaled trace.** The
60
- scene builder now lets a resolved standard profile WIN over the section (so a bad trace no longer
61
- renders), but a member with NO resolvable profile renders straight from its `section`, so a wrong-scale
62
- trace there = a wrong-size member. Trace footprints in mm (px → mm via `pt_per_ft`, like member coords),
63
- and sanity-check: an HSS6X6 is ~152 mm, a W14 ~356 mm — a `{3.3,3.3}` section is display-pixel units
64
- (~46× too small) and renders a hairline (it's in display-pixel units, not mm). If the column has a resolved profile,
65
- prefer emitting NO `section` (let the profile drive the exact dims) over a hand-traced approximation.
66
- - **Callouts/sections/details are extracted, deterministically, from the annotation layers**
67
- (`*S-ANNO-SECT*`, elevation/detail layers) → `plan.callouts[]` marker positions. Their numbers +
68
- target sheets are outlined text → Phase-2 vision. (Callout `target` is REQUIRED — emit `target:{}`
69
- until vision fills `sheet`/`number`.)
70
- - **RFI is a LAST RESORT, not a shortcut — READ THE WHOLE SET FIRST.** The drawing SET is the source of
71
- truth; a value missing from *one* sheet is NOT an RFI. Before you RFI anything you MUST exhaust the
72
- set for it:
73
- - **Column profile — the FOUNDATION / FIRST-FLOOR plan is the #1 place, ALWAYS double-check it.** An
74
- upper framing plan usually does NOT size its columns, but the **foundation plan (and/or the first /
75
- ground-floor framing plan) almost always does** — as a **COLUMN SCHEDULE** (a table keyed by column
76
- mark / grid) or as **per-column size tags at each base**. That sheet is the biggest candidate; make
77
- reading it for column sizes a REQUIRED step, not an afterthought. (Designers occasionally put the
78
- schedule elsewhere — a general/schedule sheet, or sections/details through the column, or a general
79
- note like "ALL COLS HSS6X6X3/8 UON" — so if the foundation plan doesn't have it, keep looking there.)
80
- Match each plan column to its size by **grid mark** (+ story). Only when the size is genuinely
81
- nowhere in the entire set — foundation plan checked FIRST — does the column stay `rfi:true`.
82
- - **Column ROTATION (`rot`) is MANDATORY — and derive it from the FLANGE-SEGMENT INK, not the bounding
83
- box.** A column has a weak and a strong axis; which way it faces is structural, not cosmetic. Render
84
- convention: `rot:0` = flanges horizontal / depth (strong axis) vertical; `rot:90` = flanges vertical.
85
- **The bbox aspect is NOISE for heavy near-square sections** (bf≈d on a heavy wide-flange, so h-vs-w
86
- is a coin-flip) — so the aspect misclassifies it. Instead, sum the cluster's
87
- near-horizontal segment length vs near-vertical: the **flanges carry ≈2× the ink of the web**, so
88
- the axis with more ink IS the flange axis → `rot:0` if horizontal-ink dominates, else `rot:90`.
89
- Use the **bbox aspect only as a tie-breaker when clearly elongated** (aspect ≳1.3) — there a beam
90
- line crossing the cluster can contaminate the ink count, and the elongation is unambiguous. HSS/pipe
91
- are symmetric → `rot` doesn't matter. Verify a sample against the drawing (draw the chosen flange axis
92
- over the footprint crop and confirm it lies along the drawn flanges). For skewed / special columns the
93
- user can dial the exact angle in the Inspect → **Rotation** control (any double, normalised −360…360).
94
- Do NOT default every column to `rot:0` without looking. Cross-check against the grid + frame elevations.
95
- - **Height (`bos`/`tos`) — ONE continuous member per COLUMN, read its extent from the FRAME ELEVATIONS,
96
- not one member per framing plan.** A steel column is a SINGLE member for its full vertical run. Read its
97
- true bottom and top from the **frame-elevation sheets / column schedule** — never infer the extent by
98
- splitting the column per plan. A column is normally **continuous through the intermediate floors**: the
99
- framing beams FRAME INTO it, they do not break it, so the frame elevation draws one unbroken column line
100
- through every level. Therefore the same column shown on more than one framing plan (a floor plan AND the
101
- roof plan) is the **SAME member** — create it **ONCE**, spanning its real base→top, never one copy per
102
- plan. Duplicating it per plan makes overlapping members that telescope through each other and
103
- **double-count weight in the BOM**. Read each column's SIZE from the elevation per grid **intersection**
104
- (it can differ bay to bay, and change up the height only where the elevation shows a splice — then it is
105
- one member per splice-to-splice run, still never one-per-floor). A foundation-plan mark with `bos==tos`
106
- is a **base plate / anchor point** (zero-height → the scene skips it; it is NOT the column). The scene
107
- **carries `rot` for ALL members**. RFI a column's extent only if no elevation or level datum ties its ends.
108
- - Same for `MF`/`BF`, materials, connection details — resolve from the set, RFI only after a real search.
109
- - **Never fabricate** a value to avoid an RFI, and **never RFI to avoid reading another sheet.** Both
110
- are the same sin (a shortcut on the source of truth). A confident wrong number and a lazy RFI are
111
- both failures; the honest path is: read the whole set, resolve what the set shows, RFI only the true
112
- unknowns — and say which sheet each answer came from.
113
- - **`MF`/`BF` resolve specific-first:** local/elevation callout → frame schedule keyed by mark+grid+
114
- level → general notes/UON default. Notes only set semantics/defaults; keep `mf:true` until resolved.
115
- - **READ THE SECTIONS + FRAME ELEVATIONS — they carry members and sizes the plan doesn't.** A plan
116
- member marked only `MF` (or `BF`) is NOT resolved until you read the **frame elevation** it belongs to
117
- (that sheet sizes the moment/braced-frame beams AND columns by grid + level). And a **roof / sloped /
118
- stepped** area is often framed in **SECTION**, not fully in plan — beams you can't find on the roof
119
- framing plan are in the building sections and frame elevations. **Never leave `MF`/`BF` beams
120
- unsized, and never present a roof as "missing beams" without opening every section and frame
121
- elevation that cuts it.** Cross-check the section/elevation member count against the plan; a bare `MF`
122
- mark or a suspiciously empty roof means a section is still unread — go read it.
123
- - **BIND BY THE CALLOUT BUBBLE, NOT BY THE DETAIL'S TITLE.** A section or elevation is titled with where
124
- it was **cut**; the callout bubbles drawn on the plans say where it **applies**. Those are different
125
- facts, and the bubbles are the authoritative one. Two consequences, both common on real sets:
126
- - **A title can be wrong and the set still be correct — but prove it before you decide that.** An
127
- elevation titled "ALONG GRID `<x>`" where no grid `<x>` exists in the plan grid is a *discrepancy*,
128
- not yet a verdict: callout numbers, target sheets and bubble marks are all commonly mis-read, so
129
- re-read the title AND the bubble at high zoom and confirm the target sheet before concluding
130
- anything. Prefer the bubble once geometry and repeated references corroborate it — then find the
131
- plan member carrying that bubble and bind there. Never invent a grid to make a title true. If the
132
- two still disagree after that, record the ambiguity in `read_notes` rather than declaring a
133
- drafting slip.
134
- - **One detail can size members in several places.** If the same `n/SHEET` bubble is drawn at two or
135
- more locations, that detail governs **all** of them — a "typical" condition drawn once. Sizing only
136
- the location named in the title leaves the others as false RFIs. Harvest the bubbles first, group
137
- by target, and apply each detail everywhere its bubble appears.
138
- - Say which bubble resolved each non-obvious binding in `read_notes` — that is what lets a reviewer
139
- confirm the read without repeating it.
140
- - **Not every line the filter grabs is a gravity beam — but the LAYER NAME is a hypothesis, not a fact.**
141
- The Steel Filter pulls ALL linework into `members`. Layer naming is a per-firm CAD-template choice, so
142
- **census each candidate layer before you classify it**, and treat the legend as authoritative:
143
- - **Census, then decide — and census into THREE classes, not two.** For each layer, sort its
144
- elements into: *member-scale strokes*, *tiny end-glyph fills*, and **measurement/leader strokes**.
145
- A layer that is nothing but long strokes and their arrowheads holds **members**, whatever its name
146
- implied. A layer that is overwhelmingly small fills sitting **on** other members holds
147
- **annotation**. Under the US NCS naming most sets follow, the beam layer (`*BEAM*`) and the bracing
148
- layer (`*BRAC*`) carry members while `*ANNO*` layers carry the symbols — use that as the *starting
149
- hypothesis*, never as the answer.
150
- - **The third class is the one that gets modelled by mistake: DIMENSION ARROWS ARE MEMBER-SCALE.**
151
- A dimension line is a full-length stroke on whatever layer the firm's template assigned it —
152
- frequently a *member* layer — so "is it long?" cannot separate a 5-ft kicker from a 5-ft dimension.
153
- These are **suspicion signals, not a rejection test** — take them together, never singly: an
154
- **arrowhead at BOTH ends** (a member terminates at a joint, not in a pair of arrows); **witness /
155
- extension lines** at the ends, perpendicular to the stroke; a nearby text run reading as a length
156
- (`6'-0"`, `EQ`); a span that **exactly matches the clear gap between two parallel members** and
157
- runs perpendicular to them; a run of **several parallel equal-length strokes evenly spaced** along
158
- one line of framing. **The last two alone are NOT enough to reject**: an infill beam does span the
159
- clear gap perpendicular to its supports, and a row of evenly spaced parallel members is what a
160
- joist bay looks like. Reject only with corroboration — paired arrowheads or witness lines or
161
- dimension text, plus the legend/layer semantics, plus the absence of any structural connection at
162
- the ends. Crop one and LOOK before you keep *or* drop the family; a handful of phantom braces is
163
- the usual outcome of skipping this check, and a deleted joist bay the usual outcome of over-applying
164
- it. When it stays ambiguous, keep the member and say so in `read_notes` — a phantom brace is
165
- visible to a reviewer, a silently deleted joist is not.
166
- - **NEVER drop a layer you have not censused.** Dropping a member layer deletes every member on it,
167
- silently, and nothing downstream will notice. If a layer is dropped, say which and why.
168
- - **And the symmetric rule: NEVER KEEP a layer you censused only by stroke length.** Length alone is
169
- not evidence of member-hood. A layer earns member status by *shape* — strokes that terminate at
170
- other members, carry a size label, and are not bracketed by arrowheads. State, in `read_notes`,
171
- what each kept steel layer actually contains and what you rejected from it; a layer that turns out
172
- to carry no members at all is a normal and reportable result, not a failure.
173
- - **The legend defines the glyphs; this file does not.** A plan's PLAN NOTES block declares what each
174
- line symbol means — which end-glyph marks a moment connection, a braced-frame connection, a drag
175
- connection, a stiffener, a deck span, a lateral brace. **These differ between firms.** Read the
176
- legend of the set in hand and bind each symbol to what it declares. A symbol drawn as its own line
177
- *between* two members is typically a member (a kicker/brace); a mark drawn *on* an existing member is
178
- typically annotation — corroborate both readings against the layer, the geometry and the legend
179
- before committing.
180
- - **Suffixed variants of a member layer usually mean scope, not kind** (existing, hidden/below,
181
- demolished). Confirm from the legend / line style, then treat them per the `(E)`/`(N)` scope rule —
182
- do not silently model them, and do not silently discard them either: record the decision.
183
- - **Never size a brace from an adjacent beam's W-label.** Assigning the nearest W-size is fabrication,
184
- and it renders a phantom member in 3D. A lateral brace's size comes from the detail the legend names
185
- (a `n/S-5xx` typical-detail reference); when it does not resolve there, emit `rfi:true` with `profile:""` and carry the
186
- reference in `ends[].detail`.
187
- - **A brace is `role:'beam'` + `memberType:'brace'` — NEVER `role:'brace'`.** The schema's `role` enum
188
- is `beam|column` and rejects `brace`, so the whole contract fails to PUT. See §2b **Braces**.
189
- - **`MF`/`BF` on a REAL (`S-BEAM-STEL`) beam = the extractor grabbed the mark, not the size — read the
190
- W-size, which sits ON or directly ABOVE the beam line** (the mark is a separate note beside it; per-beam
191
- zoom when they overlap). If the beam truly carries no W-size on the plan (only `MF`/`BF`), its size is
192
- **section-defined** — roof MF girder → the `n/S-3xx` frame-elevation bubble drawn on it; braced-frame
193
- beam → the brace-frame detail (e.g. `n/S-3xx`, `n/S-8xx`). Flag it RFI **with that section reference**;
194
- never guess between the two adjacent candidate sizes.
195
- - **Legend / plan-notes glyphs get mis-extracted as members.** The bar inside an "INDICATES BRACED FRAME"
196
- legend symbol lands on `S-BEAM-STEL` and looks like a 1-ft beam. Reject any "member" sitting in the
197
- sheet's legend / PLAN NOTES block (the title/side region), not the framing area.
198
- - **`(E)` = existing (often out of scope), `(N)` = new.** Read the scope note per column/member;
199
- don't take off existing steel as if it were new.
200
- - **Coordinates stay DISPLAY space.** There is no "grid-coordinate" storage — `wp`/`disp` are
201
- display-space (the schema + `contract-to-scene` require it). A column is **one member for its full
202
- vertical run** (see the Height rule above), not one member per story.
21
+ Do not read members before the user saves the Drawing Filter.
203
22
 
204
- ## VECTORIZE the overlay — never ship a blurry raster on a vector PDF
23
+ 1. Prepare the Filter deterministically from the attached sources.
24
+ 2. Stop and ask the user to review the Filter in Steel Filter and click **Save**.
25
+ 3. Only after Save, fetch the request and its saved Filter again, pin its ETag, and read members from
26
+ elements that the saved selection keeps.
205
27
 
206
- **When the PDF has vector linework (any `page.get_drawings()` paths — the normal case), the 2D plan
207
- overlay MUST be the drawing's VECTOR linework, not a rasterized JPEG.** The vectors are already
208
- enumerated in the `filter` block (`filter.sheets[].elements` `d` paths) — that IS the overlay source,
209
- and it is crisp, snappable, and measurable. A `raster_b64` JPEG overlay on a vector PDF is a **defect**
210
- (blurry, and you cannot snap/measure to it). Only fall back to `raster_b64` for a genuinely
211
- **scanned/raster-only** PDF that exposes no vector paths — and say so explicitly when you do. (Editor
212
- note: the model overlay renders the vector elements like the Filter view does; a raster is the
213
- scanned-only fallback.)
28
+ Filter preparation is geometry extraction, not interpretation. Use the deterministic PDF/vector tools
29
+ available in the environment; do not ask a model to recreate paths, layers, line weights, colours, or
30
+ text positions. Preserve coincident primitives as separate elements.
214
31
 
215
- ---
32
+ Each Filter sheet must carry:
216
33
 
217
- ## What this is
34
+ - its globally unique `sheet` label;
35
+ - the exact SHA-256 `sourceHash` of the queued attachment;
36
+ - every extracted element in canonical source order;
37
+ - a deterministic, source-scoped `elementId` for every element;
38
+ - the page geometry, steel bounding box, and selectable layer/thickness/colour facets;
39
+ - the normalized saved selection (`mode`, facets, and any explicit inclusions/exclusions).
218
40
 
219
- `steel-model` is a FloLess app that turns a structural steel drawing into an editable
220
- **takeoff contract** — members, profiles, AISC weights, T.O. elevations, connection detail refs
221
- — rendered in the overlay editor, then baked at Approve into the app's `read` node.
41
+ Reject duplicate sheet labels across the request. Never invent an id after the Filter is saved and never
42
+ identify evidence by array position or geometry alone. The saved Filter is the evidence catalogue.
222
43
 
223
- The drawing is read **at compose time** with your own vision. There is **no model in the run
224
- path and no API key** — the brain is you, in the terminal (the FloLess thin-UI contract). The
225
- deterministic run only renders the approved result.
44
+ ## Find the active request
226
45
 
227
- **Downstream outputs** (on the same canvas, triggered separately) are a 3D stick model
228
- (`viewer-3d`, from the Approve bake), an IFC file, a Tekla bake, and a formatted BOM — but
229
- this skill's job ends at producing and handing off the takeoff contract. Mention those as "next"
230
- but do not attempt them here.
46
+ Use the local request API described by `floless-app-queue`. Read the request's `project`, `appId`,
47
+ `requestId`, source references, current ledger head, and contract ETag. Work only in the named project.
48
+ If the request changed while you were reading, stop and fetch it again.
231
49
 
232
- > **Pasted a request?** If the user pastes a message beginning with a `[floless-request
233
- > type=rebake id=…]` marker, that's a request copied from the FloLess Dashboard — resolve it
234
- > via `GET /api/requests` (match the id), don't run the pasted line verbatim, and `DELETE` it
235
- > when done.
50
+ For the first read, the current contract is a schema-valid provisional native model with `members: []`,
51
+ registered `plans[]`, and the saved `filter`. It is not a historical version yet. A later read starts
52
+ from the current committed model and proposes a candidate; it does not overwrite the working tree.
236
53
 
237
- ---
54
+ ## Read the drawings
55
+
56
+ Use `reading-structural-drawings` for the reading discipline and
57
+ `steel-drawing-abbreviations` for defaults only when the drawing set has no legend. Drawing truth wins
58
+ over defaults.
238
59
 
239
- ## The loop
60
+ Inventory the whole set before reading individual members:
240
61
 
241
- ### 1. Find the drawing(s)
62
+ - sheet number, title, revision, and view kind;
63
+ - framing plans, elevations, sections, schedules, legends, and details;
64
+ - grid labels and spacings, levels, datums, scales, and north/orientation notes;
65
+ - member marks and sizes, top/bottom-of-steel information, slopes and offsets;
66
+ - connection callouts and the details or schedules they reference;
67
+ - revisions, clouds, addenda, and conflicting notes.
242
68
 
243
- From a `rebake` request: `GET http://localhost:<port>/api/requests` → the entry with
244
- `type:"rebake"` and `appId:"steel-model"` carries `snapshots: ["<abs path>", …]` and optionally
245
- `sourceName` (the original filename of the first file — use it for the `source.name` provenance
246
- field). **`snapshots` may hold MULTIPLE files** — the user can attach a whole set (e.g. separate
247
- PDFs for the Foundation / Floor / Roof plans, or one multi-sheet PDF plus a detail sheet). **Read every file in
248
- `snapshots[]`, not just the first** — treat them as one combined set: run the sheet index (step 2.1)
249
- across all of them, and the per-sheet filter pass (1b) and member read span every file. If the user
250
- just attaches or points at a drawing in prose, skip the lookup and proceed from that path (again,
251
- handle all the files they gave you).
69
+ Read every kept Filter element in context. An element excluded by the saved Filter cannot support a new
70
+ or changed member. If a needed label or line was filtered out, stop and ask the user to adjust and save
71
+ the Filter; do not silently broaden it.
252
72
 
253
- ### 1b. Filter step — isolate the steel linework FIRST (the `filter` node) — MANDATORY, DON'T SKIP
73
+ ### Grid and plan registration
254
74
 
255
- > 🚦 **This is a hard gate, not an optional pre-stage. You MUST populate the `filter` block and hand
256
- > the Filter node to the user to Save BEFORE you read any members (step 2).** The member read is
257
- > *downstream of* the filter — skipping straight to members is the #1 failure of this skill: the run
258
- > then renders the shipped example filter (`S-ANNO-BEAM-STEL` / `S-ANNO-GRID` / …) as if it were the
259
- > user's drawing, and the members get bound by a length heuristic instead of the real steel linework.
260
- > The `/score` endpoint reports `filterMissing: true` until you've done this — treat that as a blocking
261
- > worklist item (see step 3). Whenever the drawing has vector linework (any PDF `page.get_drawings()`
262
- > returns paths), this step is required; a pure raster/photo with no vector paths is the only exception,
263
- > and even then say so explicitly.
75
+ Author one top-level model grid in world millimetres. Axis ids are stable and model-global. Do not infer
76
+ axis direction from whether a label is a letter or number.
264
77
 
265
- Before the heavy read, do **one** deterministic PyMuPDF pass **per framing-plan sheet** that enumerates
266
- *every* drawing element by **layer · thickness · colour** and bakes it into the contract's `filter`
267
- block. The user then opens the **Filter** node (double-click → the steel-filter view), flips through
268
- the sheets, and keeps only the real steel lines — by facet (layer/thickness/colour) or the
269
- **eyedropper**. Because a coordinated drawing set uses one CAD template, the facet selection is
270
- **global**: narrow once, it applies to every sheet. The saved selection is what step 2 binds profile
271
- labels to, per sheet.
78
+ Every plan view must declare `viewKind: "plan"`, `sheet`, `elevation_in`, `pt_per_ft`, and two
79
+ non-coincident registration controls:
272
80
 
273
- **First, pick the plans (confirm gate).** From the sheet index (step 2.1) enumerate the framing-plan
274
- sheets (Foundation, each Floor, Roof). **Show the user the list and get an explicit OK** —
275
- "I found these framing plans: Foundation, 2nd Floor, Roof — filter all of these?" — before the pass. (The full
276
- elevation/detail classification is the broader workflow; here we only need the plan set.)
81
+ - `datum_at`: the display-space location of the chosen datum intersection;
82
+ - `datum_ref`: its `{axis_x, axis_y}` labels when it is not the model origin;
83
+ - `control2_at`: the display-space location of a second grid intersection;
84
+ - `control2_ref`: the second intersection's `{axis_x, axis_y}` labels.
277
85
 
278
86
  **Narrow headless revision exception.** When floless.app's server-owned headless preamble explicitly
279
87
  says this is a phase-one-only `revision-read`, exposes only the immutable leased PDF sources plus the
@@ -288,1492 +96,144 @@ same sheet set. Getting the OK does NOT mean "go read members"; the very next th
288
96
  filter pass below, then hand off the Filter node. Do not let the confirm gate double as permission to
289
97
  skip the filter** (that collision is exactly how the filter gets skipped and members are read with no filter block).
290
98
 
291
- Then, for **each** confirmed plan sheet, one pass in display space (`page.rotation_matrix` — never mix
292
- native/display coords):
293
-
294
- 1. **Lines** — `page.get_drawings()`: per path keep `{ kind:"line", layer:<OCG name>, w:<stroke width
295
- pt>, color:<#rrggbb stroke>, d:<SVG path>, dashed:<bool> }`.
296
- 2. **Text** — `page.get_text("dict")`: per span keep `{ kind:"text", layer:<OCG>, w:0, color:<#hex>,
297
- text:<string>, bbox:[x0,y0,x1,y1] }`.
298
- 2b. **Circles** — a closed bezier path whose bbox is round (width ≈ height, ≥ ~8 pt across) becomes
299
- `{ kind:"circle", layer:<OCG name>, cx:<centre x>, cy:<centre y>, r:<radius> }` in display space.
300
- These are the grid bubbles and callout balloons; the editor's **grid-from-drawing** detector
301
- (`web/grid-core.js` `gridFromDrawing`) anchors grid lines to them, so skipping circles silently
302
- disables the Grid panel's "From drawing" button. **Carry `layer` on the circle too** — the schema
303
- allows it, and it is what lets you tell a grid bubble from a callout balloon later. It is not what
304
- makes §0's scoping possible: that predicate filters *lines* by layer and keeps **every** circle
305
- unconditionally, precisely so a layer guess can never strand the detector without an anchor.
306
- 3. **Per-sheet entry** — push `{ sheet:<number>, title:<name?>, page:{ w, h, bg_b64, rect }, steelBbox,
307
- elements:[…] }` onto `filter.sheets`. `bg_b64` is a dimmed raster of THIS sheet's framing area
308
- (**title block excluded** — CONFIDENTIAL, machine-local, never committed). **`page.rect` = the exact
309
- clip `[x0,y0,x1,y1]` you rendered `bg_b64` from, in the SAME display-space coords as the element `d`
310
- paths** — the viewer registers the raster to `rect` (not the whole page), so it aligns 1:1 with the
311
- linework. `w`/`h` stay the full display-space page size (the vectors' coordinate frame). Pass that
312
- same display-space rect to `page.get_pixmap(clip=…)` **unchanged** — do NOT run it back through
313
- `page.derotation_matrix` on the theory that PyMuPDF wants native coords. `get_pixmap` is the one
314
- exception to that habit, and derotating its clip renders the wrong region of the sheet (see
315
- "Hard-won gotchas" below). `steelBbox` = the bbox of this sheet's steel-layer elements
316
- (Zoom-to-steel).
317
- 4. **Global facets (union across sheets)** — aggregate distinct `layers` / `thicknesses` / `colors`
318
- with a summed `count` each, ACROSS all sheets, into the top-level `filter.layers/thicknesses/colors`
319
- (NOT per-sheet). Round each element's `w` and the facet `w` the **same** way (matching is
320
- exact-equality). Mark `steel: true` on layers whose name reads as steel framing (e.g.
321
- `*BEAM*STEL*`, `*COL*`, `*BRACE*`, `*JOIST*`) → default **on**; others off. Mark
322
- `drawable: false` on pure text/dimension/title-block layers.
323
- 5. Set `filter.mode: "layer"`, `filter.active: 0`, then write it back **with a precondition header**
324
- (§5 has the full rule; a write carrying neither precondition is refused with `428`). Which route
325
- depends on whether the project already has a contract, and that is the whole rule:
326
- - **The GET returned a contract** → send only the pre-read blocks to
327
- **`PUT /api/projects/<projectId>/steel-prepass`** with `{ filter }` and `If-Match: <that ETag>`.
328
- - **The GET returned nothing** (a project created by dropping a drawing) → this is the create case,
329
- so compose the whole document and
330
- `PUT /api/contract/steel-model?project=<projectId>` with `If-None-Match: *`.
331
- **`?project=` is not optional here.** The contract route scopes a write to a project ONLY through
332
- that query parameter; without it you write the app-scoped draft instead — the project's pre-read
333
- filter never lands, and `If-None-Match: *` can come back `412` against an unrelated draft that
334
- happens to exist on the app.
335
-
336
- The prepass verb takes `filter`, `datum` and per-sheet `{ grid, datum_at, datum_ref, control2_at,
337
- control2_ref, elevation_in }` and **refuses `members`, `connections` and `joints` by name**, so it
338
- cannot replace the model you are about to read. It also cannot create a document or add a sheet — an
339
- unknown sheet is a `400`, never a new plan — and a sheet name the project holds twice is a `400` too,
340
- since there is no single plan to write to. `If-Match` must be the **exact** ETag: `If-Match: *` is
341
- refused, because this verb patches the document you read and `*` cannot detect a write that landed
342
- since your GET. On a re-read, preserve any existing per-facet `on` flags.
343
-
344
- **On a `steel.model/v2` model it takes less — `filter` plus per-sheet `{ datum_at, datum_ref,
345
- control2_at, control2_ref, elevation_in }`, and no grid or datum at all.** Check the `type` in the
346
- document you just GET-ed. A v2 model keeps ONE grid for the whole model instead of one per sheet, and
347
- that grid is not writable from THIS verb: the human moves it in the editor's Grid panel, and a
348
- re-read proposes a move through its own contract (§1c). Sending a
349
- `grid` or a `datum` HERE earns a `400` that says so. So on v2: **skip §1c's pre-read part, and in §1d skip only
350
- the root `datum` block — the per-sheet registration in §1d is still yours to write**, and a migrated
351
- model usually has none of it yet. Everything else in this section is unchanged.
352
-
353
- **Watch the payload — the write is capped at 25 MB and the filter block dominates it.** A framing plan
354
- carries tens of thousands of elements; three sheets land in the low tens of MB and a larger set will
355
- blow the cap outright, on either route above. Check the serialized size before you send, and if it is
356
- close:
357
-
358
- - **Exclude the title-block xref wholesale.** It is thousands of glyph strokes, it is never steel, and
359
- it is CONFIDENTIAL anyway — dropping it is the right call regardless of size. Identify it as the
360
- layer family living in the sheet-edge strip, not by name.
361
- - **Trim coordinate precision** in the path strings to ~0.1 pt. At any realistic drawing scale that is
362
- far finer than the linework, and it removes a large fraction of the bytes.
363
- - Keep the per-sheet `bg_b64` raster modest — it is a dimmed backdrop the viewer renders at low
364
- opacity, not a document scan.
365
-
366
- **Size the trim against the LARGEST write, which is not this one.** The same 25 MB cap applies to the
367
- `POST …/revision-read` commit in §9 — and that document carries this whole `filter` block *again*,
368
- plus every member and any rasters. A set trimmed to just fit here will blow the cap at commit, which
369
- is the one write with no second chance. Budget for that document.
370
-
371
- Say what you excluded. Never trim by dropping *elements* to fit — that silently removes candidate
372
- members and defeats the filter.
373
-
374
- ### 1c. Grid lines — read the printed grid (quick, per sheet)
99
+ Ask the user which labelled grid intersection is global `(0,0,0)` if project knowledge does not state
100
+ it. Never choose a convenient datum. Preserve the provisional shell's grid, plan order, sheet identity,
101
+ cut elevations, and registration controls byte-for-byte in the first completed candidate.
375
102
 
376
- > **`steel.model/v2` models: SKIP this section for the PRE-READ pass — but carry the grid in the
377
- > contract you re-read.** Two different endpoints, and the difference matters:
378
- >
379
- > - **The pre-read verb (`/steel-prepass`) still refuses a grid.** A v2 model keeps ONE grid for the
380
- > whole model, so there is no per-sheet `grid` to send. You will get a `400` saying so.
381
- > - **The re-read contract (`POST /revision-read`) carries the model grid, at the root, as `grid`.**
382
- > Copy the CURRENT model's `grid` through unchanged — do not drop the key. If the revised set
383
- > genuinely shows the printed grid in a new place, write the new grid there instead: it is staged as
384
- > a **proposal the user accepts** in the review, never a silent write.
385
- >
386
- > **Never omit `grid` to mean "I did not change it".** Omitting a key is not how you say that — copy
387
- > it through. (A read that drops it is refused and reported, precisely so an omission can never be
388
- > mistaken for "delete the model grid".) Removing the grid is a human edit in the editor, not a read.
103
+ ### Model-global members
389
104
 
390
- With the filter elements in hand, populate each plan's **`plan.grid`** (Tekla-style grid lines the
391
- editor renders in 2D + 3D and snaps to). The geometry is deterministic — the editor's Grid panel has
392
- a "From drawing" button running the same detector (`web/grid-core.js` `gridFromDrawing`: grid lines
393
- are the long dash-dot line fields that AIM at a bubble circle's centre and STOP at its edge; bubbles
394
- line up in a row along one sheet edge and columns along the sides). What the detector usually can't
395
- get is the **labels** — CAD sets outline their text, so bubble marks like `5.1` / `K.1` aren't in the
396
- text layer. You CAN read them: you already have vision on the sheet. So:
397
-
398
- 1. Derive the line positions (or let the user press "From drawing" later — same result).
399
- 2. **Vision-read each bubble's mark** from the sheet render, in line order.
400
- 3. Write `plan.grid = { on:true, origin:[x,y], x:"0'-0\", 3*25'-0\", …", y:"…", z:"0'-0\", …", labels_x:"K J H …",
401
- labels_y:"0.5 1 1.1 …", ext:<mm> }` — origin = the left-most × bottom-most line crossing,
402
- spacings are RELATIVE ft-in tokens (`n*d` repeats a bay) separated by **commas**. A space may
403
- belong to one mixed fraction (`8'-3 15/16\"`), so never use whitespace alone to separate
404
- fractional values. Labels remain whitespace-separated
405
- overrides in line order (X: left→right; Y: bottom→up). Sanity-check a bay or two against the
406
- printed dimension strings between grid lines — a mismatch means the sheet scale (`pt_per_ft`) is
407
- wrong, which corrupts the whole takeoff, not just the grid. **Then write the grid back** — send
408
- `{ "sheets": { "<sheet>": { "grid": … } } }` to `PUT /api/projects/<projectId>/steel-prepass` with
409
- `If-Match: <the ETag from the write in 1b>`. The body is **keyed by sheet name, never a positional
410
- list**: a positional array against a differently-ordered stored document writes each sheet's grid
411
- onto the other, silently. The 1b write already happened, and the user's next Filter-node Save writes
412
- back the contract *it loaded*; an unwritten grid (and its vision-read labels) would be silently dropped.
413
-
414
- **Do not "skip silently" a gridless sheet — the same trap as the registration one below.** A plan with
415
- no `grid` raises `grid-missing` at severity **block**, which refuses the ENTIRE first read exactly as a
416
- missing control does. If a framing plan genuinely prints no grid bubbles (rare), it cannot be presented
417
- as a plan at all: leave it out of `plans[]`, follow *Registration is mandatory on every plan sheet*
418
- (§1d) — including its warning that an omitted sheet's MEMBERS are dropped with it — and tell the user
419
- which sheet and why.
420
-
421
- ### 1d. Model datum — ASK which grid intersection is global 0,0,0
422
-
423
- > **`steel.model/v2` models: the root `datum` part is SKIPPED, the per-sheet part is not.** A v2 model
424
- > has no root `datum`: the "which intersection is 0,0,0" question was answered when the model was
425
- > migrated, and the answer lives in the model grid's origin, which the pre-read verb may not move (a
426
- > re-read may PROPOSE a new grid — see §1c). **The per-sheet
427
- > registration below is still yours to write** — `datum_at`, `datum_ref`, `control2_at`, `control2_ref`
428
- > — because those say something different: where that already-chosen origin falls on THIS sheet. A
429
- > migrated model usually has none of them yet, so this is real work, not a no-op. Send them under
430
- > `sheets`, exactly as below, and just omit the root `"datum"` block.
431
-
432
- Every sheet is traced in its **own** display space, and nothing ties two sheets to a common frame. The
433
- same physical grid read from three sheets therefore lands in three different places — measured on a real
434
- project: **443 mm apart**. That silently mis-registers every member read from those sheets — columns that
435
- stack in the building end up half a metre apart in the model, and one grid exports as three objects.
436
-
437
- One authored fact fixes it: a **datum** — the grid intersection that is global 0,0,0 — located on every
438
- sheet.
439
-
440
- **ASK the user which intersection is the datum. Never choose it.** Where the model origin sits is a
441
- project decision (it often matches the surveyor's or erector's control point), not a drafting detail.
442
- Ask in plain English, naming the likeliest candidate without deciding for them:
443
-
444
- > "Which grid intersection should be the model origin (0,0)? Most sets use the lowest-left crossing —
445
- > here that looks like A/1. Tell me a different intersection if this project uses another datum."
446
-
447
- Record the answer model-level, naming each axis **by its direction, never by whether the label looks like
448
- a letter or a number**:
105
+ Write members only in root `members[]`. IDs are unique across the whole model and remain stable across
106
+ revisions. Geometry uses world millimetres:
449
107
 
450
108
  ```json
451
- "datum": { "axis_x": "A", "axis_y": "1" }
452
- ```
453
-
454
- `axis_x` is the label of the grid line running in the **X** direction (the `labels_x` list from 1c);
455
- `axis_y` is the label of the **Y**-direction line (`labels_y`). **Do not infer this from the label's
456
- appearance.** The editor's default is X = `1 2 3…` and Y = `A B C…`, but real sets frequently invert it —
457
- this project's own demo labels X as `K J H … A` and Y as `1.1 2 3 … 6`. A user who says "A/1" has not
458
- told you which axis is which; resolve it against the actual `labels_x` / `labels_y` read in 1c, and
459
- confirm back which line is which if the set is inverted.
460
-
461
- **Then locate that intersection on every sheet**, recording it in that sheet's display space as
462
- `plan.datum_at = [x, y]` — the crossing point of those two grid lines. Each sheet then shifts so its
463
- `datum_at` lands on the model origin, instead of the model inferring an offset by comparing grid shapes.
464
-
465
- A sheet that does not print the model-origin intersection (enlarged or partial plans often omit it) may
466
- instead record **any** labelled intersection it does print, together with which one it is — its global
467
- position is already known from the grid, so registration still resolves:
468
-
469
- ```json
470
- "datum_at": [x, y], "datum_ref": { "axis_x": "F", "axis_y": "4" }
471
- ```
472
-
473
- Omit `datum_ref` when the sheet uses the model origin itself.
474
-
475
- **Record a SECOND control intersection on every sheet.** One point fixes only where the sheet sits; it
476
- cannot tell whether the sheet is rotated, mirrored, or drawn at a slightly different scale, because a
477
- single point has no orientation. Two points do: the vector between them carries the sheet's rotation,
478
- its handedness, and its true scale, all checkable against the same two labelled lines on other sheets.
479
-
480
- Same flat shape as the datum above — a point plus which intersection it is:
481
-
482
- ```json
483
- "control2_at": [x, y], "control2_ref": { "axis_x": "F", "axis_y": "4" }
484
- ```
485
-
486
- - `control2_ref` is **always** required alongside `control2_at`. Unlike `datum_ref` it is never omitted:
487
- a second control is never the model origin, so its labels always have to be stated.
488
- - Pick the intersection **furthest from the datum** that the sheet actually prints — the longer the
489
- baseline, the smaller the angular error. Diagonally opposite is ideal.
490
- - Same reading rules as the datum: take the labels from `labels_x` / `labels_y`, never guess from
491
- appearance, never invent an intersection the sheet does not print.
492
- - **When the sheet prints only one labelled intersection, you cannot omit these and carry on.** Earlier
493
- guidance here said to omit both fields and say so; that is now wrong, and following it fails the whole
494
- read. `control2_at` and `control2_ref` are REQUIRED on every plan sheet — see *Registration is
495
- mandatory* immediately below for what to do instead.
496
- - Do NOT ask the user for this one — unlike the datum, it is not a project decision. It is a second
497
- reading of something already printed, so read it.
498
-
499
- - **Any intersection is a valid datum.** Pick one for the model and prefer it on every sheet that prints
500
- it, because a shared datum makes the set easiest to reason about. But sheets do NOT have to agree:
501
- `planTransform` resolves each sheet's own `datum_ref` against the model grid, so a sheet that cannot
502
- print the chosen intersection may name a different one and still register correctly. (An earlier
503
- version of this line said every sheet must use the same one, which contradicted the `datum_ref`
504
- mechanism three paragraphs above. It also said "the choice moves registration by under 1 mm" — true of
505
- the translation, and silent about the check below, which is the thing that actually refuses.)
506
-
507
- ### What the two controls are FOR — and how accurately to read them
508
-
509
- **The sheet is positioned by its own printed grid, not by your two picks.** Its grid spacings already
510
- place every labelled intersection, so the server registers the sheet by matching that grid to the model
511
- grid, and your `datum_at`/`control2_at` are **checked against it**. Two consequences worth knowing:
512
-
513
- - **Ordinary reading error costs nothing.** A pick a pixel or three off the bubble does not move a single
514
- member. Read them carefully, but do not agonise, and never invent a "cleaner" number.
515
- - **They are the only thing that checks the sheet against the drawing.** The grid match compares one
516
- spacing string with another; nothing in it can see `pt_per_ft` or `grid.origin`. Your two picks are the
517
- one measurement that looks at the drawing, which is why a bad pair is refused rather than shrugged at.
518
-
519
- The tolerance is stated in **display points — 1/72" of the printed sheet**, so it means the same thing at
520
- every drawing scale:
521
-
522
- | how far a pick lands from the intersection it names | what happens |
523
- |---|---|
524
- | under 2 pt (1/36" on paper) | nothing; ordinary reading |
525
- | 2–9 pt | registers, and a `control-off-grid` note says how far out the reading was |
526
- | over 9 pt (1/8" on paper) | **`sheet-registration-refused` with reason `control-pick-off-grid`** — the whole read fails |
527
-
528
- **If a read is refused with `control-pick-off-grid`, do not just re-pick and retry.** Three different
529
- faults produce it, and only one is the pick:
530
-
531
- 1. **The pick is wrong** — you named `F/4` and clicked a different crossing. Re-read both points.
532
- 2. **`pt_per_ft` is wrong for this sheet** — the commonest cause, because the picks and the grid then
533
- disagree by a percentage rather than a wobble, and it grows with distance from the datum. Re-check the
534
- sheet's stated drawing scale. Anything above about 0.4 % off will trip this.
535
- 3. **`grid.origin` is wrong** — the grid you read is drawn in the wrong place on the sheet, so every
536
- intersection is offset by the same amount. Check where the origin lands against a printed bubble.
537
-
538
- The offset is printed in the message in both points and mm on the ground, so the size of the number tells
539
- you which fault it is: a few points is a pick, tens of points over a long baseline is a scale.
540
-
541
- **Pick `control2_at` as far from the datum as the sheet prints — this is why.** The two controls bound a
542
- drawing-scale error to roughly ±(9 pt ÷ the baseline in points). A 2000 pt baseline catches a scale wrong
543
- by 0.45 %; a 200 pt baseline only catches 4.5 %. Diagonally opposite corners are not a style preference,
544
- they are a measurement.
545
- - Never guess a datum, and never substitute an unlabelled crossing. When a sheet prints no labelled
546
- intersection at all, see *Registration is mandatory* below — you cannot simply leave `datum_at` unset
547
- and continue.
548
- ### Registration is MANDATORY on every plan sheet — an unregistered sheet fails the whole read
549
-
550
- **`datum_at`, `control2_at` and `control2_ref` are required on every sheet you present as a framing
551
- plan.** Not best-effort, not "record it when the sheet prints it". A first read composes a
552
- `steel.takeoff/v1` staging document, and the server converts it to `steel.model/v2` inside one
553
- transaction. That conversion runs `planTransform` over every plan sheet, and a sheet missing any of
554
- those three is refused with `plan-uneditable:registration-incomplete` — which **fails the entire read**.
555
- Nothing is published: no model, no version, no partial import. One unregistered sheet in a twenty-sheet
556
- set costs you all twenty.
557
-
558
- (That is why the older advice above — "omit both fields and say so", "leave `datum_at` unset and say
559
- which sheets are unregistered" — no longer holds. It predates the born-v2 transaction and, followed
560
- literally, guarantees a 400.)
561
-
562
- **When the drawing genuinely will not give you two labelled intersections on a sheet:**
563
-
564
- 1. **Look harder first, in this order.** Grid bubbles are often outside the framing area — check the
565
- full page, not the crop. Continuation/match lines carry axis labels. An enlarged plan usually prints
566
- at least one bubble pair even when the main crop does not. A second control does not have to be near
567
- the steel; furthest-apart is better.
568
- 2. **If it still prints only one, or none: do NOT present that sheet as a plan.** Leave it out of
569
- `plans[]` for this read and record why in `read_notes` — name the sheet and say what was missing.
570
- The rest of the set then imports normally, and the user gets a model instead of a refusal.
571
-
572
- **An omitted sheet contributes NOTHING — not just its registration, but its members.** The read only
573
- ever sees the plans you submit, so nothing from that sheet reaches the model. Registering it in the
574
- editor afterwards cannot recover members that were never read: the sheet needs a fresh read once it
575
- can be registered. Say that to the user, or they will assume the steel is there and unpositioned.
576
-
577
- **AND CLEAR EVERY MODEL-LEVEL REFERENCE TO THOSE MEMBERS, or the read still fails.** v1 stores
578
- members inside their plan, but several blocks point AT them from the document root, and a dangling
579
- reference is its own blocking issue — you escape `registration-incomplete` straight into
580
- `prop-label-unresolved`, `joint-ref-unresolved` or `candidate-references-broken`, which is more
581
- cryptic and, because no candidate gets built, names **no sheet at all**. Before dropping a sheet,
582
- remove every id belonging to it from:
583
-
584
- `prop_labels.ids` · `joints[].main` and `joints[].secondaries` · `views[].objects` ·
585
- `detail_placements[].sheet` · any cross-sheet `dims` reference.
586
- 3. **If it is the ONLY framing plan in the set, there is no way through.** A read with no plans is
587
- refused with `no-plans`. Say so and stop — do not invent a datum to get past the gate.
588
- 4. **Tell the user plainly which sheets you left out and why**, so they can decide: mark up the drawing
589
- with a labelled control and re-read, or accept the omission. That is their call, not yours to make
590
- silently either way.
591
-
592
- **Never** invent a datum, reuse another sheet's coordinates, or fabricate `control2_ref` labels to get
593
- past the gate. A registration that is wrong is worse than a sheet that is absent: every member read
594
- from that sheet lands in the wrong place, and nothing downstream can tell.
595
-
596
- If a read is refused anyway, the error names the sheets — e.g.
597
- `plan-uneditable:registration-incomplete on sheets S-203, S-207`. Fix or drop exactly those and re-read.
598
- (Verified against the message the server actually produces — `steel-takeoff-skill-registration.test.ts`
599
- pins the two in step, because an example the AI cannot find in the error is worse than no example.)
600
-
601
- - **Say so when a sheet is rotated or mirrored** relative to the others (a plan drawn at a skew, or a
602
- reversed-hand view). A datum point fixes translation only; it cannot correct orientation, and
603
- registering such a sheet as if it were square would silently distort every member read from it.
604
- - **Record the elevation the sheet CUTS as `plan.elevation_in`** (decimal inches, same convention as
605
- `default_tos`) — read it off the drawing's stated level datum for that view (the level table, the
606
- frame elevations, a section). Datum + elevation together place the sheet as a horizontal cut plane in
607
- 3D: datum fixes it in plan, elevation fixes it in height.
608
- **Never take it from a T.O.S. callout on a level that varies.** Those are surface points, not the cut
609
- plane, and picking one of them collapses exactly the distinction the next bullet draws. If no cut
610
- elevation is stated for the view, omit `elevation_in` rather than inventing one from the steel.
611
- - **`default_tos` is NOT the sheet's cut elevation** — it is the fallback top-of-steel applied to members
612
- whose ends are blank. The two often carry the same number on a framing plan, which makes conflating
613
- them easy and wrong: a plan can default its blank ends to one level while cutting at another. Author
614
- both, independently.
615
- - **A SLOPED level must NOT be given a `default_tos` at all.** A single fallback is a lie about a surface
616
- that varies. Resolve the ends from the T.O. STEEL callouts instead (§2 step 9, "Cross-sheet sources"),
617
- and leave `default_tos` absent.
618
- **But absent is not the same as safe: `steel.takeoff/v1` has no "unknown" elevation.** A blank
619
- `ends[].tos` falls back to `default_tos ?? 0`, so with the default correctly omitted an unresolved end
620
- renders **silently at zero** — roof steel on the ground, flagged by nothing. On a sloped plan every end
621
- must therefore carry an EXPLICIT `tos`; a member whose ends genuinely cannot be resolved goes to
622
- `read_notes` and is **not emitted at all**. (Only `steel.model/v2` can say "unknown" out loud — there
623
- the member is retained and the export refuses rather than substituting anything.)
624
- - **Read the elevation off the drawing; always ASK for the datum.** The elevation is printed and can be
625
- re-read later; which intersection the project calls 0,0 is the user's intent and cannot be recovered
626
- after the fact.
627
-
628
- **Write the datum block back** through the same verb as the grid — one call carries both:
629
-
630
- ```
631
- PUT /api/projects/<projectId>/steel-prepass If-Match: <the current ETag>
632
- { "datum": { "axis_x": "A", "axis_y": "1" },
633
- "sheets": { "<sheet>": { "grid": …, "datum_at": [x, y], "datum_ref": …,
634
- "control2_at": [x, y], "control2_ref": …, "elevation_in": 144 } } }
635
- ```
636
-
637
- **On a `steel.model/v2` model, the same call without the two the verb refuses** — no root `datum`, no
638
- per-sheet `grid`:
639
-
640
- ```
641
- PUT /api/projects/<projectId>/steel-prepass If-Match: <the current ETag>
642
- { "sheets": { "<sheet>": { "datum_at": [x, y], "datum_ref": …,
643
- "control2_at": [x, y], "control2_ref": …, "elevation_in": 144 } } }
644
- ```
645
-
646
- Those six per-sheet keys and `datum` are the complete set the verb accepts alongside `filter` **on
647
- `steel.takeoff/v1`**; on `steel.model/v2` it is the five per-sheet registration keys and `filter`.
648
- Anything else — `members`, `memberRefs`, `title`, `raster_b64` — is refused **by name** with a `400`, so
649
- a write that thinks it saved the model will hear about it rather than silently succeeding.
650
-
651
- **Then STOP and hand off — checkpoint before the member read.** Tell the user to open the **Filter**
652
- node, flip through the sheets, narrow to the steel, and **Save**. The saved `on` flags + `mode` are
653
- what step 2 reads — **per sheet** (each sheet's elements passing `mode` + the global `on` flags). Only
654
- after the filter is baked (confirm with `GET /api/contract/steel-model` → a `filter` with `sheets`, or
655
- `POST …/score` → `filterMissing: false`) do you proceed to the member read. The member read binds to
656
- the user's kept steel; running it against a filter-less contract is the gap this checkpoint exists to
657
- close.
658
-
659
- ### 2. Read it with your own vision — the heavy pipeline
660
-
661
- > **Candidate geometry comes from the filter (1b) — which you already baked.** By the time you reach
662
- > here, step 1b has run and the user has Saved the Filter node, so the contract carries a `filter`: the
663
- > member candidate set **for each sheet** is that sheet's **kept** line elements
664
- > (`filter.sheets[i].elements` whose layer/thickness/colour pass the GLOBAL `mode` + `on` flags) — bind
665
- > labels to *those*, not to a length-filtered scan of the whole sheet. The length heuristic below is a
666
- > **degraded fallback** for the raster-only exception in 1b (no vector paths to enumerate); if you find
667
- > yourself using it on a vector PDF, you skipped 1b — go back and do it.
668
-
669
- Follow the methodology condensed here (full detail + every gotcha in
670
- `docs/superpowers/specs/2026-06-17-steel-takeoff-agent-guidance.md`):
671
-
672
- 1. **Sheet index.** If it's a multi-sheet PDF, read the index sheet (e.g. `S-100`) once with
673
- vision to build a `sheet → page` map. Focus the takeoff on one or a few framing plan sheets
674
- (Foundation, Floor, Roof); say which.
675
- 2. **Tile the framing area** in display space (e.g. 4×3 grid, render scale ~2.0). Record each
676
- tile's display origin and extent.
677
- 3. **Geometry (exact).** `page.get_drawings()` → keep member-scale line segments (~8–45 ft) in
678
- display coords, tagged H/V/D. These are the candidate members and the snap targets.
679
- 4. **Labels — three sources, applied in order to WHATEVER EACH LABEL IS. They are not per-sheet modes.**
680
- One sheet routinely mixes them (live text in a schedule block, outlined glyphs on the framing), so
681
- run them as successive passes over the same sheet and never let the first one end the step:
682
- 1. **Live text spans** — where `page.get_text("dict")` returns real spans, you already have the
683
- string AND an exact bbox; take them, no vision pass needed for *those* labels. Keep the line's
684
- direction (`line.dir`, or recover the quad) — a span bbox alone loses the orientation of rotated
685
- text, and vertical labels are normal on a framing plan.
686
- 2. **Outlined glyphs (the usual case)** — for every label the first pass did **not** cover, the text
687
- is drawn as paths, so it is present in the vector data as a cluster of tiny glyph strokes.
688
- Harvest those instead of asking vision where the label is; you get an **exact** bbox, orientation
689
- and centre for free, and the read becomes text-only. That is the procedure below.
690
- 3. **No vector text at all (a scan)** — the positional fallback at the end of this step, for
691
- whatever the first two passes still left unread.
692
-
693
- **Whichever sources a sheet uses, the dedicated skew / `D`-segment pass below is still mandatory.**
694
- It is about geometry, not about how the text is stored, and it is the most-skipped step in this
695
- section — reaching step 5 with live text in hand is not a reason to have skipped it.
696
- 1. **Find the right layer, and verify it.** The label layer is a *hypothesis* exactly like a member
697
- layer (§0). A name containing the member type (`*ANNO-BEAM*`) very often holds the beam **end
698
- symbols** — connection arrowheads and diamonds — while the sizes sit on the plan's generic
699
- `*ANNO-TEXT*`. **Render ~20 clustered runs from the candidate layer as a montage and confirm
700
- they are text before building anything on it.** Thirty seconds; it fails loudly instead of
701
- silently binding arrowheads to beams.
702
- 2. **Cluster glyph strokes into runs.** Union-find over glyph bounding boxes, merging when the
703
- horizontal and vertical gaps each fall under **their own** threshold (start at x ≈ 1 × glyph
704
- height, y ≈ 0.5 × glyph height — one scalar for both axes cannot separate a wide label from two
705
- stacked ones). Tune by the resulting histograms, not by guesswork: too small and `W16x26` splits
706
- into `W1` + `6x26`; too large and two neighbouring labels merge. Check **both** — the width
707
- histogram should show a clear mode at one-label width, and the **height** histogram a mode at one
708
- text line. Width alone cannot see the commonest merge on a framing plan: a size above the beam
709
- line and another below it, fusing into a normal-width, double-height run.
710
- 3. **Montage and read row-major.** Crop each run, rotate vertical runs upright, and tile them into a
711
- fixed grid (e.g. 5 columns × 9 rows). One vision pass reads ~45 labels. Index is `row*cols + col`
712
- by construction, so the text binds back to an exact position with **no coordinate translation and
713
- no normalized fractions to convert**. Chunk into several images if there are many runs.
714
- 4. This same montage pattern reads **grid-bubble marks**, **callout numbers and target sheets**, and
715
- **title-block sheet numbers for the whole set** (crop every sheet's title block, tile, read once
716
- — that is the sheet index in one pass). Prefer it anywhere you need many small texts.
717
-
718
- *Only on the third branch — no vector text at all* (a scan) — fall back to tiling the framing area
719
- and reading labels positionally. **That is the one case where a reader reports a position**, and it
720
- must be as **normalized fractions [0..1]**, never pixels, which are scale-ambiguous once an image is
721
- downscaled. On the montage path no position is ever reported: it comes from the run's own bbox and
722
- the tile index.
723
- - **Skew bays get their OWN dedicated pass — they are the most-skipped members.** A skewed/angled
724
- framing bay read together with the orthogonal grid loses its diagonal members (the orthogonal
725
- pass "swallows" them, and free-hand label positions don't bind to the diagonal lines).
726
- - **Reliable skew method = bind to the EXACT diagonal geometry, don't free-place.** This is the
727
- technique that works:
728
- 1. From step 3, take the `D` member-scale segments (the exact diagonal geometry) and their
729
- bounding box — that's the skew bay.
730
- 2. Render that bbox at high DPI and **draw the `D` segments over it, each NUMBERED** at its
731
- midpoint (red line + index 0..N).
732
- 3. One vision pass over that numbered image maps **each segment index → its label** (chords are
733
- typically the short collinear sub-segments = `W16X26`; the long perpendicular rungs =
734
- `W21X62`/`W12X19`; `MF` where it's a moment mark). Give the reader the per-segment length to
735
- disambiguate chord-vs-rung.
736
- 4. Build one member per `D` segment using the segment's OWN endpoints as the work-points (so the
737
- member lands exactly on the drawn line), profile from the map, AISC weight via lookup.
738
- 5. Replace any earlier free-placed diagonal members in the bay (members whose *real* orientation
739
- is diagonal) with these exact ones. Cross-check: `D`-segment count ≈ diagonal members — a
740
- pile of unbound `D` segments means skew is still missed.
741
- 5. **Bind** each label to the nearest matching segment (within tolerance, orientation penalty on
742
- mismatch). **Bind `D` labels to `D` segments** (don't let a diagonal label grab a nearby
743
- orthogonal grid line). Assign **greedily by ascending distance**, so a near-miss cannot steal a
744
- segment that another label owns outright.
745
- - **One-to-one applies PER ANNOTATION TYPE, not per segment.** At most one competing *profile
746
- size* may win a segment — but a segment legitimately carries a size **and** an `MF`/`BF` mark,
747
- a detail tag, a connection note and an elevation callout at the same time (step 8's dedupe rule
748
- exists precisely because "a W-size + its `MF` mark" bind to the same line). A blanket
749
- one-label-one-segment rule silently discards whichever of those two arrives second.
750
- - **Nearest-wins is unsafe between close parallels — flag, don't guess.** A label sitting between
751
- two parallel members binds to whichever is marginally closer, and "marginally" is often a couple
752
- of px. Treat a binding as **ambiguous whenever the runner-up segment is within ~2× the winning
753
- distance** and the two candidates are parallel. Do not silently take the nearest: resolve it by
754
- evidence (which member does the label's leader touch? which one has no other label?) or leave the
755
- member unbound for the coverage queue. A confidently wrong size is worse than an RFI.
756
- - **A member whose ONLY label is a mark** (`MF`/`BF`, a frame member with no printed size) should be
757
- resolved from the **schedule or elevation by grid geometry** — geometry against a named grid line
758
- is stronger evidence than proximity to a text run. **But this does not outrank a printed size:**
759
- where the plan prints a W-size on the beam, §0's rule stands — read the printed size and keep the
760
- mark as `mf: true`. (The scorer agrees: `mf: true` marks the **profile** factor as
761
- schedule-assumed — it does not touch the elevation factor, which depends only on `tosDef` — and
762
- that alone caps an otherwise-high member at **med**. So preferring the schedule where the plan
763
- states the size both contradicts §0 and costs confidence.)
764
- - Segments that remain unbound are the coverage queue (the human's markup worklist) — a pile of
765
- unbound `D` segments means skew was missed; go back to step 4.
766
- 6. **Work-point extend — ALONG THE MEMBER'S OWN AXIS, never toward a nearby line.** Extend each bound
767
- segment's drawn-short ends to the centerline intersection of connecting members: intersect the
768
- member's **infinite line** with the other member's infinite line and move the endpoint to that
769
- parameter along its own direction vector (capped reach). This closes joints and is skew-proof.
770
- - **Never snap an endpoint to the nearest point on another line.** That moves the end *laterally*,
771
- pivoting the member off the line it was drawn on. It looks identical on screen, but it severs the
772
- geometric link between the member and the filter linework it came from. The guard tests two
773
- things — near-zero cross product (parallel within a few degrees) **and every filter endpoint
774
- within a couple of px of the member's line** — and it is the second that a lateral snap trips,
775
- long before the angular one does. Do not reassure yourself with the angle: a sub-degree rotation
776
- on a long member is already several px of offset at the far end. Preserve the direction vector
777
- and both checks pass for free.
778
- - **You do not have to wait for the commit to find out.** `POST …/score` returns
779
- `filterMismatchCount` and up to ten `filterMismatchSamples` (`{id, sheet}`) — the same count the
780
- revision-read guard rejects on. Check it **before** you post: a non-zero count is that rejection,
781
- one step earlier and with the offending member ids. Only if you skip that check does this surface
782
- as "member line(s) not backed by the saved Steel Filter selection" at commit.
783
- 7. **AISC lookup for weights — look up EVERY distinct designation; NEVER read the weight off the name.**
784
- Call the `steel-detailer-us` agent's `lookup` verb for **every** distinct profile in the takeoff →
785
- `plf`, and build `weights: { profile → plf }`. Do **not** derive plf from the designation: the trailing
786
- number is the weight *only* for W/S/M/HP/C/MC/WT (e.g. `W16X26`→26, `C6X8.2`→8.2), but it is the **wall
787
- thickness / leg size** for `HSS`/`PIPE`/`L` — `HSS6X6X3/8` is **27.48 plf, not 3/8**; `L4X4X3/8` is 9.8.
788
- Cherry-picking (looking up only the W's, or "eyeballing" the number) is exactly how HSS/pipe/angle
789
- members ship weightless. (A common miss: the W's and an angle resolve, but an `HSS6X6X3/8` is
790
- never looked up → it rendered but had no weight, so the editor flagged it RFI "not in the AISC table"
791
- and it dropped out of the BOM.) The lookup **is** the source of truth for weight — batch **all** distinct
792
- designations through it, HSS/PIPE/L/WT included.
793
- - **Validate each designation before you trust the read — a garbled one won't resolve.** The lookup key
794
- must be a real AISC form: `W/S/M/HP<d>X<wt>`, `C/MC<d>X<wt>`, `WT/ST/MT<d>X<wt>`, `HSS<a>X<b>X<t>` (or
795
- `HSS<od>X<t>`), `PIPE<…>`, `L<a>X<b>X<t>`, and the **double angle `2L…`** — a detail that reads
796
- "DOUBLE L4x4x3/8" is a double angle, **not** the single `L4X4X3/8` (which is half the steel). A
797
- `2L` key also encodes the back-to-back spacing (and, for unequal legs, the orientation), so read
798
- those off the detail and look the exact key up; never double a single shape's weight by hand.
799
- *(A `2L` has no single-section footprint, so `contract-to-scene` cannot extrude it — it renders in
800
- the 2D plan and counts in the BOM, but is reported in the 3D bake's `skipped` list. Say so.)* **The separator between tokens is `X`, never a repeated
801
- letter** — an OCR read like `C6C8.2` (the `X` misread as `C`) is malformed and must be corrected to
802
- `C6X8.2` before lookup (a whole run of channels can otherwise ship as `C6C8.2` → all weightless). If a
803
- designation doesn't resolve, first check it's not a misread (fix + retry) before deciding it's a true
804
- RFI — a lookup miss on a resolvable size is a reader bug, not an unknown.
805
- - **Completeness self-check (do this before hand-off, it's cheap and deterministic).** After building
806
- `weights`, assert **every distinct non-`MF`/`BF` profile used by a member has a numeric weight**. Any
807
- gap is a **reader miss to fix** (re-validate the designation, re-run the lookup) — **not** an RFI to
808
- pass to the user. The `/score` endpoint surfaces the same signal: an rfi-band member whose reason is
809
- **"…not in the AISC table"** (as opposed to "no profile assigned") means the size *is* known but you
810
- failed to resolve its weight — go resolve it, don't ship it. (`MF`/`BF` marks are the only legitimately
811
- weightless entries — they stay RFI until resolved to a real size from the Frame Elevations.)
812
- - Verify the lookup is live with a known section (e.g. `W16X26 → 26 lb/ft`) before trusting a full run —
813
- `~/.aware` rules can vanish on agent re-update (gotcha §6); if every member comes back weightless,
814
- restore `rules/aisc-shapes-v15.json` into the installed agent dir.
815
- 8. **Dedupe coincident members — by FOOTPRINT *and* ORDERED ELEVATION, never by footprint alone.**
816
- **First, don't create the duplicate: MERGE the annotations, then dedupe what is left.** Step 5 binds
817
- a size, a mark, a detail tag and a connection note to the *same* segment on purpose — emit them as
818
- **one** member carrying all of those facts (`profile` *and* `mf: true`), never one member per label.
819
- This matters because the deduper **deletes** the losing id rather than merging it: emit a `W16x26`
820
- member and a separate `MF` member on one line and "a real profile beats an `MF`/blank" drops the
821
- `MF` member outright, silently losing `mf: true` — which is supposed to be persistent and survive
822
- AISC resolution. Dedupe is for genuinely coincident *members* (overlapping tile reads, repeated
823
- passes), not for annotations of one member.
824
-
825
- What remains after that merge still needs deduping: overlapping tile reads emit coincident members
826
- that double-count the BOM. But two members can legitimately share a footprint —
827
- a beam stacked over a beam, and (critically) **the two legs of an X-brace, which project onto the
828
- same plan line**. Collapsing on work-points alone silently destroys one of them. Use the exact rule
829
- the editor and server use (`redundantDups` / `redundantDupIds`):
830
-
831
- - group by **footprint**: the two work-points, order-independent, rounded to ~3 px;
832
- - within a group, compute each member's **elevation signature** `[tos0, tos1]` **in end order**
833
- (a column's is `[col.tos, col.bos]`); a member with no explicit elevation signs as `na`;
834
- - **≤ 1 distinct explicit signature** ⇒ they are copies of one member: keep the most-resolved
835
- (a real profile beats an `MF`/blank; an elevation-tagged copy wins ties), drop the rest — an
836
- `na` member is a **wildcard** and collapses against whatever shares its footprint;
837
- - **≥ 2 distinct explicit signatures** ⇒ genuinely different objects: keep the best per signature,
838
- and **keep every `na` member** (ambiguous — never silently dropped).
839
-
840
- The signature is **order-sensitive** on purpose. That is what lets an X-brace's two legs coexist —
841
- see §2b. (The editor ALSO auto-dedupes on load, and it **deletes**, not flags. Produce a clean
842
- contract here; do not lean on it, and do not hand it a contract it will quietly prune.)
843
- 9. **Cross-sheet sources.** Frame Elevation sheets → moment-frame schedule (resolve `MF` marks),
844
- level datums (Ground / Second Floor / Roof elevations). **Section views → levels that appear
845
- NOWHERE else — always open them if the set has any.** See guidance spec §5 for what each sheet
846
- gives you.
847
-
848
- **T.O. STEEL callouts are WORKING POINTS, not per-zone stamps.** Search for them FIRST, before
849
- reaching for any default: each one fixes top-of-steel at a known location, so every member framing
850
- at that point sits at that elevation and the level lies on the surface the points define. Do NOT
851
- look for "a callout in this bay" and give up when there isn't one — that leaves a whole roof
852
- unresolved when the sheet in fact over-determines it. Instead:
853
- - **Trace each leader to its real endpoint.** A T.O.S. leader usually lands on a **column point**,
854
- not a beam. Where the members meeting that point belong to one continuous surface, the callout
855
- fixes all of them at once — that is what makes it powerful. It does NOT license blind propagation:
856
- stepped framing, a dropped bay, secondary steel and overlapping roof facets can all put different
857
- elevations at one plan point. Propagate only to members you have shown share that surface, and
858
- stop at anything the drawing separates (a step note, a level change, a seismic joint).
859
- - **Tabulate `(location → value)` and let it tell you the surface.** Candidate shapes to TEST, not a
860
- law to apply: flat; a function of ONE axis (a one-way slope); a general plane varying in both
861
- (`z = ax + by + c`); several independent surfaces (separate structures, or facets meeting at a
862
- ridge/valley); or stepped/warped/cambered, which no single fit describes. **Check the fit and
863
- record the residuals** — a tight fit is evidence, a poor one means your surface model is wrong,
864
- not that the drawing is. Callouts sharing a coordinate the surface does not vary along must agree;
865
- if they disagree, you have the wrong shape.
866
- - **Then read every remaining member off the surface — and be honest about how each value was got.**
867
- A value INTERPOLATED between callouts that bracket it is sound. **EXTRAPOLATION past the outermost
868
- callout is not**: allow it only within the same continuous surface facet, only for a short reach
869
- compared with the callout spacing you fitted (a fraction of one bay, never a new bay), and only
870
- when nothing in the drawing suggests the surface changes out there. Beyond that the elevation is
871
- **unresolved — RFI it**; do not stretch the plane to cover the sheet.
872
- - **Name the derived elevations in `read_notes`.** Neither contract has an elevation-provenance
873
- field: v1 records only `tosDef:false` ("explicit"), and the confidence scorer reads ANY explicit
874
- `tos` as "from a drawing callout" and awards the same high band whether you measured it or fitted
875
- it; v2's `z` distinguishes only known from unknown. So the score will not tell the user which
876
- elevations were read and which were derived — `read_notes` is the only place that distinction
877
- survives, which is exactly why naming them there is mandatory, not optional.
878
- - **A member crossing the fall gets a different `tos` at each end** (`ends[0]`/`ends[1]`) — never one
879
- averaged value. In `steel.model/v2` this is `from.z`/`to.z`, which are independent by design.
880
- - Every set states this differently — some on the plans, some only in a section, some with a slope
881
- note. The invariant is the ORDER: find the callouts, fit the surface, then place members.
882
-
883
- **Hard-won gotchas (from the guidance spec § 6 — do not skip these):**
884
- - **Text is usually outlined, not real text.** On most sets `get_text()` returns almost nothing and
885
- everything textual needs vision. **Check rather than assume** — some sets do ship live spans, and
886
- where they exist they are exact and free (step 4, first branch). Never *conclude* from an empty
887
- `get_text()` on one sheet that the whole set is outlined.
888
- - **Pages may be rotated (e.g. 270°).** Work entirely in display space via
889
- `page.rotation_matrix`. Never mix native/display coords — this is the single biggest source of
890
- misplaced members.
891
- - **`page.get_pixmap(clip=…)` is the ONE call that wants the rect already in DISPLAY space — do
892
- NOT derotate it first.** Every *extraction* (`get_drawings()`, `get_text()`, `search_for()`)
893
- hands back **native** coordinates you push through `page.rotation_matrix` to reach display space,
894
- so "always transform" becomes muscle memory — and it is wrong here. `clip` is interpreted in the
895
- same rotated frame as PyMuPDF's `Page.rect` attribute and the element `d`/`bbox`/`cx,cy` coords you
896
- already hold, so the display-space crop goes in **verbatim**; that same rect is also what you write
897
- into the sheet entry's `page.rect` field (step 3 above). Running it through `derotation_matrix`
898
- first silently renders a *different region* of the sheet. At 90°/270° that usually swaps the crop's
899
- width and height, so an
900
- **exact** expected-dimensions assert often does catch it — but at 180°, or on a square or
901
- symmetrically-clipped region, the pixel size comes back plausible, so dimensions alone cannot
902
- reliably rule it out. The symptom is a `bg_b64` backdrop shifted and rescaled under
903
- correctly-placed linework; the check that always settles it is a pixel-diff of the crop against the
904
- same region of a full-page render.
905
- - **When a subagent reports a POSITION — the scan-only fallback of step 4 — it must be normalized
906
- fractions, one pass, no sub-cropping.** Pixel coords from a subagent collapse after downscaling.
907
- The live-text and montage branches of step 4 are exempt: neither asks a reader for a position at
908
- all (it comes from the span/run bbox and the tile index), and the montage path sub-crops by design.
909
- - **`MF` / `BF` are marks, not profiles.** No AISC section until resolved from Frame Elevations
910
- by grid + level. Leave as `rfi` and `mf: true` until auto-resolved or the user picks.
911
- - **AISC rules can vanish.** Verify `steel-detailer-us` with a known section before a full run
912
- (`W16X26 → 26 lb/ft`); if every member comes back weightless, restore `rules/aisc-shapes-v15.json`
913
- into the installed agent dir from the aware-aeco repo. Seen cause: the agent was renamed
914
- `steel-detailer-aisc → steel-detailer-us`, so an old lookup binary points at a dir that no longer
915
- exists — make sure you're calling the current `steel-detailer-us` and its rules dir is populated.
916
- - **Half-grids have no plan coordinate.** Auto-resolve only confident cases; surface the rest in
917
- the `rfi` panel.
918
- - **Detail callout detection misreads numbers/sheets.** Verify at high zoom before trusting
919
- (both the number and the sheet can be wrong).
920
- - **`(N)` = new, `(E)` = existing (often out of scope).** Read the full set for context before
921
- deciding.
922
-
923
- ### 2b. Braces — emit them as first-class members
924
-
925
- A brace is a **member**, not annotation. Two kinds, one contract shape:
926
-
927
- ```jsonc
928
- "role": "beam", // ALWAYS 'beam' — the schema's role enum is beam|column
929
- "memberType": "brace",
930
- "position": "middle", // VERTICAL braces only (see below)
931
- "brace": {
932
- "type": "lateral" | "vertical",
933
- "floor": "above" | "below", // vertical only → solid vs long-short-dashed in the 2D plan
934
- "offset": 12, // vertical only, SIGNED INCHES, DISPLAY-ONLY
935
- "lowerEnd": 0 // optional override; otherwise derived from the ends' TOS
109
+ {
110
+ "id": "b-S201-014",
111
+ "profile": "W16X26",
112
+ "role": "beam",
113
+ "memberType": "beam",
114
+ "provenance": "read",
115
+ "from": { "x": 0, "y": 0, "z": { "known": 5029.2 } },
116
+ "to": { "x": 7620, "y": 0, "z": { "known": 5029.2 } },
117
+ "ends": [{ "note": "shear" }, { "note": "shear" }]
936
118
  }
937
119
  ```
938
120
 
939
- `brace` is a **closed** sub-object — an unknown key or a bad enum value fails the PUT.
940
-
941
- **Lateral brace** — a kicker that braces a beam, running between beams.
942
-
943
- 1. Take the kept **member-scale stroke lines on the bracing layer** (identified by the census in §0, not
944
- by its name), one member per line, work-points
945
- from the line's **own endpoints** (then run the work-point extend of step 6). `brace:{type:'lateral'}`.
946
- 2. **No `offset`, no `position`** — a flat kicker keeps the beam default.
947
- 3. **Size it from the detail the legend names — read that detail, do not skip to RFI.** It carries the
948
- member (e.g. *"DOUBLE L4x4x3/8 w/(2) bolts each end"* → a **double angle** in the `2L…` family, NOT
949
- the single `L4X4X3/8`, which is half the steel; read the back-to-back spacing to form the exact key).
950
- A detail may defer (*"see <n>/<sheet> for balance of info"*) — follow the chain. Only when the size is
951
- genuinely nowhere in the set does the brace become
952
- `rfi:true`, `profile:""`, reference in `ends[].detail`. Never copy a neighbouring beam's W-size, and
953
- never RFI a size the set actually shows.
954
- 4. `ends[].tos` from the beams it connects to (explicit, `tosDef:false`).
955
- 5. **Retype an already-read diagonal only on hard evidence.** Convert an existing member to
956
- `memberType:'brace'` when **all three** hold: its end-note is **exactly** `brace` (trimmed,
957
- case-insensitive), its profile is a **brace family** (`HSS…`, `L…`, `PIPE…`, rod), and its geometry
958
- is diagonal / off the orthogonal frame. Never substring-match the note — a *braced-frame beam*
959
- carries notes like `"braced-frame beam; size defined in Section <n>/<sheet>"`, which contains the
960
- word `brace` and is a wide-flange **beam**.
961
-
962
- **Vertical brace** — diagonal frame bracing between two column lines. It is drawn on the **BRACE FRAME
963
- ELEVATION** sheets, not on the plan, so it is **derived**, and every step must stay deterministic.
121
+ Store columns base-to-top. Preserve authored endpoint order for every other role. `role` and
122
+ `memberType` are authored facts, never guesses derived from geometry. Resolve section mass through the
123
+ region-appropriate steel detailer and record unresolved marks honestly.
964
124
 
965
- 1. **Supported topologies: a full-bay `X` and a single full-bay diagonal.** Chevron, inverted-V, K and
966
- multi-panel frames have intermediate work-points that are not the column centres — record them in
967
- `read_notes` and emit nothing. **Never fabricate a second leg to "complete" an X.**
968
- 2. **Geometry deterministically, labels by vision** — the elevation sheet is not in `filter.sheets`, so
969
- run a dedicated `page.get_drawings()` pass over that page (display space via `page.rotation_matrix`),
970
- isolate each `BRACE FRAME ELEVATION ALONG GRID <g>` detail by its viewport, and **count the legs from
971
- the diagonal stroke segments**. Vision only reads the labels (grid marks, level elevations, the
972
- `HSS…` size, the connection ids).
973
- 3. **No scale mixing.** The elevation supplies *topology, levels, grids, labels*. The **plan** supplies
974
- the *work-points*. An elevation coordinate must never land in `wp`.
975
- 4. **Work-points** are the plan **column centre-lines** at the frame's two end grids, ordered by the
976
- canonical endpoint rule (left→right). **Both legs of an X share that same `wp` order.**
977
- 5. **Transpose the elevations between the legs**, never mirror the work-points. With canonical
978
- endpoints `A`,`B`: one leg is `ends = [lowerAtA, upperAtB]`, its partner `ends = [upperAtA, lowerAtB]`
979
- (`tosDef:false` on all four). Per-side elevations matter — a roof at `ELEV = VARIES` differs between
980
- the two grids.
125
+ Elevation is explicit at both endpoints:
981
126
 
982
- > **Why:** dedupe (step 8) groups by an order-independent footprint but an **order-sensitive**
983
- > elevation signature. Transposed elevations give the two legs distinct signatures and both survive.
984
- > Mirror the `wp` instead and both collapse to one signature — the editor's first-load auto-dedupe
985
- > **deletes** a leg and the BOM silently loses its tonnage.
127
+ - known: `{ "known": 5029.2 }`;
128
+ - unknown: `{ "unknown": true }`, optionally with an `rfiRef`.
986
129
 
987
- 6. **`position:'middle'`** — emit it explicitly. A vertical brace is centred on its work-line, and both
988
- the bake and the editor's inspector now default it that way, but stating it in the contract keeps the
989
- placement independent of that default (and of the slope heuristic, which mis-reads a shallow brace in
990
- a wide bay as "roughly flat").
991
- 7. **`offset`** is DISPLAY-ONLY and never reaches 3D/IFC/Tekla. A vertical brace's plan line is
992
- collinear with the braced-frame beam above it, so `offset:0` hides the symbol under the beam, and an
993
- X's two legs at the *same* offset overlap so only the topmost is clickable. Emit **`+12` and `−12`**
994
- for a paired X (one foot each side); **`+12`** for a lone diagonal.
995
- 8. **Profile** from the elevation label, through the `steel-detailer-us` lookup like every other
996
- designation — an `HSS`'s trailing number is its **wall thickness**, not its weight.
997
- 9. **`id`** — stable, globally unique, and **sheet-independent**:
998
- `vb-<detailRef>-<alongGrid>-<endGridA>_<endGridB>-<story>-<leg>`, e.g. `vb-<detail>-<grid>-<endA>_<endB>-<lowElev>_<highElev>-a`.
999
- `<story>` is the ordered level-elevation pair (`0_198`), never an index. `<leg>` is the physical
1000
- orientation (`a` rises A→B, `b` rises B→A), never extraction order. The **sheet is deliberately not
1001
- in the id** — the version diff keys members by `sheet + id`, so baking the owner sheet in would break
1002
- identity as soon as ownership changes. On a **revision re-read, reuse the previous owner sheet** before
1003
- applying the fallback below.
1004
- 10. **Provenance:** `ends[].detail` = the frame-elevation reference (e.g. `n/S-3xx`); `ends[].note` =
1005
- that end's brace-frame connection label, bound to the endpoint it actually annotates. Neither
1006
- creates a `connections[]` row.
130
+ Never use null, a plan cut elevation, or a convenient default to hide an unknown endpoint. Unknown
131
+ elevation blocks export by design while keeping the member visible for review.
1007
132
 
1008
- **Which plan owns a vertical brace (or the BOM double-counts it).** A brace spans two levels, so two
1009
- plans could claim it. Emit it **exactly once**:
133
+ ### Observations and bindings
1010
134
 
1011
- - the **lower** level's plan if that plan is *usable*, with `floor:'above'`;
1012
- - else the **upper** level's plan if usable, with `floor:'below'`;
1013
- - else **no member** — a `read_notes` entry.
135
+ Every first-read member and every new or reader-changed member in a revision needs fresh active drawing
136
+ evidence. Only an unchanged prior manual member may remain without observations.
1014
137
 
1015
- *Usable* means **both** of these hold on that plan:
138
+ Each observation is model-globally unique and split into immutable `evidence` and mutable `binding`:
1016
139
 
1017
- 1. its own filtered `S-COLS*` linework resolves a column footprint at **each** end grid, registered to
1018
- its grid — it does **not** mean the plan owns a column *member*, since a column is stored once as a
1019
- single continuous member and most plans legitimately hold none; **and**
1020
- 2. its own filtered linework contains a **line running along the brace's plan work-line** — in
1021
- practice the brace-frame beam the X sits under.
1022
-
1023
- **Condition 2 is the one that gets missed, and on a v1 contract it is the one the server enforces.** A
1024
- vertical brace is `role:'beam'`, so the revision-read guard requires a saved filter segment backing its
1025
- work-line — a plan that has the columns but draws no beam along that line (a foundation plan, typically)
1026
- will resolve condition 1, pass your own checks, and then be **rejected at commit** with "member line(s)
1027
- not backed by the saved Steel Filter selection". Check `filterMismatchCount` from `POST …/score` first
1028
- (§3) and you see it before the commit does. When the lower level fails condition 2, that is exactly what
1029
- the `floor:'below'` fallback is for: own the brace on the upper plan, which does draw the beam.
1030
-
1031
- **Two limits on that enforcement — do not treat the guard as your only check.**
1032
- - **The member-to-filter half does not cover `steel.model/v2`.** The scoring route refuses v2, and the
1033
- backing test walks `plans[].members`, whereas a v2 model keeps members at the root — so
1034
- `filterMismatchCount` is always 0 there and no server check ties a v2 member to the linework.
1035
- (Filter *presence* is still enforced on both: `filterMissing` reads the top-level `contract.filter`.)
1036
- On the v2 arm of §9 the visual verification of §2c is not a nicety, it is the only check that the
1037
- members match the drawing.
1038
- - **It skips short members.** A plan line under the guard's minimum filter-segment length (~35 px) is
1039
- neither backed nor flagged, so a brace in a narrow bay is unverified either way.
1040
-
1041
- **Before you conclude a plan fails condition 2, confirm the beam is absent from the DRAWING** — not
1042
- merely from the *kept selection*. The test runs against the saved filter segments, so a brace-frame beam
1043
- that is plainly drawn still fails it when its layer was switched off in §1b, or when it is drawn as
1044
- dash-dot strokes each under the length minimum. That is a filter-selection gap, fixed in §1b — never a
1045
- reason to drop the brace. Dropping a real member is the more expensive error: the fall-through below
1046
- emits **no member at all**.
1047
-
1048
- Generalise the principle: **any derived member must be owned by the plan whose linework actually
1049
- contains its plan line**, not merely by the plan that is conceptually "below" it.
1050
-
1051
- **Emit a `read_notes` entry and NO member** when the end grids are absent from `plan.grid`, when no plan
1052
- resolves a column centre at an intersection, when the upper level is `VARIES` and the sheet's `T.O. STEEL`
1053
- callouts do not determine a surface over that bay (§2 step 9, "Cross-sheet sources" — fit the surface
1054
- from ALL the callouts before
1055
- concluding this; a missing callout in one bay is NOT the same as an undetermined level), or when the
1056
- topology is unsupported. An unplaceable brace **cannot** be a member
1057
- (`wp` is required), and an `rfi:true` member whose profile *does* resolve would still be counted in the
1058
- BOM. Key each note `brace:<id> — <reason>`, rebuild them from the source on **every** read (drop the ones
1059
- that have become resolvable — never carry a stale note forward), and **state them in the hand-off**
1060
- (step 6): nothing else surfaces `read_notes` to the user.
1061
-
1062
- ### 2c. VERIFY THE READ BY LOOKING AT IT — mandatory, before you assemble anything
1063
-
1064
- Everything above is inference: layer → kind, label → member, mark → size. Numeric checks confirm a
1065
- contract is *well-formed*; they cannot tell you it is *right*. The only check that catches a label on
1066
- the wrong beam, a dimension arrow modelled as a brace, or a whole layer silently missing is rendering
1067
- what you built on top of what the drawing shows and reading it.
1068
-
1069
- **Do this before §3 scoring and before the member-read write (§5 / §9).** It does **not** defer the
1070
- earlier writes: §1b's filter block and §1c/§1d's grid and datum are upstream of the member read and are
1071
- mandatory before it — this section cannot run until members exist. It costs one render and one look per
1072
- region.
1073
-
1074
- 1. For 2–3 representative regions of **each** plan — include at least one dense/typical bay and one
1075
- irregular area (skewed wing, joint, stair, roof step) — render the source sheet as the background.
1076
- 2. Draw **every member you built** in that region over it: the work-line, and its resolved profile
1077
- printed at the midpoint in a small box. Use one colour for resolved, a contrasting one for RFI /
1078
- unbound, and a third for derived members (braces) that have no label of their own.
1079
- 3. **Read the image.** Every printed profile must match the drawing text lying beside that same line.
1080
- You are looking for four specific failures:
1081
- - a printed size that disagrees with the adjacent text → **label bound to the wrong member**;
1082
- - a drawn member with no line under it → **fabricated or mis-extended geometry**;
1083
- - a drawing line that reads as a framing member with no member drawn over it → **a dropped layer
1084
- or a missed bind**;
1085
- - a member sitting on a dimension string or leader → **census failure (§0)**.
1086
- 4. Fix and re-render until the region reads clean. **Say in the hand-off that you did this and what
1087
- you checked** — "verified N regions across M sheets" is a real statement about the read's quality;
1088
- an aggregate score without it is not.
1089
-
1090
- Do the same for any **derived** geometry (vertical braces, columns placed from clustered footprints).
1091
- Derived members are the ones no label will ever contradict, so a visual check is the *only* check they
1092
- get — and for a **vertical brace that means TWO checks, against two different drawings**, because the
1093
- brace is drawn on a frame elevation while it is *owned* by a plan (§2b):
1094
-
1095
- 1. against its **brace-frame elevation** — topology, profile and end elevations;
1096
- 2. against the **plan** — its projected work-line lands on the plan line that owns it, and that line is
1097
- present in the saved filter selection (§2b condition 2).
1098
-
1099
- Rendering a brace only over the plan checks the second and silently assumes the first.
1100
-
1101
- ### 3. Honor `target_confidence` — score, then LOOP to the goal
1102
-
1103
- Read the app's `target_confidence` input (default 70). The user may also set a **per-read override**
1104
- via the editor (stored as a top-level `target_confidence` on the contract); it wins over the input
1105
- default. On a **re-read / rebake**, preserve any `target_confidence` already on the existing contract
1106
- (carry it into the new draft) so the user's chosen target isn't reset. The confidence score is a
1107
- **deterministic function of observable evidence** — not a model self-report — so you measure it with
1108
- the server, never by eyeballing. Per-member bands (full method in
1109
- `docs/superpowers/specs/2026-06-20-steel-takeoff-confidence-report.md`):
1110
-
1111
- - **Verified (1.0)** — human-confirmed. **High (0.9)** — resolved from drawing evidence, no contradiction.
1112
- - **Medium (0.65)** — one indirection (`MF`→frame schedule) or a plan-default (assumed) elevation.
1113
- - **Low (0.35)** — coincident duplicate. **RFI (0)** — no AISC size resolved.
1114
-
1115
- Aggregate = the **tons-weighted** average of those band weights over the non-RFI members (RFI are
1116
- excluded from the average and counted separately as the headline drag).
1117
-
1118
- **The score endpoint is your gauge — call it, don't guess.** *(v1 documents only: the route refuses
1119
- `steel.model/v2` rather than answering about a model it cannot read. On the v2 arm of §9 there is no
1120
- score to loop against — hold yourself to §2c's visual verification and the §6 hand-off instead of
1121
- looping on a number.)*
1122
-
1123
- ```
1124
- POST http://localhost:<port>/api/contract/steel-model/score?project=<projectId>
1125
- Content-Type: application/json
1126
- { "contract": <your draft contract>, "target": <target_confidence, e.g. 70> }
1127
- ```
1128
-
1129
- **Pass `?project=` whenever you are working inside a project.** It scopes the fallback read and the
1130
- confidence target to that project. Without it — and this route used to IGNORE the parameter entirely
1131
- (#511) — a body-less call scores the APP-level document instead: a confidence answer about a model you
1132
- did not ask about, returned with no error. This route is the gauge the read-loop uses to decide when to
1133
- STOP reading, so a confident number about the wrong model is the worst possible answer. It is safe to
1134
- omit only when there is genuinely no project.
1135
-
1136
- Returns `{ score, target, meetsTarget, gap, rfiCount, counts, worklist, filterMissing,
1137
- filterBackedMembers, filterMismatchCount, filterMismatchSamples }` — the SAME aggregate the editor's
1138
- Confidence chip shows. **The last three are your pre-flight for the §9 commit**: `filterMismatchCount`
1139
- is exactly what the revision-read guard refuses on, and `filterMismatchSamples` names up to ten
1140
- offending members, so a non-zero count here is a commit rejection you can still fix cheaply. `worklist` is the rfi/low/med members dragging the score,
1141
- worst-first (heaviest first within a band), each with a `reason`. (Omit `contract` to score the stored
1142
- one — that is the read the `?project=` scope governs.)
1143
-
1144
- **`filterMissing` is the completeness gate — independent of the confidence score.** `true` means the
1145
- contract has no usable `filter` block: step 1b never ran, so the members were bound by the length
1146
- heuristic, not the user's steel. A filter-less contract can still hit `meetsTarget` — so **do not treat
1147
- `meetsTarget` alone as "done."** If `filterMissing` is `true`,
1148
- go back to step 1b, bake the filter, and hand off the Filter node before continuing. Hand-off (step 6)
1149
- requires `filterMissing: false`.
1150
-
1151
- **The loop** — iterate at COMPOSE time until the goal is met:
1152
-
1153
- 1. Build the draft (steps 1–2), `POST …/score`.
1154
- 2. While `meetsTarget` is false AND the last round improved the score:
1155
- - Take the top of `worklist` and fix by `band`/`reason`:
1156
- - **rfi — "no profile assigned" / "<x> not in the AISC table":** re-read that member's label region at
1157
- higher zoom; re-run the `steel-detailer-us` lookup. **rfi — "unresolved mark MF…":** resolve it from the
1158
- Frame Elevation schedule (grid + level) → set the real profile, keep `mf: true`.
1159
- - **med — "resolved from the frame schedule (assumed)":** confirm the MF resolution against the schedule.
1160
- **med — "plan-default elevation":** resolve that member's ends and set `ends[].tos` with `tosDef:false` —
1161
- from a local T.O.S callout if it has one, otherwise from the surface the sheet's callouts define
1162
- (§2 step 9). "No callout on this member" is not the end of the search; only a surface the callouts
1163
- genuinely do not determine is, and that is a `read_notes` entry.
1164
- - **low — "duplicate":** delete the coincident member (or merge).
1165
- - Re-`POST …/score`. Stop when `meetsTarget`, or after **2 rounds with no score gain** (diminishing returns).
1166
- 3. PUT the final contract (step 5). **Be honest if you stop below target** — report the score, the gap,
1167
- and what's left on the worklist (it's a triage guide, not a hard gate; the user decides whether to Approve).
1168
-
1169
- ### 4. Assemble the `steel.takeoff/v1` contract
1170
-
1171
- Emit a JSON object matching the schema in `schemas/steel.takeoff.v1.schema.json`. Top-level
1172
- required fields: `type: "steel.takeoff/v1"` (discriminator), `plans` (array of plan objects).
1173
- Important optional fields:
1174
-
1175
- ```jsonc
140
+ ```json
1176
141
  {
1177
- "type": "steel.takeoff/v1",
1178
- "source": {
1179
- "name": "<sourceName or basename of the drawing path>",
1180
- "path": "<absolute path you read>",
1181
- "sheet": "<e.g. S-202>",
1182
- "sha256": "<sha256 of the file if available>",
1183
- "read_at": "<ISO 8601 timestamp>"
1184
- },
1185
- "weights": { "W16X26": 26, "HSS6X6X3/8": 27.48 }, // profile → plf; null for unresolved
1186
- "moment_frames": [ … ], // from Frame Elevation sheets
1187
- "detail_bubbles": { "S-504": { "5": [0.32, 0.71] } }, // sheet → { number → [fx,fy] }
1188
- "connections": [ // vendor-neutral connection library
1189
- { "id": "cx-m1", "type": "moment", "detail": "5-S504", "targets": { "tekla": "146" }, "source": "drawing" }
1190
- ],
1191
- "plans": [
1192
- {
1193
- "sheet": "S-202",
1194
- "title": "Second Floor Framing Plan",
1195
- "clip": [x0, y0, x1, y1], // display-space crop of framing area
1196
- "pt_per_ft": 12.3,
1197
- "default_tos": 198, // decimal inches (16'-6" = 198)
1198
- "raster_b64": "…", // CONFIDENTIAL — machine-local, never committed
1199
- "segments": [ { "id": "seg-1", "a": [x,y], "b": [x,y], "o": "H" } ],
1200
- "labels": [ { "text": "W16X26", "disp": [x,y] } ],
1201
- "details": [ { "text": "5-S504", "disp": [x,y] } ],
1202
- "callouts": [ { "kind": "section", "text": "A", "disp": [x,y], "target": { "sheet": "S-301", "number": "A" } } ],
1203
- "tos_callouts": [ { "elev_in": 198, "type": "TOS", "disp": [x,y] } ],
1204
- "members": [
1205
- {
1206
- "id": "m1",
1207
- "profile": "W16X26",
1208
- "material": "A992",
1209
- "wp": [[x0,y0],[x1,y1]],
1210
- "angle": "H",
1211
- "role": "beam",
1212
- "rfi": false,
1213
- "mf": false,
1214
- "ends": [
1215
- { "tos": 198, "note": "moment", "tosDef": false, "detail": "5-S504", "conn": "cx-m1" },
1216
- { "tos": 198, "note": "shear", "tosDef": true, "detail": "" }
1217
- ]
1218
- },
1219
- {
1220
- "id": "c1",
1221
- "profile": "HSS6X6X3/8",
1222
- "wp": [[x,y],[x,y]], // BOTH work points are the SAME plan point — a column is a dot in plan
1223
- "angle": "V",
1224
- "role": "column",
1225
- "rot": 0,
1226
- "rfi": false,
1227
- "col": { "bos": 0, "tos": 198, "tosDef": false, "note": "", "detail": "" }
1228
- },
1229
- {
1230
- "id": "vb-<detail>-<grid>-<endA>_<endB>-<lo>_<hi>-a", // one leg of an X; its partner is …-b with the elevations transposed
1231
- "profile": "HSS6X6X5/8",
1232
- "wp": [[x0,y0],[x1,y1]], // the two COLUMN CENTRES, same order on both legs
1233
- "angle": "D",
1234
- "role": "beam", // never 'brace'
1235
- "memberType": "brace",
1236
- "position": "middle",
1237
- "rfi": false,
1238
- "brace": { "type": "vertical", "floor": "above", "offset": 12 },
1239
- "ends": [
1240
- { "tos": 0, "tosDef": false, "detail": "3/S-3xx", "note": "brace-frame connection <mark>" },
1241
- { "tos": 198, "tosDef": false, "detail": "3/S-3xx", "note": "brace-frame connection <mark>" }
1242
- ]
1243
- }
1244
- ]
142
+ "id": "obs-S201-b014-r1",
143
+ "evidence": {
144
+ "source": {
145
+ "sourceHash": "<queued attachment sha256>",
146
+ "sheet": "S-201",
147
+ "elementId": "<selected Filter element id>"
148
+ },
149
+ "local": { "wp": [[100, 900], [400, 900]], "pt_per_ft": 12 },
150
+ "provenance": "auto-read",
151
+ "observed": {
152
+ "profile": { "value": "W16X26", "confidence": 91 },
153
+ "fromZ": { "value": { "known": 5029.2 }, "confidence": 82 }
1245
154
  }
1246
- ]
155
+ },
156
+ "binding": {
157
+ "memberIds": ["b-S201-014"],
158
+ "status": "active",
159
+ "verified": false
160
+ }
1247
161
  }
1248
162
  ```
1249
163
 
1250
- Key field rules:
1251
- - All `wp` / `disp` / `a` / `b` coordinates are **display space** (not native PDF coords, not
1252
- millimetres).
1253
- - **Endpoint direction (canonical order).** `wp[0]`/`ends[0]` is the member's **START** (drawn as a
1254
- **yellow** dot in the editor); `wp[1]`/`ends[1]` is the **END** (drawn **magenta**). Always emit
1255
- endpoints in a consistent direction so start/end read the same across the whole takeoff:
1256
- - **Columns** — bottom → top (start at the lower elevation): `col` goes `bos` (start) → `tos` (end).
1257
- **A column's TWO WORK POINTS ARE THE SAME PLAN POINT** — `wp: [[x,y],[x,y]]`. The rise lives in
1258
- `col.bos`/`col.tos` and nowhere else; `wp` says only *where the column stands*, and a column stands
1259
- over one point. Emitting two different plan points describes a member that travels sideways as it
1260
- rises, which no column can do — it is what a beam or a brace read as a column looks like, and the
1261
- conversion to the model now stops and asks about every one of them (`column-plan-offset`). If the
1262
- line you are reading really does run across the plan, it is a **beam** (`role: "beam"`, with
1263
- `memberType: "brace"` if it braces), not a column with two points.
1264
- - **Beams** in plan — **left → right** (start = smaller X); for a vertical-in-plan run, **bottom → up**
1265
- (start = the lower end on the sheet, i.e. the **larger** display-Y since display Y grows downward).
1266
- This is the on-screen reading direction (→ or ↑). It costs nothing to get right at authoring time and
1267
- makes the yellow/magenta end handles meaningful in both the 2D and 3D editor.
1268
- - **Section rotation (`rot`) is a MEMBER-level field — it applies to ANY member, not just columns.** A
1269
- column renders in the 2D plan (and 3D) as its **profile-section footprint** (the I-shape, box, channel,
1270
- or angle of its `profile`), and a beam/brace carries the same roll about its work-line in 3D. Emit `rot`
1271
- as the section's in-plan orientation in **degrees** (`0` = as drawn; `90` = a quarter-turn, strong axis
1272
- swapped; any double is accepted, normalised −360…360). **For columns it is MANDATORY — derive it from the
1273
- flange-segment ink, never the bbox** (see §0 "Column ROTATION"). For a beam/brace, emit `rot` only when
1274
- the section is visibly rolled (a canted member); a normal beam stays `0`. The whole path carries it end
1275
- to end — `contract-to-scene` emits `rot` for every member (not gated on `role`) and both the 2D editor
1276
- (`columnSectionPoly`) and the 3D view (`orientMember`) apply it — so the user can dial the exact angle in
1277
- Inspect → **Profile Rotation** for any selected member(s). The section size itself comes from the
1278
- `profile` (no need to trace it). *(The scene builder also skips a zero-height column, `bos==tos` — a
1279
- foundation base marker — so it never renders as a flat plate; the real column is the single continuous
1280
- member read from the frame elevations. Set its true `bos`/`tos` from the elevation, not a per-plan guess.)*
1281
- - Elevations are **decimal inches** (canonical); the editor accepts/displays ft-in strings.
1282
- `tosDef: false` means the value came from a drawing callout; `true` means it follows the plan
1283
- default.
1284
- - **A COLUMN carries its own flag: `col.tosDef`, and it is a SWITCH, not an annotation.** Get this
1285
- one wrong and you lose the number, not just a confidence point.
1286
- - **Emit `col.tosDef: false` whenever `col.tos` carries an explicit read value — near callout or
1287
- distant, it makes no difference.** On the v1→v2 conversion (§9), a `tosDef` that is anything
1288
- other than `false` makes the migration **substitute the sheet's `default_tos` and never read
1289
- your `col.tos` at all** — and if the sheet declares no `default_tos`, the elevation lands
1290
- `unknown`. A column whose top you actually read then ships at the wrong height, silently, into
1291
- the model, the 3D view and the BOM.
1292
- - **Emit `true` only when you emit no `tos` at all** and the top genuinely rides the plan default.
1293
- That is what the surrounding rule already says — `false` = came from a drawing callout,
1294
- `true` = follows the plan default — and it is about the **top only**.
1295
- - **`bos` is not governed by this flag.** The migration always treats `col.bos` as authored, so
1296
- how well-sourced the base is has no bearing on `tosDef`. Condition it solely on where the top
1297
- came from.
1298
- - *Then* the confidence effect, which is the smaller reason to care: the scorer reads
1299
- `ends[].tosDef` for beams and `col.tosDef` for columns, and treats a column's elevation as
1300
- *assumed* unless `col.tosDef` is explicitly `false` — worklist reason naming it a plan default
1301
- (currently "plan default (UNO) — no local callout"). That makes an otherwise resolved,
1302
- unverified, non-duplicate column band **med** rather than high; a `verified` flag, an RFI
1303
- profile or a duplicate footprint still take precedence. The aggregate is tonnage-weighted, so
1304
- the cost scales with the column share of the takeoff.
1305
- - Say which rule you used in `read_notes`, e.g. "column tops taken from the nearest T.O. STEEL
1306
- callout within N ft; beyond that, the plan default (emitted with no `tos`)".
1307
- - `rfi: true` means no AISC size resolved — excluded from the BOM. `mf: true` marks a
1308
- moment-frame member (persistent; survives AISC resolution).
1309
- - **`read_notes` (top-level `string[]`) is where what you could NOT resolve goes.** An ambiguous label,
1310
- a member you cannot place, an unsupported brace topology. It is the honest carrier because an
1311
- unplaceable member has no work-points (`wp` is required, so it cannot be a member at all) and an
1312
- `rfi:true` member whose profile *does* resolve is still counted in the BOM. Rebuild these from the
1313
- source on every read — drop notes whose subject has become resolvable rather than carrying them
1314
- forward — and **read them out in the hand-off** (step 6); nothing in the UI surfaces them yet.
1315
- - **`material` (grade) — capture it (Slice 5b).** Read the drawing's **general-notes grade table**
1316
- (the "MATERIAL" / "STRUCTURAL STEEL" notes) and stamp each member's `material` from its section
1317
- family: wide-flange / WT → `A992`, HSS → `A500` (Gr. B or C per the notes), pipe → `A53`,
1318
- angles / channels / plates → `A36` or `A572-50` per the notes. A per-member callout on the drawing
1319
- overrides the family default. Capturing grade is what lets the Workspaces **History → "What
1320
- changed"** compare surface a **Material** change when a revision re-grades a member.
1321
- - `raster_b64` is a base64 JPEG of the framing area (title block excluded). It is
1322
- **machine-local** and **never committed**. **It is the SCANNED-ONLY fallback overlay** — on a vector
1323
- PDF the overlay is the `filter` vector linework (see "VECTORIZE the overlay" above), so a vector read
1324
- does not need to lean on `raster_b64` for a crisp plan. Emit it for provenance / raster-only sheets;
1325
- never treat a raster overlay as acceptable when vectors exist.
1326
- - **Connection library (`connections[]`) + per-end refs.** A vendor-neutral top-level
1327
- `connections: [{ id, type, detail, targets:{ tekla:"146", … }, source }]` maps a connection
1328
- TYPE → the firm's design detail# → per-platform component ids. A member end references a row by id
1329
- via `ends[].conn` (or `col.conn` for a column); the legacy `note`/`detail` stay as the fallback
1330
- when `conn` is empty. `source` is `drawing` (read from a callout — best evidence), `company-rules`
1331
- (the firm's standard), or `user`. Prefer a `conn` reference over free text when the connection is
1332
- known — the editor's per-end picker and the Connections confidence card both key on it.
1333
- - **Base-plate connections (`joints[]`) — the geometry recipe.** Where the set has a **base-plate
1334
- detail + schedule** (column size → base-plate THK×"N"×"B", anchor Ø×embed, weld "A", washer plate),
1335
- emit a top-level `joints[]` entry per column so FloLess renders the real plate + anchor kit + weld
1336
- in 3D: `{ id, kind:"base-plate", main:"<column member id>", at:"base", source:"auto", params:{…} }`.
1337
- The joint binds to the column by id and may CITE a `connections[]` row via `conn` for its
1338
- type/detail identity (build on the library, don't fork it). Map the schedule straight into `params`:
1339
-
1340
- | Schedule callout | `params` key(s) |
1341
- |---|---|
1342
- | base-plate THK · "N" · "B" | `thickness` · `plateWidth` · `plateDepth` |
1343
- | anchor bolt Ø · count | `boltDia` · `boltCols`×`boltRows` |
1344
- | weld size "A" | `weldLeg` |
1345
- | "provide 1/4"×3"×3" PL washer w/ std hole" | `washerPlateThickness` · `washerPlateSide` |
1346
- | "anchor holes oversized: A-bolt Ø + 5/16"" | `holeClearance` (the +amount) |
1347
- | edge distance · embed | `edgeDist` · `projBelow` |
1348
-
1349
- ⚠️ **UNITS: the *dimensional* `params` are MILLIMETRES** (the engine works in mm) — unlike the
1350
- contract's display/inch member coords — so convert the schedule's inches ×25.4. (`boltCols` /
1351
- `boltRows` are integer *counts*, not mm; `projBelow` is how far the rod renders below the plate — a
1352
- reasonable proxy for the embed.) Any omitted param falls back to a sensible default. Worked example
1353
- (a `W10x33 → 1"×18"×10", 1"Ø×12", 5/16"` schedule row):
1354
- `params: { thickness:25.4, plateWidth:457.2, plateDepth:254, boltDia:25.4, boltCols:2, boltRows:2, edgeDist:50.8, weldLeg:7.94, washerPlateThickness:6.35, washerPlateSide:76.2, holeClearance:7.94, projBelow:304.8 }`.
1355
- The weld automatically traces the column's **profile outline** (the I-shape for a W; a rectangle for
1356
- an HSS — square only when the section is square). *(The outline is engine-rendered: a wide-flange's
1357
- flange width is still approximate until a real AISC `bf` table lands, so a W renders a touch narrow —
1358
- the plate/anchor/weld sizes you set are exact.)*
1359
- - **Shear-plate (fin-plate) connections (`joints[]`) — the bolted beam-end recipe.** Where a beam end
1360
- reads as a **shear / simple / fin-plate / shear-tab** connection (the per-end `note`/`conn`), emit a
1361
- `joints[]` entry **per beam end** so FloLess renders the vertical fin plate (bolted to the web) + the
1362
- bolt group + the plate-to-support weld in 3D:
1363
- `{ id, kind:"shear-plate", main:"<SUPPORTED BEAM member id>", at:"end0"|"end1", source:"auto", params:{…} }`.
1364
- ⚠️ **`main` is the BEAM** (not the support) — the joint sits at one of the beam's ends; `at:"end0"` =
1365
- the start end (`ends[0]`), `at:"end1"` = the far end (`ends[1]`). Optionally name the support in
1366
- `secondaries:["<column/girder id>"]` (metadata only — the geometry is placed off the beam end + beam
1367
- axis, so it's not required). May CITE a `connections[]` row via `conn` for its type/detail identity.
1368
- Map the schedule into `params`:
1369
-
1370
- | Schedule callout | `params` key(s) |
1371
- |---|---|
1372
- | plate THK · width (along beam) · height | `plateThickness` · `plateWidth` · `plateHeight` |
1373
- | bolt Ø · rows×cols · pitch/gauge | `boltDia` · `boltRows`×`boltCols` · `boltPitch` |
1374
- | weld size | `weldLeg` |
1375
- | beam clearance / erection gap off the support (≈½–¾") | `clearance` |
1376
- | which face of the beam web the plate laps | `webSide` (+1 / -1) |
1377
- | bolt grade (AISC) — A325 or A490 | `boltGrade` ("A325" / "A490") |
1378
- | "stiffener / backing plate on the far side" | `stiffener: true` |
1379
-
1380
- ⚠️ **UNITS: the *dimensional* `params` are MILLIMETRES** (×25.4 from inches) — `boltCols`/`boltRows`
1381
- are integer counts; `stiffener` is a boolean; `webSide` is +1/-1. The fin plate is VERTICAL (in the
1382
- beam-web plane) and **laps one face of the web** (not centred — `webSide` picks the face), cantilevered
1383
- toward the beam from the support edge; the **`clearance` pulls the beam back** so it clears the support
1384
- (the cope/cut is a later slice). Omitted params fall back to sensible defaults (10 mm plate, 1×3 M20
1385
- bolts at 70 mm, 6 mm weld, ~13 mm clearance; A325 grade). The bolt **length is not a param** — it
1386
- auto-sizes from the grip (clamped plies) per the AISC A325/A490 chart and rides the bolt callout (the
1387
- 3D part label); `boltGrade` only picks A325 vs A490. For a beam-to-beam joint, name the supporting girder in
1388
- `secondaries:["<girderId>"]` so `stiffener:true` draws a full-height stiffener on the girder web.
1389
- Worked example (a 3/8"×4"×8" tab, 3×3/4" bolts @ 3", far end of beam b3): `{ id:"sp-b3-e1",
1390
- kind:"shear-plate", main:"b3", at:"end1", source:"auto", params:{ plateThickness:9.5, plateWidth:101.6,
1391
- plateHeight:203.2, boltCols:1, boltRows:3, boltDia:19.05, boltPitch:76.2, weldLeg:6.35, clearance:12.7 } }`.
1392
- - **Brace-gusset connections (`joints[]`) — the braced-end recipe.** Where a **brace** end reads as a
1393
- gusset / brace connection (a plate the brace bolts to, typically drawn `PL … EA SIDE`), emit a
1394
- `joints[]` entry **per braced end** so FloLess renders the gusset plate(s) + the bolt group + the
1395
- plate-to-support welds, and sets the brace back off the member it frames into:
1396
- `{ id, kind:"brace-gusset", main:"<BRACE member id>", at:"end0"|"end1", secondaries:["<support id>"], params:{…} }`.
1397
-
1398
- ⚠️ **Three things this kind requires that the fin plate does not:**
1399
- 1. **`main` must be a member whose `memberType` is `"brace"`.** This is the one connection kind whose
1400
- host IS a brace, and it is skipped on anything else. If the plan reads a diagonal as bracing, say so
1401
- in `memberType` — the connection builds *because* the member is called a brace.
1402
- 2. **Name the support in `secondaries`, and name the right one.** It must be the member the brace
1403
- actually frames INTO — never the other brace of a chevron. A named support that is a brace, or that
1404
- the braced end does not physically reach, is **discarded and the support is inferred from the
1405
- geometry instead** — so a wrong id does not announce itself, it quietly builds against whatever the
1406
- engine picks. Get it right rather than relying on the fallback; only when nothing can be inferred
1407
- either is the joint skipped.
1408
- 3. **There is no erection-gap param.** The brace is cut back to where it really meets the support,
1409
- derived from the two members' geometry. Do not author a `clearance` — it is not read.
1410
-
1411
- | Schedule / detail callout | `params` key(s) |
1412
- |---|---|
1413
- | plate THK · width (along the brace) · height | `plateThickness` · `plateWidth` · `plateHeight` |
1414
- | one plate, or one **each side** of the brace | `plateCount` (1 or **2** — 2 is the default) |
1415
- | bolt Ø · rows×cols · pitch/gauge | `boltDia` · `boltRows`×`boltCols` · `boltPitch` / `boltColPitch` |
1416
- | edge distance to the plate edge | `edgeDist` |
1417
- | weld size | `weldLeg` |
1418
- | which face of the brace's leg the plates sandwich | `webSide` (+1 / -1) |
1419
- | bolt grade (AISC) — A325 or A490 | `boltGrade` ("A325" / "A490") |
1420
-
1421
- ⚠️ **UNITS: the *dimensional* `params` are MILLIMETRES** (×25.4 from inches); `boltCols`/`boltRows`/
1422
- `plateCount` are integer counts. `plateCount:2` is the default because a gusset is usually drawn as a
1423
- pair — and the pair is what makes the bolts **double shear**, which the bolt length auto-sizes from
1424
- (grip = plate + leg + plate). Worked example (a 3/8" plate each side, 7" long, (2) 3/4" bolts at 3"
1425
- with 1 1/2" edge distance, 1/4" fillet, on the start end of brace `br7` framing into beam `b2`):
1426
- `{ id:"bg-br7-e0", kind:"brace-gusset", main:"br7", at:"end0", secondaries:["b2"], source:"auto",
1427
- params:{ plateThickness:9.5, plateWidth:177.8, boltCols:2, boltRows:1, boltDia:19.05,
1428
- boltColPitch:76.2, edgeDist:38.1, weldLeg:6.35, plateCount:2 } }`.
1429
-
1430
- **What it will refuse, and why a refusal is the right answer.** This kind declines rather than drawing
1431
- something it cannot prove, so an end that does not build is telling you something. Today it refuses:
1432
-
1433
- - a brace that is **not level** — the plate is built vertical, which suits horizontal bracing; a sloped
1434
- brace wants its plate in the brace's own plane, and that is not built yet;
1435
- - a brace with **no horizontal run** in plan (a purely vertical one) — there is no plan clash to solve;
1436
- - a section with **no face the plates can bear on**. The plates lap a real face, so which sections work
1437
- depends on the shape *and* on the member's roll (`rot`):
1438
-
1439
- | brace section | builds |
1440
- |---|---|
1441
- | **angle** (`L…`) | at any roll — either leg can take the plates |
1442
- | **wide flange / channel** (`W…`, `C…`) | only at `rot` 0 or 180, where the **web** faces the plates; at 90/270 the plates would meet a flange, which is a different detail |
1443
- | **HSS / tube / pipe** | never — you cannot lap a plate onto a closed section, and inventing a face would put the plate inside the steel |
164
+ The source locator is exactly `{sourceHash, sheet, elementId}` and must resolve to an element selected
165
+ by the pinned Filter. Do not use contract records, element positions, or geometry hashes as evidence.
166
+ Put the observation in the source plan's `memberObservations[]`. Use `memberRefs[]` only to display
167
+ manual or otherwise unobserved members on a plan.
1444
168
 
1445
- So if a `W` or `C` brace refuses, check its `rot` before anything else. A tube brace will not build at
1446
- all yet — say so rather than substituting a kind that would;
1447
- - a support with **no plan spine** — so a brace framing into a **column** is refused today; this kind
1448
- solves the set-back against a support that runs in plan, which a column does not;
1449
- - a support the braced end **does not reach**, when nothing else can be inferred either;
1450
- - a set-back that would consume **more than half the brace**;
1451
- - any plate **too short to hold the bolt group** with proper edge distance on *both* plates AND end
1452
- distance on the cut-back brace.
169
+ Never rewrite old evidence. A re-read mints a new observation with `provenance: "revision-read"` and
170
+ `supersedes: ["old-observation-id"]`. Rebind, supersede, or archive the old observation through its
171
+ binding. A split may bind one observation to both survivors; deletion archives it with no member ids.
1453
172
 
1454
- If an end you expected refuses, check in this order: the brace's `memberType`, its section (is it a
1455
- tube?), what it frames into (a column?), and whether the plate width you authored is long enough — a
1456
- skew makes the two plates sit slightly apart along the brace, which eats into the usable length.
173
+ ## Confidence and verification
1457
174
 
1458
- - **Company-rules pre-fill (§5.5).** If a firm-standard knowledge file is present (e.g.
1459
- `company-rules.md`: "moment → 50S504 → Tekla 146"), read it and emit those rows in `connections[]`
1460
- with `source: "company-rules"`, then PUT. The user reviews/edits them in the editor's
1461
- **Connections** library panel and assigns a row per member end. No new agent verb — it's contract data.
1462
- - **Firm DETAILING standards → shear-plate `joints[].params` (§5.5b).** The same `company-rules.md` is
1463
- also the home for the firm's **detailing** standards (the firm's IP / AISC-*Manual* reference data —
1464
- kept **machine-local, NEVER committed**, and out of the public `aware` AISC agent, which is
1465
- free-source only). When detailing a **shear plate**, read these and set the matching `joints[].params`
1466
- (and say you applied the firm rule), instead of leaning on the engine defaults:
1467
- - **Bolt grade + length** — the firm's default grade → `boltGrade` ("A325"/"A490"). The bolt length
1468
- auto-sizes from grip in the engine per the firm's A325/A490 bolt-length chart; just confirm the
1469
- grade. *(The firm's chart in `company-rules.md` mirrors AISC Manual Table 7-18 add-to-grip — facts
1470
- for the firm's own use; do not republish the table.)*
1471
- - **Usual gages** — the firm's bolt gauge `g` by flange width / leg (W-beams, angles) → `boltPitch`
1472
- and the bolt grid; e.g. a W-beam web gage or a standard 3" pitch. Read the gage table.
1473
- - **Near-side / far-side (NS-FS)** — the firm's default web face the shear plate laps → `webSide`
1474
- (+1 near / -1 far). Many shops default NS unless the drawing says FS.
1475
- - **Knife-plate / shear-tab shape + edge distance + clearance** — the firm's standard plate
1476
- proportions, edge distance, and erection clearance → `plateWidth`/`plateHeight`/`edgeDist`/
1477
- `clearance`. Use the firm's value when it differs from the engine default.
1478
- - **Sizing stays detailing-not-design.** Apply the firm's DEFAULTS + flag a drawing value that
1479
- conflicts; never invent a number. The drawing's explicit callout still wins over the firm default.
1480
- - *(Base plates have their OWN firm keys — `plateWidth`/`plateDepth`/`thickness`/`edgeDist`/
1481
- `boltCols`×`boltRows`/`boltDia`/`weldLeg`/`holeClearance`/`projBelow` — no grade/pitch/webSide;
1482
- apply the firm's base-plate schedule there the same way.)*
1483
- Format in `company-rules.md`: plain headed sections the AI can read (e.g. `## Bolts` with the grade
1484
- default + the length chart, `## Gages`, `## Shear tab (NS-FS, edge, clearance)`). The author keeps it
1485
- private; FloLess just reads + applies it.
1486
- - **Clickable callouts (`callouts[]`) — position is deterministic, the REFERENCE is mandatory.** Harvest
1487
- the cross-reference marks drawn ON the plan that point to ANOTHER sheet — **section cuts** (e.g. a
1488
- circle with `A` over `A` and a sheet ref), **elevation/interior-elevation marks**, and **detail
1489
- references** — as per-plan
1490
- `callouts: [{ kind:"section"|"elevation"|"detail-ref", text:"5/S-501", disp:[x,y], target:{ sheet:"S-501", number:"5" } }]`.
1491
- `disp` (the clickable hotspot) comes deterministically from the annotation-layer marker circle
1492
- (`*S-ANNO-SECT*`), but the **detail NUMBER and target SHEET are the point of a callout — a callout
1493
- without them is useless.** The number/sheet are OUTLINED text (`get_text` returns nothing), so **read
1494
- them with vision** at the marker (verify at high zoom — both the number and the sheet are easy to
1495
- misread) and fill BOTH `text` (the mark as drawn, e.g. `"5/S-501"`) and `target:{sheet,number}`. Do
1496
- NOT ship a callout with an empty `target` as finished — a positionless-ref bubble is a regression from
1497
- the detail bubbles that already carry `"2/S-701"`-style marks; if the mark truly can't be read, RFI it,
1498
- don't leave it blank.
1499
- - **Link the referenced drawing — VECTORIZED when possible.** A callout must LINK to the real target
1500
- drawing, not just name it: when the referenced sheet/detail is in the set, extract it and wire the
1501
- callout so clicking it opens that drawing. Render the linked detail/section the SAME vector-first way
1502
- as the plan overlay (see "VECTORIZE the overlay") — the referenced sheet's vector linework, crisp and
1503
- snappable, NOT a rasterized JPEG. A raster detail preview is the scanned-only fallback. (The editor
1504
- draws a clickable bubble at each `disp`: it jumps to the referenced sheet if that sheet is loaded as a
1505
- plan, else opens the detail lightbox — which must show the VECTOR detail when the source is vector.)
1506
- - **Recipe:** for every DISTINCT sheet the callouts target (the `S-3xx` sections/frame-elevations AND
1507
- the `S-4xx…S-8xx` details), export that PDF page to a vector SVG — `page.get_svg_image(fitz.Identity)`,
1508
- then **strip the embedded `<image>` raster** (it duplicates the linework and bloats the file) — and
1509
- write it to `<project>/details/<sheet>.svg`. The editor fetches `GET /api/contract/<app>/detail/<sheet>`
1510
- (server reads that file). Extract EVERY referenced sheet, not just the section sheets — a `1/S-801`
1511
- callout with no `details/S-801.svg` silently falls back to raster. Map sheet→PDF page by reading the
1512
- title-block sheet numbers (they're outlined text → render the bottom-right corner and read with vision).
175
+ Score confidence per observed field, not once per member. Loop until the request's `target_confidence`
176
+ is met or the drawing cannot support it. If it cannot, retain the member, use unknown values where
177
+ necessary, and add a plain-English `read_notes` entry explaining what a reviewer must resolve.
1513
178
 
1514
- ### 5. Write to the contract store
179
+ Before submission, render and inspect the result:
1515
180
 
1516
- **Two routes, and which one you use is decided by WHAT you are writing, not by preference.**
181
+ - overlay members against each registered source view;
182
+ - verify grid registration, orientation, scale, and sheet cut elevation;
183
+ - compare member counts, marks, profiles, and elevations with schedules and callouts;
184
+ - ensure every new/changed read member has active evidence from a selected Filter element;
185
+ - ensure observation source hashes match the queued attachments exactly;
186
+ - confirm no member is duplicated merely because it appears on multiple sheets.
1517
187
 
1518
- | you are writing | route |
1519
- |---|---|
1520
- | the pre-read blocks — §1b `filter`, §1c `grid`, §1d `datum` + the per-sheet registration keys | **`PUT /api/projects/<projectId>/steel-prepass`** |
1521
- | the same, on a **`steel.model/v2`** model — `filter` + the per-sheet registration keys ONLY, no `grid`, no `datum` | the same verb; it refuses the other two by name |
1522
- | the finished takeoff (§4's whole document: `members`, profiles, elevations) **into a Workspaces project** — including the project's FIRST one | **`POST /api/projects/<projectId>/revision-requests`** then **`POST /api/projects/<projectId>/revision-read`** (§9) |
1523
- | the finished takeoff when there is **no project** (a plain app-scoped contract) | `PUT /api/contract/steel-model` (add `If-None-Match: *` when the `GET` returned no ETag) |
188
+ For any connection or detail you build, follow the clash and exact-placement stages in
189
+ `floless-app-steel-model`: prove bearing faces meet with zero overlap and zero gap, bolts clamp the real
190
+ plies, and connection geometry fits the actual section. Measure it; a screenshot is corroboration only.
1524
191
 
1525
- **A finished takeoff into a project goes through `revision-read`, never the contract PUT — and "it is the
1526
- first document" does not change that** (#492). Both routes store the members, so the contract PUT looks
1527
- like it worked: `200`, an ETag, and a project the user can open. What it silently skips is everything that
1528
- makes the read a *version*:
192
+ ## Assemble the contract
1529
193
 
1530
- - **No entry in the ledger.** An ordinary contract PUT calls `createVersion` nowhere — only rollback,
1531
- Approve, `revision-read` and the v2 migration commit do. The project's History reads *"No versions
1532
- yet"* over a document that plainly exists, so there is nothing to compare, roll back to, or sign off.
1533
- - **No provenance.** `revision-read` records the drawing files the read came from (`source.files`) and the
1534
- request it answered. A contract PUT records that the document changed, and nothing about where it came from.
1535
- - **The Steel Filter checkpoint does not run.** `revisionReadContractError` is wired into `revision-read`
1536
- only. It is what refuses a member read whose work-points are not backed by the saved filter selection —
1537
- the check that catches a mis-registered read *before* it becomes the model.
1538
-
1539
- So the create case belongs to `revision-read` too: queue the request with the drawing snapshots, then post
1540
- the contract against that `requestId`. §9 has the call shape and the identity rules.
1541
-
1542
- The one create that **is** the contract route's is the **pre-read** document in §1b — the prepass verb
1543
- cannot create a document, so a project whose `GET` returned nothing needs the contract PUT to bring the
1544
- `filter` blocks into being. That is staging, not a read: it carries no members, and the member read that
1545
- follows still goes through `revision-read`. **That read is what makes the project a `steel.model/v2`
1546
- model** — the provisional filter-only v1 document at history head 0 is consumed by the conversion, not
1547
- kept. See §9.
1548
-
1549
- The prepass verb exists because the pre-read pass used to GET the contract and PUT the **whole document**
1550
- back. That is a full-document replacement: it can overwrite members, joints and connections that the
1551
- user has already reviewed, and an ETag does not stop it — an ETag makes a write not *stale*, not not
1552
- *canonical*. The verb accepts `filter`, `datum` and per-sheet `{ grid, datum_at, datum_ref, control2_at,
1553
- control2_ref, elevation_in }`, and refuses everything else **by name** with a `400`. **On a
1554
- `steel.model/v2` model the accepted set is narrower** — `filter` plus the per-sheet registration keys,
1555
- with `grid` and `datum` refused (§1c, §1d), because a v2 grid is model-global canonical structure rather
1556
- than a pre-read block. It cannot create a
1557
- document and it cannot add a sheet (an unknown sheet is a `400`, never a new plan), which is why the
1558
- **§1b pre-read** create — and only that one — belongs to the contract route.
1559
-
1560
- The two **contract-store** routes (the prepass verb and `PUT /api/contract/steel-model`) share one
1561
- implementation, so the `412`/`428` answers and the lock below apply to whichever you use — **with one
1562
- deliberate exception**: the prepass verb refuses `If-Match: *` with its own `428`. It patches the
1563
- document you read, and `*` cannot detect a write that landed since your GET, so it demands the EXACT
1564
- ETag (§1b). `If-None-Match: *` is no use there either, since that verb cannot create a document. In
1565
- short: on the prepass verb, always send the exact ETag.
1566
-
1567
- `revision-read` is a different shape again and is covered in §9: it carries no ETag at all, because the
1568
- AI composed that document from the drawing set rather than from one it read here.
1569
-
1570
- **Read first, then write.** `GET` the contract before you write and keep its `ETag` response header —
1571
- that tag is what makes the write safe, and you need it even when you are replacing the document
1572
- wholesale.
1573
-
1574
- **A contract write MUST carry a precondition** — the server refuses one that does not (`428`). Which
1575
- header depends on what that `GET` returned:
1576
-
1577
- ```
1578
- PUT http://localhost:<port>/api/contract/steel-model?project=<projectId> # ?project= = which store
1579
- Content-Type: application/json
1580
- If-Match: <the ETag from your GET> # replacing — the usual case
1581
- If-None-Match: * # ONLY if the GET returned no ETag at all (no draft yet)
1582
-
1583
- <contract JSON body>
1584
- ```
1585
-
1586
- **Drop `?project=` and you have written a different document.** It is the only thing that scopes this
1587
- route to a project; without it the write lands on the app-scoped draft. Omit it *only* for a genuinely
1588
- app-scoped contract (no project involved) — and keep it on the `GET` too, so the ETag you send back
1589
- belongs to the store you are writing.
1590
-
1591
- The server schema-validates the body. Responses that need action:
1592
-
1593
- - **`400`** — schema-invalid. Read the error, fix the offending fields, and re-PUT.
1594
- - **`412`** — someone else (the user in the editor, another tool, a workflow run) wrote to this
1595
- contract after you read it. **Do NOT retry the same body** — that would destroy their change.
1596
- Re-`GET`, re-apply your edit to the NEW document, and write again with the fresh ETag.
1597
- - **`428`** — you sent no precondition. Add `If-Match` (or `If-None-Match: *` if the GET gave you no
1598
- ETag) and retry.
1599
-
1600
- Sending a precondition is not optional politeness: without it a slow edit silently overwrites whatever
1601
- landed while you were working. Read back the current contract with
1602
- `GET /api/contract/steel-model?project=<projectId>` — same `?project=` rule as the write, or you read
1603
- one store and precondition the other.
1604
-
1605
- ### 6. Hand off to the user
1606
-
1607
- **Preconditions — both, not either:**
1608
- 1. The filter is present and the member read is bound to it. **How you establish that depends on the
1609
- contract type, because `/score` refuses v2** (§3) — do not call it and read a refusal as a pass:
1610
- - **`steel.takeoff/v1`** — `POST …/score` returns `filterMissing: false` **and
1611
- `filterMismatchCount: 0`**. If `filterMissing` is still `true`, you are not done: return to step
1612
- 1b. A non-zero `filterMismatchCount` is the §9 commit rejection arriving early — read
1613
- `filterMismatchSamples` and fix those members (§2 step 6, §2b) before handing off.
1614
- - **`steel.model/v2`** — there is no score call to make. Confirm the contract carries a usable
1615
- top-level `filter` yourself, and hold it to **a non-empty `filter.sheets[]`** — what §1b produces.
1616
- *That is stricter than the guard*, deliberately: the guard's `filterMissing` is satisfied by a
1617
- non-empty `sheets[]` **or** a legacy single-page `filter.page`, so a pre-multisheet contract slips
1618
- through it while still being below this skill's standard. If you find only `filter.page`, re-run
1619
- §1b and emit the per-sheet block rather than passing it along. There is no v2 equivalent of
1620
- `filterMismatchCount` — the backing test walks `plans[].members`, which a v2 model does not have —
1621
- so **nothing server-side ties a v2 member to the linework** and precondition 2 carries that weight
1622
- alone.
1623
-
1624
- Either way: do not present a takeoff whose filter was skipped as finished.
1625
- 2. The **visual verification of §2c has been done** and the regions read clean. A score is a statement
1626
- about evidence *recorded*, not evidence *correct* — do not hand off a takeoff you have not looked at.
1627
-
1628
- Tell the user:
1629
- - What you read (e.g. "read 14 beams, 6 columns and 9 braces on the two framing plans; 3 MF members
1630
- await Frame-Elevation resolution; aggregate confidence 78% — above your 70% target").
1631
- - **What you verified and how** — the regions you rendered and checked (§2c), and any binding you
1632
- resolved by evidence rather than proximity. This is what separates "the numbers look fine" from
1633
- "I looked at it".
1634
- - **Which layers you kept, dropped, or found to hold no members** (§0 census), in one line each. A
1635
- steel-named layer that turned out to be dimensions or legend glyphs is a result the user needs.
1636
- - **Every `read_notes` entry, in plain English** — what could not be resolved and why (an unplaceable
1637
- brace, a missing half-grid, an unsupported brace topology). Nothing in the UI shows `read_notes`, so
1638
- this hand-off is the only place the user learns what was left out. Never let an omission pass silently.
1639
- - **Open the editor**: double-click the `read` node (or the takeoff node) in the FloLess
1640
- canvas. The editor renders the overlay, the member list, the RFI panel, and the confidence
1641
- report so they can verify and correct.
1642
- - **Approve & bake lock**: when satisfied, click Approve in the editor. Approve bakes the
1643
- contract into the `read` node's `config.takeoff` and recompiles; the Run gate disarms until
1644
- approved. After approval, the 3D view and BOM nodes render from the baked contract.
1645
- - **Freeze** the `read` node (right-click → Freeze, or `aware app freeze`) once it's approved
1646
- so a future re-read won't overwrite it until they explicitly unfreeze.
1647
- - What's next: the 3D view (`view` node), IFC export, Tekla bake, and formatted BOM are on the
1648
- same canvas and follow from Approve.
1649
-
1650
- ### 7. Clear the request
1651
-
1652
- If the trigger came from a `rebake` request:
1653
-
1654
- ```
1655
- DELETE http://localhost:<port>/api/requests/<id>
1656
- ```
1657
-
1658
- ### 8. Confidentiality
1659
-
1660
- Never write client, firm, or project identifiers into files, commits, or responses. The
1661
- contract carries the source path in `source.path` and an embedded raster in `raster_b64` — both
1662
- are machine-local (stored under `~/.floless/contracts/steel-model.json` by the server and
1663
- never committed). Clip title blocks from any embedded preview.
1664
-
1665
- ### 9. Reading into a project — the `revision-read` route (Slice 5)
1666
-
1667
- **This is the route for EVERY member read into a Workspaces project — the first one and every re-read**
1668
- (§5). The two differ only in how much of the section below applies: a first read has no prior members,
1669
- so the identity rules are vacuous and you can skip to *"No request queued yet"* at the end.
1670
-
1671
- On a **re-read** (a REVISED drawing set attached to a project that already has versions) the Workspaces
1672
- **History → "What changed"** compare matches members between versions by their `id`, scoped per `sheet`.
1673
- So the re-read must keep identity stable:
1674
-
1675
- 1. **Fetch the current contract first** — `GET /api/contract/steel-model?project=<projectId>`. (When a
1676
- queued request triggered you, the project id is in that request's body; on a first read you queued
1677
- the request yourself, so you already have it.) That is the previous version's working tree.
1678
- 2. **Carry ids + sheets forward** — for every member that still exists in the revised set, reuse its
1679
- existing `id` and keep it on the same `sheet` label (e.g. `S-201` stays `S-201`). Mint a NEW id
1680
- only for a genuinely new member; simply drop the id of a member the revision deleted.
1681
- 3. Then compose the updated `steel.takeoff/v1` and `POST /api/projects/<projectId>/revision-read
1682
- { contract, message, requestId }`. **Which of three arms answers depends on the project's state, and
1683
- they do not answer alike — read the STATUS and the `contractType`, never just `ok`:**
1684
-
1685
- | project state | what the POST does | answer |
1686
- |---|---|---|
1687
- | **first read** — no versions yet, store empty or holding only the §1b filter-only pre-read | converts your v1 staging and atomically publishes the completed model + activation + version 1 | `200` `{ ok: true, version, contractType: "steel.model/v2" }` — the request is cleared for you |
1688
- | **already a `steel.model/v2` model** | *stages* the read for human confirmation; nothing is written | `202` `{ ok: true, … }` — the request stays queued as `staged` |
1689
- | **legacy v1** (has versions, never migrated) | commits a v1 version in one step | `200` — the request is cleared for you |
1690
-
1691
- Do **not** DELETE the request in any of the three: the two committing arms clear it themselves, and
1692
- the staged arm needs it to stay queued (see "Notes that bite" below).
1693
-
1694
- > **A first read is where a project is BORN `steel.model/v2`.** You still compose
1695
- > `steel.takeoff/v1` — that is the reader's internal staging shape, and the route requires a declared
1696
- > v1 document on this arm — but what lands is v2: one root `members[]` in world millimetres, a
1697
- > model-global `grid`, and the plans reduced to registered views. Confirm it by reading back
1698
- > `contractType` (or `GET`-ing the contract) rather than assuming the shape you sent is the shape
1699
- > that was stored. If the staging cannot be converted the answer is a `400` naming the reason
1700
- > (`v1-staging-exit`, e.g. `grid-lines-unmigrated` or `plan-uneditable:registration-incomplete`) and
1701
- > **nothing is published** — no contract, no activation, no version. Fix the read and re-post.
1702
- >
1703
- > **`plan-uneditable:registration-incomplete` or `grid-missing` → go back to
1704
- > §1d *Registration is mandatory on every plan sheet*.** The message names the sheets. That section
1705
- > is where the fix is, and it is 900 lines above this one — this pointer exists because this 400 is
1706
- > where you will be standing when you need it.
1707
-
1708
- > **On a `steel.model/v2` project compose a `steel.model/v2` document instead** — check the `type`
1709
- > of the contract you GET-ed in step 1. Members live in one root `members[]` in world millimetres,
1710
- > and the root **`grid` comes across unchanged** unless the revised set shows the printed grid in a
1711
- > new place, in which case write the new one and it becomes a proposal the user accepts (§1c).
1712
- > Never drop the `grid` key to mean "unchanged" — a read that omits it is refused.
1713
-
1714
- **No request queued yet? Queue it yourself — this is also the FIRST read's route** (§5). The two-call
1715
- shape is the same whether the project already has versions or none at all:
194
+ Start from the current native model and preserve every field outside the requested read. The completed
195
+ document has this shape:
1716
196
 
197
+ ```json
198
+ {
199
+ "type": "steel.model/v2",
200
+ "origin": "native",
201
+ "members": [],
202
+ "plans": [],
203
+ "grid": null,
204
+ "filter": {},
205
+ "target_confidence": 70,
206
+ "read_notes": []
207
+ }
1717
208
  ```
1718
- POST http://localhost:<port>/api/projects/<projectId>/revision-requests
1719
- Content-Type: application/json
1720
209
 
1721
- { "snapshots": [ { "name": "S-201.pdf", "dataUrl": "data:application/pdf;base64,…" } ],
1722
- "message": "First read of the framing plans" }
1723
- -> { ok: true, request: { id: "<requestId>", … } }
1724
- ```
210
+ Follow `schemas/steel.model.v2.schema.json`; closed objects reject unsupported keys. Never include a
211
+ conversion provenance block or a second contract shape. Preserve confidential rasters only in the
212
+ working project contract; approval and bake strip them from published artifacts.
1725
213
 
1726
- Then post the contract against that id, exactly as step 3 above. Notes that bite:
214
+ ## Submit through revision-read
1727
215
 
1728
- - **At least one snapshot is required** (`400` otherwise) — they become the version's durable
1729
- `source.files` provenance, so this is also how the drawing files get stored, not just how the request
1730
- gets made. Send the real sheets you read.
1731
- - **At most EIGHT snapshots** (`400 too many snapshots (max 8)`), each within the per-file byte cap.
1732
- A real set has more sheets than that, so send the ones this read is actually based on rather than the
1733
- whole set, and queue a further read for the rest.
1734
- - **`snapshots[].dataUrl` is a base64 data-URL and the server SNIFFS the bytes** — it accepts PNG, JPEG,
1735
- WebP and PDF, and `400`s on anything else. A DXF/SVG/TIFF sheet must be rendered to one of those
1736
- first. `name` is optional but worth sending: it is the durable provenance label stored with the file.
1737
- (It is not rendered in the History table today — send it because it is the record, not for display.)
1738
- - **The queue stamps the ledger head as the read's base.** If a version lands between the queue and the
1739
- post, `revision-read` answers `409` — re-GET and re-read rather than retrying the same body.
1740
- - **A `200` may carry `notes: string[]` — READ THEM.** A read can succeed and still have something to
1741
- say. Each line is one thing the migration noticed, locating its sheet as data (`control-off-grid
1742
- [sheet S-201]: …`), capped at eight with an `and N more note(s)` tail. The one to act on is
1743
- **`control-off-grid`**: it means your two registration controls were read further off the
1744
- intersections they name than a good reading allows, and it prints the offset in display points *and*
1745
- mm on the ground. Nothing moved — the sheet is positioned by its grid — but the size of that number
1746
- tells you what to fix: a few points is the pick, tens of points over a long baseline is the sheet's
1747
- `pt_per_ft`. See *"What the two controls are FOR"* above for the whole table. Say it to the user
1748
- rather than swallowing it; a note here is the only warning you get before the next read refuses.
1749
- - **On an already-migrated `steel.model/v2` project the post does NOT commit.** A v2 document is
1750
- *staged* for human review: the answer is `202` with `ok: true` — so check the STATUS, not `ok` — the
1751
- request stays queued as `staged`, no version is minted, and nothing is written until the user
1752
- confirms in Workspaces. Hand off at the `202`; do not treat it as a finished read, and do not delete
1753
- the request. Only the v1 arm commits in one step and clears the request itself.
216
+ POST the completed candidate to the project `revision-read` route with:
1754
217
 
1755
- If you renumber everything, the diff shows a misleading "all removed + all added" and the app warns
1756
- **"identity not preserved."** Carrying ids forward is what makes *"beam B12 was upsized"* come out
1757
- exact instead of a churn of the whole model.
218
+ - the queued `requestId` and base ledger head;
219
+ - the pinned contract and Filter ETags required by the route;
220
+ - the complete native candidate;
221
+ - source snapshots for every queued drawing;
222
+ - a concise read summary and unresolved notes.
1758
223
 
1759
- ---
224
+ On the first read, a valid candidate is journal-published as History version 1 and the request clears.
225
+ On a later read, the route stages a diff for user review. Do not claim completion until the user confirms
226
+ the staged revision and the route publishes it. A conflict, stale Filter, changed source, or changed
227
+ ledger head means refetch and re-read; never force the stale candidate through.
1760
228
 
1761
229
  ## Guardrails
1762
230
 
1763
- - **Compose-time only.** The drawing is read HERE, by you, then PUT to the store. Never add a
1764
- runtime node that reads the drawing — `aware app validate` rejects it, and it breaks
1765
- determinism.
1766
- - **Contract, not scene.** This skill produces a `steel.takeoff/v1` contract. The 3D scene
1767
- derives from it at Approve (`contract-to-scene`); do not manually assemble the 3D scene here.
1768
- - **Thin-UI contract.** The browser recorded intent and the drawing path; the brain is you, in
1769
- the terminal. The UI never reads the drawing and never writes the contract directly.
1770
- - **Honest about gaps.** Unbound segments are the human's worklist, not an error. State
1771
- assumptions (plan-default elevations, assumed heights, unresolved MF marks). Never fabricate
1772
- sizes or grid positions the drawing does not show.
1773
- - **Resolve the port** from the running floless.app the same way other floless-app skills do
1774
- (check `~/.floless/port` or the active server port).
1775
- - **Decode unfamiliar note/profile codes** with **`steel-drawing-abbreviations`** (the default
1776
- US/AISC abbreviations + shape legend) when the set lacks its own abbreviations sheet — for TYP
1777
- profiles, TOS/UON defaults, `(E)`/`(N)` scope, and shape designations. The project's own legend
1778
- always overrides; never expand a member *mark* (`MF`/`BF`/`D1`) from it — resolve those from the
1779
- schedules/elevations.
231
+ - **Filter first.** Stop after deterministic Filter preparation until the user saves it.
232
+ - **Native model only.** Compose only `steel.model/v2` with `origin: "native"`.
233
+ - **Model-global truth.** Members and grid live at root; plans are registered views.
234
+ - **World units.** Member geometry and the model grid are millimetres; observation geometry is local
235
+ display space paired with `pt_per_ft`.
236
+ - **Selected evidence only.** Every new or reader-changed member traces to a selected Filter element.
237
+ - **No fabricated certainty.** Unknown elevations and unresolved profiles remain explicit.
238
+ - **No silent overwrite.** Respect request ids, ledger heads, ETags, staging, and confirmation.
239
+ - **No secrets in artifacts.** Never bake source rasters, credentials, absolute paths, or private notes.