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
@@ -46,7 +46,7 @@ Source: [customization-discovery](https://antigravity.google/docs/customization-
46
46
 
47
47
  - Subagent tools: `invoke_subagent` spawns concurrent child sessions with clean context (`Workspace`: `inherit` default, `branch` isolated git worktree, `share` shared working copy); `define_subagent` defines a session-scoped subagent; `send_message` (`Recipient`, `Message`) wakes an `Idle` subagent with its history intact; `manage_subagents` supports `list`, `kill`, and `kill_all` ([subagents](https://antigravity.google/docs/subagents)).
48
48
  - Built-in subagents: `research` (codebase exploration), `browser` (UI verification, screenshots, console and network inspection; `/browser`), and `self` (clone of the calling agent) ([subagents](https://antigravity.google/docs/subagents)).
49
- - Custom subagent files live in `.agents/agents/<name>.md` (or `<name>/agent.md`), `~/.gemini/config/agents/`, or plugin `agents/<name>.md` / `agents/<name>/agent.md`. In multi-harness plugins shared with omp or Claude Code, use `agents/<name>/agent.md` so Antigravity loads the subagent while omp and Claude Code (`agents/*.md`) ignore it and keep their own built-ins.
49
+ - Custom subagent files live in `.agents/agents/<name>.md` (or `<name>/agent.md`), `~/.gemini/config/agents/`, or plugin `agents/<name>.md` / `agents/<name>/agent.md`. Use flat `agents/*.md` in multi-harness plugins so Antigravity, omp, and Claude Code discover the same agents.
50
50
  - Frontmatter: `name` and `description` (required), `tools` (allowlist; `send_message` is always included), `mainAgent` (default `true`; selectable via `agy --agent <name>` or `/agents`), `subagent` (default `true`), `model` (`inherit` default, `flash_lite`, `flash`, `pro`), `commandExecutionPolicy` (`sandbox` default, `off`, `auto`, `eager`), `mcpServers`, `skills`, `plugins`, `inheritMcp` (`true`), and `inheritCustomizations` (`true`) ([subagents](https://antigravity.google/docs/subagents), [build-plugins](https://antigravity.google/docs/build-plugins)).
51
51
  - **Tool-name hang warning:** unmapped or misspelled names in `tools:` frontmatter can cause the subagent process to hang during execution. List only verified Antigravity tool names (or omit `tools:` to inherit the default set) ([subagents](https://antigravity.google/docs/subagents)).
52
52
  - Nesting is capped at 10 levels. Lifecycle states are `Running`, `Idle` (zero cost until messaged), and `Killed` (`kill` deletes temporary `branch`/`share` worktrees while retaining the JSONL transcript). CLI controls: `/agents`, `Alt+J` (jump to subagent awaiting approval), `Ctrl+K` (fast-path approve), `@<subagent>` (direct message), `/tasks` (`manage_task` for background shell jobs) ([subagents](https://antigravity.google/docs/subagents)).
@@ -100,7 +100,7 @@ Source: [customization-discovery](https://antigravity.google/docs/customization-
100
100
  - `skill://deepmodebot/...` URIs do not resolve natively: read files from `~/.gemini/config/plugins/deepmodebot/skills/<name>/` (or `.agents/plugins/deepmodebot/skills/<name>/`), or resolve them via `omp_resolve` on deepmodebot's bundled `omp` MCP server when omp is installed.
101
101
  - Bundled containment & auto-map guard (`hooks.json` -> `node ./scripts/antigravity-guard.mjs`): `PreInvocation` marks sessions whose `lastUserInput` starts with `/deep`, `/deepmodebot`, `/tournament`, `/review-pr`, `/land-pr`, `/pr-thread`, `/contribute`, or `/project-brief` (persisting marks in `PLUGIN_DATA` or `~/.gemini/antigravity/deepmodebot-guard`), and inside git repos auto-injects a fast offline git-only `workspace-map` overview (`--fast --offline --no-orca`, `<= 1200 B`, writing `<main-checkout>/.scratch/workspace-map.db`; skipped on `/review-pr` when no DB exists) via `injectSteps`.
102
102
  - `PreToolUse` denies file-tool writes outside the project root, main `.worktrees/`, `.deepmodebot.json` `extraWriteRoots`, and `artifactDirectoryPath`, always exiting `0` so it never fails open. Shell commands still require discipline.
103
- - Bundled subagents (`agents/scout/agent.md`, `agents/reviewer/agent.md`, `agents/security-reviewer/agent.md`): all three default to `model: flash` so scouts and read-only review waves never inherit flagship Carbon/Pro quota; omp `task` maps to `invoke_subagent` (`TypeName: "scout" | "reviewer" | "security-reviewer"` or `self` with `Model: "flash"` / `"flash_lite"` for panel verifiers; keep `Workspace: "inherit"` unless an isolated worktree is intended). Keep `tools:` lists restricted to verified Antigravity tool names so subagents never hang.
103
+ - Deepmodebot ships five flat `agents/*.md` definitions without harness-specific `model:` or `tools:`. In an active session, the `invoke_subagent` hook pins `scout` to `flash_lite` and `researcher`, `reviewer`, `security-reviewer`, and `comment-sicko` to `flash` when `Model` is omitted or `inherit`. It keeps explicit models, injects `worker.md`, and blocks nested spawns unless authorized. Select a specialist with `TypeName`; keep `Workspace: "inherit"` unless the slice needs isolation.
104
104
  - Bundled `omp` MCP bridge (`mcp_config.json` -> `node ./scripts/omp-mcp-server.mjs`, namespaced `deepmodebot_omp`, `timeoutSeconds: 600`): exposes `omp_run` (`omp -p --mode json` with stdin prompt delivery and per-call `timeoutSeconds` + process-tree kill), `omp_task` (concurrent dispatch; `scout`, `reviewer`, and `security-reviewer` default to `@smol`/`medium`, optional `model`/`thinking` override), and `omp_resolve` while stripping `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `OPENAI_API_KEY`, and `CODEX_API_KEY` by default so omp stays on its subscription login.
105
105
  - Unconfigured MCP tools default to `Ask` in Antigravity; add `mcp(deepmodebot_omp/*)` to `permissions.allow` before unattended `agy -p` runs so calls are not soft-denied.
106
106
  - CLI-only `~/.gemini/skills/` trap: stale copies in `~/.gemini/skills/` or `~/.gemini/antigravity-cli/skills/` outrank workspace `.agents/skills/` and plugins in `agy` while staying invisible in Antigravity App. Install via `agy plugin install` (`~/.gemini/config/plugins/`) or `.agents/skills/` instead.
@@ -3,7 +3,7 @@ name: deepmodebot
3
3
  description: "Hardcore Mode engineering orchestrator (/deep, Deepmodebot, non-trivial engineering): LLM autoroute, Confession + Adaptive Prosecutor, quota-safe delegation, real-app proof."
4
4
  hooks:
5
5
  PreToolUse:
6
- - matcher: "Write|Edit|NotebookEdit|Bash"
6
+ - matcher: "Write|Edit|NotebookEdit|Bash|Agent|Read|Grep|Glob|LS|NotebookRead"
7
7
  hooks:
8
8
  - type: command
9
9
  command: 'for f in "${CLAUDE_PLUGIN_ROOT:-/nonexistent}/skills/deepmodebot/assets/contain/claude-guard.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/skills/deepmodebot/assets/contain/claude-guard.sh" "$HOME/.claude/skills/deepmodebot/assets/contain/claude-guard.sh"; do if [ -f "$f" ]; then exec "${BASH:-bash}" "$f" enforce; fi; done; exit 0'
@@ -26,14 +26,16 @@ Applies to M/L and multi-item routes (Size **S** tracks its single item inline).
26
26
 
27
27
  `/deep <anything>` is the zero-human-thought autopilot across `agy`, `omp`, Claude Code, and Codex: the user never needs to pick subcommands (`/research`, `/suggest`, `/tournament`, `/grill`) or engineer prompts.
28
28
 
29
- **0. Decode intent & 1-shot pre-flight clarify (`assets/prompt-tools/prompt_tools.py clarify`).** Decode typos, shorthand, URLs/orgs, and compound asks automatically, and look up repo/doc/runtime facts yourself (never ask what tools can answer).
30
- Only when human intent has `2+` materially different product/scope outcomes or hits an irreversible boundary, ask **once upfront** (`1-3` `(Recommended)`-first choices via `ask_question` / `AskUserQuestion` / `ask` / `request_user_input`; pick `(Recommended)` in `-p` mode), then execute 100% end-to-end without mid-run hand-holding.
29
+ **0. Confirm intent before routing or acting.** Read the latest request and relevant prior decisions. Decode typos and shorthand. Inspect facts read-only when needed. Restate the target, requested deliverables, intended outcome, how to tell it was achieved, and what execution or publication the user authorized. A named method, metric, or tool is not automatically the goal. Keep every clause; treat an earlier decision as binding unless the user changes it.
30
+ Use `prompt_tools.py clarify` as a hint. Ask once only if the remaining interpretations would materially change the outcome or scope. Otherwise proceed with a stated assumption when it matters. In headless mode, choose a reversible default for ambiguity; stop at any unauthorized hard stop.
31
+ Use this intent statement for routing, scope, and evaluation. A prompt upgrade may clarify it, not expand it. Done when the planned work and success criteria match the original request and the user's latest correction.
31
32
 
32
33
  **1. Orient & auto-bootstrap.** Use Antigravity's hook-injected offline **workspace-map** overview if present; else run `python -B "<this skill>/assets/workspace-map/workspace_map.py" overview --fast --offline --no-orca` (`py -3 -B` on Windows; writes `<main-checkout>/.scratch/workspace-map.db`).
33
34
  On non-read-only sessions in an uninitialized repo, auto-run `python -B "<this skill>/assets/setup/project_setup.py" --root "<root>"` to create missing `.deepmodebot/ci.yml`, `.deepmodebot/policy.xml`, `.scratch/deepmode-memory.db`, and managed `AGENTS.md`/`CLAUDE.md` blocks (preserves user text; rewriting conflicting rules needs two owner yeses).
34
35
  Recall top project memories via `project_memory.py recall --root "<root>" --format xml --budget-tokens 600`. Skip `overview` and bootstrap on strictly read-only routes (`investigation`, local `pr-review`, `pr-thread`, `suggest`) when no DB exists. Run `query <term>` before broad greps; check `git remote`, `docs/PROJECT_BRIEF.md`, `STACK.md`, verify skills, and `gh repo view`. Outside/empty repo: Contain the work.
35
36
 
36
- **2. Route semantically & chain research/gaps (`references/techniques/autoroute.md`).** Run the 3-stage LLM router (`assets/autoroute/autoroute.py menu` → LLM JSON → `autoroute.py verify --strict`, or `autoroute.py route`) and `prompt_tools.py upgrade` on messy asks. Automatically chain **research** / **prior-art** (`gap_audit.py` + `trending.py` + `dmb-net`) when external SOTA/orgs/APIs apply and `deepmodebot gate gap` for repo drift/stubs; re-route mid-flight via `autoroute.py reroute`.
37
+ **2. Route semantically & chain research/gaps (`references/techniques/autoroute.md`).** Run the LLM router (`assets/autoroute/autoroute.py menu --json` → LLM JSON → `autoroute.py verify --strict --json`, or headless `autoroute.py route --json`). On `APPROVED`, open every `locked_plan.read_targets` entry in order. Pass the URIs verbatim in omp; elsewhere resolve them against the named skill's root.
38
+ Use `prompt_tools.py upgrade` on messy asks. Automatically chain **research** / **prior-art** (`gap_audit.py` + `trending.py` + `dmb-net`) when external SOTA/orgs/APIs apply and `deepmodebot gate gap` for repo drift/stubs; re-route mid-flight via `autoroute.py reroute`.
37
39
 
38
40
  **3. Size & delivery** (re-size if scope grows; delivery != size).
39
41
 
@@ -64,8 +66,9 @@ Outside writes allowed only for new repo folder, tool-managed state (`local://`/
64
66
  For **S**, only one-line restate, single-item scope check, real-artifact proof, and (if landing) S lane apply.
65
67
  - **Restate first** (goal, problem, smallest change) without waiting; track 100% scope (`references/full-scope.md`).
66
68
  - **Hardcore mode by default (`references/principles/hardcore-mode.md`):** build the first-principles architectural ceiling (real algorithms, solvers, parallelism, full integration) rather than stubs/toy MVPs unless asked.
67
- - **Zero reward hacking (`references/principles/no-reward-hacking.md`):** never weaken tests, zero thresholds (`--min-iou 0`), add `.skip`, or substitute procedural primitives (`create_cube`/`create_cone`) for real pipelines; lock gates/references, verify upstream provenance receipts (`job_id` + SHA-256), and pair scalar checks with an independent read-only critic (`deepmodebot gate reward`, `assets/reward-guard/reward_guard.py`).
68
- - **Owner-approved rules (`references/rule-approval.md`):** with `.deepmodebot/rules/ledger.json` present, never edit agent rule files (AGENTS.md, CLAUDE.md, `.cursor/rules/`, skills, agent settings; `assets/rules/rule-paths.json`); draft under `.scratch/`, run `assets/rules/rule_ledger.py propose`, and ask the owner to `deepmodebot rules review` + `approve`. Never run `rules init|approve|reject|rotate` or ask for the passphrase.
69
+ - **Zero reward hacking (`references/principles/no-reward-hacking.md`):** across all code, APIs, UIs, data/ML, and 3D, never weaken assertions/coverage/strictness, branch on `PYTEST_CURRENT_TEST`/`JEST_WORKER_ID` in prod, mock the SUT, add `.skip`/`--no-cov`/`continue-on-error`, or substitute stubs/primitives; lock gates first and pair checks with sealed `reward_guard.py run-judge` (`deepmodebot gate reward`).
70
+ - **Self-Improvement Memory on every harness edit (`references/techniques/sim.md`, arXiv:2611.18856):** before changing instructions, skills, hooks, gates, policy, or the loop, `sim.py read`, then `sim.py propose` (problem, edit + rationale, predicted fixes) before evaluating, then `sim.py record` the evolve-set outcome, misses included. `.deepmodebot/sim.json` is append-only and gate-enforced.
71
+ - **Owner-approved rules (`references/rule-approval.md`):** with `.deepmodebot/rules/ledger.json` in the repo or home (`~/.omp/agent`, `~/.claude`, `~/.codex`, `~/.gemini` hooks/skills/settings), never edit agent rule files (AGENTS.md, CLAUDE.md, `.cursor/rules/`, skills, agent settings; `assets/rules/rule-paths.json`); draft under `.scratch/`, run `rule_ledger.py propose [--user]`, and ask the owner to `deepmodebot rules review [--user]`. Never run `rules init|approve|reject` or edit the ledger.
69
72
  - **Name principles:** on M/L, add "Why I chose this" naming each read principle (`references/principles/`) that changed a decision.
70
73
  - **Prove on the real artifact (E2E Rehearsal Gate):** run the real app/CLI/service; tests alone are not proof. For E2E workflows (any app/tool/UI), grill & lock user intent first (`assets/e2e/rehearsal_gate.py init` + `approve`), record the full continuous video, watch the entire video together (never isolated frames alone), and iterate `v1..v25` until `rehearsal_gate.py verdict --strict` returns `REHEARSAL_PASSED`.
71
74
  - **Clarify once upfront, then decide autonomously:** repo/doc/code fact → look up yourself; empirical engineering fork → Prototype; genuine human-intent ambiguity (`2+` distinct user outcomes) → ask `1-3` `(Recommended)`-first choices once before coding, then drive to 100% completion with zero interruptions.
@@ -81,20 +84,25 @@ For **S**, only one-line restate, single-item scope check, real-artifact proof,
81
84
  - **Admin merge:** only on explicit land/merge ask or `"autonomousMerge": true`; `--admin` may bypass only a required review after exact-head panel pass, never failing checks or non-review rules.
82
85
  - **Decisions & hard stops:** pick smallest reversible codebase-consistent choice and log under "Decisions I made". Hard stops (batch once at end): force-push/history rewrite on shared/default branch; deleting others' branches/data; deploys/releases/publishing; external messages; bypassing forge protections; spending money; user-only credentials; outside-root writes; rewriting repo rule files (two owner yeses).
83
86
  - **Subscription, not API:** logged-in subscriptions only; unset all provider API key env vars in child processes. Tick waypoints and keep moving; say "no" when warranted.
84
- - **Subagents & quota (`references/delegation.md`, `assets/quota-guard/quota_guard.py`):** delegates own exclusive files and start briefs with `Read <this installed skill>/worker.md before anything else.`; never stack `/teamwork`/`/swarm` with multi-seat waves (`max_subagents=0` when nested); pin low-tier models (`flash`/`flash_lite`, `@smol`, `haiku`/`sonnet`, `gpt-6-luna`) for scouts, helpers, `reviewer`, `security-reviewer`, and `panel` verifiers (`2-4` turns, never `inherit` Carbon/Opus/Pro); keep `<=150`-line work inline; run 3-seat panel only at final merge SHA.
87
+ - **Subagents & quota (`references/delegation.md`):** Start each brief with `Read <this installed skill>/worker.md before anything else.` and give the worker exclusive files. omp loads `.omp/RULES.md` even when it drops `AGENTS.md`. Keep small work inline and reserve the three-seat panel for the final merge SHA.
88
+ - **Worker guards:** Use `assets/worker-gate/worker_gate.py` to initialize a slice and verify its receipt. Installed omp, Claude, and Antigravity hooks block unauthorized nested spawns and enforce configured slice fences on file tools. omp and Antigravity also inject the worker brief and route overhead specialists to low-cost tiers.
85
89
 
86
90
  ## Routes
87
91
 
88
- Techniques: `references/techniques/<name>.md`; playbooks: `references/playbooks/<file>.md`. Full 30-playbook / 70-technique / 26-principle catalog: `references/catalog.md`.
92
+ Look up route paths in `autoroute.py menu --json` or `references/catalog.md`. Open the verified `locked_plan.read_targets` from Step 2; don't construct paths from bare names.
89
93
 
90
94
  - **PRs, releases & migrations:** review PR / "review since <ref>" → **pr-review**; land own PR → **pr-conversation**; aging/stale PR → **modernize-pr**; bot issue work → **issue-conversation**; bots on own sub → **github-app**; get green → `babysit`; security gate → **security-audit** (`static_sec_audit.py` + **variant-analysis**); run pr-agent → **pr-agent**; zero-downtime DB/API cutover → **expand-contract**; post-deploy canary & release docs → **release-and-canary**.
91
95
  - **Contributing & repos:** read-only repo → `skill://contribute`; publish for helpers → `skill://project-brief`; repo setup → `setup`; DX/CLI onboarding audit → **devex-review**; triage → `triage`; spec → `spec`; tickets → `tickets`; implement spec/sprints → `phased-build`; full project → `end-to-end`.
92
96
  - **Queues, goals & orientation:** `factory.json`/board/PR queue → `work-a-queue`; session/program goal → `run-a-goal`; vague goal → **goal-review** → `self-authoring`; harden checks/anti-slop → **inner-loop**; index repo/worktrees/PRs/symbols → **workspace-map**; foggy multi-session → `wayfinder`; handoff → `handoff`.
93
97
  - **Prompts, audits & checks:** LLM router → **autoroute**; upgrade prompt → **prompt-upgrade**; expert words / problem disambiguation → **reframe**; founder/ambition check → **product-lens**; scan repo gaps/overclaims → **suggest**; grill plan → **grill**; "are you sure" / gaps / overclaims → **self-grill** (`bundle` Prosecutor); kill weak tests / fuzz → **mutation-testing**; stuck → `bug-fix` + **self-grill**; blast radius → **blast-radius**; deepen → **sharpen**.
94
98
  - **Formal proofs & statecharts:** Lean/Rocq/TLA+/SMT/Claim-DAGs → **formal-verification** (`verify_proof.py`); TLA+ model + Mermaid statechart → `skill://statechart`; author/maintain project formal verify skill → `skill://create-formal-verification-skill` / `skill://maintain-formal-verification-skill`.
95
- - **Design, stack, SEO & Office docs:** open gaps/vague ambition → **tournament**; 2+ shapes → **architect**; contested design → **interrogate**; new app → **prior-art** (`scripts/trending.py`) → `skill://deep-stack` → `end-to-end`; SEO/GEO/`llms.txt`/Schema.org/Agentic Browsing → `skill://seo-and-geo` (`seo_audit.py`); `.xlsx`/`.pptx`/`.docx`/`.pdf` → `skill://office-documents` (`doc_audit.py`); catch up → **recall** (video → **catchup-video**); glossary/ADR → **domain-model**; research → `skill://research` (**research**); SME → **sme-review** / **questionnaire**.
96
- - **UI, E2E, perf & media:** A2UI (`a2ui.org`) / cockpit → **gen-ui**; webhook/Tailscale bot UI → **webhook-ui**; E2E full-video rehearsal gate (`v1..v25`, `REHEARSAL.md`) → `assets/e2e/rehearsal_gate.py` + **visual-e2e**; Penpot/editable design → **open-design-evidence**; backend/DB/API slowness, N+1, pools, hot loops → `perf-issue` (`assets/perf-audit/perf_audit.py` + **benchmark-checklist** + `skill://domain-rules`); video breakdown (`rea-video`/`VIDEO.md`) → **video-forensics**.
97
- - **Build, CI, slop & memory:** parallel gates (`deepmodebot gate slop|reward|ci|perf|ui|seo|docs|sec|cleanup|agents|skill-check|map|guard|gap`; `native/dmb-net`: `trending|pr-overlap|fetch-papers|webhook`) with Python fallbacks (`local_ci.py`, `slop_gate.py`, `reward_guard.py`, `gap_audit.py`, `project_memory.py`, `project_setup.py --install-hooks`); model & budget → **model-setup** (`model_setup.py`); TDD → **tdd**; comments → **no-comments**; prose → **unslop** + **technical-writing**; garden → **correct**; fan-out → **swarm**/**arena**; port → `refactoring`.
99
+ - **Design, stack & SEO:** open gaps or vague ambition → **tournament**; 2+ shapes → **architect**; contested design → **interrogate**; new app → **prior-art** (`scripts/trending.py`) → `skill://deep-stack` → `end-to-end`; SEO/GEO, `llms.txt`, Schema.org, and agentic browsing → `skill://seo-and-geo` (`seo_audit.py`).
100
+ - **Docs & domain:** `.xlsx`/`.pptx`/`.docx`/`.pdf` → `skill://office-documents` (`doc_audit.py`); catch up → **recall** (video → **catchup-video**); glossary/ADR → **domain-model**; research → `skill://research` (**research**); SME → **sme-review** / **questionnaire**.
101
+ - **UI, E2E & design evidence:** A2UI (`a2ui.org`) / cockpit → **gen-ui**; webhook/Tailscale bot UI → **webhook-ui**; E2E full-video rehearsal gate (`v1..v25`, `REHEARSAL.md`) → `assets/e2e/rehearsal_gate.py` + [`visual-e2e`](references/techniques/visual-e2e.md); Penpot/editable design → **open-design-evidence**.
102
+ - **Perf & media:** backend/DB/API slowness, N+1, pools, hot loops → `perf-issue` (`assets/perf-audit/perf_audit.py` + **benchmark-checklist** + `skill://domain-rules`); video breakdown (`rea-video`/`VIDEO.md`) → **video-forensics**.
103
+ - **Build, CI, slop & memory:** parallel gates (`deepmodebot gate slop|reward|sim|ci|perf|ui|seo|docs|sec|cleanup|agents|skill-check|map|guard|gap`); `native/dmb-net`: `trending|pr-overlap|fetch-papers|webhook`. Bootstrap with `project_setup.py --install-hooks`; see `references/catalog.md` for tools and fallbacks.
104
+ - **Gate fallbacks:** `local_ci.py`, `slop_gate.py`, `reward_guard.py`, `sim.py`, `gap_audit.py`, and `project_memory.py`.
105
+ - **Build & maintenance techniques:** model and budget → **model-setup** (`model_setup.py`); TDD → **tdd**; comments → **no-comments**; prose → **unslop** + **technical-writing**; garden → **correct**; fan-out → **swarm**/**arena**; port → `refactoring`.
98
106
  - **Skills, rules & meta:** edit `SKILL.md` → `authoring-a-skill` (**writing-for-agents** first); edit `AGENTS.md`/`CLAUDE.md`/brief → **writing-for-agents** (`assets/agents-md/agents_md.py`); prompt/loop → `self-authoring`; specialist (`tool-routing`, `git-guardrails`, `pre-commit`, `scrape`, `architecture-review`, `wizard`, `course`, `re-explain`, `reflect`, `retro`, `tracker`, `agent-collaboration`) → named technique.
99
107
  ## Playbooks & Principles
100
108
 
@@ -1,16 +1,14 @@
1
1
  #!/usr/bin/env python3
2
- """Generate or refresh a repo's AGENTS.md and CLAUDE.md (deepmodebot "writing-for-agents" technique).
2
+ """Generate or refresh a repo's AGENTS.md, CLAUDE.md, and sticky .omp/RULES.md.
3
3
 
4
4
  python agents_md.py build [path] [--overwrite] [--dry-run]
5
5
  python agents_md.py check [path]
6
6
  python agents_md.py user [--write]
7
7
 
8
8
  AGENTS.md is the one home for the rules. CLAUDE.md imports it with `@AGENTS.md`, because Claude Code reads
9
- CLAUDE.md, not AGENTS.md. build writes a managed block between deepmodebot markers and keeps everything outside it;
10
- running it again refreshes the block in place. --overwrite replaces both whole files after copying the old ones to
11
- <root>/.scratch/agents-md-backup/<timestamp>/. The block holds the finish-line rule, the repo's real check commands
12
- (from `loop.py audit`), and where scratch files go.
13
- check exits 1 when either file lacks the current block, so a stale block fails a repo check.
9
+ CLAUDE.md, not AGENTS.md. omp `task` workers load .omp/RULES.md instead. build refreshes only the managed blocks;
10
+ --overwrite replaces all three files after backing them up under <root>/.scratch/agents-md-backup/<timestamp>/.
11
+ check exits 1 when any managed block is missing or stale.
14
12
  user previews the finish-line block for ~/.claude/CLAUDE.md, which Claude Code loads in every project; --write adds
15
13
  it. That file is the user's own config: write it only on the user's explicit yes.
16
14
  """
@@ -50,7 +48,7 @@ FINISH_LINE = """## Finish line
50
48
  4. Passing tests or a working demo mean "this part works", not "the request is done".
51
49
  5. When you shrink or skip a part, say so at that moment, not in a caveats list at the end.
52
50
  6. When asked "are we done?", answer with the list first.
53
- 7. Hitting a metric by weakening a check, skipping a reference, or substituting primitive stand-ins is reward hacking, not done.
51
+ 7. Passing a check by weakening tests/types/thresholds, stubbing the system under test, overwriting snapshots, or faking outputs is reward hacking, not done.
54
52
  """
55
53
 
56
54
 
@@ -86,12 +84,38 @@ def repo_block(report, root=None):
86
84
  if has_ci or has_policy:
87
85
  lines.append("- Project memory DB: `.scratch/deepmode-memory.db` (SQLite WAL+FTS5); recall compact XML via "
88
86
  "`project_memory.py recall --format xml --budget-tokens 800`.")
87
+ if root and os.path.isfile(os.path.join(root, ".deepmodebot", "sim.json")):
88
+ lines.append("- Self-Improvement Memory (arXiv:2611.18856): before editing harness files (agent instructions, skills, "
89
+ "hooks, gates, policy), run `<deepmodebot skill>/assets/sim/sim.py read`, cite or open a problem with "
90
+ "`sim.py propose` (edit, rationale, predicted fixes) before evaluating, then `sim.py record` the "
91
+ "evolve-set outcome, misses included. `.deepmodebot/sim.json` is append-only; the slop gate blocks "
92
+ "harness edits without a new attempt.")
89
93
  lines.append("")
90
94
  return "\n".join(lines)
91
95
  def wrap(body):
92
96
  return f"{BEGIN}\n{body.rstrip()}\n{END}\n"
93
97
 
94
98
 
99
+ def omp_rules_block(report, root=None):
100
+ layers = report["layers"]
101
+ lines = [
102
+ "- Execute inline: 0 child spawns unless kickoff authorizes a model tier and cap. Read the installed `worker.md` for role rules.",
103
+ "- Edit only assigned `owned_files`; escalate shared contract changes to the coordinator. Keep narration, banner, and workaround comments out of code.",
104
+ "- Zero reward hacking: keep assertions, types, coverage, and thresholds strict; verify the real system and preserve provenance.",
105
+ "- Keep all writes inside the project. Set `TMPDIR`, `TMP`, and `TEMP` to `<root>/.scratch/tmp/`; keep worktrees in `<main>/.worktrees/` and run Python with `-B`.",
106
+ ]
107
+ for label, key in (("Repo fast checks", "static_checks"), ("Repo tests", "test_checks"),
108
+ ("Live proof", "runtime_verify")):
109
+ if layers[key]:
110
+ lines.append(f"- {label}: {code_list(layers[key])}.")
111
+ if not layers["runtime_verify"]:
112
+ lines.append("- Live proof: run the real app, CLI, or service path.")
113
+ lines.append("- Run scoped checks on your slice; leave whole-repo checks to the build owner in parallel work.")
114
+ if root and os.path.isfile(os.path.join(root, ".deepmodebot", "sim.json")):
115
+ lines.append("- Before harness edits, read `sim.py read` output and stage `sim.py propose` or use the coordinator's staged attempt. Record the outcome with `sim.py record` when you own the attempt.")
116
+ return wrap("\n".join(lines))
117
+
118
+
95
119
  def upsert(text, block):
96
120
  """Replace the managed block in text, or append it. Text outside the markers is kept byte for byte."""
97
121
  if "<!-- deepmodebot:begin" in text and not BLOCK_RE.search(text):
@@ -104,9 +128,12 @@ def upsert(text, block):
104
128
 
105
129
 
106
130
  def safe_target(root, name):
107
- path = os.path.join(root, name)
108
- if os.path.islink(path):
109
- raise SystemExit(f"{name} is a symlink; refusing to write through it")
131
+ path = root
132
+ is_junction = getattr(os.path, "isjunction", lambda _: False)
133
+ for part in name.split("/"):
134
+ path = os.path.join(path, part)
135
+ if os.path.islink(path) or is_junction(path):
136
+ raise SystemExit(f"{path} is a symlink or junction; refusing to write through it")
110
137
  return path
111
138
 
112
139
 
@@ -124,12 +151,14 @@ def write(path, text):
124
151
 
125
152
 
126
153
  def planned(root, overwrite):
127
- """Return {file name: (path, current text, wanted text)} for AGENTS.md and CLAUDE.md."""
128
- agents_block = wrap(repo_block(audit_repo(root), root=root))
154
+ """Return {file name: (path, current text, wanted text)} for each managed instruction file."""
155
+ report = audit_repo(root)
156
+ agents_block = wrap(repo_block(report, root=root))
129
157
  claude_block = wrap("@AGENTS.md")
130
158
  plan = {}
131
159
  for name, block, title in (("AGENTS.md", agents_block, "# Agent instructions"),
132
- ("CLAUDE.md", claude_block, "# Claude Code")):
160
+ ("CLAUDE.md", claude_block, "# Claude Code"),
161
+ (".omp/RULES.md", omp_rules_block(report, root=root), "# Sticky worker rules")):
133
162
  path = safe_target(root, name)
134
163
  current = read(path)
135
164
  if overwrite:
@@ -147,10 +176,11 @@ def backup(root, plan):
147
176
  ignore = os.path.join(root, ".scratch", ".gitignore")
148
177
  if not os.path.exists(ignore):
149
178
  write(ignore, "*\n")
150
- for name, (path, current, _) in plan.items():
179
+ for name, (path, _, _) in plan.items():
151
180
  if os.path.exists(path):
152
- os.makedirs(folder, exist_ok=True)
153
- shutil.copy2(path, os.path.join(folder, name))
181
+ dest = os.path.join(folder, name)
182
+ os.makedirs(os.path.dirname(dest), exist_ok=True)
183
+ shutil.copy2(path, dest)
154
184
  return folder
155
185
 
156
186
 
@@ -174,11 +204,12 @@ def run_build(opts):
174
204
 
175
205
  def run_check(opts):
176
206
  root = project_root(opts.path)
177
- stale = [name for name, (_, current, wanted) in planned(root, False).items() if wanted != current]
207
+ plan = planned(root, False)
208
+ stale = [name for name, (_, current, wanted) in plan.items() if wanted != current]
178
209
  for name in stale:
179
210
  print(f"{name}: missing or stale deepmodebot block; run `agents_md.py build`")
180
211
  if not stale:
181
- print("AGENTS.md and CLAUDE.md: up to date")
212
+ print(f"{', '.join(plan)}: up to date")
182
213
  return 1 if stale else 0
183
214
 
184
215
 
@@ -203,11 +234,11 @@ def run_user(opts):
203
234
  def main():
204
235
  parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
205
236
  sub = parser.add_subparsers(dest="action", required=True)
206
- build = sub.add_parser("build", help="create or refresh AGENTS.md and CLAUDE.md")
237
+ build = sub.add_parser("build", help="create or refresh the managed instruction files")
207
238
  build.add_argument("path", nargs="?", default=".")
208
239
  build.add_argument("--overwrite", action="store_true", help="replace whole files, backing up the old ones")
209
240
  build.add_argument("--dry-run", action="store_true", help="print the files and write nothing")
210
- check = sub.add_parser("check", help="exit 1 when either file lacks the current block")
241
+ check = sub.add_parser("check", help="exit 1 when a managed instruction block is missing or stale")
211
242
  check.add_argument("path", nargs="?", default=".")
212
243
  user = sub.add_parser("user", help="preview, or --write, the finish-line block in ~/.claude/CLAUDE.md")
213
244
  user.add_argument("--write", action="store_true")
@@ -270,18 +270,12 @@ def discover_live_catalog(root: Path | None = None) -> dict:
270
270
  "summary": _first_summary_line(smd),
271
271
  }
272
272
 
273
- all_modes: dict[str, dict] = {}
274
- all_modes.update(playbooks)
275
- all_modes.update(techniques)
276
- all_modes.update(references)
277
- all_modes.update(sibling_skills)
278
-
279
273
  return {
280
274
  "playbooks": playbooks,
281
275
  "techniques": techniques,
282
276
  "references": references,
283
277
  "sibling_skills": sibling_skills,
284
- "all_modes": all_modes,
278
+ "local_modes": {**playbooks, **techniques, **references},
285
279
  }
286
280
 
287
281
 
@@ -354,19 +348,20 @@ def build_menu_packet(prompt: str, root: Path | None = None) -> dict:
354
348
  clarification = prompt_tools.analyze_ambiguity(cleaned, root=safe_root)
355
349
  compact_playbooks = [f"{k} (route_file: {v['file']}): {v['summary']}" for k, v in catalog["playbooks"].items()]
356
350
  compact_techniques = [f"{k} (route_file: {v['file']}): {v['summary']}" for k, v in catalog["techniques"].items()]
357
- compact_ref_skills = [f"{k} (route_file: {v['file']}): {v['summary']}" for k, v in catalog["sibling_skills"].items()]
351
+ compact_references = [f"{k} (route_file: {v['file']}): {v['summary']}" for k, v in catalog["references"].items()]
352
+ compact_ref_skills = [f"{v['file']} (route_file: {v['file']}): {v['summary']}" for v in catalog["sibling_skills"].values()]
358
353
 
359
354
  minimal_opt_out = has_minimal_opt_out(cleaned)
360
355
  hardcore_default = not minimal_opt_out
361
356
  hardcore_system_hit = bool(HARDCORE_SYSTEM_RE.search(cleaned))
362
357
 
363
358
  schema = {
364
- "decoded_intent": "1-sentence semantic restatement of what the user actually wants",
359
+ "decoded_intent": "The user's objective, observable success evidence, and allowed delivery boundary",
365
360
  "deliverables": ["1. concrete deliverable", "2. ..."],
366
- "primary_mode": "exact mode name from Playbooks, Techniques, or Sibling Skills",
361
+ "primary_mode": "exact mode name from Playbooks, Techniques, References, or qualified skill://<name> from Sibling Skills",
367
362
  "route_file": "exact route_file from the catalog",
368
363
  "secondary_techniques": ["optional companion technique names, e.g. self-grill, no-comments, security-audit"],
369
- "reference_skills": ["optional skill://<name> URIs from Reference & Sibling Skills"],
364
+ "reference_skills": ["optional skill://<name> URIs from Sibling Skills"],
370
365
  "size": "S | M | L | none",
371
366
  "self_grill": "none | plan | checks | both",
372
367
  "hardcore_mode": hardcore_default,
@@ -386,6 +381,9 @@ def build_menu_packet(prompt: str, root: Path | None = None) -> dict:
386
381
  "and choose the best primary_mode, companion techniques, reference_skills, size, and self_grill mode purely from "
387
382
  "semantic understanding against the live catalog below (never naive keyword matching).\n"
388
383
  "Routing guidance:\n"
384
+ "- Decide the user's intended outcome before choosing a mode. Preserve the distinction between what "
385
+ "they want, how they suggested doing it, and what they authorized. A proxy is not the outcome. "
386
+ "Do not expand the task or infer permission to publish, deploy, send, or spend from an indirect goal.\n"
389
387
  "- Hardcore Mode is ON by default: aim straight for the first-principles architectural ceiling and promote any "
390
388
  "'(Optional hardcore mode)' tier into a mandatory deliverable unless the user explicitly asked for a minimal fix or throwaway prototype.\n"
391
389
  "- Read-only/discovery/audit modes (investigation, runtime-forensics, trace-forensics, pr-review, grill, self-grill, "
@@ -402,7 +400,8 @@ def build_menu_packet(prompt: str, root: Path | None = None) -> dict:
402
400
  f"Live repo facts:\n{json.dumps(repo_facts, indent=2)}\n\n"
403
401
  f"Playbooks ({len(compact_playbooks)}):\n- " + "\n- ".join(compact_playbooks) + "\n\n"
404
402
  f"Techniques ({len(compact_techniques)}):\n- " + "\n- ".join(compact_techniques) + "\n\n"
405
- f"Reference & Sibling Skills ({len(compact_ref_skills)}):\n- " + "\n- ".join(compact_ref_skills) + "\n\n"
403
+ f"References ({len(compact_references)}):\n- " + "\n- ".join(compact_references) + "\n\n"
404
+ f"Sibling Skills ({len(compact_ref_skills)}):\n- " + "\n- ".join(compact_ref_skills) + "\n\n"
406
405
  f"Required JSON schema:\n{json.dumps(schema, indent=2)}"
407
406
  )
408
407
 
@@ -426,6 +425,7 @@ def build_menu_packet(prompt: str, root: Path | None = None) -> dict:
426
425
  "catalog_counts": {
427
426
  "playbooks": len(catalog["playbooks"]),
428
427
  "techniques": len(catalog["techniques"]),
428
+ "references": len(catalog["references"]),
429
429
  "sibling_skills": len(catalog["sibling_skills"]),
430
430
  },
431
431
  "decision_schema": schema,
@@ -433,28 +433,19 @@ def build_menu_packet(prompt: str, root: Path | None = None) -> dict:
433
433
  }
434
434
 
435
435
 
436
- def _validate_route_file(route_file: str, expected_file: str, primary: str, all_modes: dict, sibling_skills: dict) -> str | None:
436
+ def _validate_route_file(route_file: str, primary: str, mode: dict) -> str | None:
437
+ expected_file = mode["file"]
437
438
  if route_file == expected_file:
438
439
  return None
439
- if route_file.startswith("skill://"):
440
- rest = route_file.removeprefix("skill://")
441
- parts = [p for p in rest.split("/") if p]
442
- if not parts:
443
- return f"invalid skill URI {route_file!r}"
444
- sname = parts[0]
445
- if sname != primary:
446
- return f"route_file {route_file!r} does not match primary_mode {primary!r} (expected {expected_file!r})"
447
- base_dir = SKILL_DIR if sname == SKILL_DIR.name else (sibling_skills.get(sname) or {}).get("dir")
448
- if base_dir is None:
449
- return f"route_file {route_file!r} names non-existent skill {sname!r}"
450
- if len(parts) > 1:
451
- sub_target = (base_dir / "/".join(parts[1:])).resolve()
452
- try:
453
- sub_target.relative_to(base_dir.resolve())
454
- except ValueError:
455
- return f"route_file {route_file!r} escapes skill root"
456
- if not sub_target.is_file():
457
- return f"route_file {route_file!r} does not exist on disk"
440
+ if expected_file.startswith("skill://") and route_file.startswith(expected_file + "/"):
441
+ base_dir = mode["dir"].resolve()
442
+ sub_target = (base_dir / route_file[len(expected_file) + 1:]).resolve()
443
+ try:
444
+ sub_target.relative_to(base_dir)
445
+ except ValueError:
446
+ return f"route_file {route_file!r} escapes skill root"
447
+ if not sub_target.is_file():
448
+ return f"route_file {route_file!r} does not exist on disk"
458
449
  return None
459
450
  return f"route_file {route_file!r} does not match primary_mode {primary!r} (expected {expected_file!r})"
460
451
 
@@ -469,7 +460,7 @@ def verify_decision(
469
460
  repo_facts = gather_repo_facts(root)
470
461
  safe_root = Path(repo_facts["root"]) if repo_facts.get("has_root") else None
471
462
  catalog = discover_live_catalog(root=safe_root)
472
- all_modes = catalog["all_modes"]
463
+ local_modes = catalog["local_modes"]
473
464
  techniques = catalog["techniques"]
474
465
  sibling_skills = catalog["sibling_skills"]
475
466
 
@@ -478,18 +469,22 @@ def verify_decision(
478
469
  auto_repairs: dict = {}
479
470
 
480
471
  raw_primary = str(decision.get("primary_mode", "")).strip()
481
- primary = raw_primary.removeprefix("skill://") if raw_primary.startswith("skill://") else raw_primary
482
- if primary not in all_modes:
483
- violations.append(f"unknown primary_mode {raw_primary!r}: must match a live playbook, technique, or sibling skill")
484
-
485
- expected_file = all_modes[primary]["file"] if primary in all_modes else ""
472
+ primary = raw_primary.removeprefix("skill://")
486
473
  route_file = str(decision.get("route_file", "")).strip()
487
- if primary in all_modes:
474
+ sibling = sibling_skills.get(primary)
475
+ sibling_uri = f"skill://{primary}"
476
+ if raw_primary == sibling_uri or route_file == sibling_uri or route_file.startswith(sibling_uri + "/"):
477
+ mode = sibling
478
+ else:
479
+ mode = local_modes.get(primary) or sibling
480
+ if mode is None:
481
+ violations.append(f"unknown primary_mode {raw_primary!r}: must match a live playbook, technique, reference, or sibling skill")
482
+ else:
488
483
  if not route_file:
489
- route_file = expected_file
490
- auto_repairs["route_file"] = expected_file
484
+ route_file = mode["file"]
485
+ auto_repairs["route_file"] = route_file
491
486
  else:
492
- rf_err = _validate_route_file(route_file, expected_file, primary, all_modes, sibling_skills)
487
+ rf_err = _validate_route_file(route_file, raw_primary, mode)
493
488
  if rf_err:
494
489
  violations.append(rf_err)
495
490
 
@@ -499,9 +494,6 @@ def verify_decision(
499
494
  sec_list: list[str] = []
500
495
  else:
501
496
  sec_list = [str(x).strip() for x in (raw_sec or []) if str(x).strip()]
502
- for tech in sec_list:
503
- if tech not in techniques:
504
- violations.append(f"unknown secondary_technique {tech!r}: not found in references/techniques/")
505
497
 
506
498
  raw_refs = decision.get("reference_skills")
507
499
  if raw_refs is not None and not isinstance(raw_refs, list):
@@ -561,9 +553,10 @@ def verify_decision(
561
553
  if not isinstance(deliverables, list) or not deliverables:
562
554
  violations.append("deliverables must be a non-empty list covering full request scope")
563
555
 
564
- decoded_intent = str(decision.get("decoded_intent", "")).strip()
556
+ raw_intent = decision.get("decoded_intent")
557
+ decoded_intent = raw_intent.strip() if isinstance(raw_intent, str) else ""
565
558
  if not decoded_intent:
566
- violations.append("decoded_intent cannot be empty")
559
+ violations.append("decoded_intent must be a nonblank string")
567
560
 
568
561
  sensitive_prompt = bool(SENSITIVE_RE.search(prompt)) if prompt else False
569
562
  sensitive_diff = bool(repo_facts.get("diff_sensitive_paths"))
@@ -634,6 +627,11 @@ def verify_decision(
634
627
  warnings.append(f"recommended secondary_techniques omitted for {size} work: {missing_sec}")
635
628
  auto_repairs["add_secondary_techniques"] = missing_sec
636
629
 
630
+ final_sec = sorted(set(sec_list) | set(auto_repairs.get("add_secondary_techniques", [])))
631
+ for tech in final_sec:
632
+ if tech not in techniques:
633
+ violations.append(f"unknown secondary_technique {tech!r}: not found in references/techniques/")
634
+
637
635
  if violations:
638
636
  status = "REJECTED"
639
637
  elif critic_reasons:
@@ -647,7 +645,7 @@ def verify_decision(
647
645
  critic_prompt = (
648
646
  f"You are the Adversarial Route Critic (round {next_round} of 2). Attack the proposed route decision below. "
649
647
  "Check: (1) based on what the user literally typed, does a more specific playbook or technique fit better than primary_mode? "
650
- "(2) did deliverables drop any clause from the user prompt? "
648
+ "(2) did the decoded intent or deliverables drop a user goal, substitute a proxy, or widen authorization? "
651
649
  "(3) are size, self_grill, secondary_techniques, and reference_skills accurate and safe? "
652
650
  "Output ONLY the corrected full JSON decision with \"critic_reviewed\": true.\n\n"
653
651
  f"Original prompt: {prompt}\n"
@@ -669,7 +667,12 @@ def verify_decision(
669
667
  model_tier, effort = "M", "medium"
670
668
 
671
669
  final_refs = sorted(set(ref_list) | set(auto_repairs.get("add_reference_skills", [])))
672
- final_sec = sorted(set(sec_list) | set(auto_repairs.get("add_secondary_techniques", [])))
670
+ if status == "APPROVED":
671
+ read_targets = list(dict.fromkeys([
672
+ route_file if route_file.startswith("skill://") else f"skill://deepmodebot/{route_file}",
673
+ *(f"skill://deepmodebot/{techniques[t]['file']}" for t in final_sec),
674
+ *final_refs,
675
+ ]))
673
676
  qg = _load_sibling("ar_quota_guard", "quota-guard/quota_guard.py")
674
677
  outer_harness = qg.detect_outer_harness(root=safe_root)
675
678
  lean_quota = bool(decision.get("lean_mode")) or (bool(LEAN_QUOTA_RE.search(prompt)) if prompt else False)
@@ -697,10 +700,12 @@ def verify_decision(
697
700
  "auto_repairs": auto_repairs,
698
701
  "critic_prompt": critic_prompt,
699
702
  "locked_plan": {
703
+ "decoded_intent": decoded_intent,
700
704
  "primary_mode": primary,
701
705
  "route_file": route_file,
702
706
  "secondary_techniques": final_sec,
703
707
  "reference_skills": final_refs,
708
+ "read_targets": read_targets,
704
709
  "size": size,
705
710
  "self_grill": self_grill_mode,
706
711
  "hardcore_mode": hardcore_mode,
@@ -7,6 +7,7 @@
7
7
  # claude-guard.sh enforce PreToolUse, always on (the deepmodebot skill's frontmatter hook)
8
8
  # claude-guard.sh if-active <data-dir> PreToolUse, only in sessions marked active (the plugin's hooks.json)
9
9
  # claude-guard.sh activate <data-dir> UserPromptSubmit: mark the session when the prompt runs /deepmodebot:
10
+ # claude-guard.sh session-notice SessionStart: tell the owner about agent rule changes they have not approved
10
11
  # DEEPMODEBOT_GUARD_PYTHONS names the interpreters to try (default "python3 python"); the tests use it.
11
12
  here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
13
  mode="${1:-enforce}"
@@ -29,6 +30,9 @@ input="$(cat)"
29
30
  session="$(printf '%s' "$input" | sed -n 's/.*"session_id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | tr -cd 'A-Za-z0-9_-')"
30
31
  mark="$data/active-sessions/$session"
31
32
  case "$mode" in
33
+ session-notice)
34
+ echo '{"systemMessage": "deepmodebot: no Python 3.8+ on PATH, so it cannot check your agent rules for changes you have not approved."}'
35
+ exit 0 ;;
32
36
  activate)
33
37
  if [ -n "$data" ] && [ -n "$session" ] &&
34
38
  printf '%s' "$input" | grep -Eq '"prompt"[[:space:]]*:[[:space:]]*"([[:space:]]|\\[nrt])*/deepmodebot:'; then