riskrails 3.0.1 → 3.1.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 (62) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/README.md +28 -15
  5. package/ai/policies/model-routing.md +7 -7
  6. package/ai/policies/production.md +3 -3
  7. package/ai/policies/release.md +2 -2
  8. package/ai/policies/review-economy.md +27 -30
  9. package/bin/riskrails.js +5 -5
  10. package/hooks/context-guard.py +1 -1
  11. package/hooks/guard/common.py +2 -0
  12. package/hooks/guard/paths.py +41 -30
  13. package/hooks/project-scaffold.py +1 -5
  14. package/hooks/runtime-gate.py +6 -6
  15. package/hooks/update_notice.py +20 -14
  16. package/instructions/routing.md +1 -1
  17. package/instructions/stub.md +3 -3
  18. package/package.json +1 -1
  19. package/skills/AGENTS.md +1 -1
  20. package/skills/CLAUDE.md +1 -1
  21. package/skills/ai-init/templates/.ai/AGENTS.md +1 -1
  22. package/skills/ai-init/templates/.ai/VERSION +1 -1
  23. package/skills/ai-init/templates/.ai/policies/security.md +7 -1
  24. package/skills/ai-init/templates/.ai/policies/testing.md +19 -6
  25. package/skills/ai-init/templates/AGENTS.block.md +2 -2
  26. package/skills/ai-init/templates/CLAUDE.block.md +2 -2
  27. package/skills/ai-init/templates/GEMINI.block.md +2 -2
  28. package/skills/ai-init/templates/gitignore.snippet +1 -0
  29. package/skills/ai-init/templates/junie-guidelines.block.md +2 -2
  30. package/skills/ai-task/sensors.py +24 -4
  31. package/skills/ai-task/state.py +37 -14
  32. package/skills/project-init/templates/constitution.md +1 -1
  33. package/skills/project-init/templates/sdlc-README.md +20 -14
  34. package/skills/project-update/history/blobs/00289f98434fed230eebe768dfb3425f83d737866a3aebc97aa95167c4fa0c6e +131 -0
  35. package/skills/project-update/history/blobs/079a91f976ad69b5cf49ccb9a28849576e4735ddd9485fc26599e528a69fd2f4 +30 -0
  36. package/skills/project-update/history/blobs/07ff7fa6f93d471ff533f553b4e523e4105ccde1f3dab70132c5237728f68422 +13 -0
  37. package/skills/project-update/history/blobs/0ef4a360c76da290173dea0f8073949cb0f8113710a38df95acae5d96bdd1286 +123 -0
  38. package/skills/project-update/history/blobs/18c7a2753ce9cb6f6d3d1e9d5d1125d75950b879d56b7325225b200869631b29 +15 -0
  39. package/skills/project-update/history/blobs/25d4f2a86deb5e2574bb3210b67bb24fcc4afb19f93a7b65a057daa874a9d18e +1 -0
  40. package/skills/project-update/history/blobs/48d9950f16e31d55475f566a80dc95f64b35f1c804d2f51729e313a4f29bac8d +13 -0
  41. package/skills/project-update/history/blobs/5a93f78b4ed4d416c171139b2ce610a117f9c1dd46fbb56ca86729cb4c53d10c +6 -0
  42. package/skills/project-update/history/blobs/6a3be0e624e5ad91e44d08857b7183ee53b7903e1e8d56ff196dbc9dde271e4a +75 -0
  43. package/skills/project-update/history/blobs/7170553410bba904ffb7edb4b231e3b3579b85542d84de717299980938f82c9d +13 -0
  44. package/skills/project-update/history/blobs/774b1e3a04ef0d49d33c44a2cfecd92eb6f6b738a12b6a681103ba7fc13e7b86 +67 -0
  45. package/skills/project-update/history/blobs/7f063e79195a5c85c37b7260dd20c184d3b9bea85e37202e0bbca73ad84bba49 +13 -0
  46. package/skills/project-update/history/blobs/c8573ca1f810ce6c4ac49456a4c1725b93e0d3b74c54ce95d46d8747777895f0 +13 -0
  47. package/skills/project-update/history/blobs/d6e5b34d475e7187d2a8cb2aac7e7f1a427142baf6461bda387d70ceb4d8a8c1 +30 -0
  48. package/skills/project-update/history/blobs/e120ff4e32b2e950fc94ada4e787d57dc9c790da37223e5a202d74f7e3aadf80 +13 -0
  49. package/skills/project-update/history/index.json +36 -15
  50. package/skills/project-update/migrations/0011_retire_risk_tiers.py +37 -0
  51. package/skills/project-update/migrations/__init__.py +6 -1
  52. package/skills/project-update/render_instructions.py +1 -1
  53. package/skills/project-update/update.py +374 -87
  54. package/skills/rr-build-all/SKILL.md +2 -2
  55. package/skills/rr-plan/SKILL.md +3 -1
  56. package/skills/rr-review/SKILL.md +13 -8
  57. package/skills/rr-setup/SKILL.md +15 -2
  58. package/skills/rr-setup/setup.py +7 -1
  59. package/skills/rr-spec/SKILL.md +4 -2
  60. package/skills/usage-report/usage-report.py +4 -2
  61. package/skills/ai-init/templates/.ai/policies/risk-tiers.json +0 -628
  62. package/skills/ai-init/templates/.ai/policies/risk-tiers.md +0 -180
