Skip to content

Expose privacy-safe pruning receipts for context-cleaning runs #101

@caioribeiroclw-pixel

Description

@caioribeiroclw-pixel

Cozempic is solving the practical side of Claude Code context bloat: prune/minify/stub the stuff that should not keep living in the session. One missing debug primitive I keep seeing across the Claude Code context-bloat threads is a small receipt that proves what was pruned without exposing the raw session.

Suggested shape for a dry-run / execute artifact:

{
  "event": "context.prune.completed",
  "session_id_hash": "hmac-sha256:...",
  "run_id": "uuid-or-hash",
  "prescription": "standard",
  "strategy_counts": {
    "tool-output-trim": 7,
    "tool-result-age:minified": 18,
    "tool-result-age:stubbed": 43,
    "document-dedup": 2,
    "compact-summary-collapse": 1
  },
  "before_tokens_bucket": "100k_150k",
  "after_tokens_bucket": "50k_75k",
  "bytes_removed_bucket": "10mb_25mb",
  "protected_counts": {
    "compact_summary": 1,
    "team_message": 4,
    "behavioral_digest": 3
  },
  "raw_text_copied": false,
  "backup_created": true,
  "audit_gaps": ["receipt_proves_prune_shape_not_summary_correctness"]
}

Why I think this is useful:

  • users can distinguish "Cozempic saved tokens" from "it removed the thing I needed"
  • maintainers can debug strategy regressions from hashes/counts/buckets instead of asking for private .jsonl sessions
  • it gives teams a safe before/after artifact for guard daemon actions, doctor fixes, and aggressive prescriptions
  • it pairs well with the existing dry-run default: cozempic treat current --receipt-json could be safe to share by default

Privacy guardrails I would keep strict:

  • HMAC session/message/tool ids, not plain SHA-256 over predictable ids
  • bucket token/byte/line counts instead of exact raw sizes where possible
  • never copy raw tool output, prompts, file paths, screenshots, or behavioral digest text into the receipt
  • include protected-item counts so users can verify Agent Teams / compact summaries / digest entries were not touched

This is not a request to make Cozempic an observability system. I think the minimal win is a shareable receipt for each treatment/guard run that answers: which strategy acted, how much changed, what was protected, and what privacy boundary was preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions