kylebrodeur commited on
Commit
f691896
·
verified ·
1 Parent(s): c6cc161

deploy: update Space from deploy_preflight --push

Browse files
.pi/tasks-config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "autoCascade": true,
3
+ "showAll": true,
4
+ "taskScope": "project"
5
+ }
.pi/tasks/tasks-019ebf40-6559-7f96-b1ee-853132ac70cf.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "nextId": 17,
3
+ "tasks": []
4
+ }
.pi/tasks/tasks.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nextId": 12,
3
+ "tasks": [
4
+ {
5
+ "id": "9",
6
+ "subject": "Add Microfactory summary to book package",
7
+ "description": "Create or update a summary writeup of Microfactory Node: 3D Printer in ~/projects/microfactory/packages/book and ensure it is linked from the book structure. The summary should capture the one-judged-moment framing, the Chief Engineer/La Forge two-agent model, local-first architecture, and links to live Space/datasets. Verify the book index/README references it.",
8
+ "status": "completed",
9
+ "activeForm": "Adding Microfactory summary to book package",
10
+ "metadata": {},
11
+ "blocks": [],
12
+ "blockedBy": [],
13
+ "createdAt": 1781493713260,
14
+ "updatedAt": 1781493770321
15
+ },
16
+ {
17
+ "id": "10",
18
+ "subject": "Document channel post in POSTS.md",
19
+ "description": "Create or update docs/writeup/POSTS.md to include the channel post meta-framing about judged vs unjudged components, along with the existing social variants (A/B/C1/C2) and ship checklist. Keep it as the canonical record of all drafted posts.",
20
+ "status": "completed",
21
+ "activeForm": "Documenting channel post in POSTS.md",
22
+ "metadata": {},
23
+ "blocks": [],
24
+ "blockedBy": [],
25
+ "createdAt": 1781493713262,
26
+ "updatedAt": 1781493792101
27
+ },
28
+ {
29
+ "id": "11",
30
+ "subject": "Design email opt-in for Microfactory updates",
31
+ "description": "Design and implement a lightweight, privacy-first email opt-in for Microfactory updates inside the Gradio app. Must be explicit opt-in, store minimal data (email + timestamp + optional source), and use durable storage. Evaluate: HF dataset CommitScheduler, local JSONL, or external provider. Include clear privacy disclosure. Do not collect emails without consent. Update README and FIELD NOTES to mention it.",
32
+ "status": "completed",
33
+ "activeForm": "Designing email opt-in for Microfactory updates",
34
+ "metadata": {},
35
+ "blocks": [],
36
+ "blockedBy": [],
37
+ "createdAt": 1781493713262,
38
+ "updatedAt": 1781493968614
39
+ }
40
+ ]
41
+ }
Makefile CHANGED
@@ -29,6 +29,15 @@ deploy-check: ## deploy/record readiness gate (offline: build + files + creds +
29
  deploy: ## run the gates, then UPDATE the Space files (hf upload) + factory reboot (needs HF_TOKEN)
30
  uv run python -m scripts.deploy_preflight --push
31
 
 
 
 
 
 
 
 
 
 
32
  demo: ## scripted integration run / video-beat dry run
33
  uv run python -m scripts.scripted_demo
34
 
 
29
  deploy: ## run the gates, then UPDATE the Space files (hf upload) + factory reboot (needs HF_TOKEN)
30
  uv run python -m scripts.deploy_preflight --push
31
 
32
+ publish: ## deploy to HF Space + sync the public GitHub mirror (needs HF_TOKEN + gh auth)
33
+ uv run python -m scripts.publish
34
+
35
+ publish-dry: ## show what publish would change without pushing
36
+ uv run python -m scripts.publish --dry-run
37
+
38
+ publish-mirror: ## sync only the public GitHub mirror (skip Space push)
39
+ uv run python -m scripts.publish --mirror-only
40
+
41
  demo: ## scripted integration run / video-beat dry run
42
  uv run python -m scripts.scripted_demo
43
 
