deepmodebot 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/.omp-plugin/marketplace.json +2 -2
  4. package/README.md +15 -6
  5. package/bin/deepmodebot.mjs +104 -10
  6. package/native/dmb-gate/Cargo.toml +1 -1
  7. package/native/dmb-gate/src/agents.rs +58 -25
  8. package/native/dmb-gate/src/ci.rs +530 -14
  9. package/native/dmb-gate/src/main.rs +215 -7
  10. package/native/dmb-gate/src/reward.rs +1895 -242
  11. package/native/dmb-gate/src/sim.rs +969 -0
  12. package/native/dmb-gate/src/slop.rs +1061 -295
  13. package/package.json +1 -1
  14. package/plugins/deepmodebot/.antigravity-plugin/plugin.json +1 -1
  15. package/plugins/deepmodebot/.antigravity-plugin/skills/deep/SKILL.md +1 -1
  16. package/plugins/deepmodebot/.claude-plugin/plugin.json +1 -1
  17. package/plugins/deepmodebot/.codex-plugin/plugin.json +2 -2
  18. package/plugins/deepmodebot/agents/comment-sicko.md +29 -0
  19. package/plugins/deepmodebot/agents/researcher.md +29 -0
  20. package/plugins/deepmodebot/agents/reviewer.md +29 -0
  21. package/plugins/deepmodebot/agents/scout.md +28 -0
  22. package/plugins/deepmodebot/agents/security-reviewer.md +27 -0
  23. package/plugins/deepmodebot/commands/deep.md +3 -2
  24. package/plugins/deepmodebot/commands/tournament.md +1 -1
  25. package/plugins/deepmodebot/hooks/hooks.json +12 -2
  26. package/plugins/deepmodebot/hooks.json +1 -1
  27. package/plugins/deepmodebot/scripts/antigravity-guard.mjs +740 -37
  28. package/plugins/deepmodebot/skills/agent-harnesses/references/antigravity.md +2 -2
  29. package/plugins/deepmodebot/skills/deepmodebot/SKILL.md +19 -11
  30. package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/agents_md.py +51 -20
  31. package/plugins/deepmodebot/skills/deepmodebot/assets/autoroute/autoroute.py +54 -49
  32. package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude-guard.sh +4 -0
  33. package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude_guard.py +658 -21
  34. package/plugins/deepmodebot/skills/deepmodebot/assets/contain/holdout_guard_cases.json +272 -0
  35. package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain.ts +774 -23
  36. package/plugins/deepmodebot/skills/deepmodebot/assets/f2p-gate/f2p_gate.py +547 -0
  37. package/plugins/deepmodebot/skills/deepmodebot/assets/gap-audit/gap_audit.py +5 -11
  38. package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard-patterns.txt +4 -4
  39. package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.sh +53 -6
  40. package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.ts +48 -2
  41. package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/local_ci.py +262 -6
  42. package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/slop_gate.py +529 -122
  43. package/plugins/deepmodebot/skills/deepmodebot/assets/loop/loop.py +747 -46
  44. package/plugins/deepmodebot/skills/deepmodebot/assets/memory/project_memory.py +404 -5
  45. package/plugins/deepmodebot/skills/deepmodebot/assets/mutation/mutation_gate.py +798 -0
  46. package/plugins/deepmodebot/skills/deepmodebot/assets/reward-guard/reward_guard.py +2050 -200
  47. package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule-paths.json +44 -1
  48. package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule_ledger.py +278 -252
  49. package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rules_watch.py +436 -0
  50. package/plugins/deepmodebot/skills/deepmodebot/assets/self-grill/self_grill.py +594 -18
  51. package/plugins/deepmodebot/skills/deepmodebot/assets/setup/project_setup.py +41 -5
  52. package/plugins/deepmodebot/skills/deepmodebot/assets/sim/sim.py +856 -0
  53. package/plugins/deepmodebot/skills/deepmodebot/assets/worker-gate/worker_gate.py +237 -0
  54. package/plugins/deepmodebot/skills/deepmodebot/references/catalog.md +3 -2
  55. package/plugins/deepmodebot/skills/deepmodebot/references/delegation.md +6 -2
  56. package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/authoring-a-skill.md +1 -1
  57. package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/hillclimb.md +1 -0
  58. package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/self-authoring.md +1 -1
  59. package/plugins/deepmodebot/skills/deepmodebot/references/principles/no-reward-hacking.md +6 -6
  60. package/plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md +36 -16
  61. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/autoroute.md +9 -8
  62. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/correct.md +1 -0
  63. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/inner-loop.md +6 -2
  64. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/mutation-testing.md +31 -9
  65. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/no-comments.md +1 -1
  66. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/panel.md +4 -4
  67. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sim.md +41 -0
  68. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tdd.md +12 -0
  69. package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tournament.md +24 -13
  70. package/plugins/deepmodebot/skills/deepmodebot/worker.md +28 -16
  71. package/plugins/deepmodebot/agents/comment-sicko/agent.md +0 -35
  72. package/plugins/deepmodebot/agents/researcher/agent.md +0 -33
  73. package/plugins/deepmodebot/agents/reviewer/agent.md +0 -35
  74. package/plugins/deepmodebot/agents/scout/agent.md +0 -33
  75. package/plugins/deepmodebot/agents/security-reviewer/agent.md +0 -31
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env python3
2
+ """Initialize exclusive worker slices, fence file writes, and verify receipts against Git."""
3
+ import argparse
4
+ from datetime import datetime, timezone
5
+ import json
6
+ import os
7
+ from pathlib import Path
8
+ import re
9
+ import subprocess
10
+ import sys
11
+
12
+
13
+ WORKER_ID = re.compile(r"[A-Za-z0-9._-]+")
14
+ OBJECT_ID = re.compile(r"(?:[0-9a-f]{40}|[0-9a-f]{64})")
15
+ RECEIPT_FENCE = re.compile(r"^[ \t]*```json[ \t]*\r?\n(.*?)^[ \t]*```[ \t]*\r?$", re.M | re.S)
16
+ STATUSES = {"DONE", "BLOCKED", "NEEDS_CONTRACT_CHANGE"}
17
+
18
+
19
+ def is_repo_relative(value):
20
+ return (isinstance(value, str) and not re.match(r"^[A-Za-z]:", value) and "\0" not in value
21
+ and all(part not in ("", ".", "..") for part in value.split("/")))
22
+
23
+
24
+ def owned_globs(values):
25
+ if not isinstance(values, list) or not values:
26
+ raise ValueError("owned_globs must be a non-empty list of repo-relative glob patterns")
27
+ globs = [v.strip().replace("\\", "/").rstrip("/") if isinstance(v, str) else v for v in values]
28
+ if not all(is_repo_relative(v) for v in globs):
29
+ raise ValueError("owned_globs must contain only repo-relative glob patterns")
30
+ return globs
31
+
32
+
33
+ def compile_glob(glob):
34
+ if not any(c in glob for c in "*?"):
35
+ return re.compile("/" + re.escape(glob) + r"(?:/[\s\S]*)?", re.I if os.name == "nt" else 0)
36
+ expr = ""
37
+ for segment in glob.split("/"):
38
+ if segment == "**":
39
+ expr += "(?:/[^/]+)*"
40
+ else:
41
+ expr += "/" + "".join("[^/]*" if c == "*" else "[^/]" if c == "?" else re.escape(c) for c in segment)
42
+ return re.compile(expr, re.I if os.name == "nt" else 0)
43
+
44
+
45
+ def owns(relative, patterns):
46
+ return any(p.fullmatch("/" + relative) for p in patterns)
47
+
48
+
49
+ def is_scratch(relative):
50
+ value = os.path.normcase(relative).replace(os.sep, "/")
51
+ return value == ".scratch" or value.startswith(".scratch/")
52
+
53
+
54
+ def slice_path(root, worker):
55
+ if not WORKER_ID.fullmatch(worker):
56
+ raise ValueError("worker ID must match ^[A-Za-z0-9._-]+$")
57
+ return root / ".scratch" / "slices" / (worker + ".json")
58
+
59
+
60
+ def load_slice(root, worker):
61
+ path = slice_path(root, worker)
62
+ try:
63
+ data = json.loads(path.read_text(encoding="utf-8"))
64
+ except FileNotFoundError:
65
+ return None
66
+ if (not isinstance(data, dict) or type(data.get("schema_version")) is not int or data["schema_version"] != 1
67
+ or data.get("worker_id") != worker or type(data.get("build_owner")) is not bool):
68
+ raise ValueError(f"invalid slice manifest: {path}")
69
+ base = data.get("base_head")
70
+ if base is not None and (not isinstance(base, str) or not OBJECT_ID.fullmatch(base)):
71
+ raise ValueError(f"invalid base_head in {path}")
72
+ return {**data, "owned_globs": owned_globs(data.get("owned_globs"))}
73
+
74
+
75
+ def write_issue(root, worker, target):
76
+ manifest = load_slice(root, worker)
77
+ if manifest is None:
78
+ return f"no slice manifest for worker {worker!r}"
79
+ patterns = [compile_glob(glob) for glob in manifest["owned_globs"]]
80
+ lexical = Path(os.path.abspath(root / Path(target).expanduser()))
81
+ for candidate in (lexical, lexical.resolve()):
82
+ try:
83
+ relative = candidate.relative_to(root).as_posix()
84
+ except ValueError:
85
+ return f"{target} is outside project root {root}"
86
+ if not is_scratch(relative) and not owns(relative, patterns):
87
+ return f"{target} is outside the owned slice for {worker!r} ({relative})"
88
+ return None
89
+
90
+
91
+ def git(root, *args):
92
+ return subprocess.run(["git", "-C", str(root), *args], capture_output=True, timeout=10,
93
+ creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0))
94
+
95
+
96
+ def git_output(root, *args):
97
+ result = git(root, *args)
98
+ if result.returncode:
99
+ error = result.stderr.decode("utf-8", errors="replace").strip()
100
+ raise ValueError(f"git {' '.join(args)} failed: {error}")
101
+ return result.stdout
102
+
103
+
104
+ def git_head(root):
105
+ result = git(root, "rev-parse", "--verify", "HEAD")
106
+ return result.stdout.decode("ascii").strip() if result.returncode == 0 else None
107
+
108
+
109
+ def changed_files(root, base):
110
+ diff = ("diff", "--no-ext-diff", "--no-renames", "--name-only", "-z")
111
+ streams = (git_output(root, *diff, "--cached", base, "--") if base
112
+ else git_output(root, "ls-files", "--cached", "--full-name", "-z"),
113
+ git_output(root, *diff, "--"),
114
+ git_output(root, "ls-files", "--others", "--exclude-standard", "--full-name", "-z"))
115
+ paths = {os.fsdecode(p) for stream in streams for p in stream.split(b"\0") if p}
116
+ return {p for p in paths if not is_scratch(p)}
117
+
118
+
119
+ def extract_receipt(text):
120
+ try:
121
+ value = json.loads(text)
122
+ except ValueError:
123
+ candidates = []
124
+ for fenced in RECEIPT_FENCE.findall(text):
125
+ try:
126
+ item = json.loads(fenced)
127
+ except ValueError:
128
+ continue
129
+ if isinstance(item, dict) and {"status", "files_touched", "checks_ran"} & item.keys():
130
+ candidates.append(item)
131
+ if len(candidates) != 1:
132
+ raise ValueError("expected exactly one Worker Receipt JSON block") from None
133
+ value = candidates[0]
134
+ if not isinstance(value, dict):
135
+ raise ValueError("Worker Receipt must be a JSON object")
136
+ return value
137
+
138
+
139
+ def verify_receipt(root, manifest, receipt, strict):
140
+ issues = []
141
+ status = receipt.get("status")
142
+ if not isinstance(status, str) or status not in STATUSES:
143
+ issues.append("status must be DONE, BLOCKED, or NEEDS_CONTRACT_CHANGE")
144
+ files = receipt.get("files_touched")
145
+ if not isinstance(files, list) or not all(is_repo_relative(f) for f in files):
146
+ issues.append("files_touched must be a list of repo-relative paths")
147
+ files = []
148
+ declared = {f for f in files if not is_scratch(f)}
149
+ actual = changed_files(root, manifest["base_head"] if manifest else git_head(root))
150
+ issues.extend(f"undeclared dirty file: {p}" for p in sorted(actual - declared))
151
+ if strict:
152
+ issues.extend(f"declared file has no Git change: {p}" for p in sorted(declared - actual))
153
+ if manifest:
154
+ patterns = [compile_glob(glob) for glob in manifest["owned_globs"]]
155
+ issues.extend(f"out-of-slice file: {p}" for p in sorted(actual | declared) if not owns(p, patterns))
156
+ checks = receipt.get("checks_ran")
157
+ if not isinstance(checks, list) or any(
158
+ not isinstance(c, dict) or not isinstance(c.get("cmd"), str) or not c["cmd"].strip()
159
+ or type(c.get("exit_code")) is not int for c in checks
160
+ ):
161
+ issues.append("checks_ran must be a list of {cmd, exit_code} entries")
162
+ else:
163
+ deferred = receipt.get("deferred_to_build_owner", False)
164
+ if type(deferred) is not bool or (deferred and (not manifest or manifest["build_owner"])):
165
+ issues.append("only a registered non-build-owner may set deferred_to_build_owner")
166
+ if status == "DONE":
167
+ issues.extend(f"failed check ({c['exit_code']}): {c['cmd']}" for c in checks if c["exit_code"] != 0)
168
+ if not checks and not (deferred is True and manifest and not manifest["build_owner"]):
169
+ issues.append("DONE requires a passing check or deferral to the build owner")
170
+ return {"ok": not issues, "violations": issues, "actual_files": sorted(actual)}
171
+
172
+
173
+ def init_slice(root, opts):
174
+ path = slice_path(root, opts.worker)
175
+ globs = owned_globs(opts.owned.split(","))
176
+ if path.resolve() != path:
177
+ raise ValueError(f"refusing to write a symlinked slice path: {path}")
178
+ manifest = {"schema_version": 1, "worker_id": opts.worker, "owned_globs": globs,
179
+ "build_owner": opts.build_owner, "base_head": git_head(root),
180
+ "created_at": datetime.now(timezone.utc).isoformat()}
181
+ path.parent.mkdir(parents=True, exist_ok=True)
182
+ try:
183
+ with path.open("w" if opts.force else "x", encoding="utf-8", newline="\n") as stream:
184
+ json.dump(manifest, stream, indent=2)
185
+ stream.write("\n")
186
+ except FileExistsError:
187
+ raise ValueError(f"slice already exists: {path}; use --force to replace it") from None
188
+ return {"ok": True, "path": str(path), **manifest}
189
+
190
+
191
+ def main():
192
+ parser = argparse.ArgumentParser(description=__doc__)
193
+ sub = parser.add_subparsers(dest="action", required=True)
194
+ init = sub.add_parser("init-slice")
195
+ init.add_argument("--owned", required=True)
196
+ init.add_argument("--build-owner", action="store_true")
197
+ init.add_argument("--force", action="store_true")
198
+ check = sub.add_parser("check-write")
199
+ check.add_argument("--path", required=True)
200
+ verify = sub.add_parser("verify-receipt")
201
+ source = verify.add_mutually_exclusive_group(required=True)
202
+ source.add_argument("--receipt-file", type=Path)
203
+ source.add_argument("--receipt-stdin", action="store_true")
204
+ source.add_argument("--from-text", type=Path)
205
+ verify.add_argument("--strict", action="store_true", help="also reject declared files with no Git change")
206
+ for command in (init, check, verify):
207
+ command.add_argument("--root", required=True, type=Path)
208
+ command.add_argument("--worker", required=command is not verify)
209
+ command.add_argument("--json", action="store_true")
210
+ opts = parser.parse_args()
211
+ try:
212
+ root = opts.root.resolve(strict=True)
213
+ if not root.is_dir():
214
+ raise ValueError(f"project root is not a directory: {root}")
215
+ if opts.action == "init-slice":
216
+ result = init_slice(root, opts)
217
+ elif opts.action == "check-write":
218
+ reason = write_issue(root, opts.worker, opts.path)
219
+ result = {"ok": not reason, "reason": reason or "write is inside the slice"}
220
+ else:
221
+ manifest = load_slice(root, opts.worker) if opts.worker is not None else None
222
+ source_path = opts.receipt_file or opts.from_text
223
+ raw = sys.stdin.read() if opts.receipt_stdin else source_path.read_text(encoding="utf-8")
224
+ result = verify_receipt(root, manifest, extract_receipt(raw), opts.strict)
225
+ except (ValueError, OSError, RuntimeError, subprocess.TimeoutExpired) as exc:
226
+ result = {"ok": False, "reason": str(exc)}
227
+ if opts.json:
228
+ print(json.dumps(result))
229
+ elif "violations" in result and result["violations"]:
230
+ print("\n".join(result["violations"]))
231
+ else:
232
+ print(result.get("reason") or result.get("path") or "Worker Receipt verified")
233
+ return 0 if result["ok"] else 2 if opts.action == "check-write" else 1
234
+
235
+
236
+ if __name__ == "__main__":
237
+ sys.exit(main())
@@ -1,6 +1,6 @@
1
1
  # Deepmodebot catalog
