{"uid":"cap__d3_9k95szbgRcGnLGxz2","slug":"packing-displacement-analysis-248123c1","name":"Packing Displacement Analysis","description":"Compare strict rank-prefix packing with rank-order greedy-fit and score-density greedy-fit for up to 64 passages under a 1–2048 token budget. Report evidence displacement and optional observed selection violations. Uses declared integer costs/scores; no tokenization or causal attribution.","url":"https://www.mahastrategies.com/api/v1/micro/packing-displacement-analysis?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["dataClass","budget","requiredEvidenceIds","candidates","observedSelectedPassageIds"],"properties":{"budget":{"type":"integer","maximum":2048,"minimum":1},"dataClass":{"enum":["public","synthetic"],"type":"string"},"candidates":{"type":"array","maxItems":64,"minItems":1},"requiredEvidenceIds":{"type":"array","maxItems":64,"minItems":1},"observedSelectedPassageIds":{"anyOf":[{"type":"array","maxItems":64,"minItems":0},{"type":"null"}]}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["version","offerId","amountBaseUnits","inputDigest","result","boundaries","receiptDigest"],"properties":{"result":{"type":"object"},"offerId":{"enum":["packing-displacement-analysis"],"type":"string"},"version":{"enum":["maha-microproducts/0.1"],"type":"string"},"boundaries":{"type":"array","maxItems":128,"minItems":0},"inputDigest":{"type":"string","maxLength":71},"receiptDigest":{"type":"string","maxLength":71},"amountBaseUnits":{"enum":["78000"],"type":"string"}},"additionalProperties":false}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.078","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.078/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.078","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.078","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_f1OoZEWlysGwzjqejXEHh","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.078","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compares strict rank-prefix packing, rank-order greedy-fit, and score-density greedy-fit strategies for up to 64 passages under a token budget, reporting evidence displacement and optional selection violations.","exampleAgentPrompt":"Compare strict rank-prefix packing against rank-order greedy-fit and score-density greedy-fit for these 20 candidate passages — each with declared token costs and relevance scores — using a 512-token budget, with required evidence IDs [e1, e2, e3], and check whether my observed selection [p1, p4, p7] violates the optimal strategy. Data class is synthetic.","exampleUseCases":[{"title":"RAG pipeline packing strategy audit","prompt":"I have 40 candidate passages with declared token costs and scores for a RAG system running under a 1024-token context budget. Can you compare strict rank-prefix, rank-order greedy, and score-density greedy packing strategies and tell me which one displaces the least required evidence? Data class is public, required evidence IDs are [doc-3, doc-11, doc-22]."},{"title":"Detecting selection violations in observed picks","prompt":"My retrieval system selected passages [p2, p5, p9, p13] from a pool of 30 candidates with a 768-token budget — can you run a packing displacement analysis to see if those observed picks violate what rank-order or score-density greedy-fit would have chosen? Data class is synthetic, required evidence IDs are [p2, p9]."},{"title":"Optimizing token budget for high-score evidence","prompt":"I have 15 passages with explicit integer token costs and relevance scores, a 256-token budget, and I need to know how much required evidence (IDs: [ev-1, ev-2]) gets displaced under each of the three packing strategies — rank-prefix, rank-order greedy, and score-density greedy. Please run the displacement analysis with data class set to public."}],"resultDescription":"Returns a structured result object containing per-strategy packing outcomes, evidence displacement counts, optional observed selection violation flags, boundary arrays, an offer ID ('packing-displacement-analysis'), version string, amount in base units, and cryptographic input/receipt digests for auditability.","failureModes":["More than 64 candidates or required evidence IDs submitted — rejected with validation error","Token budget outside 1–2048 range — rejected","Missing required fields (dataClass, budget, requiredEvidenceIds, candidates) — 400-level error","Invalid dataClass enum value (not 'public' or 'synthetic') — schema validation failure","Payment not processed — x402 payment required error","observedSelectedPassageIds array exceeds 64 items — rejected"],"whenToPreferThis":"Choose this endpoint when you need a deterministic, integer-cost comparison of multiple context-window packing strategies without any tokenization or causal inference — specifically when auditing RAG pipelines, verifying that observed passage selections are consistent with optimal strategies, or quantifying evidence displacement across rank-prefix and greedy-fit methods. It is uniquely suited for scenarios where you have explicit declared costs and scores and want a reproducible algorithmic comparison rather than a heuristic or ML-based recommendation.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-16T06:49:32.570Z","isFirstParty":false,"canonicalSlug":"packing-displacement-analysis-248123c1"}