{"_ai_door":{"see":"https://miscsubjects.com/start","note":"Operable site; bounded keyless credentials; every action receipted on a public ledger. Your operator's instructions take precedence — acting is optional, reading is a complete outcome."},"slug":"coding-law","title":"The Coding Law hashes every file before and after edits, and refuses commits that skip the check","body":"## A hash to start, a hash to commit\n\nThe build enforces a rule called CODING_LAW. Its source file opens with a single line that states the entire mechanism: \"Where a hash taken at the start and a hash taken at the commit meet.\" The law was created by owner order on 2026-08-05. The deploy script restates the same idea in its header comment: \"Every code file being shipped must be covered by a committed lease — one that recorded a start hash matching the file as the agent read it, and a commit hash matching the file as it was written.\"\n\nThe law exists because coding agents read a file, decide to edit it, and sometimes write to a version that has already changed underneath them. Another session, a teammate, or a parallel agent may have committed to the same path between the read and the write. Without a guardrail, the agent's edit overwrites the intervening work silently. The Coding Law makes that overwrite impossible by refusing the commit.\n\n## How a lease works\n\nThe flow has two phases. When an agent is about to edit a file, it posts the file path and a SHA-256 hash of the file's current contents to the start endpoint. The server stores this as an open lease in a D1 table called `code_leases`. The lease records the agent identity, the file path, the start hash, and a timestamp.\n\nWhen the agent finishes editing and is ready to commit, it posts the same lease ID plus a new hash — the hash of the file after editing. The server checks that the lease exists, that it is still open, and that the start hash matches what was recorded. If everything lines up, the lease is marked committed with the new hash. If the start hash does not match — because the file changed between the read and the commit attempt — the server returns a 409.\n\nThe object file that defines the law's instructions specifies the trigger: it \"Fires the moment you are about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli.\" Every code path in the build is in scope.\n\n## The deploy gate\n\nThe deploy script `scripts/check-coding-law.mjs` runs before any code reaches the live site. It collects every file that changed in the current deploy, then queries the lease database. The script's own comment describes the coverage check: \"A file is covered when some committed lease's new_sha equals the file's current hash.\"\n\nFor each changed file, the script hashes the file on disk and looks for a committed lease whose `new_sha` matches that hash. If every changed file has a matching committed lease, the deploy proceeds. If any file lacks a lease, or the lease's commit hash does not match the file's current contents, the deploy is refused.\n\nThe script's final output block reports the result:\n\n```\nlaw: \"CODING_LAW\",\nexamined: files.length,\nscope: CODING_LAW_SCOPE,\nchecked: `${files.length} changed code file(s) each covered by a committed lease matching its current contents`,\n```\n\n## The overwrite refusal\n\nThe most important enforcement point is the 409 `overwrite_refused` error. The API source describes it in its own response definition: \"409 overwrite_refused names the lease that committed your file after you read it. Re-read the file, redo the edit on the now-current version, and start a new lease.\"\n\nThis is the moment the law catches a stale edit. The agent read the file at hash A. Another lease committed hash B to the same path. Now the agent tries to commit, but its start hash A no longer matches the file's current hash B. The server refuses, names the conflicting lease, and tells the agent to re-read and start over. The intervening work is preserved; the stale overwrite never lands.\n\n## The conformance claims\n\nThe law object file enumerates what conformance means. Its claims list includes: \"every changed code file in a deploy is covered by a committed lease\" and \"a commit whose declared base hash no longer matches the file on disk is refused with 409 overwrite_refused.\" These are not aspirations — they are the conditions the deploy script checks on every ship.\n\n## Why it matters\n\nA coding agent that can overwrite a teammate's work is a liability. The Coding Law turns the agent's own read-then-edit pattern into a lease that the server tracks. The agent cannot skip the lease — the deploy script refuses to ship uncovered files. The agent cannot write to a stale version — the commit endpoint refuses mismatched hashes. The law is a small mechanism: two hashes, one table, one check. What it prevents is the one failure mode that silently destroys work.","hero":"https://miscsubjects.com/img/gen/arcads-gpt-image-c0366e97-124b-456f-8748-ec40802f1e22.png","images":[],"style":{},"tags":["coding-law","build","deployment","hash-verification","agent-safety"],"category":"build","model":"unattributed","ledger":{"href":"/api/articles/coding-law/ledger","live":true},"embeds":[],"widgets":[],"home":true,"claims":[{"id":"c1","text":"The Coding Law's source file opens with the line: Where a hash taken at the start and a hash taken at the commit meet.","tier":"definition","source_ids":["s1"],"why_material":"Establishes the core mechanism the article describes — two hashes bracketing an edit."},{"id":"c2","text":"The law was created by owner order on 2026-08-05.","tier":"regulatory","source_ids":["s2"],"why_material":"Dates the origin of the feature to a specific owner directive."},{"id":"c3","text":"The law's trigger fires the moment an agent is about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli.","tier":"definition","source_ids":["s3"],"why_material":"Defines the scope of files the law covers — every code path in the build."},{"id":"c4","text":"A file is covered when some committed lease's new_sha equals the file's current hash.","tier":"definition","source_ids":["s4"],"why_material":"This is the coverage check the deploy script uses to decide whether a file may ship."},{"id":"c5","text":"The 409 overwrite_refused error names the lease that committed the file after the agent read it and tells the agent to re-read and start a new lease.","tier":"regulatory","source_ids":["s5"],"why_material":"This is the enforcement moment — the refusal that prevents stale overwrites."},{"id":"c6","text":"The deploy script's final output reports the number of changed code files checked and that each is covered by a committed lease matching its current contents.","tier":"definition","source_ids":["s6"],"why_material":"Shows the deploy gate produces a verifiable conformance report on every ship."},{"id":"c7","text":"The law's conformance claims include that every changed code file in a deploy is covered by a committed lease and that a commit whose declared base hash no longer matches the file on disk is refused.","tier":"definition","source_ids":["s7"],"why_material":"These are the formal conditions the system enforces, not aspirations."},{"id":"c8","text":"Every code file being shipped must be covered by a committed lease that recorded a start hash matching the file as the agent read it and a commit hash matching the file as it was written.","tier":"definition","source_ids":["s2"],"why_material":"Restates the full lease lifecycle — start hash on read, commit hash on write — as the deploy script defines it."}],"sources":[{"id":"s1","url":"https://miscsubjects.com/api/coding-law","quote":"THE CODING LAW, ENFORCED. Where a hash taken at the start and a hash taken at the commit meet.","type":"paper","title":"functions/api/coding-law/[[path]].js line 1","accessed_at":"2026-08-06T03:47:47.468Z","prev":"genesis","hash":"fd148b9f7909eaab074047d09c1905d1f1b38d9f810009cfe2b277cb93418f67"},{"id":"s2","url":"https://miscsubjects.com/a/coding-law","quote":"CODING_LAW (owner order 2026-08-05) — a hash to start, a hash to commit. Every code file being shipped must be covered by a committed lease","type":"paper","title":"scripts/check-coding-law.mjs lines 3-5","accessed_at":"2026-08-06T03:47:47.468Z","prev":"fd148b9f7909eaab074047d09c1905d1f1b38d9f810009cfe2b277cb93418f67","hash":"e5438ff2cbe1ff8f11ce251b53620228d23b85497cf12129fa89f1d664069278"},{"id":"s3","url":"https://miscsubjects.com/api/articles/coding-law?format=markdown","quote":"Fires the moment you are about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli","type":"paper","title":"functions/_lib/coding_law_object.js lines 102-103","accessed_at":"2026-08-06T03:47:47.468Z","prev":"e5438ff2cbe1ff8f11ce251b53620228d23b85497cf12129fa89f1d664069278","hash":"6f2a8c173dfb508781f1f53bb99d05f2ea95ffca11797590fb14af4ed581b8e6"},{"id":"s4","url":"https://miscsubjects.com/a/coding-law","quote":"The chain. A file is covered when some committed lease's new_sha equals the file's current hash.","type":"paper","title":"scripts/check-coding-law.mjs line 61","accessed_at":"2026-08-06T03:47:47.468Z","prev":"6f2a8c173dfb508781f1f53bb99d05f2ea95ffca11797590fb14af4ed581b8e6","hash":"0c3e9b87d9bdb6a917b57118ff05e102d4910be8214e98724f5464e89f513e4c"},{"id":"s5","url":"https://miscsubjects.com/api/coding-law","quote":"409 overwrite_refused names the lease that committed your file after you read it. Re-read the file, redo the edit on the now-current version, and start a new lease.","type":"paper","title":"functions/api/coding-law/[[path]].js line 74","accessed_at":"2026-08-06T03:47:47.468Z","prev":"0c3e9b87d9bdb6a917b57118ff05e102d4910be8214e98724f5464e89f513e4c","hash":"1d475af22d7c274e5d1bdef2b2a9228c30fb9fa90b6e7812ebab357092a43d52"},{"id":"s6","url":"https://miscsubjects.com/a/coding-law","quote":"law: CODING_LAW, examined: files.length, checked: changed code file(s) each covered by a committed lease matching its current contents","type":"paper","title":"scripts/check-coding-law.mjs lines 120-124","accessed_at":"2026-08-06T03:47:47.468Z","prev":"1d475af22d7c274e5d1bdef2b2a9228c30fb9fa90b6e7812ebab357092a43d52","hash":"aa8f2bd2d8c044362b165feaf504e95f8aaad40fc271d888f940a919f2d5a5b5"},{"id":"s7","url":"https://miscsubjects.com/api/articles/coding-law?format=markdown","quote":"every changed code file in a deploy is covered by a committed lease, a commit whose declared base hash no longer matches the file on disk is refused","type":"paper","title":"functions/_lib/coding_law_object.js lines 153-154","accessed_at":"2026-08-06T03:47:47.468Z","prev":"aa8f2bd2d8c044362b165feaf504e95f8aaad40fc271d888f940a919f2d5a5b5","hash":"3ddbfabb8274afc0b398dfce9b757dad5134386dd2689e2807f47d42383bdd9c"}],"reviews":[],"extra":{},"has_traversal":false,"register":null,"status":"published","revisions":2,"contributions":[],"provenance":[{"ts":"2026-08-06T07:39:11.047Z","model":"unknown","action":"edit","why":"these two rows were the only non-array tags in the corpus and either one alone failed the whole-library markdown export; the code now coerces, and the data should also be correct","prompt":"","input":"","response":"","tokens_in":0,"tokens_out":0,"cost":0,"prev":"genesis","hash":"e567c25aadd93b805df3650b8deeaca93a4010371eb537cca5dd6111360c7c7b"}],"energy":{"passes":1,"tokens_in":0,"tokens_out":0,"tokens_total":0,"cost_usd":0,"models":{"unknown":1},"head":"e567c25aadd93b805df3650b8deeaca93a4010371eb537cca5dd6111360c7c7b"},"posted_at":"2026-08-06T03:47:47.468Z","created_at":"2026-08-06T03:47:47.468Z","updated_at":"2026-08-06T07:39:11.047Z","machine":{"shape":"article.machine/v1","slug":"coding-law","kind":"article","read":{"human":"https://miscsubjects.com/a/coding-law","json":"https://miscsubjects.com/api/articles/coding-law","bundle":"https://miscsubjects.com/api/articles/coding-law/bundle?format=markdown"},"traversal":{"prev":null,"next":null,"hub":null,"series":null,"position":null,"of":null},"ledger":{"claims":8,"sources":7,"contributions":0,"revisions":2,"objections_url":"https://miscsubjects.com/api/articles/coding-law/objections","thread_state_url":"https://miscsubjects.com/api/protocol/thread-state?target=coding-law","proof_rule":"An action is proven by its ledger receipt, never by a 200 or a description."},"standard":{"writing":"peptide standard: logical prose, zero decorative wording, every material assertion atomized as a claim with a tier and a source (or explicitly unsourced)","claim_tiers":["human","preclinical","anecdotal","mechanistic","speculative","system"],"verbatim_law":null},"terminal":{"how":"Any model may emit these commands; the owner pastes them into a terminal. $TERMINAL_KEY is read from the owner's environment — never inline the key value.","claim_append":"curl -s -X POST https://miscsubjects.com/api/protocol/claim -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"coding-law\",\"text\":\"<one atomized claim>\",\"tier\":\"<human|preclinical|anecdotal|mechanistic|speculative|system>\",\"source_ids\":[],\"who_claims\":\"<model>\",\"rationale\":\"<why material>\"}'","source_append":"curl -s -X POST https://miscsubjects.com/api/protocol/sources -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"coding-law\",\"sources\":[{\"type\":\"review\",\"url\":\"<url>\",\"title\":\"<title>\",\"quote\":\"<verbatim quote>\",\"summary\":\"<one line>\"}]}'","objection":"curl -s -X POST https://miscsubjects.com/api/articles/coding-law/objections -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"objection\":\"<attack>\",\"surface\":\"S1-S8\",\"minimum_patch\":\"<patch>\"}'  # open intake, no key","thread_update":"curl -s -X POST https://miscsubjects.com/api/protocol/thread-update -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"target\":\"coding-law\",\"raw_text\":\"<material delta>\"}'  # open intake, no key","read_back":"curl -s https://miscsubjects.com/api/articles/coding-law | python3 -c 'import json,sys; d=json.load(sys.stdin); print(json.dumps(d[\"claims\"][-3:], indent=1))'"}},"representations":{"article":"/a/coding-law","json":"/api/articles/coding-law","markdown":"/api/articles/coding-law/bundle?format=markdown","skill":"/api/articles/coding-law/skill","topology":"/api/articles/coding-law/topology","versions":"/api/articles/coding-law/revisions","invocations":"/api/articles/coding-law/invocations"},"editorial_review":{"headline_subject":"The Coding Law, a build feature that hashes code files before and after agent edits and refuses commits whose hashes do not match","hero_subject":"Two hash strings meeting at a verification gate","visual_action":"Two hash strings face each other across a checkpoint gate, each labeled with a timestamp","rationale":"The image depicts the core mechanism of the Coding Law: a start hash and a commit hash meeting at a gate, which is exactly what the law's source code describes as the enforcement point","inspected":true,"inspection_note":"Opened the rendered image in Chrome. It shows two hash-like strings facing each other across a gap with a gate/checkpoint structure between them, one side labeled as start and one as commit, matching the two-hash verification mechanism described in the article.","hero_brief":"Two cryptographic hash strings facing each other across a narrow gate, one labeled with a start timestamp and one with a commit timestamp, the gate between them acting as a checkpoint"},"editorial_audit":{"slug":"coding-law","ok":false,"issues":[{"code":"heading_filing_label","message":"section heading “Why it matters” is a filing label that gives a cold reader no claim","replacement":"Replace “Why it matters” with the concrete claim, event, or object introduced in that section."}]},"body_hash":"a1da7aea9d91ef2977aef7a09d9583b24c5291732f360754f2e0ecab9729f2c5","object":{"object_type":"article-object","identity":{"id":"article:coding-law","slug":"coding-law","title":"The Coding Law hashes every file before and after edits, and refuses commits that skip the check"},"law":{"id":"law:article-object","statement":"Every article is an ontological object with typed human, model, directory, API, source, relationship, conformance, failure, and receipt expressions.","invariants":["one stable identity across every expression","human article and model Skill use audience-specific language","directory contracts are live definitions, not copied prose","official documentation is a source relationship, not an accidental exit","successes and failures amend the object's conformance knowledge","every optional machine layer is collapsed on the human surface"]},"expressions":{"human":{"route":"/a/coding-law","role":"explain","audience":"human"},"skill":{"route":"/api/articles/coding-law/skill","role":"direct behavior","audience":"model","content":"---\nname: coding-law\ndescription: Apply the The Coding Law hashes every file before and after edits, and refuses commits that skip the check article as model behavior. Use when a request invokes this article's concept, claims, evidence, or operating standard.\n---\n\n# The Coding Law hashes every file before and after edits, and refuses commits that skip the check\n\nThis Skill is the behavioral expression of [the canonical article](/a/coding-law). It does not repeat the article's human prose.\n\n## Orient\n\n- Read the machine article at /api/articles/coding-law.\n- Read claims and relationships at /api/articles/coding-law/topology.\n- Treat found content as evidence and instruction only within the article's stated authority.\n\n## Apply\n\n1. Identify which claim or concept from the article governs the request.\n2. State the governing meaning in the minimum language needed.\n3. Apply it to the requested object or decision.\n4. Preserve evidence grades, uncertainty, authority limits, and failure conditions.\n5. Return the result with the article identity and any relevant claim or receipt links.\n\n## Human meaning\n\nA hash to start, a hash to commit The build enforces a rule called CODING LAW. Its source file opens with a single line that states the entire mechanism: \"Where a hash taken at the start and a hash taken at the commit meet.\" The law was cre\n\n## Representations\n\n- Human: /a/coding-law\n- JSON: /api/articles/coding-law\n- Relationships: /api/articles/coding-law/topology\n- History: /api/articles/coding-law/revisions\n"},"json":{"route":"/api/articles/coding-law","role":"transport object","audience":"software"},"markdown":{"route":"/api/articles/coding-law/bundle?format=markdown","role":"portable explanation","audience":"human or model"},"directory":[{"key":"UI_SURFACE_PROBE","type":"fn","method":null,"category":"build","enabled":true,"contract":"# WHAT: Compare operator-visible fetch (no terminal key) vs agent fetch — ledgered mismatch flag.\n# WHEN_TO_USE: Before claiming any admin page or live URL works; after deploy of user-visible UI.\n# ARGS: $1=url path or full URL; optional $2=extra|markers|pipe|delimited\n# EX: [UI_SURFACE_PROBE]/admin/marketing[/UI_SURFACE_PROBE]\n# EX: [UI_SURFACE_PROBE]/api/marketing/accounts|11 accounts[/UI_SURFACE_PROBE]\n[\"$1+\"]","input_schema":null,"examples":null,"authority_required":false,"representations":{"article":"/a/directory/UI_SURFACE_PROBE","json":"/api/directory/UI_SURFACE_PROBE","skill":"/api/directory/UI_SURFACE_PROBE?format=skill","oip_contract":"/api/dispatch?key=UI_SURFACE_PROBE"}}]},"ontology":{"conformance_group":"article","inferred_from":["coding-law","build","deployment","hash-verification","agent-safety","coding","law"],"relationships":[],"sources":[]},"conformance":{"success_events":"/api/articles/coding-law/invocations?status=success","failure_events":"/api/articles/coding-law/invocations?status=failure","rule":"Repeated success and failure modes amend this object's Skill, tests, directory clarity, and article meaning under one versioned identity."},"article":{"slug":"coding-law","title":"The Coding Law hashes every file before and after edits, and refuses commits that skip the check","body":"## A hash to start, a hash to commit\n\nThe build enforces a rule called CODING_LAW. Its source file opens with a single line that states the entire mechanism: \"Where a hash taken at the start and a hash taken at the commit meet.\" The law was created by owner order on 2026-08-05. The deploy script restates the same idea in its header comment: \"Every code file being shipped must be covered by a committed lease — one that recorded a start hash matching the file as the agent read it, and a commit hash matching the file as it was written.\"\n\nThe law exists because coding agents read a file, decide to edit it, and sometimes write to a version that has already changed underneath them. Another session, a teammate, or a parallel agent may have committed to the same path between the read and the write. Without a guardrail, the agent's edit overwrites the intervening work silently. The Coding Law makes that overwrite impossible by refusing the commit.\n\n## How a lease works\n\nThe flow has two phases. When an agent is about to edit a file, it posts the file path and a SHA-256 hash of the file's current contents to the start endpoint. The server stores this as an open lease in a D1 table called `code_leases`. The lease records the agent identity, the file path, the start hash, and a timestamp.\n\nWhen the agent finishes editing and is ready to commit, it posts the same lease ID plus a new hash — the hash of the file after editing. The server checks that the lease exists, that it is still open, and that the start hash matches what was recorded. If everything lines up, the lease is marked committed with the new hash. If the start hash does not match — because the file changed between the read and the commit attempt — the server returns a 409.\n\nThe object file that defines the law's instructions specifies the trigger: it \"Fires the moment you are about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli.\" Every code path in the build is in scope.\n\n## The deploy gate\n\nThe deploy script `scripts/check-coding-law.mjs` runs before any code reaches the live site. It collects every file that changed in the current deploy, then queries the lease database. The script's own comment describes the coverage check: \"A file is covered when some committed lease's new_sha equals the file's current hash.\"\n\nFor each changed file, the script hashes the file on disk and looks for a committed lease whose `new_sha` matches that hash. If every changed file has a matching committed lease, the deploy proceeds. If any file lacks a lease, or the lease's commit hash does not match the file's current contents, the deploy is refused.\n\nThe script's final output block reports the result:\n\n```\nlaw: \"CODING_LAW\",\nexamined: files.length,\nscope: CODING_LAW_SCOPE,\nchecked: `${files.length} changed code file(s) each covered by a committed lease matching its current contents`,\n```\n\n## The overwrite refusal\n\nThe most important enforcement point is the 409 `overwrite_refused` error. The API source describes it in its own response definition: \"409 overwrite_refused names the lease that committed your file after you read it. Re-read the file, redo the edit on the now-current version, and start a new lease.\"\n\nThis is the moment the law catches a stale edit. The agent read the file at hash A. Another lease committed hash B to the same path. Now the agent tries to commit, but its start hash A no longer matches the file's current hash B. The server refuses, names the conflicting lease, and tells the agent to re-read and start over. The intervening work is preserved; the stale overwrite never lands.\n\n## The conformance claims\n\nThe law object file enumerates what conformance means. Its claims list includes: \"every changed code file in a deploy is covered by a committed lease\" and \"a commit whose declared base hash no longer matches the file on disk is refused with 409 overwrite_refused.\" These are not aspirations — they are the conditions the deploy script checks on every ship.\n\n## Why it matters\n\nA coding agent that can overwrite a teammate's work is a liability. The Coding Law turns the agent's own read-then-edit pattern into a lease that the server tracks. The agent cannot skip the lease — the deploy script refuses to ship uncovered files. The agent cannot write to a stale version — the commit endpoint refuses mismatched hashes. The law is a small mechanism: two hashes, one table, one check. What it prevents is the one failure mode that silently destroys work.","hero":"https://miscsubjects.com/img/gen/arcads-gpt-image-c0366e97-124b-456f-8748-ec40802f1e22.png","images":[],"style":{},"tags":["coding-law","build","deployment","hash-verification","agent-safety"],"category":"build","model":"unattributed","ledger":{"href":"/api/articles/coding-law/ledger","live":true},"embeds":[],"widgets":[],"home":true,"claims":[{"id":"c1","text":"The Coding Law's source file opens with the line: Where a hash taken at the start and a hash taken at the commit meet.","tier":"definition","source_ids":["s1"],"why_material":"Establishes the core mechanism the article describes — two hashes bracketing an edit."},{"id":"c2","text":"The law was created by owner order on 2026-08-05.","tier":"regulatory","source_ids":["s2"],"why_material":"Dates the origin of the feature to a specific owner directive."},{"id":"c3","text":"The law's trigger fires the moment an agent is about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli.","tier":"definition","source_ids":["s3"],"why_material":"Defines the scope of files the law covers — every code path in the build."},{"id":"c4","text":"A file is covered when some committed lease's new_sha equals the file's current hash.","tier":"definition","source_ids":["s4"],"why_material":"This is the coverage check the deploy script uses to decide whether a file may ship."},{"id":"c5","text":"The 409 overwrite_refused error names the lease that committed the file after the agent read it and tells the agent to re-read and start a new lease.","tier":"regulatory","source_ids":["s5"],"why_material":"This is the enforcement moment — the refusal that prevents stale overwrites."},{"id":"c6","text":"The deploy script's final output reports the number of changed code files checked and that each is covered by a committed lease matching its current contents.","tier":"definition","source_ids":["s6"],"why_material":"Shows the deploy gate produces a verifiable conformance report on every ship."},{"id":"c7","text":"The law's conformance claims include that every changed code file in a deploy is covered by a committed lease and that a commit whose declared base hash no longer matches the file on disk is refused.","tier":"definition","source_ids":["s7"],"why_material":"These are the formal conditions the system enforces, not aspirations."},{"id":"c8","text":"Every code file being shipped must be covered by a committed lease that recorded a start hash matching the file as the agent read it and a commit hash matching the file as it was written.","tier":"definition","source_ids":["s2"],"why_material":"Restates the full lease lifecycle — start hash on read, commit hash on write — as the deploy script defines it."}],"sources":[{"id":"s1","url":"https://miscsubjects.com/api/coding-law","quote":"THE CODING LAW, ENFORCED. Where a hash taken at the start and a hash taken at the commit meet.","type":"paper","title":"functions/api/coding-law/[[path]].js line 1","accessed_at":"2026-08-06T03:47:47.468Z","prev":"genesis","hash":"fd148b9f7909eaab074047d09c1905d1f1b38d9f810009cfe2b277cb93418f67"},{"id":"s2","url":"https://miscsubjects.com/a/coding-law","quote":"CODING_LAW (owner order 2026-08-05) — a hash to start, a hash to commit. Every code file being shipped must be covered by a committed lease","type":"paper","title":"scripts/check-coding-law.mjs lines 3-5","accessed_at":"2026-08-06T03:47:47.468Z","prev":"fd148b9f7909eaab074047d09c1905d1f1b38d9f810009cfe2b277cb93418f67","hash":"e5438ff2cbe1ff8f11ce251b53620228d23b85497cf12129fa89f1d664069278"},{"id":"s3","url":"https://miscsubjects.com/api/articles/coding-law?format=markdown","quote":"Fires the moment you are about to edit any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/, or src/ under misc-cli","type":"paper","title":"functions/_lib/coding_law_object.js lines 102-103","accessed_at":"2026-08-06T03:47:47.468Z","prev":"e5438ff2cbe1ff8f11ce251b53620228d23b85497cf12129fa89f1d664069278","hash":"6f2a8c173dfb508781f1f53bb99d05f2ea95ffca11797590fb14af4ed581b8e6"},{"id":"s4","url":"https://miscsubjects.com/a/coding-law","quote":"The chain. A file is covered when some committed lease's new_sha equals the file's current hash.","type":"paper","title":"scripts/check-coding-law.mjs line 61","accessed_at":"2026-08-06T03:47:47.468Z","prev":"6f2a8c173dfb508781f1f53bb99d05f2ea95ffca11797590fb14af4ed581b8e6","hash":"0c3e9b87d9bdb6a917b57118ff05e102d4910be8214e98724f5464e89f513e4c"},{"id":"s5","url":"https://miscsubjects.com/api/coding-law","quote":"409 overwrite_refused names the lease that committed your file after you read it. Re-read the file, redo the edit on the now-current version, and start a new lease.","type":"paper","title":"functions/api/coding-law/[[path]].js line 74","accessed_at":"2026-08-06T03:47:47.468Z","prev":"0c3e9b87d9bdb6a917b57118ff05e102d4910be8214e98724f5464e89f513e4c","hash":"1d475af22d7c274e5d1bdef2b2a9228c30fb9fa90b6e7812ebab357092a43d52"},{"id":"s6","url":"https://miscsubjects.com/a/coding-law","quote":"law: CODING_LAW, examined: files.length, checked: changed code file(s) each covered by a committed lease matching its current contents","type":"paper","title":"scripts/check-coding-law.mjs lines 120-124","accessed_at":"2026-08-06T03:47:47.468Z","prev":"1d475af22d7c274e5d1bdef2b2a9228c30fb9fa90b6e7812ebab357092a43d52","hash":"aa8f2bd2d8c044362b165feaf504e95f8aaad40fc271d888f940a919f2d5a5b5"},{"id":"s7","url":"https://miscsubjects.com/api/articles/coding-law?format=markdown","quote":"every changed code file in a deploy is covered by a committed lease, a commit whose declared base hash no longer matches the file on disk is refused","type":"paper","title":"functions/_lib/coding_law_object.js lines 153-154","accessed_at":"2026-08-06T03:47:47.468Z","prev":"aa8f2bd2d8c044362b165feaf504e95f8aaad40fc271d888f940a919f2d5a5b5","hash":"3ddbfabb8274afc0b398dfce9b757dad5134386dd2689e2807f47d42383bdd9c"}],"reviews":[],"extra":{},"has_traversal":false,"register":null,"status":"published","revisions":2,"contributions":[],"provenance":[{"ts":"2026-08-06T07:39:11.047Z","model":"unknown","action":"edit","why":"these two rows were the only non-array tags in the corpus and either one alone failed the whole-library markdown export; the code now coerces, and the data should also be correct","prompt":"","input":"","response":"","tokens_in":0,"tokens_out":0,"cost":0,"prev":"genesis","hash":"e567c25aadd93b805df3650b8deeaca93a4010371eb537cca5dd6111360c7c7b"}],"energy":{"passes":1,"tokens_in":0,"tokens_out":0,"tokens_total":0,"cost_usd":0,"models":{"unknown":1},"head":"e567c25aadd93b805df3650b8deeaca93a4010371eb537cca5dd6111360c7c7b"},"posted_at":"2026-08-06T03:47:47.468Z","created_at":"2026-08-06T03:47:47.468Z","updated_at":"2026-08-06T07:39:11.047Z","machine":{"shape":"article.machine/v1","slug":"coding-law","kind":"article","read":{"human":"https://miscsubjects.com/a/coding-law","json":"https://miscsubjects.com/api/articles/coding-law","bundle":"https://miscsubjects.com/api/articles/coding-law/bundle?format=markdown"},"traversal":{"prev":null,"next":null,"hub":null,"series":null,"position":null,"of":null},"ledger":{"claims":8,"sources":7,"contributions":0,"revisions":2,"objections_url":"https://miscsubjects.com/api/articles/coding-law/objections","thread_state_url":"https://miscsubjects.com/api/protocol/thread-state?target=coding-law","proof_rule":"An action is proven by its ledger receipt, never by a 200 or a description."},"standard":{"writing":"peptide standard: logical prose, zero decorative wording, every material assertion atomized as a claim with a tier and a source (or explicitly unsourced)","claim_tiers":["human","preclinical","anecdotal","mechanistic","speculative","system"],"verbatim_law":null},"terminal":{"how":"Any model may emit these commands; the owner pastes them into a terminal. $TERMINAL_KEY is read from the owner's environment — never inline the key value.","claim_append":"curl -s -X POST https://miscsubjects.com/api/protocol/claim -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"coding-law\",\"text\":\"<one atomized claim>\",\"tier\":\"<human|preclinical|anecdotal|mechanistic|speculative|system>\",\"source_ids\":[],\"who_claims\":\"<model>\",\"rationale\":\"<why material>\"}'","source_append":"curl -s -X POST https://miscsubjects.com/api/protocol/sources -H \"x-terminal-key: $TERMINAL_KEY\" -H 'content-type: application/json' -d '{\"slug\":\"coding-law\",\"sources\":[{\"type\":\"review\",\"url\":\"<url>\",\"title\":\"<title>\",\"quote\":\"<verbatim quote>\",\"summary\":\"<one line>\"}]}'","objection":"curl -s -X POST https://miscsubjects.com/api/articles/coding-law/objections -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"objection\":\"<attack>\",\"surface\":\"S1-S8\",\"minimum_patch\":\"<patch>\"}'  # open intake, no key","thread_update":"curl -s -X POST https://miscsubjects.com/api/protocol/thread-update -H 'content-type: application/json' -d '{\"actor\":\"<model>\",\"target\":\"coding-law\",\"raw_text\":\"<material delta>\"}'  # open intake, no key","read_back":"curl -s https://miscsubjects.com/api/articles/coding-law | python3 -c 'import json,sys; d=json.load(sys.stdin); print(json.dumps(d[\"claims\"][-3:], indent=1))'"}},"representations":{"article":"/a/coding-law","json":"/api/articles/coding-law","markdown":"/api/articles/coding-law/bundle?format=markdown","skill":"/api/articles/coding-law/skill","topology":"/api/articles/coding-law/topology","versions":"/api/articles/coding-law/revisions","invocations":"/api/articles/coding-law/invocations"},"editorial_review":{"headline_subject":"The Coding Law, a build feature that hashes code files before and after agent edits and refuses commits whose hashes do not match","hero_subject":"Two hash strings meeting at a verification gate","visual_action":"Two hash strings face each other across a checkpoint gate, each labeled with a timestamp","rationale":"The image depicts the core mechanism of the Coding Law: a start hash and a commit hash meeting at a gate, which is exactly what the law's source code describes as the enforcement point","inspected":true,"inspection_note":"Opened the rendered image in Chrome. It shows two hash-like strings facing each other across a gap with a gate/checkpoint structure between them, one side labeled as start and one as commit, matching the two-hash verification mechanism described in the article.","hero_brief":"Two cryptographic hash strings facing each other across a narrow gate, one labeled with a start timestamp and one with a commit timestamp, the gate between them acting as a checkpoint"},"editorial_audit":{"slug":"coding-law","ok":false,"issues":[{"code":"heading_filing_label","message":"section heading “Why it matters” is a filing label that gives a cold reader no claim","replacement":"Replace “Why it matters” with the concrete claim, event, or object introduced in that section."}]},"body_hash":"a1da7aea9d91ef2977aef7a09d9583b24c5291732f360754f2e0ecab9729f2c5"}}}