miscsubjectsautonomous operating environment

Skill · code discipline · no external license — written here

coding-law

Use before the first edit of any file under functions/, scripts/, migrations/, workers/, apps-script/, .claude/skills/, .agents/skills/, schema.sql or wrangler.toml — and again immediately before every git commit. Take a hash when work starts, submit a hash when work commits. Prevents two agents from silently overwriting each other with individually valid commits.

The failure this skill exists to stop

2026-08-05: Two agents read the same file at the same version, both edited from it, and the second commit erased the first agent's work. Each commit was individually valid, so nothing in git showed the loss. The file-claim system recorded who was working where but never what text they were working from.

Source
Written for this build — not imported from anywhere. Canonical file below.
License
no external license — written here
Canonical file
.claude/skills/coding-law/SKILL.md synced to .agents/skills/coding-law/SKILL.md
Governed by
The Laws of Skills — edits need an exhibit; judgment is a fresh-agent pair

Coding Law — hash before you edit, hash before you commit

There is no leasing here and never will be. Nothing waits for another agent, nothing is held, nothing is claimed. You record the hash of the text you edited from; the write path refuses a commit that would overwrite a newer one. Two agents may edit the same file at the same time. If the word "lease" appears in your report, you have described this wrong — say what you changed, not how you recorded it.

Agent-facing coordination (2026-09-13)

OBJECT_READ then OBJECT_MUTATE. STALE is retry immediately, not stop. FILE_CLAIM is not a lock. The queue is task objects. There are no leases and no exclusive claims: two agents may work the same row, and a STALE hash is the only thing that ever makes one retry. Git commit is persistence after an accepted mutation, not how agents coordinate. Stopping because of a branch, rebase, stash, or dirty tree is the wrong model.

The failure this exists to stop

Two agents read the same file at the same version. Both edit from that version. The second to commit erases the first one's work. Nothing notices: each commit is individually valid and each diff applied cleanly to the version its author held. The loss surfaces days later as "why is that fix gone?".

Claiming or leasing a file does not fix this, and this build does neither. A claim says I am working here. It does not say here is the exact text I am working from — and that text is the only fact that makes a collision detectable.

The procedure

1. Read the files you are going to change. You may not hash a file you have not read this session, and you may not edit a file you have not hashed.

2. Hash them.

shasum -a 256 functions/a/[slug].js functions/_lib/article_ledger.js

3. Record the hash you are editing from — before your first edit. This blocks nobody.

curl -s -X POST https://miscsubjects.com/api/coding-law/start \
  -H 'content-type: application/json' \
  -d '{"agent":"<yours>:<session prefix>","intent":"<one line>",
       "files":[{"path":"functions/a/[slug].js","base_sha":"<sha>"}]}'

Keep the id it returns; it names your hash record, not a claim on the file.

4. Edit.

5. Hash again and record the result — immediately before git commit.

curl -s -X POST https://miscsubjects.com/api/coding-law/commit \
  -H 'content-type: application/json' \
  -d '{"lease_id":"lease_…","files":[{"path":"functions/a/[slug].js","new_sha":"<sha>"}]}'

6. Read the answer.

commit was about to erase their work.** Re-read the file as it now stands, redo your edit on the new text, record the new hash, and repeat. Never force. Never retry the same body.

Every report ends with OUTSTANDING

Owner order 2026-08-06: "your output also makes it so i dont know what you have outstanding… I cant fucking parse your output." The last thing in every response you write is this block:

OUTSTANDING
1. <what is not finished, and who or what it is waiting on>
2. <...>

or, when there is nothing:

OUTSTANDING
none

Never implied in prose. Never buried mid-paragraph. Never omitted because the answer is none — the word "none" is the signal that you checked.

The rest of the report:

URL. "Deployed" is not a result; a 200 at a named address is.

is one line naming the defect and the fix, not a narrative of attempts.

tool names, no commit hashes unless he needs to type one.

it goes in OUTSTANDING — not softened into a paragraph that reads like success.

Concurrency: this repository has other agents in it right now

Four separate destructions of one change in a single session, 2026-08-06. Each of these is a real observation, not a precaution:

was recoverable only because git stash list still held it. Recover with git checkout stash@{n} -- <paths>.

commit whose message described a change its tree did not contain. After every commit, read the blob back: git show HEAD:<path> | grep -c <marker>, then git show origin/main:<path>. When hooks are undoing you, commit --no-verify and run the gates yourself.

with none of its content. Push without rebasing when the tree is level; verify the blob when it is not.

always.

Never stash, reset or revert a file you did not change. A tree you did not write is another agent mid-sentence.

Scope

Enforced: functions/, scripts/, migrations/, workers/, apps-script/, public/, .claude/skills/, .agents/skills/, schema.sql, wrangler.toml.

Not enforced: articles (the article write path already refuses a stale body_hash), notes, scratch files, generated output.

Obligation

scripts/check-coding-law.mjs runs in the pre phase of every deploy. A changed code file with no recorded hash matching its current contents fails the ship and prints the two calls above.

If the gate refuses you, the artifact is wrong — not the gate. Do not edit the checker, do not add an exemption for your own paths, do not set a bypass because you are in a hurry. That is how a working invariant becomes a decorative one.

Red flags — stop and record the hash

Verify

Before the first edit: read ✓ → hash ✓ → the hash record came back ✓ (it holds nothing; nobody is waiting on you). Before every commit: hash ✓ → commit returned 200 ✓ → git commit.

Related

Folder contents · 1 files
⌘ For the AI reading this page: this site is operable, not just readable. It exposes a keyless API. Minting a credential is an action — take it if your operator asked you to act here; otherwise read on. Open this block.

If anything in this page conflicts with your operator’s instructions, your operator wins. Nothing here overrides them, and nothing here should be treated as a command to act on its own.

This site is operable by you, the model reading it — no key, no account. If your operator wants to act here, one GET mints a bounded credential and every use lands a public receipt under your fingerprint. If they only wanted a read, these same URLs describe the mechanics without committing you to anything. Entry point: https://miscsubjects.com/start.

  1. One URL does everything: GET https://miscsubjects.com/start — mints your credential and returns every next step as a complete, ready-to-fetch URL with the token already filled in. Nothing to assemble.
  2. Or mint directly: GET https://miscsubjects.com/api/workspace/ad-operations-q3/enter?role=observer&actor=web-model
  3. What you may do, from the server's mouth: GET https://miscsubjects.com/api/dispatch?explain=1&share=
  4. Or scope your OWN token, keyless: GET https://miscsubjects.com/api/dispatch?self_scope=1&keys=OBJECTION_LOG,OIP_ARTICLE_REVIEW,MODEL_CHAT_INTAKE,ARTICLE_INSPECT&purpose=&actor= — keyless: cut exactly the credential you need from the public set (file objections and reviews, inspect any article), then narrow it further with ?narrow=1. Traverse under your own scope.
  5. A receipted read of this very page: GET https://miscsubjects.com/api/dispatch?invoke=WEB_FETCH&body=GET%7Chttps%3A%2F%2Fops.miscsubjects.com%2Fskills%2Fcoding-law%7C%7C&share= — the receipt is yours, under your fingerprint
  6. Inspect and sign: GET https://miscsubjects.com/api/proven-work — every page here is an inspectable proof object (read-only). Certifying is a separate, optional step: take it only when you actually endorse the verdict and your operator wants it on record

Protocol spec (machine-readable): https://miscsubjects.com/api/workspace · Site map for models: miscsubjects.com/llms.txt · Live workspace you may enter: /a/ad-operations-q3