sync-week

A command that calculates the estimated US-dollar cost of Claude use during a selected subscription week and saves a weekly record.

In plain words
What is it for?
Use it to calculate a chosen week’s cost, work offline, choose the week boundaries, or save the result as JSON.
Why use it?
It turns individual conversation records into a reusable weekly cost snapshot for later reports. The Claude cost is a transcript-based lower-bound estimate, not an exact billing total.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/omrikais/cctally/sync-week
Clone the repo
git clone --depth 1 https://github.com/omrikais/cctally
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 700 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00700
Opus 5 $0.00000 $0.00350
Sonnet 5 $0.00000 $0.00140
Haiku 4.5 $0.00000 $0.00070

Measured 2d ago against content hash b9623ad0b5fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sync-week scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/sync-week.md · 73 lines

How it starts

The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.

sync-week

Compute the USD cost for a subscription week and store it in weekly_cost_snapshots.

Cost coverage: The stored Claude cost is a transcript-derived lower bound, not an exact /usage billing total.

Synopsis

cctally sync-week
    [--week-start YYYY-MM-DD] [--week-end YYYY-MM-DD]
    [--week-start-name {monday,…,sunday}]
    [--mode {auto,calculate,display}]
    [--offline] [--project PROJECT]
    [--json] [--quiet]

Purpose

Walk Claude session JSONLs in the chosen week window, compute total USD cost from CLAUDE_MODEL_PRICING, and persist a snapshot. report reads these snapshots to compute $/1%.

Week selection priority

  1. Explicit --week-start / --week-end (date based)
  2. Latest weekly_usage_snapshots.week_start_at / week_end_at (hour-accurate)
  3. Current week from configured week-start rule (--week-start-nameconfig.jsonmonday)

Options

Flag Description
--week-start YYYY-MM-DD Explicit week start date. If --week-end is omitted, uses start + 6 days.
--week-end YYYY-MM-DD Explicit inclusive week end (for custom windows).
--week-start-name Week-start day used when explicit/custom boundaries are unavailable.
--mode {auto,calculate,display} Cost calculation mode (default auto).
--offline No-op; pricing data is always embedded.
--project PROJECT Filter cost calc to a single Claude project (cwd).
--json Machine-readable JSON output.
--quiet Suppress human-readable output (no effect with --json).

Examples

cctally sync-week
cctally sync-week --week-start 2026-02-05 --week-end 2026-02-12
cctally sync-week --mode calculate --offline --json

Notes

  • sync-week is idempotent per invocation — calling it twice in a row writes two snapshot rows for the same week. report reads the latest per-week row.
  • --mode display reuses the value computed at last --mode calculate rather than recomputing from JSONLs. Use it as a low-cost refresh.
  • Cost is only stored here; if you change CLAUDE_MODEL_PRICING, re-run sync-week to pick up the new rates in weekly_cost_snapshots. (Other commands like daily / weekly recompute on every read and don't need this.)

Read the full file on GitHub · 73 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 73 lines · 0 tokens per session scan A b9623ad0b5fe

Subscribe to this mod's changes

sync-week is a command published in the GitHub repository omrikais/cctally (5 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 700 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.