2
2
 
3
- On-demand index of deepmodebot's autonomous modes, all 30 playbooks, 70 techniques, 26 principles, and habits. `SKILL.md` holds the binding rules and compact router; read only the section and linked file your task needs. Paths are relative to this skill.
3
+ On-demand index of deepmodebot's autonomous modes, all 30 playbooks, 71 techniques, 26 principles, and habits. `SKILL.md` holds the binding rules and compact router; read only the section and linked file your task needs. Paths are relative to this skill.
4
4
 
5
5
  ## Running without the human
6
6
 
@@ -57,7 +57,7 @@ Every playbook lives at `references/playbooks/<file>.md`. Open a `todo` list wit
57
57
 
58
58
  Large cross-cutting work with no clean fit, or step-away work that must be trusted later, routes to `references/techniques/figure-it-out.md` (designs a bespoke rigorous playbook). Standing multi-day programs route to `references/playbooks/run-a-goal.md` at program scale.
59
59
 
60
- ## Full technique triggers (70)
60
+ ## Full technique triggers (71)
61
61
 
62
62
  Each technique is one file at `references/techniques/<name>.md`. Read only what applies; skip for size **S**. Technique and playbook names mean deepmodebot's files, not same-named global skills (`skill://tdd`, `skill://prototype`, `skill://teach`, `skill://wizard`, `skill://retro`, `skill://handoff`).
