auto-mode 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -1,128 +1,95 @@
1
1
  <div align="center">
2
2
  <h1>auto-mode</h1>
3
-
4
3
  <p>
5
4
  <a href="https://www.npmjs.com/package/auto-mode"><img src="https://img.shields.io/npm/v/auto-mode" alt="npm version"></a>
6
5
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
7
6
  </p>
8
-
9
- <p>
10
- <a href="./docs/README.md">Documentation</a> •
11
- <a href="./docs/guides/configuration.md">Configuration</a> •
12
- <a href="./policy/rules.md">The rules</a> •
13
- <a href="./docs/architecture/overview.md">Architecture</a>
14
- </p>
15
7
  </div>
16
8
 
17
- **auto-mode** is a permission classifier that runs as a hook. It decides whether a coding agent's
18
- next action should run.
9
+ **auto-mode** judges coding-agent tool calls through a permission hook. It returns allow, deny, or
10
+ no verdict to Claude Code, Codex, and Muse Code. Local rules settle read-only actions and build
11
+ cleanup; Jev evaluates the remaining actions against a written policy.
19
12
 
20
- Claude Code's built-in auto mode judges actions only for Claude. Point Claude Code at another model
21
- through an Anthropic-compatible gateway — GLM, Kimi, Muse Spark — and that judging stops. Every
22
- shell command, file write, and push needs your approval again.
23
-
24
- auto-mode replaces it. The harness calls it before a tool runs, hands it the pending call, and reads
25
- back allow, deny, or nothing. It works in Claude Code, Codex, and Muse Code, and behaves the same
26
- whichever model drives them.
13
+ The Jev request includes the policy, your configured environment and permissions, the complete
14
+ proposed action, and the last direct user message. It excludes the rest of the session. Configure
15
+ standing permissions upfront; earlier conversational grants and restrictions are unavailable to the
16
+ classifier.
27
17
 
28
18
  ## Install
29
19
 
30
20
  ```sh
31
21
  npm i -g auto-mode
32
- auto-mode init claude # or codex, or muse
22
+ auto-mode init claude --event permission-request
33
23
  ```
34
24
 
35
- `init` prints the hook entry, the file to paste it into, and the extra step that harness needs. It
36
- does not write the file itself.
25
+ Paste the printed hook entry into the file it identifies. `init` prints configuration and never
26
+ writes into a harness's settings. [Harnesses](./docs/guides/harnesses.md) covers registration for
27
+ each harness.
37
28
 
38
- The judging model needs a key. The default model is Muse Spark:
29
+ Create the classifier configuration:
39
30
 
