sprag-cli 3.90.1 → 3.90.3

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 CHANGED
@@ -27,10 +27,9 @@
27
27
  같은 요청 12건, 두 터미널: sprag 적용 시 **$6.68 → $1.83 (72.6% 절감)**<br>
28
28
  <sub>예시 요청을 공개 단가로 계산했습니다. <a href="https://sprag.io/assets/video/sprag-compare-ko.mp4">전체 영상 (41초)</a></sub>
29
29
 
30
- <a href="https://sprag.io/assets/video/sprag-explain-ko.mp4"><img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-explain-ko.gif" width="760" alt="사용량 한도 게이지가 차오를수록 요청이 서브에이전트 쪽으로 더 많이 옮겨 가고, 이어서 메인 모델이 직접 했다면 냈을 비용이 세 조각으로 쌓이는 막대를 보여 줍니다."></a>
30
+ <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-limits-ko.png" width="760" alt="5시간·7일·LiteLLM 한도가 찰수록 더 많이 위임합니다. 70%까지는 평소대로, 70%부터는 판단이 애매하면, 90%부터는 여러 단계 작업도 위임하고, 설계·보안·배포는 한도와 상관없이 메인 모델이 처리합니다.">
31
31
 
32
- 한도가 찰수록 더 많이 위임하고, 절감액은 메인 모델이 직접 했을 때의 비용으로 계산합니다.<br>
33
- <sub>요청 흐름은 개념도이고 실측이 아닙니다. $209.67은 개발 PC에서 14일간 위임 87건으로 아낀 금액입니다. <a href="https://sprag.io/assets/video/sprag-explain-ko.mp4">전체 영상 (37초)</a></sub>
32
+ <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-savings-ko.png" width="760" alt="절감액 계산 기준입니다. 위임한 일을 메인 모델이 직접 했다면 냈을 비용에서 실제로 쓴 비용을 뺀 값이며, 계산식과 실측 금액을 나란히 보여 줍니다. 최근 14일(2026-10-17 ~ 2026-10-31, 개발 PC 1대, 위임 83건) 절감액 합계는 $216.38이고 손해로 계산된 위임은 0건입니다.">
34
33
 
35
34
  </div>
36
35
 
package/README.md CHANGED
@@ -27,10 +27,9 @@
27
27
  Same 12 requests, two terminals: **$6.68 → $1.83 (−72.6%)** with Sprag.<br>
28
28
  <sub>Example requests priced at public list rates. <a href="https://sprag.io/assets/video/sprag-compare-en.mp4">Full video (41s)</a></sub>
29
29
 
30
- <a href="https://sprag.io/assets/video/sprag-explain-en.mp4"><img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-explain-en.gif" width="760" alt="As a usage-limit gauge fills, more requests shift from the main model to subagents, and then a bar stacks up what the main model would have paid to do the work itself."></a>
30
+ <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-limits-en.png" width="760" alt="The fuller your 5-hour, 7-day or LiteLLM limit gets, the more Sprag delegates: as usual below 70%, when in doubt from 70%, multi-step work too from 90%. Design, security and deploys always stay on the main model.">
31
31
 
32
- Delegates more as your limit fills, and counts savings as what the main model would have paid to do the work itself.<br>
33
- <sub>Concept diagram, not a measurement; the $209.67 saved is 87 delegations over 14 days on a dev machine. <a href="https://sprag.io/assets/video/sprag-explain-en.mp4">Full video (37s)</a></sub>
32
+ <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-savings-en.png" width="760" alt="How savings are counted: what the main model would have paid to do the delegated work, minus what it actually cost, shown as a formula with the measured amounts. Over the last 14 days (Oct 17 to Oct 31, 2026, one dev machine, 83 delegations) the total saving was $216.38, with no delegation counted as a loss.">
34
33
 
35
34
  </div>
36
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprag-cli",
3
- "version": "3.90.1",
3
+ "version": "3.90.3",
4
4
  "description": "Model-delegation router for Claude Code and Codex: lookups, checks and test runs go to cheaper models, documents go in as compact Markdown, and a live statusline shows spend and savings.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/net-saving.js CHANGED
@@ -111,9 +111,12 @@ export function netSavingV3({ calls, mainCtx, followUps, promptTokens, resultTok
111
111
  const ctx1 = calls[0].ctx;
112
112
  const grow = (c) => Math.max(0, c.ctx - ctx1);
113
113
  let cfWork = 0;
114
+ let cfReread = 0;
114
115
  let totalOut = 0;
115
116
  calls.forEach((c, i) => {
116
- cfWork += (mainCtx + grow(c)) * rates.cacheRead;
117
+ const reread = (mainCtx + grow(c)) * rates.cacheRead;
118
+ cfWork += reread;
119
+ cfReread += reread;
117
120
  if (!(skipFirstWrite && i === 0)) cfWork += c.newIn * rates.write;
118
121
  cfWork += c.out * rates.output;
119
122
  totalOut += c.out;
@@ -124,5 +127,7 @@ export function netSavingV3({ calls, mainCtx, followUps, promptTokens, resultTok
124
127
  + resultTokens * rates.write
125
128
  + resultTokens * followUps * rates.cacheRead;
126
129
  const actual = subActual + overhead;
127
- return { usd: cfWork + cfCarry - actual, cfWork, cfCarry, overhead, actual };
130
+ // cfReread is the part of cfWork spent re-reading context; the rest is new
131
+ // input and output. Split out so the savings page can show each term.
132
+ return { usd: cfWork + cfCarry - actual, cfWork, cfReread, cfCarry, overhead, actual, subActual };
128
133
  }
package/src/route-scan.js CHANGED
@@ -973,6 +973,9 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
973
973
  usd: detail.usd,
974
974
  v2: runSaving(e.run, baseline),
975
975
  cfWork: detail.cfWork,
976
+ cfReread: detail.cfReread,
977
+ subActual: detail.subActual,
978
+ startedAt: e.run.startedAt ?? null,
976
979
  cfCarry: detail.cfCarry,
977
980
  overhead: detail.overhead,
978
981
  firstWrite: detail.basis === 'v3' ? (e.run.perCall[0].newIn * (unitRates(baseline)?.write ?? 0)) : 0,