README.md CHANGED
@@ -141,9 +141,9 @@ Local dev uses [uv](https://docs.astral.sh/uv); the HF Space installs via `requi
141
  **Layout:** `app.py` (Space entrypoint) + `test_core.py` at the root; the core library lives in
142
  `core/`, runnable helpers in `scripts/` (run via `make <target>` or `uv run python -m scripts.<name>`),
143
  and the simulator / learning-loop / ingestion packages in `sim/`, `learn/`, `ingest/`. See
144
- [`docs/RUNBOOK.md`](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/RUNBOOK.md) for the full run-and-test order of operations.
145
 
146
- **HF Space deployment** (source repo): [`docs/reference/DEPLOYMENT.md`](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/reference/DEPLOYMENT.md) + [`docs/RUNBOOK.md`](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/RUNBOOK.md)
147
  ("Deploy to the Space") cover Space variables, the dual local/Space config, build strategy,
148
  the `@spaces.GPU`-on-inference-only pattern, and field-log setup.
149
 
@@ -240,8 +240,8 @@ Storytelling is a judging principle, not a badge.
240
  - **Demo video:** [<!-- TODO: add video URL after recording -->]()
241
  - **Social post:** [<!-- TODO: add social post URL after publishing -->]()
242
  - **Stay in the loop:** an email signup lives at the bottom of the live Space. Opt-in only, clear privacy note, no third-party trackers.
243
- - **How to use it (guided tour):** [`docs/RUNBOOK.md` §2](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/RUNBOOK.md#2--use-the-tool-the-guided-tour--also-the-judges-tour)
244
- - **Build story / field notes:** [`docs/writeup/06-FIELD-NOTES.md`](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/writeup/06-FIELD-NOTES.md)
245
  - **Build paper trail (on this Space):**
246
  - **Model cards:** [`LoRA v2`](learn/finetune/MODEL_CARD.md) · [`LoRA v3 QAT`](learn/finetune/MODEL_CARD_QAT.md)
247
  - **Local run / publish:** [`SERVING.md`](learn/finetune/SERVING.md) · [`OLLAMA_PUBLISHING.md`](learn/finetune/OLLAMA_PUBLISHING.md)
@@ -249,7 +249,7 @@ Storytelling is a judging principle, not a badge.
249
  - **Session report + activity trace:** [`SESSION_REPORT.md`](learn/finetune/SESSION_REPORT.md) · [`activity.jsonl`](learn/finetune/activity.jsonl)
250
  - **Calibration:** [`sim/calibration/CALIBRATION-REPORT.md`](sim/calibration/CALIBRATION-REPORT.md) · [`sim/calibration/README.md`](sim/calibration/README.md)
251
  - **Ingestion + assets:** [`ingest/README.md`](ingest/README.md) · [`assets/screenshots/README.md`](assets/screenshots/README.md) · [`dist/README.md`](dist/README.md) · [`dist/deliberation/README.md`](dist/deliberation/README.md)
252
- - **Source:** [kylebrodeur/microfactory-lab](https://github.com/kylebrodeur/microfactory-lab)
253
 
254
  ## License
255
 
 
141
  **Layout:** `app.py` (Space entrypoint) + `test_core.py` at the root; the core library lives in
142
  `core/`, runnable helpers in `scripts/` (run via `make <target>` or `uv run python -m scripts.<name>`),
143
  and the simulator / learning-loop / ingestion packages in `sim/`, `learn/`, `ingest/`. See
144
+ [`docs/RUNBOOK.md`](https://github.com/kylebrodeur/microfactory-node/blob/main/docs/RUNBOOK.md) for the full run-and-test order of operations.
145
 
146
+ **HF Space deployment** (on this Space): [`docs/reference/DEPLOYMENT.md`](docs/reference/DEPLOYMENT.md) + [`docs/RUNBOOK.md`](https://github.com/kylebrodeur/microfactory-node/blob/main/docs/RUNBOOK.md)
147
  ("Deploy to the Space") cover Space variables, the dual local/Space config, build strategy,
148
  the `@spaces.GPU`-on-inference-only pattern, and field-log setup.
149
 
 
240
  - **Demo video:** [<!-- TODO: add video URL after recording -->]()
241
  - **Social post:** [<!-- TODO: add social post URL after publishing -->]()
242
  - **Stay in the loop:** an email signup lives at the bottom of the live Space. Opt-in only, clear privacy note, no third-party trackers.
243
+ - **How to use it (guided tour):** [`docs/RUNBOOK.md` §2](https://github.com/kylebrodeur/microfactory-node/blob/main/docs/RUNBOOK.md#2--use-the-tool-the-guided-tour--also-the-judges-tour)
244
+ - **Build story / field notes:** [Hugging Face blog — Microfactory Node field notes](https://huggingface.co/blog/build-small-hackathon/microfactory-lab-field-notes)
245
  - **Build paper trail (on this Space):**
246
  - **Model cards:** [`LoRA v2`](learn/finetune/MODEL_CARD.md) · [`LoRA v3 QAT`](learn/finetune/MODEL_CARD_QAT.md)
247
  - **Local run / publish:** [`SERVING.md`](learn/finetune/SERVING.md) · [`OLLAMA_PUBLISHING.md`](learn/finetune/OLLAMA_PUBLISHING.md)
 
249
  - **Session report + activity trace:** [`SESSION_REPORT.md`](learn/finetune/SESSION_REPORT.md) · [`activity.jsonl`](learn/finetune/activity.jsonl)
250
  - **Calibration:** [`sim/calibration/CALIBRATION-REPORT.md`](sim/calibration/CALIBRATION-REPORT.md) · [`sim/calibration/README.md`](sim/calibration/README.md)
251
  - **Ingestion + assets:** [`ingest/README.md`](ingest/README.md) · [`assets/screenshots/README.md`](assets/screenshots/README.md) · [`dist/README.md`](dist/README.md) · [`dist/deliberation/README.md`](dist/deliberation/README.md)
252
+ - **Source:** [kylebrodeur/microfactory-node](https://github.com/kylebrodeur/microfactory-node) (public mirror of the build/iteration repo)
253
 
254
  ## License
255
 
app.py CHANGED
@@ -784,7 +784,7 @@ def run_print(state, iterations, nozzle, bed, fan, retract, progress=gr.Progress
784
  + (f"first clean print at **iteration {first}**, now **{traj[-1]:.2f}**."
785
  if first else f"still improving — best **{max(traj):.2f}** after {len(traj)} runs.")
786
  + " The Engineer proposed; a separate simulated world reported the outcome; the **Inspector** "
787
- "graded each run; the policy and ledger learned. *(Simulated — see [SIMULATION.md](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/docs/reference/SIMULATION.md).)*"
788
  )
789
  policy_html = (f"{before_html}<div style='text-align:center;color:var(--ao-orange);font-size:11px;"
790
  f"letter-spacing:2px;'>{icon('arrow')} LEARNED</div>{policy_cell_html(after, key)}")
 
784
  + (f"first clean print at **iteration {first}**, now **{traj[-1]:.2f}**."
785
  if first else f"still improving — best **{max(traj):.2f}** after {len(traj)} runs.")
786
  + " The Engineer proposed; a separate simulated world reported the outcome; the **Inspector** "
787
+ "graded each run; the policy and ledger learned. *(Simulated — see [SIMULATION.md](docs/reference/SIMULATION.md).)*"
788
  )
789
  policy_html = (f"{before_html}<div style='text-align:center;color:var(--ao-orange);font-size:11px;"
790
  f"letter-spacing:2px;'>{icon('arrow')} LEARNED</div>{policy_cell_html(after, key)}")
data/_modal_candidate_lessons.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {"job_id": "modal-saviour-detach-b6bc015e", "material": "PLA", "geometry_type": "adhesion", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_sag", "lesson": "Print detachment detected when layer-to-layer NRMSE score > 1.0 AND 5-layer deviance > 1.0. Large structural changes across consecutive layers indicate the part has separated from the bed. Check bed adhesion: clean surface, raise bed temp, use brim or raft.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
2
+ {"job_id": "modal-saviour-clog-81f35c76", "material": "PLA", "geometry_type": "stringing", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_stringing", "lesson": "Filament runout or nozzle clog detected when NRMSE score < 0.2 AND deviance < 0.2. Near-zero structural change means no material is being deposited. Check filament spool, extruder tension, and nozzle for clogs.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
3
+ {"job_id": "modal-saviour-break-1cbfb724", "material": "PLA", "geometry_type": "overhang", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_sag", "lesson": "Partial breakage detected when frame-to-frame score delta > 0.2 AND deviance delta > 0.2. Sudden structural changes mid-print indicate layer delamination or part fracture. Reduce cooling fan, increase nozzle temp, check for drafts.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
data/lessons.jsonl ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"job_id":"seed-001","material":"PLA","geometry_type":"stringing","env_temp":22.0,"env_humidity":45.0,"outcome":"failed_stringing","lesson":"PLA strung at 215C in moderate humidity. Dropping nozzle to ~200C and nudging retraction up cleared it. With PLA, temperature is usually the bigger lever than retraction distance.","source":"seed","timestamp":"2026-05-20T10:00:00Z"}
2
+ {"job_id":"seed-002","material":"PLA","geometry_type":"stringing","env_temp":24.0,"env_humidity":70.0,"outcome":"failed_stringing","lesson":"High ambient humidity made PLA string even at a sane 205C. Settings tweaks did little; the real fix was drying the filament. Above ~60% humidity, suspect moisture before chasing retraction.","source":"seed","timestamp":"2026-05-20T10:05:00Z"}
3
+ {"job_id":"seed-003","material":"PLA","geometry_type":"overhang","env_temp":23.0,"env_humidity":40.0,"outcome":"success","lesson":"Steep PLA overhang printed clean with cooling fan at 100%. PLA likes maximum cooling on overhangs to freeze the layer before it droops.","source":"seed","timestamp":"2026-05-20T10:10:00Z"}
4
+ {"job_id":"seed-004","material":"PLA","geometry_type":"overhang","env_temp":28.0,"env_humidity":50.0,"outcome":"failed_sag","lesson":"PLA overhang sagged in a warm room even at full fan. Warm ambient air weakens part cooling; on hot days drop a few degrees and ensure unobstructed airflow, or add support past ~50 degrees of overhang.","source":"seed","timestamp":"2026-05-20T10:15:00Z"}
5
+ {"job_id":"seed-005","material":"PLA","geometry_type":"bridge","env_temp":22.0,"env_humidity":42.0,"outcome":"success","lesson":"Short PLA bridge under ~50mm printed flat with full cooling and slightly increased bridge flow. Max fan plus brisk bridge speed is the reliable combo for PLA spans.","source":"seed","timestamp":"2026-05-20T10:20:00Z"}
6
+ {"job_id":"seed-006","material":"PLA","geometry_type":"adhesion","env_temp":19.0,"env_humidity":38.0,"outcome":"failed_sag","lesson":"First layer wouldn't stick in a cold room. Bumping bed to ~60C, slowing the first layer, and turning the fan off for the opening layers fixed adhesion. Cold ambient hurts first-layer bonding most.","source":"seed","timestamp":"2026-05-20T10:25:00Z"}
7
+ {"job_id":"seed-007","material":"PETG","geometry_type":"stringing","env_temp":23.0,"env_humidity":48.0,"outcome":"failed_stringing","lesson":"PETG strung badly at 245C. Lowering to ~232C, raising travel speed, and enabling wipe-before-travel cleaned it up. PETG strings more than PLA by nature, so live at the low end of its temp range.","source":"seed","timestamp":"2026-05-20T10:30:00Z"}
8
+ {"job_id":"seed-008","material":"PETG","geometry_type":"stringing","env_temp":25.0,"env_humidity":65.0,"outcome":"failed_stringing","lesson":"PETG is hygroscopic and strung heavily in humid air despite good settings. Drying the spool was the only durable fix. Above ~60% humidity, dry PETG first and treat settings as secondary.","source":"seed","timestamp":"2026-05-20T10:35:00Z"}
9
+ {"job_id":"seed-009","material":"PETG","geometry_type":"overhang","env_temp":23.0,"env_humidity":45.0,"outcome":"failed_sag","lesson":"PETG overhang drooped when I ran the fan low for strength. PETG needs a cooling compromise: ~30-50% fan generally, bumped to 60-70% specifically over overhangs and bridges.","source":"seed","timestamp":"2026-05-20T10:40:00Z"}
10
+ {"job_id":"seed-010","material":"PETG","geometry_type":"adhesion","env_temp":22.0,"env_humidity":47.0,"outcome":"failed_sag","lesson":"PETG layers came out brittle with the fan too high. Dropping cooling to ~30% and raising temp 5C restored layer bonding. Over-cooling PETG causes delamination; it is the opposite of PLA.","source":"seed","timestamp":"2026-05-20T10:45:00Z"}
11
+ {"job_id":"seed-011","material":"PETG","geometry_type":"bridge","env_temp":24.0,"env_humidity":44.0,"outcome":"success","lesson":"PETG bridge held by temporarily raising fan to ~70% for the span only, then returning to 40%. Targeted cooling bursts beat globally high fan, which would weaken the rest of the part.","source":"seed","timestamp":"2026-05-20T10:50:00Z"}
12
+ {"job_id":"seed-012","material":"PETG","geometry_type":"stringing","env_temp":21.0,"env_humidity":40.0,"outcome":"success","lesson":"Clean PETG print at 230C with gentle retraction (moderate distance, ~40mm/s) in dry conditions. PETG stays molten longer than PLA, so gentle retraction plus fast travel beats aggressive retraction, which clogs.","source":"seed","timestamp":"2026-05-20T10:55:00Z"}
13
+ {"job_id":"ingest-001","material":"ABS","geometry_type":"warping","env_temp":20.0,"env_humidity":40.0,"outcome":"failed_sag","lesson":"ABS corners lifted in an open, cool room. ABS needs an enclosure and a 100-110C bed; without it, warping is near-certain regardless of settings.","source":"ingested","timestamp":"2026-05-22T09:00:00Z"}
14
+ {"job_id":"ingest-002","material":"ABS","geometry_type":"adhesion","env_temp":24.0,"env_humidity":45.0,"outcome":"success","lesson":"ABS first layer held with bed at 105C, brim, and fan off for opening layers. Draught control matters more than glue for ABS adhesion.","source":"ingested","timestamp":"2026-05-22T09:05:00Z"}
15
+ {"job_id":"ingest-003","material":"TPU","geometry_type":"stringing","env_temp":23.0,"env_humidity":55.0,"outcome":"failed_stringing","lesson":"TPU strung badly; it is highly hygroscopic. Dry the spool and print slow (~25mm/s) with minimal retraction — TPU clogs with aggressive retraction.","source":"ingested","timestamp":"2026-05-22T09:10:00Z"}
16
+ {"job_id":"ingest-004","material":"PETG","geometry_type":"stringing","env_temp":26.0,"env_humidity":65.0,"outcome":"failed_stringing","lesson":"PETG strings heavily in humid conditions. Dry filament at 65C for 4+ hours, then lower nozzle temp 5-10C and increase retraction to 5-6mm. Wet PETG is the #1 cause of stringing.","source":"ingested","timestamp":"2026-06-12T12:00:00Z"}
17
+ {"job_id":"ingest-005","material":"PETG","geometry_type":"bridge","env_temp":24.0,"env_humidity":44.0,"outcome":"success","lesson":"PETG bridges cleanly with fan at 80%, nozzle 240C, and retraction at 5mm. PETG likes more cooling than people think — just not on the first layer.","source":"ingested","timestamp":"2026-06-12T12:05:00Z"}
18
+ {"job_id":"ingest-006","material":"PLA","geometry_type":"overhang","env_temp":31.0,"env_humidity":40.0,"outcome":"failed_sag","lesson":"PLA overhangs sag in a hot room (31C ambient). Max fan (100%) and lower nozzle to 200C rescued the next print. PLA needs aggressive cooling when ambient is above 28C.","source":"ingested","timestamp":"2026-06-12T12:10:00Z"}
19
+ {"job_id":"ingest-007","material":"PLA","geometry_type":"vase","env_temp":21.0,"env_humidity":40.0,"outcome":"success","lesson":"PLA vase mode at 205C/60C bed with 100% fan produced a clean spiral. PLA is forgiving in cool, dry rooms — the baseline material for vase-mode prints.","source":"ingested","timestamp":"2026-06-12T12:15:00Z"}
20
+ {"job_id":"ingest-008","material":"ABS","geometry_type":"overhang","env_temp":25.0,"env_humidity":42.0,"outcome":"failed_sag","lesson":"ABS overhangs curled upward at 80% fan — ABS hates part cooling. Keep fan at 0-20% for ABS, rely on enclosure ambient temp instead. Fan on ABS causes layer delamination.","source":"ingested","timestamp":"2026-06-12T12:20:00Z"}
21
+ {"job_id":"ingest-009","material":"TPU","geometry_type":"stringing","env_temp":22.0,"env_humidity":35.0,"outcome":"success","lesson":"TPU printed clean with 3mm retraction at 25mm/s in a dry room. TPU's flexibility means retraction must be slow and short — fast retraction stretches the filament instead of pulling it back.","source":"ingested","timestamp":"2026-06-12T12:25:00Z"}
22
+ {"job_id":"ingest-010","material":"PETG","geometry_type":"adhesion","env_temp":22.0,"env_humidity":50.0,"outcome":"success","lesson":"PETG adhesion is strong on PEI at 80C bed — too strong on smooth PEI without release agent. Use textured PEI or glue stick as a release layer, not an adhesion aid, for PETG.","source":"ingested","timestamp":"2026-06-12T12:30:00Z"}
23
+ {"job_id": "octo-petg-stringy-240", "material": "PETG", "geometry_type": "stringing", "env_temp": 22.0, "env_humidity": 50.0, "outcome": "failed_stringing", "lesson": "My own PETG print at 240C nozzle came out very stringy on a retraction-heavy part. PETG strings when the nozzle runs hot or the spool is damp - dry the spool, drop ~10C, and increase retraction.", "source": "ingested", "timestamp": "2024-05-20T20:57:00+00:00"}
24
+ {"job_id": "modal-saviour-detach-b6bc015e", "material": "PLA", "geometry_type": "adhesion", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_sag", "lesson": "Print detachment detected when layer-to-layer NRMSE score > 1.0 AND 5-layer deviance > 1.0. Large structural changes across consecutive layers indicate the part has separated from the bed. Check bed adhesion: clean surface, raise bed temp, use brim or raft.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
25
+ {"job_id": "modal-saviour-clog-81f35c76", "material": "PLA", "geometry_type": "stringing", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_stringing", "lesson": "Filament runout or nozzle clog detected when NRMSE score < 0.2 AND deviance < 0.2. Near-zero structural change means no material is being deposited. Check filament spool, extruder tension, and nozzle for clogs.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
26
+ {"job_id": "modal-saviour-break-1cbfb724", "material": "PLA", "geometry_type": "overhang", "env_temp": 22.0, "env_humidity": 45.0, "outcome": "failed_sag", "lesson": "Partial breakage detected when frame-to-frame score delta > 0.2 AND deviance delta > 0.2. Sudden structural changes mid-print indicate layer delamination or part fracture. Reduce cooling fan, increase nozzle temp, check for drafts.", "source": "ingested", "timestamp": "2026-06-12T18:29:36.460621+00:00"}
data/references.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
dist/README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - 3d-printing
7
+ - additive-manufacturing
8
+ - llm
9
+ - retrieval
10
+ - build-small-hackathon
11
+ pretty_name: "Microfactory Node: Lesson Ledger"
12
+ size_categories:
13
+ - n<1K
14
+ ---
15
+
16
+ # Microfactory Node: 3D Printer (Lesson Ledger)
17
+
18
+ The compounding memory of **Microfactory Node: 3D Printer**, a small local Gemma that learns 3D
19
+ printing job by job. Each row is one durable lesson keyed to the conditions it was learned in.
20
+ The node retrieves from this ledger before every print, so job N+1 starts smarter than job N.
21
+ This is the knowledge that usually lives in one maker's head and dies with the shop. Here it
22
+ persists, and anyone can read it.
23
+
24
+ Project: [Live](https://node.microfactory.space) ·
25
+ [Code](https://github.com/kylebrodeur/microfactory-node).
26
+
27
+ ## Schema (one JSON object per line)
28
+
29
+ ```json
30
+ {"job_id": "seed-004", "material": "PLA", "geometry_type": "overhang",
31
+ "env_temp": 28.0, "env_humidity": 50.0, "outcome": "failed_sag",
32
+ "lesson": "PLA overhang sagged at 28C with the fan low; raise cooling, drop nozzle ~10C.",
33
+ "source": "seed", "timestamp": "2026-05-20T09:00:00Z"}
34
+ ```
35
+
36
+ | Field | Meaning |
37
+ |---|---|
38
+ | `material` | PLA, PETG, ABS, TPU |
39
+ | `geometry_type` | overhang, bridge, stringing, adhesion, vase (the failure-mode class) |
40
+ | `env_temp` / `env_humidity` | room conditions the lesson was learned in |
41
+ | `outcome` | success, failed_sag, failed_stringing |
42
+ | `lesson` | one durable, directional sentence (the transferable craft) |
43
+ | `source` | `seed` (curated start), `ingested` (from real configs/prints), `earned` (a real reported outcome), `sim` (the deterministic world) |
44
+
45
+ ## How the knowledge is sourced
46
+
47
+ Lessons are grounded, never invented. Seed lessons are hand-curated starters. Ingested lessons
48
+ come from real slicer/firmware profiles and real print history. Earned and simulated lessons come
49
+ from outcomes reported outside the model: the model proposes, a deterministic world or a human
50
+ reports what happened, and only then is a lesson written. The model never grades its own work.
51
+
52
+ ## Honest limits
53
+
54
+ Small and deliberately so. The simulated outcomes are a physics-lite stand-in for a printer, used
55
+ to run the closed loop on camera; they are labeled as such. Treat the lessons as a maker's
56
+ notebook: directionally true, condition-keyed, and meant to be checked against your own machine.
dist/chief_engineer_ledger.jsonl ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"job_id":"seed-001","material":"PLA","geometry_type":"stringing","env_temp":22.0,"env_humidity":45.0,"outcome":"failed_stringing","lesson":"PLA strung at 215C in moderate humidity. Dropping nozzle to ~200C and nudging retraction up cleared it. With PLA, temperature is usually the bigger lever than retraction distance.","source":"seed","timestamp":"2026-05-20T10:00:00Z"}
2
+ {"job_id":"seed-002","material":"PLA","geometry_type":"stringing","env_temp":24.0,"env_humidity":70.0,"outcome":"failed_stringing","lesson":"High ambient humidity made PLA string even at a sane 205C. Settings tweaks did little; the real fix was drying the filament. Above ~60% humidity, suspect moisture before chasing retraction.","source":"seed","timestamp":"2026-05-20T10:05:00Z"}
3
+ {"job_id":"seed-003","material":"PLA","geometry_type":"overhang","env_temp":23.0,"env_humidity":40.0,"outcome":"success","lesson":"Steep PLA overhang printed clean with cooling fan at 100%. PLA likes maximum cooling on overhangs to freeze the layer before it droops.","source":"seed","timestamp":"2026-05-20T10:10:00Z"}
4
+ {"job_id":"seed-004","material":"PLA","geometry_type":"overhang","env_temp":28.0,"env_humidity":50.0,"outcome":"failed_sag","lesson":"PLA overhang sagged in a warm room even at full fan. Warm ambient air weakens part cooling; on hot days drop a few degrees and ensure unobstructed airflow, or add support past ~50 degrees of overhang.","source":"seed","timestamp":"2026-05-20T10:15:00Z"}
5
+ {"job_id":"seed-005","material":"PLA","geometry_type":"bridge","env_temp":22.0,"env_humidity":42.0,"outcome":"success","lesson":"Short PLA bridge under ~50mm printed flat with full cooling and slightly increased bridge flow. Max fan plus brisk bridge speed is the reliable combo for PLA spans.","source":"seed","timestamp":"2026-05-20T10:20:00Z"}
6
+ {"job_id":"seed-006","material":"PLA","geometry_type":"adhesion","env_temp":19.0,"env_humidity":38.0,"outcome":"failed_sag","lesson":"First layer wouldn't stick in a cold room. Bumping bed to ~60C, slowing the first layer, and turning the fan off for the opening layers fixed adhesion. Cold ambient hurts first-layer bonding most.","source":"seed","timestamp":"2026-05-20T10:25:00Z"}
7
+ {"job_id":"seed-007","material":"PETG","geometry_type":"stringing","env_temp":23.0,"env_humidity":48.0,"outcome":"failed_stringing","lesson":"PETG strung badly at 245C. Lowering to ~232C, raising travel speed, and enabling wipe-before-travel cleaned it up. PETG strings more than PLA by nature, so live at the low end of its temp range.","source":"seed","timestamp":"2026-05-20T10:30:00Z"}
8
+ {"job_id":"seed-008","material":"PETG","geometry_type":"stringing","env_temp":25.0,"env_humidity":65.0,"outcome":"failed_stringing","lesson":"PETG is hygroscopic and strung heavily in humid air despite good settings. Drying the spool was the only durable fix. Above ~60% humidity, dry PETG first and treat settings as secondary.","source":"seed","timestamp":"2026-05-20T10:35:00Z"}
9
+ {"job_id":"seed-009","material":"PETG","geometry_type":"overhang","env_temp":23.0,"env_humidity":45.0,"outcome":"failed_sag","lesson":"PETG overhang drooped when I ran the fan low for strength. PETG needs a cooling compromise: ~30-50% fan generally, bumped to 60-70% specifically over overhangs and bridges.","source":"seed","timestamp":"2026-05-20T10:40:00Z"}
10
+ {"job_id":"seed-010","material":"PETG","geometry_type":"adhesion","env_temp":22.0,"env_humidity":47.0,"outcome":"failed_sag","lesson":"PETG layers came out brittle with the fan too high. Dropping cooling to ~30% and raising temp 5C restored layer bonding. Over-cooling PETG causes delamination; it is the opposite of PLA.","source":"seed","timestamp":"2026-05-20T10:45:00Z"}
11
+ {"job_id":"seed-011","material":"PETG","geometry_type":"bridge","env_temp":24.0,"env_humidity":44.0,"outcome":"success","lesson":"PETG bridge held by temporarily raising fan to ~70% for the span only, then returning to 40%. Targeted cooling bursts beat globally high fan, which would weaken the rest of the part.","source":"seed","timestamp":"2026-05-20T10:50:00Z"}
12
+ {"job_id":"seed-012","material":"PETG","geometry_type":"stringing","env_temp":21.0,"env_humidity":40.0,"outcome":"success","lesson":"Clean PETG print at 230C with gentle retraction (moderate distance, ~40mm/s) in dry conditions. PETG stays molten longer than PLA, so gentle retraction plus fast travel beats aggressive retraction, which clogs.","source":"seed","timestamp":"2026-05-20T10:55:00Z"}
13
+ {"job_id":"ingest-001","material":"ABS","geometry_type":"warping","env_temp":20.0,"env_humidity":40.0,"outcome":"failed_sag","lesson":"ABS corners lifted in an open, cool room. ABS needs an enclosure and a 100-110C bed; without it, warping is near-certain regardless of settings.","source":"ingested","timestamp":"2026-05-22T09:00:00Z"}
14
+ {"job_id":"ingest-002","material":"ABS","geometry_type":"adhesion","env_temp":24.0,"env_humidity":45.0,"outcome":"success","lesson":"ABS first layer held with bed at 105C, brim, and fan off for opening layers. Draught control matters more than glue for ABS adhesion.","source":"ingested","timestamp":"2026-05-22T09:05:00Z"}
15
+ {"job_id":"ingest-003","material":"TPU","geometry_type":"stringing","env_temp":23.0,"env_humidity":55.0,"outcome":"failed_stringing","lesson":"TPU strung badly; it is highly hygroscopic. Dry the spool and print slow (~25mm/s) with minimal retraction — TPU clogs with aggressive retraction.","source":"ingested","timestamp":"2026-05-22T09:10:00Z"}
16
+ {"job_id":"ingest-004","material":"PETG","geometry_type":"stringing","env_temp":26.0,"env_humidity":65.0,"outcome":"failed_stringing","lesson":"PETG strings heavily in humid conditions. Dry filament at 65C for 4+ hours, then lower nozzle temp 5-10C and increase retraction to 5-6mm. Wet PETG is the #1 cause of stringing.","source":"ingested","timestamp":"2026-06-12T12:00:00Z"}
17
+ {"job_id":"ingest-005","material":"PETG","geometry_type":"bridge","env_temp":24.0,"env_humidity":44.0,"outcome":"success","lesson":"PETG bridges cleanly with fan at 80%, nozzle 240C, and retraction at 5mm. PETG likes more cooling than people think — just not on the first layer.","source":"ingested","timestamp":"2026-06-12T12:05:00Z"}
18
+ {"job_id":"ingest-006","material":"PLA","geometry_type":"overhang","env_temp":31.0,"env_humidity":40.0,"outcome":"failed_sag","lesson":"PLA overhangs sag in a hot room (31C ambient). Max fan (100%) and lower nozzle to 200C rescued the next print. PLA needs aggressive cooling when ambient is above 28C.","source":"ingested","timestamp":"2026-06-12T12:10:00Z"}
19
+ {"job_id":"ingest-007","material":"PLA","geometry_type":"vase","env_temp":21.0,"env_humidity":40.0,"outcome":"success","lesson":"PLA vase mode at 205C/60C bed with 100% fan produced a clean spiral. PLA is forgiving in cool, dry rooms — the baseline material for vase-mode prints.","source":"ingested","timestamp":"2026-06-12T12:15:00Z"}
20
+ {"job_id":"ingest-008","material":"ABS","geometry_type":"overhang","env_temp":25.0,"env_humidity":42.0,"outcome":"failed_sag","lesson":"ABS overhangs curled upward at 80% fan — ABS hates part cooling. Keep fan at 0-20% for ABS, rely on enclosure ambient temp instead. Fan on ABS causes layer delamination.","source":"ingested","timestamp":"2026-06-12T12:20:00Z"}
21
+ {"job_id":"ingest-009","material":"TPU","geometry_type":"stringing","env_temp":22.0,"env_humidity":35.0,"outcome":"success","lesson":"TPU printed clean with 3mm retraction at 25mm/s in a dry room. TPU's flexibility means retraction must be slow and short — fast retraction stretches the filament instead of pulling it back.","source":"ingested","timestamp":"2026-06-12T12:25:00Z"}
22
+ {"job_id":"ingest-010","material":"PETG","geometry_type":"adhesion","env_temp":22.0,"env_humidity":50.0,"outcome":"success","lesson":"PETG adhesion is strong on PEI at 80C bed — too strong on smooth PEI without release agent. Use textured PEI or glue stick as a release layer, not an adhesion aid, for PETG.","source":"ingested","timestamp":"2026-06-12T12:30:00Z"}
23
+ {"job_id":"octo-petg-stringy-240","material":"PETG","geometry_type":"stringing","env_temp":22.0,"env_humidity":50.0,"outcome":"failed_stringing","lesson":"My own PETG print at 240C nozzle came out very stringy on a retraction-heavy part. PETG strings when the nozzle runs hot or the spool is damp - dry the spool, drop ~10C, and increase retraction.","source":"ingested","timestamp":"2024-05-20T20:57:00+00:00"}
24
+ {"job_id":"modal-saviour-detach-b6bc015e","material":"PLA","geometry_type":"adhesion","env_temp":22.0,"env_humidity":45.0,"outcome":"failed_sag","lesson":"Print detachment detected when layer-to-layer NRMSE score > 1.0 AND 5-layer deviance > 1.0. Large structural changes across consecutive layers indicate the part has separated from the bed. Check bed adhesion: clean surface, raise bed temp, use brim or raft.","source":"ingested","timestamp":"2026-06-12T18:29:36.460621+00:00"}
25
+ {"job_id":"modal-saviour-clog-81f35c76","material":"PLA","geometry_type":"stringing","env_temp":22.0,"env_humidity":45.0,"outcome":"failed_stringing","lesson":"Filament runout or nozzle clog detected when NRMSE score < 0.2 AND deviance < 0.2. Near-zero structural change means no material is being deposited. Check filament spool, extruder tension, and nozzle for clogs.","source":"ingested","timestamp":"2026-06-12T18:29:36.460621+00:00"}
26
+ {"job_id":"modal-saviour-break-1cbfb724","material":"PLA","geometry_type":"overhang","env_temp":22.0,"env_humidity":45.0,"outcome":"failed_sag","lesson":"Partial breakage detected when frame-to-frame score delta > 0.2 AND deviance delta > 0.2. Sudden structural changes mid-print indicate layer delamination or part fracture. Reduce cooling fan, increase nozzle temp, check for drafts.","source":"ingested","timestamp":"2026-06-12T18:29:36.460621+00:00"}
dist/deliberation/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories: [text-generation]
4
+ language: [en]
5
+ tags: [3d-printing, additive-manufacturing, agent-trace, multi-agent, deliberation, build-small-hackathon]
6
+ pretty_name: Chief Engineer — Deliberation Traces
7
+ ---
8
+
9
+ # Chief Engineer — Deliberation Traces
10
+
11
+ Turn-by-turn **multi-persona deliberation** from **The Chief Engineer**, a small local
12
+ Gemma agent built for the HF Build Small hackathon (Backyard AI). Where the
13
+ [lesson ledger](https://huggingface.co/datasets/kylebrodeur/chief-engineer-ledger)
14
+ records *what the agent learned*, this records *how it reasons*: the argument between
15
+ the personas on each job. It grows two ways: a reproducible static export
16
+ (`make deliberation`) and **live turns logged on every run of the Space** (gated on
17
+ `HF_TOKEN`; config + agent reasoning only, never PII or uploaded files).
18
+
19
+ Each row is one **turn**:
20
+
21
+ - **O'Brien** (Chief Engineer) — proposes settings + reasoning over precedent.
22
+ - **Spine** (Safety Spine) — deterministically vetoes/clamps unsafe values.
23
+ - **La Forge** (QA Inspector) — a separate, skeptical voice: second opinion before the
24
+ print (`concur` / `caution` / `dispute`), a grade on each run, and a run verdict.
25
+ - **Operator** — the human, who can override a `dispute` and proceed.
26
+ - **World** (Outcome Simulator) — the deterministic physics-lite world that reports the
27
+ actual print outcome (the agent never grades its own work).
28
+
29
+ The integrity rule made literal: the proposer never marks its own homework.
30
+
31
+ ## Schema
32
+
33
+ `session_id, track, turn, agent, role, act, stance, content, material, geometry,
34
+ bed_position, env_temp, env_humidity, ts`
35
+
36
+ `track` is the phase — `preflight` (propose → veto → second opinion → override),
37
+ `print-loop` (simulate → grade, per iteration), `review` (run verdict).
dist/deliberation/deliberations.jsonl ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"session_id": "abs-overhang-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "no close precedent. ABS is high shrinkage material, and the overhang geometry requires significant thermal management. The room temp (26°C) is acceptable but not ideal; it's cool enough to promote warping without being cold enough to cause rapid cooling issues on the print surface. We must manage the differential between the hot plastic and the environment/bed. High bed temps are needed for adhesion, and minimal cooling is required to maintain thermal equilibrium.\nProposed: nozzle 260°C, bed 105°C, fan 0%, first-layer fan 0%, retraction 4.0mm.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:07+00:00"}
2
+ {"session_id": "abs-overhang-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material — no clamp.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:14+00:00"}
3
+ {"session_id": "abs-overhang-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Thermal management risks are under-engineered. — The reliance on ambient temperature and high bed temps without an enclosure is a thin margin. Watch for differential cooling stress.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:21+00:00"}
4
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 1: sag (quality 0.19, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.19) — learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:28+00:00"}
5
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging — exactly as called. — Quality 0.19. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:35+00:00"}
6
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 2: sag (quality 0.27, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.27) — learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:42+00:00"}
7
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging — exactly as called. — Quality 0.27. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:49+00:00"}
8
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 3: sag (quality 0.33, dominant cost: sag). Policy: ABS/overhang/mid/humid: sag (q=0.33) — learned: fan_pct +12, nozzle_temp -3.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:00:56+00:00"}
9
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "confirmed", "content": "Failed on sagging — exactly as called. — Quality 0.33. The Engineer's risk flag was right; the loop now has the lesson.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:03+00:00"}
10
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 10, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "failed_sag", "content": "Iteration 4: warp (quality 0.34, dominant cost: warp). Policy: ABS/overhang/mid/humid: warp (q=0.34) — learned: fan_pct -10.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:10+00:00"}
11
+ {"session_id": "abs-overhang-edge", "track": "print-loop", "turn": 11, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "missed", "content": "Failed on warping — and it wasn't flagged. — Quality 0.34. The Engineer didn't predict this mode. That gap is what the next iteration has to close.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:17+00:00"}
12
+ {"session_id": "abs-overhang-edge", "track": "review", "turn": 12, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "caution", "content": "Improving but not yet clean (best 0.34). — Quality rose 0.19 → 0.34 over 4 runs but never crossed the bar. More iterations or a different lever needed — the loop is learning, slowly.", "material": "ABS", "geometry": "overhang", "bed_position": "edge", "env_temp": 26.0, "env_humidity": 60.0, "ts": "2026-06-14T12:01:24+00:00"}
13
+ {"session_id": "petg-overhang-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "Job [1] is close: PETG/overhang, and the primary lesson—that aggressive cooling compromises overhang stability—is paramount here. The current environment (24°C, 55% RH) is stable and comparable to the prior job's conditions. I must maintain the compromise established previously: use moderate fan speed for general printing but boost it significantly over overhangs/bridges to manage residual heat buildup in PETG. This balances strength with dimensional stability.\nProposed: nozzle 245°C, bed 85°C, fan 50%, first-layer fan 0%, retraction 5.0mm.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:31+00:00"}
14
+ {"session_id": "petg-overhang-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material — no clamp.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:38+00:00"}
15
+ {"session_id": "petg-overhang-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "dispute", "content": "Overhang cooling compromise is unsound. — The proposed fan strategy ignores thermal gradients. PETG requires controlled, gradual cooling, not aggressive boosts that induce warping.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:45+00:00"}
16
+ {"session_id": "petg-overhang-center", "track": "preflight", "turn": 4, "agent": "Operator", "role": "Operator", "act": "override", "stance": "override", "content": "Acknowledged La Forge's objection. Proceeding to print on the operator's call.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:52+00:00"}
17
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 5, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) — holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:01:59+00:00"}
18
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 6, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). — Engineer flagged sag; the settings covered it. Credit the call — or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:06+00:00"}
19
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 7, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) — holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:13+00:00"}
20
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 8, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). — Engineer flagged sag; the settings covered it. Credit the call — or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:20+00:00"}
21
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 9, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.73). Policy: PETG/overhang/mid/mid: success (q=0.73) — holding policy.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:27+00:00"}
22
+ {"session_id": "petg-overhang-center", "track": "print-loop", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.73). — Engineer flagged sag; the settings covered it. Credit the call — or it was conservative.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:34+00:00"}
23
+ {"session_id": "petg-overhang-center", "track": "review", "turn": 11, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. — PETG/overhang climbed 0.73 → 0.73. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PETG", "geometry": "overhang", "bed_position": "center", "env_temp": 24.0, "env_humidity": 55.0, "ts": "2026-06-14T12:02:41+00:00"}
24
+ {"session_id": "pla-adhesion-center", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "The prior job [1] failed due to cold ambient conditions (19°C) causing poor first-layer adhesion, which is the primary concern here. This lesson transfers directly: current ambient temperature (21°C) is still relatively cool for optimal PLA bonding, requiring heat assistance. We must maintain the lessons from [1]: raise bed temp significantly and manage cooling to ensure a strong initial bond.\nProposed: nozzle 215°C, bed 60°C, fan 30%, first-layer fan 0%, retraction 5.0mm.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:48+00:00"}
25
+ {"session_id": "pla-adhesion-center", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clear", "content": "Within the safe envelope for this material — no clamp.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:02:55+00:00"}
26
+ {"session_id": "pla-adhesion-center", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Over-reliance on heat for adhesion alone. — The combination of 60°C bed/21°C ambient doesn't guarantee a bond; warping risk remains high.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:02+00:00"}
27
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) — holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:09+00:00"}
28
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). — Engineer flagged adhesion; the settings covered it. Credit the call — or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:16+00:00"}
29
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) — holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:23+00:00"}
30
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). — Engineer flagged adhesion; the settings covered it. Credit the call — or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:30+00:00"}
31
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 1.00). Policy: PLA/adhesion/mid/mid: success (q=1.00) — holding policy.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:37+00:00"}
32
+ {"session_id": "pla-adhesion-center", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=1.00). — Engineer flagged adhesion; the settings covered it. Credit the call — or it was conservative.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:44+00:00"}
33
+ {"session_id": "pla-adhesion-center", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. — PLA/adhesion climbed 1.00 → 1.00. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "PLA", "geometry": "adhesion", "bed_position": "center", "env_temp": 21.0, "env_humidity": 45.0, "ts": "2026-06-14T12:03:51+00:00"}
34
+ {"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 1, "agent": "O'Brien", "role": "Chief Engineer", "act": "propose", "stance": "", "content": "No close precedent exists (TPU, stringing). TPU is flexible and prone to oozing/stringing due to its low modulus and high surface area interaction with the nozzle. The primary goal is minimizing ooze while maintaining flow for detail. I will start by slightly lowering the temperature from standard baselines to reduce viscosity and thermal energy available for stringing, keeping bed temp moderate for adhesion.\nProposed: nozzle 220°C, bed 45°C, fan 60%, first-layer fan 0%, retraction 3.0mm.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:03:58+00:00"}
35
+ {"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 2, "agent": "Spine", "role": "Safety Spine", "act": "veto", "stance": "clamped", "content": "Clamped: nozzle_temp 210 below safe 220 for TPU → clamped to 220.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:05+00:00"}
36
+ {"session_id": "tpu-stringing-edge", "track": "preflight", "turn": 3, "agent": "La Forge", "role": "QA Inspector", "act": "second_opinion", "stance": "caution", "content": "Low temps may compromise flow stability on flexible materials. — The reduction from standard baselines is a gamble; TPU needs consistent, reliable extrusion despite viscosity changes.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:12+00:00"}
37
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 4, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 1: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) — holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:19+00:00"}
38
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 5, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). — Engineer flagged stringing; the settings covered it. Credit the call — or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:26+00:00"}
39
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 6, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 2: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) — holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:33+00:00"}
40
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 7, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). — Engineer flagged stringing; the settings covered it. Credit the call — or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:40+00:00"}
41
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 8, "agent": "World", "role": "Outcome Simulator", "act": "simulate", "stance": "success", "content": "Iteration 3: clean print (quality 0.86). Policy: TPU/stringing/mid/humid: success (q=0.86) — holding policy.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:47+00:00"}
42
+ {"session_id": "tpu-stringing-edge", "track": "print-loop", "turn": 9, "agent": "La Forge", "role": "QA Inspector", "act": "grade", "stance": "overcautious", "content": "Print held (q=0.86). — Engineer flagged stringing; the settings covered it. Credit the call — or it was conservative.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:04:54+00:00"}
43
+ {"session_id": "tpu-stringing-edge", "track": "review", "turn": 10, "agent": "La Forge", "role": "QA Inspector", "act": "verdict", "stance": "concur", "content": "Converged to clean by iteration 1. — TPU/stringing climbed 0.86 → 0.86. The compounding is real: each simulated outcome tightened the policy and the next run was better-informed.", "material": "TPU", "geometry": "stringing", "bed_position": "edge", "env_temp": 23.0, "env_humidity": 65.0, "ts": "2026-06-14T12:05:01+00:00"}
learn/finetune/MODEL_CARD.md CHANGED
@@ -106,7 +106,7 @@ ollama run hf.co/kylebrodeur/microfactory-node-gguf:microfactory-node-v2.gguf
106
  ```
107
 
108
  See the
109
- [full publishing runbook](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/learn/finetune/OLLAMA_PUBLISHING.md)
110
  for the merge → quantize → upload pipeline and the QAT-trained v3 sibling
111
  ([`microfactory-node-lora-v3-qat`](https://huggingface.co/kylebrodeur/microfactory-node-lora-v3-qat)).
112
 
 
106
  ```
107
 
108
  See the
109
+ [full publishing runbook](https://github.com/kylebrodeur/microfactory-node/blob/main/learn/finetune/OLLAMA_PUBLISHING.md)
110
  for the merge → quantize → upload pipeline and the QAT-trained v3 sibling
111
  ([`microfactory-node-lora-v3-qat`](https://huggingface.co/kylebrodeur/microfactory-node-lora-v3-qat)).
112
 
learn/finetune/MODEL_CARD_QAT.md CHANGED
@@ -116,7 +116,7 @@ ollama run hf.co/kylebrodeur/microfactory-node-gguf:microfactory-node-v3-qat-q4_
116
  ```
117
 
118
  See the
119
- [full publishing runbook](https://github.com/kylebrodeur/microfactory-lab/blob/main/chief-engineer/learn/finetune/OLLAMA_PUBLISHING.md)
120
  for the merge → quantize → upload pipeline. The non-QAT sibling lives at
121
  [`microfactory-node-lora-v2`](https://huggingface.co/kylebrodeur/microfactory-node-lora-v2).
122
 
 
116
  ```
117
 
118
  See the
119
+ [full publishing runbook](https://github.com/kylebrodeur/microfactory-node/blob/main/learn/finetune/OLLAMA_PUBLISHING.md)
120
  for the merge → quantize → upload pipeline. The non-QAT sibling lives at
121
  [`microfactory-node-lora-v2`](https://huggingface.co/kylebrodeur/microfactory-node-lora-v2).
122
 
learn/finetune/SESSION_REPORT.md CHANGED
@@ -306,5 +306,5 @@ Full walkthrough — SSH setup, the seven gotchas hit and fixed, the
306
  - [`MODEL_CARD.md`](MODEL_CARD.md) / [`MODEL_CARD_QAT.md`](MODEL_CARD_QAT.md) — "Try it via GGUF" section linking both paths.
307
  - [`RUNBOOK.md`](RUNBOOK.md) Step 8 — `ollama pull → cp → push` block with link out to OLLAMA_PUBLISHING.md.
308
  - [`PIPELINE.md`](PIPELINE.md) §6 — publish-to-ollama.com box added to the pipeline diagram.
309
- - [`docs/_archive/UI-OVERHAUL-CHANGELOG.md`](../../docs/_archive/UI-OVERHAUL-CHANGELOG.md) — 2026-06-14 session entry includes the publishing step.
310
- - [`docs/writeup/06-FIELD-NOTES.md`](../../docs/writeup/06-FIELD-NOTES.md) — new field-note #10 ("Distribution is part of the build").
 
306
  - [`MODEL_CARD.md`](MODEL_CARD.md) / [`MODEL_CARD_QAT.md`](MODEL_CARD_QAT.md) — "Try it via GGUF" section linking both paths.
307
  - [`RUNBOOK.md`](RUNBOOK.md) Step 8 — `ollama pull → cp → push` block with link out to OLLAMA_PUBLISHING.md.
308
  - [`PIPELINE.md`](PIPELINE.md) §6 — publish-to-ollama.com box added to the pipeline diagram.
309
+ - [`docs/_archive/UI-OVERHAUL-CHANGELOG.md`](https://github.com/kylebrodeur/microfactory-node/blob/main/docs/_archive/UI-OVERHAUL-CHANGELOG.md) — 2026-06-14 session entry includes the publishing step.
310
+ - [`docs/writeup/06-FIELD-NOTES.md`](https://github.com/kylebrodeur/microfactory-node/blob/main/docs/writeup/06-FIELD-NOTES.md) — new field-note #10 ("Distribution is part of the build").
package.json CHANGED
@@ -4,7 +4,10 @@
4
  "private": true,
5
  "type": "module",
6
  "scripts": {
7
- "record-studio": "node scripts/record-studio.cjs"
 
 
 
8
  },
9
  "devDependencies": {
10
  "playwright": "^1.59.1"
 
4
  "private": true,
5
  "type": "module",
6
  "scripts": {
7
+ "record-studio": "node scripts/record-studio.cjs",
8
+ "publish": "uv run python -m scripts.publish",
9
+ "publish-dry": "uv run python -m scripts.publish --dry-run",
10
+ "publish-mirror": "uv run python -m scripts.publish --mirror-only"
11
  },
12
  "devDependencies": {
13
  "playwright": "^1.59.1"
scripts/deploy_preflight.py CHANGED
@@ -34,18 +34,17 @@ FIELD_LOG_DATASET = "build-small-hackathon/chief-engineer-field-log"
34
  # SERVING.md, OLLAMA_PUBLISHING.md. Internal session/budget/iteration logs stay in the
35
  # GitHub repo but are kept out of the Space.
36
  SPACE_IGNORE = [
37
- "docs/**", "spike/**", "field_logs/**", "deliberation_logs/**", ".venv/**", "**/__pycache__/**",
38
- "**/*.pyc", ".git/**", ".gitignore", ".env", ".agents/**", ".codeboarding/**", ".codeboardingignore",
39
- "data/policy.json", "data/_generated.glb",
 
 
 
 
40
  "data/_vprint.gif", "uv.lock", ".pytest_cache/**", "*.cap/**",
41
- # Internal finetune workpapers — public versions live in README/MODEL_CARDs/SERVING/OLLAMA_PUBLISHING.
42
- "learn/finetune/RUNBOOK.md",
43
- "learn/finetune/PIPELINE.md",
44
  "learn/finetune/REPORT.md",
45
  "learn/finetune/REPORT_v1.md",
46
- "learn/finetune/SESSION_REPORT.md",
47
- "learn/finetune/BUDGET.md",
48
- "learn/finetune/activity.jsonl",
49
  ]
50
  _fail: list[str] = []
51
  _warn: list[str] = []
 
34
  # SERVING.md, OLLAMA_PUBLISHING.md. Internal session/budget/iteration logs stay in the
35
  # GitHub repo but are kept out of the Space.
36
  SPACE_IGNORE = [
37
+ # Docs are internal by default, but two reference docs are public-facing.
38
+ "docs/**",
39
+ "!docs/reference/DEPLOYMENT.md",
40
+ "!docs/reference/SIMULATION.md",
41
+ "spike/**", "field_logs/**", "deliberation_logs/**", ".venv/**", "node_modules/**",
42
+ "recordings/**", "**/__pycache__/**", "**/*.pyc", ".git/**", ".gitignore", ".env", ".agents/**",
43
+ ".codeboarding/**", ".codeboardingignore", "data/policy.json", "data/_generated.glb",
44
  "data/_vprint.gif", "uv.lock", ".pytest_cache/**", "*.cap/**",
45
+ # Internal finetune workpapers kept internal.
 
 
46
  "learn/finetune/REPORT.md",
47
  "learn/finetune/REPORT_v1.md",
 
 
 
48
  ]
49
  _fail: list[str] = []
50
  _warn: list[str] = []
scripts/publish.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Publish the Space + sync the public GitHub mirror in one command.
2
+
3
+ Run from `chief-engineer/`:
4
+
5
+ make publish
6
+
7
+ or
8
+
9
+ uv run python -m scripts.publish
10
+
11
+ What it does:
12
+ 1. Runs `scripts.deploy_preflight --push` to update the HF Space and reboot.
13
+ 2. Syncs the Space-facing file subset to the public mirror repo
14
+ `kylebrodeur/microfactory-node` and pushes `main`.
15
+
16
+ Environment:
17
+ - HF_TOKEN or `hf auth login` must be active for the Space push.
18
+ - `gh auth login` or SSH key must be active for the GitHub push.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import os
25
+ import shutil
26
+ import subprocess
27
+ import sys
28
+ import tempfile
29
+ from pathlib import Path
30
+
31
+ ROOT = Path(__file__).resolve().parent.parent
32
+ MIRROR_REPO = "git@github.com:kylebrodeur/microfactory-node.git"
33
+ MIRROR_NAME = "microfactory-node"
34
+
35
+ # Same rules as deploy_preflight.SPACE_IGNORE, plus a .gitignore for the mirror itself.
36
+ MIRROR_IGNORE = [
37
+ "docs/**",
38
+ "!docs/reference/DEPLOYMENT.md",
39
+ "!docs/reference/SIMULATION.md",
40
+ "spike/**", "field_logs/**", "deliberation_logs/**", ".venv/**", "node_modules/**",
41
+ "recordings/**", "**/__pycache__/**", "**/*.pyc", ".git/**", ".gitignore", ".env", ".agents/**",
42
+ ".codeboarding/**", ".codeboardingignore", "data/policy.json", "data/_generated.glb",
43
+ "data/_vprint.gif", "uv.lock", ".pytest_cache/**", "*.cap/**",
44
+ "learn/finetune/REPORT.md",
45
+ "learn/finetune/REPORT_v1.md",
46
+ ]
47
+
48
+
49
+ def match_ignore(rel_path: str) -> bool:
50
+ import fnmatch
51
+
52
+ # (pattern, is_negative)
53
+ patterns: list[tuple[str, bool]] = []
54
+ for pat in MIRROR_IGNORE:
55
+ is_neg = pat.startswith("!")
56
+ real_pat = pat[1:] if is_neg else pat
57
+ patterns.append((real_pat, is_neg))
58
+
59
+ # Inclusions override exclusions.
60
+ for pat, is_neg in patterns:
61
+ if is_neg and _matches(rel_path, pat):
62
+ return False
63
+ for pat, is_neg in patterns:
64
+ if not is_neg and _matches(rel_path, pat):
65
+ return True
66
+ return False
67
+
68
+
69
+ def _matches(rel_path: str, pat: str) -> bool:
70
+ import fnmatch
71
+
72
+ if pat.endswith("/**"):
73
+ prefix = pat[:-3]
74
+ return rel_path.startswith(prefix + "/") or rel_path == prefix
75
+ if pat.startswith("**/"):
76
+ suffix = pat[3:]
77
+ return rel_path.endswith(suffix) or ("/" + suffix) in rel_path
78
+ if pat.startswith("*"):
79
+ return fnmatch.fnmatch(rel_path, pat) or fnmatch.fnmatch(Path(rel_path).name, pat)
80
+ return rel_path == pat or rel_path.startswith(pat + "/")
81
+
82
+
83
+ def run(cmd: list[str], cwd: Path | None = None, check: bool = True, capture_output: bool = False) -> subprocess.CompletedProcess:
84
+ print(f" $ {' '.join(cmd)}")
85
+ kwargs = {"cwd": cwd, "check": check, "text": True}
86
+ if capture_output:
87
+ kwargs["capture_output"] = True
88
+ return subprocess.run(cmd, **kwargs)
89
+
90
+
91
+ def publish_space(*, no_reboot: bool = False, dry_run: bool = False) -> bool:
92
+ print("\n⏫ Step 1 — update the HF Space")
93
+ cmd = ["uv", "run", "python", "-m", "scripts.deploy_preflight"]
94
+ if not dry_run:
95
+ cmd.append("--push")
96
+ if no_reboot:
97
+ cmd.append("--no-reboot")
98
+ r = subprocess.run(cmd, cwd=ROOT, text=True)
99
+ return r.returncode == 0
100
+
101
+
102
+ def sync_mirror(*, dry_run: bool = False) -> bool:
103
+ print("\n🪞 Step 2 — sync public GitHub mirror")
104
+ mirror_dir = Path(tempfile.gettempdir()) / f"{MIRROR_NAME}-sync"
105
+ if mirror_dir.exists():
106
+ shutil.rmtree(mirror_dir)
107
+ mirror_dir.mkdir(parents=True)
108
+
109
+ print(f" Mirroring Space-facing subset → {mirror_dir}")
110
+ files_copied = 0
111
+ for src in sorted(ROOT.rglob("*")):
112
+ if not src.is_file():
113
+ continue
114
+ rel = src.relative_to(ROOT).as_posix()
115
+ if match_ignore(rel):
116
+ continue
117
+ dst = mirror_dir / rel
118
+ dst.parent.mkdir(parents=True, exist_ok=True)
119
+ shutil.copy2(src, dst)
120
+ files_copied += 1
121
+
122
+ # Drop transient pycache/pi that may have slipped through
123
+ for d in list(mirror_dir.rglob("__pycache__")):
124
+ shutil.rmtree(d)
125
+ pi_dir = mirror_dir / ".pi"
126
+ if pi_dir.exists():
127
+ shutil.rmtree(pi_dir)
128
+
129
+ print(f" Copied {files_copied} files")
130
+
131
+ run(["git", "init", "-b", "main"], cwd=mirror_dir, check=False)
132
+ run(["git", "remote", "add", "origin", MIRROR_REPO], cwd=mirror_dir, check=False)
133
+ run(["git", "fetch", "origin", "main"], cwd=mirror_dir, check=False)
134
+ run(["git", "reset", "--hard", "origin/main"], cwd=mirror_dir, check=False)
135
+
136
+ # Clean working tree but keep .git
137
+ for item in mirror_dir.iterdir():
138
+ if item.name == ".git":
139
+ continue
140
+ if item.is_dir():
141
+ shutil.rmtree(item)
142
+ else:
143
+ item.unlink()
144
+
145
+ # Re-copy after reset
146
+ for src in sorted(ROOT.rglob("*")):
147
+ if not src.is_file():
148
+ continue
149
+ rel = src.relative_to(ROOT).as_posix()
150
+ if match_ignore(rel):
151
+ continue
152
+ dst = mirror_dir / rel
153
+ dst.parent.mkdir(parents=True, exist_ok=True)
154
+ shutil.copy2(src, dst)
155
+
156
+ for d in list(mirror_dir.rglob("__pycache__")):
157
+ shutil.rmtree(d)
158
+ if (mirror_dir / ".pi").exists():
159
+ shutil.rmtree(mirror_dir / ".pi")
160
+
161
+ run(["git", "add", "-A"], cwd=mirror_dir)
162
+ status = run(["git", "status", "--short"], cwd=mirror_dir, check=True, capture_output=True)
163
+ if not status.stdout.strip():
164
+ print(" Mirror already up to date.")
165
+ return True
166
+
167
+ print(f" Changes:\n{status.stdout}")
168
+ if dry_run:
169
+ print(" (dry-run: not committing or pushing)")
170
+ return True
171
+
172
+ run(["git", "commit", "-m", "Re-sync from private microfactory-lab"], cwd=mirror_dir)
173
+ run(["git", "push", "origin", "main"], cwd=mirror_dir)
174
+ print(f" ✅ Mirror pushed: https://github.com/kylebrodeur/{MIRROR_NAME}")
175
+ return True
176
+
177
+
178
+ def main() -> int:
179
+ ap = argparse.ArgumentParser(description="Publish the HF Space + sync the public GitHub mirror.")
180
+ ap.add_argument("--no-reboot", action="store_true", help="push to Space but skip factory reboot")
181
+ ap.add_argument("--mirror-only", action="store_true", help="skip the HF Space push; only sync the mirror")
182
+ ap.add_argument("--dry-run", action="store_true", help="show what would happen; do not push")
183
+ args = ap.parse_args()
184
+
185
+ print("Publish Microfactory Node: HF Space + public GitHub mirror")
186
+ print("=" * 60)
187
+
188
+ if not args.mirror_only:
189
+ if not publish_space(no_reboot=args.no_reboot, dry_run=args.dry_run):
190
+ print("\n🔴 Space push failed — mirror sync skipped.")
191
+ return 1
192
+
193
+ if not sync_mirror(dry_run=args.dry_run):
194
+ print("\n🔴 Mirror sync failed.")
195
+ return 1
196
+
197
+ print("\n🟢 Published: Space updated, mirror synced.")
198
+ return 0
199
+
200
+
201
+ if __name__ == "__main__":
202
+ sys.exit(main())
scripts/record-beat.sh ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Record a single demo beat to its own .cap project.
3
+ # Reuses the same Chrome CDP window; starts/stops Cap per beat so each beat
4
+ # becomes a clean, short clip in Cap Studio.
5
+ #
6
+ # Usage from WSL inside chief-engineer/:
7
+ # ./record-beat.sh load
8
+ # ./record-beat.sh slice
9
+ # ./record-beat.sh second
10
+ # ./record-beat.sh scrub
11
+ # ./record-beat.sh placement
12
+ # ./record-beat.sh climb
13
+ # ./record-beat.sh print
14
+ # ./record-beat.sh review
15
+ #
16
+ # Requirements: Chrome + Cap + pnpm Playwright already set up (run ./record-studio.sh once).
17
+
18
+ set -euo pipefail
19
+
20
+ cd "$(dirname "$0")"
21
+
22
+ source ~/projects/cap-cli-skill/setup.sh 2>/dev/null || true
23
+
24
+ HOST_IP=$(ip route show | grep default | awk '{print $3}')
25
+ export CDP_URL="http://${HOST_IP}:9222"
26
+ CHROME="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
27
+ SPACE="https://node.microfactory.space/?__theme=dark"
28
+
29
+ # Launch Chrome if not already alive
30
+ if ! curl -s "${CDP_URL}/json/version" >/dev/null 2>&1; then
31
+ echo "Launching Chrome app window..."
32
+ PROFILE_DIR="/tmp/chrome-studio-profile-$(date +%s)"
33
+ mkdir -p "$PROFILE_DIR"
34
+ nohup "${CHROME}" --app="${SPACE}" --remote-debugging-port=9222 \
35
+ --remote-debugging-address=0.0.0.0 \
36
+ --user-data-dir="$PROFILE_DIR" \
37
+ --window-size=1707,1067 \
38
+ --window-position=0,0 \
39
+ --disable-session-crashed-bubble --no-first-run \
40
+ --no-default-browser-check --disable-features=TranslateUI \
41
+ >/tmp/chrome-beat.log 2>&1 &
42
+ sleep 5
43
+ else
44
+ echo "Chrome CDP already alive — reusing existing window"
45
+ fi
46
+
47
+ BEAT="${1:-all}"
48
+ shift || true
49
+
50
+ # Map beat names to the driver beat argument
51
+ BEAT_ARG="${BEAT}"
52
+ case "$BEAT" in
53
+ load) BEAT_ARG="load" ;;
54
+ slice) BEAT_ARG="slice" ;;
55
+ second) BEAT_ARG="second" ;;
56
+ scrub) BEAT_ARG="scrub" ;;
57
+ placement) BEAT_ARG="placement" ;;
58
+ climb) BEAT_ARG="climb" ;;
59
+ print) BEAT_ARG="loop" ;;
60
+ review) BEAT_ARG="loop" ;;
61
+ esac
62
+
63
+ SCREEN_ID=$(cap targets screens --json | python3 -c 'import sys,json; d=json.load(sys.stdin); print([s for s in d if s.get("primary")][0]["id"])')
64
+ echo "Recording beat: ${BEAT} (driver=${BEAT_ARG}) (screen=${SCREEN_ID})"
65
+
66
+ CAP_START_TMP="/tmp/cap-beat-start-$(date +%s).txt"
67
+ echo "Starting Cap recording..."
68
+ rm -f "$CAP_START_TMP"
69
+ nohup /mnt/c/Users/kyleb/AppData/Local/Cap/cap-cli.exe record start --screen "$SCREEN_ID" --fps 60 --detach --json > "$CAP_START_TMP" 2>&1 &
70
+ CAP_PID=$!
71
+ sleep 3
72
+
73
+ # Parse the JSON Cap emitted
74
+ REC_ID=""
75
+ if [[ -s "$CAP_START_TMP" ]]; then
76
+ REC_ID=$(python3 -c "import sys,json; data=open(sys.argv[1]).read(); print([json.loads(l) for l in data.splitlines() if l.strip().startswith('{') and l.strip().endswith('}')][0]['recordingId'])" "$CAP_START_TMP")
77
+ fi
78
+
79
+ if [[ -z "$REC_ID" ]]; then
80
+ echo " ✗ could not parse Cap recording ID; output was:"
81
+ cat "$CAP_START_TMP" || true
82
+ wait "$CAP_PID" 2>/dev/null || true
83
+ exit 1
84
+ fi
85
+
86
+ echo " ✓ Cap recording started (${REC_ID})"
87
+
88
+ echo "Driving beat..."
89
+ node scripts/record-studio.cjs --skip-cap --beat="${BEAT_ARG}" "$@" || true
90
+
91
+ echo "Stopping Cap recording..."
92
+ cap record stop --id "${REC_ID}" || true
93
+ echo " ✓ Beat ${BEAT} done — raw .cap project ready in Cap Studio"
scripts/record-studio.sh ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # One-liner studio recording for WSL + Windows Chrome + Cap Desktop.
3
+ #
4
+ # This script:
5
+ # 1. Sources the cap-cli-skill so `cap` is available.
6
+ # 2. Discovers the Windows host IP from WSL's default gateway.
7
+ # 3. Launches Chrome in app mode pointed at https://node.microfactory.space
8
+ # with remote debugging enabled (if not already running).
9
+ # 4. Runs the Node-based studio driver, which uses npm/pnpm-based Playwright,
10
+ # starts a Cap screen recording if none is active, warms the GPU via the
11
+ # WARM UP button, then drives the full demo. It leaves the raw .cap
12
+ # project — no export.
13
+ #
14
+ # Usage:
15
+ # ./record-studio.sh
16
+ # ./record-studio.sh --beat=3
17
+ # ./record-studio.sh --beat=placement --pause=4
18
+ #
19
+ # Prerequisites:
20
+ # Chrome installed at C:\Program Files\Google\Chrome\Application\chrome.exe
21
+ # Cap CLI set up via ~/projects/cap-cli-skill/setup.sh
22
+
23
+ set -euo pipefail
24
+
25
+ cd "$(dirname "$0")"
26
+
27
+ source ~/projects/cap-cli-skill/setup.sh 2>/dev/null || true
28
+
29
+ HOST_IP=$(ip route show | grep default | awk '{print $3}')
30
+ CDP_URL="http://${HOST_IP}:9222"
31
+ CHROME="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
32
+ SPACE="https://node.microfactory.space/?__theme=dark"
33
+
34
+ echo "Windows host IP: ${HOST_IP}"
35
+ echo "CDP URL: ${CDP_URL}"
36
+
37
+ # Screen resolution from Cap target; adjust if your display differs.
38
+ SCREEN_W=1707
39
+ SCREEN_H=1067
40
+
41
+ # Launch Chrome in app mode with CDP if CDP is not already alive
42
+ if ! curl -s "${CDP_URL}/json/version" >/dev/null 2>&1; then
43
+ echo "Launching Chrome app window..."
44
+ PROFILE_DIR="/tmp/chrome-studio-profile-$(date +%s)"
45
+ mkdir -p "$PROFILE_DIR"
46
+ nohup "${CHROME}" --app="${SPACE}" --remote-debugging-port=9222 \
47
+ --remote-debugging-address=0.0.0.0 \
48
+ --user-data-dir="$PROFILE_DIR" \
49
+ --window-size=${SCREEN_W},${SCREEN_H} \
50
+ --window-position=0,0 \
51
+ --disable-session-crashed-bubble --no-first-run \
52
+ --no-default-browser-check --disable-features=TranslateUI \
53
+ >/tmp/chrome-studio.log 2>&1 &
54
+ sleep 5
55
+ else
56
+ echo "Chrome CDP already alive — reusing existing window"
57
+ fi
58
+
59
+ # Install Node deps if Playwright is not resolvable
60
+ if ! node -e "require.resolve('playwright')" >/dev/null 2>&1; then
61
+ echo "Installing Playwright (pnpm/npm)..."
62
+ if command -v pnpm &> /dev/null; then
63
+ pnpm install
64
+ else
65
+ npm install
66
+ fi
67
+ npx playwright install chromium
68
+ fi
69
+
70
+ echo "Starting studio recording..."
71
+ CDP_URL="${CDP_URL}" node scripts/record-studio.cjs "$@"
sim/calibration/README.md CHANGED
@@ -37,5 +37,5 @@ Enums (`material`/`geometry_type`/`outcome`) match `core/models.py`.
37
  ordinary prints are tagged `overhang`.
38
  - **3DTime outcomes are uniformly `success`** — no failure signal; good for Lane-A
39
  references, weak for outcome calibration.
40
- See `CALIBRATION-REPORT.md` and `../../docs/RESEARCH-NEEDS.md` for the fixes that make
41
  this set tunable.
 
37
  ordinary prints are tagged `overhang`.
38
  - **3DTime outcomes are uniformly `success`** — no failure signal; good for Lane-A
39
  references, weak for outcome calibration.
40
+ See `CALIBRATION-REPORT.md` and `../../docs/plan/RESEARCH-NEEDS.md` for the fixes that make
41
  this set tunable.