sprag-cli 3.90.2 → 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,7 +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
- <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-explain-ko.png" width="760" alt="카드 두 장입니다. 첫 번째는 5시간·7일·LiteLLM 한도가 찰수록 더 많이 위임한다는 내용으로, 70%까지는 평소대로, 70%부터는 판단이 애매하면, 90%부터는 여러 단계 작업도 위임하고 설계·보안·배포는 항상 메인 모델이 맡습니다. 두 번째는 절감액이 메인 모델이 직접 했다면 냈을 비용에서 서브에이전트와 위임에 실제로 든 비용을 뺀 값이라는 계산 기준입니다.">
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
+
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건입니다.">
31
33
 
32
34
  </div>
33
35
 
package/README.md CHANGED
@@ -27,7 +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
- <img src="https://raw.githubusercontent.com/rootstudioyaml/sprag/main/docs/sprag-explain-en.png" width="760" alt="Two cards. The first: 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%), while design, security and deploys always stay on the main model. The second: a saving is what the main model would have paid to do the delegated work, minus what the subagent and the delegating actually cost.">
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
+
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.">
31
33
 
32
34
  </div>
33
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprag-cli",
3
- "version": "3.90.2",
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,