auto-mode 0.18.0 → 0.19.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/README.md CHANGED
@@ -6,108 +6,78 @@
6
6
  </p>
7
7
  </div>
8
8
 
9
- **auto-mode** judges the tool calls that Claude Code would prompt for. It is a core library and a
10
- Claude Code mod. The mod returns allow, deny, or no verdict before the permission dialog appears.
11
- Local rules settle read-only actions and build cleanup; Jev evaluates the remaining actions against
12
- a written policy.
9
+ **auto-mode** tries to mitigate the risk of unattended non-Claude agents inside Claude Code.
13
10
 
14
- The Jev request includes the policy, your configured environment and permissions, the complete
15
- proposed action, and the last direct user message. It excludes the rest of the session. Configure
16
- standing permissions upfront; earlier conversational grants and restrictions are unavailable to the
17
- classifier.
11
+ auto-mode runs as a Claude Code mod, and its operating model is loosely modelled on Anthropic's
12
+ native auto mode. Instead of one model, it pairs a fast decision model (such as Jev) with a
13
+ traditional classifier-judge model (such as Haiku) to cover the first one's shortcomings.
18
14
 
19
15
  ## Install
20
16
 
17
+ auto-mode needs node 24 or later, Claude Code, and a TypeSafe API key for Jev.
18
+
21
19
  ```sh
22
20
  npm i -g auto-mode
23
21
  claude --plugin-dir "$(npm root -g)/auto-mode/mods/auto-mode"
24
22
  ```
25
23
 
