claude-token-saver 3.44.0 → 3.50.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/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 rootstudioyaml
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,35 @@
1
+ sprag (npm: sprag-cli)
2
+ Copyright 2026 rootstudioyaml
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ Releases up to and including v3.47.0 were published under the MIT License.
17
+ Anyone who received a copy under those terms keeps them for that copy; this
18
+ change applies to later releases.
19
+
20
+ --------------------------------------------------------------------------------
21
+ Third-party content redistributed with this project
22
+
23
+ presets/korean-style/fluent-korean.md
24
+ fluent-korean, Copyright (c) 2026 snflkd, MIT License.
25
+ Vendored with only the output-style frontmatter removed; the guidance text
26
+ is unmodified. It stays under its own terms, which are reproduced in
27
+ presets/korean-style/LICENSE-fluent-korean.
28
+ Upstream: https://github.com/snflkd/fluent-korean
29
+
30
+ --------------------------------------------------------------------------------
31
+ Trademarks
32
+
33
+ Section 6 of the License grants no rights in the project's names or marks.
34
+ "sprag" and the sprag logo are not licensed for use in a way that states or
35
+ implies endorsement of a fork or a derived distribution.
package/README.ko.md CHANGED
@@ -8,83 +8,128 @@
8
8
  **AI 코딩 에이전트용 품질 래칫**<br>**같은 실수는 두 번 없습니다**
9
9
 
