A typical implementation of the protocol standardizing a verbose meteorological API payload.
{
"url": "https://api.weather.gov/gridpoints/TOP/31,80/forecast",
"signals": ["temperature", "windspeed", "shortforecast"],
"aliases": {
"temperature": "temp",
"shortforecast": "forecast"
}
}
periods[0].temp: 45
periods[0].windspeed: 10 mph
periods[0].forecast: Mostly Clear
periods[1].temp: 38
periods[1].windspeed: 5 mph
periods[1].forecast: Sunny
Real-world compression metrics from the reference implementation.
Input (raw JSON): ~27 estimated tokens
Output (skin): ~5 estimated tokens
Savings: 83.02%
Platform Fee: 5 tokens
The analysis function calculates exact token estimates before and after transformation, enabling precise cost modeling for production pipelines.
AgentSkin handles both APIs and web pages. When fetching HTML content, the engine parses semantic structure and converts to structured JSON before pruning.
1. Fetch HTML content
2. Parse with cheerio (HTML parser)
3. Extract: title, h1/h2, paragraphs, links, meta
4. Convert to structured JSON
5. Prune with signals/aliases
6. Output clean Markdown skin