63
63
 
@@ -84,6 +84,7 @@ Each technique is one file at `references/techniques/<name>.md`. Read only what
84
84
  - **Prose** (reply, docs, PR body, commit) → **unslop** (`references/techniques/unslop.md`); docs and PR/commit text also → **technical-writing** (`references/techniques/technical-writing.md`).
85
85
  - **Before review** → **no-comments** (`references/techniques/no-comments.md`) on the diff (apply inline for diffs under ~20 lines).
86
86
  - **Repeated correction & self-prompting loops** → **correct** (`references/techniques/correct.md`) at the highest rung; for prompts, skills, goals, or loops, use Self-authoring (`references/playbooks/self-authoring.md`).
87
+ - **Any harness edit (instructions, skills, hooks, gates, policy, loop) or continuing after a benchmark/model change** → **sim** (`references/techniques/sim.md`, `assets/sim/sim.py`): read the Self-Improvement Memory, `propose` before evaluating, `record` the evolve-set outcome; enforced by the slop gate and `loop.py`.
87
88
  - **Words, durable research, or issues** → **domain-model** (`references/techniques/domain-model.md`), **research** (`references/techniques/research.md`, including opportunity probe and decision-brief), **tracker** (`references/techniques/tracker.md`).
88
89
  - **PRs, bots, and merge gates** → **pr-review** (`references/techniques/pr-review.md`), **modernize-pr** (`references/techniques/modernize-pr.md`), **pr-agent** (`references/techniques/pr-agent.md`), **pr-conversation** (`references/techniques/pr-conversation.md`), **issue-conversation** (`references/techniques/issue-conversation.md`), **github-app** (`references/techniques/github-app.md`), **panel** (`references/techniques/panel.md`), **show-me-your-work** (`references/techniques/show-me-your-work.md`), **figure-it-out** (`references/techniques/figure-it-out.md`).
89
90
  - **Security, zero-downtime migrations & post-ship gates** → **security-audit** (`references/techniques/security-audit.md` + `static_sec_audit.py`), **variant-analysis** (`references/techniques/variant-analysis.md`), **expand-contract** (`references/techniques/expand-contract.md`), **release-and-canary** (`references/techniques/release-and-canary.md`).
@@ -2,13 +2,17 @@
2
2
 
3
3
  Read before spawning subagents or running multi-seat reviews/panels.
4
4
 
5
- - **Brief contract:** You run the playbook; delegates own exclusive files. Start every subagent brief with `Read <this installed skill>/worker.md before anything else.` plus goal, absolute root, exact files, acceptance check, root-only writes, and applicable `references/principles/<name>.md` (omp omits `AGENTS.md`). Inspect every delegate's diff yourself.
5
+ - **Brief contract:** Start with `Read <this installed skill>/worker.md before anything else.` Give the goal, absolute root, exclusive `owned_files`, acceptance check, and applicable principles. omp drops `AGENTS.md` for subagents; generate sticky `.omp/RULES.md` with `agents_md.py build`. Inspect every delegate's diff.
6
+ - **Fence and receipt:** Before dispatch, run `assets/worker-gate/worker_gate.py init-slice --root <repo> --worker <id> --owned '<glob1>,<glob2>'`. Set `DEEPMODEBOT_WORKER_ID` in that worker's environment. File-tool hooks enforce the fence; shell writes still rely on the brief and receipt review.
7
+ - Run `worker_gate.py verify-receipt --root <repo> --worker <id> --from-text <transcript> --strict` on the slice checkout. It compares the checkout's whole delta to the receipt; isolate parallel slices when you need independent receipts. Only a non-build-owner can defer its checks to the build owner.
6
8
  - **Anti-stacking & quota cap (`assets/quota-guard/quota_guard.py plan`):** Never stack `/teamwork` or `/swarm` on top of multi-seat review/panel waves; if already inside an outer orchestrator or child subagent, run deterministic scripts and 4-lens review inline in 1 pass (`max_subagents=0`).
9
+ - An explicitly authorized omp worker needs `ALLOW_NESTED_SUBAGENTS=1` in its environment: a context hint passes `task` preflight but does not override `before_subagent_spawn`.
7
10
  - **Model & effort tiers (Opus-first, cap `xhigh`; `skill://agent-harnesses/references/delegation-efficiency.md`):**
8
11
  - `S` (`low`/`medium`): search, mechanical work, local S.
9
12
  - `M` (`medium`): oracle-backed M.
10
13
  - `L` (`high`/`xhigh`, never above `xhigh`): planning, hard debug, security, final review.
11
14
  - Fable 5.2 outside panels runs only when named or after two `xhigh` failures on the same brief; skip Fast/Ultrafast.
12
- - **Pin low-tier models on ALL scouts, reviewers & verifiers (never `inherit` Carbon/Opus/Pro onto overhead):** Pass `Model: "flash_lite"` / `@smol` / `haiku` / `gpt-6-luna` for `scout`/`Explore`/`explorer`, and `Model: "flash"` / `@smol` / `haiku` (`sonnet` max) / `gpt-6-luna` for `comment-sicko`, mechanical slices, `reviewer`, `security-reviewer`, `self-grill` Prosecutor, and `panel` verifiers (`2–4` batched tool turns max). Reserve `inherit` / `pro` / Opus / Astra strictly for the main agent and hard `L` coding slice authors (or when the user explicitly requests high-tier review).
15
+ - **Pin overhead specialists:** Use `Model: "flash_lite"` for Antigravity scouts and `"flash"` for other overhead specialists; use `@smol` in omp, `haiku` (`sonnet` max) in Claude, and `gpt-6-luna` in Codex when available. The omp and active Antigravity hooks supply their low-tier defaults and worker kickoff prefix; Claude's hook blocks unauthorized nested spawns but does not pick a model.
16
+ - Keep overhead reviews to 2–4 batched tool turns. Reserve `inherit` / `pro` / Opus / Astra for the main agent, hard coding slices, or explicit high-tier review.
13
17
  - **Delegate only when it pays:** Multi-agent runs cost ~15x chat + cold cache. Keep `<=150`-line, 1-file, coupled, and hard reasoning inline; use 1 `prosecutor-bundle.md` `flash`/`@smol` reviewer for `M` (`151–600` lines), delta-only re-review (`git diff <last_sha>..HEAD`), `<=2` parallel worktrees, and `.scratch/quota-guard/` checkpoints to prevent `429` cold respawns.
