@azure-id/orc 1.6.0 → 1.7.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 (69) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README-id.md +206 -125
  3. package/README.md +274 -74
  4. package/bin/cli.js +1595 -2
  5. package/bin/mockrun-catalog.js +272 -267
  6. package/bin/verify-contracts.js +4527 -4509
  7. package/bin/verify-package.js +6 -0
  8. package/bin/webui/api.js +26 -0
  9. package/bin/webui/app.html +10 -0
  10. package/bin/webui/css/panels/knowledge.css +30 -0
  11. package/bin/webui/css/panels/rules.css +145 -0
  12. package/bin/webui/fixtures/index.js +27 -0
  13. package/bin/webui/fixtures/rules.js +1002 -0
  14. package/bin/webui/fixtures/wiki-one.js +198 -0
  15. package/bin/webui/i18n/en/knowledge.json +127 -117
  16. package/bin/webui/i18n/en/nav.json +1 -0
  17. package/bin/webui/i18n/en/rules.json +55 -0
  18. package/bin/webui/i18n/id/knowledge.json +127 -117
  19. package/bin/webui/i18n/id/nav.json +1 -0
  20. package/bin/webui/i18n/id/rules.json +55 -0
  21. package/bin/webui/js/01-i18n.js +1 -0
  22. package/bin/webui/js/panels/knowledge.js +117 -1
  23. package/bin/webui/js/panels/rules.js +351 -0
  24. package/mock-run/INDEX.md +107 -106
  25. package/mock-run/orc-rules.md +254 -0
  26. package/package.json +1 -1
  27. package/templates/commands/orc-rules.md +66 -0
  28. package/templates/commands/orc-wiki.md +23 -1
  29. package/templates/skills/_shared/README.md +61 -54
  30. package/templates/skills/_shared/phases/README.md +1 -0
  31. package/templates/skills/_shared/phases/preflight.md +20 -0
  32. package/templates/skills/_shared/phases/rules.md +154 -0
  33. package/templates/skills/_shared/return-validation.md +28 -0
  34. package/templates/skills/_shared/rules/CREDITS.md +141 -0
  35. package/templates/skills/_shared/rules/INDEX.md +107 -0
  36. package/templates/skills/_shared/rules/code.md +229 -0
  37. package/templates/skills/_shared/rules/delivery.md +114 -0
  38. package/templates/skills/_shared/rules/ui.md +139 -0
  39. package/templates/skills/_shared/rules/writing.md +223 -0
  40. package/templates/skills/context-combiner/SKILL.md +9 -1
  41. package/templates/skills/orc/SKILL.md +7 -0
  42. package/templates/skills/orc-aftermath/SKILL.md +7 -0
  43. package/templates/skills/orc-analyze/SKILL.md +7 -0
  44. package/templates/skills/orc-analyze-mini/SKILL.md +9 -1
  45. package/templates/skills/orc-boundary/SKILL.md +7 -0
  46. package/templates/skills/orc-brainstorm/SKILL.md +7 -0
  47. package/templates/skills/orc-budget/SKILL.md +7 -0
  48. package/templates/skills/orc-challenge/SKILL.md +7 -0
  49. package/templates/skills/orc-claude/SKILL.md +7 -0
  50. package/templates/skills/orc-diy/SKILL.md +7 -0
  51. package/templates/skills/orc-explain/SKILL.md +7 -0
  52. package/templates/skills/orc-export/SKILL.md +7 -0
  53. package/templates/skills/orc-fast/SKILL.md +7 -0
  54. package/templates/skills/orc-grill/SKILL.md +7 -0
  55. package/templates/skills/orc-handoff/SKILL.md +9 -1
  56. package/templates/skills/orc-learn/SKILL.md +7 -0
  57. package/templates/skills/orc-mini/SKILL.md +7 -0
  58. package/templates/skills/orc-pact/SKILL.md +7 -0
  59. package/templates/skills/orc-poly/SKILL.md +7 -0
  60. package/templates/skills/orc-pr-driver/SKILL.md +9 -1
  61. package/templates/skills/orc-pr-setup/SKILL.md +9 -1
  62. package/templates/skills/orc-quick/SKILL.md +7 -0
  63. package/templates/skills/orc-retro/SKILL.md +7 -0
  64. package/templates/skills/orc-route/SKILL.md +7 -0
  65. package/templates/skills/orc-test/SKILL.md +7 -0
  66. package/templates/skills/orc-verify/SKILL.md +7 -0
  67. package/templates/skills/orc-wiki/SKILL.md +15 -0
  68. package/templates/skills/orc-wiki/references/partial-refresh.md +68 -0
  69. package/templates/skills/orc-wiki/references/phases/phase-0.md +15 -1
