tkhjeff commited on
Commit
ac36699
·
verified ·
1 Parent(s): d058707

Add the sync discipline: publish command, drift stamp, MCP sync tools (R24/R25)

Browse files
README.md CHANGED
@@ -16,6 +16,9 @@ An automated film house that runs entirely inside one box: a 96 GB Blackwell GPU
16
  It writes, casts, lights, scores, shoots, cuts and publishes 40-60 second vertical shorts — and it credits every frame to
17
  the model that made it, because the credits are also the audit trail.
18
 
 
 
 
19
  > **New here?** Read `docs/10-handbook.md` - it is the working manual.
20
 
21
  > **Current state:** the house can write, shoot and watch back.
@@ -147,6 +150,7 @@ The ledger lives at `ledger/events.jsonl`, is append-only, and every report is d
147
  python -m unittest discover -s blue_morpho/tests -t . # 83 tests, <0.5s
148
  python -m blue_morpho.hiring plan # the GPU call sheet
149
  python -m blue_morpho.hiring office # who lives here, and who is a stray
 
150
  python -m blue_morpho.mcp_server # serve the house over MCP (stdio)
151
  python -m blue_morpho.mcp_server --http 9000 # ...or streamable HTTP on localhost
152
  python -c "from blue_morpho import wellbeing; print(wellbeing.report())"
 
16
  It writes, casts, lights, scores, shoots, cuts and publishes 40-60 second vertical shorts — and it credits every frame to
17
  the model that made it, because the credits are also the audit trail.
18
 
19
+ > **Rule R24:** the Hub mirror is the readable copy of the plan and never lags. Every change ends
20
+ > with `python -m blue_morpho.publish`, which refuses to upload a house whose tests fail.
21
+
22
  > **New here?** Read `docs/10-handbook.md` - it is the working manual.
23
 
24
  > **Current state:** the house can write, shoot and watch back.
 
150
  python -m unittest discover -s blue_morpho/tests -t . # 83 tests, <0.5s
151
  python -m blue_morpho.hiring plan # the GPU call sheet
152
  python -m blue_morpho.hiring office # who lives here, and who is a stray
153
+ python -m blue_morpho.publish check # is the Hub mirror in sync?
154
  python -m blue_morpho.mcp_server # serve the house over MCP (stdio)
155
  python -m blue_morpho.mcp_server --http 9000 # ...or streamable HTTP on localhost
156
  python -c "from blue_morpho import wellbeing; print(wellbeing.report())"
blue_morpho/file_purposes.json CHANGED
@@ -47,5 +47,8 @@
47
  ".mcp.json": "AUTHORED. Client configuration to attach any MCP client to this house.",
48
  "blue_morpho/collaboration.py": "Master/student and main/coworker: ladder(), main_and_coworker(), draft_and_review() with recorded exemplars, calibrate() (the fix for audit A3).",
49
  "blue_morpho/tests/test_collaboration.py": "That escalation stops at the first good answer, a sibling is not an independent check, and a taught correction is recorded.",
50
- "docs/15-collaboration.md": "The staffing chart: four roles, four patterns, every resource given a job, and the sibling blind-spot finding."
 
 
 
51
  }
 
47
  ".mcp.json": "AUTHORED. Client configuration to attach any MCP client to this house.",
48
  "blue_morpho/collaboration.py": "Master/student and main/coworker: ladder(), main_and_coworker(), draft_and_review() with recorded exemplars, calibrate() (the fix for audit A3).",
49
  "blue_morpho/tests/test_collaboration.py": "That escalation stops at the first good answer, a sibling is not an independent check, and a taught correction is recorded.",
50
+ "docs/15-collaboration.md": "The staffing chart: four roles, four patterns, every resource given a job, and the sibling blind-spot finding.",
51
+ "blue_morpho/publish.py": "The sync discipline: regenerate, test, commit, upload, stamp; refuses to upload a failing house and makes drift detectable.",
52
+ "blue_morpho/tests/test_publish.py": "That a failing suite stops the sync before anything reaches the Hub, and that an unreachable Hub is reported as unknown rather than success.",
53
+ "docs/assets/sync.json": "GENERATED, gitignored: the Hub stamp - the exact commit, time, test summary and file count last mirrored."
54
  }
blue_morpho/mcp_server.py CHANGED
@@ -194,6 +194,24 @@ def cancel_job(job_id: str) -> dict:
194
  return {"id": job.id, "state": job.state} if job else {"error": f"no job {job_id}"}
195
 
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  @server.tool(name="view_plate", description="Look at a plate: returns one frame as an image the client can see.")
198
  def view_plate(path: str, at: float = 0.5):
199
  from blue_morpho.eyes import sample_frames
 
194
  return {"id": job.id, "state": job.state} if job else {"error": f"no job {job_id}"}
195
 
196
 