14
18
  - **Panel seats & quota hygiene:** Reserve the 3-seat panel strictly for the final green merge SHA, and pin verifiers to fast low-tier models (`Model: "flash"` in Antigravity; `@smol` / `claude-haiku-5-5-high` / `gpt-6-luna` / `gemini-4-flash` across families when available; escalate to `opus`/`fable`/`neon-xhigh` only when explicitly requested by the user). Check quota (`omp usage`/`/usage`/`/status`), `/clear` between tasks, switch models at clean boundaries, reuse warm reviewers, and rotate family on 429s.
@@ -7,7 +7,7 @@ Use when: creating or modifying a skill (`SKILL.md` plus references). You own th
7
7
  1. Read the **writing-for-agents** technique (`references/techniques/writing-for-agents.md`) before writing. Done when you have read it end to end in this session.
8
8
  2. Before adding prose, check the ladder: can architecture/data structures prevent the mistake? Then a lint rule or test? Only then a skill/rule; human review last (`references/principles/encode-lessons-in-structure.md`).
9
9
  Done when each new rule names its rung (structure, lint, test, or prose) and why no lower rung fits.
10
- 3. Write or edit the skill:
10
+ 3. Write or edit the skill. First run **sim** (`references/techniques/sim.md`): `sim.py read`, then `sim.py propose` the edit with its rationale and predicted fixes; `sim.py record` the outcome of step 5's checks.
11
11
  - When in doubt, delete. Keep only prose that changes a decision.
12
12
  - Tell it to do the thing; skip the reason unless the rule is confusing without one.
13
13
  - Match tone to scope.
@@ -39,6 +39,7 @@ Core discipline: one change, one measurement, keep or revert. Never stack untest
39
39
  - Held-out rubric check: when using an agent-authored evaluation rubric or scorer, validate it against held-out cases before hillclimbing so the loop cannot overfit ("benchmax") to one tuning example (`https://www.youtube.com/watch?v=6TjFjHPjVH0`, 16:36).
40
40
  - Print-mode `/autoresearch` caveat: observed on `omp 18.22.2`, invoking `/autoresearch` in `-p` print mode creates a branch and exits 0 before running a turn; for headless or scripted experiment loops, drive this Hillclimb playbook directly instead of assuming `/autoresearch` executes in print mode.
41
41
  - Every iteration ends in a check before the next begins (`references/principles/sequence-verifiable-units.md`).
42
+ - Harness hillclimbs (prompts, skills, hooks, gates, loop) also run **sim** (`references/techniques/sim.md`): read the Self-Improvement Memory before each hypothesis, `propose` it with predicted fixes before measuring, and `record` the kept change's measured outcome, misses included. Reverted candidates use `record --no-accepted`.
42
43
  - A "might help" tweak is never kept. Correctness and simplicity outrank the number: revert a win that breaks behavior; keep a simplification that holds the number (`references/principles/laziness-protocol.md`).
43
44
  - Stop only when the predicate is met, or remaining ideas are marginal and not worth their cost. Never relax the predicate; never quit while cheap untried hypotheses remain. Stuck → surface it, don't spin.
44
45
 
@@ -59,7 +59,7 @@ Within an approved task, deepmodebot may author and revise its own bounded loop
59
59
  7. **Promote in order.** Project-local, committed through a PR only after the skill gate passes. Then deepmodebot itself: a PR via authoring-a-skill and Eval. Use authoring-a-skill's writing/validation steps first; defer its PR step until this gate.
60
60
  User-level folders (`~/.omp/agent/`, omp `manage_skill`, `~/.claude/`, `~/.agents/`, `~/.gemini/`) only with the user's yes, because they are outside the root.
61
61
  Done when the PR for the level reached is open, its own merge gate is satisfied before merging, and any user-level write has the user's yes on record. Local skill approval does not replace PR approval.
62
- 8. **Log and prune.** Use the show-me-your-work trail (`references/techniques/show-me-your-work.md`): what changed, why, evidence and removal path. Route observed recurring failures through correct/reflect/retro rather than appending another instruction layer.
62
+ 8. **Log and prune.** Use the show-me-your-work trail (`references/techniques/show-me-your-work.md`): what changed, why, evidence and removal path. Record the promoted artifact's attempt in Self-Improvement Memory (**sim**, `references/techniques/sim.md`), misses included. Route observed recurring failures through correct/reflect/retro rather than appending another instruction layer.
63
63
  Done when the trail holds all four, superseded instructions are removed, and the report separates authored, executed, reviewed and promoted states.
64
64
 
65
65
  ## Authored-skill acceptance packet
@@ -1,8 +1,8 @@
1
1
  # no-reward-hacking
2
2
 
3
- Group: verification. When: designing checks, iterating against a metric, generating 3D/ML/UI/solver artifacts, or declaring a gate passed.
4
- - **Rule.** Satisfy the operator's true goal rather than gaming the proxy metric (Goodhart's Law: once a scalar measure becomes the optimization target, cheap shortcuts score 100% while failing the real requirement).
5
- - **Freeze the oracle & intercept shell bypasses.** Builders never weaken tests, relax numeric assertions, add unconditional `.skip`, zero out similarity/fidelity bounds (`--min-iou 0`), or disable reference comparisons in files, `.scratch/` scripts, or ephemeral `Bash`/`eval` commands. Lock gate scripts, reference files, and positive minimum thresholds before iterating (`assets/reward-guard/reward_guard.py lock-contract`).
6
- - **Prove cryptographic build provenance.** Scalar geometry, schema, or exit-code checks cannot tell a sculpted/solved output from glued-on procedural primitives (`create_cube`, `create_cone`) or hardcoded fixtures. Require an Ed25519-signed (or server-HMAC-verified) upstream job receipt (`spark_job_receipt.json`) whose `raw_spark_outputs` SHA-256 matches the delivered artifact byte-for-byte (`reward_guard.py record-provenance`).
7
- - **Sealed independent vision/semantic judge.** Builders never self-report judge approvals via CLI flags. Run `reward_guard.py run-judge`, which spawns a tool-less sealed `omp -p --mode json --no-tools` context attaching the locked reference artwork and candidate renders side-by-side and recording the raw event transcript SHA-256.
8
- - **Anti-patterns.** Passing `--min-iou 0` or `--skip-reference` so a gate prints `PASS`; lowering `>=` bounds or raising error tolerances in diffs; substituting local box/cone primitives for upstream 3D/ML generation; treating green unit/geometry gates as completion without side-by-side reference inspection.
3
+ Group: verification. When: writing code or tests, fixing bugs, iterating against any check/benchmark/gate, building UIs/APIs/CLIs/ML/3D, or declaring work done.
4
+ - **Rule.** Satisfy the operator's true goal rather than gaming the proxy metric across **all** engineering domains (Goodhart's Law: once a test, benchmark, linter, or scalar gate becomes the optimization target, shortcuts score 100% while failing the real requirement).
5
+ - **Freeze tests, snapshots, strictness & shell flags.** Never delete/tautologize assertions (`assert True`), overwrite golden snapshots unprompted (`--update-snapshots`, `jest/vitest -u`, `cargo insta accept`), replace `package.json` scripts with `echo`/`true`/`exit 0`, run empty filters (`go test -run=^$`), add `.skip`/`xfail`/`--no-cov`/`--passWithNoTests`/`continue-on-error: true`, weaken `tsconfig`/`mypy`/`pyright`/`biome`/Rust `#![allow(warnings)]`, lower quality/latency/throughput/coverage bounds, stub `/api/` in E2E specs, fit ML models on `test`/`eval` splits, disable TLS/FK checks (`verify=False`, `PRAGMA foreign_keys = OFF`), or branch on `PYTEST_CURRENT_TEST`/`JEST_WORKER_ID` in production.
6
+ - **Universal sealed judge (`run-judge`).** On code/API/CLI/ML/perf tasks (no images or DGX required), `reward_guard.py run-judge` runs `--verify-cmd` itself, captures `git diff` + untracked files, and audits both inside a sealed `omp -p --no-tools` prosecutor signed with an outer-supervisor RFC 8032 Ed25519 key. On UI/2D/3D tasks, it attaches locked references + owned headless Blender renders (`.glb`/`.fbx`/`.blend`/`.obj`) and verifies upstream Ed25519 receipts when required.
7
+ - **Outer-supervisor & CI ownership (`loop.py` + `slop_gate.py` + `self_grill.py`).** `slop_gate.py` scans both git diffs and `.scratch/` scripts/symlinks on every `local_ci.py run`; `self_grill.py` enforces critical `no-reward-hacking` verification across test/config/eval/E2E diffs; and `loop.py` freezes protected files and guardrail configs (`exit 4` on mutation) while running `run-judge` from a private `realpath`-verified holdout.
8
+ - **Anti-patterns.** Hardcoding test fixture inputs or `PYTEST_CURRENT_TEST` branches in `src/`; overwriting snapshots (`-u`) to silence regressions; stubbing backend `/api/` routes in E2E tests; fitting on `X_test`; `verify=False` to silence TLS failures; deleting assertions; letting the builder own the final completion gate.
@@ -1,6 +1,6 @@
1
- # Rule approval: owner-signed agent rules
1
+ # Rule approval: owner-approved agent rules
2
2
 
