{"slug":"agent-halowerk-com-v1-memory-compact-23986a","title":"Takes a message history and a character budget and returns a shortened history t","host":"agent.halowerk.com","method":"POST","resource":"https://agent.halowerk.com/v1/memory-compact","category":"other","description":"Takes a message history and a character budget and returns a shortened history together with a full account of what it cost. Four stages run in fixed order: pin protects messages that must survive (roles listed in keep_roles, the last keep_last_n messages, and anything you marked pin), dedupe remove","price_listed":0.005,"price_asked":0.005,"state":"answering","state_label":"Answering","checks_7d":1,"answered_7d":1,"latency_ms_median":1178,"reported_calls_30d":1,"reported_payers_30d":1,"networks":["eip155:8453"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"budget_chars":400,"duplicate_threshold":0.9,"keep_last_n":2,"keep_roles":["system"],"max_message_chars":120,"messages":[{"content":"You are a logistics dispatcher. Always answer with the shipment id first.","role":"system"},{"content":"Where is shipment DE-4471? It left Hamburg on Monday morning and should reach Lyon by Thursday.","role":"user"},{"content":"DE-4471 is in transit and cleared the Strasbourg hub at 03:10. Estimated arrival in Lyon is Thursday 14:00.","role":"assistant"},{"content":"Where is shipment DE-4471? It left Hamburg on Monday morning and should reach Lyon by Thursday.","role":"user"},{"content":"DE-4471 is still on schedule, no new scan since Strasbourg.","role":"assistant"},{"content":"Good. Book the return leg for Friday.","role":"user"}]},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"additionalProperties":false,"properties":{"budget_chars":{"description":"Character budget for the sum of all returned message contents.","maximum":400000,"minimum":100,"type":"integer"},"duplicate_threshold":{"default":0.9,"description":"Word-overlap ratio from which a later message of the same role counts as a near-duplicate of an earlier one.","maximum":1,"minimum":0.5,"type":"number"},"keep_last_n":{"default":5,"description":"How many of the most recent messages are protected.","maximum":50,"minimum":0,"type":"integer"},"keep_roles":{"default":["system"],"description":"Roles whose messages are protected.","items":{"enum":["system","user","assistant","tool"],"type":"string"},"maxItems":4,"type":"array"},"max_message_chars":{"default":400,"description":"Length to which unprotected survivors are trimmed in the trim stage.","maximum":4000,"minimum":80,"type":"integer"},"messages":{"description":"The conversation in order, oldest first.","items":{"additionalProperties":false,"properties":{"content":{"description":"Message text.","maxLength":8000,"minLength":1,"type":"string"},"id":{"description":"Optional caller-side identifier, echoed unchanged.","maxLength":128,"type":"string"},"pin":{"default":false,"description":"If true this message is protected: never trimmed, never dropped.","type":"boolean"},"role":{"description":"Speaker role.","enum":["system","user","assistant","tool"],"type":"string"}},"required":["role","content"],"type":"object"},"maxItems":200,"minItems":2,"type":"array"}},"required":["messages","budget_chars"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-09-24","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.005,"price_match":true,"latency_ms":1178,"error":null}],"description_full":"Takes a message history and a character budget and returns a shortened history together with a full account of what it cost. Four stages run in fixed order: pin protects messages that must survive (roles listed in keep_roles, the last keep_last_n messages, and anything you marked pin), dedupe removes later near-duplicates of an earlier message of the same role using word-overlap similarity, trim shortens unprotected survivors to max_message_chars at the last sentence boundary, and drop removes…","last_updated":"2026-09-19T15:59:10.187Z","schemes":["exact"]}