26
- The package ships the mod in `mods/auto-mode`. The mod runs the `auto-mode` executable on `PATH`;
27
- its `command` option takes another executable. [Claude permission mod](./docs/guides/claude-mod.md)
28
- covers the mod, its time limits, and a trial session.
29
-
30
- Create the classifier configuration:
31
-
32
- ```json
33
- {
34
- "classifiers": { "jev": { "apiKeyEnv": "TYPESAFE_API_KEY" } },
35
- "decision": { "classifier": "jev" }
36
- }
37
- ```
38
-
39
- Save it as `~/.config/auto-mode/config.json` and export your TypeSafe API key, or set the entry's
40
- `apiKeyCommand` to a command that prints it. [Configuration](./docs/guides/configuration.md) covers
41
- the registries and credentials.
42
-
43
- ## Standing permissions
44
-
45
- Jev imports explicit entries from `autoMode.environment`, `autoMode.allow`, `autoMode.soft_deny`,
46
- and `autoMode.hard_deny` in your user Claude settings. It imports no credential values or shell
47
- permission patterns. `$defaults` refers to auto-mode's shipped policy; it does not expand Claude's
48
- built-in classifier rules.
49
-
50
- Configured allows clear soft blocks. Hard blocks take priority over all allows and conversational
51
- consent. [False-positive clarification](./docs/guides/policy.md#false-positive-clarification) can
52
- clear Policy Tampering and Audit Tampering. The last direct user message can supply the exact action
53
- and target that a soft block needs; replies such as “go ahead” cannot supply an unseen proposal.
54
-
55
- Read [the policy](./policy/rules.md) before you enable the mod.
56
- [Writing a policy](./docs/guides/policy.md) covers the precedence and the limits of an action-only
57
- assessment.
58
-
59
- ## Decisions and failures
60
-
61
- Jev evaluates each named rule with a typed choice between allow and block. auto-mode allows the
62
- action unless some rule's block probability reaches the threshold, 0.2 by default. Every denial
63
- names the rule with the highest block probability, the harm, and what clears it, and the agent
64
- continues on another path. The threshold is configurable and needs evaluation against your actions.
65
-
66
- A missing key, failed API call, malformed response, or oversized request follows
67
- `decision.onFailure`. The default `defer` writes no verdict and keeps the prompt; `deny` fails
68
- closed. Failures write a diagnostic to stderr. auto-mode never truncates a Jev action to make it
69
- fit.
70
-
71
- ## Commands
72
-
73
- | Command | Effect |
74
- | ---------------------------- | ----------------------------------------- |
75
- | `auto-mode run` | Read a mod request and write a verdict |
76
- | `auto-mode run --explain` | Write decision details to stderr |
77
- | `auto-mode run --local-only` | Skip the model tier |
78
- | `auto-mode run --jev-only` | Require Jev with a 5-second API timeout |
79
- | `auto-mode print-prompt` | Print the selected provider's base policy |
80
-
81
- The mod evaluates only ask decisions and preserves existing allow and deny decisions. It runs the
82
- CLI as a bounded child process with `--jev-only`. The `spark`, `claude`, `glm`, and `messages`
83
- classifier kinds use the Messages API and serve library callers.
24
+ Export your key as `TYPESAFE_API_KEY`, or point the configuration at a command that prints it.
25
+ [Claude permission mod](./docs/guides/claude-mod.md) covers the mod and a trial session you can
26
+ undo.
27
+
28
+ ## Features
29
+
30
+ - **Local rules** allow read-only calls and build-output cleanup without a model call
31
+ ([local rules](./docs/architecture/stages/local-rules.md)).
32
+ - **Containment** denies a write outside the task's own worktrees, branches and pull requests
33
+ ([containment](./docs/architecture/stages/containment.md)).
34
+ - **The edit bypass** allows an in-scope file edit once a secret scan finds nothing
35
+ ([the edit bypass](./docs/architecture/stages/edit-bypass.md)).
36
+ - **Jev** judges the remaining calls against the shipped rules and your own
37
+ ([Jev](./docs/architecture/stages/jev.md)).
38
+ - **The judge**, on by default, reviews every Jev deny, and overturns it when your last message
39
+ asked the main agent for exactly this action, or when no rule covers the action
40
+ ([the judge](./docs/architecture/stages/judge.md)).
41
+ - **The denial budget** hands a call back to you when an agent keeps getting denied
42
+ ([the denial budget](./docs/architecture/stages/denial-budget.md)).
43
+ - **Your own rules** from your Claude settings join the policy as block rules
44
+ ([settings and repository facts](./docs/architecture/evidence/settings-and-repository.md)).
45
+ - **Action diagnostics** record how each call was decided, without the command or the prompt
46
+ ([action diagnostics](./docs/guides/diagnostics.md)).
47
+
48
+ Read [the rules](./policy/rules.md) before you enable the mod.
49
+ [Writing a policy](./docs/guides/policy.md) covers how the rules clear and how to change them.
84
50
 
85
51
  ## Library
86
52
 
53
+ You can call auto-mode's core APIs from your own code. `parseActionRequest` reads the request the
54
+ mod sends the CLI ([the contract](./docs/architecture/mod.md#the-contract)), and `classifyAction`
55
+ runs it through [the stages](./docs/architecture/overview.md#the-path-of-a-prompted-call) from the
56
+ local rules to the judge. The two options in the example apply the denial budget and write the
57
+ action log, as the CLI does, and `recordScope` adds what a finished Bash call created to the
58
+ session's scope.
59
+
87
60
  ```ts
88
61
  import { classifyAction, loadConfig, parseActionRequest } from 'auto-mode';
89
62
 
90
63
  const request = parseActionRequest(body);
91
64
 
92
65
  if (request !== null) {
93
- const outcome = await classifyAction(request, await loadConfig());
66
+ const outcome = await classifyAction(request, await loadConfig(), {
67
+ budget: true,
68
+ actionLog: true,
69
+ });
94
70
  }
95
71
  ```
96
72
 
97
- `classifyAction` runs both tiers and returns the verdict, a note, and diagnostics. A request carries
98
- the session identity, the action, and the task context; `parseActionRequest` builds one from the
99
- mod's JSON. Build every request with `parseActionRequest`: it drops a child agent's direct user
100
- message, and the classifiers trust the request they receive.
73
+ ## Configuration
74
+
75
+ Read the [configuration](./docs/guides/configuration.md) guide, which covers every field and the
76
+ credentials.
101
77
 
102
78
  ## Documentation
103
79
 
104
- - [Architecture](./docs/architecture/overview.md) covers the request, decision combination, and the
105
- mod contract.
106
- - [Configuration](./docs/guides/configuration.md) covers every setting and the imported Claude
107
- rules.
108
- - [Claude permission mod](./docs/guides/claude-mod.md) covers the request, the verdict, and the time
109
- limits.
110
- - [Writing a policy](./docs/guides/policy.md) covers rule edits and evaluation.
80
+ [docs/](./docs/README.md) covers the architecture and the user guides.
111
81
 
112
82
  ## Licence
113
83