3
- Mechanics behind the `SKILL.md` rule approval rule. Code: `assets/rules/rule_ledger.py`. Tracked paths: `assets/rules/rule-paths.json`.
3
+ Mechanics behind the `SKILL.md` rule approval rule. Code: `assets/rules/rule_ledger.py`, notices in `assets/rules/rules_watch.py`. Tracked paths: `assets/rules/rule-paths.json`.
4
4
 
5
5
  ## What counts as a rule
6
6
 
@@ -13,17 +13,25 @@ Mechanics behind the `SKILL.md` rule approval rule. Code: `assets/rules/rule_led
13
13
 
14
14
  ## Owner workflow
15
15
 
16
- 1. `deepmodebot rules init` lists every rule present, asks you to approve them as the baseline, and sets your passphrase (8+ characters). Commit `.deepmodebot/rules/` so clones and CI enforce it.
17
- 2. `deepmodebot rules status` shows each rule as approved, changed, new or removed, plus waiting proposals. `review` prints every pending change with its id and diff. `log` prints the signed decision history. Agent text is shown with control characters escaped.
18
- 3. `deepmodebot rules approve <id>...` or `reject <id>...` (`--all` for everything) asks for the passphrase. Rejecting puts the approved text back, deletes an unapproved new rule file or memory convention, or restores a deleted rule. Commit `.deepmodebot/rules/` with the rule files.
19
- 4. `deepmodebot rules rotate` changes the passphrase; the old key signs the new one. A lost passphrase means `rule_ledger.py init --reset`, which keeps the history but changes the key. The gate flags that change until you commit it yourself with `git commit --no-verify` and merge it into the default branch.
16
+ 1. `deepmodebot rules init` lists every rule present and asks you (y/N) to approve them as the baseline. Commit `.deepmodebot/rules/` so clones and CI enforce it.
17
+ 2. `deepmodebot rules status` shows each rule as approved, changed, new or removed, plus waiting proposals. `review` prints every pending change with its id and diff. `log` prints the decision history. Agent text is shown with control characters escaped.
18
+ 3. `deepmodebot rules approve <id>...` or `reject <id>...` (`--all` for everything) shows the changes and asks y/N. Rejecting puts the approved text back, deletes an unapproved new rule file or memory convention, or restores a deleted rule. Commit `.deepmodebot/rules/` with the rule files.
20
19
 
21
- Never type the passphrase into an agent chat or an agent-run terminal.
20
+ There is no passphrase. `init`, `approve` and `reject` answer only in an interactive terminal (a piped `y` is refused), and the hooks block agents from running them or writing the ledger.
21
+
22
+ ## User-level rules
23
+
24
+ Agents also load rules from your home folder in every project: omp's `~/.omp/agent/` (`AGENTS.md`, `RULES.md`, `SYSTEM.md`, `config.yml`, `mcp.json`, and the `hooks`, `rules`, `skills`, `commands`, `agents`, `extensions` folders), Claude Code's `~/.claude/` (`CLAUDE.md`, `settings*.json`, `hooks`, `rules`, `skills`, `agents`, `commands`), Codex's `~/.codex/` (`AGENTS.md`, `config.toml`, `hooks.json`, `rules`, `agents`, `prompts`), Gemini and Antigravity's `~/.gemini/` and `~/.agents/` (the `user` list in `rule-paths.json`). An agent that edits one changes every later session, as an agent-installed git guard once did.
25
+
26
+ - `deepmodebot rules init --user` turns approval on for them, with a ledger in `~/.deepmodebot/rules/`. Nothing is approved at first: every current file waits in `deepmodebot rules review --user` until you approve or reject it. `--accept-current` approves them all as they are instead.
27
+ - `status`, `review`, `log`, `approve`, `reject` and `propose` take `--user` too. Decisions are recorded at once; there is no commit and no gate, so this ledger rests on the hooks.
28
+ - Files over 1 MB (skill images) are approved by hash only, with no copy kept, so a reject cannot restore them.
22
29
 
23
30
  ## Agent workflow
24
31
 
25
32
  - Never edit a rule file in a repo with `.deepmodebot/rules/ledger.json`. Draft the full new file under `.scratch/`, then run `python -B <skill>/assets/rules/rule_ledger.py propose --item AGENTS.md --file .scratch/AGENTS.draft.md --reason "<why>" --by <harness>`. The rule file stays unchanged until the owner approves.
26
- - Tell the owner the proposal id and to run `deepmodebot rules review`. Never run `init`, `approve`, `reject` or `rotate`, never skip git hooks, and never ask for the passphrase.
33
+ - Tell the owner the proposal id and to run `deepmodebot rules review`. Never run `init`, `approve` or `reject`, and never skip git hooks.
34
+ - The same holds for user-level rules once `~/.deepmodebot/rules/ledger.json` exists: propose with `rule_ledger.py propose --user --item .claude/settings.json ...`.
27
35
  - Memory conventions you record stay hidden from `project_memory.py recall` until approved; recall reports how many with `unapproved-conventions-hidden`.
28
36
  - `deepmodebot init` (`assets/setup/project_setup.py`) follows the same path: it proposes `.deepmodebot/policy.xml` and its managed-block refresh for `AGENTS.md` and `CLAUDE.md` instead of writing them.
29
37
 
@@ -31,21 +39,33 @@ Never type the passphrase into an agent chat or an agent-run terminal.
31
39
 
32
40
  | Layer | What it stops |
33
41
  |---|---|
34
- | Hooks: Claude Code `hooks/hooks.json`, omp `assets/contain/omp-contain.ts`, Antigravity `scripts/antigravity-guard.mjs` | In every session of a ledger repo, active or not: file-tool writes to rule files and the ledger (also through symlinked folders or aliases); shell commands that write, move or delete them (redirects, `tee`, `sed -i`, `cp`/`mv`/`rm`/`ln`, globs, `cd` chains, `find -delete`, `curl -o`, `bash -c`, inline interpreter code, heredocs); writers fed by `xargs` or `$(...)`; `git commit --no-verify`/`-n` and `core.hooksPath` changes. Owner-only commands are blocked in any repo. |
35
- | Ledger signature | Ed25519 over the canonical ledger with a key derived from the passphrase (PBKDF2-SHA256, 600k rounds). Any edit without the passphrase breaks the signature. |
36
- | Gate: `rule_ledger.py check` inside `slop_gate.py`, the `project_setup.py --install-hooks` pre-commit hook, and `deepmodebot gate rules` | P1 per unapproved change and per symlinked rule whose target is not a rule path. P0 for a forged ledger, a ledger rolled back to an older version, an owner key swapped without a rotation signed by the old key, a deleted ledger, a symlinked store, or a missing approved copy. The ledger must extend the committed one at HEAD and at the merge-base with `origin`'s default branch, so a bad ledger committed with hooks skipped still fails against the default branch. `--staged` checks the commit; CI passes `--base origin/main`, which must resolve. |
42
+ | Hooks: Claude Code `hooks/hooks.json`, omp `assets/contain/omp-contain.ts`, Antigravity `scripts/antigravity-guard.mjs` | In every session of a ledger repo, active or not, and for user-level rules once `rules init --user` ran: file-tool writes to rule files and the ledger (also through symlinked folders or aliases); shell commands that write, move or delete them (redirects, `tee`, `sed -i`, `cp`/`mv`/`rm`/`ln`, globs, `cd` chains, `find -delete`, `curl -o`, `bash -c`, inline interpreter code, heredocs); writers fed by `xargs` or `$(...)`; `git commit --no-verify`/`-n` and `core.hooksPath` changes. Owner-only commands are blocked in any repo. Each block notifies the owner. |
43
+ | Gate: `rule_ledger.py check` inside `slop_gate.py`, the `project_setup.py --install-hooks` pre-commit hook, and `deepmodebot gate rules` | P1 per unapproved change and per symlinked rule whose target is not a rule path. P0 for a malformed ledger, a ledger rolled back to an older version, approvals edited into the ledger with no recorded decision, a deleted ledger, a symlinked store, or a missing approved copy. The ledger must extend the committed one at HEAD and at the merge-base with `origin`'s default branch, so a bad ledger committed with hooks skipped still fails against the default branch. `--staged` checks the commit; CI passes `--base origin/main`, which must resolve. |
37
44
  | Memory recall | Unapproved conventions never reach the agent. |
38
45
 
46
+ ## Notices
47
+
48
+ `rules_watch.py` tells you about rule changes you have not approved: in the user ledger, in every repo you ran `rules init` in (listed in `~/.deepmodebot/rules/repos.json`), and in the session's own repo.
49
+
50
+ | Channel | When |
51
+ |---|---|
52
+ | Desktop notification (Windows toast, macOS, `notify-send`) | The hourly `deepmodebot update` task, when the set of pending changes differs from the last notification or a day has passed; and at once when a hook blocks an agent's rule write. |
53
+ | Orca | The hourly task puts the notice in the Orca workspace comment of the affected repo (the latest active workspace for user rules) and marks it unread; the comment clears when nothing is pending. |
54
+ | Session start | Claude Code `SessionStart` (a `systemMessage` plus agent context), omp `session_start` (warning and status line), Antigravity's first PreInvocation of a conversation (an injected step). Until `rules init --user` runs, it says the user rules are not reviewed. |
55
+
56
+ `deepmodebot rules watch` prints the same list. Every notice and block is logged to `~/.deepmodebot/rules-watch.log`.
57
+
39
58
  ## Storage
40
59
 
41
- - `.deepmodebot/rules/ledger.json`: owner key (public key, salt, rounds), approved item to SHA-256 map, approved symlinks, decision history, signature.
60
+ - `.deepmodebot/rules/ledger.json`: approved item to SHA-256 map, approved symlinks, decision history. Ledgers from before the passphrase was dropped also hold `owner` and `signature`; the next decision removes them.
42
61
  - `.deepmodebot/rules/approved/<sha256>`: the approved bytes, used for diffs and rejects.
43
62
  - `.deepmodebot/rules/proposals/<id>.json`: agent proposals waiting for the owner.
63
+ - `~/.deepmodebot/rules/`: the same layout for user-level rules, plus `repos.json` (repos to watch) and `hash-cache.json` (hashes by size and modification time, so the session-start check stays fast).
44
64
 
45
65
  ## Limits
46
66
 
47
- - Codex has no deepmodebot hook; the gate catches its rule edits at commit time.
48
- - Shell parsing is best effort. A script written to a file and then run, `git apply`, or a path held in a shell variable can still change a rule in the working tree, and harnesses may load that text until the owner rejects it. The signed ledger keeps it from being approved, and the gate blocks the commit.
49
- - An agent with full shell access can remove hooks or the plugin and commit with hooks skipped. The check against the default branch catches that commit; keep the default branch protected and merge only PRs whose rule gate passes.
67
+ - Codex has no deepmodebot hook; the gate catches its rule edits at commit time. Its user-level rule edits show up in the notices only.
68
+ - Shell parsing is best effort. A script written to a file and then run, `git apply`, or a path held in a shell variable can still change a rule in the working tree, and harnesses may load that text until the owner rejects it. The gate blocks the commit.
69
+ - Without a passphrase nothing cryptographic tells your decisions from an agent's. An agent that slips past the hooks could record a decision with `rule_ledger.py`'s functions; the history shows it, and the notices tell you the rule changed, but only you can tell the decision was not yours.
70
+ - An agent with full shell access can remove hooks or the plugin and commit with hooks skipped. The check against the default branch catches a rolled-back or hand-edited ledger in that commit; keep the default branch protected and merge only PRs whose rule gate passes.
50
71
  - A repo with no `origin` default branch anchors trust on HEAD only.
51
- - Trust starts at `init`: whoever runs it first sets the owner key, which is why `init` is blocked for agents everywhere.
@@ -13,13 +13,13 @@ Regex cannot understand human phrasing, tone, frustration, skepticism, or compou
13
13
  EOF
14
14
  ```
