claude-token-saver 3.42.2 → 3.42.4
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.ko.md +36 -21
- package/README.md +29 -17
- package/package.json +1 -1
- package/src/cohesion.js +1 -1
- package/src/commands/handoff.js +2 -2
- package/src/commands/history.js +3 -3
- package/src/commands/install.js +1 -1
- package/src/commands/seed.js +1 -1
- package/src/commands/update-check.js +2 -2
- package/src/commands/upgrade.js +4 -4
- package/src/harness-templates.js +5 -5
- package/src/korean-style.js +1 -1
- package/src/seed-rules.js +1 -1
- package/src/update-check.js +1 -1
package/README.ko.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<img alt="Sprag" src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/site/assets/logo/sprag-lockup-light.svg" width="220">
|
|
6
6
|
</picture>
|
|
7
7
|
|
|
8
|
-
**AI 코딩 에이전트용 품질
|
|
8
|
+
**AI 코딩 에이전트용 품질 래칫**<br>**같은 실수는 두 번 없습니다**
|
|
9
9
|
|
|
10
10
|
[](https://www.npmjs.com/package/sprag-cli)
|
|
11
11
|
[](https://www.npmjs.com/package/claude-token-saver)
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
# Sprag
|
|
20
|
+
# Sprag
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**AI 코딩 에이전트에 거는 품질 래칫입니다. 에이전트는 그대로 일하고, 퇴행만 잠급니다.** 이름은 스프래그 클러치에서 왔습니다. 앞으로 도는 힘은 그대로 통과시키고, 역회전하는 순간 잠기는 부품입니다. Sprag는 Claude Code가 이미 남기는 세션 기록을 읽어 누적되는 이득으로 바꿉니다. 되풀이된 실패는 세션 시작마다 올라오는 규칙이 되고, 저렴한 티어가 감당한다고 증명된 작업은 실행 건마다 절감액 원장을 영수증 삼아 그쪽으로 위임되며, 캐시와 사용량 한도 문제는 아직 손쓸 수 있을 때 statusline에 나타납니다.
|
|
23
|
+
|
|
24
|
+
아낀 돈은 두 줄로 보여 줍니다. 라우팅과 문서 변환이 각자 한 줄씩 차지하며, 두 수치 모두 추정이 아니라 원장 기록입니다. 의존성 0, API 키 불요, 데이터는 컴퓨터 밖으로 나가지 않습니다.
|
|
23
25
|
|
|
24
26
|

|
|
25
27
|
|
|
@@ -45,16 +47,18 @@ gemini-2.5-pro 57.9% $734 ▰▰▰▰▰▰▰▰▰▰▰
|
|
|
45
47
|
|
|
46
48
|
v3.35.0 부터는 지출도 보입니다. 이번 달 1일 이후 쓴 금액을 `💵 Sep $42` 로 상시 표시하고, 5h/7d cap 이 아예 없는 LiteLLM 게이트웨이(Bedrock 등) 환경에서는 키 예산을 `🔑 budget ▰▱ 34% $34/$100` 게이지로 보여 줍니다.
|
|
47
49
|
|
|
48
|
-
##
|
|
50
|
+
## 설치 한 번에 전부 들어 있고, 첫날부터 동작합니다
|
|
49
51
|
|
|
50
|
-
| | 하는 일 |
|
|
51
|
-
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
| 🅷
|
|
55
|
-
|
|
|
52
|
+
| | 하는 일 |
|
|
53
|
+
|---|---|
|
|
54
|
+
| ⚙️ **래칫 규칙** | 되풀이된 실패가 한 줄짜리 규칙이 되어 매 세션에 올라옵니다. 후보는 기록에서 자동으로 찾아 주고, 프로젝트 범위와 전역 범위 중 어느 쪽에 넣을지는 사용자가 고릅니다. |
|
|
55
|
+
| 🔀 **모델 피팅** | 기록에서 뽑은 위임 규칙에 측정한 오류율과 절감액을 붙여 `ratchet-model.md`에 적습니다. 판별 기준은 공개 데이터로 [벤치마크](./docs/BENCHMARK.md)했습니다. |
|
|
56
|
+
| 🅷 **하네스 점수** | 다섯 가지 운영 원칙을 실시간으로 점검합니다 ([비용 −18.6% 실측](#실제-효과-도입-전후-리포트)). 검증 단계를 건너뛰면 완료를 보고하기 전에 `🅷 4/5`가 먼저 알려 줍니다. |
|
|
57
|
+
| 📊 **토큰 텔레메트리** | 캐시 적중률과 TTL, 컨텍스트 크기, 출력 급증, 두 가지 사용량 한도를 매 턴 프롬프트에 표시합니다. |
|
|
58
|
+
| 📄 **doc2md** | pptx와 xlsx, pdf, docx, fig를 필요할 때 변환합니다. 문서를 통째로 붙이는 대신 변환본만 읽으면 됩니다 ([발표자료 한 건에 51만 토큰 절약](#-doc2md-문서를-읽기-전에-markdown-으로-바꿉니다)). |
|
|
59
|
+
| 🇰🇷 **문체 게이트** | 쓰는 시점에 hook으로 검사합니다. 지금은 한국어 기술 문서를 지원하며 이중 피동과 번역투, 문장 연결을 살핍니다. |
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
실측 −18.6%는 하네스와 래칫의 몫이고, 라우팅과 문서 변환 절감액은 그 위에 얹힙니다. 두 절감액은 성격이 달라서 한 숫자로 합치지 않고, statusline이 각각의 줄로 보여 주며 금액이 큰 쪽을 위에 놓습니다.
|
|
58
62
|
|
|
59
63
|
## 목차
|
|
60
64
|
|
|
@@ -68,7 +72,6 @@ v3.35.0 부터는 지출도 보입니다. 이번 달 1일 이후 쓴 금액을 `
|
|
|
68
72
|
**사전 준비:** Node.js ≥ 18 (`node -v`로 확인 · macOS `brew install node` · Windows `winget install OpenJS.NodeJS.LTS` · Linux/WSL은 [nvm](https://github.com/nvm-sh/nvm) 권장)
|
|
69
73
|
|
|
70
74
|
```bash
|
|
71
|
-
npm uninstall -g claude-cache-monitor # (구 패키지 사용자만)
|
|
72
75
|
npm i -g sprag-cli
|
|
73
76
|
```
|
|
74
77
|
|
|
@@ -148,9 +151,11 @@ $ sprag route-scan savings # 모든 금액을 룰 단위까지 역추적
|
|
|
148
151
|
|
|
149
152
|
## 라우터가 아닙니다: 60초 설명
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
설치는 한 번이면 됩니다. 이미 쓰고 있는 세션을 그대로 읽으므로, 프롬프트를 쓰는 방식을 바꾸라고 요구하지 않습니다. 요청을 실시간으로 가로채거나 모델을 바꿔치기하지도 않습니다.
|
|
155
|
+
|
|
156
|
+
1. **되풀이된 실패가 규칙이 됩니다.** 처음 겪는 실패는 그냥 작업입니다. 같은 실패가 두 번째로 나타나면 Sprag가 규칙 후보로 알립니다. 적용 범위를 승인하면 그 뒤로는 세션이 시작될 때마다 규칙이 함께 올라옵니다.
|
|
157
|
+
2. **안전한 작업은 하위 에이전트가 맡습니다.** 이력상 안전하다고 확인된 작업과 맞아떨어지면, 더 저렴한 티어로 하위 에이전트를 띄워 처리하고 결과를 메인에게 돌려 검수하게 합니다. 틀려도 겉으로 드러나지 않는 작업은 메인 에이전트가 계속 맡습니다.
|
|
158
|
+
3. **비용 문제를 미리 알려 줍니다.** 캐시 적중률과 TTL 만료, 컨텍스트 증가, 두 가지 사용량 한도를 매 턴 읽어 statusline에 띄웁니다. 아직 손쓸 수 있을 때 보입니다.
|
|
154
159
|
|
|
155
160
|
### 실시간 모델 라우팅이 오히려 비용을 키우는 이유
|
|
156
161
|
|
|
@@ -225,7 +230,7 @@ Claude Code 안에서 `/claude-token-saver` Skill을 실행하거나, 칩에 적
|
|
|
225
230
|
| `sprag handoff` | 작업 상태를 `HANDOFF-*.md`로 백업 (캡 임박 시) |
|
|
226
231
|
| `sprag mode [keywords...]` | 출력 설정 (`icon`/`text`, `ko`/`en`, `1h`~`30d` 윈도 등) |
|
|
227
232
|
| `sprag harness ...` | 🅷 Harness 관리 (아래 참고) |
|
|
228
|
-
| `sprag route-scan` | 상위 모델이 반복 처리한 쉬운 작업을 감지해 haiku 위임
|
|
233
|
+
| `sprag route-scan` | 상위 모델이 반복 처리한 쉬운 작업을 감지해 haiku 위임 래칫 룰을 제안합니다 (아래 참고) |
|
|
229
234
|
| `sprag route-scan savings` | 라우팅 절감 원장입니다. 모델 이동별 합계와 실행별 내역을 함께 보여 주며, 표시되는 금액의 근거가 됩니다 |
|
|
230
235
|
| `sprag compact-window` | 1M 컨텍스트를 쓰면서 자동 압축 창이 설정되지 않았으면 경고하고, `set`으로 40만에 고정합니다 (아래 참고) |
|
|
231
236
|
| `sprag korean on\|off\|status` | 한국어 문체 지침을 세션 시작 시 주입하고, 쓰기 시점 검사를 함께 설치합니다 (아래 참고) |
|
|
@@ -264,14 +269,14 @@ sprag harness check # 현재 점수 (글로벌 fallback 인정)
|
|
|
264
269
|
sprag harness analyze # 훅 없이도 수동으로 전사 분석을 실행해 harness-state.json 갱신
|
|
265
270
|
sprag harness promote <N> --project|--global # 경고 #N → ratchet 룰 (스코프 필수)
|
|
266
271
|
sprag harness promote "<룰 텍스트>" --project|--global # 내가 직접 정의한 룰도 같은 명령으로 등록
|
|
267
|
-
sprag harness pull # 패키지 동봉 큐레이션 룰 → 내 글로벌
|
|
272
|
+
sprag harness pull # 패키지 동봉 큐레이션 룰 → 내 글로벌 래칫에 등록 (opt-in, 중복 스킵)
|
|
268
273
|
sprag harness list / rm <N> # 룰 조회 / 삭제 (자동 .bak)
|
|
269
274
|
sprag harness off | on # 🅷 표시 토글
|
|
270
275
|
```
|
|
271
276
|
|
|
272
277
|
- `promote`는 non-TTY 환경(스크립트나 LLM 호출)에서 `--project` 또는 `--global` 플래그가 **반드시 필요합니다.** 적용 범위가 사용자에게 묻지 않은 채 결정되는 사고를 막기 위한 설계입니다.
|
|
273
|
-
- `pull`은 패키지에 동봉된 **제작자 큐레이션
|
|
274
|
-
- `seed`는 같은 프리셋을 **한 건씩** 물어보는 경로입니다. `pull`이
|
|
278
|
+
- `pull`은 패키지에 동봉된 **제작자 큐레이션 래칫 룰**(`presets/ratchet-rules.json`, 실제 반복 사고에서 승격된 범용 룰만)을 내 글로벌 래칫(`~/.claude/ratchet.md`)에 등록합니다. 설치(`install`)나 `init`은 아무것도 자동 주입하지 않으며, `pull`은 항상 opt-in이고 재실행해도 중복이 없습니다(멱등). 마음에 안 드는 룰은 `harness rm`으로 제거하면 됩니다.
|
|
279
|
+
- `seed`는 같은 프리셋을 **한 건씩** 물어보는 경로입니다. `pull`이 래칫 룰 전체를 한 번에 등록하는 명령인 데 반해, `seed`는 모델 피팅 프리셋까지 포함해 설치·업그레이드 후 첫 세션에서 한 건씩 제안합니다 ([아래](#-seed-설치-직후부터-위임이-걸리게-하는-시작-룰)).
|
|
275
280
|
- 🅷⚠ 런타임 경고(`ratchet?` `no-evidence` `PEV-skip`)는 30분 후 자동 만료되고, 하위 디렉터리 세션도 프로젝트에 올바르게 매칭됩니다. PEV-skip은 변경성 도구(Edit/Write/Bash)만 카운트해 읽기 위주 세션에서는 발동하지 않습니다 (v2.16.0+).
|
|
276
281
|
|
|
277
282
|
<details>
|
|
@@ -365,14 +370,14 @@ v3.10.0부터는 프로파일 ID를 역할(main·opus·sonnet·haiku)로 되돌
|
|
|
365
370
|
|
|
366
371
|
## 🌱 seed: 설치 직후부터 위임이 걸리게 하는 시작 룰
|
|
367
372
|
|
|
368
|
-
모델 피팅
|
|
373
|
+
모델 피팅 래칫(`ratchet-model.md`)은 **빈 파일로 시작합니다.** route-scan이 사용자의 로그에서 같은 유형의 작업을 여러 번 관측하고, 사용자가 그 후보를 승인해야 룰이 생깁니다. 즉 갓 설치한 상태에서는 위임이 한 건도 걸리지 않고, 그 상태가 며칠 이어집니다. 정작 절감 효과가 가장 클 시기입니다.
|
|
369
374
|
|
|
370
375
|
`seed`는 패키지에 동봉된 프리셋으로 그 공백을 메웁니다.
|
|
371
376
|
|
|
372
377
|
| 프리셋 | 내용 | 파일 |
|
|
373
378
|
|---|---|---|
|
|
374
379
|
| 모델 피팅 9건 | 명령 실행·탐색·상태 확인·붙여넣은 로그 질문·읽기 요약, 각 유형의 T2(haiku)와 T1(sonnet) 룰 | `presets/model-rules.json` |
|
|
375
|
-
|
|
|
380
|
+
| 래칫 6건 | 실제 반복 사고에서 승격된 범용 룰 | `presets/ratchet-rules.json` |
|
|
376
381
|
|
|
377
382
|
**등록 절차:** 설치나 업그레이드 후 첫 세션에서 SessionStart 훅이 대기 중인 프리셋을 모델에게 전달하고, 모델이 **한 건씩 순서대로** 등록 여부를 묻습니다. 사용자가 답하면 곧바로 아래 명령을 실행합니다.
|
|
378
383
|
|
|
@@ -593,6 +598,16 @@ harness 5/5 + ratchet을 실제 적용한 전후 비교입니다 (저자 Claude
|
|
|
593
598
|
- ⚠️ 도입 후 데이터는 2일치(157msg)로 통계적 의미가 약하고, 주별 작업 토픽 차이가 섞여 있어 도구 효과만 깨끗이 분리되진 않습니다.
|
|
594
599
|
</details>
|
|
595
600
|
|
|
601
|
+
## FAQ
|
|
602
|
+
|
|
603
|
+
**claude-token-saver와 같은 도구인가요?** 네. Sprag가 새 이름이고 npm 패키지는 `sprag-cli`입니다. `claude-token-saver` 패키지도 같은 릴리스를 계속 받으므로 기존 설치는 그대로 동작합니다.
|
|
604
|
+
|
|
605
|
+
**LLM을 호출하거나 API 키가 필요한가요?** 아니요. Claude Code가 이미 내 컴퓨터에 남기는 세션 로그를 사후 분석할 뿐입니다. 추가 모델 호출도, 키도 없고, 데이터가 밖으로 나가지 않습니다.
|
|
606
|
+
|
|
607
|
+
**프롬프트 습관을 바꿔야 하나요?** 아니요. 설치 때 hook과 statusline을 한 번 등록하면, 지금 하던 방식 그대로 쓰는 동안 규칙과 위임, 경고가 세션 안에 나타납니다.
|
|
608
|
+
|
|
609
|
+
**절감액 수치는 어디서 나오나요?** 위임 실행마다 실제 가격 차이가 장부에 한 줄씩 기록됩니다. 라우팅 기준은 공개 데이터로 벤치마크했고, 방법은 [docs/BENCHMARK.md](./docs/BENCHMARK.md)에 있습니다.
|
|
610
|
+
|
|
596
611
|
## 동작 원리 · 환경
|
|
597
612
|
|
|
598
613
|
Claude Code는 모든 API 응답을 `~/.claude/projects/<dir>/<session>.jsonl`에 기록합니다. 이 도구는 `cache_read_input_tokens`, `cache_creation.ephemeral_5m/1h_input_tokens` 등을 `requestId` 기준으로 중복 제거 후 집계합니다.
|
package/README.md
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
# Sprag
|
|
20
|
+
# Sprag
|
|
21
21
|
|
|
22
|
-
**
|
|
22
|
+
**A quality ratchet for AI coding agents — your agent keeps working, it just stops regressing.** Sprag is named after the sprag clutch: forward motion passes freely, backspin locks. It reads the sessions Claude Code already writes and turns them into gains that compound — every repeated failure becomes a rule loaded at session start, work a cheaper tier has proven it can do is delegated there with a per-run savings ledger as the receipt, and cache or rate-limit trouble reaches your statusline while you can still act on it.
|
|
23
|
+
|
|
24
|
+
What it saved shows on two lines — routing and document conversion each get their own, ledger entries rather than estimates. Zero dependencies, no API key, nothing leaves your machine.
|
|
23
25
|
|
|
24
26
|

|
|
25
27
|
|
|
@@ -45,18 +47,18 @@ gemini-2.5-pro 57.9% $734 ▰▰▰▰▰▰▰▰▰▰▰
|
|
|
45
47
|
|
|
46
48
|
Since v3.35.0 spend is visible too: month-to-date spend shows as `💵 Sep $42`, and on LiteLLM gateways (Bedrock and friends) with no 5h/7d caps, your key budget renders as a `🔑 budget ▰▱ 34% $34/$100` gauge.
|
|
47
49
|
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
| | What it does | Effect |
|
|
51
|
-
|---|---|---|
|
|
52
|
-
| 🔀 **Routing** | Delegates recurring easy work to cheaper models | Savings recorded per run in a ledger; criteria [benchmarked](./docs/BENCHMARK.md) on public data |
|
|
53
|
-
| 📄 **Document conversion** | Turns pptx/xlsx/pdf/docx/fig into Markdown before the model reads them | **510,000 tokens** saved on one deck ([below](#-doc2md--documents-become-markdown-before-the-model-reads-them)) |
|
|
54
|
-
| 🅷 **Harness** | Blocks the token-burning habits: unevidenced "done", skipped verification (5 principles) | **−18.6% cost** ([measured](#real-world-impact--beforeafter-report)) |
|
|
55
|
-
| ⚙️ **Ratchet** | Freezes each error you hit into a rule | Same mistake stops recurring |
|
|
50
|
+
## Everything ships in one install, working from day one
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
| | What it does |
|
|
53
|
+
|---|---|
|
|
54
|
+
| ⚙️ **Ratchet rules** | Repeated failures become one-line rules loaded every session. Candidates are detected from your logs; you choose project or global scope. |
|
|
55
|
+
| 🔀 **Model fitting** | Log-driven delegation rules with measured error rates and reported savings, written to `ratchet-model.md`. Criteria [benchmarked](./docs/BENCHMARK.md) on public data. |
|
|
56
|
+
| 🅷 **Harness score** | Five operating principles checked live ([−18.6% cost, measured](#real-world-impact--beforeafter-report)). Skip the verify step and `🅷 4/5` says so before you report done. |
|
|
57
|
+
| 📊 **Token telemetry** | Cache hit rate, TTL, context size, output spikes and both rate-limit windows, in the prompt every turn. |
|
|
58
|
+
| 📄 **doc2md** | pptx, xlsx, pdf, docx and fig converted on demand, so a document costs a read instead of a context bomb ([510k tokens saved on one deck](#-doc2md--documents-become-markdown-before-the-model-reads-them)). |
|
|
59
|
+
| 🇰🇷 **Style gates** | Write-time prose lint enforced by hook. Shipping today for Korean technical writing: double passives, translationese, cohesion. |
|
|
58
60
|
|
|
59
|
-
The two savings figures are never added together
|
|
61
|
+
The measured −18.6% comes from the harness and ratchet; routing and conversion savings sit on top of it. The two savings figures are never added together: routing says "the same work ran on a cheaper model", conversion says "a file became readable without pushing the original through the context window". The statusline gives each its own line and puts the larger one first.
|
|
60
62
|
|
|
61
63
|
## Contents
|
|
62
64
|
|
|
@@ -70,7 +72,6 @@ The two savings figures are never added together, because they answer different
|
|
|
70
72
|
**Prerequisite:** Node.js ≥ 18 (`node -v` · macOS `brew install node` · Windows `winget install OpenJS.NodeJS.LTS` · Linux/WSL: [nvm](https://github.com/nvm-sh/nvm) recommended)
|
|
71
73
|
|
|
72
74
|
```bash
|
|
73
|
-
npm uninstall -g claude-cache-monitor # (previous-package users only)
|
|
74
75
|
npm i -g sprag-cli
|
|
75
76
|
```
|
|
76
77
|
|
|
@@ -150,10 +151,11 @@ By run (newest first):
|
|
|
150
151
|
|
|
151
152
|
## Not a router — 60 seconds
|
|
152
153
|
|
|
153
|
-
It never intercepts a request in realtime.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
Sprag installs once, reads the sessions you already run, and does not ask you to change how you prompt. It never intercepts a request or swaps your model in realtime.
|
|
155
|
+
|
|
156
|
+
1. **A repeat becomes a rule.** The first failure is just work. On the second, Sprag surfaces it as a candidate; you approve the scope, and the rule loads at the start of every session after that.
|
|
157
|
+
2. **Safe work goes to a sub-agent.** When a task matches one your history shows is safe, Sprag spawns a sub-agent on a cheaper tier to do it and hands the result back for review. Anything that fails quietly stays with the main agent.
|
|
158
|
+
3. **Cost trouble shows up early.** Cache hit rate, TTL expiry, context growth and both rate-limit windows are read every turn and printed in your statusline, while you can still act on them.
|
|
157
159
|
|
|
158
160
|
### Why realtime model routing can cost more, not less
|
|
159
161
|
|
|
@@ -712,6 +714,16 @@ Source: [Anthropic pricing docs](https://platform.claude.com/docs/en/about-claud
|
|
|
712
714
|
| Pro ($20/mo) | **5m fixed** | not configurable |
|
|
713
715
|
| API key | 5m default (1h via beta header) | `cache_control.ttl` |
|
|
714
716
|
|
|
717
|
+
## FAQ
|
|
718
|
+
|
|
719
|
+
**Is this the same tool as claude-token-saver?** Yes. Sprag is the new name; the npm package is `sprag-cli`, and the `claude-token-saver` package keeps receiving the same releases so nothing breaks.
|
|
720
|
+
|
|
721
|
+
**Does it call an LLM or need an API key?** No. Everything is post-hoc analysis of the session logs Claude Code already writes on your machine. No extra model calls, no key, no telemetry leaves your computer.
|
|
722
|
+
|
|
723
|
+
**Will it change how I prompt?** No. It installs hooks and a statusline once, then works from what you already do. Rules, delegation, and warnings show up inside your normal sessions.
|
|
724
|
+
|
|
725
|
+
**Where do the savings numbers come from?** Each delegated run writes a ledger entry with the actual price difference. The tier criteria behind the routing are benchmarked on public data; the method is in [docs/BENCHMARK.md](./docs/BENCHMARK.md).
|
|
726
|
+
|
|
715
727
|
## How it works · Environment
|
|
716
728
|
|
|
717
729
|
Claude Code logs every API call to `~/.claude/projects/<dir>/<session>.jsonl`. This tool dedupes streaming chunks by `requestId` and aggregates `cache_read_input_tokens` / `cache_creation.ephemeral_5m/1h_input_tokens` by day and session.
|
package/package.json
CHANGED
package/src/cohesion.js
CHANGED
|
@@ -63,7 +63,7 @@ export async function cohesionInjection({ cfg = loadConfig() } = {}) {
|
|
|
63
63
|
if (!text) return null;
|
|
64
64
|
return [
|
|
65
65
|
'[sprag cohesion] Follow this guidance for English prose in this session.',
|
|
66
|
-
'The user enabled it in
|
|
66
|
+
'The user enabled it in sprag.',
|
|
67
67
|
'',
|
|
68
68
|
text,
|
|
69
69
|
].join('\n');
|
package/src/commands/handoff.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* session can pick up where this one stopped. Pairs with the cap-warn chip:
|
|
5
5
|
* when statusline shows 🚨 5H 90%+, run this to back up state before the cap
|
|
6
6
|
* hits.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* sprag handoff # write to cwd
|
|
8
|
+
* sprag handoff --cwd PATH # custom directory
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { readStdinJson, extractCaps } from '../stdin-payload.js';
|
package/src/commands/history.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Subcommand: history — print recent warning transitions captured by the
|
|
3
3
|
* statusline. One markdown file per day, persisted under the platform-
|
|
4
4
|
* specific user-data dir.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* sprag history # last 7 days
|
|
6
|
+
* sprag history --days 30 # custom window
|
|
7
|
+
* sprag history --list # just list available dates
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
|
package/src/commands/install.js
CHANGED
|
@@ -333,7 +333,7 @@ export async function run({ hasFlag }) {
|
|
|
333
333
|
if (pending.length > 0) {
|
|
334
334
|
console.log('');
|
|
335
335
|
console.log(lang === 'ko'
|
|
336
|
-
? ` seed: 추천 룰 ${pending.length}건이 대기 중입니다 (모델 피팅 +
|
|
336
|
+
? ` seed: 추천 룰 ${pending.length}건이 대기 중입니다 (모델 피팅 + 래칫 프리셋).`
|
|
337
337
|
: ` seed: ${pending.length} recommended rule(s) are waiting (model-fitting + ratchet presets).`);
|
|
338
338
|
console.log(lang === 'ko'
|
|
339
339
|
? ' 다음 Claude Code 세션에서 한 건씩 등록할지 물어봅니다. 지금 보려면: sprag seed'
|
package/src/commands/seed.js
CHANGED
|
@@ -86,7 +86,7 @@ export async function run({ args, hasFlag }) {
|
|
|
86
86
|
for (const s of pending) {
|
|
87
87
|
const head = s.kind === 'model'
|
|
88
88
|
? `[${s.id}] ${s.tier} · "${s.label}" → ${s.agent}`
|
|
89
|
-
: `[${s.id}] ${ko ? '
|
|
89
|
+
: `[${s.id}] ${ko ? '래칫 룰' : 'ratchet rule'}`;
|
|
90
90
|
console.log(` ${head}`);
|
|
91
91
|
console.log(` ${s.ruleText}`);
|
|
92
92
|
}
|
|
@@ -57,8 +57,8 @@ export async function run({ hasFlag, version }) {
|
|
|
57
57
|
? `새 버전이 있습니다: v${version} → ${s.latest}`
|
|
58
58
|
: `Update available: v${version} → ${s.latest}`);
|
|
59
59
|
console.log(lang === 'ko'
|
|
60
|
-
? `업그레이드: ${upgradeCommand()} (또는
|
|
61
|
-
: `Upgrade with: ${upgradeCommand()} (or:
|
|
60
|
+
? `업그레이드: ${upgradeCommand()} (또는 sprag upgrade)`
|
|
61
|
+
: `Upgrade with: ${upgradeCommand()} (or: sprag upgrade)`);
|
|
62
62
|
if (s.dismissed) {
|
|
63
63
|
console.log(lang === 'ko'
|
|
64
64
|
? '이 버전은 사용자가 한 번 넘긴 상태라, 세션 시작 시에는 다시 묻지 않습니다.'
|
package/src/commands/upgrade.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Subcommand: upgrade — install the latest release with the package manager
|
|
3
3
|
* that put this copy on disk.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* sprag upgrade # refresh the check, then install
|
|
6
|
+
* sprag upgrade --print # show the command, run nothing
|
|
7
7
|
*
|
|
8
8
|
* This is the command the model runs after the user says yes to the
|
|
9
9
|
* session-start offer, so it prints the exact command it is about to execute
|
|
@@ -63,6 +63,6 @@ export async function run({ hasFlag, version }) {
|
|
|
63
63
|
// the statusline chip clears on the next render instead of lingering.
|
|
64
64
|
await refreshUpdateState(s.latest);
|
|
65
65
|
console.log(lang === 'ko'
|
|
66
|
-
? `설치가 끝났습니다. 새 셸에서
|
|
67
|
-
: `Done. In a fresh shell, run
|
|
66
|
+
? `설치가 끝났습니다. 새 셸에서 sprag --version 으로 ${s.latest} 인지 확인하십시오.`
|
|
67
|
+
: `Done. In a fresh shell, run sprag --version to confirm ${s.latest}.`);
|
|
68
68
|
}
|
package/src/harness-templates.js
CHANGED
|
@@ -49,7 +49,7 @@ export const MODEL_RATCHET_IMPORT_RE = /^@(?:~\/\.claude|\.claude)\/ratchet-mode
|
|
|
49
49
|
export function harnessClaudeMdBlock(scope = 'project') {
|
|
50
50
|
const sections = HARNESS_SECTIONS.map((s) => s.heading).join('\n\n... (see full block below)');
|
|
51
51
|
return `${HARNESS_BLOCK_BEGIN}
|
|
52
|
-
## 🅷 Harness Rules (
|
|
52
|
+
## 🅷 Harness Rules (sprag)
|
|
53
53
|
|
|
54
54
|
이 섹션은 \`sprag harness init\`이 생성합니다. 5가지 원칙 모두를
|
|
55
55
|
지키면 statusline에 \`🅷 5/5\`로 표시되고, 빠진 게 있으면 \`🅷 3/5\` 식으로
|
|
@@ -59,7 +59,7 @@ export function harnessClaudeMdBlock(scope = 'project') {
|
|
|
59
59
|
${HARNESS_SECTIONS[0].heading}
|
|
60
60
|
- 같은 에러·오해·반복 작업이 한 번 더 발생하면 즉시 \`.claude/ratchet.md\`에
|
|
61
61
|
"조건 → 행동" 한 줄로 룰 추가.
|
|
62
|
-
-
|
|
62
|
+
- sprag가 후보를 감지하면 statusline에 \`🅷⚠ ratchet?\`로 알림.
|
|
63
63
|
\`sprag harness promote "<rule>" --project|--global\`로 승인.
|
|
64
64
|
- **scope는 항상 사용자에게 먼저 물어볼 것** — 프로젝트 한정이면 \`--project\`,
|
|
65
65
|
도구·환경 일반 룰이면 \`--global\`(\`~/.claude/ratchet.md\`). Bash 환경은
|
|
@@ -67,9 +67,9 @@ ${HARNESS_SECTIONS[0].heading}
|
|
|
67
67
|
플래그를 명시해야 함. 묻지 않고 기본값으로 등록하지 말 것.
|
|
68
68
|
- 승인된 룰은 이 블록 맨 아래 \`@\` import로 매 세션 로드된다 — 그 import 라인을
|
|
69
69
|
지우면 ratchet.md는 컨텍스트에 들어오지 않으니 지우지 말 것.
|
|
70
|
-
- **모델 피팅
|
|
70
|
+
- **모델 피팅 래칫**: \`.claude/ratchet-model.md\`(프로젝트)와
|
|
71
71
|
\`~/.claude/ratchet-model.md\`(글로벌)에 있는 티어 위임 룰도 ratchet.md와
|
|
72
|
-
동일하게 따를 것. 이 파일은
|
|
72
|
+
동일하게 따를 것. 이 파일은 sprag가 로그 기반으로 자동
|
|
73
73
|
생성·갱신하므로 직접 수정하지 말 것 (관리: \`route-scan rules\`).
|
|
74
74
|
|
|
75
75
|
${HARNESS_SECTIONS[1].heading}
|
|
@@ -123,7 +123,7 @@ ${HARNESS_BLOCK_END}
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export function harnessRatchetMdInitial() {
|
|
126
|
-
return `# Ratchet Rules (auto-grown by
|
|
126
|
+
return `# Ratchet Rules (auto-grown by sprag)
|
|
127
127
|
|
|
128
128
|
같은 실수가 두 번 발생하면 여기에 한 줄 추가됩니다. 형식: "YYYY-MM-DD: <조건> → <행동>".
|
|
129
129
|
|
package/src/korean-style.js
CHANGED
|
@@ -181,7 +181,7 @@ export function koreanStyleInjection({ cfg = loadConfig() } = {}) {
|
|
|
181
181
|
if (!text) return null;
|
|
182
182
|
return [
|
|
183
183
|
'[sprag korean-style] 이 세션에서 한국어를 출력할 때는 아래 지침을 따르십시오.',
|
|
184
|
-
'이 지침은 사용자가
|
|
184
|
+
'이 지침은 사용자가 sprag에 설정한 것입니다.',
|
|
185
185
|
...koreanScopeLines(cfg),
|
|
186
186
|
'표기 규칙(예외 없이 적용): 도구 호출 인자에 한국어를 비롯한 비ASCII 문자열을 담을 때에는 반드시 리터럴 UTF-8로 작성하고, \\uXXXX 유니코드 이스케이프로는 절대 작성하지 마십시오. 이스케이프로 작성하면 글자가 깨진 채 파일에 기록되는 사례가 자주 발생합니다.',
|
|
187
187
|
`(출처: ${KOREAN_STYLE_SOURCE})`,
|
package/src/seed-rules.js
CHANGED
|
@@ -252,7 +252,7 @@ export function seedOfferBlock({ lang = userLanguage(), root = findProjectRoot()
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
if (fixes.length > 0) {
|
|
255
|
-
lines.push(` ·
|
|
255
|
+
lines.push(` · 래칫 룰 ${fixes.length}건 — 같은 실수를 반복하지 않도록 세션마다 읽히는 규칙입니다.`);
|
|
256
256
|
for (const s of fixes) lines.push(` [${s.id}] ${s.ruleText}`);
|
|
257
257
|
}
|
|
258
258
|
lines.push(' 등록: claude-token-saver seed accept <id> --global|--project # 적용 범위는 반드시 사용자에게 확인');
|
package/src/update-check.js
CHANGED