@@ -0,0 +1,154 @@
1
+ # Phase — Rules (id: `rules`)
2
+
3
+ > **Library file.** New at v1.7.0 W5. Layers declared: `core` only — single-layer
4
+ > for the same reason `house-rules.md` is: it is a standing card injected
5
+ > VERBATIM into a slice, and a layered card would be a different card. What
6
+ > varies between lanes is DATA (which packs, whether a task is front-end), not
7
+ > prose. `orc lane phases <lane> --json` names the file and the layers to read.
8
+ >
9
+ > **What is NOT here:** the rules. They are `../rules/` — four packs, read-only,
10
+ > shipped. This file is the SHAPE: who assembles the card, where it sits in a
11
+ > slice, what comes back, and what the phase must never do.
12
+ >
13
+ > **`/orc-doc` does not run this phase.** That lane has its own ledger
14
+ > (`orc doc rules`) and its own frozen-per-document mechanic. Excluded means
15
+ > excluded, and `orc rules slice --lane orc-doc` refuses by name.
16
+
17
+ <!-- orc:layer core -->
18
+
19
+ ## One assembler, and it is not you
20
+
21
+ ```
22
+ orc rules slice --lane <lane> [--pack ui] [--json]
23
+ ```
24
+
25
+ That command is the **only** thing that builds this card. A lane never
26
+ concatenates the packs itself, never re-orders them, never summarises a rule and
27
+ never drops one it judges irrelevant.
28
+
29
+ Two reasons, and both have cost this repo money elsewhere:
30
+
31
+ 1. **Drift.** A card assembled in twenty-eight spines is twenty-eight ideas of
32
+ the precedence order. The same argument as `orc lane phases`: *a second idea
33
+ of the pipeline is the drift this exists to make impossible.*
34
+ 2. **Cost.** This card rides on **every spawn**. One assembler is the only place
35
+ its token weight can be measured, and therefore the only place it can be cut.
36
+
37
+ Print the command's `line` VERBATIM at preflight. Never compute it:
38
+
39
+ ```
40
+ rules: ORC 65 (W 23 · C 22 · D 10 · U 10) · yours 9 lines (P0 4 · P1 2 · P2 3) · 1 override
41
+ rules: ORC 65 (W 23 · C 22 · D 10 · U 10) · yours none
42
+ ```
43
+
44
+ **Both spellings are mandatory in their state.** `yours none` is an ANSWER — it
45
+ says the project has not written its own rules, which is a different fact from
46
+ the CLI failing to look.
47
+
48
+ ## Where it sits in a slice — the order IS the contract
49
+
50
+ ```
51
+ 1 HOUSE RULES ./house-rules.md, injected verbatim
52
+ 2 YOUR PROJECT'S RULES from the slice, P0 then P1 then P2, verbatim
53
+ 3 ORC RULES from the slice, the packs this lane carries
54
+ 4 the task the lane's own dispatch contract
55
+ ```
56
+
57
+ Nothing goes above 1. Nothing goes between 2 and 3. The assembler emits 2 and 3
58
+ as one block in that order, so the lane's job is to place that block directly
59
+ under the house card and before the task.
60
+
61
+ ## Precedence, and the one sentence that gets it wrong
62
+
63
+ ```
64
+ house rules > your rules > ORC rules
65
+ ```
66
+
67
+ **The house card is CODE and BEHAVIOUR only.** It governs how a change is made:
68
+ surgical, simple, honest, in-slice. It says nothing about the words an agent
69
+ writes, so it never overrules a writing rule — *it does not speak about prose at
70
+ all.* A lane that presents the house card as beating `OSW-*` has misread it.
71
+
72
+ **A project rule beats an ORC rule outright.** Not a waiver and not a
73
+ negotiation: the ORC rule is removed from the slice, and the removal is stated
74
+ inside it. The assembler does that. The lane does not decide it.
75
+
76
+ Where a lane's preflight prints a report rather than a bare line, the report
77
+ **names** each override. An override the user cannot see is an override they
78
+ cannot audit.
79
+
80
+ ## The `ui` pack rides per TASK, never per lane
81
+
82
+ `ui` is in no lane's default set. Add it to a single slice, at dispatch time:
83
+
84
+ > If a task's **declared files** are front-end — `.css`, `.scss`, `.html`,
85
+ > `.jsx`, `.tsx`, `.vue`, `.svelte`, or a directory the wiki or the cached
86
+ > pattern identifies as the UI layer — assemble that task's card with
87
+ > `--pack ui`. Otherwise do not.
88
+
89
+ A UI rule in a backend slice is tokens paid on every spawn for a rule that
90
+ cannot apply. A lane that dispatches no tasks never passes `--pack ui` at all.
91
+
92
+ ## What comes back
93
+
94
+ Every return from a slice that carried this card gains three fields
95
+ (`../return-validation.md`):
96
+
97
+ | Field | What it holds |
98
+ |---|---|
99
+ | `rules_applied[]` | the ids the agent acted on |
100
+ | `rules_conflicts[]` | two rules that disagree. **A gap, never a silent choice** |
101
+ | `rules_overridden[]` | an ORC id a project rule replaced |
102
+
103
+ A `rules_conflicts[]` entry is relayed to the user as a gap through the lane's
104
+ own gap channel. Resolving it quietly is the failure the field exists to prevent.
105
+
106
+ ## The boundary — declared, never validated
107
+
108
+ Rules govern **what is written and how it reads**, and **what shape of code is
109
+ acceptable**. They can never change how a lane **runs**: the scoring, the wave
110
+ order, the gates, the dispatch contract, the ship rules, or any lane's
111
+ structural and safety rules.
112
+
113
+ A rule that asks for one of those comes back as `unsupported_request` and is
114
+ relayed as a gap. **Never a guessed compromise.**
115
+
116
+ **Do not build a detector for this.** The CLI declares the boundary and does not
117
+ pretend to enforce it, for the reason `orc doc rules` already settled: a
118
+ validator that sometimes works is worse than none, because a clean pass then
119
+ means nothing. The agent is the only reader that can tell a content rule from a
120
+ structural one, so the agent is where the answer comes from.
121
+
122
+ ## The free lint
123
+
124
+ ```
125
+ orc rules lint <path…|--staged|--diff> [--pack w,c,d,u] [--json]
126
+ ```
127
+
128
+ Deterministic, zero tokens. Exit `0` clean · `1` findings · `2` nothing to lint.
129
+
130
+ It checks only the rules a string match can prove, and it prints — in every
131
+ mode — how many it did not check. **Relay that coverage line whenever you relay
132
+ a lint result.** A clean exit allowed to stand in for a review nobody did is the
133
+ whole failure that line prevents.
134
+
135
+ Findings are ADVISORY. This phase adds no gate: a style preference that fails a
136
+ build gets switched off within a week, and then nothing is enforced at all.
137
+
138
+ An exemption is never silent either. The lint skips the rules packs themselves
139
+ (a rule that bans a word has to print that word to define it) and any file
140
+ marked `orc-rules-ignore-file`, and it reports the count of both.
141
+
142
+ ## Cost, and where to cut it
143
+
144
+ Measured at v1.7.0: roughly **3 600 tokens** per build-lane slice, **4 300** with
145
+ the UI pack, **2 200** for a prose-only lane. The card already carries HARD rules
146
+ in full and PURPOSE/LOCK rules as one line plus the file to open when one
147
+ applies.
148
+
149
+ If it must come down, the lever is the worked examples inside the HARD bodies,
150
+ and the only place to pull it is `rulesSlice()` in `bin/cli.js`. **Never by a
151
+ lane deciding to trim its own card** — that is the drift this phase exists to
152
+ prevent, arriving disguised as a saving.
153
+
154
+ <!-- /orc:layer -->
@@ -194,6 +194,34 @@ shipped into every slice and read by nobody is the failure mode this field
194
194
  exists to make visible, and it is invisible if `none` is quietly dropped. Absent