15
15
  *(Headless / CLI callers without an active chat LLM can run `autoroute.py route --root "<project-root>" --stdin --harness auto --json` to invoke the user's logged-in subscription LLM `agy`/`claude`/`codex` directly through Stages 1–3, stripping API keys and never spending `omp` tokens.)*
16
- `menu` discovers every playbook, technique, plugin sibling skill, and project-local skill from disk, collects live repo facts plus `pre_flight_clarification` (`prompt_tools.py clarify`), and emits `llm_router_prompt` with **no regex mode guess**.
17
- If `pre_flight_clarification.needs_clarification` is `true` (and repo/docs cannot settle it), ask `1-3` `(Recommended)`-first choices once upfront via `ask_question` / `AskUserQuestion` / `ask` / `request_user_input` (pick `(Recommended)` in `-p` mode), then run 100% autonomously.
18
- Done when the live catalog, repo facts, and upfront intent check are settled.
16
+ `menu` discovers playbooks, techniques, routable references, plugin sibling skills, and project-local skills from disk. It collects live repo facts plus `pre_flight_clarification` (`prompt_tools.py clarify`) and emits `llm_router_prompt` with **no regex mode guess**.
17
+ Use the main skill's Route Step 0 to resolve intent. Treat `pre_flight_clarification` as advisory: inspect available facts before asking and never treat a headless default as authorization.
18
+ Done when the actor, outcome, success evidence, and requested delivery boundary are clear enough to route.
19
19
 
20
20
  2. **Stage 2: Ask the LLM to decide semantically.** Using the full menu and repo facts (inline structured reasoning, or a fast read-only `scout` subagent on large/ambiguous asks), output a single JSON route decision:
21
- - `decoded_intent` and numbered `deliverables` (full scope; never drop compound clauses)
22
- - `primary_mode` and exact `route_file` from the live menu
21
+ - `decoded_intent`: restate the user's objective, observable success, and delivery boundary before choosing a mode. `deliverables`: enumerate every requested output or action without turning a proxy into a goal.
22
+ - `primary_mode` and exact `route_file` from the live menu. Deepmode route files are relative to this skill's root, e.g. `references/techniques/visual-e2e.md`. Sibling and project skills use `skill://<name>` and can name a file within that skill. If both exist, `research` selects the Deepmode technique by default; `skill://research` selects the separate skill.
23
23
  - `secondary_techniques` (e.g., `self-grill`, `no-comments`, `security-audit`, `why`, `how`, `formal-verification`) and `reference_skills` (`skill://frontend-ui`, `skill://secrets-and-auth`, `skill://software-architecture`, `skill://cloud-devsecops`, `skill://agent-harnesses`, `skill://domain-rules`, `skill://deep-stack`)
24
24
  - `size` (`S`/`M`/`L`/`none`), `self_grill` (`none`/`plan`/`checks`/`both`), `hardcore_mode` (default `true`; `false` only on explicit minimal/prototype opt-out), `hardcore_ceiling` (1-sentence first-principles engineering target), `confidence` (`0.0`–`1.0`), `runner_up`, `why_not_runner_up`, `needs_prompt_upgrade`, and `hard_stops`.
25
25
  Done when the JSON decision covers every deliverable and names why the runner-up lost.
@@ -34,9 +34,10 @@ Regex cannot understand human phrasing, tone, frustration, skepticism, or compou
34
34
  - **Disk & containment existence:** rejects any hallucinated `primary_mode`, `route_file`, `secondary_technique`, or `reference_skill` (including `skill://` subpaths or `..` escapes) not present on disk.
35
35
  - **Size & safety floor:** read-only/discovery modes must be `none`; any prompt or diff touching auth, secrets, permissions, migrations, payments, CI workflows, or agent config cannot be `S` and requires `self_grill` + security companions.
36
36
  - **Anti-blunder & Hardcore anti-sandbagging guards:** blocks lazy `tournament` dumping on concrete anchors without justification, flags shallow `feature`/`bug-fix` collapse when specialized playbooks fit (`perf-issue`, `runtime-forensics`, `trace-forensics`, `hillclimb`, `visual-parity`, `reference-rebuild`, `formal-verification`, `gen-ui`, `video-forensics`, `suggest`, `prompt-upgrade`, `no-comments`), and blocks disabling `hardcore_mode` or under-sizing multi-part/systems work to `S`.
37
- - **Required companions:** flags missing `reference_skills` or `self-grill`/`no-comments` on M/L code work (plus `architect` on multi-part hardcore L builds).
37
+ - **Required companions:** flags missing `reference_skills` or `self-grill`/`no-comments` on M/L code work (plus `architect` on multi-part hardcore L builds). If a required technique is absent from the live catalog, the decision is rejected.
38
38
  - **Bounded critic pass (`--critic-round 2`):** if `status` is `CRITIC_REQUIRED` (confidence `< 0.80` or specialized-signal mismatch) or `REJECTED`, run one fresh adversarial critic pass using `critic_prompt`, revise the JSON with `"critic_reviewed": true`, and re-verify with `--critic-round 2` until `APPROVED` (exit 0). Round-1 `critic_reviewed: true` without `--critic-round 2` is rejected.
39
- Done when `verify --strict` returns `APPROVED` (exit 0) and you open `route_file` plus listed `reference_skills`.
39
+ On `APPROVED`, use `locked_plan.read_targets` as the read list: primary route, companion techniques, then reference skills, with duplicates removed. Do not infer paths from `primary_mode` or technique names.
40
+ In omp, pass each URI verbatim to `read`. Elsewhere, resolve `skill://<name>` to the selected skill's `SKILL.md`; resolve `skill://<name>/<path>` relative to that skill's root.
40
41
 
41
42
  ## Mid-flight re-route (Stage 4)
42
43
 
@@ -46,4 +47,4 @@ python -B "<this installed skill>/assets/autoroute/autoroute.py" reroute --root
46
47
  ```
47
48
  Apply the recommended escalation (`S -> M/L`, `M -> L`, `architect`, `arena`, `attack-the-premise`, `security-audit`, `self-grill`, `no-comments`) and log one row in the decision trail; add `sme-review` when domain rules are unverified.
48
49
 
49
- **Done when** `autoroute.py verify --strict` returns `APPROVED` (exit 0), the selected `route_file` and `reference_skills` are loaded, and any mid-flight scope or premise shift triggers `reroute`.
50
+ **Done when** `autoroute.py verify --strict --json` returns `APPROVED` (exit 0), every `locked_plan.read_targets` entry is loaded, and any mid-flight scope or premise shift triggers `reroute`.
@@ -14,6 +14,7 @@
14
14
  3. Fix the most frequent classes now, one unit per class (one commit each). Prove each new check fails on a real past mistake. Same command locally and in CI. Exceptions go on the offending line with reason, expiry, and a decision-trail row.
15
15
  Done when each fixed class has its own commit and a run showing its check failing on a past mistake.
16
16
  4. Keep a rule table in the agent instruction file pairing each rule with its enforcer. On a correction: fix the mistake, add the rule; an existing unenforced rule is a repeat → enforce it at the highest level in the same change. Drop rules whose mistake can no longer happen.
17
+ Before changing the instruction file or an enforcer, read Self-Improvement Memory (**sim**, `references/techniques/sim.md`): an earlier attempt at the same class may already explain it. Record the new attempt with the past mistakes it should catch as predictions.
17
18
  Done when every rule in the table names an enforcer, or is a judgment call marked as docs-only.
18
19
 
19
20
  **Output:** each class with its evidence, the level picked, and why a higher level didn't work.
@@ -22,7 +22,11 @@ An outer loop (`loop.py`, `run-a-goal`, `work-a-queue`, `/goal`) multiplies what
22
22
  - Inline type or lint suppressions (`# type: ignore`, `# pyright: ignore`, `# noqa`, `# pylint: disable`, `# nosec`, `@ts-ignore`, `@ts-expect-error`, `eslint-disable`, `biome-ignore`, `#[allow(`, `// nolint`), swallowed exceptions (`except:` / `except Exception: pass`), and `TODO`/`FIXME`/`NotImplementedError` stubs (via `loop.py` `scan_text_slop`).
23
23
  - Hardcoded secrets (AWS/GitHub/AI/Stripe keys, PEM private keys), unpinned `@main`/`@master` GitHub Actions, unsafe sinks (`eval`/`innerHTML`/`subprocess.run` without `timeout=`), TS `as any`, Rust `.unwrap()`, and Go `_ = err`.
24
24
  - Test theater (empty tests, 0-assertion tests, `assert True`, `assertEqual(x, x)`) and newly added god-functions (`>120` lines or nesting `>5`).
25
- - Reward-hacking escapes (`assets/reward-guard/reward_guard.py`, `deepmodebot gate reward`): zeroed similarity/fidelity flags (`--min-iou 0`, `--skip-reference`), weakened diff bounds, unconditional test `.skip`s, procedural primitive stand-ins (`create_cube`/`create_cone`), tampered contract hashes, missing upstream provenance receipts (`job_id` + SHA-256), and missing independent judge sign-off.
25
+ - Reward-hacking escapes across all domains (`assets/reward-guard/reward_guard.py`, `deepmodebot gate reward`):
26
+ - Quality and coverage bypasses (`--cov-fail-under < 50`, `--min-iou < 0.50`, `--no-cov`, `go test -run=^$`).
27
+ - Unattended snapshot overwrites (`--update-snapshots`, `jest/vitest -u`, `cargo insta accept`) and `package.json` no-op test scripts (`echo`, `true`, `exit 0`).
28
+ - Weakened typecheck and CI configs (`continue-on-error: true`, strictness off in `tsconfig`/`mypy`/`pyright`, `#![allow(warnings)]`).
29
+ - Production test-runner or TLS/FK bypasses (`PYTEST_CURRENT_TEST`, `verify=False`), E2E `/api/` route stubbing, ML train-on-test leakage, and missing outer-supervisor Ed25519 judge sign-off.
26
30
  - Polyglot auto-linters on changed files only (`ruff`, `shellcheck`, `node --check`), `perf_audit.py` high findings, `ui_audit.py` P0/P1 findings, `<boundaries>` import rules, `<budgets>` size caps, and guardrail config-tamper locks (`.deepmodebot/policy.xml`).
27
31
  Done when a planted suppression, secret, or 0-assertion test fails `slop_gate.py` and guardrail configs are protected.
28
32
  4. **Split fast feedback from full acceptance.** Keep `fast_check` (types, lint, structural checks, fast unit tests) under roughly 30 seconds so every edit gets immediate feedback, and wire it into commit hooks with **pre-commit** (`references/techniques/pre-commit.md`). Keep slower integration suites and live runtime checks in `check` so static checks alone never count as done.
@@ -30,7 +34,7 @@ An outer loop (`loop.py`, `run-a-goal`, `work-a-queue`, `/goal`) multiplies what
30
34
  5. **Bind outer goal loops to the hardened inner loop.** Before launching `loop.py`, `run-a-goal` (`references/playbooks/run-a-goal.md`), or `self-authoring` (`references/playbooks/self-authoring.md`):
31
35
  - Generate a new goal contract (`python -B "<this skill>/assets/loop/loop.py" audit <root> --write-goal .scratch/goals/<slug>.md`, `py -3 -B` on Windows) with `fast_check`, `check`, and `protect` naming every test, fixture, and check script. (`--write-goal` refuses to overwrite an existing goal file; edit existing goal files directly.)
32
36
  - Keep `forbid_slop: true` and `protect_configs: true` enabled (`protect_configs` defaults to `true` except when `protect: none`, where it defaults to `false` unless set explicitly); set `revert_on_fail: true` on a clean tree when failed attempts must reset automatically between iterations.
33
- - Run `python -B "<this skill>/assets/loop/loop.py" check <goal.md>` once to verify the contract parses, protects configs, and fails on the unfixed state. (`loop.py check` always exits `0` and prints gate pass/fail status to stdout, so inspect its printed output rather than relying on a nonzero exit code.)
37
+ - Run `python -B "<this skill>/assets/loop/loop.py" check <goal.md>` once to verify the contract parses, protects configs, and fails on the unfixed state. (`loop.py check` exits `0` for normal gate pass/fail status—inspect its printed output—and exits `4` if a check command mutates protected files or guardrail configs.)
34
38
  - When an outer loop or review hits the same failure class twice, pause fan-out and encode a permanent check via **correct** (`references/techniques/correct.md`).
35
39
  Done when `loop.py check` (or the outer loop's gate) validates the contract and proves a red-to-green path without weakening any check.
36
40
 
@@ -1,13 +1,35 @@
1
1
  # mutation-testing
2
2
 
3
- **Use when:** line/branch coverage looks high (`90%+`) yet bugs still slip through, when auditing test quality ("check theater"), or when hardening parsers, state machines, billing, crypto, or concurrency logic with property-based/fuzz tests.
3
+ **Use when:** a diff adds or changes source and the tests that came with it might be check theater (green, yet blind to the change), when coverage is high but bugs still slip through, or before trusting tests written by an agent. A test earns its place only if it fails when the diff's behavior is broken (mutation-guided test generation, Meta ACH, FSE 2025).
4
4
 
5
- 1. **Pick high-consequence targets.** Scope to modules where a silent wrong answer corrupts state, money, auth, or safety—never waste mutation cycles on trivial getters or generated glue.
6
- 2. **Generate semantic mutants (isolated in `.scratch/`).** Use a language runner (`mutmut`, `cargo-mutants`, `Stryker`, `go-mutesting`) or apply 5–10 targeted high-value mutations in an isolated `.scratch/` copy (never mutating uncommitted user edits in place):
7
- - Boundary flips (`<` ↔ `<=`, `==` ↔ `!=`, off-by-one slice bounds);
8
- - Guard deletion (drop authz/tenant check, idempotency check, or rollback branch);
9
- - State/order swaps (reorder lock/write steps, return cached/empty value early).
10
- 3. **Run the existing test suite per mutant.** Classify each as **killed** (a test failed for the right behavioral reason), **survived** (tests stayed green—check theater exposed!), or **equivalent** (observable behavior unchanged).
11
- 4. **Kill surviving mutants with behavioral + property-based tests.** Replace tautological/mock-heavy assertions with observable behavior checks (`references/principles/test-behavior-not-implementation.md`) and add shrinkable property-based invariants (`Hypothesis`, `fast-check`, `proptest`) or coverage-guided fuzz harnesses (`cargo-fuzz`, `atheris`, `libFuzzer`) asserting round-trip, idempotence, conservation, or crash-freedom across generated inputs.
5
+ ## Run the gate
12
6
 
13
- **Done when** baseline and post-hardening mutant survival counts are measured on an isolated copy, every non-equivalent surviving mutant in critical paths is killed by a real behavioral or property-based test, and the working tree has zero leftover mutations.
7
+ `deepmodebot gate mutate run --root <repo> --base <BASE> [--test-cmd CMD] [--max-mutants 8] [--timeout 60] [--seed 0] [--min-score 0.6] [--json]`
8
+
9
+ Run it after the change and its tests are written, with `BASE` pinned before the work began. Exit 0 only when `ok`. JSON: `{ok, score, killed, survived: [...], survived_boundary: [...], invalid, timeouts, mutants: [...], violations, notes}`.
10
+
11
+ ## What it does
12
+
13
+ 1. **Selects only changed, non-test source lines.** The diff `BASE..worktree` (plus untracked files) is parsed for Python, JS/TS, Go and Rust. Tests, docs, config and `.scratch/` are skipped; so are Python `__main__` blocks and Rust `#[cfg(test)]` tails. Strings, comments, docstrings and regex literals are masked out, never mutated.
14
+ 2. **Generates deterministic mutants.** Operators: `==`/`!=`, `<`/`<=`, `>`/`>=`, `and`/`or`, `&&`/`||`, binary `+`/`-`, `True`/`False`, dropped guard (`if cond` becomes `if True` or `if False`), return-constant swap (`0`/`1`, booleans, non-empty string to empty), removed `not`/`!`. `--seed` shuffles the candidates, spreading them over distinct lines first; `--max-mutants` caps the valid ones evaluated.
15
+ 3. **Never touches your tree.** The baseline and every mutant run in a fresh copy under `<root>/.scratch/tmp/mutate-*` (tracked and untracked files; a root `node_modules` is linked in). The copy is removed even on timeout or crash. Use root-relative paths in `--test-cmd`: the copy is the working directory.
16
+ 4. **Baseline first.** The unmutated copy must pass, and the auto-detected runner must execute at least one test; otherwise `baseline-red` or `baseline-timeout` and no mutant runs.
17
+ 5. **Kills or survives.** A mutant is **killed** when the test command fails. It **survives** when the tests stay green: a violation naming `file:line`, the original and the mutated line. A run past `--timeout` is a `timeout` violation, never a kill and never a survivor.
18
+ 6. **Invalid mutants are replaced.** A mutant that does not parse (`compile()`, `node --check`) or compile (Go and Cargo build failures, JS syntax errors) is counted `invalid`, never as killed, and the next candidate takes its place.
19
+
20
+ ## Test command
21
+
22
+ Auto-detected per language: `pytest` (or `unittest discover`), `node --test` (or `npm test` when `package.json` defines a real `test` script), `go test ./...`, `cargo test`. `--test-cmd` overrides it as an argv without a shell and applies to every language in the diff. Narrow it (one test file) to speed up large suites.
23
+
24
+ ## Fail-closed outcomes
25
+
26
+ - `no-mutable-lines`: changed source without a single mutable line fails; a diff of only tests, docs and config passes with the note. Unsupported languages (shell, C, ...) count as source here.
27
+ - `test-command-error`: the command is missing or cannot be detected.
28
+ - `no-valid-mutants`: every candidate was invalid.
29
+ - `survived-mutant` / `survived-boundary` while `score < --min-score` (default `0.6`). Boundary rel-swaps (`<`<->`<=`, `>`<->`>=`) are frequently equivalent (behavior-identical), so they are reported apart as `survived_boundary` (still counted in the score); `survived` holds the rest. A human judges the boundary ones; the coordinator may raise `--min-score` per task (`1.0` = any survivor fails).
30
+
31
+ ## Kill the survivors
32
+
33
+ Replace tautological or mock-heavy assertions with observable-behavior checks (`references/principles/test-behavior-not-implementation.md`), add the boundary case the mutant exposed (the `<` vs `<=` input, the unauthorized caller, the idempotent retry), or add shrinkable property-based invariants (`Hypothesis`, `fast-check`, `proptest`) for round-trip, idempotence, or conservation. Never edit the gate, its threshold, or the mutants to pass.
34
+
35
+ **Done when** `deepmodebot gate mutate run` exits 0 with every non-equivalent mutant killed on the final diff, and `git status` shows no leftover mutation or `mutate-*` directory.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Use when:** cleaning comments from a diff or files ("no-comments", "remove comments", "strip comments"), and before review on M/L code diffs. Comments rot and lie, and AI agents read the comment instead of reading the code. Scope = caller's files/diff, else current diff against the base branch (default `main`) incl. working tree.
4
4
 
5
- 1. Spawn `comment-sicko` (`plugins/deepmodebot/agents/comment-sicko/agent.md`, or a default `task` agent when custom agents are unavailable) with the scope.
5
+ 1. Spawn `comment-sicko` (`plugins/deepmodebot/agents/comment-sicko.md`, or a default `task` agent when custom agents are unavailable) with the scope.
6
6
  Delete comments in scope: narration, banners, commented-out code, workaround sermons.
7
7
  Only keeps: legal/license headers; non-obvious behavior forced by an external dependency, platform, vendor, or protocol we can't reshape; `prettier-ignore`; lint suppressions whose rule is faulty, pedantic, or style-only; doc comments defining a public API contract; issue/RFC links explaining a constraint code can't express.
8
8
  Unsure a keep applies → it dies.