ccstats 0.4.0

Fast token and cost usage statistics CLI for Claude Code, OpenAI Codex, Cursor, Grok, and Kimi Code
Documentation
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://specrail.local/schemas/runtime_checkpoint.schema.json",
  "title": "Runtime Checkpoint",
  "type": "object",
  "required": [
    "checkpoint_version",
    "tranche_id",
    "repo",
    "scope",
    "status",
    "context_budget",
    "output_firewall",
    "items",
    "resume_prompt"
  ],
  "additionalProperties": true,
  "properties": {
    "checkpoint_version": {
      "const": 1
    },
    "tranche_id": {
      "type": "string",
      "minLength": 1
    },
    "repo": {
      "type": "string",
      "minLength": 1
    },
    "scope": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "enum": ["planning", "running", "blocked", "handoff", "complete"]
    },
    "overall_objective": {
      "type": "string"
    },
    "queue_mode": {
      "enum": ["bounded_tranche", "full_queue_drain", null]
    },
    "spec_coverage": {
      "type": ["object", "null"],
      "additionalProperties": true,
      "properties": {
        "checked_at": {
          "type": ["string", "null"]
        },
        "complete": {
          "type": "array"
        },
        "needs_tasks": {
          "type": "array"
        },
        "needs_spec": {
          "type": "array"
        },
        "umbrella_covered": {
          "type": "array"
        },
        "exception_allowed": {
          "type": "array"
        }
      }
    },
    "goal": {
      "type": ["object", "null"],
      "additionalProperties": true,
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "objective": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "tokens_used": {
          "type": ["integer", "null"],
          "minimum": 0
        },
        "token_budget": {
          "type": ["integer", "null"],
          "minimum": 1
        }
      }
    },
    "goal_candidate": {
      "type": ["object", "null"],
      "additionalProperties": true,
      "required": ["objective", "done_when", "blocked_stop_condition"],
      "properties": {
        "objective": {
          "type": "string",
          "minLength": 1
        },
        "done_when": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "constraints": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "blocked_stop_condition": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "context_budget": {
      "type": "object",
      "required": [
        "window_tokens",
        "soft_stop_ratio",
        "hard_stop_ratio",
        "critical_stop_ratio"
      ],
      "additionalProperties": true,
      "properties": {
        "window_tokens": {
          "type": "integer",
          "minimum": 1
        },
        "soft_stop_ratio": {
          "type": "number",
          "exclusiveMinimum": 0,
          "exclusiveMaximum": 1
        },
        "hard_stop_ratio": {
          "type": "number",
          "exclusiveMinimum": 0,
          "exclusiveMaximum": 1
        },
        "critical_stop_ratio": {
          "type": "number",
          "exclusiveMinimum": 0,
          "exclusiveMaximum": 1
        }
      }
    },
    "output_firewall": {
      "type": "object",
      "required": [
        "raw_log_policy",
        "max_parent_stdout_lines",
        "max_subagent_final_lines",
        "artifact_root"
      ],
      "additionalProperties": true,
      "properties": {
        "raw_log_policy": {
          "const": "file_only"
        },
        "max_parent_stdout_lines": {
          "type": "integer",
          "minimum": 1
        },
        "max_subagent_final_lines": {
          "type": "integer",
          "minimum": 1
        },
        "artifact_root": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["state", "next_action"],
        "additionalProperties": true,
        "properties": {
          "issue": {
            "type": ["integer", "null"],
            "minimum": 1
          },
          "pr": {
            "type": ["integer", "null"],
            "minimum": 1
          },
          "state": {
            "type": "string",
            "minLength": 1
          },
          "spec_status": {
            "enum": [
              "complete",
              "needs_tasks",
              "needs_spec",
              "umbrella_covered",
              "exception_allowed",
              null
            ]
          },
          "spec_status_reason": {
            "type": ["string", "null"]
          },
          "branch": {
            "type": ["string", "null"]
          },
          "worktree": {
            "type": ["string", "null"]
          },
          "head_sha": {
            "type": ["string", "null"]
          },
          "truth_level": {
            "enum": ["A", "B", "C", "D", null]
          },
          "ci": {
            "type": ["object", "null"],
            "additionalProperties": true
          },
          "local_verification": {
            "type": "array"
          },
          "review": {
            "type": ["object", "null"],
            "additionalProperties": true
          },
          "review_threads": {
            "type": ["object", "null"],
            "additionalProperties": true
          },
          "pr_gate": {
            "type": ["object", "null"],
            "additionalProperties": true
          },
          "blocker": {
            "type": ["string", "null"]
          },
          "next_action": {
            "type": "string",
            "minLength": 1
          },
          "merge_state": {
            "type": ["string", "null"]
          }
        }
      }
    },
    "remaining_queue": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["state", "next_action"],
        "additionalProperties": true,
        "properties": {
          "issue": {
            "type": ["integer", "null"],
            "minimum": 1
          },
          "pr": {
            "type": ["integer", "null"],
            "minimum": 1
          },
          "state": {
            "type": "string",
            "minLength": 1
          },
          "spec_status": {
            "enum": [
              "complete",
              "needs_tasks",
              "needs_spec",
              "umbrella_covered",
              "exception_allowed",
              null
            ]
          },
          "spec_status_reason": {
            "type": ["string", "null"]
          },
          "blocker": {
            "type": ["string", "null"]
          },
          "next_action": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "resume_prompt": {
      "type": "string",
      "minLength": 1
    }
  }
}