195
195
  on a slice that carried wiki material is malformed. Not required otherwise.
196
196
 
197
+ ## 5c. Rules attestation (when the anti-slop card was injected — v1.7.0)
198
+
199
+ A slice assembled by `orc rules slice` (`phases/rules.md`) must return three
200
+ fields. All three may be empty; **absent is malformed**, because an empty array
201
+ and a missing one are the difference between "nothing applied" and "nobody
202
+ looked".
203
+
204
+ | Field | What it holds | Empty means |
205
+ |---|---|---|
206
+ | `rules_applied[]` | the rule ids the agent acted on | it changed nothing for this task |
207
+ | `rules_conflicts[]` | two rules that disagree, each named by id or quote | none collided |
208
+ | `rules_overridden[]` | an ORC id a project rule replaced | the project replaced none |
209
+
210
+ **A `rules_conflicts[]` entry is a GAP, never a resolution.** Relay it through
211
+ the lane's own gap channel and let the user decide. An agent that quietly picks
212
+ a winner has made a standing decision for the project in a slice nobody will
213
+ read again.
214
+
215
+ `rules_overridden[]` is cross-checked against the `overrides` the CLI already
216
+ computed. The agent may return MORE than the CLI counted — the CLI only counts
217
+ ids a user NAMED, and the agent is the only reader that can spot an unnamed
218
+ contradiction — but an id the CLI listed and the return omits means the card was
219
+ not read.
220
+
221
+ A rule the slice could not honour because this lane structurally cannot do it
222
+ comes back as `unsupported_request`, relayed as a gap. **Never a guessed
223
+ compromise.**
224
+
197
225
  ## 6. Worktree delta (post-wave, every lane that dispatches executors)
