@azure-id/orc 1.7.1 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3649 -3381
- package/README-id.md +923 -844
- package/README.md +836 -788
- package/bin/build-agents.js +43 -27
- package/bin/cli.js +701 -3
- package/bin/graph-extract.js +927 -0
- package/bin/graph-notes.js +188 -0
- package/bin/graph-query.js +808 -0
- package/bin/graph-resolve.js +178 -0
- package/bin/graph-signals.js +277 -0
- package/bin/graph.js +605 -0
- package/bin/verify-contracts.js +4669 -4553
- package/bin/verify-package.js +626 -616
- package/bin/webui/api.js +1419 -1414
- package/bin/webui/fixtures/index.js +579 -576
- package/bin/webui/fixtures/knowledge.js +316 -291
- package/bin/webui/i18n/en/knowledge.json +167 -151
- package/bin/webui/i18n/en/overview.json +101 -100
- package/bin/webui/i18n/id/knowledge.json +167 -151
- package/bin/webui/i18n/id/overview.json +101 -100
- package/bin/webui/js/panels/knowledge.js +1065 -1006
- package/bin/webui/js/panels/overview.js +492 -488
- package/package.json +39 -39
- package/templates/agents/MODEL-MAPPING.md +163 -158
- package/templates/agents/orc-executor-haiku-4-5.md +133 -121
- package/templates/agents/orc-executor-opus-4-7-high.md +134 -122
- package/templates/agents/orc-executor-opus-4-7-med.md +134 -122
- package/templates/agents/orc-executor-opus-4-8-high.md +134 -122
- package/templates/agents/orc-executor-opus-5-high.md +134 -122
- package/templates/agents/orc-executor-opus-5-low.md +134 -122
- package/templates/agents/orc-executor-opus-5-med.md +134 -122
- package/templates/agents/orc-executor-sonnet-4-6-high.md +134 -122
- package/templates/agents/orc-executor-sonnet-4-6-med.md +134 -122
- package/templates/agents/orc-executor-sonnet-5-high.md +134 -122
- package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +86 -0
- package/templates/hooks/README.md +444 -396
- package/templates/hooks/orc-graph-hook.js +336 -0
- package/templates/hooks/orc-statusline-render.js +922 -921
- package/templates/hooks/orc-statusline.js +1596 -1545
- package/templates/skills/_shared/README.md +4 -0
- package/templates/skills/_shared/code-graph.md +220 -0
- package/templates/skills/_shared/opus5-only.md +4 -0
- package/templates/skills/_shared/phases/execution.md +166 -147
- package/templates/skills/_shared/phases/planning.md +142 -135
- package/templates/skills/_shared/phases/preflight.md +132 -118
- package/templates/skills/_shared/phases/review.md +63 -53
- package/templates/skills/_shared/phases/ship.md +96 -88
- package/templates/skills/_shared/phases/trace.md +6 -0
- package/templates/skills/_shared/phases/wiki-consult.md +194 -189
- package/templates/skills/_shared/read-ladder.md +124 -102
- package/templates/skills/_shared/return-validation.md +259 -250
- package/templates/skills/orc/SKILL.md +255 -254
- package/templates/skills/orc-diy/references/flow-schema.md +101 -100
- package/templates/skills/orc-fast/SKILL.md +236 -229
- package/templates/skills/orc-mini/SKILL.md +267 -259
- package/templates/skills/orc-quick/SKILL.md +378 -361
- package/templates/skills/orc-quick/references/dispatch-gate.md +6 -0
- package/templates/skills/orc-wiki/references/staleness.md +294 -288
|
@@ -1,396 +1,444 @@
|
|
|
1
|
-
# The ORC hooks
|
|
2
|
-
|
|
3
|
-
> This page is written in Simplified Technical English. Short sentences, one
|
|
4
|
-
> idea each, plain words. See `bin/webui/i18n/TERMS.md` for the term list.
|
|
5
|
-
|
|
6
|
-
This page covers the two hooks you can see. The STATUS LINE, which shows what
|
|
7
|
-
is happening, and the READ GATE, which can stop an oversized read.
|
|
8
|
-
|
|
9
|
-
ORC shows two lines at the bottom of your terminal. Claude Code draws them.
|
|
10
|
-
ORC writes them.
|
|
11
|
-
|
|
12
|
-
Every value comes from a file on your disk or from data Claude Code gives the
|
|
13
|
-
hook. No value costs model tokens. Nothing here starts a run.
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
🚀 ORC v1.2.1 - Opus 5/high · context (34%) · 5h 41% (2h13m) ↔ wk 12% · ucs 6% · wiki: fresh
|
|
17
|
-
▰ status: quick · Q3 DO · agents 7 (2 running) · orc-extra: on · Dur 48m · MTok 412K · main
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Line 1 answers: **what model am I on, and how much do I have left?**
|
|
21
|
-
Line 2 answers: **what is this session doing?**
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Line 1
|
|
26
|
-
|
|
27
|
-
### 1. The icon and `ORC v1.2.1 - Opus 5/high`
|
|
28
|
-
|
|
29
|
-
The icon is the verdict. The words are the ORC version you have installed and
|
|
30
|
-
the model and effort you are running now.
|
|
31
|
-
|
|
32
|
-
| Icon | Meaning | What to do |
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| ✅ | Good. This is the base tier. | Nothing. |
|
|
35
|
-
| 🚀 | Better than the base tier. | Nothing. |
|
|
36
|
-
| ⛔ | ORC will work less well here. | Read the reason in brackets. Change the model or the effort. |
|
|
37
|
-
|
|
38
|
-
The ⛔ line always gives a reason:
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
⛔ ORC v1.2.1 - Sonnet 5/high (model≠Opus5/Opus4.8/Fable5) · context (34%)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
If ORC cannot read its own version, it shows `ORC` with no number. It does not
|
|
45
|
-
guess.
|
|
46
|
-
|
|
47
|
-
**This line can only warn you.** A status line cannot stop a command. The
|
|
48
|
-
`orc-effort-guard.js` hook is what stops a run at a low effort.
|
|
49
|
-
|
|
50
|
-
### 2. `context (34%)`
|
|
51
|
-
|
|
52
|
-
How full the context window is. At 100% Claude Code must compact the session.
|
|
53
|
-
|
|
54
|
-
### 3. `5h 41% (2h13m) ↔ wk 12%`
|
|
55
|
-
|
|
56
|
-
Your subscription use. Anthropic sends these numbers; ORC does not estimate
|
|
57
|
-
them.
|
|
58
|
-
|
|
59
|
-
- `5h 41%` — you used 41% of the 5-hour window.
|
|
60
|
-
- `(2h13m)` — the 5-hour window resets in 2 hours and 13 minutes.
|
|
61
|
-
- `wk 12%` — you used 12% of the 7-day window.
|
|
62
|
-
|
|
63
|
-
A `⚠` appears at 75%. A `⛔` appears at 90%, and the verdict changes to ⛔.
|
|
64
|
-
|
|
65
|
-
Older versions of Claude Code do not send these numbers. Then this part is
|
|
66
|
-
absent.
|
|
67
|
-
|
|
68
|
-
### 4. `ucs 6%`
|
|
69
|
-
|
|
70
|
-
**ucs = usage, current session.** The 5-hour window moved 6% while this session
|
|
71
|
-
ran.
|
|
72
|
-
|
|
73
|
-
Two facts to know:
|
|
74
|
-
|
|
75
|
-
- The window is for your **whole account**. A second terminal moves it too. So
|
|
76
|
-
`ucs` is what moved, not only what you used here.
|
|
77
|
-
- A window reset is not a refund. ORC banks what you used before the reset. The
|
|
78
|
-
count continues.
|
|
79
|
-
|
|
80
|
-
`ucs 0%` is an answer. It means nothing measurable moved yet.
|
|
81
|
-
|
|
82
|
-
### 5. Extra parts
|
|
83
|
-
|
|
84
|
-
These parts appear only when they apply.
|
|
85
|
-
|
|
86
|
-
| Part | Meaning |
|
|
87
|
-
|---|---|
|
|
88
|
-
| `wiki: fresh` / `AGING (14c)` / `STALE (52c)` | How old your project wiki is. The number is commits since the scan. |
|
|
89
|
-
| `wiki: UNREGISTERED (run \`orc wiki sync\`)` | You have wiki documents, but no index. The fix is free. |
|
|
90
|
-
| `diy:my-flow READY` / `STALE→recompile` | Your `/orc-diy` flow. `STALE` means you must run `orc diy compile`. |
|
|
91
|
-
| `orc 1.2.2 available` | A newer ORC exists. Run `orc upgrade`. |
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Line 2
|
|
96
|
-
|
|
97
|
-
### 1. `▰ status: quick · Q3 DO`
|
|
98
|
-
|
|
99
|
-
The lane that is running now, and the phase it is in. The small symbol in front
|
|
100
|
-
moves. Each kind of phase has its own symbol.
|
|
101
|
-
|
|
102
|
-
| Symbol | Kind | The lane is |
|
|
103
|
-
|---|---|---|
|
|
104
|
-
| `◔ ◑ ◕ ●` | look | reading files and collecting facts |
|
|
105
|
-
| `? ¿` | ask | waiting for your answer |
|
|
106
|
-
| `▁ ▃ ▅ ▇` | plan | deciding what to do and in what order |
|
|
107
|
-
| `▰ ▱` | do | running agents that write code |
|
|
108
|
-
| `◇ ◈ ◆` | check | reviewing, verifying or testing |
|
|
109
|
-
| `› » ≫` | ship | finishing and handing over |
|
|
110
|
-
| `· ˙` | wait | stopped on purpose |
|
|
111
|
-
| braille | generic | a phase with no symbol of its own |
|
|
112
|
-
|
|
113
|
-
**This part can be absent, and that is correct.** ORC shows a phase only when a
|
|
114
|
-
file on disk proves it. Two things prove a phase: an agent that ORC dispatched,
|
|
115
|
-
or a phase note the run wrote to its trace.
|
|
116
|
-
|
|
117
|
-
So some phases show nothing:
|
|
118
|
-
|
|
119
|
-
- a phase that only reads files and asks you a question, for example `Q1 LOOK`
|
|
120
|
-
and `Q2 ASK` in `/orc-quick`;
|
|
121
|
-
- a run that stopped more than 10 minutes ago;
|
|
122
|
-
- a worker that runs outside Claude (`orc extra`), unless the run wrote a note.
|
|
123
|
-
|
|
124
|
-
ORC hides the part instead of guessing. A wrong phase is worse than no phase.
|
|
125
|
-
|
|
126
|
-
**The symbol is not a progress bar.** Claude Code draws the status line when
|
|
127
|
-
something happens. So the symbol moves while you type and while ORC works. It
|
|
128
|
-
stops when the session is idle. That is true, and it is the design.
|
|
129
|
-
|
|
130
|
-
To turn the motion off, set `ORC_STATUSLINE_MOTION=0`.
|
|
131
|
-
To use plain ASCII symbols, set `ORC_STATUSLINE_ASCII=1`.
|
|
132
|
-
|
|
133
|
-
### 2. `agents 7 (2 running)`
|
|
134
|
-
|
|
135
|
-
How many agents this session dispatched, and how many have not returned yet.
|
|
136
|
-
|
|
137
|
-
`(2 running)` is important. If you see a number here and nothing is happening,
|
|
138
|
-
an agent is still working. Do not start the same task again. Run
|
|
139
|
-
`orc run inflight` to check.
|
|
140
|
-
|
|
141
|
-
Two limits:
|
|
142
|
-
|
|
143
|
-
- ORC counts only agents it dispatched with a name. A quick read that uses no
|
|
144
|
-
named agent is not counted.
|
|
145
|
-
- If you continue an agent instead of dispatching a new one, ORC cannot see it.
|
|
146
|
-
So this number is a floor, not a total.
|
|
147
|
-
|
|
148
|
-
### 3. `orc-extra: on`
|
|
149
|
-
|
|
150
|
-
`on` means ORC may send some work to a provider that is not Claude. `off` means
|
|
151
|
-
all work stays on Claude.
|
|
152
|
-
|
|
153
|
-
To change it, run `orc config set extra_enabled true` or `false`.
|
|
154
|
-
|
|
155
|
-
### 4. `Dur 48m`
|
|
156
|
-
|
|
157
|
-
How long this session has run.
|
|
158
|
-
|
|
159
|
-
### 5. `MTok 412K`
|
|
160
|
-
|
|
161
|
-
**MTok = main token.** The tokens your **main session** used. `412K` is 412
|
|
162
|
-
thousand.
|
|
163
|
-
|
|
164
|
-
This is the sum of all four token kinds: new input, cache write, cache read and
|
|
165
|
-
output.
|
|
166
|
-
|
|
167
|
-
**Claude Code does not record tokens for a dispatched agent.** So an hour of
|
|
168
|
-
agent work adds almost nothing to this number. `MTok` tells you how much your
|
|
169
|
-
own conversation costs. It does not tell you what a run costs.
|
|
170
|
-
|
|
171
|
-
For the true cost of a run, use `orc usage report` or `/orc-budget`.
|
|
172
|
-
|
|
173
|
-
`MTok —` means ORC could not measure it. It never shows `0`, because `0` would
|
|
174
|
-
say the session was free.
|
|
175
|
-
|
|
176
|
-
### 6. `main`
|
|
177
|
-
|
|
178
|
-
The branch you are on. A detached HEAD shows as `@a1b2c3d`.
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## If a part is missing
|
|
183
|
-
|
|
184
|
-
| You see | Reason |
|
|
185
|
-
|---|---|
|
|
186
|
-
| Only one line | The hook could not read your `.claude/orc/` folder. It failed quietly, which is correct: a status line must never break your session. |
|
|
187
|
-
| No `status:` | No run is active, or the phase cannot be proved. See above. |
|
|
188
|
-
| No branch | This folder is not a Git repository. |
|
|
189
|
-
| `MTok —` | ORC could not read the session transcript. |
|
|
190
|
-
| No `5h`/`wk` | Your Claude Code version does not send usage numbers. |
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Your own status line
|
|
195
|
-
|
|
196
|
-
You can build your own instead of this one. It is **off** by default, and while
|
|
197
|
-
it is off this file describes exactly what you see.
|
|
198
|
-
|
|
199
|
-
Open the panel:
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
orc ui
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Then go to **CLI Hook Interface**. You put components into three lines and drag
|
|
206
|
-
them where you want them. One rule decides where a component may go:
|
|
207
|
-
|
|
208
|
-
> A line may hold a component only if every line above it holds at least one.
|
|
209
|
-
|
|
210
|
-
So line 1 must hold something before line 2 can, and line 2 before line 3. Each
|
|
211
|
-
line holds at most six components. The panel will not let you make an illegal
|
|
212
|
-
move, and it tells you why.
|
|
213
|
-
|
|
214
|
-
Every component can be changed: its words, its colour, its shape, how wide it
|
|
215
|
-
is, and when it is allowed to disappear.
|
|
216
|
-
|
|
217
|
-
**The shape decides what the other settings can do.** Only these shapes print a
|
|
218
|
-
short name in front of the value: `plain`, `label-value`, `bracket`, `angle`,
|
|
219
|
-
`badge`, `pill` and `stack`. A bar, an icon and a bare value have no room for
|
|
220
|
-
one, so the panel switches the Name box off for them and says so. The same is
|
|
221
|
-
true of the number settings: a bar has a width and a colour ramp, and no number
|
|
222
|
-
format at all.
|
|
223
|
-
|
|
224
|
-
**Three things a terminal cannot do**, said plainly so you do not look for them:
|
|
225
|
-
|
|
226
|
-
| You may want | What you get |
|
|
227
|
-
|---|---|
|
|
228
|
-
| A bigger font | The terminal owns the font size. Use **bold**, or make a component wider — a bar at width 12 is a big object. |
|
|
229
|
-
| A blinking part | Refused. Half of terminals turn it off, and no part of a status line needs it. |
|
|
230
|
-
| Icon-font symbols | Not shipped. They need a font we cannot check for, and they draw as empty boxes without it. |
|
|
231
|
-
|
|
232
|
-
There is a command-line half (`orc statusline`). It exists so the panel has
|
|
233
|
-
something to run. Building a three-line layout by typing flags is harder than
|
|
234
|
-
dragging, so the panel is the recommended way.
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## The agent panel
|
|
239
|
-
|
|
240
|
-
When ORC sends work to a subagent, Claude Code shows a row for it in the agent
|
|
241
|
-
panel. ORC can draw that row too — `orc ui` ▸ **CLI Hook Interface**, then pick
|
|
242
|
-
the **subagent** board.
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
● orc-executor-opus-5-low O5/low 84K ███▎░░░░ 42% for 17m
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
It is off by default, and while it is off you see Claude Code's own row.
|
|
249
|
-
|
|
250
|
-
**One thing here runs whether the row is on or off**, and it is worth knowing
|
|
251
|
-
about. Claude Code tells this hook **how many tokens each agent has used**.
|
|
252
|
-
Nothing else tells ORC that: the conversation file records no token use for a
|
|
253
|
-
subagent at all. So ORC writes down what the panel reports, and `orc usage
|
|
254
|
-
report` shows it.
|
|
255
|
-
|
|
256
|
-
**It is a floor, not a total.** ORC only sees an agent while it is in the panel.
|
|
257
|
-
An agent that starts and ends between two redraws is never seen, and a number
|
|
258
|
-
read just before an agent ended is short by whatever came after. `orc usage
|
|
259
|
-
report` says so on every one of these numbers. It never shows `0` for something
|
|
260
|
-
it did not see.
|
|
261
|
-
|
|
262
|
-
---
|
|
263
|
-
|
|
264
|
-
## The read gate
|
|
265
|
-
|
|
266
|
-
This is a different hook. It is off when you install ORC.
|
|
267
|
-
|
|
268
|
-
ORC has a rule about reading. The main session reads a file to FIND things.
|
|
269
|
-
To UNDERSTAND a file, ORC sends an agent to read it and report back. The agent
|
|
270
|
-
uses its own context, not yours. The rule was written in three guide files and
|
|
271
|
-
nothing checked it. The read gate is the part that can say no.
|
|
272
|
-
|
|
273
|
-
Turn it on like this:
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
orc config set read_gate warn # it tells you, and still reads the file
|
|
277
|
-
orc config set read_gate block # it stops the read
|
|
278
|
-
orc config set read_gate off # the default
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### What it does
|
|
282
|
-
|
|
283
|
-
It looks at one thing: a `Read` of a whole file, by the main session, during an
|
|
284
|
-
ORC run, when the file is 1000 lines or more.
|
|
285
|
-
|
|
286
|
-
In `warn` it shows you a note and reads the file anyway. In `block` it stops the
|
|
287
|
-
read and tells you three other ways to get what you need:
|
|
288
|
-
|
|
289
|
-
- Read the file with `offset` and `limit`. This is never stopped.
|
|
290
|
-
- Search the file first, then read that part.
|
|
291
|
-
- Send an agent to read it. An agent's reads are never stopped.
|
|
292
|
-
|
|
293
|
-
**A block always names another way.** A gate that only says no is a gate people
|
|
294
|
-
turn off.
|
|
295
|
-
|
|
296
|
-
### When it says nothing
|
|
297
|
-
|
|
298
|
-
This list is the important part. The gate is quiet in all of these states, and
|
|
299
|
-
each one is on purpose:
|
|
300
|
-
|
|
301
|
-
| State | Why |
|
|
302
|
-
|---|---|
|
|
303
|
-
| An agent is reading | An agent must read a file in full before it edits it. If it could not, it would guess the old text and damage the file. |
|
|
304
|
-
| `read_gate` is `off` | This is the default. With `off`, the hook does nothing at all. |
|
|
305
|
-
| No ORC run is open | The gate is about ORC's own reading. It is not a rule for your session. Outside a run it never stops anything. |
|
|
306
|
-
| You used `offset` or `limit` | This is the behaviour the gate wants. It can never stop it. |
|
|
307
|
-
| The file is under 1000 lines | See the next part. |
|
|
308
|
-
| The file is a build log, a test result, or `.jsonl` | ORC reads these to decide pass or fail. A cut-short failing build looks like a passing build. That is worse than any saving. |
|
|
309
|
-
| The gate hit an error | It always lets the read through. Then it writes down what went wrong. |
|
|
310
|
-
|
|
311
|
-
**The gate cannot see a file you read with a shell command** such as `cat` or
|
|
312
|
-
`head`. It only sees the `Read` tool.
|
|
313
|
-
|
|
314
|
-
### Why 1000 lines
|
|
315
|
-
|
|
316
|
-
Sending an agent is not free. One real agent read cost about 13,000 tokens and
|
|
317
|
-
about 76 seconds. A line in this project is about 55 characters. So a file must
|
|
318
|
-
be near 1000 lines before sending an agent costs less than reading it yourself.
|
|
319
|
-
|
|
320
|
-
Below that number, sending an agent costs more than it saves.
|
|
321
|
-
|
|
322
|
-
You can change it:
|
|
323
|
-
|
|
324
|
-
```
|
|
325
|
-
orc config set read_gate_max_lines 500
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### What it never does
|
|
329
|
-
|
|
330
|
-
- It never stops an agent's read.
|
|
331
|
-
- It never stops a read outside an ORC run.
|
|
332
|
-
- It never stops a `Bash` command.
|
|
333
|
-
- It never reads the file to you. It only counts the lines.
|
|
334
|
-
- It never fails closed. If the hook breaks, your read still happens.
|
|
335
|
-
|
|
336
|
-
### Where to look when it acts
|
|
337
|
-
|
|
338
|
-
Every `warn` and every `block` writes one line in the run trace:
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
[070926 14:22:01.220] hook READ-GATE block :: lines=2400 max=1000 file=big-plan.md
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
An allowed read writes nothing. `orc doctor` tells you if the gate is on but not
|
|
345
|
-
wired, and if it ever had to let a read through because it could not judge it.
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
##
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
- It
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
1
|
+
# The ORC hooks
|
|
2
|
+
|
|
3
|
+
> This page is written in Simplified Technical English. Short sentences, one
|
|
4
|
+
> idea each, plain words. See `bin/webui/i18n/TERMS.md` for the term list.
|
|
5
|
+
|
|
6
|
+
This page covers the two hooks you can see. The STATUS LINE, which shows what
|
|
7
|
+
is happening, and the READ GATE, which can stop an oversized read.
|
|
8
|
+
|
|
9
|
+
ORC shows two lines at the bottom of your terminal. Claude Code draws them.
|
|
10
|
+
ORC writes them.
|
|
11
|
+
|
|
12
|
+
Every value comes from a file on your disk or from data Claude Code gives the
|
|
13
|
+
hook. No value costs model tokens. Nothing here starts a run.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
🚀 ORC v1.2.1 - Opus 5/high · context (34%) · 5h 41% (2h13m) ↔ wk 12% · ucs 6% · wiki: fresh
|
|
17
|
+
▰ status: quick · Q3 DO · agents 7 (2 running) · orc-extra: on · Dur 48m · MTok 412K · main
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Line 1 answers: **what model am I on, and how much do I have left?**
|
|
21
|
+
Line 2 answers: **what is this session doing?**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Line 1
|
|
26
|
+
|
|
27
|
+
### 1. The icon and `ORC v1.2.1 - Opus 5/high`
|
|
28
|
+
|
|
29
|
+
The icon is the verdict. The words are the ORC version you have installed and
|
|
30
|
+
the model and effort you are running now.
|
|
31
|
+
|
|
32
|
+
| Icon | Meaning | What to do |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| ✅ | Good. This is the base tier. | Nothing. |
|
|
35
|
+
| 🚀 | Better than the base tier. | Nothing. |
|
|
36
|
+
| ⛔ | ORC will work less well here. | Read the reason in brackets. Change the model or the effort. |
|
|
37
|
+
|
|
38
|
+
The ⛔ line always gives a reason:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
⛔ ORC v1.2.1 - Sonnet 5/high (model≠Opus5/Opus4.8/Fable5) · context (34%)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If ORC cannot read its own version, it shows `ORC` with no number. It does not
|
|
45
|
+
guess.
|
|
46
|
+
|
|
47
|
+
**This line can only warn you.** A status line cannot stop a command. The
|
|
48
|
+
`orc-effort-guard.js` hook is what stops a run at a low effort.
|
|
49
|
+
|
|
50
|
+
### 2. `context (34%)`
|
|
51
|
+
|
|
52
|
+
How full the context window is. At 100% Claude Code must compact the session.
|
|
53
|
+
|
|
54
|
+
### 3. `5h 41% (2h13m) ↔ wk 12%`
|
|
55
|
+
|
|
56
|
+
Your subscription use. Anthropic sends these numbers; ORC does not estimate
|
|
57
|
+
them.
|
|
58
|
+
|
|
59
|
+
- `5h 41%` — you used 41% of the 5-hour window.
|
|
60
|
+
- `(2h13m)` — the 5-hour window resets in 2 hours and 13 minutes.
|
|
61
|
+
- `wk 12%` — you used 12% of the 7-day window.
|
|
62
|
+
|
|
63
|
+
A `⚠` appears at 75%. A `⛔` appears at 90%, and the verdict changes to ⛔.
|
|
64
|
+
|
|
65
|
+
Older versions of Claude Code do not send these numbers. Then this part is
|
|
66
|
+
absent.
|
|
67
|
+
|
|
68
|
+
### 4. `ucs 6%`
|
|
69
|
+
|
|
70
|
+
**ucs = usage, current session.** The 5-hour window moved 6% while this session
|
|
71
|
+
ran.
|
|
72
|
+
|
|
73
|
+
Two facts to know:
|
|
74
|
+
|
|
75
|
+
- The window is for your **whole account**. A second terminal moves it too. So
|
|
76
|
+
`ucs` is what moved, not only what you used here.
|
|
77
|
+
- A window reset is not a refund. ORC banks what you used before the reset. The
|
|
78
|
+
count continues.
|
|
79
|
+
|
|
80
|
+
`ucs 0%` is an answer. It means nothing measurable moved yet.
|
|
81
|
+
|
|
82
|
+
### 5. Extra parts
|
|
83
|
+
|
|
84
|
+
These parts appear only when they apply.
|
|
85
|
+
|
|
86
|
+
| Part | Meaning |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `wiki: fresh` / `AGING (14c)` / `STALE (52c)` | How old your project wiki is. The number is commits since the scan. |
|
|
89
|
+
| `wiki: UNREGISTERED (run \`orc wiki sync\`)` | You have wiki documents, but no index. The fix is free. |
|
|
90
|
+
| `diy:my-flow READY` / `STALE→recompile` | Your `/orc-diy` flow. `STALE` means you must run `orc diy compile`. |
|
|
91
|
+
| `orc 1.2.2 available` | A newer ORC exists. Run `orc upgrade`. |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Line 2
|
|
96
|
+
|
|
97
|
+
### 1. `▰ status: quick · Q3 DO`
|
|
98
|
+
|
|
99
|
+
The lane that is running now, and the phase it is in. The small symbol in front
|
|
100
|
+
moves. Each kind of phase has its own symbol.
|
|
101
|
+
|
|
102
|
+
| Symbol | Kind | The lane is |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `◔ ◑ ◕ ●` | look | reading files and collecting facts |
|
|
105
|
+
| `? ¿` | ask | waiting for your answer |
|
|
106
|
+
| `▁ ▃ ▅ ▇` | plan | deciding what to do and in what order |
|
|
107
|
+
| `▰ ▱` | do | running agents that write code |
|
|
108
|
+
| `◇ ◈ ◆` | check | reviewing, verifying or testing |
|
|
109
|
+
| `› » ≫` | ship | finishing and handing over |
|
|
110
|
+
| `· ˙` | wait | stopped on purpose |
|
|
111
|
+
| braille | generic | a phase with no symbol of its own |
|
|
112
|
+
|
|
113
|
+
**This part can be absent, and that is correct.** ORC shows a phase only when a
|
|
114
|
+
file on disk proves it. Two things prove a phase: an agent that ORC dispatched,
|
|
115
|
+
or a phase note the run wrote to its trace.
|
|
116
|
+
|
|
117
|
+
So some phases show nothing:
|
|
118
|
+
|
|
119
|
+
- a phase that only reads files and asks you a question, for example `Q1 LOOK`
|
|
120
|
+
and `Q2 ASK` in `/orc-quick`;
|
|
121
|
+
- a run that stopped more than 10 minutes ago;
|
|
122
|
+
- a worker that runs outside Claude (`orc extra`), unless the run wrote a note.
|
|
123
|
+
|
|
124
|
+
ORC hides the part instead of guessing. A wrong phase is worse than no phase.
|
|
125
|
+
|
|
126
|
+
**The symbol is not a progress bar.** Claude Code draws the status line when
|
|
127
|
+
something happens. So the symbol moves while you type and while ORC works. It
|
|
128
|
+
stops when the session is idle. That is true, and it is the design.
|
|
129
|
+
|
|
130
|
+
To turn the motion off, set `ORC_STATUSLINE_MOTION=0`.
|
|
131
|
+
To use plain ASCII symbols, set `ORC_STATUSLINE_ASCII=1`.
|
|
132
|
+
|
|
133
|
+
### 2. `agents 7 (2 running)`
|
|
134
|
+
|
|
135
|
+
How many agents this session dispatched, and how many have not returned yet.
|
|
136
|
+
|
|
137
|
+
`(2 running)` is important. If you see a number here and nothing is happening,
|
|
138
|
+
an agent is still working. Do not start the same task again. Run
|
|
139
|
+
`orc run inflight` to check.
|
|
140
|
+
|
|
141
|
+
Two limits:
|
|
142
|
+
|
|
143
|
+
- ORC counts only agents it dispatched with a name. A quick read that uses no
|
|
144
|
+
named agent is not counted.
|
|
145
|
+
- If you continue an agent instead of dispatching a new one, ORC cannot see it.
|
|
146
|
+
So this number is a floor, not a total.
|
|
147
|
+
|
|
148
|
+
### 3. `orc-extra: on`
|
|
149
|
+
|
|
150
|
+
`on` means ORC may send some work to a provider that is not Claude. `off` means
|
|
151
|
+
all work stays on Claude.
|
|
152
|
+
|
|
153
|
+
To change it, run `orc config set extra_enabled true` or `false`.
|
|
154
|
+
|
|
155
|
+
### 4. `Dur 48m`
|
|
156
|
+
|
|
157
|
+
How long this session has run.
|
|
158
|
+
|
|
159
|
+
### 5. `MTok 412K`
|
|
160
|
+
|
|
161
|
+
**MTok = main token.** The tokens your **main session** used. `412K` is 412
|
|
162
|
+
thousand.
|
|
163
|
+
|
|
164
|
+
This is the sum of all four token kinds: new input, cache write, cache read and
|
|
165
|
+
output.
|
|
166
|
+
|
|
167
|
+
**Claude Code does not record tokens for a dispatched agent.** So an hour of
|
|
168
|
+
agent work adds almost nothing to this number. `MTok` tells you how much your
|
|
169
|
+
own conversation costs. It does not tell you what a run costs.
|
|
170
|
+
|
|
171
|
+
For the true cost of a run, use `orc usage report` or `/orc-budget`.
|
|
172
|
+
|
|
173
|
+
`MTok —` means ORC could not measure it. It never shows `0`, because `0` would
|
|
174
|
+
say the session was free.
|
|
175
|
+
|
|
176
|
+
### 6. `main`
|
|
177
|
+
|
|
178
|
+
The branch you are on. A detached HEAD shows as `@a1b2c3d`.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## If a part is missing
|
|
183
|
+
|
|
184
|
+
| You see | Reason |
|
|
185
|
+
|---|---|
|
|
186
|
+
| Only one line | The hook could not read your `.claude/orc/` folder. It failed quietly, which is correct: a status line must never break your session. |
|
|
187
|
+
| No `status:` | No run is active, or the phase cannot be proved. See above. |
|
|
188
|
+
| No branch | This folder is not a Git repository. |
|
|
189
|
+
| `MTok —` | ORC could not read the session transcript. |
|
|
190
|
+
| No `5h`/`wk` | Your Claude Code version does not send usage numbers. |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Your own status line
|
|
195
|
+
|
|
196
|
+
You can build your own instead of this one. It is **off** by default, and while
|
|
197
|
+
it is off this file describes exactly what you see.
|
|
198
|
+
|
|
199
|
+
Open the panel:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
orc ui
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Then go to **CLI Hook Interface**. You put components into three lines and drag
|
|
206
|
+
them where you want them. One rule decides where a component may go:
|
|
207
|
+
|
|
208
|
+
> A line may hold a component only if every line above it holds at least one.
|
|
209
|
+
|
|
210
|
+
So line 1 must hold something before line 2 can, and line 2 before line 3. Each
|
|
211
|
+
line holds at most six components. The panel will not let you make an illegal
|
|
212
|
+
move, and it tells you why.
|
|
213
|
+
|
|
214
|
+
Every component can be changed: its words, its colour, its shape, how wide it
|
|
215
|
+
is, and when it is allowed to disappear.
|
|
216
|
+
|
|
217
|
+
**The shape decides what the other settings can do.** Only these shapes print a
|
|
218
|
+
short name in front of the value: `plain`, `label-value`, `bracket`, `angle`,
|
|
219
|
+
`badge`, `pill` and `stack`. A bar, an icon and a bare value have no room for
|
|
220
|
+
one, so the panel switches the Name box off for them and says so. The same is
|
|
221
|
+
true of the number settings: a bar has a width and a colour ramp, and no number
|
|
222
|
+
format at all.
|
|
223
|
+
|
|
224
|
+
**Three things a terminal cannot do**, said plainly so you do not look for them:
|
|
225
|
+
|
|
226
|
+
| You may want | What you get |
|
|
227
|
+
|---|---|
|
|
228
|
+
| A bigger font | The terminal owns the font size. Use **bold**, or make a component wider — a bar at width 12 is a big object. |
|
|
229
|
+
| A blinking part | Refused. Half of terminals turn it off, and no part of a status line needs it. |
|
|
230
|
+
| Icon-font symbols | Not shipped. They need a font we cannot check for, and they draw as empty boxes without it. |
|
|
231
|
+
|
|
232
|
+
There is a command-line half (`orc statusline`). It exists so the panel has
|
|
233
|
+
something to run. Building a three-line layout by typing flags is harder than
|
|
234
|
+
dragging, so the panel is the recommended way.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## The agent panel
|
|
239
|
+
|
|
240
|
+
When ORC sends work to a subagent, Claude Code shows a row for it in the agent
|
|
241
|
+
panel. ORC can draw that row too — `orc ui` ▸ **CLI Hook Interface**, then pick
|
|
242
|
+
the **subagent** board.
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
● orc-executor-opus-5-low O5/low 84K ███▎░░░░ 42% for 17m
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
It is off by default, and while it is off you see Claude Code's own row.
|
|
249
|
+
|
|
250
|
+
**One thing here runs whether the row is on or off**, and it is worth knowing
|
|
251
|
+
about. Claude Code tells this hook **how many tokens each agent has used**.
|
|
252
|
+
Nothing else tells ORC that: the conversation file records no token use for a
|
|
253
|
+
subagent at all. So ORC writes down what the panel reports, and `orc usage
|
|
254
|
+
report` shows it.
|
|
255
|
+
|
|
256
|
+
**It is a floor, not a total.** ORC only sees an agent while it is in the panel.
|
|
257
|
+
An agent that starts and ends between two redraws is never seen, and a number
|
|
258
|
+
read just before an agent ended is short by whatever came after. `orc usage
|
|
259
|
+
report` says so on every one of these numbers. It never shows `0` for something
|
|
260
|
+
it did not see.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## The read gate
|
|
265
|
+
|
|
266
|
+
This is a different hook. It is off when you install ORC.
|
|
267
|
+
|
|
268
|
+
ORC has a rule about reading. The main session reads a file to FIND things.
|
|
269
|
+
To UNDERSTAND a file, ORC sends an agent to read it and report back. The agent
|
|
270
|
+
uses its own context, not yours. The rule was written in three guide files and
|
|
271
|
+
nothing checked it. The read gate is the part that can say no.
|
|
272
|
+
|
|
273
|
+
Turn it on like this:
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
orc config set read_gate warn # it tells you, and still reads the file
|
|
277
|
+
orc config set read_gate block # it stops the read
|
|
278
|
+
orc config set read_gate off # the default
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### What it does
|
|
282
|
+
|
|
283
|
+
It looks at one thing: a `Read` of a whole file, by the main session, during an
|
|
284
|
+
ORC run, when the file is 1000 lines or more.
|
|
285
|
+
|
|
286
|
+
In `warn` it shows you a note and reads the file anyway. In `block` it stops the
|
|
287
|
+
read and tells you three other ways to get what you need:
|
|
288
|
+
|
|
289
|
+
- Read the file with `offset` and `limit`. This is never stopped.
|
|
290
|
+
- Search the file first, then read that part.
|
|
291
|
+
- Send an agent to read it. An agent's reads are never stopped.
|
|
292
|
+
|
|
293
|
+
**A block always names another way.** A gate that only says no is a gate people
|
|
294
|
+
turn off.
|
|
295
|
+
|
|
296
|
+
### When it says nothing
|
|
297
|
+
|
|
298
|
+
This list is the important part. The gate is quiet in all of these states, and
|
|
299
|
+
each one is on purpose:
|
|
300
|
+
|
|
301
|
+
| State | Why |
|
|
302
|
+
|---|---|
|
|
303
|
+
| An agent is reading | An agent must read a file in full before it edits it. If it could not, it would guess the old text and damage the file. |
|
|
304
|
+
| `read_gate` is `off` | This is the default. With `off`, the hook does nothing at all. |
|
|
305
|
+
| No ORC run is open | The gate is about ORC's own reading. It is not a rule for your session. Outside a run it never stops anything. |
|
|
306
|
+
| You used `offset` or `limit` | This is the behaviour the gate wants. It can never stop it. |
|
|
307
|
+
| The file is under 1000 lines | See the next part. |
|
|
308
|
+
| The file is a build log, a test result, or `.jsonl` | ORC reads these to decide pass or fail. A cut-short failing build looks like a passing build. That is worse than any saving. |
|
|
309
|
+
| The gate hit an error | It always lets the read through. Then it writes down what went wrong. |
|
|
310
|
+
|
|
311
|
+
**The gate cannot see a file you read with a shell command** such as `cat` or
|
|
312
|
+
`head`. It only sees the `Read` tool.
|
|
313
|
+
|
|
314
|
+
### Why 1000 lines
|
|
315
|
+
|
|
316
|
+
Sending an agent is not free. One real agent read cost about 13,000 tokens and
|
|
317
|
+
about 76 seconds. A line in this project is about 55 characters. So a file must
|
|
318
|
+
be near 1000 lines before sending an agent costs less than reading it yourself.
|
|
319
|
+
|
|
320
|
+
Below that number, sending an agent costs more than it saves.
|
|
321
|
+
|
|
322
|
+
You can change it:
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
orc config set read_gate_max_lines 500
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### What it never does
|
|
329
|
+
|
|
330
|
+
- It never stops an agent's read.
|
|
331
|
+
- It never stops a read outside an ORC run.
|
|
332
|
+
- It never stops a `Bash` command.
|
|
333
|
+
- It never reads the file to you. It only counts the lines.
|
|
334
|
+
- It never fails closed. If the hook breaks, your read still happens.
|
|
335
|
+
|
|
336
|
+
### Where to look when it acts
|
|
337
|
+
|
|
338
|
+
Every `warn` and every `block` writes one line in the run trace:
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
[070926 14:22:01.220] hook READ-GATE block :: lines=2400 max=1000 file=big-plan.md
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
An allowed read writes nothing. `orc doctor` tells you if the gate is on but not
|
|
345
|
+
wired, and if it ever had to let a read through because it could not judge it.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## The code graph hook
|
|
350
|
+
|
|
351
|
+
This is a third hook. It is installed with ORC and it does nothing until you
|
|
352
|
+
turn the code graph on.
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
orc config set code_graph on # the graph, and this hook with it
|
|
356
|
+
orc config set code_graph_hooks off # keep the graph, stop the hook
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
ORC keeps a map of this repository: where each function is, and who calls it.
|
|
360
|
+
The map costs no model tokens — a parser builds it from git.
|
|
361
|
+
|
|
362
|
+
The problem this hook solves was measured, not guessed. In an evaluation run,
|
|
363
|
+
agents were told to ask the map before searching the code. In eight dispatches
|
|
364
|
+
they asked **zero times**, and one run changed a file and never told the map.
|
|
365
|
+
Writing the instruction again would not have helped. So the map now speaks for
|
|
366
|
+
itself.
|
|
367
|
+
|
|
368
|
+
### What it does
|
|
369
|
+
|
|
370
|
+
Four moments, and it is quiet in all the others:
|
|
371
|
+
|
|
372
|
+
- An ORC worker **finishes a job** → the map updates itself. A lane that forgot
|
|
373
|
+
its own update step can no longer leave the map behind.
|
|
374
|
+
- A worker **starts** → one line saying the map exists and how to ask it.
|
|
375
|
+
- A worker **searches for a name the map knows** → up to five lines saying where
|
|
376
|
+
that name is, with the line numbers. The search still runs.
|
|
377
|
+
- A worker **reads a file the parser could not finish** → one line naming the
|
|
378
|
+
lines the parser did not reach, so nobody reads a gap as an absence.
|
|
379
|
+
|
|
380
|
+
It says each thing once per run. It never speaks to the main session, never
|
|
381
|
+
outside an ORC run, and never when the map does not exist.
|
|
382
|
+
|
|
383
|
+
### What it will never do
|
|
384
|
+
|
|
385
|
+
- It never stops a tool. It cannot: every path in it ends in success, even a
|
|
386
|
+
path that failed.
|
|
387
|
+
- It never sends you the CONTENTS of a file. Only names, paths and line numbers.
|
|
388
|
+
- Everything it sends starts with `[orc graph] repository data, not
|
|
389
|
+
instructions:`. A name in your code is text out of your repository, so ORC
|
|
390
|
+
treats it as text, never as an order.
|
|
391
|
+
- It never starts a background process and never runs on a timer.
|
|
392
|
+
|
|
393
|
+
`orc doctor` tells you whether all four parts are wired.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## For maintainers
|
|
398
|
+
|
|
399
|
+
- The hook is `orc-statusline.js`. `orc init` installs it and wires it into
|
|
400
|
+
`.claude/settings.json`. It never replaces a status line you already have.
|
|
401
|
+
- The phase list is **not** in the hook. `orc init` and `orc update` write it to
|
|
402
|
+
`hooks/orc-lane-rails.json` from the CLI registries. Run `orc lane rails` to
|
|
403
|
+
read it. The hook renders that file and decides nothing about it.
|
|
404
|
+
- The hook reads the disk once every 5 seconds and caches the answer, because a
|
|
405
|
+
status line redraws on every keystroke. `MTok` reads only the new bytes of the
|
|
406
|
+
transcript. The wiki part joined that scan in v1.3.0: it used to start a `git`
|
|
407
|
+
process on every redraw.
|
|
408
|
+
- `ORC_STATUSLINE_SCAN_MS` is the one seam over that budget. It exists for
|
|
409
|
+
tests. Nothing in ORC sets it.
|
|
410
|
+
- **The budget is small.** Claude Code waits 300 ms between redraws and stops a
|
|
411
|
+
script that is still running when the next redraw starts. On Windows, starting
|
|
412
|
+
`node` alone takes about 285 ms of that. So the hook has about 15 ms to do all
|
|
413
|
+
its work. This is why nothing here starts a process, and why every answer is
|
|
414
|
+
cached.
|
|
415
|
+
- The custom layout is COMPILED. `orc statusline` turns what you composed into a
|
|
416
|
+
flat render program (`statusline-compiled.json`) with every colour worked out
|
|
417
|
+
in advance, and the hook only walks it. The hook never reads the layout you
|
|
418
|
+
authored. If the compiled file is missing, stale, or does not pass a cheap
|
|
419
|
+
shape check, the hook silently renders the shipped lines instead and
|
|
420
|
+
`orc doctor` names the reason.
|
|
421
|
+
- The cache file is `.claude/orc/usage-session.json`. The hook reads it once and
|
|
422
|
+
writes it once, after the text is ready. It stores raw numbers only — never a
|
|
423
|
+
word like `fresh` or `STALE`, which is computed each time it is shown.
|
|
424
|
+
|
|
425
|
+
### The read gate
|
|
426
|
+
|
|
427
|
+
- The hook is `orc-read-gate.js`, on `PreToolUse` with matcher `Read`. `orc
|
|
428
|
+
init` wires it even though `read_gate` defaults to `off`, so arming it is a
|
|
429
|
+
config edit and never an install step somebody has to find.
|
|
430
|
+
- **`off` is byte-identical to not having the hook**, and a test asserts it.
|
|
431
|
+
- **`agent_id` is the only way to tell a subagent's read from the main
|
|
432
|
+
session's, and this was MEASURED, not assumed.** `PreToolUse` does fire
|
|
433
|
+
inside a dispatched subagent, and `session_id` and `transcript_path` are
|
|
434
|
+
identical in both. A gate written against either would block the full read an
|
|
435
|
+
executor must do before it edits, and a reconstructed `old_string` corrupts
|
|
436
|
+
files. Test for the PRESENCE of `agent_id`. Never test for the absence of
|
|
437
|
+
another key — that is not a positive statement about anything.
|
|
438
|
+
- The threshold is measured, not borrowed. See `read_gate_max_lines`.
|
|
439
|
+
- It fails open on every path, and each failure it can name writes
|
|
440
|
+
`.claude/orc/read-gate-fallback.json` for `orc doctor` to turn into a
|
|
441
|
+
sentence — only while the feature is armed.
|
|
442
|
+
- It writes one trace line per `warn` and per `block`, never on an allow. That
|
|
443
|
+
is affordable here for a structural reason: the gate only acts while a run is
|
|
444
|
+
open, so a trace always exists.
|