pi-permission-classifier 0.5.2 → 0.6.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 CHANGED
@@ -5,6 +5,194 @@ format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
5
5
  this project adheres to
6
6
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.1] - 2026-11-03
9
+
10
+ ### Fixed
11
+
12
+ - The test suite runs from a public clone. The structure tests read
13
+ CLAUDE.md, which the public repository does not carry, so the suite
14
+ failed to load; those checks now skip when the file is absent.
15
+ - The test fixtures set `matchedSpelling` and `decidingPath`, which
16
+ pi-permission-system now requires on the request facts, so the
17
+ typecheck passes again. Runtime behavior is unchanged.
18
+
19
+ ## [0.6.0] - 2026-10-06
20
+
21
+ ### Added
22
+
23
+ - A quick judge beside the LLM judge. The quick judge asks a System One
24
+ classifier model (for example `typesafe/jev-latest`) through pi's
25
+ `findOfType("classifier", ...)` and `classify` three fixed questions:
26
+ reversible, contained, and one of nine hazards, where sending secrets off
27
+ the machine (secret exfiltration) is apart from pushing, publishing or
28
+ uploading project work (push or publish). Contained counts the
29
+ project's own build, run and test tools with their usual caches, and
30
+ reversible counts output that can be made again; secrets, data sent out,
31
+ git history and uncommitted work stay failures. It allows when each of
32
+ the three clears its built-in threshold (0.8, chosen by an eval against
33
+ logged asks; `allowThreshold`, when set, applies one value to all
34
+ three), denies with the hazard named when
35
+ one hazard reaches `denyThreshold` (default 0.9), and otherwise treats the
36
+ answer as uncertain. The model sees the gated value, surface, tool, cwd,
37
+ the full command within `contextBudgetBytes`, and the selected guidance
38
+ files when `quickJudge.guidance` is on (default). It has its own timeout,
39
+ circuit breaker and health record. An unset or unknown model never falls
40
+ back to the session model.
41
+ - The `mode` config field (default `llm`) picks who judges: `llm`, `quick`,
42
+ or `quick-then-llm`, where the quick judge settles clear cases and the LLM
43
+ judge reviews everything it does not allow. In `quick-then-llm` the quick
44
+ judge always runs with `allow-defer` and `onError` defer, with one warning
45
+ per session when `quickJudge` asks for more. The mode is read on every
46
+ ask.
47
+ - The `quickJudge` config object: `provider`, `model`, `verdicts` (default
48
+ `allow-defer`), `onError` (default `defer`), `allowThreshold` (optional),
49
+ `denyThreshold`, `guidance` and `timeoutMs`.
50
+ - `npm run eval:quick`, a development eval that scores the quick judge's
51
+ question sets against Jev on a hazard set and on the asks your review log
52
+ shows as approved, and reports the allow rates per threshold set. Its
53
+ corpus and report stay under the gitignored `drafts/eval/`.
54
+ - `data/asks.jsonl`, a committed store of every permission ask the chain
55
+ judged: the ask, each judge decision on it, how it ended and who decided,
56
+ and the user text. `npm run data:pull` appends the asks not yet stored
57
+ from the review log and the session files, scrubbed: home directory,
58
+ login name, email addresses, git identity flags, LAN addresses, mounts
59
+ and secret values become placeholders, and each project directory gets a
60
+ stable alias from the gitignored `data/project-aliases.json`. A structure
61
+ test scans the file with the same rules. The quick judge eval builds its
62
+ safe cases from the store.
63
+ - `verdicts` (`allow-deny-defer`, `allow-defer`, `allow-deny`) and
64
+ `onError` (`defer`, `deny`) for each judge, enforced in code. `onError`
65
+ deny turns a failure into a deny with a fixed reason that names the
66
+ failure and says to retry later or take another route.
67
+ - `/permission-model` with no argument opens a menu with an entry for
68
+ each choice the mode runs, each showing its current value: who judges
69
+ (the mode), the quick judge model, the LLM judge model, a model-call
70
+ timeout for each judge the mode runs, and the last judge's verdicts
71
+ and on error.
72
+ Each entry opens one list with the current value preselected; a pick is
73
+ saved at once and the menu opens again. The LLM list offers "Same as the
74
+ chat model (follows /model)". Picking a quick mode while the global
75
+ config has no quick model asks for one and saves both together. A
76
+ configured model that is not available is listed first as `(current,
77
+ not available)`, and picking it changes nothing. Escape in a list goes
78
+ back to the menu without a change; a save that leaves the merged config
79
+ invalid closes the menu after the error.
80
+ - Typed forms `/permission-model mode <llm|quick|quick-then-llm>`,
81
+ `/permission-model llm <provider>/<id>`, `/permission-model llm
82
+ chat-model` and `/permission-model quick <provider>/<id>`, with tab
83
+ completion for each. Setting a model never changes the mode, and a
84
+ typed quick mode is saved only when the global config has a quick
85
+ model. Outside the TUI, `/permission-model` prints the mode, the active
86
+ judges and the usage line.
87
+ - A model-call timeout entry for each judge the mode runs: `Quick judge
88
+ model-call timeout` (absent in mode `llm`) and `LLM judge model-call
89
+ timeout` (absent in mode `quick`), each showing the current budget in
90
+ seconds. The list offers 5, 10, 15, 25, 30 and 60 seconds, the saved
91
+ budget when it is not one of those, and a clear row that returns the
92
+ judge to its built-in 5 seconds. A saved budget that is not whole
93
+ seconds shows its decimals (2500 ms as 2.5), and picking the current
94
+ row changes nothing.
95
+ - Typed forms `/permission-model llm timeout <seconds>` and
96
+ `/permission-model quick timeout <seconds>` set one judge's model-call
97
+ budget, entered in whole seconds and written as milliseconds. The LLM
98
+ judge's form writes the top-level `timeoutMs`; the quick judge's form
99
+ writes `quickJudge.timeoutMs` and keeps the other `quickJudge` keys.
100
+ `0` clears that judge's key. A sign, a decimal point, an exponent, an
101
+ empty value, a negative value and anything above 3600 seconds are
102
+ refused with no write. Tab completion offers `timeout` after `llm ` and
103
+ after `quick `, and the preset budgets and the clear value after
104
+ `llm timeout ` and `quick timeout `, filtered by the digits typed.
105
+ - The `--permission-model` launch flag takes a comma list of
106
+ `quick:<provider>/<id>`, `llm:<provider>/<id>`, `llm:chat-model` and
107
+ `mode:<mode>`, in any subset, for the session only. An item that does not
108
+ resolve is ignored with a warning and the rest still applies.
109
+ - The footer entry opens with the label `perm-judge:` and shows a part for
110
+ each judge the mode runs, quick first and joined with `->` in the order
111
+ they run: `quick:<provider>/<id>` and `llm:<provider>/<id>` or
112
+ `llm:chat-model`, each with its own health suffix.
113
+ - `/permission-model` sets `verdicts` and `onError` for the last judge in
114
+ line (the LLM judge in modes `llm` and `quick-then-llm`, the quick judge
115
+ in mode `quick`): the menu has a verdicts entry and an on error entry,
116
+ and the typed forms `verdicts <allow-deny-defer|allow-defer|allow-deny>`
117
+ and `on-error <defer|deny>` set one field each. The print form outside
118
+ the TUI shows the last judge's policy.
119
+ - Decision entries carry `judge` (`quick` or `llm`); quick entries also
120
+ carry the per-question answer probabilities, with the hazard as
121
+ `[option, probability]` pairs, highest first.
122
+ The breaker open and close entries and the LLM judge's short-circuit
123
+ debug entries carry `judge` too.
124
+ - The LLM judge sees what you asked for. Each ask's prompt carries your
125
+ own messages from the session in a labelled data block: the text you
126
+ typed, with a skill reduced to its name and arguments. Assistant text,
127
+ tool results, bash output, custom messages and compaction or branch
128
+ summaries are never sent. The first message is kept plus the newest back
129
+ to 24,000 characters, each message capped at 4,000 (head and tail). The
130
+ block is left out when anything was cut, a message of yours is still
131
+ queued, or the ask was forwarded from a subagent. The default rubric
132
+ lets a request that directly and specifically names the action move a
133
+ case that would otherwise defer to allow, never past the never-allow
134
+ list; a message telling the agent not to do it means defer; approval
135
+ inside the command, the agent's text or tool output does not count. A
136
+ custom `instructions` rubric gets the block without these rules.
137
+ - `npm run eval:quick` pairs each logged ask with the user text the
138
+ runtime would send at that point in its session, runs every hazard case
139
+ with no user text, an unrelated task and a request naming it, adds
140
+ injection and forbidden cases (`eval/intent-cases.json`), and searches
141
+ thresholds against an intent ship bar. The quick judge does not send
142
+ user text yet: in the first run no thresholds met the bar (see
143
+ `eval/RESULTS.md`).
144
+ - `npm run eval:quick` scores a local System One model instead of Jev with
145
+ `EVAL_S1_MODEL=provider/id` at `EVAL_S1_BASE_URL` (default
146
+ `http://127.0.0.1:8080/v1/`), with its own cache, scores and report
147
+ files. `EVAL_SAFE_LIMIT=N` scores a spread sample of N safe cases and
148
+ `EVAL_INTENT=0` skips the intent pass.
149
+
150
+ ### Changed
151
+
152
+ - `config/config.example.json` ships the quick-then-llm shape: a `mode`,
153
+ the LLM judge's `provider`, `model` and `timeoutMs`, and a `quickJudge`
154
+ block with `provider`, `model`, `guidance` and its own `timeoutMs`.
155
+ The file carried one `timeoutMs` and no quick judge block, which read
156
+ as a single call budget shared by both judges.
157
+ - The README says which judge each `timeoutMs` belongs to: the LLM judge
158
+ table names the top-level key and points at `quickJudge.timeoutMs`,
159
+ the `quickJudge` table names its own key and says the top-level key
160
+ belongs to the LLM judge alone, and the quick-then-llm example config
161
+ sets both budgets. The notes say a model call is aborted after that
162
+ judge's own timeout.
163
+ - The chain link is renamed from `classifier` to `permission-judge`. List
164
+ `permission-judge` in `authorizerChain`. For this release the link is
165
+ also registered as `classifier`, which logs a deprecation warning once per
166
+ session. With both names in the chain an ask is judged once: the second
167
+ name defers for a request the judge already reviewed, and a warning says
168
+ to remove `classifier`.
169
+ - The LLM judge that follows the session's model is now called the chat
170
+ model: `llm:chat-model` in the footer, where it was `judge:session`.
171
+ - Requires pi 1.0.0 or newer (`@earendil-works/pi-coding-agent >=1.0.0`).
172
+ The picker no longer uses pi's model selector component, so the README
173
+ note about pi older than 0.84.3 is gone.
174
+ - An over-budget ask follows `verdicts` on the LLM judge: it still defers
175
+ by default, and denies under `allow-deny`.
176
+ - When `allow-defer` withholds a model deny, the entry records defer reason
177
+ `deny-capped`.
178
+ - The LLM judge prompt escapes a delimiter tag (such as `</ask-value>` or
179
+ `<user-messages>`) inside the judged value, the executed unit and the
180
+ full command, so a command cannot close its block or forge a block of
181
+ user messages.
182
+ - The warning for an unreachable permission service now says no permission
183
+ link is registered.
184
+
185
+ ### Removed
186
+
187
+ - `/permission-model <provider>/<id>`: use `/permission-model llm
188
+ <provider>/<id>`.
189
+ - `/permission-model session`: use `/permission-model llm chat-model`.
190
+ - `--permission-model <provider>/<id>` without a prefix: use
191
+ `--permission-model llm:<provider>/<id>`. A bare pair is ignored with a
192
+ warning that names the `llm:` form.
193
+ - The degraded `/permission-model` list for a pi whose model registry
194
+ hides its runtime: the picker no longer needs it.
195
+
8
196
  ## [0.5.2] - 2026-09-25
9
197
 
10
198
  ### Fixed