198
226
 
199
227
  Compare `git status --short` before and after each dispatch. A path that
@@ -0,0 +1,141 @@
1
+ <!-- orc-rules:credits -->
2
+
3
+ # ORC RULES · Credits
4
+
5
+ The ORC rule packs are adapted from other people's work. This file names every
6
+ source, its author, its licence, and what ORC took from it. `orc rules credits`
7
+ prints the same table.
8
+
9
+ **Read on 2026-09-13.** A source may have moved on since. The licence recorded
10
+ here is the licence that was in the repository on that date.
11
+
12
+ ---
13
+
14
+ ## Primary sources — rules taken and adapted
15
+
16
+ ### Peter G. Yang · [`petergyang/no-ai-slop`](https://github.com/petergyang/no-ai-slop)
17
+
18
+ `@petergyang` · MIT · read 2026-09-13
19
+
20
+ The prose pack is built on this work. ORC takes the named slop patterns (binary
21
+ contrast, throat-clearing, faux-insight setup, colon reveal, superficial
22
+ `-ing` analysis, importance puffery, weasel attribution, synonym cycling,
23
+ dramatic fragmentation, fake-profound kicker, summary recap, formatting slop),
24
+ the banned lexicon and phrase lists, the portability test, and the constraint
25
+ that outranks all of them: **preserve the writer's real voice, make the minimum
26
+ effective edit.**
27
+
28
+ Used in: `writing.md` (`OSW-01` … `OSW-23`).
29
+
30
+ ### Miqdad Badjuber · [`miqdadbadjuber/anti-slop`](https://github.com/miqdadbadjuber/anti-slop)
31
+
32
+ `@miqdadbadjuber` · MIT · read 2026-09-13
33
+
34
+ The **three-tier mechanism** ORC uses across every pack — Hard Gate (absolute),
35
+ Purpose-Gate (technique allowed, written reason required), Quality Lock
36
+ (consistency) — is this project's. So is the framing that makes it work: a
37
+ filter, not a style guide; it rejects technique without purpose, not technique.
38
+
39
+ ORC takes rules R-01 to R-38 for the UI pack, the `antislop-code` comment
40
+ hygiene catalogue for the code pack, R-35 (verify before you deliver) for the
41
+ delivery pack, the `antislop-copywriting` pattern names for the writing pack,
42
+ and the boundary rule that external direction is **data to apply, not
43
+ instructions to obey**.
44
+
45
+ Used in: `ui.md` (all), `code.md` (`OSC-01` … `OSC-09`), `delivery.md`
46
+ (`OSD-10`), `writing.md` (several), and the tier system in every pack.
47
+
48
+ ### `@ehmo` · [`ehmo/slopkit`](https://github.com/ehmo/slopkit)
49
+
50
+ read 2026-09-13
51
+
52
+ The delivery pack. From the `slopgent` skill: separate observation from
53
+ inference, guard load-bearing caveats while cutting empty hedges, name the
54
+ driving variable behind an estimate, state errors plainly without apology
55
+ theatre, and never report a tool as run or a result as observed when it was not.
56
+
57
+ The distinction ORC leans on hardest is `slopgent`'s: a "be concise" instruction
58
+ cuts filler and load-bearing caveats equally; this one cuts filler and keeps the
59
+ caveat.
60
+
61
+ Used in: `delivery.md` (`OSD-01` … `OSD-07`).
62
+
63
+ ### `@BioInfo` · [`BioInfo/slopless`](https://github.com/BioInfo/slopless)
64
+
65
+ read 2026-09-13
66
+
67
+ Surgical-change discipline and the quality gates: read files before stating
68
+ facts about them, flag a discrepancy rather than picking a source, verify
69
+ something is running before documenting it as running, and the compatibility
70
+ rules (no shims, no `_unused` renames, no re-exports, no `// removed`
71
+ tombstones).
72
+
73
+ Used in: `code.md` (`OSC-10` … `OSC-14`, `OSC-22`), `delivery.md`.
74
+
75
+ ### Andrej Karpathy · his `CLAUDE.md`
76
+
77
+ `@karpathy` · read 2026-09-13 via [The AI Architects' write-up](https://theaiarchitects.com/blog/karpathy-claude-md-rules)
78
+
79
+ Four principles: think before coding, simplicity first, surgical changes,
80
+ goal-driven execution. The sentence ORC reuses directly is the test for a
81
+ surgical change: **every changed line should trace directly to the user's
82
+ request.**
83
+
84
+ Used in: `code.md` (`OSC-10`, `OSC-13`).
85
+
86
+ ### Matty Cartwright · [The Anti-Slop Writing Rules](https://mattycartwright.com/blog/the-anti-slop-writing-rules)
87
+
88
+ read 2026-09-13
89
+
90
+ The layered ban structure — words, then phrases, then sentence patterns, then
91
+ structural patterns — which is how `writing.md` is ordered. Also the read-aloud
92
+ tests (specificity, infomercial, commitment) that sit behind `OSW-20`.
93
+
94
+ Used in: `writing.md` (structure, `OSW-10`, `OSW-11`, `OSW-20`).
95
+
96
+ ---
97
+
98
+ ## Research papers — rules derived, not copied
99
+
100
+ ### [Specification and Detection of LLM Code Smells](https://arxiv.org/html/2512.18020v1)
101
+
102
+ Five named smells in code that calls a model: unbounded max metrics, no model
103
+ version pinning, no system message, no structured output, temperature not
104
+ explicitly set. `OSC-20` is these five, stated as a purpose-gate.
105
+
106
+ ### [AI-Generated Smells: An Analysis of Code and Architecture in LLM- and Agent-Driven Development](https://arxiv.org/html/2605.02741v1)
107
+
108
+ Two findings ORC turned into rules. The **Reasoning-Complexity Paradox**:
109
+ stronger models produce longer methods, not shorter ones, because they
110
+ consolidate complex logic into one procedural block (`OSC-15`). The **Modular
111
+ Mirage**: agents achieve structural modularity by separating files while related
112
+ behaviour fragments across the tree, so cohesion drops as file count rises
113
+ (`OSC-16`). The paper's God-class and Too-Many-Branches findings are `OSC-17`.
114
+
115
+ ### [Investigating the Smells of LLM Generated Code](https://arxiv.org/pdf/2510.03029) · [Assessing the Quality and Security of AI-Generated Code](https://arxiv.org/pdf/2508.14727)
116
+
117
+ Over-commenting, redundant defensive checks for conditions that cannot happen,
118
+ dead assignments, and functions that reimplement something already present.
119
+ Behind `OSC-01`, `OSC-11` and `OSC-18`.
120
+
121
+ ---
122
+
123
+ ## Read, nothing taken
124
+
125
+ Listed so a reader can follow the same trail. Each restates patterns the primary
126
+ sources already cover.
127
+
128
+ - [`adewale/anti-slop-writing`](https://github.com/adewale/anti-slop-writing)
129
+ - [`jalaalrd/anti-ai-slop-writing`](https://github.com/jalaalrd/anti-ai-slop-writing)
130
+ - `tmdgusya/engineering-discipline`, the `clean-ai-slop` skill
131
+
132
+ ---
133
+
134
+ ## If you are one of these authors
135
+
136
+ The rule text here is adapted, not copied verbatim, and reorganised into ORC's
137
+ own id scheme so that a lint finding and a conflict report can name the same
138
+ thing across versions. If you would prefer different wording, a different
139
+ attribution, or removal, open an issue on
140
+ [`azure-id/orc`](https://github.com/azure-id/orc) and it will be changed in the
141
+ next release.
@@ -0,0 +1,107 @@
1
+ <!-- orc-rules:index -->
2
+
3
+ # ORC RULES — the anti-slop baseline
4
+
5
+ > **READ-ONLY.** Everything in this folder ships with ORC and changes only with
6
+ > `orc update`. Nothing in ORC writes here, and `orc rules set --pack …` is
7
+ > refused by name.
8
+ >
9
+ > Your own rules live in `.claude/orc/rules.md`. Write them with
10
+ > `orc rules add --priority P0 --text "…"`, or in `orc ui` ▸ **Rules**.
11
+
12
+ ORC generates a lot of text and a lot of code. Both come out carrying the same
13
+ recognisable defaults: prose that says nothing in a confident shape, and code
14
+ that is longer, more defensive and more abstract than the task asked for. These
15
+ packs are the filter.
16
+
17
+ **This is a filter, not a style guide.** It prescribes no voice, no aesthetic
18
+ and no architecture. It rejects technique without purpose, and it never invents
19
+ direction of its own.
20
+
21
+ ---
22
+
23
+ ## The packs
24
+
25
+ | Pack | File | Ids | Rules | Layer | Applies to |
26
+ |---|---|---|---|---|---|
27
+ | **Writing** | `writing.md` | `OSW-01…23` | 23 | `writing` | every word an agent writes |
28
+ | **Code** | `code.md` | `OSC-01…22` | 22 | `code` | source an agent writes or edits |
29
+ | **Delivery** | `delivery.md` | `OSD-01…10` | 10 | `core` | what an agent reports about its own work |
30
+ | **UI** | `ui.md` | `OSU-01…10` | 10 | `ui` | front-end work only, added **per task** |
31
+
32
+ **65 rules.** `orc rules --json` is the count's only source. Never compute it
33
+ here, and never compute it in a skill.
34
+
35
+ Credits, licences and what was taken from whom: `CREDITS.md`, or
36
+ `orc rules credits`.
37
+
38
+ ---
39
+
40
+ ## The three tiers
41
+
42
+ | Tier | Meaning | On a finding |
43
+ |---|---|---|
44
+ | **HARD** | Absolute. No exception, no purpose that redeems it. | A finding. |
45
+ | **PURPOSE** | The technique is allowed. It needs a written one-line reason. | Missing reason is a finding; the technique is not. |
46
+ | **LOCK** | A consistency requirement. | Reported, never blocking. |
47
+
48
+ The tier system is Miqdad Badjuber's (`miqdadbadjuber/anti-slop`). The mechanism
49
+ it exists for: a ban list alone leaves a void, and a model fills a void with its
50
+ most generic output. A purpose gate asks for the reason instead, which is the
51
+ only thing that separates craft from default.
52
+
53
+ ---
54
+
55
+ ## Precedence — three layers, and the order never changes
56
+
57
+ ```
58
+ 1. PROJECT CODE HOUSE RULES ../phases/house-rules.md + the project's CLAUDE.md P0
59
+ ├ scope: CODE and agent BEHAVIOUR only
60
+ └ beats everything below it, always
61
+
62
+ 2. USER RULES .claude/orc/rules.md (P0 > P1 > P2)
63
+ └ beats the ORC rules OUTRIGHT on any conflict
64
+
65
+ 3. ORC RULES these packs — read-only
66
+ ```
67
+
68
+ **Layer 1 is code-only.** The house card governs how a change is made: surgical,
69
+ simple, honest, in-slice. It says nothing about the words an agent writes, so it
70
+ never overrules a writing rule — it does not speak about prose at all.
71
+
72
+ **Layer 2 wins outright over layer 3.** A user rule that contradicts an ORC rule
73
+ disables that ORC rule for this project. This is never silent: the agent returns
74
+ `rules_overridden[]` naming the ORC id and the user line that replaced it, and
75
+ the preflight prints the count. A silent override is the one outcome nobody can
76
+ audit.
77
+
78
+ ---
79
+
80
+ ## The boundary
81
+
82
+ Rules govern **what is written and how it reads**, and **what shape of code is
83
+ acceptable**. They can never change how a lane **runs**: the scoring, the wave
84
+ order, the gates, the dispatch contract, the ship rules, or any lane's
85
+ structural and safety rules.
86
+
87
+ A rule that asks for one of those comes back as `unsupported_request` and is
88
+ relayed as a gap. **Never a guessed compromise.**
89
+
90
+ **There is no fake validator here.** The CLI cannot parse intent, so it does not
91
+ pretend to. It does not detect a user rule that would break a structural rule.
92
+ It **declares** the boundary — in `orc rules`, at the top of every dispatched
93
+ slice, and in the panel. This is the same decision `orc doc rules` made, and for
94
+ the same reason: a validator that sometimes works is worse than none.
95
+
96
+ ---
97
+
98
+ ## What reads these packs
99
+
100
+ - `orc rules slice --lane <lane>` is the **only** assembler. No skill builds the
101
+ card itself, so no two lanes can drift.
102
+ - `../phases/rules.md` is the phase that injects it.
103
+ - `orc rules lint` checks the mechanically checkable subset and says, in every
104
+ mode, how many rules it did **not** check.
105
+ - `/orc-doc` reads **none** of this. That lane has its own ledger, written with
106
+ `orc doc rules`, and its own frozen-per-document mechanic. The two surfaces
107
+ never mix.
@@ -0,0 +1,229 @@
1
+ <!-- orc-rules:pack id=code prefix=OSC layer=code -->
2
+
3
+ # ORC RULES · Code (`OSC`)
4
+
5
+ > **READ-ONLY.** This file ships with ORC and changes only with `orc update`.
6
+ > Your own rules go in `.claude/orc/rules.md`, and **yours win** wherever the two
7
+ > disagree.
8
+
9
+ **Applies to** source an agent writes or edits.
10
+
11
+ **Precedence note.** The project's CODE house rules
12
+ (`../phases/house-rules.md` and the project's own `CLAUDE.md` P0) beat this pack
13
+ and beat the user ledger. This pack never restates a house rule; where one
14
+ already covers the ground, the rule below cites it.
15
+
16
+ **Source.** Andrej Karpathy's `CLAUDE.md` ·
17
+ [`BioInfo/slopless`](https://github.com/BioInfo/slopless) ·
18
+ Miqdad Badjuber — [`miqdadbadjuber/anti-slop`](https://github.com/miqdadbadjuber/anti-slop), the `antislop-code` skill (MIT) ·
19
+ [Specification and Detection of LLM Code Smells](https://arxiv.org/html/2512.18020v1) ·
20
+ [AI-Generated Smells](https://arxiv.org/html/2605.02741v1) ·
21
+ [Investigating the Smells of LLM Generated Code](https://arxiv.org/pdf/2510.03029).
22
+ Full attribution in `CREDITS.md`.
23
+
24
+ ---
25
+
26
+ ### OSC-01 · HARD · A comment never restates the code
27
+
28
+ Delete a comment that repeats what the next line, the declaration or the
29
+ signature already shows: `// Initialize the variable` above `let count = 0`,
30
+ `// User class` above `class User {}`, `const userAge = 25; // User age is 25`.
31
+
32
+ It doubles the reading load and adds nothing. Remove the comment. Leave the code.
33
+
34
+ ### OSC-02 · HARD · No decorative separator
35
+
36
+ No banner built from repeated characters, no ALL-CAPS section label, no
37
+ box-drawn header: `// ==========`, `// -------- WORKFLOW --------`,
38
+ `/* ---- ROUTES ---- */`.
39
+
40
+ The decoration is the message, and the message is "generated". Use one plain
41
+ line, or nothing.
42
+
43
+ Checked by `orc rules lint`.
44
+
45
+ ### OSC-03 · HARD · No workflow narration
46
+
47
+ No `// Step 1: Validate input`, `// Step 2: Process`, `// First…`, `// Next…`,
48
+ `// Finally…`. The control flow is already visible.
49
+
50
+ If the flow is genuinely hard to follow, that is a structure problem, not a
51
+ missing comment.
52
+
53
+ Checked by `orc rules lint`.
54
+
55
+ ### OSC-04 · HARD · No empty label
56
+
57
+ No `// Main logic`, `// Core logic`, `// Business logic`, `// Helper function`,
58
+ `// Entry point`, `// Error handling`, `// Note: this is important`,
59
+ `// Important: please read`.
60
+
61
+ The label names a category, not a fact. "Note: retries happen only on 5xx" earns
62
+ its place. "Note: this is important" does not.
63
+
64
+ Checked by `orc rules lint`.
65
+
66
+ ### OSC-05 · HARD · A TODO names a task
67
+
68
+ No `// TODO: improve this`, `// Future improvements`, `// Additional
69
+ optimization can be added here`, `// Add more validation`.
70
+
71
+ A vague TODO names a feeling, not a task. Keep a TODO only when it says what to
72
+ do and carries enough context to act on. Otherwise delete it.
73
+
74
+ Checked by `orc rules lint`.
75
+
76
+ ### OSC-06 · HARD · No decorative emoji in code
77
+
78
+ No emoji as decoration in a comment, a log line or an identifier: `// ✅
79
+ Validation`, `// 🚀 Performance`, `// 🔒 Security`. Emoji is visual noise in
80
+ source, and that exact set is the generated vocabulary.
81
+
82
+ Carve-out: a string the product actually renders to a user, and a test asserting
83
+ on it.
84
+
85
+ Checked by `orc rules lint`.
86
+
87
+ ### OSC-07 · HARD · No end markers
88
+
89
+ No `} // end if`, `# End of function`, `// End processOrder`. The closing brace
90
+ already ends the block.
91
+
92
+ Checked by `orc rules lint`.
93
+
94
+ ### OSC-08 · LOCK · One line per comment
95
+
96
+ One line. Two only when the second carries a new fact. Never three.
97
+
98
+ A person leaves a note; a generator writes a case. Cut the reasoning chain, the
99
+ issue number and the version history. Keep the constraint: the platform trap,
100
+ the silent failure, the protocol rule, the performance cost.
101
+
102
+ **Value is not length.** A comment that legitimately earns its place still does
103
+ not earn a paragraph.
104
+
105
+ ### OSC-09 · HARD · Comments explain why, never what
106
+
107
+ Never strip a comment that carries: business logic and intent · an architectural
108
+ decision · a security consideration · a performance trade-off · concurrency
109
+ behaviour · a protocol detail · an API contract · a workaround · an edge case or
110
+ assumption · a licence or legal notice.
111
+
112
+ ```js
113
+ // Stripe may retry webhook deliveries for up to three days.
114
+ // Ignore duplicate events using the event ID.
115
+ ```
116
+
117
+ That comment stays. A comment earns its place when it explains something the
118
+ code does not already show.
119
+
120
+ ### OSC-10 · HARD · No speculative abstraction
121
+
122
+ Minimum code that solves the stated problem. No helper for a one-time operation.
123
+ No abstraction for a single call site. No configurability nobody asked for. No
124
+ design for a hypothetical future requirement.
125
+
126
+ Three similar lines of code beat a premature abstraction.
127
+
128
+ ### OSC-11 · HARD · No defence against impossible states
129
+
130
+ No error handling, fallback or validation for a scenario that cannot happen.
131
+ Trust internal code and framework guarantees.
132
+
133
+ Validate at system boundaries only: user input, external APIs, parsed files, and
134
+ anything crossing a process boundary.
135
+
136
+ ### OSC-12 · HARD · No backwards-compatibility shim
137
+
138
+ When the code can just change, change it. No feature flag, no compatibility
139
+ layer, no `_unused` rename, no re-export of a moved type, no `// removed`
140
+ tombstone.
141
+
142
+ If it is unused, delete it completely.
143
+
144
+ ### OSC-13 · HARD · Surgical
145
+
146
+ Every changed line traces directly to the request. Do not improve adjacent code,
147
+ comments or formatting. Do not refactor what is not broken. Do not add
148
+ docstrings or type annotations to code you did not change.
149
+
150
+ Cites house card rule 1. Where the house card and this rule differ, the house
151
+ card wins.
152
+
153
+ ### OSC-14 · HARD · Pre-existing dead code: mention, do not delete
154
+
155
+ Remove the imports, variables and functions **your** change left unused. Report
156
+ any other dead code you notice; do not remove it unless asked.
157
+
158
+ ### OSC-15 · PURPOSE · Method length
159
+
160
+ A function longer than the file's own norm is split, or the reason is written in
161
+ one line.
162
+
163
+ Stronger models write longer methods, not shorter ones: they consolidate complex
164
+ logic into a single procedural block because that is locally the most probable
165
+ continuation. This rule is the counterweight.
166
+
167
+ ### OSC-16 · PURPOSE · No Modular Mirage
168
+
169
+ New files that spread one behaviour across the tree produce structural
170
+ modularity with no semantic cohesion. If a change adds files, the reason each
171
+ boundary exists is written in one line.
172
+
173
+ Separating files is not the same as separating concerns.
174
+
175
+ ### OSC-17 · PURPOSE · No God class, no branch sink
176
+
177
+ No "manager" or "service" class that centralises every branch. No class whose
178
+ response set spans most of the module. Where one is genuinely right, write the
179
+ reason.
180
+
181
+ ### OSC-18 · HARD · Look before you write a helper
182
+
183
+ Before adding a helper, a util, a formatter or a validator, search for the one
184
+ that already exists. Redundant reimplementation is the most expensive slop in
185
+ this pack: it compiles, it passes, and it doubles the maintenance surface
186
+ silently.
187
+
188
+ ### OSC-19 · HARD · Match the existing style
189
+
190
+ Match the surrounding code's naming, comment density, error handling and file
191
+ layout, even where you would do it differently. The cached project pattern
192
+ (`orc pattern`) is the reference when one exists.
193
+
194
+ ### OSC-20 · PURPOSE · LLM-calling code is pinned and bounded
195
+
196
+ When the task writes code that calls a model, each of these is done or the
197
+ reason is written:
198
+
199
+ - Pin the model **version**, never a bare provider alias.
200
+ - Set `temperature` explicitly. Provider defaults differ and change.
201
+ - Bound max tokens, timeouts and retries. Unbounded is not "no limit", it is an
202
+ unknown limit.
203
+ - Send a system message.
204
+ - Enforce a structured output schema where the caller expects fields.
205
+
206
+ ### OSC-21 · HARD · No unrequested artifact files
207
+
208
+ Do not create a file nobody asked for: `SUMMARY.md`, `IMPLEMENTATION_NOTES.md`,
209
+ `CHANGES.md`, `NOTES.md`, `*_final`, `*_v2`, `*_new`, `*.bak`, `*.old`.
210
+
211
+ Report in the return. Do not leave a file behind as the report.
212
+
213
+ Checked by `orc rules lint` on new files.
214
+
215
+ ### OSC-22 · HARD · Introduce no OWASP Top 10 weakness
216
+
217
+ Injection, broken access control, insecure deserialisation, secrets in source,
218
+ missing authorisation on a new endpoint, unvalidated redirect. If you notice
219
+ insecure code you wrote, fix it in the same slice and say so in the return.
220
+
221
+ ---
222
+
223
+ ## Not a ban — keep these
224
+
225
+ - Every comment on the `OSC-09` list, at whatever length its facts require.
226
+ - Validation at a real system boundary (`OSC-11` is about impossible states, not
227
+ about untrusted input).
228
+ - An abstraction with two or more real call sites today.
229
+ - Defensive code the project's own pattern already established (`OSC-19` wins).