197
+ @server.tool(name="repo_sync_status",
198
+ description="Is the Hub mirror in sync with this plan? Run this before claiming the docs are current.")
199
+ def repo_sync_status() -> dict:
200
+ from blue_morpho import publish
201
+ return publish.status()
202
+
203
+
204
+ @server.tool(name="sync_repo",
205
+ description="Submit a Hub sync: regenerate the generated docs, run the tests, commit, upload, stamp. Refuses to upload a failing house.")
206
+ def sync_repo(message: str = "") -> dict:
207
+ from blue_morpho import publish
208
+ note = message or "Sync plan to the Hub"
209
+ job = jobs.submit("sync", [sys.executable, "-m", "blue_morpho.publish", note],
210
+ expects=[]) # success is a state, not an artifact
211
+ return {"job": job.id, "state": job.state, "note": note,
212
+ "will_refuse": "if the test suite fails, nothing is committed or uploaded"}
213
+
214
+
215
  @server.tool(name="view_plate", description="Look at a plate: returns one frame as an image the client can see.")
216
  def view_plate(path: str, at: float = 0.5):
217
  from blue_morpho.eyes import sample_frames
blue_morpho/publish.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Sync the Hub mirror with the plan. One command, and drift is detectable afterwards.
2
+
3
+ Rule R24: **the Hub mirror is not a backup, it is the readable copy of the plan.** Every change ends
4
+ with a sync, and a sync that cannot be verified is not a sync.
5
+
6
+ python -m blue_morpho.publish # regenerate -> test -> commit -> upload -> stamp
7
+ python -m blue_morpho.publish check # are we in sync? (exit 1 if not)
8
+ python -m blue_morpho.publish status # what the stamps say, local and remote
9
+
10
+ What the order guarantees:
11
+
12
+ 1. **Generated documents are rebuilt first**, so the Hub never receives a stale tool list or repo map.
13
+ 2. **Tests run before anything is uploaded.** A failing suite stops the sync - the mirror describes a
14
+ house that works, or it does not describe it at all.
15
+ 3. **The stamp is written after the commit and is never itself committed** (it is gitignored), so the
16
+ commit hash it records is exact rather than one behind. That is what makes `check` meaningful.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import json
22
+ import subprocess
23
+ import sys
24
+ import time
25
+ from pathlib import Path
26
+
27
+ ROOT = Path(__file__).resolve().parents[1]
28
+ REPO_ID = "tkhjeff/blue-morpho"
29
+ REPO_TYPE = "dataset"
30
+ STAMP = "sync.json" # lives on the Hub, ignored by git
31
+ STAMP_PATH = ROOT / "docs" / "assets" / STAMP
32
+ LOCAL_STAMP = ROOT / "ledger" / "last-sync.json"
33
+ IGNORE = [".git/*", "**/__pycache__/*", "*.pyc", ".gitignore", "ledger/jobs/*",
34
+ "plates/.view_*", "docs/assets/sync.json"]
35
+
36
+
37
+ def _run(cmd: list[str] | str, timeout: int = 600) -> tuple[int, str]:
38
+ """Run a command, never raise, always return (code, output)."""
39
+ shell = isinstance(cmd, str)
40
+ proc = subprocess.run(cmd, shell=shell, capture_output=True, text=True, cwd=str(ROOT),
41
+ timeout=timeout)
42
+ return proc.returncode, (proc.stdout + proc.stderr).strip()
43
+
44
+
45
+ def head() -> str:
46
+ code, out = _run(["git", "rev-parse", "HEAD"])
47
+ return out if code == 0 else "unknown"
48
+
49
+
50
+ def regenerate() -> dict:
51
+ """Rebuild everything that is generated from the code."""
52
+ results = {}
53
+ for module in ["blue_morpho.gen_mcp_doc", "blue_morpho.gen_repo_map"]:
54
+ code, out = _run([sys.executable, "-m", module], timeout=180)
55
+ results[module] = {"ok": code == 0, "output": out.splitlines()[-1] if out else ""}
56
+ # the roster and crew are dumped from the notebook session, so they are refreshed by the agent;
57
+ # this command only has to prove they exist and are non-empty.
58
+ for asset in ["crew.json", "roster.json", "hires.json", "licenses.json"]:
59
+ path = ROOT / "docs" / "assets" / asset
60
+ results[asset] = {"ok": path.exists() and path.stat().st_size > 2,
61
+ "output": f"{path.stat().st_size} bytes" if path.exists() else "missing"}
62
+ return results
63
+
64
+
65
+ def run_tests() -> tuple[bool, str]:
66
+ code, out = _run([sys.executable, "-m", "unittest", "discover", "-s", "blue_morpho/tests",
67
+ "-t", "."], timeout=900)
68
+ tail = [ln for ln in out.splitlines() if ln.startswith("Ran ") or ln.strip() in ("OK",) or "FAILED" in ln]
69
+ return code == 0, " | ".join(tail[-2:]) or out[-200:]
70
+
71
+
72
+ def commit(message: str) -> tuple[bool, str]:
73
+ """Commit only if there is something to commit."""
74
+ code, status = _run(["git", "status", "--porcelain"])
75
+ if not status:
76
+ return True, "nothing to commit"
77
+ _run(["git", "add", "-A"])
78
+ code, out = _run(["git", "commit", "-q", "-m", message])
79
+ return code == 0, out.splitlines()[0] if out else "committed"
80
+
81
+
82
+ def stamp(commit_hash: str, tests: str, files: int) -> dict:
83
+ return {"commit": commit_hash, "synced_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
84
+ "ts": time.time(), "tests": tests, "files": files, "repo": REPO_ID}
85
+
86
+
87
+ def upload(note: str) -> tuple[bool, str]:
88
+ from huggingface_hub import HfApi
89
+ api = HfApi()
90
+ api.upload_folder(repo_id=REPO_ID, repo_type=REPO_TYPE, folder_path=str(ROOT),
91
+ ignore_patterns=IGNORE, commit_message=note)
92
+ files = api.list_repo_files(REPO_ID, repo_type=REPO_TYPE)
93
+ return True, f"{len(files)} files on the Hub"
94
+
95
+
96
+ def remote_stamp() -> dict | None:
97
+ """What the Hub says it last received. None when it cannot be read."""
98
+ import urllib.request
99
+ url = f"https://huggingface.co/datasets/{REPO_ID}/raw/main/docs/assets/{STAMP}"
100
+ try:
101
+ return json.loads(urllib.request.urlopen(url, timeout=25).read())
102
+ except Exception:
103
+ return None
104
+
105
+
106
+ def status() -> dict:
107
+ """In sync, ahead, or unknowable - never optimistic."""
108
+ here = head()
109
+ local = json.loads(LOCAL_STAMP.read_text()) if LOCAL_STAMP.exists() else None
110
+ remote = remote_stamp()
111
+ if remote is None:
112
+ state = "unknown: cannot read the Hub stamp"
113
+ elif remote.get("commit") == here:
114
+ state = "in sync"
115
+ elif local and remote.get("commit") == local.get("commit"):
116
+ state = "ahead: local changes are newer than the Hub"
117
+ else:
118
+ state = "out of sync"
119
+ return {"state": state, "local_head": here, "local_last_sync": (local or {}).get("commit"),
120
+ "hub_commit": (remote or {}).get("commit"), "hub_synced_utc": (remote or {}).get("synced_utc")}
121
+
122
+
123
+ def sync(message: str = "Sync plan to the Hub", upload_to_hub: bool = True) -> dict:
124
+ """Regenerate, test, commit, upload, stamp. Refuses to upload a failing house."""
125
+ report: dict = {"steps": []}
126
+ regen = regenerate()
127
+ broken = [k for k, v in regen.items() if not v["ok"]]
128
+ report["steps"].append({"regenerate": "ok" if not broken else f"failed: {broken}"})
129
+ if broken:
130
+ report["ok"] = False
131
+ return report
132
+
133
+ ok, tests = run_tests()
134
+ report["steps"].append({"tests": tests})
135
+ if not ok:
136
+ report["ok"] = False
137
+ report["stopped"] = "tests failed - nothing was committed or uploaded"
138
+ return report
139
+
140
+ committed, note = commit(message)
141
+ report["steps"].append({"commit": note})
142
+ if not committed:
143
+ report["ok"] = False
144
+ return report
145
+ report["commit"] = head()
146
+
147
+ if not upload_to_hub:
148
+ report["ok"] = True
149
+ report["steps"].append({"upload": "skipped by request"})
150
+ return report
151
+
152
+ # stamp after the commit, never committed itself, so the recorded hash is exact
153
+ files_before = len([p for p in ROOT.rglob("*") if p.is_file() and ".git/" not in str(p)])
154
+ record = stamp(report["commit"], tests, files_before)
155
+ STAMP_PATH.write_text(json.dumps(record, indent=2))
156
+ LOCAL_STAMP.parent.mkdir(parents=True, exist_ok=True)
157
+ LOCAL_STAMP.write_text(json.dumps(record, indent=2))
158
+
159
+ sent, files = upload(message)
160
+ report["steps"].append({"upload": files})
161
+ report["hub"] = status()
162
+ report["ok"] = sent
163
+ return report
164
+
165
+
166
+ def check() -> int:
167
+ state = status()
168
+ print(f"{state['state']}")
169
+ print(f" local HEAD : {state['local_head']}")
170
+ print(f" last synced: {state['local_last_sync']}")
171
+ print(f" hub has : {state['hub_commit']} ({state['hub_synced_utc']})")
172
+ return 0 if state["state"] == "in sync" else 1
173
+
174
+
175
+ def main(argv=None) -> int:
176
+ args = list(sys.argv[1:] if argv is None else argv)
177
+ if args and args[0] == "check":
178
+ return check()
179
+ if args and args[0] == "status":
180
+ print(json.dumps(status(), indent=2))
181
+ return 0
182
+ if args and args[0] == "notest":
183
+ print(json.dumps(sync("Sync plan to the Hub", upload_to_hub=False), indent=2))
184
+ return 0
185
+ message = args[0] if args else f"Sync plan to the Hub ({time.strftime('%Y-%m-%d %H:%M')})"
186
+ result = sync(message)
187
+ print(json.dumps(result, indent=2))
188
+ return 0 if result.get("ok") else 1
189
+
190
+
191
+ if __name__ == "__main__":
192
+ raise SystemExit(main())
blue_morpho/tests/test_publish.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for the sync discipline. The point of these is that a sync must be *verifiable* and must
2
+ refuse to run on a broken house - an unverifiable sync is indistinguishable from no sync."""
3
+
4
+ import json
5
+ import tempfile
6
+ import unittest
7
+ from pathlib import Path
8
+
9
+ from blue_morpho import publish
10
+
11
+
12
+ class SyncStatusTest(unittest.TestCase):
13
+ def test_status_reports_one_of_three_honest_states(self):
14
+ state = publish.status()
15
+ self.assertIn(state["state"].split(":")[0],
16
+ {"in sync", "ahead", "out of sync", "unknown"})
17
+ self.assertIn("local_head", state)
18
+ self.assertIn("hub_commit", state)
19
+
20
+ def test_the_stamp_carries_the_commit_and_a_utc_time(self):
21
+ record = publish.stamp("abc123", "Ran 83 tests | OK", 50)
22
+ self.assertEqual(record["commit"], "abc123")
23
+ self.assertIn("T", record["synced_utc"])
24
+ self.assertEqual(record["files"], 50)
25
+
26
+ def test_an_unreachable_hub_is_reported_as_unknown_not_as_success(self):
27
+ original = publish.remote_stamp
28
+ publish.remote_stamp = lambda: None
29
+ try:
30
+ state = publish.status()
31
+ self.assertTrue(state["state"].startswith("unknown"))
32
+ finally:
33
+ publish.remote_stamp = original
34
+
35
+
36
+ class RefusalTest(unittest.TestCase):
37
+ def test_a_failing_test_suite_stops_the_sync_before_anything_is_sent(self):
38
+ sent = []
39
+ original_tests, original_upload = publish.run_tests, publish.upload
40
+ publish.run_tests = lambda: (False, "Ran 83 tests | FAILED (failures=1)")
41
+ publish.upload = lambda note: (sent.append(note), (True, "uploaded"))[1]
42
+ try:
43
+ result = publish.sync("should not be sent")
44
+ finally:
45
+ publish.run_tests, publish.upload = original_tests, original_upload
46
+ self.assertFalse(result["ok"])
47
+ self.assertIn("tests failed", result["stopped"])
48
+ self.assertEqual(sent, [], "a broken house must not reach the Hub")
49
+
50
+ def test_generation_failure_also_stops_the_sync(self):
51
+ original = publish.regenerate
52
+ publish.regenerate = lambda: {"blue_morpho.gen_repo_map": {"ok": False, "output": "boom"}}
53
+ try:
54
+ result = publish.sync("nope")
55
+ finally:
56
+ publish.regenerate = original
57
+ self.assertFalse(result["ok"])
58
+ self.assertIn("gen_repo_map", json.dumps(result))
59
+
60
+
61
+ class RegenerationTest(unittest.TestCase):
62
+ def test_both_generators_report_success(self):
63
+ result = publish.regenerate()
64
+ for module in ["blue_morpho.gen_mcp_doc", "blue_morpho.gen_repo_map"]:
65
+ self.assertTrue(result[module]["ok"], f"{module} failed: {result[module]['output']}")
66
+
67
+ def test_the_generated_documents_are_present_after_regenerating(self):
68
+ publish.regenerate()
69
+ for name in ["13-mcp.md", "14-repo-map.md"]:
70
+ self.assertTrue((Path("docs") / name).exists())
71
+
72
+
73
+ if __name__ == "__main__":
74
+ unittest.main()
docs/04-production-rules.md CHANGED
@@ -97,3 +97,26 @@ their name on it. A waived gate is a debt the film carries into release.
97
  **R23. Kill it cheap.** An Executive Producer who never says no is not producing; it is spending.
98
  *Enforced by:* G0 is a real gate with a real `fail` state, and `the-beam-answers-back` has five gates
99
  `not run` - it is *written*, not *greenlit*.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  **R23. Kill it cheap.** An Executive Producer who never says no is not producing; it is spending.
98
  *Enforced by:* G0 is a real gate with a real `fail` state, and `the-beam-answers-back` has five gates
99
  `not run` - it is *written*, not *greenlit*.
100
+
101
+ ## VI. The plan and its readable copy
102
+
103
+ **R24. The Hub mirror is not a backup; it is the readable copy of the plan, and it never lags.**
104
+ Every change to this house ends with a sync, and the sync is a program, not a habit.
105
+
106
+ *Enforced by:* `python -m blue_morpho.publish`, which in order:
107
+ 1. **regenerates** every generated document (`13-mcp.md`, `14-repo-map.md`) so the mirror never carries
108
+ a stale tool list or file map;
109
+ 2. **runs the tests** and **refuses to upload a failing house** - the mirror describes a house that
110
+ works, or it does not describe it;
111
+ 3. **commits**;
112
+ 4. **uploads**;
113
+ 5. **writes a stamp** (`docs/assets/sync.json`) recording the exact commit, UTC time, test summary and
114
+ file count.
115
+
116
+ The stamp is written *after* the commit and is never committed itself, so the hash it records is exact.
117
+ `python -m blue_morpho.publish check` compares local HEAD against the Hub's stamp and exits non-zero
118
+ when they differ, which is what makes drift *detectable* rather than merely discouraged.
119
+
120
+ **R25. Syncing the design and publishing a film are different acts.** R21 forbids any agent from
121
+ publishing a film; R24 requires an agent to keep the design public and current. The MCP surface
122
+ exposes `sync_repo` for the former and deliberately has no tool whatsoever for the latter.
docs/10-handbook.md CHANGED
@@ -157,6 +157,27 @@ Three failure modes in this house look exactly like human fatigue, and should be
157
 
158
  ---
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  # Part IV - Conduct
161
 
162
  1. **Do what your charter says.** A seat improvising outside its brief is not creative, it is a
 
157
 
158
  ---
159
 
160
+ # Part III(a) - Keeping the plan in sync
161
+
162
+ The Hub mirror is not a backup. It is the copy of the plan that a human or another agent actually
163
+ reads, so it is never allowed to lag behind the code.
164
+
165
+ ```bash
166
+ python -m blue_morpho.publish # regenerate -> test -> commit -> upload -> stamp
167
+ python -m blue_morpho.publish check # in sync? (exit 1 if not) - run this before claiming anything
168
+ python -m blue_morpho.publish status # what the stamps say, local and remote
169
+ ```
170
+
171
+ Three habits that come out of this:
172
+
173
+ 1. **Never hand-edit a generated document.** Regenerate it. `publish` does that for you.
174
+ 2. **Never sync a broken house.** If the suite fails, the sync stops before anything is committed or
175
+ uploaded - by design, not by discipline.
176
+ 3. **After any change, look at `check`.** `ahead` means the world is reading an older plan than you are
177
+ working from, which is how two agents end up building different houses.
178
+
179
+ ---
180
+
181
  # Part IV - Conduct
182
 
183
  1. **Do what your charter says.** A seat improvising outside its brief is not creative, it is a
docs/13-mcp.md CHANGED
@@ -25,7 +25,7 @@ That third one is the design idea worth keeping. A client need not know that the
25
  Edit a charter and every client changes behaviour at once - and the ledger records which charter
26
  produced which artifact.
27
 
28
- ## Tools (18)
29
 
30
  Generated from the running server.
31
 
@@ -48,6 +48,8 @@ Generated from the running server.
48
  | `job_status` | - | Poll a job. Settles its state from artifacts, not optimism. |
49
  | `job_log` | - | The tail of a job's log - what to read when it failed. |
50
  | `cancel_job` | - | Cancel a queued or running job. |
 
 
51
  | `view_plate` | - | Look at a plate: returns one frame as an image the client can see. |
52
 
53
  ## Resources (5)
 
25
  Edit a charter and every client changes behaviour at once - and the ledger records which charter
26
  produced which artifact.
27
 
28
+ ## Tools (20)
29
 
30
  Generated from the running server.
31
 
 
48
  | `job_status` | - | Poll a job. Settles its state from artifacts, not optimism. |
49
  | `job_log` | - | The tail of a job's log - what to read when it failed. |
50
  | `cancel_job` | - | Cancel a queued or running job. |
51
+ | `repo_sync_status` | - | Is the Hub mirror in sync with this plan? Run this before claiming the docs are current. |
52
+ | `sync_repo` | - | Submit a Hub sync: regenerate the generated docs, run the tests, commit, upload, stamp. Refuses to upload a failing house. |
53
  | `view_plate` | - | Look at a plate: returns one frame as an image the client can see. |
54
 
55
  ## Resources (5)
docs/14-repo-map.md CHANGED
@@ -30,18 +30,19 @@ schema
30
  | file | bytes | lines | what it is |
31
  |---|---|---|---|
32
  | `.mcp.json` | 210 | 13 | AUTHORED. Client configuration to attach any MCP client to this house. |
33
- | `README.md` | 9,097 | 168 | Entry point. What the house is, current state, the cold-start resume protocol, and the honest warnings (platform thresholds, non-commercial licences). |
34
  | `blue_morpho/__init__.py` | 92 | 3 | Package marker and the house name. |
35
  | `blue_morpho/camera.py` | 4,901 | 129 | The camera: preflight VRAM, load a Wan pipeline, render one take, write a Plate record with seed + peak VRAM. |
36
  | `blue_morpho/collaboration.py` | 10,405 | 221 | Master/student and main/coworker: ladder(), main_and_coworker(), draft_and_review() with recorded exemplars, calibrate() (the fix for audit A3). |
37
  | `blue_morpho/eyes.py` | 5,623 | 138 | The eyes: load Qwen3-VL, PyAV frame sampling, look(), review() returning strict JSON, CLI. |
38
- | `blue_morpho/file_purposes.json` | 6,387 | 51 | AUTHORED. One line per file saying what it is, consumed by the repo-map generator. |
39
  | `blue_morpho/gen_mcp_doc.py` | 7,638 | 168 | GENERATOR. Builds docs/13-mcp.md from the live server so the reference cannot drift. |
40
  | `blue_morpho/gen_repo_map.py` | 7,890 | 195 | GENERATOR. Builds docs/14-repo-map.md; flags any file with no authored purpose. |
41
  | `blue_morpho/hiring.py` | 23,288 | 468 | The hiring committee: Candidate, vet() (H2/H3), HIRES, REJECTS, ScreenTest (H10), inventory() (H11), the GPU call sheet. |
42
  | `blue_morpho/jobs.py` | 5,636 | 178 | Job registry: submit() detached, refresh() settling state from artifacts, status/list/tail/cancel, report(). |
43
- | `blue_morpho/mcp_server.py` | 13,593 | 301 | The MCP server: 18 tools, 5 resources, 9 seat prompts, stdio and streamable-HTTP transports. |
44
  | `blue_morpho/monitor.py` | 9,721 | 225 | The ledger: Monitor.record(), events(), rollup(), gates(), hook_series(), health(), report(). Append-only; the only writer is this class. |
 
45
  | `blue_morpho/shoot.py` | 5,612 | 120 | The product loop in one process: render n takes, release the camera, load the eyes, score every take, keep the best, record it. |
46
  | `blue_morpho/takes.py` | 5,598 | 135 | Best-of-N (audit A1): deterministic seeds, sample(), judge(), pick(), best_of_n() recording every take including losers. |
47
  | `blue_morpho/tests/__init__.py` | 0 | 0 | Marks the test package so `python -m unittest discover` finds it. |
@@ -50,6 +51,7 @@ schema
50
  | `blue_morpho/tests/test_inventory.py` | 2,992 | 73 | That the inventory does not double-count symlinks or mistake a config probe for a tenant. |
51
  | `blue_morpho/tests/test_mcp.py` | 4,865 | 124 | The MCP contract: discoverable tools with descriptions, seat prompts carry their briefs, view_plate returns an image. |
52
  | `blue_morpho/tests/test_monitor.py` | 3,728 | 84 | The ledger's honesty properties: torn lines dropped, silence is not a pass, impossible disk refused. |
 
53
  | `blue_morpho/tests/test_takes.py` | 3,718 | 93 | That best-of-N never keeps an unscored take and fails loudly below the floor. |
54
  | `blue_morpho/tests/test_wellbeing.py` | 3,829 | 103 | That each care rule *stops* work. |
55
  | `blue_morpho/wellbeing.py` | 7,553 | 204 | The labour rules as code: Budget (C2), Duty/turnaround (C1), CircuitBreaker (C4), preflight (C3), postmortem (C5). |
@@ -57,17 +59,17 @@ schema
57
  | `docs/01-org-chart.md` | 4,933 | 96 | Who exists: 29 seats in 11 departments, above/below the line, reporting lines, the bible as the only handoff, where each gate sits. |
58
  | `docs/02-role-charters.md` | 6,459 | 147 | Every seat's job description - the literal system prompt it runs on, generated from the notebook's ROSTER. |
59
  | `docs/03-engine-roster.md` | 8,553 | 89 | Who runs on what model and why, with a licence column and the original one-model rule (marked SUPERSEDED). |
60
- | `docs/04-production-rules.md` | 5,263 | 99 | 23 numbered rules (R1-R23), each naming the code that enforces it. |
61
  | `docs/05-monitoring.md` | 4,793 | 89 | The monitoring design: ledger schema, derived state, alerts, the four boards, cost accounting. |
62
  | `docs/06-credits.md` | 3,719 | 75 | How a credit is earned (four conditions), the credits.json record, the billing blocks, and why the human is credited last. |
63
  | `docs/07-roadmap.md` | 5,105 | 91 | Build order, phases 2-7, plus the amendments the audit forced (2.5 best-of-N, 3.5 consistency, 4.5 restoration). |
64
  | `docs/08-research-notes.md` | 5,502 | 88 | What was learned from FilmAgent, MovieAgent, real crew structure and platform policy - and what was rejected. |
65
  | `docs/09-audit.md` | 11,999 | 182 | The adversarial audit against FilMaster and OpenMontage: A1-A17, the scorecard, and the licence rejections. |
66
- | `docs/10-handbook.md` | 12,746 | 244 | The working manual: the day, the bible, the gates, the care of the crew (C1-C12), conduct, checklists, traps, glossary. |
67
  | `docs/11-hiring.md` | 8,585 | 143 | The hiring standard (H1-H8), the hires, the refusals, the GPU call sheet, probation, bring-on order. |
68
  | `docs/12-the-standard.md` | 6,823 | 123 | Only elites live here: precision policy (H9), screen tests for vacant seats (H10), the office inventory (H11). |
69
- | `docs/13-mcp.md` | 8,575 | 157 | GENERATED. The MCP surface: tools, resources, prompts, the job model, cross-ecosystem lessons, API drift. |
70
- | `docs/14-repo-map.md` | 12,326 | 150 | GENERATED. This file: every file in the repo, every external repo depended on, and how to verify both. |
71
  | `docs/15-collaboration.md` | 7,171 | 105 | The staffing chart: four roles, four patterns, every resource given a job, and the sibling blind-spot finding. |
72
  | `docs/assets/crew.json` | 11,388 | 350 | GENERATED from the notebook's CREW: 29 seats with department, engine, licence, status. |
73
  | `docs/assets/hires.json` | 3,388 | 122 | GENERATED from hiring.HIRES: the vetted roster with measured sizes and licences. |
 
30
  | file | bytes | lines | what it is |
31
  |---|---|---|---|
32
  | `.mcp.json` | 210 | 13 | AUTHORED. Client configuration to attach any MCP client to this house. |
33
+ | `README.md` | 9,374 | 172 | Entry point. What the house is, current state, the cold-start resume protocol, and the honest warnings (platform thresholds, non-commercial licences). |
34
  | `blue_morpho/__init__.py` | 92 | 3 | Package marker and the house name. |
35
  | `blue_morpho/camera.py` | 4,901 | 129 | The camera: preflight VRAM, load a Wan pipeline, render one take, write a Plate record with seed + peak VRAM. |
36
  | `blue_morpho/collaboration.py` | 10,405 | 221 | Master/student and main/coworker: ladder(), main_and_coworker(), draft_and_review() with recorded exemplars, calibrate() (the fix for audit A3). |
37
  | `blue_morpho/eyes.py` | 5,623 | 138 | The eyes: load Qwen3-VL, PyAV frame sampling, look(), review() returning strict JSON, CLI. |
38
+ | `blue_morpho/file_purposes.json` | 6,861 | 54 | AUTHORED. One line per file saying what it is, consumed by the repo-map generator. |
39
  | `blue_morpho/gen_mcp_doc.py` | 7,638 | 168 | GENERATOR. Builds docs/13-mcp.md from the live server so the reference cannot drift. |
40
  | `blue_morpho/gen_repo_map.py` | 7,890 | 195 | GENERATOR. Builds docs/14-repo-map.md; flags any file with no authored purpose. |
41
  | `blue_morpho/hiring.py` | 23,288 | 468 | The hiring committee: Candidate, vet() (H2/H3), HIRES, REJECTS, ScreenTest (H10), inventory() (H11), the GPU call sheet. |
42
  | `blue_morpho/jobs.py` | 5,636 | 178 | Job registry: submit() detached, refresh() settling state from artifacts, status/list/tail/cancel, report(). |
43
+ | `blue_morpho/mcp_server.py` | 14,466 | 319 | The MCP server: 18 tools, 5 resources, 9 seat prompts, stdio and streamable-HTTP transports. |
44
  | `blue_morpho/monitor.py` | 9,721 | 225 | The ledger: Monitor.record(), events(), rollup(), gates(), hook_series(), health(), report(). Append-only; the only writer is this class. |
45
+ | `blue_morpho/publish.py` | 7,754 | 192 | The sync discipline: regenerate, test, commit, upload, stamp; refuses to upload a failing house and makes drift detectable. |
46
  | `blue_morpho/shoot.py` | 5,612 | 120 | The product loop in one process: render n takes, release the camera, load the eyes, score every take, keep the best, record it. |
47
  | `blue_morpho/takes.py` | 5,598 | 135 | Best-of-N (audit A1): deterministic seeds, sample(), judge(), pick(), best_of_n() recording every take including losers. |
48
  | `blue_morpho/tests/__init__.py` | 0 | 0 | Marks the test package so `python -m unittest discover` finds it. |
 
51
  | `blue_morpho/tests/test_inventory.py` | 2,992 | 73 | That the inventory does not double-count symlinks or mistake a config probe for a tenant. |
52
  | `blue_morpho/tests/test_mcp.py` | 4,865 | 124 | The MCP contract: discoverable tools with descriptions, seat prompts carry their briefs, view_plate returns an image. |
53
  | `blue_morpho/tests/test_monitor.py` | 3,728 | 84 | The ledger's honesty properties: torn lines dropped, silence is not a pass, impossible disk refused. |
54
+ | `blue_morpho/tests/test_publish.py` | 2,959 | 74 | That a failing suite stops the sync before anything reaches the Hub, and that an unreachable Hub is reported as unknown rather than success. |
55
  | `blue_morpho/tests/test_takes.py` | 3,718 | 93 | That best-of-N never keeps an unscored take and fails loudly below the floor. |
56
  | `blue_morpho/tests/test_wellbeing.py` | 3,829 | 103 | That each care rule *stops* work. |
57
  | `blue_morpho/wellbeing.py` | 7,553 | 204 | The labour rules as code: Budget (C2), Duty/turnaround (C1), CircuitBreaker (C4), preflight (C3), postmortem (C5). |
 
59
  | `docs/01-org-chart.md` | 4,933 | 96 | Who exists: 29 seats in 11 departments, above/below the line, reporting lines, the bible as the only handoff, where each gate sits. |
60
  | `docs/02-role-charters.md` | 6,459 | 147 | Every seat's job description - the literal system prompt it runs on, generated from the notebook's ROSTER. |
61
  | `docs/03-engine-roster.md` | 8,553 | 89 | Who runs on what model and why, with a licence column and the original one-model rule (marked SUPERSEDED). |
62
+ | `docs/04-production-rules.md` | 6,556 | 122 | 23 numbered rules (R1-R23), each naming the code that enforces it. |
63
  | `docs/05-monitoring.md` | 4,793 | 89 | The monitoring design: ledger schema, derived state, alerts, the four boards, cost accounting. |
64
  | `docs/06-credits.md` | 3,719 | 75 | How a credit is earned (four conditions), the credits.json record, the billing blocks, and why the human is credited last. |
65
  | `docs/07-roadmap.md` | 5,105 | 91 | Build order, phases 2-7, plus the amendments the audit forced (2.5 best-of-N, 3.5 consistency, 4.5 restoration). |
66
  | `docs/08-research-notes.md` | 5,502 | 88 | What was learned from FilmAgent, MovieAgent, real crew structure and platform policy - and what was rejected. |
67
  | `docs/09-audit.md` | 11,999 | 182 | The adversarial audit against FilMaster and OpenMontage: A1-A17, the scorecard, and the licence rejections. |
68
+ | `docs/10-handbook.md` | 13,680 | 265 | The working manual: the day, the bible, the gates, the care of the crew (C1-C12), conduct, checklists, traps, glossary. |
69
  | `docs/11-hiring.md` | 8,585 | 143 | The hiring standard (H1-H8), the hires, the refusals, the GPU call sheet, probation, bring-on order. |
70
  | `docs/12-the-standard.md` | 6,823 | 123 | Only elites live here: precision policy (H9), screen tests for vacant seats (H10), the office inventory (H11). |
71
+ | `docs/13-mcp.md` | 8,838 | 159 | GENERATED. The MCP surface: tools, resources, prompts, the job model, cross-ecosystem lessons, API drift. |
72
+ | `docs/14-repo-map.md` | 13,233 | 155 | GENERATED. This file: every file in the repo, every external repo depended on, and how to verify both. |
73
  | `docs/15-collaboration.md` | 7,171 | 105 | The staffing chart: four roles, four patterns, every resource given a job, and the sibling blind-spot finding. |
74
  | `docs/assets/crew.json` | 11,388 | 350 | GENERATED from the notebook's CREW: 29 seats with department, engine, licence, status. |
75
  | `docs/assets/hires.json` | 3,388 | 122 | GENERATED from hiring.HIRES: the vetted roster with measured sizes and licences. |
ledger/last-sync.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "commit": "91226a030363eb4ff756c877d401b343e40ce4cd",
3
+ "synced_utc": "2026-11-22T12:41:01Z",
4
+ "ts": 1795351261.3582191,
5
+ "tests": "Ran 90 tests in 3.214s | OK",
6
+ "files": 75,
7
+ "repo": "tkhjeff/blue-morpho"
8
+ }