@@ -1,180 +0,0 @@
1
- <!-- generated from risk-tiers.json sha256:80cf708a42ad6d7851f4063e0d9127b850f274dcb6633c9a9773d01173d437f8 -->
2
- <!-- If /ai-status reports this hash as stale, risk-tiers.json changed and this
3
- mirror did not. The JSON file is the source of truth; update this by hand. -->
4
-
5
- # Risk tiers
6
-
7
- Every task gets exactly one tier before anything is planned. The tier decides
8
- three things: who plans it, who reviews it, and whether a human signs it off.
9
-
10
- The tier is the **scope** of a change — what it reaches — never its size. How
11
- many files or lines it touches is measured and reported by the diff budget; it
12
- does not classify. Three questions settle most cases: does it change a process
13
- that other code runs through (T4 at least)? does it touch money, identity or
14
- customer data (T5)? is it irreversible (T6)? Adding a resource and the screens
15
- that present it, without changing an existing process, is T3.
16
-
17
- | Tier | What it covers | Plan reviewed | Human approves the plan | Adversarial review | Security review | Human approves the release |
18
- |---|---|---|---|---|---|---|
19
- | **T0** | documentation, comments, translations with no logic | no | no | no | no | no |
20
- | **T1** | formatting, a label, a template or stylesheet change with no logic | no | no | no | no | no |
21
- | **T2** | an isolated admin screen or form, a new field, a grid column or filter, a small feature that changes no existing process | no | no | the sensors; a BALANCED model only when one is red | no | no |
22
- | **T3** | CRUD and presentation: a new resource with its entity, repository, form, grid, routes, menu and translations; a non-critical API extension; a new service with limited reach | no | no | the sensors; a BALANCED model only when one is red | no | no |
23
- | **T4** | shared domain behaviour and processes: shared services, orders, workflows, async processing, an important integration, a schema migration that adds to a table, configuration and dependencies | no — the human reviews it in plan mode | yes | yes, on STRONG | when auth or personal data is touched | yes |
24
- | **T5** | payments, accounting, tax, fiscal, authentication, authorization, order state transitions, customer data, external financial systems | yes | yes | yes | yes | yes |
25
- | **T6** | migration strategy, infrastructure, Kubernetes, production deployment, data migration, destructive schema change, cross-system migration | yes | yes | yes | yes | yes |
26
-
27
- ## Which model works on it
28
-
29
- The tier is the contract; which model it resolves to depends on the runtime the
30
- session is in. The pipeline, the gates and the obligations below are identical
31
- either way.
32
-
33
- | Tier | Plans and reviews on |
34
- |---|---|
35
- | T0, T1 | the session, directly; readers on FAST |
36
- | T2, T3 | the session plans; BALANCED reviews, and only when a sensor is red |
37
- | T4 | the session plans in plan mode; STRONG reviews the diff |
38
- | T5 | STRONG |
39
- | T6 | EXPERT — `ai-expert` |
40
-
41
- Which model a tier is comes from the installed plan, per runtime: `state.py profile
42
- --tier <TIER>` prints it, and `/ai-status` shows all four.
43
-
44
- Under Codex an agent's own file outranks the model asked for when it is spawned,
45
- so the STRONG re-runs of `ai-risk` and `ai-planner` use the dedicated
46
- `ai-risk-strong` and `ai-planner-strong` agents. Same tier, same trigger.
47
-
48
- Report the model that actually ran, not the one that was requested: a rate-limit
49
- gate may have moved an agent down a tier.
50
-
51
- Escalation is per task and one step at a time. The triggers are listed in
52
- `risk-tiers.json`; the short version is that a cheap agent which returns thin,
53
- contradictory or empty evidence gets escalated, and nothing starts expensive
54
- "just in case".
55
-
56
- A tier can be raised by anyone at any moment. Lowering one is a human decision,
57
- written into the task record with the reason.
58
-
59
- ## Who does each stage: the pipeline profile
60
-
61
- `pipeline_profile` in `risk-tiers.json` decides who runs a stage, never whether
62
- it runs. Every tier keeps its `stages_required`; the profile says which of them
63
- go to a subagent. The default `solo` profile has two modes:
64
-
65
- - **direct** (T0–T4): no pipeline ceremony. The session names the files, edits,
66
- runs the step's own tests, then the verification command once at the end,
67
- then the e2e suite once after it, and fixes every failure as one batch. T0/T1
68
- keep no state file at all; T2 to T4 are one `state.py quick` call that arms
69
- the scope guard and one `state.py close` at the end. The only subagents are
70
- cheap readers (`Explore`, `log-reader` on FAST) and, at T2 and T3, one
71
- `ai-reviewer` on BALANCED over the diff when `state.py review-gate` finds a
72
- red sensor — all green is the review. T4 is the same path with three
73
- additions: the plan is written in plan mode and the human approves it before
74
- any edit, characterization tests come first, and the one review is on
75
- STRONG. No `ai-planner`, no plan-review agent, no `ai-release`.
76
- - **sdlc** (T5–T6): the full pipeline, recorded stage by stage, with the plan,
77
- plan review, adversarial review, security review and release report delegated
78
- to the STRONG and EXPERT tiers as the table says.
79
-
80
- | Tier | `solo` (default) delegates | `team` delegates |
81
- |---|---|---|
82
- | T0, T1 | nothing — direct mode, no state file: say which files, edit, verify (T1) | discovery (and the test run at T1) |
83
- | T2, T3 | the adversarial review, on BALANCED, only when a sensor is red; the plan is three to five lines in the conversation | every stage except implementation |
84
- | T4 | the adversarial review, on STRONG; the plan is written in plan mode by the session and approved by the human | every stage except implementation |
85
- | T5 | plan, plan review, adversarial review, security review, release report | every stage except implementation |
86
- | T6 | discovery and impact as well; the plan goes to `ai-expert` | every stage except implementation |
87
-
88
- Tests run in three scopes, and never more often than that. **Inside a step**:
89
- only the tests the plan named for that step, through `step_test_command` scoped
90
- to the files it touched — never the full suite, never e2e; those failures are
91
- fixed in the step, before `state.py step-done`. **After the last step**: the
92
- full fast suite, `verify_command`, once, to the end, with no fail-fast flag —
93
- every failure is collected and classified first, every new regression is fixed
94
- in **one** remediation step (`state.py remediate`), and the command runs once
95
- more. At most two rounds, then the human decides: `sensors.tests.max_suite_runs`
96
- is 2, and a third `state.py test-run --scope suite` exits 6. **At the end of the task**,
97
- after the fast suite is green: `e2e_command`, once — never per step, skipped at
98
- T0/T1 and whenever the change cannot reach an e2e-covered flow, which is said
99
- in one line. Review findings are handled the same way as test failures: one
100
- batch, one scoped re-review only when a blocker was fixed. A bugfix still shows
101
- its failing test first.
102
-
103
- In `solo` the session still delegates one `ai-discovery` when the area is
104
- unfamiliar or the plan depends on an `UNKNOWN`, `ai-risk` on STRONG when a T4+
105
- classification is not obvious, and `log-reader` when the verification output is
106
- long. The triggers are listed under `delegate_anyway_when`.
107
-
108
- ## Diff budget, scopes and sensors
109
-
110
- A tier is a prediction made before the work; the diff is what the work turned out
111
- to be. `state.py step-done` measures the step and the task against `diff_budget`
112
- and checks the task against `path_scopes`. Neither moves the tier: size is
113
- reported and a path scope is a hint.
114
-
115
- | | per step | per task |
116
- |---|---|---|
117
- | T0 | 300 lines / 15 files | 600 / 30 |
118
- | T1 | 120 / 5 | 300 / 10 |
119
- | T2 | 200 / 8 | 400 / 15 |
120
- | T3 | 250 / 10 | 800 / 30 |
121
- | T4 | 250 / 10 | 800 / 30 |
122
- | T5 | 150 / 6 | 400 / 15 |
123
- | T6 | 150 / 6 | 400 / 15 |
124
-
125
- Lock files, snapshots, minified and generated files are excluded; the `docs`
126
- scope is counted and reported but not budgeted. The budget is **advisory**:
127
- over it, `step-done` finishes the step and warns, naming
128
- `state.py step-split <id> --files …` as the way to a smaller review, and the
129
- re-score leaves the tier alone. Size never decides whether the sensors may
130
- stand in for a reader, and `diff_budget.enforce` is read and ignored, `true`
131
- included. A file outside the step's `allowed_files` is `SCOPE_CHANGE_REQUIRED`,
132
- as it has always been.
133
-
134
- `path_scopes` is ordered and the first match wins, which is why `pipeline` and
135
- `dependencies` stand above `docs` and `tests` above `payments`. A scope's
136
- `min_tier` is a **hint**, not a floor: every scope that changes a process —
137
- `pipeline`, `dependencies`, `migrations`, `config` — says T4, a change reaching
138
- `**/Payment/**` or `**/Security/**` says T5, and infrastructure says T6. When
139
- the task's tier sits below it, `step-done` prints `hint: payments
140
- (src/Payment/X.php) — path_scopes says T5; tier unchanged` once per scope and
141
- leaves the tier where it is. Raising it is `state.py risk`; `downgrade_rule`
142
- means a human lowers one, in writing, and `state.py risk`/`triage` refuses a
143
- lowering that no human asked for.
144
-
145
- ### When the sensors replace the review
146
-
147
- At T3 and below, when every sensor in `required_for_skip` is green or
148
- explicitly not applicable — the suite passed on this exact tree, the required
149
- tests fail without the change (`bite`) and the task's tier is T3 or lower,
150
- whatever its size — the model review is replaced by the
151
- sensor set, and `state.py review-gate` records `review_status: skipped_green`.
152
- This is the intent's decision 6; `review-economy.md` carries the reasoning.
153
-
154
- A sensor is green only when it measured something. A missing `lint_command` is
155
- `unavailable` and blocks the skip; only `lint_command: none`, written by a
156
- human in `testing.md`, counts as not applicable. `sensors.py detect` proposes
157
- the line and never runs the tool it detected.
158
-
159
- A project whose `risk-tiers.json` still describes six tiers (no `T6`) is read
160
- on its own scale — its direct-mode cap stays T3 and its review skip stays at T2
161
- — until `/project-update` renumbers it.
162
-
163
- ## Extra obligations by tier
164
-
165
- - **T4 and above**: characterization tests come before any change to legacy behaviour,
166
- and the plan names the rollback.
167
- - **T4 is not a small T5.** It runs in direct mode; the delegated plan, the
168
- plan-review agent, the security review (unless auth or personal data is
169
- touched) and `ai-release` start at T5.
170
- - **T5**: the release report must have a rollback section and a monitoring section,
171
- and the plan must state the idempotency and retry behaviour explicitly.
172
- - **T6**: migration analysis covering locks, table size, duration, deployment
173
- ordering and old-version compatibility; a rehearsed rollback, not a described
174
- one; and destructive operations need their own separate approval that names
175
- the operation.
176
-
177
- ## When the tier is not obvious
178
-
179
- Take the higher one. The cost of an unnecessary review is a few minutes; the
180
- cost of an unreviewed payment change is not.