40
- ```sh
41
- mkdir -p ~/.config/auto-mode
42
- cat > ~/.config/auto-mode/config.json <<'JSON'
43
- { "preset": "spark", "provider": { "apiKeyEnv": "META_API_KEY" } }
44
- JSON
31
+ ```json
32
+ {
33
+ "preset": "jev",
34
+ "provider": { "apiKeyEnv": "TYPESAFE_API_KEY" }
35
+ }
45
36
  ```
46
37
 
47
- Presets for `claude` and `glm` ship too. See [Configuration](./docs/guides/configuration.md).
48
-
49
- ## How it decides
50
-
51
- Two tiers.
38
+ Save it as `~/.config/auto-mode/config.json` and export your TypeSafe API key. Hooks that run with a
39
+ scrubbed environment need `provider.apiKeyCommand` instead.
40
+ [Configuration](./docs/guides/configuration.md) covers credentials and provider overrides.
52
41
 
53
- 1. **Local rules.** Deterministic matching, no network call, under a millisecond. Answers allow or
54
- escalate, never deny. Reads, listings, `git status`, and deleting build output are settled here
55
- and never reach the model.
56
- 2. **The model.** Everything else goes to a small reasoning model with the policy as its system
57
- prompt. A hard case takes 13 to 24 seconds.
42
+ ## Standing permissions
58
43
 
59
- Tier one never denies because the two errors cost differently. A wrong allow costs one unwatched
60
- action. A wrong deny stops work you asked for, and the rules that deny are prose that needs a
61
- reader.
44
+ Jev imports explicit entries from `autoMode.environment`, `autoMode.allow`, `autoMode.soft_deny`,
45
+ and `autoMode.hard_deny` in your user Claude settings. It imports no credential values or shell
46
+ permission patterns. `$defaults` refers to auto-mode's shipped policy; it does not expand Claude's
47
+ built-in classifier rules.
62
48
 
63
- ## The policy
49
+ Configured allows clear soft blocks. Hard blocks take priority over all allows and conversational
50
+ consent. [False-positive clarification](./docs/guides/policy.md#false-positive-clarification) can
51
+ clear Policy Tampering and Audit Tampering. The last direct user message can supply the exact action
52
+ and target that a soft block needs; replies such as “go ahead” cannot supply an unseen proposal.
64
53
 
65
- Two files. Both are sent to the model verbatim, and neither addresses you.
54
+ Read [the policy](./policy/rules.md) before you enable the hook.
55
+ [Writing a policy](./docs/guides/policy.md) covers the precedence and the limits of an action-only
56
+ assessment.
66
57
 
67
- | File | Holds | Edit it to |
68
- | ------------------------------------------------ | ------------------------------------------------------------ | -------------------------- |
69
- | [`policy/rules.md`](./policy/rules.md) | 22 rules, 7 exceptions | Change what is blocked |
70
- | [`policy/classifier.md`](./policy/classifier.md) | Threat model, consent bar, evaluation rules, output contract | Change how judgement works |
58
+ ## Decisions and failures
71
59
 
72
- `classifier.md` carries a `<rules>` marker on its own line. At run time auto-mode replaces it with
73
- the whole of `rules.md`. `auto-mode print-prompt` writes the result, which is what the model reads.
60
+ Jev evaluates each named rule with a typed choice. auto-mode returns a denial for a confident block,
61
+ approval when every rule confidently allows the action, and manual approval for uncertain decisions.
62
+ The confidence threshold is configurable and needs evaluation against your actions.
74
63
 
75
- Rules come in two tiers. A **hard block** takes no consent, because it creates a risk you cannot see
76
- from inside the session. A **soft block** clears when you named the action and the detail that makes
77
- it dangerous — "force push this branch", not "tidy up the repo". Seven exceptions cover work that
78
- resembles a blocked action and is not: deleting `node_modules`, running a formatter, dropping a
79
- local test database.
64
+ A missing key, failed API call, malformed response, or oversized request follows `onFailure`. The
65
+ default `defer` writes no verdict and leaves the harness to decide; `deny` fails closed. Failures
66
+ write a diagnostic to stderr. auto-mode never truncates a Jev action to make it fit.
80
67
 
81
- Read [`policy/rules.md`](./policy/rules.md) before turning this on. To change a rule, edit it;
82
- `rulesPath` points at your own file and replaces the shipped one whole.
83
-
84
- ## Harnesses
85
-
86
- All three were verified end to end: the hook denied a real tool call and the harness stopped it.
87
-
88
- | Harness | Match every tool | Also needed |
89
- | ----------- | ----------------- | --------------------------------------- |
90
- | Claude Code | `"matcher": ".*"` | — |
91
- | Codex | omit `matcher` | `hooks = true`, and trust the hook once |
92
- | Muse Code | `"matcher": ""` | no `timeout_ms` key |
93
-
94
- Each difference stops the hook running if you get it wrong, and none of them reports an error.
95
- `init` prints the right one. Details in [Harnesses](./docs/guides/harnesses.md).
96
-
97
- ## Writing nothing is an answer
98
-
99
- It means auto-mode has no opinion, and the harness does what it would have done alone. That is the
100
- output for an unknown harness, an event that is not a tool gate, malformed input, a missing key, and
101
- a model that times out.
68
+ ## Commands
102
69
 
103
- auto-mode can therefore only narrow what your harness already allows. It never removes a gate that
104
- was there. Set `onFailure` to `deny` to fail closed instead.
70
+ | Command | Effect |
71
+ | ---------------------------- | ----------------------------------------- |
72
+ | `auto-mode run` | Read a hook payload and write a verdict |
73
+ | `auto-mode run --explain` | Write decision details to stderr |
74
+ | `auto-mode run --local-only` | Skip the model tier |
75
+ | `auto-mode run --jev-only` | Require Jev with a 5-second API timeout |
76
+ | `auto-mode print-prompt` | Print the selected provider's base policy |
77
+ | `auto-mode init <harness>` | Print a hook entry |
105
78
 
106
- ## Commands
79
+ Existing `spark`, `claude`, and `glm` presets use the Messages API and conversation history. Select
80
+ `jev` explicitly to change an existing provider configuration.
107
81
 
108
- | Command | What it does |
109
- | ---------------------------- | -------------------------------------------------- |
110
- | `auto-mode run` | Read a payload on stdin, write a verdict on stdout |
111
- | `auto-mode run --explain` | Also write the reasoning to stderr |
112
- | `auto-mode run --local-only` | Skip the model tier |
113
- | `auto-mode print-prompt` | Print the assembled system prompt |
114
- | `auto-mode init <harness>` | Print the hook entry to add |
82
+ The optional [Claude permission mod](./docs/guides/claude-mod.md) evaluates ask decisions before the
83
+ permission dialog. It preserves existing allow and deny decisions and has a bounded child process.
115
84
 
116
85
  ## Documentation
117
86
 
118
- - [Overview](./docs/architecture/overview.md) — the two tiers, harness detection, the verdict
119
- contract, prompt caching, and the failure modes.
120
- - [Configuration](./docs/guides/configuration.md) — every field, every preset, and how the key is
121
- found.
122
- - [Harnesses](./docs/guides/harnesses.md) — installing into Claude Code, Codex, and Muse Code, and
123
- what each does differently.
124
- - [Writing a policy](./docs/guides/policy.md) — the rule tiers, the consent bar, and how to change
125
- or replace the shipped rules.
87
+ - [Architecture](./docs/architecture/overview.md) covers the request, decision combination, and wire
88
+ contract.
89
+ - [Configuration](./docs/guides/configuration.md) covers every setting and the imported Claude
90
+ rules.
91
+ - [Harnesses](./docs/guides/harnesses.md) covers registration and hook trust.
92
+ - [Writing a policy](./docs/guides/policy.md) covers rule edits and evaluation.
126
93
 
127
94
  ## Licence
128
95