10
10
  [![npm](https://img.shields.io/npm/v/sprag-cli.svg?label=sprag-cli)](https://www.npmjs.com/package/sprag-cli)
11
- [![downloads](https://img.shields.io/npm/dm/claude-token-saver.svg)](https://www.npmjs.com/package/claude-token-saver)
12
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
11
+ [![downloads](https://img.shields.io/npm/dm/sprag-cli.svg)](https://www.npmjs.com/package/sprag-cli)
12
+ [![license](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](./LICENSE)
13
13
 
14
- [sprag.io](https://sprag.io) · [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) · [English](https://github.com/rootstudioyaml/sprag/blob/main/README.md)
14
+ [English](https://github.com/rootstudioyaml/sprag/blob/main/README.md) · [한국어](https://github.com/rootstudioyaml/sprag/blob/main/README.ko.md)
15
15
 
16
- </div>
16
+ [sprag.io](https://sprag.io) · [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md)
17
17
 
18
- ---
18
+ </div>
19
19
 
20
20
  ---
21
21
 
22
- # Sprag
22
+ **에이전트는 그대로 일하고, 퇴행만 막습니다.** 이름은 스프래그 클러치에서 왔습니다. 앞으로 도는 힘은 그대로 통과시키고, 역회전하는 순간 잠기는 부품입니다.
23
23
 
24
- **AI 코딩 에이전트에 거는 품질 래칫입니다. 에이전트는 그대로 일하고, 퇴행만 막습니다.** 이름은 스프래그 클러치에서 왔습니다. 앞으로 도는 힘은 그대로 통과시키고, 역회전하는 순간 잠기는 부품입니다. Sprag는 Claude Code가 이미 남기는 세션 기록을 읽어 누적되는 이득으로 바꿉니다. 되풀이된 실패는 세션마다 올라오는 규칙이 되고, 저렴한 티어가 감당한다고 증명된 작업은 절감액 원장을 영수증 삼아 그쪽으로 위임되며, 캐시와 사용량 한도 문제는 아직 손쓸 수 있을 때 statusline에 나타납니다.
24
+ Sprag 는 Claude Code 가 이미 남기는 세션 기록을 읽습니다. 거기서 찾아낸 것은 이후 모든 세션에 남습니다. 되풀이된 실패는 세션마다 올라오는 규칙이 되고, 저렴한 등급에서 번도 틀리지 않은 작업은 등급의 서브에이전트로 갑니다. 위임된 실행은 한 건마다 단가 차액을 원장에 적습니다. 캐시와 사용량 한도 문제는 아직 손쓸 수 있을 때 statusline 에 나타납니다.
25
25
 
26
- 의존성 0, API 불요, 데이터는 컴퓨터 밖으로 나가지 않습니다.
26
+ 데이터는 컴퓨터 밖으로 나가지 않습니다. Claude Code 가 이 컴퓨터에 이미 남긴 기록만 읽기 때문입니다. API 키도, 추가 모델 호출도, 런타임 의존성도 없습니다.
27
27
 
28
28
  ```bash
29
29
  npm i -g sprag-cli # 예전 이름 claude-token-saver 와 같은 패키지입니다
30
30
  ```
31
31
 
32
- ![statusline 예시. 첫 줄은 라우팅 절감액, 둘째 줄은 문서 변환 절감액, 셋째 줄은 진단 칩입니다](./docs/statusline.png)
32
+ ![statusline 예시. 첫 줄은 라우팅 절감액, 둘째 줄은 문서 변환 절감액, 셋째 줄은 진단 칩입니다](https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/statusline.png)
33
+
34
+ ## 작동 방식
35
+
36
+ <picture>
37
+ <source srcset="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/how-it-works.svg" type="image/svg+xml">
38
+ <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/how-it-works.png" alt="왼쪽에 들어가는 것은 지난 세션 기록, 방금 시킨 작업, 첨부하려는 문서, 지금 쓰고 있는 한국어 문장, 이번 턴이 소비하는 토큰입니다. 오른쪽에서 나오는 것은 매 세션 시작에 주입되는 래칫 룰, 변환된 문서, 쓰는 도중의 한국어 검사, 프롬프트에 붙는 비용 표시, 그리고 조건에 맞는 작업을 haiku 또는 sonnet 서브에이전트로 보내고 그 결과를 메인 에이전트가 검토하는 흐름입니다.">
39
+ </picture>
40
+
41
+ 왼쪽 항목은 모두 세션이 이미 만들어 내고 있는 것입니다. 그것을 읽으려고 어디에도 전송하지 않습니다. 아래쪽 등급 판정이 위임 논리의 전부이며 기준은 세 가지입니다. 답이 어디에 있는지, 틀렸을 때 테스트나 종료 코드로 바로 드러나는지, 그 규칙을 측정했을 때 오류율이 얼마였는지입니다.
33
42
 
34
- ## 숫자
43
+ Sprag 사용자가 지정한 모델을 바꾸지 않습니다. 이미 실행한 기록을 읽어 저렴한 등급에서 한 번도 틀리지 않은 작업 유형을 찾고, 그 유형에만 서브에이전트를 띄웁니다. 돌아온 결과는 메인 에이전트가 검토한 뒤에 완료로 인정되며, 규칙이 맞지 않게 되는 순간 작업은 메인 에이전트로 되돌아옵니다.
44
+
45
+ ## 측정 결과
35
46
 
36
47
  | 지표 | 결과 | | 근거 |
37
48
  |---|---|---|---|
38
49
  | 공개 벤치마크 정확도 | **59.1%** · 단일 최고 모델 57.9% | `▰▰▰▰▰▰▰▰▰▰▰▰` | [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) |
39
50
  | 같은 문항 총비용 | **$268** · gpt-5 $388 · gemini-2.5-pro $734 | `▰▰▰▰▰▱▱▱▱▱▱▱` | [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) |
40
- | 문서 토큰 | **−95.8%** · 540,42922,610 | `▰▱▱▱▱▱▱▱▱▱▱▱` | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) |
41
- | 메시지당 비용 | **−18.6%** · $2.345 $1.910 | `▰▰▰▰▰▰▰▰▰▰▱▱` | [실측 리포트](#실제-효과-도입-전후-리포트) |
42
-
43
- ```text
44
- 정확도 총비용 (11,696문항)
45
- 티어 기준 라우터 59.1% ← 최고 $268 ▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱
46
- gpt-5 57.8% $388 ▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱
47
- gemini-2.5-pro 57.9% $734 ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
51
+ | 같은 문서들의 토큰 | **−95.9%** · 2,011,17882,209 (12건) | `▰▱▱▱▱▱▱▱▱▱▱▱` | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) |
52
+ | 위임 절감액 (원장) | **$44.67** · 위임 69건 | `▰▰▰▰▰▰▰▰▰▰▰▱` | `sprag route-scan savings` |
53
+ | 같은 프롬프트를 저가 등급에 | **비용 24%** · 여덟 건 중 한 건이 더 틀림 | `▰▰▰▱▱▱▱▱▱▱▱▱` | [A/B 실측](#같은-프롬프트를-저가-등급에-돌리면) |
54
+
55
+ 앞의 두 줄은 다음 반박에 답하려고 있습니다. 저가 모델에 일을 내려보내면 정확도가 떨어질 것이라는 반박입니다. 공개 데이터에서는 떨어지지 않았습니다. 같은 판정 기준을 라우터로 만들어 11,696건에 적용했더니 정확도가 단일 최고 모델보다 1.2%p 높고 비용은 3분의 1이었습니다. 정확도가 오른 까닭은 간단합니다. 모든 유형에서 1등인 모델은 없기 때문입니다.
56
+
57
+ LLMRouterBench(Findings of ACL 2026)에서 오프라인으로 측정했습니다. 11,696건이며, 답과 채점 결과와 비용이 데이터셋에 함께 들어 있는 13개 모델을 씁니다. 모델을 호출하지 않았고 비용도 들지 않았습니다. 라우터가 고르고, 숫자는 데이터셋에서 찾아 합쳤습니다. 다시 돌려도 같은 값이 나옵니다.
58
+
59
+ 다만 이렇게 확인한 것은 판정 기준이고, sprag 가 실제로 쓰는 모델 조합은 아닙니다. 데이터셋에 Claude 계열이 없어서 deepseek-v3 와 qwen3-235b, gpt-5 가 각각 저가·중간·상위 등급을 대신했습니다.
60
+
61
+ 뒤의 세 줄은 이 머신에서 실제로 쌓인 기록이라 시간이 지나면 값이 커집니다. 아래 수치는 2026-09-18 에 뽑았습니다.
62
+
63
+ ### 지금 이 머신의 최근 30일
64
+
48
65
  ```
66
+ 🔀 라우팅 절감 누적 $44.67 (최근 7일 $23.21 · 30일 $42.73)
49
67
 
50
- 라우팅 절감액은 추정치가 아니라 위임 한 건 한 건의 차액을 적은 원장입니다. `sprag route-scan savings` 가 모든 금액을 룰 단위까지 역추적해 보여 줍니다. 집계에서 무엇을 빼는지까지 [원장 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md)에 적어 두었습니다.
68
+ opus-5 sonnet-5 59회 $39.75 ▰▰▰▰▰▰▰▰▰▰▱▱
69
+ opus-5 → haiku-4.5 10회 $4.92 ▰▱▱▱▱▱▱▱▱▱▱▱
70
+ ```
71
+
72
+ | 함께 측정한 값 | 30일 기준 | |
73
+ |---|---|---|
74
+ | 문서 변환 | 12건 · 2,011,178 → 82,209 토큰 | `▰▱▱▱▱▱▱▱▱▱▱▱` |
75
+ | 캐시 적중률 | 92.2% | `▰▰▰▰▰▰▰▰▰▰▰▱` |
76
+ | 그 뒤의 사용량 | 175 세션 · API 호출 14,682회 · 입력 38.1억 토큰 | |
77
+
78
+ 실제 출력입니다. `sprag route-scan savings` 와 `sprag --days 30`, 그리고 doc2md 원장에서 그대로 가져왔습니다. 추정한 값은 없습니다.
79
+
80
+ 위임된 실행은 한 건마다 단가 차액을 기록하므로, `sprag route-scan savings` 가 어떤 금액이든 그 원인이 된 규칙까지 역추적해 보여 줍니다. 집계에서 무엇을 빼는지는 [명령 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.ko.md)에 적어 두었습니다.
51
81
 
52
82
  ## 설치 한 번에 전부 들어 있고, 첫날부터 동작합니다
53
83
 
54
84
  | | 하는 일 | 더 보기 |
55
85
  |---|---|---|
56
- | ⚙️ **래칫 규칙** | 되풀이된 실패가 한 줄짜리 규칙이 되어 매 세션에 올라옵니다. 후보는 기록에서 자동으로 찾아 줍니다. | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) |
86
+ | ⚙️ **래칫 규칙** | 되풀이된 실패가 한 줄짜리 규칙이 되어 매 세션에 올라옵니다. 후보는 기록에서 자동으로 찾아 줍니다. | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.ko.md) |
57
87
  | 🔀 **모델 피팅** | 기록에서 뽑은 위임 규칙에 측정한 오류율과 절감액을 붙여 `ratchet-model.md`에 적습니다. | [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) |
58
- | 🅷 **하네스 점수** | 다섯 가지 운영 원칙을 실시간으로 점검합니다. 검증 단계를 건너뛰면 `🅷 4/5`가 먼저 알려 줍니다. | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) |
59
- | 📊 **토큰 텔레메트리** | 캐시 적중률과 TTL, 컨텍스트 크기, 출력 급증, 두 가지 사용량 한도를 매 턴 표시합니다. | [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md) |
88
+ | 🅷 **하네스 점수** | 다섯 가지 운영 원칙을 실시간으로 점검합니다. 검증 단계를 건너뛰면 `🅷 4/5`가 먼저 알려 줍니다. | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.ko.md) |
89
+ | 📊 **토큰 텔레메트리** | 캐시 적중률과 TTL, 컨텍스트 크기, 출력 급증, 두 가지 사용량 한도를 매 턴 표시합니다. | [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.ko.md) |
60
90
  | 📄 **doc2md** | pptx와 xlsx, pdf, docx, fig를 필요할 때 Markdown 으로 바꿔 읽습니다. | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) |
61
- | 🇰🇷 **문체 게이트** | 쓰는 시점에 hook으로 검사합니다. 이중 피동과 번역투, 문장 연결을 살핍니다. | [문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) |
91
+ | 🇰🇷 **문체 게이트** | 쓰는 시점에 hook으로 검사합니다. 이중 피동과 번역투, 문장 연결을 살핍니다. | [문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.ko.md) |
92
+
93
+ 두 절감액은 한 숫자로 합치지 않습니다. 재는 대상이 다르기 때문입니다. 라우팅 원장은 위임된 실행의 단가 차액을 적고, 변환 원장은 문서가 쓰지 않게 된 토큰을 적습니다.
62
94
 
63
- 실측 −18.6%는 하네스와 래칫의 몫이고, 라우팅과 문서 변환 절감액은위에 얹힙니다. 절감액은 성격이 달라서 숫자로 합치지 않습니다.
95
+ 하네스와 래칫 규칙이 줄여 몫은 원장 어디에도 잡히지 않습니다. 절감은 번을 싸게 만드는 방식이 아니라 왕복 횟수를 줄이는 방식으로 나타납니다.
64
96
 
65
97
  ## statusline 한 줄로 보는 상태
66
98
 
67
99
  ```
68
- 🔀 라우팅 절감 $2.09 | fable→sonnet 1회 $0.72 · opus→haiku 1회 $0.57
69
- 🚨 5H █████▓ 94% 🔄 12:36 · 🅷 5/5 · 🤖 Opus 5 · 🧠 Cache hit 98.8% · ⏳ Cache expires 59:46 · 📅 weekly ██▒░░░ 38% · 💵 Sep $42 · 📦 Ctx 47% of 1M
100
+ 🔀 라우팅 절감 $44.67 | opus→sonnet 59회 $39.75 · opus→haiku 10회 $4.92
101
+ 🚨 5H ▰▰▰▰▰▰▰▰▰▰▰▱ 94% 🔄 12:36 · 🅷 5/5 · 🤖 Opus 5 · 🧠 Cache hit 98.8% · ⏳ Cache expires 59:46 · 📅 weekly ▰▰▰▰▰▱▱▱▱▱▱▱ 38% · 💵 Sep $42 · 📦 Ctx 47% of 1M
70
102
  ```
71
103
 
72
- 문제가 생기면 경고 칩이 줄 맨 앞으로 옵니다. `🚨 5H/7D NN%`, `⚠ Ctx 500k+`, `⚠ Cache miss`, `⚠ Input spike`, `⚠ Output heavy`, `⚠ Call surge`, `⚠ Rebuild churn`, `⚠ 5m TTL` 여덟 가지이며, 칩 문구를 그대로 말하면 Skill이 원인 코드와 조치 순서를 꺼내 줍니다. 세그먼트별 의미와 기준은 [statusline 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md)에 정리했습니다.
104
+ 문제가 생기면 경고 칩이 줄 맨 앞으로 옵니다. `🚨 5H/7D NN%`, `⚠ Ctx 500k+`, `⚠ Cache miss`, `⚠ Input spike`, `⚠ Output heavy`, `⚠ Call surge`, `⚠ Rebuild churn`, `⚠ 5m TTL` 여덟 가지입니다. 칩 문구를 Claude 에게 그대로 붙여 넣으면 Skill 이 원인 코드와 조치 순서를 꺼내 줍니다. 세그먼트마다 무엇을 뜻하는지는 [statusline 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.ko.md)에 정리했습니다.
105
+
106
+ JetBrains IDE 내장 터미널에서는 이모지 대신 한 칸 글리프로 표시합니다(`◉ Cache hit 98.8% · ◧ Ctx 47% of 1M`). IDE 기본 폰트에 이모지 글리프가 없어서, 이모지를 그대로 두면 `Cache expires 4:545` 처럼 이전 프레임 문자가 화면에 남습니다. 모드 종류와 `sprag mode narrow` · `mode icon-force` 사용법은 [statusline 문서의 라벨 모드](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.ko.md#라벨-모드)에 있습니다.
107
+
108
+ ## 같은 프롬프트를 저가 등급에 돌리면
73
109
 
74
- ## 실제 효과: 도입 전후 리포트
110
+ 벤치마크는 공개 데이터를 씁니다. 이 절은 같은 질문을 제 작업에 던진 결과입니다. 이 저장소의 실제 세션에서 질문 여덟 개를 골라 두 등급에 보내고, 실행 전에 적어 둔 정답과 맞춰 봤습니다(2026-09-17, 원자료 `video/out/measure2.json`).
75
111
 
76
- ![sprag: harness와 ratchet 도입 효과](./docs/harness-impact.png)
112
+ | | 상위 등급 (opus-5) | 저가 등급 (haiku-4.5) |
113
+ |---|---:|---:|
114
+ | 여덟 건 총비용 | $2.5652 | **$0.6132** (23.9%) |
115
+ | 정답 판정 | 7 / 8 | 6 / 8 |
116
+ | 답이 같았던 건수 | | 6 / 8 |
77
117
 
78
- harness 5/5 + ratchet을 실제 적용한 전후 비교입니다 (저자 Claude Code 로그, **사용자 메시지 1건당** 정규화, 2026-05-02 기준, Opus 4.7 가격).
118
+ 눈여겨볼 문항은 등급이 함께 틀린 번째입니다. `process.env` 참조하는 파일을 물으면서 하위 디렉터리를 포함할지 적지 않았고, 등급이 서로 다르게 해석했습니다. 그 조건 하나를 넣어 다시 물으니 두 답이 똑같아졌습니다. 모델이 약해서 틀린 것이 아니라 질문이 모호했습니다.
79
119
 
80
- | 메트릭 | 도입 (7일/739msg) | 도입 (2일/157msg) | 변화 |
81
- |---|---:|---:|---:|
82
- | 메시지당 비용 | $2.345 | $1.910 | **−18.6%** |
83
- | 메시지당 출력 토큰 | 7,391 | 6,052 | −18.1% |
84
- | 메시지당 assistant 왕복 | 9.73 | 8.83 | −9.2% |
85
- | 메시지당 도구 호출 | 5.72 | 5.25 | −8.2% |
120
+ 남은 건은 저가 등급이 파일 목록에서 개를 빠뜨린 경우입니다. 틀린 목록은 틀렸다는 사실이 바로 보입니다. 두 번째 기준이 하는 일이 이것입니다.
86
121
 
87
- 같은 요청을 적은 왕복으로 끝내므로 시도 적중률이 오릅니다. PEV와 Structured Task가 번에 가게 만든 효과로 보입니다. 표본이 2일치(157msg)라 통계적 의미는 약하고, 주별 작업 토픽 차이도 섞여 있습니다.
122
+ 정리하면 저가 등급은 공짜가 아닙니다. 표본에서는 조회 작업 여덟 가운데건을 틀리는 대신 비용을 4분의 1로 줄였습니다. 그래서 규칙은 틀렸을 바로 드러나는 작업만 내려보내고, 설계와 원인 진단은 상위 등급에 남깁니다.
123
+
124
+ ## 이 방식이 여기서 만들어 낸 것
125
+
126
+ | 측정 항목 | 값 | 표본 | 기간 |
127
+ |---|---|---|---|
128
+ | 문서 변환 | 2,011,178 → 82,209 토큰 | 12건 (xlsx·pptx·pdf) | 2026-09-18 까지 누적 |
129
+ | 위임 실행 | $44.67 절감 · 건당 $0.65 | 69건 | 2026-09-18 까지 누적 |
130
+ | 래칫 규칙 누적 | 37건 (글로벌 30 · 프로젝트 7) | 저장소 4곳 | 2026-05-08 ~ 09-16 |
131
+
132
+ 래칫 규칙과 위임 규칙은 늘어나는 방식이 다릅니다. 래칫 규칙은 사람이 저지른 실수에서 나오므로 계속 늘어납니다. 위임 규칙은 멈춥니다. 기준이 알아보는 작업 유형이 정해져 있어서, 유형마다 규칙이 하나 생기면 더 승격할 것이 없습니다.
88
133
 
89
134
  ## 자주 쓰는 명령
90
135
 
@@ -97,27 +142,29 @@ harness 5/5 + ratchet을 실제 적용한 전후 비교입니다 (저자 Claude
97
142
  | `sprag harness check` | 🅷 하네스 점수 확인 |
98
143
  | `sprag doc2md <파일>` | 문서 한 건을 Markdown 으로 변환 |
99
144
 
100
- 전체 명령과 옵션, 출력 언어 설정은 [명령 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md)에 있습니다.
145
+ 전체 명령과 옵션, 출력 언어 설정은 [명령 문서](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.ko.md)에 있습니다.
101
146
 
102
147
  ## 더 깊은 내용
103
148
 
104
149
  | 문서 | 다루는 내용 |
105
150
  |---|---|
106
- | [설치와 기본 설정](https://github.com/rootstudioyaml/sprag/blob/main/docs/INSTALL.md) | 설치 직후 켜지는 기능, 직접 켜야 하는 기능, 끄는 방법 |
107
- | [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.md) | 세그먼트 의미, 경고 칩, 토큰 급증 원인 코드, 업데이트 안내 |
108
- | [명령](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.md) | 전체 서브커맨드와 CLI 옵션 |
109
- | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.md) | 5원칙, 래칫 승격, compact-window 고정, seed 프리셋 |
151
+ | [설치와 기본 설정](https://github.com/rootstudioyaml/sprag/blob/main/docs/INSTALL.ko.md) | 설치 직후 켜지는 기능, 직접 켜야 하는 기능, 끄는 방법 |
152
+ | [statusline](https://github.com/rootstudioyaml/sprag/blob/main/docs/STATUSLINE.ko.md) | 세그먼트 의미, 경고 칩, 토큰 급증 원인 코드, 업데이트 안내 |
153
+ | [명령](https://github.com/rootstudioyaml/sprag/blob/main/docs/COMMANDS.ko.md) | 전체 서브커맨드와 CLI 옵션 |
154
+ | [Harness](https://github.com/rootstudioyaml/sprag/blob/main/docs/HARNESS.ko.md) | 5원칙, 래칫 승격, compact-window 고정, seed 프리셋 |
110
155
  | [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) | 티어 판정, 룰 파일 구조, 스캔 시점, 서브에이전트 설정 |
111
156
  | [티어 판별 기준](https://github.com/rootstudioyaml/sprag/blob/main/docs/TIER_CRITERIA.md) | T0·T1·T2 를 가르는 근거와 연구 출처 |
112
157
  | [벤치마크](https://github.com/rootstudioyaml/sprag/blob/main/docs/BENCHMARK.md) | LLMRouterBench 11,696문항 재현 결과 |
113
158
  | [doc2md](https://github.com/rootstudioyaml/sprag/blob/main/docs/DOC2MD.md) | 변환 대상 포맷, 절감 근거, 문서 수정 절차, DRM 문서 |
114
- | [한국어 문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.md) | 주입 내용, 쓰기 시점 검사, 적용 전후 비교 |
115
- | [라우터가 아닌 이유](https://github.com/rootstudioyaml/sprag/blob/main/docs/NOT-A-ROUTER.md) | 실시간 라우팅이 캐시를 깨서 비용을 키우는 구조 |
116
- | [게이트웨이와 환경](https://github.com/rootstudioyaml/sprag/blob/main/docs/GATEWAYS.md) | Bedrock·Vertex·LiteLLM, 가격표, FAQ, 동작 원리 |
159
+ | [한국어 문체 지침](https://github.com/rootstudioyaml/sprag/blob/main/docs/KOREAN-STYLE.ko.md) | 주입 내용, 쓰기 시점 검사, 적용 전후 비교 |
160
+ | [라우터가 아닌 이유](https://github.com/rootstudioyaml/sprag/blob/main/docs/NOT-A-ROUTER.ko.md) | 실시간 라우팅이 캐시를 깨서 비용을 키우는 구조 |
161
+ | [게이트웨이와 환경](https://github.com/rootstudioyaml/sprag/blob/main/docs/GATEWAYS.ko.md) | Bedrock·Vertex·LiteLLM, 가격표, FAQ, 동작 원리 |
162
+
163
+ LiteLLM 게이트웨이 환경에서는 `sprag profile-map --refresh` 가 게이트웨이의 `GET /model/info` 에서 모델 별칭을 바로 읽어 오므로, route-scan 이 위임 투표가 쌓이길 기다리거나 `profile-map.json` 을 손으로 편집할 필요가 없어졌습니다. 이 갱신은 LiteLLM 예산 게이지와 같은 5분 점검·24시간 캐시 주기를 씁니다. 인증 토큰은 저장하지 않으며, 호출 시점마다 `apiKeyHelper` 에서 읽어 그 헬퍼의 수명 그대로 만료되게 둡니다. 자세한 내용은 [route-scan](https://github.com/rootstudioyaml/sprag/blob/main/docs/ROUTE_SCAN.md) 문서에 있습니다.
117
164
 
118
165
  ## 릴리스 노트
119
166
 
120
- 전체 내역은 [CHANGELOG.md](./CHANGELOG.md)로 옮겼습니다. 최근 변경은 다음과 같습니다.
167
+ 전체 내역은 [CHANGELOG.md](./CHANGELOG.md) 로 옮겼습니다. 최근 변경은 다음과 같습니다.
121
168
 
122
169
  - **v3.39.0**: `feedback` 서브커맨드가 터미널이나 Claude 세션에서 버그 제보·기능 제안을 바로 제출합니다. gh CLI가 있으면 이슈 직접 등록, 없으면 로그인 없는 익명 제출(릴레이가 이슈로 자동 등록), 오프라인이면 로컬 저장. `install`은 기존 statusline이 있으면 조용히 건너뛰지 않고 교체 여부를 묻습니다.
123
170
  - **v3.38.0**: `cohesion on`이 응집성 다섯 원칙을 영어 블록으로 주입합니다. 옵트인이고, korean 지침이 켜져 있으면 중복 주입을 막습니다.
@@ -137,11 +184,15 @@ sprag feedback "Bedrock에서 5m TTL 칩이 사라지지 않아요"
137
184
 
138
185
  `gh` CLI가 인증되어 있으면 GitHub 이슈로 바로 등록하고, 없으면 로그인이 필요 없는 익명 경로로 제출합니다(github.com이 막힌 사내망에서도 동작합니다). `gh` 경로를 건너뛰려면 `--anonymous`를 붙입니다. 도구 버전과 OS 정보는 자동으로 첨부됩니다.
139
186
 
140
- 버그를 제보하실 때는 도구 버전(`sprag --version`)과 OS를 함께 적어 주시고, statusline이나 경고 관련 문제라면 statusline 출력이나 `sprag last` 결과를 덧붙여 주시면 원인을 빨리 찾을 수 있습니다.
187
+ 버그를 제보하실 때는 도구 버전(`sprag --version`)과 OS 를 함께 적어 주십시오. statusline 이나 경고 관련 문제라면 statusline 출력이나 `sprag last` 결과를 덧붙여 주시면 원인을 빨리 찾을 수 있습니다.
141
188
 
142
189
  ## 라이선스
143
190
 
144
- MIT
191
+ Apache License 2.0 입니다. 원문은 [LICENSE](./LICENSE) 에 있고, 그 라이선스가 요구하는 출처 표기는 [NOTICE](./NOTICE) 에 정리했습니다.
192
+
193
+ v3.47.0 까지는 MIT 로 배포했습니다. 그 조건으로 받은 사본은 계속 MIT 를 따르고, Apache-2.0 은 그 이후 릴리스부터 적용됩니다.
194
+
195
+ **제품이나 유료 서비스에 붙여 쓰시는 경우.** 라이선스가 이미 허용하므로 허락을 받으실 일은 아닙니다. 다만 알려 주시면 좋겠습니다. 규모가 커질 때 불편해지는 지점은 우회하시는 것보다 저희가 고치는 편이 낫기 때문입니다. 팀 단위로 래칫 규칙을 공유하는 경우, 게이트웨이가 모델 ID 를 불투명한 프로파일로 기록하는 환경, 좌석별 예산 집계가 그런 지점입니다. [이슈](https://github.com/rootstudioyaml/sprag/issues)를 열거나 아래 채널로 연락해 주십시오.
145
196
 
146
197
  ---
147
198