ultracost 0.2.0 → 0.2.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 +4 -2
- package/README.md +20 -74
- package/docs/PUBLISHING.md +10 -15
- package/docs/TESTING.md +4 -15
- package/docs/architecture.md +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,8 @@ All notable changes to this project are documented here. The format is based on
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.1] - 2026-06-14
|
|
10
|
+
|
|
9
11
|
### Changed
|
|
10
12
|
- **The cost gate is now mode-aware and hard in every permission mode.** It reads
|
|
11
13
|
`permission_mode` from the `PreToolUse` event: it asks (with the estimate) in
|
|
@@ -74,8 +76,8 @@ All notable changes to this project are documented here. The format is based on
|
|
|
74
76
|
- Data-driven `policy.json` with load-time validation (rejects undefined default tiers
|
|
75
77
|
and tiers whose model is in `neverUse`).
|
|
76
78
|
- `ultracost status`, `ultracost doctor`, `ultracost uninstall`.
|
|
77
|
-
- Docs: architecture, policy reference, and the ultracode rationale.
|
|
78
79
|
|
|
79
|
-
[Unreleased]: https://github.com/danielkremen818/ultracost/compare/v0.2.
|
|
80
|
+
[Unreleased]: https://github.com/danielkremen818/ultracost/compare/v0.2.1...HEAD
|
|
81
|
+
[0.2.1]: https://github.com/danielkremen818/ultracost/compare/v0.2.0...v0.2.1
|
|
80
82
|
[0.2.0]: https://github.com/danielkremen818/ultracost/compare/v0.1.0...v0.2.0
|
|
81
83
|
[0.1.0]: https://github.com/danielkremen818/ultracost/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
+
<img src="./assets/logo.png" alt="ultracost logo" width="150">
|
|
4
|
+
|
|
3
5
|
# ultracost
|
|
4
6
|
|
|
5
7
|
**Per-stage model routing for Claude Code dynamic workflows.**
|
|
@@ -29,14 +31,15 @@ guard that fails any unpinned stage.
|
|
|
29
31
|
|
|
30
32
|
No telemetry. No network on the hot path. MIT.
|
|
31
33
|
|
|
32
|
-
**Setup
|
|
34
|
+
**Setup:**
|
|
33
35
|
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
/plugin install ultracost@ultracost
|
|
36
|
+
```bash
|
|
37
|
+
npx ultracost init
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
> A Claude Code plugin is planned; today ultracost installs via the npm CLI.
|
|
41
|
+
|
|
42
|
+
**Command:** `ultracost check [script]` (or `/ultracost:check` in Claude Code) — flag any `agent()` stage missing a model pin.
|
|
40
43
|
|
|
41
44
|
**CLI verbs:** `init · check · audit · estimate · pricing · status · doctor · uninstall`.
|
|
42
45
|
|
|
@@ -75,90 +78,33 @@ ultracost makes the routing **explicit, policy-driven, and verifiable** — with
|
|
|
75
78
|
|
|
76
79
|
## Architecture
|
|
77
80
|
|
|
78
|
-
One shared core in `src/`, two delivery surfaces:
|
|
79
|
-
|
|
80
|
-
```mermaid
|
|
81
|
-
flowchart TD
|
|
82
|
-
subgraph core["src/ — shared core"]
|
|
83
|
-
POL["policy.js<br/>(policy.json — you own it)"]
|
|
84
|
-
RUL["rules.js<br/>(rule compiler)"]
|
|
85
|
-
GRD["guard.js<br/>(static analysis)"]
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
subgraph plugin["Claude Code plugin — PRIMARY"]
|
|
89
|
-
SK["skills/ultracost<br/>routing policy (always-relevant)"]
|
|
90
|
-
CMD["/ultracost:check command"]
|
|
91
|
-
HK["hooks.json<br/>SessionStart (all sources)"]
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
subgraph cli["npm CLI — secondary"]
|
|
95
|
-
BIN["bin/cli.js<br/>init · check · audit · doctor · status · uninstall"]
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
POL --> RUL
|
|
99
|
-
RUL --> SK
|
|
100
|
-
RUL --> BIN
|
|
101
|
-
GRD --> CMD
|
|
102
|
-
GRD --> BIN
|
|
103
|
-
HK --> RE["reinject.mjs<br/>(node, no bash/jq)"]
|
|
104
|
-
BIN --> RE
|
|
105
|
-
|
|
106
|
-
classDef ft fill:#1f6feb,stroke:#0b3d91,color:#fff;
|
|
107
|
-
class POL,RUL,GRD ft;
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The plan lives in **data** (`policy.json`), not in prose buried in a prompt. The guard is the enforcement layer the model can't talk its way out of. See [`docs/architecture.md`](./docs/architecture.md) for the full picture.
|
|
111
|
-
|
|
112
|
-
## Install
|
|
113
|
-
|
|
114
|
-
### Plugin (recommended)
|
|
115
|
-
|
|
116
|
-
Inside Claude Code, add the marketplace and install the plugin:
|
|
81
|
+
One shared core in `src/`, two delivery surfaces: an **npm CLI** (the install path today) and a Claude Code **plugin** (planned). Both compile from the same `policy.json`.
|
|
117
82
|
|
|
118
|
-
|
|
119
|
-
/plugin marketplace add danielkremen818/ultracost
|
|
120
|
-
/plugin install ultracost@ultracost
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Then verify a workflow script at any time:
|
|
124
|
-
|
|
125
|
-
```text
|
|
126
|
-
/ultracost:check ./path/to/workflow.js
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
The plugin bundles four things and **touches none of your existing files**:
|
|
83
|
+
<div align="center">
|
|
130
84
|
|
|
131
|
-
|
|
132
|
-
- a **`PreToolUse` cost gate** on the `Workflow` tool that hard-stops every dynamic-workflow launch with an estimate (set `ULTRACOST_GATE=off` to disable; see [`docs/ESTIMATES.md`](./docs/ESTIMATES.md)),
|
|
133
|
-
- the **`/ultracost:check`** command (the Workflow Guard), and
|
|
134
|
-
- a **routing-policy skill** for explicit reference when Claude authors workflow/ultracode/subagent scripts.
|
|
85
|
+
<img src="./assets/architecture.svg" alt="ultracost architecture — policy.json compiles through the src/ core into a Claude Code plugin and an npm CLI; the guard and a PreToolUse cost gate verify every workflow stage at runtime" width="960">
|
|
135
86
|
|
|
136
|
-
>
|
|
87
|
+
</div>
|
|
137
88
|
|
|
138
|
-
|
|
89
|
+
The plan lives in **data** (`policy.json`), not in prose buried in a prompt. The guard is the enforcement layer the model can't talk its way out of. See [`docs/architecture.md`](./docs/architecture.md) for the full picture.
|
|
139
90
|
|
|
140
|
-
|
|
91
|
+
## Install
|
|
141
92
|
|
|
142
93
|
```bash
|
|
143
94
|
npx ultracost init
|
|
144
95
|
```
|
|
145
96
|
|
|
146
|
-
This writes `~/.claude/ultracost/policy.json`, injects the routing block into `~/.claude/CLAUDE.md`, installs the re-inject hook (`~/.claude/ultracost/reinject.mjs`), and registers it in `~/.claude/settings.json`. New sessions pick it up immediately. Paths honor `CLAUDE_CONFIG_DIR` if you've relocated your config.
|
|
97
|
+
This writes `~/.claude/ultracost/policy.json`, injects the routing block into `~/.claude/CLAUDE.md`, installs the re-inject hook (`~/.claude/ultracost/reinject.mjs`), and registers it on `SessionStart` in `~/.claude/settings.json`. New sessions pick it up immediately. Paths honor `CLAUDE_CONFIG_DIR` if you've relocated your config.
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## Uninstall
|
|
151
|
-
|
|
152
|
-
### Plugin
|
|
99
|
+
Then verify a workflow script at any time:
|
|
153
100
|
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
/plugin marketplace remove ultracost
|
|
101
|
+
```bash
|
|
102
|
+
ultracost check ./path/to/workflow.js
|
|
157
103
|
```
|
|
158
104
|
|
|
159
|
-
|
|
105
|
+
> Requires Node ≥ 24. A Claude Code plugin — bundling the `SessionStart` policy injection, a `PreToolUse` cost gate on the `Workflow` tool, the `/ultracost:check` command, and a routing-policy skill — ships in this repo and is planned as a separate install path; for now use the npm CLI above.
|
|
160
106
|
|
|
161
|
-
|
|
107
|
+
## Uninstall
|
|
162
108
|
|
|
163
109
|
```bash
|
|
164
110
|
ultracost uninstall
|
package/docs/PUBLISHING.md
CHANGED
|
@@ -17,16 +17,16 @@ The GitHub handle is set to `danielkremen818` across the repo. If you fork or mo
|
|
|
17
17
|
update the handle in every file that ships:
|
|
18
18
|
|
|
19
19
|
- [x] `package.json` — `repository.url`, `bugs.url`, `homepage`.
|
|
20
|
-
- [x] `README.md` — install
|
|
20
|
+
- [x] `README.md` — the npm install command (`npx ultracost init`) and the npm/CI badge URLs.
|
|
21
21
|
- [x] `CHANGELOG.md` — the `[Unreleased]`/release compare links.
|
|
22
22
|
- [x] `.claude-plugin/plugin.json` — `homepage` and `repository`; also confirm `author` and `version`.
|
|
23
23
|
- [ ] `LICENSE` and `NOTICE` — confirm the copyright holder.
|
|
24
24
|
|
|
25
|
-
Names that must stay consistent across the plugin package and the docs (so the
|
|
26
|
-
install works):
|
|
25
|
+
Names that must stay consistent across the plugin package and the docs (so the planned
|
|
26
|
+
plugin install works once it is published):
|
|
27
27
|
|
|
28
|
-
- Marketplace name: **`ultracost`** and plugin name: **`ultracost`** →
|
|
29
|
-
|
|
28
|
+
- Marketplace name: **`ultracost`** and plugin name: **`ultracost`** → the plugin resolves
|
|
29
|
+
as `ultracost@ultracost`.
|
|
30
30
|
- Command resolves to **`/ultracost:check`**.
|
|
31
31
|
|
|
32
32
|
Sanity-check before any submission:
|
|
@@ -88,16 +88,11 @@ What to know:
|
|
|
88
88
|
|
|
89
89
|
### 2. Your own marketplace repo
|
|
90
90
|
|
|
91
|
-
ultracost ships its own `.claude-plugin/marketplace.json`, so
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/plugin install ultracost@ultracost
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
This is the install path the README leads with. It works the moment the repo is public —
|
|
100
|
-
put it in the README and launch posts.
|
|
91
|
+
ultracost ships its own `.claude-plugin/marketplace.json`, so the repo can serve as a
|
|
92
|
+
self-hosted plugin marketplace once that install path is announced. **Not yet documented as
|
|
93
|
+
user-facing** — the README leads with the npm CLI (`npx ultracost init`) for now. When the
|
|
94
|
+
plugin distribution is published, surface the marketplace-add + install steps here and in the
|
|
95
|
+
README and launch posts.
|
|
101
96
|
|
|
102
97
|
### 3. awesome-claude-code (hesreallyhim)
|
|
103
98
|
|
package/docs/TESTING.md
CHANGED
|
@@ -111,14 +111,8 @@ Two ways to load the plugin from your working copy. Option A registers a marketp
|
|
|
111
111
|
|
|
112
112
|
### Option A — local marketplace install
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```text
|
|
117
|
-
/plugin marketplace add ~/projects/ultracost
|
|
118
|
-
/plugin install ultracost@ultracost
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Or non-interactively from a shell:
|
|
114
|
+
Register the working copy as a local marketplace and install from it (the dev/test path —
|
|
115
|
+
not a user-facing install):
|
|
122
116
|
|
|
123
117
|
```bash
|
|
124
118
|
claude plugin marketplace add ~/projects/ultracost
|
|
@@ -247,13 +241,8 @@ ultracost uninstall # removes the CLAUDE.md block, hook, settings entry
|
|
|
247
241
|
npm unlink -g ultracost
|
|
248
242
|
|
|
249
243
|
# plugin install (Step 3, Option A)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
Inside Claude Code:
|
|
253
|
-
|
|
254
|
-
```text
|
|
255
|
-
/plugin uninstall ultracost@ultracost
|
|
256
|
-
/plugin marketplace remove ultracost
|
|
244
|
+
claude plugin uninstall ultracost@ultracost
|
|
245
|
+
claude plugin marketplace remove ultracost
|
|
257
246
|
```
|
|
258
247
|
|
|
259
248
|
`--plugin-dir` (Step 3, Option B) leaves nothing behind — it ends with the session.
|
package/docs/architecture.md
CHANGED
|
@@ -5,6 +5,16 @@ exposed through **two delivery surfaces**: a Claude Code **plugin** (primary) an
|
|
|
5
5
|
**npm CLI** (secondary). Both compile from the same policy, so the routing rules can never
|
|
6
6
|
drift between them.
|
|
7
7
|
|
|
8
|
+
<div align="center">
|
|
9
|
+
|
|
10
|
+
<img src="../assets/architecture.svg" alt="ultracost architecture — policy.json compiles through the src/ core into a Claude Code plugin and an npm CLI; the guard and a PreToolUse cost gate verify every workflow stage at runtime" width="960">
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
> The diagram above is generated by [`scripts/generate-architecture-svg.py`](../scripts/generate-architecture-svg.py)
|
|
15
|
+
> (offline; logos vendored under `scripts/icons/`). The mermaid source below is the
|
|
16
|
+
> text-first reference.
|
|
17
|
+
|
|
8
18
|
```mermaid
|
|
9
19
|
flowchart TD
|
|
10
20
|
subgraph core["src/ — shared core"]
|
|
@@ -43,7 +53,7 @@ flowchart TD
|
|
|
43
53
|
|
|
44
54
|
| | Plugin (primary) | npm CLI (secondary) |
|
|
45
55
|
|---|---|---|
|
|
46
|
-
| **Install** |
|
|
56
|
+
| **Install** | ships in-repo; a separate install path is planned (not yet announced) | `npx ultracost init` (the install path today) |
|
|
47
57
|
| **Routing guidance** | **`SessionStart` hook** injects the policy as context (no file mutation); a skill ships alongside for explicit reference | block injected into `~/.claude/CLAUDE.md` |
|
|
48
58
|
| **Guard** | `/ultracost:check` command (runs `guard.js`) | `ultracost check` / `ultracost audit` |
|
|
49
59
|
| **Policy injection** | `hooks/hooks.json` → `node "${CLAUDE_PLUGIN_ROOT}/templates/hooks/reinject.mjs"` (all `SessionStart` sources) | `node "<config>/ultracost/reinject.mjs"`, registered in `settings.json` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultracost",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Per-stage model routing for Claude Code dynamic workflows (ultracode). Quality-first policy, CLAUDE.md rule injection, and a workflow-script guard that catches subagent stages that would silently inherit Opus.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|