Skip to main content

Output Verbosity Suffixv1.4.0#

POST /v1/compress accepts an optional style field taking one of "terse", "normal" (default), or "verbose". When you set style: "terse", the response carries a short system_prompt_suffix string plus a style_suffix_version tag. Inject the suffix into your downstream LLM's system prompt to cap output verbosity.

The suffix is a versioned constant: fast to inject, prompt-cache-friendly, and does not alter the compressed skeleton itself. It reduces output tokens without affecting compression fidelity.

{
        "compressed": "Short skeleton of the document…",
        "stats": { "original_tokens": 485, "compressed_tokens": 61, "savings_pct": 87.4, ... },
        "system_prompt_suffix": "Be concise. No filler, no hedging. State conclusions first. Omit sycophancy and preambles. Fragments are fine for prose; keep code blocks normal.",
        "style_suffix_version": "v1"
      }

The suffix is a versioned constant (deterministic and prompt-cache-friendly) and changes only when the format changes. "verbose" is reserved for a future workflow; today it returnsnull (same as "normal").

Prompt Cache Optimizationv1.1#

POST /v1/compress accepts an optional cache_policy object. When preserve_prefix is true, gotcontext leaves a static prefix of your document byte-for-byte untouched and compresses only the dynamic remainder. Compression is deterministic for identical input and parameters, so the same call with the same static context reproduces the same preserved prefix bytes every time. That lets your downstream provider's own prompt cache (Anthropic, OpenAI, or Gemini) serve that prefix from cache instead of reprocessing it on every request.

This is a different mechanism from gotcontext's own semantic response cache (see Cache Threshold and Cache-Hit Source Breakdown), which skips recompressing an input you've already sent. Prompt cache optimization instead makes gotcontext's compressed output compatible with the native cache your downstream LLM call maintains on its own end.

{
        "text": string,             // your document: static prefix + dynamic remainder
        "cache_policy": {
          "preserve_prefix": true,  // required to turn the feature on; default false
          "explicit_prefix_bytes": number|null, // optional exact split offset
          "target": "anthropic",    // "anthropic" | "openai" | "gemini"
          "ttl": "1h"                // "5m" (default) | "1h" | "24h"
        }
      }

Leave explicit_prefix_bytes unset and gotcontext scans your text for a common role-boundary marker (a blank line then three dashes, three hash marks, a "USER:" line, or a "Human:" line) and splits right after the first one it finds. If none is found, the whole input is treated as dynamic and no prefix is preserved.

{
        "compressed": string,
        "cache_breakpoints": [
          { "target": "anthropic", "position_tokens": 1240, "ttl": "1h", "hint": "" }
        ],
        "preserved_prefix_tokens": 1240
      }

cache_breakpoints is empty unless cache_policy was supplied. Each provider enforces its own minimum cacheable prefix length (it varies by model, typically in the low thousands of tokens); if the declared or detected prefix is smaller than that minimum, the request is refused with HTTP 422. Pass cost_model so the check runs against the model you are actually calling.

Both SDKs ship a helper that stamps the returned breakpoint onto an Anthropic messages array for you. It works directly off the JSON response, no client wrapper required:

curl -X POST https://api.gotcontext.ai/v1/compress \
        -H "Authorization: Bearer gc_your_key_here" \
        -H "Content-Type: application/json" \
        -d '{
          "text": "You are a helpful, concise assistant.\n---\nWhat did the Q3 filing say about churn?",
          "cache_policy": { "preserve_prefix": true, "target": "anthropic", "ttl": "1h" }
        }'

Only breakpoints with target === "anthropic" are honored by the helper today. OpenAI and Gemini breakpoints come back in cache_breakpoints for you to apply against those providers' own caching APIs.

Pair this with the Prompt-Cache Friendliness Score to check whether a prompt is cache-friendly before you send it, and with Cache-Adjusted Savings to see realized savings across compression and provider cache reuse combined.

Secret-Marker Pre-flight Blockv1.4.0#

POST /v1/compress and POST /v1/compress-code/structural run a pre-flight against the submitted content for unambiguous secret markers. On match, the request is refused with HTTP 400 and a machine-readable error body:

{
        "detail": {
          "error_code": "sensitive_content",
          "marker_class": "aws_access_key",
          "message": "Input appears to contain sensitive content; refusing to compress. Remove the secret value and retry."
        }
      }

Detected marker classes: pem_private_key(PEM RSA/EC/DSA/OpenSSH/PGP/ENCRYPTED private-key headers), aws_access_key (AKIA+ 16-char suffix), openai_api_key (sk-or sk-proj- with ≥20-char suffix), ssh_key_path (.ssh/id_rsa|ed25519|ecdsa|dsafragments), and dotenv_secret(multi-line KEY=value with known-sensitive names like SECRET_KEY, DATABASE_URL, STRIPE_SECRET_KEY, POLAR_ACCESS_TOKEN, etc).

The matched value is never echoed. Error responses carry only the marker_class; the structured log line (sensitive-content-refuse user_id=… marker_class=…) likewise carries no content. Safe to log.

Structural-Loss Advisory Header (code_blocks, headings, urls)v1.4.0#

Every POST /v1/compress response now counts the fenced code blocks, markdown headings, and URLs present in the input and compares to the compressed output. If any class has fewer occurrences in the output, an advisory header is attached:

HTTP/1.1 200 OK
      X-Fidelity-Warning: code_blocks,urls
      Content-Type: application/json
      …

This is advisory. The request never fails on structural loss. Dashboards can alert on high per-tenant rates; auditors can verify "did I lose structure?" without a separate call. Possible values are a comma-separated subset of code_blocks, headings, urls. Absent means all three classes were preserved.

Fidelity Profiles#

Save named compression presets so repeat workflows fire one slug instead of three knobs. Each profile stores a fidelity level, chunk size, and skeleton ratio; pass profile="my-name" on any compress call instead of the raw parameters.

Five built-in fidelity tiers: abstract (most compressed) · outline · balanced (default) · detailed · raw. Manage profiles at /dashboard/profiles.

Where to next

Quickstart
Connect your MCP client and run your first compression in under two minutes.
Recipes
Copy-paste tool sequences for the workflows you'll run most.
Troubleshooting
Symptom-to-fix for the errors people actually hit.
Glossary
Plain-language definitions for skeleton, fidelity, profiles, and the rest.