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.
- package/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/.omp-plugin/marketplace.json +2 -2
- package/README.md +15 -6
- package/bin/deepmodebot.mjs +104 -10
- package/native/dmb-gate/Cargo.toml +1 -1
- package/native/dmb-gate/src/agents.rs +58 -25
- package/native/dmb-gate/src/ci.rs +530 -14
- package/native/dmb-gate/src/main.rs +215 -7
- package/native/dmb-gate/src/reward.rs +1895 -242
- package/native/dmb-gate/src/sim.rs +969 -0
- package/native/dmb-gate/src/slop.rs +1061 -295
- package/package.json +1 -1
- package/plugins/deepmodebot/.antigravity-plugin/plugin.json +1 -1
- package/plugins/deepmodebot/.antigravity-plugin/skills/deep/SKILL.md +1 -1
- package/plugins/deepmodebot/.claude-plugin/plugin.json +1 -1
- package/plugins/deepmodebot/.codex-plugin/plugin.json +2 -2
- package/plugins/deepmodebot/agents/comment-sicko.md +29 -0
- package/plugins/deepmodebot/agents/researcher.md +29 -0
- package/plugins/deepmodebot/agents/reviewer.md +29 -0
- package/plugins/deepmodebot/agents/scout.md +28 -0
- package/plugins/deepmodebot/agents/security-reviewer.md +27 -0
- package/plugins/deepmodebot/commands/deep.md +3 -2
- package/plugins/deepmodebot/commands/tournament.md +1 -1
- package/plugins/deepmodebot/hooks/hooks.json +12 -2
- package/plugins/deepmodebot/hooks.json +1 -1
- package/plugins/deepmodebot/scripts/antigravity-guard.mjs +740 -37
- package/plugins/deepmodebot/skills/agent-harnesses/references/antigravity.md +2 -2
- package/plugins/deepmodebot/skills/deepmodebot/SKILL.md +19 -11
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/agents_md.py +51 -20
- package/plugins/deepmodebot/skills/deepmodebot/assets/autoroute/autoroute.py +54 -49
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude-guard.sh +4 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude_guard.py +658 -21
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/holdout_guard_cases.json +272 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain.ts +774 -23
- package/plugins/deepmodebot/skills/deepmodebot/assets/f2p-gate/f2p_gate.py +547 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/gap-audit/gap_audit.py +5 -11
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard-patterns.txt +4 -4
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.sh +53 -6
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.ts +48 -2
- package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/local_ci.py +262 -6
- package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/slop_gate.py +529 -122
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/loop.py +747 -46
- package/plugins/deepmodebot/skills/deepmodebot/assets/memory/project_memory.py +404 -5
- package/plugins/deepmodebot/skills/deepmodebot/assets/mutation/mutation_gate.py +798 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/reward-guard/reward_guard.py +2050 -200
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule-paths.json +44 -1
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule_ledger.py +278 -252
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rules_watch.py +436 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/self-grill/self_grill.py +594 -18
- package/plugins/deepmodebot/skills/deepmodebot/assets/setup/project_setup.py +41 -5
- package/plugins/deepmodebot/skills/deepmodebot/assets/sim/sim.py +856 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/worker-gate/worker_gate.py +237 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/catalog.md +3 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/delegation.md +6 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/authoring-a-skill.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/hillclimb.md +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/self-authoring.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/no-reward-hacking.md +6 -6
- package/plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md +36 -16
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/autoroute.md +9 -8
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/correct.md +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/inner-loop.md +6 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/mutation-testing.md +31 -9
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/no-comments.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/panel.md +4 -4
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sim.md +41 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tdd.md +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tournament.md +24 -13
- package/plugins/deepmodebot/skills/deepmodebot/worker.md +28 -16
- package/plugins/deepmodebot/agents/comment-sicko/agent.md +0 -35
- package/plugins/deepmodebot/agents/researcher/agent.md +0 -33
- package/plugins/deepmodebot/agents/reviewer/agent.md +0 -35
- package/plugins/deepmodebot/agents/scout/agent.md +0 -33
- package/plugins/deepmodebot/agents/security-reviewer/agent.md +0 -31
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "deepmodebot: rigorous agent engineering for omp, Claude Code, Codex, and Google Antigravity",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.11.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "deepmodebot",
|
|
14
14
|
"source": "./plugins/deepmodebot",
|
|
15
15
|
"description": "Rigorous agent engineering mode for omp, Claude Code, Codex, and Google Antigravity: /deep routes tasks to playbooks, enforces Full-Scope Completion, SME-in-the-loop incremental sprints, model/rate-limit resilience, root containment, real-app proof, and verifier-gated PR review.",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.11.0",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"category": "development",
|
|
19
19
|
"tags": [
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "deepmodebot: rigorous agent engineering for omp, Claude Code, Codex, and Google Antigravity",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.11.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "deepmodebot",
|
|
14
14
|
"source": "./plugins/deepmodebot",
|
|
15
15
|
"description": "Rigorous agent engineering mode for omp, Claude Code, Codex, and Google Antigravity: /deep routes tasks to playbooks, enforces Full-Scope Completion, SME-in-the-loop incremental sprints, model/rate-limit resilience, root containment, real-app proof, and verifier-gated PR review.",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.11.0",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"category": "development",
|
|
19
19
|
"tags": [
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Facts for an agent deciding whether to suggest deepmodebot to its user. The same
|
|
|
51
51
|
| `/deep <anything>` | One command routes semantically (`autoroute.py` 3-stage LLM router + route critic) in **Hardcore Mode by default**, audits gaps and overclaims (`self-grill`), proves the result on the real app, and reports its decisions. Concrete tasks run directly, draft plans take **grill**, check/proof audits take **self-grill** / **formal-verification**, and open architecture or research gaps run a 12-agent **tournament** bracket. |
|
|
52
52
|
| `/deepmodebot:suggest` | Scans the real repo via `gap_audit.py`, `perf_audit.py`, and `prompt_tools.py` for doc-to-CLI flag drift, cross-language gate drift, hollow stubs, swallowed exceptions, doc overclaims, broken links, missing tests, and hardcore upgrade targets, emitting ranked `/deep` prompts and a validated **A2UI v1.0** HTML cockpit (`.scratch/gen-ui/`). |
|
|
53
53
|
| `/deepmodebot:research` | Runs identical 4-stage adversarial SOTA & gap research (`/research` in Antigravity) across `agy`, `omp`, Claude Code, and Codex: verifies source code and root `LICENSE` files over READMEs, runs mandatory disconfirmation probes on issues/changelogs/CVEs, and enforces a SOTA-vs-Repo Differential Gap Matrix (`gap_audit.py verify-research --strict`). |
|
|
54
|
-
| `deepmodebot` skill | 30 playbooks, 26 principles and
|
|
54
|
+
| `deepmodebot` skill | 30 playbooks, 26 principles and 71 techniques, routed from a compact `SKILL.md` under Antigravity's 24 KB limit (core rules before `## Routes` under Claude Code's ~20 KB post-compaction window) with full lookup tables in `references/catalog.md`, `worker.md`, `reward_guard.py`, `quota_guard.py`, `verify_proof.py`, `static_sec_audit.py`, `model_setup.py`, `self_cleanup.py`, Full-Scope Completion (`loop.py manifest`), SME-in-the-loop incremental sprints, and enforced Self-Improvement Memory for harness edits (`sim.py`, arXiv:2611.18856). |
|
|
55
55
|
| PR and issue bots | Install your own private GitHub App on your repos and a poller on your machine runs the bots: it reviews and lands your own PRs, resolves their merge conflicts, and plans and builds the issues you open. See [GitHub App bots](#github-app-bots). |
|
|
56
56
|
| PR review | `/deepmodebot:review-pr <PR number>` reviews correctness, security, spec and standards, keeps findings backed by code or execution, and posts a comment-only review. No hosted review service is required. Prompts and source context still reach your configured model provider. |
|
|
57
57
|
| Land a PR | `/deepmodebot:land-pr <PR number>` finishes and merges your own PR with no human: a reviewer bot posts findings in the PR thread, the author bot answers each with a fix or a reason, three verifier bots vote on the final head, and on a pass it merges. It never merges over a failing check. You see each turn in the session as it lands, drawn as an 8-bit frame right in the chat (each bot a sprite, each turn a dialog box), or watch the whole conversation play live as an 8-bit battle screen in your terminal; `/deepmodebot:pr-thread <PR or issue URL>` shows any bot conversation later. |
|
|
@@ -62,7 +62,7 @@ Facts for an agent deciding whether to suggest deepmodebot to its user. The same
|
|
|
62
62
|
| Harness references | Cited, dated guides (checked 2026-11-13) for using omp, Claude Code, Codex, and Google Antigravity, the MCP, ACP, A2A, and WebMCP protocols, and portable AI-native conventions (`AGENTS.md`, Agent Skills, plugin marketplaces). A cross-harness map translates every omp tool and path deepmodebot names across harnesses. In `plugins/deepmodebot/skills/agent-harnesses/`. |
|
|
63
63
|
| Agent SDK workspace | [Install and use Antigravity, Claude Agent, Codex, and omp SDKs](plugins/deepmodebot/skills/agent-harnesses/references/sdks.md), with pinned optional dependencies and no-model smoke commands. CLI subscription logins and SDK authentication are separate contracts. |
|
|
64
64
|
| Contained work | The agent works only inside the project's repo. Scratch and temp files go in `.scratch/`, worktrees in `.worktrees/` (both git-ignored), never system temp or folders outside the repo. With no repo it creates a named one first. Guards enforce this in Claude Code, omp, and Antigravity; Codex's sandbox does it natively. Windows process cleanup uses the loaded interpreter as owner without launcher breakaway; process ownership is not credential isolation. |
|
|
65
|
-
| Approved rules | You see and
|
|
65
|
+
| Approved rules | You see and approve every rule AI agents load: `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, skills, agent settings, and memory conventions. `deepmodebot rules init` approves today's rules after a yes/no in your terminal. From then on agents can only propose rule changes; hooks in Claude Code, omp and Antigravity block direct rule edits, the commit gate blocks unapproved or hand-edited approvals, and `deepmodebot rules review` / `approve` / `reject` / `log` track every decision. [How it works](plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md). |
|
|
66
66
|
| Credentials and auth | Cited, free-first guidance (checked 2026-11-11) for sharing API keys and `.env` safely, passwords and usernames, logins and MFA for agents, credential brokers, protecting MCP servers and agent APIs, CI OIDC, secret scanning, and leak response. In `plugins/deepmodebot/skills/secrets-and-auth/`. |
|
|
67
67
|
| Architecture | Cited, decision-ready guidance (checked 2026-11-11) for organizing monorepos, naming the domain (glossary, typed models, LinkML, RDF and SHACL, graph databases, Palantir-style ontology for agent actions), choosing and migrating databases with agents working safely against them, and backend infrastructure and system design (reliability, queues and durable workflows, APIs, OpenTelemetry, deployment, IaC). Each file ends with the default stack for a solo dev or small team. In `plugins/deepmodebot/skills/software-architecture/`. |
|
|
68
68
|
| Self-authoring | deepmodebot writes and revises bounded loop prompts from observed failures. `assets/loop/loop.py` pairs inner-loop hardening (`audit`, `manifest`, `fast_check`, `forbid_slop`, `protect_configs`) with sprint-scoped Full-Scope Completion (`status`, `--sprint`, `"inventory"`, `"sme_gate"`), cheap-first escalation, quota/429 fallback (`fallback_harness_args`), cadence/SME checkpoints (`checkpoint_every` or `sme_gate`, exit 6; active-sprint pass with deferred slices exits 0 with `scope_complete: false`), and `latest-summary.json`. `loop.py run` uses omp, Claude Code, or Codex. |
|
|
@@ -272,7 +272,7 @@ The examples use the bare `/deep`. With a plugin install, type `/deepmodebot:dee
|
|
|
272
272
|
Agents add rules to `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, skills and project memory as they work. Turn on owner approval once per repo, from your own terminal:
|
|
273
273
|
|
|
274
274
|
```bash
|
|
275
|
-
deepmodebot rules init # lists today's rules
|
|
275
|
+
deepmodebot rules init # lists today's rules and asks you to approve them as the baseline
|
|
276
276
|
git add .deepmodebot/rules && git commit -m "rules: owner approval on"
|
|
277
277
|
```
|
|
278
278
|
|
|
@@ -280,10 +280,19 @@ After that:
|
|
|
280
280
|
|
|
281
281
|
- Agents cannot edit rule files. The hooks block the write and tell the agent to run `rule_ledger.py propose`, which parks the change for you. New memory conventions stay hidden from the agent until approved.
|
|
282
282
|
- `deepmodebot rules status` lists every rule and what waits. `deepmodebot rules review` shows each pending change with an id and diff. `deepmodebot rules log` shows every past decision.
|
|
283
|
-
- `deepmodebot rules approve <id>` or `reject <id>` (or `--all`)
|
|
284
|
-
- The pre-commit hook (`deepmodebot init --install-hooks`), the slop gate and `deepmodebot gate rules` fail on any unapproved rule
|
|
283
|
+
- `deepmodebot rules approve <id>` or `reject <id>` (or `--all`) shows the changes and asks yes/no. Reject puts the approved text back. Commit `.deepmodebot/rules/` afterwards.
|
|
284
|
+
- The pre-commit hook (`deepmodebot init --install-hooks`), the slop gate and `deepmodebot gate rules` fail on any unapproved rule or a hand-edited or rolled-back ledger. They compare against HEAD and your default branch, so a commit that skipped the hooks still fails there; in CI run `deepmodebot gate rules --base origin/main`.
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
There is no passphrase: `init`, `approve` and `reject` only take an answer typed in an interactive terminal, and agents are blocked from running them and from skipping git hooks. Codex has no deepmodebot hook, so its rule edits are caught at commit time. [Limits](plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md#limits).
|
|
287
|
+
|
|
288
|
+
Agents can also change the rules in your home folder that every session loads: `~/.omp/agent` hooks and skills, `~/.claude` settings and hooks, `~/.codex`, `~/.gemini`. Put those under review too:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
deepmodebot rules init --user # nothing approved yet: each current file waits for you
|
|
292
|
+
deepmodebot rules review --user # then approve --user <id> or reject --user <id>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
deepmodebot then tells you whenever a rule changed without your approval: a desktop notification from the hourly update task, a warning when a Claude Code, omp or Antigravity session starts, and a comment on the Orca workspace. A hook that blocks an agent's rule write notifies you at once. `deepmodebot rules watch` lists what waits. [Details](plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md#notices).
|
|
287
296
|
|
|
288
297
|
## GitHub App bots
|
|
289
298
|
|
package/bin/deepmodebot.mjs
CHANGED
|
@@ -42,11 +42,14 @@ Usage: deepmodebot <command>
|
|
|
42
42
|
--check exit 1 if project setup is incomplete
|
|
43
43
|
--install-hooks install <1s .git/hooks/pre-commit running zero-token slop gate
|
|
44
44
|
--dependabot also generate .github/dependabot.yml with 7-day cooldown
|
|
45
|
-
gate [sub] Run parallel check gate (slop|reward|ci|perf|ui|seo|docs|sec|cleanup|agents|skill-check|map|guard|gap|rules)
|
|
45
|
+
gate [sub] Run parallel check gate (slop|reward|ci|perf|ui|seo|docs|sec|cleanup|agents|skill-check|map|guard|gap|rules|sim|worker|f2p|mutate)
|
|
46
|
+
sim [sub] Self-Improvement Memory for harness edits (arXiv:2611.18856): init|read|propose|record|transfer|status|check
|
|
46
47
|
rules [sub] Track and approve the rules AI agents load in this repo (AGENTS.md, CLAUDE.md, .cursor/rules, skills, ...)
|
|
47
48
|
status | review | log what is approved, what waits, and every past decision
|
|
48
|
-
init | approve <id>|--all | reject <id>|--all
|
|
49
|
-
owner only: asks
|
|
49
|
+
init | approve <id>|--all | reject <id>|--all
|
|
50
|
+
owner only: asks you to confirm y/N in this terminal
|
|
51
|
+
--user the user-level rules in ~/.omp, ~/.claude, ~/.codex, ~/.gemini, ~/.agents
|
|
52
|
+
watch [--notify toast,orca] list rule changes you have not approved (the hourly task notifies)
|
|
50
53
|
net [sub] Run native concurrent Go engine (trending|pr-overlap|fetch-papers|webhook)
|
|
51
54
|
build-native Compile zero-dep Rust (dmb-gate) and Go (dmb-net) release binaries
|
|
52
55
|
update Upgrade this npm package, then re-sync the tools setup configured (--quiet for the hourly task)
|
|
@@ -204,13 +207,67 @@ function findNativeGate() {
|
|
|
204
207
|
return null;
|
|
205
208
|
}
|
|
206
209
|
|
|
210
|
+
const SIM_SCRIPT = join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "sim", "sim.py");
|
|
211
|
+
const RULES_DIR = join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "rules");
|
|
212
|
+
|
|
213
|
+
// sim.py owns the store-writing subcommands; the native gate runs `sim check` and folds SIM into `slop`.
|
|
214
|
+
const SIM_PY_ONLY = ["init", "read", "propose", "record", "transfer", "status"];
|
|
215
|
+
|
|
216
|
+
function runNativeSlop(nativeBin, passArgs, root) {
|
|
217
|
+
const ledger = ".deepmodebot/rules/ledger.json";
|
|
218
|
+
const staged = passArgs.includes("--staged");
|
|
219
|
+
const base = !staged && !passArgs.includes("--files") ? option("base") : undefined;
|
|
220
|
+
const indexHasLedger = staged && run("git", ["-C", root, "cat-file", "-e", `:${ledger}`]).code === 0;
|
|
221
|
+
const storedLedger = existsSync(join(root, ledger)) || indexHasLedger
|
|
222
|
+
|| run("git", ["-C", root, "cat-file", "-e", `${base || "HEAD"}:${ledger}`]).code === 0;
|
|
223
|
+
const res = run(nativeBin, passArgs);
|
|
224
|
+
if (!storedLedger) {
|
|
225
|
+
if (res.out) console.log(res.out);
|
|
226
|
+
return res.code;
|
|
227
|
+
}
|
|
228
|
+
const py = findPython();
|
|
229
|
+
if (!py) {
|
|
230
|
+
console.error("slop: Python is required to check the owner rule ledger.");
|
|
231
|
+
return res.code || 1;
|
|
232
|
+
}
|
|
233
|
+
const [exe, prefix] = py;
|
|
234
|
+
const json = passArgs.includes("--json");
|
|
235
|
+
const rules = run(exe, [...prefix, join(RULES_DIR, "rule_ledger.py"), "check", "--root", root,
|
|
236
|
+
...(staged ? ["--staged"] : []), ...(base ? ["--base", base] : []), ...(json ? ["--json"] : [])]);
|
|
237
|
+
if (json) {
|
|
238
|
+
const slop = parseJson(res.stdout);
|
|
239
|
+
const ledgerReport = parseJson(rules.stdout);
|
|
240
|
+
if (slop?.findings && ledgerReport?.findings) {
|
|
241
|
+
slop.findings.push(...ledgerReport.findings);
|
|
242
|
+
for (const {severity} of ledgerReport.findings) slop.counts[severity] = (slop.counts[severity] ?? 0) + 1;
|
|
243
|
+
slop.ok = res.code === 0 && rules.code === 0;
|
|
244
|
+
console.log(JSON.stringify(slop));
|
|
245
|
+
} else {
|
|
246
|
+
if (res.out) console.log(res.out);
|
|
247
|
+
if (rules.out) console.error(rules.out);
|
|
248
|
+
return res.code || rules.code || 1;
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
if (res.out) console.log(res.out);
|
|
252
|
+
if (rules.out) console.log(rules.out);
|
|
253
|
+
}
|
|
254
|
+
return res.code || rules.code;
|
|
255
|
+
}
|
|
256
|
+
|
|
207
257
|
function gate() {
|
|
208
258
|
const passArgs = args.slice(1);
|
|
209
259
|
const sub = passArgs[0] && !passArgs[0].startsWith("-") ? passArgs[0] : "slop";
|
|
210
|
-
const pyOnly = new Set(["seo", "docs", "sec", "rules"]);
|
|
260
|
+
const pyOnly = new Set(["seo", "docs", "sec", "rules", "worker", "f2p", "mutate"]);
|
|
261
|
+
const advisory = (sub === "perf" || sub === "sec") && passArgs.includes("--advisory");
|
|
262
|
+
if (advisory) passArgs.splice(passArgs.indexOf("--advisory"), 1);
|
|
263
|
+
if (sub === "perf" && !advisory && !passArgs.includes("--fail-on-high")) passArgs.push("--fail-on-high");
|
|
264
|
+
const root = resolve(option("root") || process.cwd());
|
|
211
265
|
const rewardLedger = sub === "reward" && passArgs.some((a) => ["lock-contract", "record-provenance", "run-judge", "verdict"].includes(a));
|
|
212
|
-
const
|
|
266
|
+
const simStore = sub === "sim" && passArgs.some((a) => SIM_PY_ONLY.includes(a));
|
|
267
|
+
const lockedReward = sub === "slop" && existsSync(join(root, ".scratch", "reward-guard"));
|
|
268
|
+
const nativeBin = pyOnly.has(sub) || rewardLedger || simStore || lockedReward ? null : findNativeGate();
|
|
213
269
|
if (nativeBin) {
|
|
270
|
+
if (sub === "slop") return runNativeSlop(nativeBin, passArgs, root);
|
|
214
271
|
const res = run(nativeBin, passArgs);
|
|
215
272
|
if (res.out.trim()) console.log(res.out.trim());
|
|
216
273
|
return res.code;
|
|
@@ -222,6 +279,10 @@ function gate() {
|
|
|
222
279
|
}
|
|
223
280
|
const rest = passArgs[0] === sub ? passArgs.slice(1) : passArgs;
|
|
224
281
|
if (sub === "rules" && rest[0] !== "check") rest.unshift("check");
|
|
282
|
+
if (sub === "ci" && !["validate", "plan", "run"].includes(rest[0])) rest.unshift("run");
|
|
283
|
+
if (sub === "agents" && !["build", "check", "user"].includes(rest[0])) rest.unshift("check");
|
|
284
|
+
if (sub === "sec" && !advisory && !rest.includes("--strict")) rest.push("--strict");
|
|
285
|
+
if (sub === "sim" && !["init", "read", "propose", "record", "transfer", "status", "check"].includes(rest[0])) rest.unshift("check");
|
|
225
286
|
const map = {
|
|
226
287
|
slop: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "local-ci", "slop_gate.py"),
|
|
227
288
|
reward: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "reward-guard", "reward_guard.py"),
|
|
@@ -234,26 +295,58 @@ function gate() {
|
|
|
234
295
|
cleanup: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "cleanup", "self_cleanup.py"),
|
|
235
296
|
agents: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "agents-md", "agents_md.py"),
|
|
236
297
|
gap: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "gap-audit", "gap_audit.py"),
|
|
237
|
-
rules: join(
|
|
298
|
+
rules: join(RULES_DIR, "rule_ledger.py"),
|
|
299
|
+
sim: SIM_SCRIPT,
|
|
300
|
+
worker: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "worker-gate", "worker_gate.py"),
|
|
301
|
+
f2p: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "f2p-gate", "f2p_gate.py"),
|
|
302
|
+
mutate: join(pkgRoot, "plugins", "deepmodebot", "skills", "deepmodebot", "assets", "mutation", "mutation_gate.py"),
|
|
238
303
|
};
|
|
239
304
|
const script = map[sub] || map.slop;
|
|
305
|
+
if ((sub === "worker" || sub === "f2p" || sub === "mutate") && !existsSync(script)) {
|
|
306
|
+
console.error(`${{ worker: "Worker", f2p: "F2P", mutate: "Mutation" }[sub]} gate is not present in this installation: ${script}`);
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
240
309
|
const [exe, prefix] = py;
|
|
241
310
|
const res = run(exe, [...prefix, script, ...rest]);
|
|
242
311
|
if (res.out.trim()) console.log(res.out.trim());
|
|
243
312
|
return res.code;
|
|
244
313
|
}
|
|
245
314
|
|
|
246
|
-
// Interactive: the owner
|
|
315
|
+
// Interactive: the owner answers the y/N prompt in this terminal, so the child shares our stdio.
|
|
247
316
|
function rules() {
|
|
248
317
|
const py = findPython();
|
|
249
318
|
if (!py) {
|
|
250
319
|
console.error("python 3 not found on PATH");
|
|
251
320
|
return 1;
|
|
252
321
|
}
|
|
253
|
-
const
|
|
322
|
+
const passArgs = args.slice(1);
|
|
323
|
+
const watch = passArgs[0] === "watch";
|
|
324
|
+
const script = join(RULES_DIR, watch ? "rules_watch.py" : "rule_ledger.py");
|
|
325
|
+
const cmd = watch ? ["check", "--cwd", process.cwd(), ...passArgs.slice(1)] : passArgs.length ? passArgs : ["status"];
|
|
326
|
+
const [exe, prefix] = py;
|
|
327
|
+
const res = spawnSync(exe, [...prefix, script, ...cmd], { stdio: "inherit", windowsHide: true });
|
|
328
|
+
return res.status ?? 1;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Hourly task: toast and mark Orca when agent rules changed without the owner's approval.
|
|
332
|
+
function notifyUnapprovedRules() {
|
|
333
|
+
const py = findPython();
|
|
334
|
+
if (!py) return;
|
|
335
|
+
const [exe, prefix] = py;
|
|
336
|
+
const r = run(exe, [...prefix, join(RULES_DIR, "rules_watch.py"), "check", "--notify", "toast,orca"]);
|
|
337
|
+
if (r.code !== 0) log(`rules watch failed: ${r.out.slice(-200)}`);
|
|
338
|
+
else if (r.out.trim() && !r.out.includes("nothing pending")) say(r.out.trim());
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function sim() {
|
|
342
|
+
const py = findPython();
|
|
343
|
+
if (!py) {
|
|
344
|
+
console.error("python 3 not found on PATH");
|
|
345
|
+
return 1;
|
|
346
|
+
}
|
|
254
347
|
const passArgs = args.slice(1);
|
|
255
348
|
const [exe, prefix] = py;
|
|
256
|
-
const res = spawnSync(exe, [...prefix,
|
|
349
|
+
const res = spawnSync(exe, [...prefix, SIM_SCRIPT, ...(passArgs.length ? passArgs : ["status"])], { stdio: "inherit", windowsHide: true });
|
|
257
350
|
return res.status ?? 1;
|
|
258
351
|
}
|
|
259
352
|
|
|
@@ -342,6 +435,7 @@ function update() {
|
|
|
342
435
|
const ok = report(results);
|
|
343
436
|
writeState({ ...state, version, lastResult: results, lastUpdate: new Date().toISOString() });
|
|
344
437
|
log(`${version}: ${results.map((r) => `${r.id}=${r.ok ? "ok" : "FAIL"} (${r.detail})`).join("; ")}`);
|
|
438
|
+
notifyUnapprovedRules();
|
|
345
439
|
return { code: ok ? 0 : 1 };
|
|
346
440
|
});
|
|
347
441
|
if (outcome.skipped) {
|
|
@@ -390,7 +484,7 @@ function uninstall() {
|
|
|
390
484
|
return 0;
|
|
391
485
|
}
|
|
392
486
|
|
|
393
|
-
const commands = { setup, init, gate, rules, net, "build-native": buildNative, update, doctor, uninstall, version: () => (console.log(version), 0), help: () => (console.log(HELP), 0) };
|
|
487
|
+
const commands = { setup, init, gate, rules, sim, net, "build-native": buildNative, update, doctor, uninstall, version: () => (console.log(version), 0), help: () => (console.log(HELP), 0) };
|
|
394
488
|
const handler = flag("version") ? commands.version : flag("help") || flag("h") ? commands.help : commands[cmd];
|
|
395
489
|
if (!handler) {
|
|
396
490
|
console.error(`Unknown command: ${cmd}\n\n${HELP}`);
|
|
@@ -3,30 +3,7 @@ use std::fs;
|
|
|
3
3
|
use std::path::PathBuf;
|
|
4
4
|
use std::process::ExitCode;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
let mut root = PathBuf::from(".");
|
|
8
|
-
let mut as_json = false;
|
|
9
|
-
let mut i = 0;
|
|
10
|
-
while i < args.len() {
|
|
11
|
-
match args[i].as_str() {
|
|
12
|
-
"check" => i += 1,
|
|
13
|
-
"--root" if i + 1 < args.len() => {
|
|
14
|
-
root = PathBuf::from(&args[i + 1]);
|
|
15
|
-
i += 2;
|
|
16
|
-
}
|
|
17
|
-
"--json" => {
|
|
18
|
-
as_json = true;
|
|
19
|
-
i += 1;
|
|
20
|
-
}
|
|
21
|
-
s if !s.starts_with("--") => {
|
|
22
|
-
root = PathBuf::from(s);
|
|
23
|
-
i += 1;
|
|
24
|
-
}
|
|
25
|
-
_ => i += 1,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let root = fs::canonicalize(&root).unwrap_or(root);
|
|
6
|
+
fn check(root: &std::path::Path) -> Vec<String> {
|
|
30
7
|
let agents_path = root.join("AGENTS.md");
|
|
31
8
|
let claude_path = root.join("CLAUDE.md");
|
|
32
9
|
let mut issues: Vec<String> = Vec::new();
|
|
@@ -53,6 +30,40 @@ pub fn run(args: &[String]) -> ExitCode {
|
|
|
53
30
|
Err(_) => issues.push("CLAUDE.md is missing".to_string()),
|
|
54
31
|
}
|
|
55
32
|
|
|
33
|
+
match fs::read_to_string(root.join(".omp/RULES.md")) {
|
|
34
|
+
Ok(txt) => {
|
|
35
|
+
let lines = txt.lines().count();
|
|
36
|
+
if lines > 120 {
|
|
37
|
+
issues.push(format!(".omp/RULES.md has {lines} lines (> 120 budget)"));
|
|
38
|
+
}
|
|
39
|
+
if !txt.contains("<!-- deepmodebot:begin") || !txt.contains("<!-- deepmodebot:end -->") {
|
|
40
|
+
issues.push(".omp/RULES.md missing managed deepmodebot block markers".into());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
Err(_) => issues.push(".omp/RULES.md is missing".into()),
|
|
44
|
+
}
|
|
45
|
+
issues
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
pub fn run(args: &[String]) -> ExitCode {
|
|
49
|
+
let mut root = PathBuf::from(".");
|
|
50
|
+
let mut as_json = false;
|
|
51
|
+
let mut args = args.iter();
|
|
52
|
+
while let Some(arg) = args.next() {
|
|
53
|
+
match arg.as_str() {
|
|
54
|
+
"check" => {}
|
|
55
|
+
"--root" => {
|
|
56
|
+
if let Some(path) = args.next() {
|
|
57
|
+
root = PathBuf::from(path);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
"--json" => as_json = true,
|
|
61
|
+
path if !path.starts_with("--") => root = PathBuf::from(path),
|
|
62
|
+
_ => {}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let issues = check(&root);
|
|
66
|
+
|
|
56
67
|
let ok = issues.is_empty();
|
|
57
68
|
if as_json {
|
|
58
69
|
let items: Vec<String> = issues.iter().map(|s| json_escape(s)).collect();
|
|
@@ -62,7 +73,7 @@ pub fn run(args: &[String]) -> ExitCode {
|
|
|
62
73
|
items.join(",")
|
|
63
74
|
);
|
|
64
75
|
} else if ok {
|
|
65
|
-
println!("dmb-gate agents [OK]: AGENTS.md and
|
|
76
|
+
println!("dmb-gate agents [OK]: AGENTS.md, CLAUDE.md and .omp/RULES.md in sync");
|
|
66
77
|
} else {
|
|
67
78
|
println!("dmb-gate agents [FAIL]:");
|
|
68
79
|
for iss in &issues {
|
|
@@ -75,3 +86,25 @@ pub fn run(args: &[String]) -> ExitCode {
|
|
|
75
86
|
ExitCode::from(1)
|
|
76
87
|
}
|
|
77
88
|
}
|
|
89
|
+
|
|
90
|
+
#[cfg(test)]
|
|
91
|
+
mod tests {
|
|
92
|
+
use super::*;
|
|
93
|
+
|
|
94
|
+
#[test]
|
|
95
|
+
fn checks_omp_rules_presence_markers_and_budget() {
|
|
96
|
+
let root = crate::tests::TestRepo::new("agents");
|
|
97
|
+
let markers = "<!-- deepmodebot:begin (managed) -->\n<!-- deepmodebot:end -->\n";
|
|
98
|
+
fs::write(root.0.join("AGENTS.md"), markers).unwrap();
|
|
99
|
+
fs::write(root.0.join("CLAUDE.md"), "@AGENTS.md\n").unwrap();
|
|
100
|
+
assert_eq!(check(&root.0), [".omp/RULES.md is missing"]);
|
|
101
|
+
fs::create_dir(root.0.join(".omp")).unwrap();
|
|
102
|
+
let rules = root.0.join(".omp/RULES.md");
|
|
103
|
+
fs::write(&rules, "unmanaged\n".repeat(121)).unwrap();
|
|
104
|
+
let issues = check(&root.0);
|
|
105
|
+
assert!(issues.iter().any(|s| s.contains("120 budget")));
|
|
106
|
+
assert!(issues.iter().any(|s| s.contains("missing managed")));
|
|
107
|
+
fs::write(&rules, markers).unwrap();
|
|
108
|
+
assert!(check(&root.0).is_empty());
|
|
109
|
+
}
|
|
110
|
+
}
|