{ "pack_id": "cost-optimization", "title": "Cost optimization", "version": "0.1.0", "summary": "A collection of nouns and verbs for finding and measuring cost savings: ledgers from supplied usage and dated prices, savings proposed with arithmetic, before-and-after measurements and recommendations for the owner, keeping billed, measured, estimated and credit apart.", "dependencies": [ "evaluation-design" ], "boundaries": [ "Never change plans, settings, resources or model choices. Recommendations are for the owner to act on.", "Read only usage and invoices the requester supplied or exported. Do not open billing dashboards or credential files.", "Keep the caller's chosen model and output settings. A cheaper setting is a trade-off to measure, not a default.", "Importing the pack writes nothing and enqueues nothing." ], "nouns": [ { "slug": "pack", "category": "noun.skill_pack", "role": "pack", "title": "A collection of nouns and verbs for finding and measuring cost savings", "value": { "lets_workers": "Find where a project's money goes and how to spend less without breaking anything: build a ledger from supplied usage and dated prices, propose savings with their arithmetic, measure the promising ones before and after, and recommend changes for the owner to make.", "flow": [ { "verb": { "$verb": "cost-optimization.inventory-costs" }, "when": "First, from usage and invoices the requester supplied." }, { "verb": { "$verb": "cost-optimization.price-check" }, "when": "For ledger lines without a dated price." }, { "verb": { "$verb": "cost-optimization.propose-savings" }, "when": "After the ledger exists." }, { "verb": { "$verb": "cost-optimization.measure-saving" }, "when": "For savings worth confirming; two runs each, before and after." }, { "verb": { "$verb": "cost-optimization.recommend" }, "when": "After measurements, or directly for obvious estimates labeled as such." }, { "verb": { "$verb": "cost-optimization.review-recommendation" }, "when": "Last, by a different worker." } ], "relationship": "Repository review's cost family finds cost questions in code; this pack goes deeper with ledgers and measurements.", "rules": [ "Never change plans, settings, resources or model choices. Recommendations are for the owner to act on.", "Read only usage and invoices the requester supplied or exported. Do not open billing dashboards or credential files.", "Keep the caller's chosen model and output settings. A cheaper setting is a trade-off to measure, not a default." ] }, "relations": [ [ "requires_noun", "method" ], [ "requires_noun", "template.cost-ledger" ], [ "requires_noun", "template.price-card" ], [ "requires_noun", "template.saving-hypothesis" ], [ "requires_noun", "template.saving-result" ], [ "requires_noun", "template.recommendation" ], [ "requires_noun", "template.review" ] ] }, { "slug": "method", "category": "noun.skill_pack", "role": "method", "title": "Cost method: separate billed, measured, estimated and credit", "category_reason": "A reusable method with its guardrails, used by every verb in this pack.", "value": { "rules": [ "Keep four kinds of numbers apart: billed (from an invoice), measured (from usage counters), estimated (arithmetic on stated assumptions) and credit.", "Every price has a source URL and the date it was read; plans and prices change.", "Unknown amounts stay null; never fill a gap with zero.", "A saving counts only if quality, reliability and security hold; measure them with the same runs.", "Keep the caller's chosen model and output settings. A cheaper setting is a trade-off to measure, not a default.", "Never change plans, settings, resources or model choices. Recommendations are for the owner to act on.", "Read only usage and invoices the requester supplied or exported. Do not open billing dashboards or credential files." ], "measurement": { "$pin": "evaluation-design:method" } }, "relations": [ [ "requires_noun", "evaluation-design:method" ] ] }, { "slug": "template.cost-ledger", "category": "noun.eval_run", "role": "template", "title": "Template: a cost ledger for one period: each line's unit, quantity, price, amount, basis and source", "value": { "describes": "a cost ledger for one period: each line's unit, quantity, price, amount, basis and source", "schema": { "type": "object", "additionalProperties": false, "required": [ "period", "currency", "lines", "total_by_basis" ], "properties": { "period": { "type": "object", "additionalProperties": false, "required": [ "start", "end" ], "properties": { "start": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}", "maxLength": 40 }, "end": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}", "maxLength": 40 } } }, "currency": { "type": "string", "minLength": 3, "maxLength": 3, "pattern": "^[A-Z]{3}$" }, "lines": { "type": "array", "minItems": 1, "maxItems": 200, "items": { "type": "object", "additionalProperties": false, "required": [ "service", "unit", "quantity", "unit_price", "amount", "basis", "source" ], "properties": { "service": { "type": "string", "minLength": 1, "maxLength": 120 }, "unit": { "type": "string", "minLength": 1, "maxLength": 80 }, "quantity": { "type": [ "number", "null" ] }, "unit_price": { "type": [ "number", "null" ] }, "amount": { "type": [ "number", "null" ] }, "basis": { "type": "string", "enum": [ "billed", "measured", "estimated", "credit" ] }, "source": { "type": "string", "minLength": 1, "maxLength": 300 }, "price_card_ref": { "type": "string", "minLength": 0, "maxLength": 300 } } } }, "total_by_basis": { "type": "object", "additionalProperties": false, "required": [ "billed", "measured", "estimated", "credit" ], "properties": { "billed": { "type": [ "number", "null" ] }, "measured": { "type": [ "number", "null" ] }, "estimated": { "type": [ "number", "null" ] }, "credit": { "type": [ "number", "null" ] } } } } }, "rules": [ "Totals are kept per basis, never mixed.", "A line without a price has amount null." ] }, "category_reason": "A ledger is a null-honest scorecard of spend with its sources." }, { "slug": "template.price-card", "category": "noun.public_source", "role": "template", "title": "Template: one dated price from a provider's public pricing page", "value": { "describes": "one dated price from a provider's public pricing page", "schema": { "type": "object", "additionalProperties": false, "required": [ "provider", "item", "unit", "price", "currency", "plan", "source_url", "read_at" ], "properties": { "provider": { "type": "string", "minLength": 1, "maxLength": 120 }, "item": { "type": "string", "minLength": 1, "maxLength": 200 }, "unit": { "type": "string", "minLength": 1, "maxLength": 80 }, "price": { "type": [ "number", "null" ], "minimum": 0 }, "unknown_reason": { "type": "string", "minLength": 0, "maxLength": 300 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3, "pattern": "^[A-Z]{3}$" }, "plan": { "type": "string", "minLength": 1, "maxLength": 120 }, "source_url": { "type": "string", "minLength": 1, "maxLength": 400, "pattern": "^https://" }, "read_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}", "maxLength": 40 }, "notes": { "type": "string", "minLength": 0, "maxLength": 300 } } }, "rules": [ "read_at is the date the page was read.", "A price that is not public is null with unknown_reason; prices behind a login are out of scope." ], "example": { "provider": "SYNTHETIC cloud", "item": "rows written", "unit": "1 million rows", "price": 1.0, "currency": "USD", "plan": "SYNTHETIC paid plan", "source_url": "https://example.invalid/synthetic/pricing", "read_at": "2026-10-29" } }, "category_reason": "A price card is a dated snapshot of a public source." }, { "slug": "template.saving-hypothesis", "category": "noun.seed_hypothesis", "role": "template", "title": "Template: a proposed saving with its arithmetic, risks and how to measure it", "value": { "describes": "a proposed saving with its arithmetic, risks and how to measure it", "schema": { "type": "object", "additionalProperties": false, "required": [ "change", "expected_saving", "arithmetic", "risks", "measure_with" ], "properties": { "change": { "type": "string", "minLength": 1, "maxLength": 400 }, "expected_saving": { "type": "object", "additionalProperties": false, "required": [ "amount", "currency", "period", "basis" ], "properties": { "amount": { "type": "number", "minimum": 0 }, "currency": { "type": "string", "minLength": 3, "maxLength": 3 }, "period": { "type": "string", "minLength": 1, "maxLength": 40 }, "basis": { "type": "string", "enum": [ "estimated" ] } } }, "arithmetic": { "type": "string", "minLength": 1, "maxLength": 600 }, "risks": { "type": "array", "minItems": 1, "maxItems": 8, "items": { "type": "string", "minLength": 1, "maxLength": 300 } }, "measure_with": { "type": "string", "minLength": 1, "maxLength": 400 }, "reversible": { "type": "boolean" } } }, "rules": [ "expected_saving is always an estimate until measured.", "Name every risk to quality, reliability or security." ] }, "category_reason": "A saving hypothesis is a falsifiable prediction that measurement confirms or refutes." }, { "slug": "template.saving-result", "category": "noun.eval_run", "role": "template", "title": "Template: a before-and-after measurement of one saving", "value": { "describes": "a before-and-after measurement of one saving", "schema": { "type": "object", "additionalProperties": false, "required": [ "hypothesis_ref", "before", "after", "runs", "saving", "quality_held", "notes" ], "properties": { "hypothesis_ref": { "type": "string", "minLength": 1, "maxLength": 300 }, "before": { "type": "object", "additionalProperties": false, "required": [ "amount", "unit", "basis" ], "properties": { "amount": { "type": [ "number", "null" ] }, "unit": { "type": "string", "minLength": 1, "maxLength": 80 }, "basis": { "type": "string", "enum": [ "billed", "measured", "estimated", "credit" ] } } }, "after": { "type": "object", "additionalProperties": false, "required": [ "amount", "unit", "basis" ], "properties": { "amount": { "type": [ "number", "null" ] }, "unit": { "type": "string", "minLength": 1, "maxLength": 80 }, "basis": { "type": "string", "enum": [ "billed", "measured", "estimated", "credit" ] } } }, "runs": { "type": "integer", "minimum": 2, "maximum": 10 }, "saving": { "type": [ "number", "null" ] }, "quality_held": { "type": [ "boolean", "null" ] }, "notes": { "type": "string", "minLength": 1, "maxLength": 600 } } }, "rules": [ "At least two runs for before and after.", "quality_held null means it was not measured." ] }, "category_reason": "A saving result is a measured run comparison." }, { "slug": "template.recommendation", "category": "noun.seed_hypothesis", "role": "template", "title": "Template: recommended changes for the owner, each with saving, evidence and trade-offs", "value": { "describes": "recommended changes for the owner, each with saving, evidence and trade-offs", "schema": { "type": "object", "additionalProperties": false, "required": [ "items", "adoption_authorized" ], "properties": { "items": { "type": "array", "minItems": 1, "maxItems": 10, "items": { "type": "object", "additionalProperties": false, "required": [ "change", "recommendation", "saving", "evidence", "trade_offs" ], "properties": { "change": { "type": "string", "minLength": 1, "maxLength": 300 }, "recommendation": { "type": "string", "enum": [ "do", "measure_first", "no_change" ] }, "saving": { "type": "object", "additionalProperties": false, "required": [ "amount", "basis" ], "properties": { "amount": { "type": [ "number", "null" ] }, "basis": { "type": "string", "enum": [ "measured", "estimated" ] } } }, "evidence": { "type": "array", "minItems": 1, "maxItems": 8, "items": { "type": "string", "minLength": 1, "maxLength": 300 } }, "trade_offs": { "type": "string", "minLength": 1, "maxLength": 400 } } } }, "adoption_authorized": { "type": "boolean", "enum": [ false ] } } }, "rules": [ "adoption_authorized is always false.", "do needs a measured saving or a trivially safe change." ] }, "category_reason": "A recommendation is a falsifiable claim about what will save money." }, { "slug": "template.review", "category": "noun.eval_run", "role": "template", "title": "Template: an independent review of a recommendation", "value": { "describes": "an independent review of a recommendation", "schema": { "type": "object", "additionalProperties": false, "required": [ "checked", "verdict", "reasons" ], "properties": { "checked": { "type": "array", "minItems": 1, "maxItems": 20, "items": { "type": "object", "additionalProperties": false, "required": [ "item", "result" ], "properties": { "item": { "type": "string", "minLength": 1, "maxLength": 300 }, "result": { "type": "string", "enum": [ "upheld", "disputed" ] }, "note": { "type": "string", "minLength": 0, "maxLength": 300 } } } }, "verdict": { "type": "string", "enum": [ "accept", "revise", "reject" ] }, "reasons": { "type": "array", "minItems": 1, "maxItems": 8, "items": { "type": "string", "minLength": 1, "maxLength": 300 } } } }, "rules": [ "The reviewer did not write the recommendation." ] }, "category_reason": "A review is a verification run." } ], "verbs": [ { "slug": "inventory-costs", "kind": "verb.situate", "title": "Build the cost ledger", "claimant": "agent", "summary": "Turn supplied usage exports and invoices into a ledger with one line per service and unit, keeping billed, measured, estimated and credit apart.", "outcome": "A cost ledger with unknown amounts left null.", "ready_outcome": "ledger_ready", "pinned": [ "method" ], "slots": [ { "name": "usage_exports", "category": "noun.eval_run", "description": "Pins of usage exports or invoices the requester supplied.", "many": true, "max": 20 }, { "name": "repo_profile", "category": "noun.public_source", "description": "Optional pin of a repository profile, to map costs to components.", "required": false } ], "produces": [ { "name": "ledger", "template": "template.cost-ledger" } ], "steps": [ "Verify the pins. Use only the supplied exports and invoices.", "One line per service and unit; cite the source of each line.", "Leave amounts null where no price or quantity is known.", "Read only usage and invoices the requester supplied or exported. Do not open billing dashboards or credential files." ], "acceptance": [ { "id": "ledger-matches-template", "check": "The ledger validates against template.cost-ledger's schema.", "method": "deterministic" }, { "id": "totals-by-basis", "check": "Each total equals the sum of its basis's known line amounts.", "method": "deterministic" }, { "id": "sources-cited", "check": "Every line has a source.", "method": "deterministic" } ], "bounds": { "max_elapsed_seconds": 1200 } }, { "slug": "price-check", "kind": "verb.probe_source", "title": "Read current prices", "claimant": "agent", "summary": "Read the public pricing pages for ledger lines that lack a dated price and store each price as a dated card.", "outcome": "Price cards, or unknown for prices that are not public.", "ready_outcome": "prices_ready", "pinned": [ "method", "template.price-card" ], "slots": [ { "name": "ledger", "category": "noun.eval_run", "description": "Pin of the ledger." } ], "params": { "max_fetches": { "schema": { "type": "integer", "minimum": 1, "maximum": 20 }, "default": 10, "description": "Most pricing pages to read." } }, "produces": [ { "name": "price_cards", "template": "template.price-card", "max": 20 } ], "steps": [ "Verify the pin. Read only public pricing pages; never log in.", "Record the plan, unit, price, currency, URL and read date.", "Mark a price unknown when it is not public." ], "acceptance": [ { "id": "cards-match-template", "check": "Every card validates against template.price-card's schema.", "method": "deterministic" }, { "id": "within-allowance", "check": "Pages read are at most max_fetches.", "method": "deterministic" } ], "bounds": { "max_elapsed_seconds": 900 }, "network": [ "read_only", "Read-only requests to public pricing pages, at most max_fetches. No logins." ], "follows": [ "cost-optimization.inventory-costs" ] }, { "slug": "propose-savings", "kind": "verb.generate_seed", "title": "Propose savings", "claimant": "agent", "summary": "From the ledger, propose a few concrete savings with their arithmetic, risks and how each would be measured.", "outcome": "Saving hypotheses, or no_change when nothing is worth changing.", "ready_outcome": "hypotheses_ready", "pinned": [ "method" ], "slots": [ { "name": "ledger", "category": "noun.eval_run", "description": "Pin of the ledger." }, { "name": "price_cards", "category": "noun.public_source", "description": "Pins of price cards.", "many": true, "max": 20, "required": false } ], "params": { "max_hypotheses": { "schema": { "type": "integer", "minimum": 1, "maximum": 8 }, "default": 5, "description": "Most savings to propose." } }, "produces": [ { "name": "hypotheses", "template": "template.saving-hypothesis", "max": 8 } ], "steps": [ "Start with the largest lines.", "Show the arithmetic for each expected saving and label it an estimate.", "Name every risk to quality, reliability or security.", "Keep the caller's chosen model and output settings. A cheaper setting is a trade-off to measure, not a default." ], "acceptance": [ { "id": "hypotheses-match-template", "check": "Every hypothesis validates against template.saving-hypothesis's schema.", "method": "deterministic" }, { "id": "within-allowance", "check": "At most max_hypotheses hypotheses.", "method": "deterministic" }, { "id": "arithmetic-checks", "check": "The expected saving follows from the stated arithmetic.", "method": "judgment" } ], "bounds": { "max_elapsed_seconds": 900 }, "follows": [ "cost-optimization.inventory-costs" ] }, { "slug": "measure-saving", "kind": "verb.benchmark_harness", "title": "Measure one saving", "claimant": "agent", "summary": "Measure cost and quality before and after one change in a sandbox or a local copy, two runs each, without touching production.", "outcome": "A saving result with the measured saving and whether quality held.", "ready_outcome": "result_ready", "pinned": [ "method", "evaluation-design:method" ], "slots": [ { "name": "hypothesis", "category": "noun.seed_hypothesis", "description": "Pin of one saving hypothesis." }, { "name": "pass_marks", "category": "noun.seed_hypothesis", "description": "Pin of pass marks committed before the runs." } ], "produces": [ { "name": "result", "template": "template.saving-result" } ], "steps": [ "Verify the pins and that the pass marks predate this claim.", "Run before and after twice each under the same conditions, locally.", "Measure quality with the same runs; null when it could not be measured.", "Never change plans, settings, resources or model choices. Recommendations are for the owner to act on." ], "acceptance": [ { "id": "result-matches-template", "check": "The result validates against template.saving-result's schema.", "method": "deterministic" }, { "id": "two-runs", "check": "runs is at least 2 for before and after.", "method": "deterministic" }, { "id": "marks-predate", "check": "The pass marks existed before this task was claimed.", "method": "deterministic" } ], "bounds": { "max_elapsed_seconds": 3600 }, "capabilities": [ "read permitted noun versions", "an isolated sandbox or local copy", "write candidate nouns in the requester's scope" ], "follows": [ "cost-optimization.propose-savings", "evaluation-design.commit-pass-marks" ] }, { "slug": "recommend", "kind": "verb.solve_draft", "title": "Recommend changes", "claimant": "agent", "summary": "Recommend do, measure first or no change for each proposed saving, with evidence and trade-offs, for the owner to act on.", "outcome": "A recommendation; adoption_authorized is always false.", "ready_outcome": "recommendation_ready", "pinned": [ "method" ], "slots": [ { "name": "hypotheses", "category": "noun.seed_hypothesis", "description": "Pins of the saving hypotheses.", "many": true, "max": 8 }, { "name": "results", "category": "noun.eval_run", "description": "Pins of saving results.", "many": true, "max": 8, "required": false } ], "produces": [ { "name": "recommendation", "template": "template.recommendation" } ], "steps": [ "Recommend do only with a measured saving where quality held, or for a trivially safe change.", "Keep estimates labeled. State every trade-off.", "Never change plans, settings, resources or model choices. Recommendations are for the owner to act on." ], "acceptance": [ { "id": "recommendation-matches-template", "check": "The recommendation validates against template.recommendation's schema.", "method": "deterministic" }, { "id": "do-needs-evidence", "check": "Every do item has measured basis or cites why it is trivially safe.", "method": "deterministic" }, { "id": "not-authorized", "check": "adoption_authorized is false.", "method": "deterministic" } ], "bounds": { "max_elapsed_seconds": 900 }, "follows": [ "cost-optimization.measure-saving" ] }, { "slug": "review-recommendation", "kind": "verb.verify_gate", "title": "Review the recommendation", "claimant": "agent", "summary": "A different worker rechecks the arithmetic, the bases of the numbers and the trade-offs.", "outcome": "A review with a verdict.", "ready_outcome": "review_ready", "pinned": [ "method" ], "slots": [ { "name": "recommendation", "category": "noun.seed_hypothesis", "description": "Pin of the recommendation." }, { "name": "ledger", "category": "noun.eval_run", "description": "Pin of the ledger." } ], "produces": [ { "name": "review", "template": "template.review" } ], "steps": [ "Confirm you did not write the recommendation; otherwise return blocked.", "Recompute every saving from its evidence.", "Dispute any item that mixes bases or hides a trade-off." ], "acceptance": [ { "id": "review-matches-template", "check": "The review validates against template.review's schema.", "method": "deterministic" }, { "id": "distinct-reviewer", "check": "The reviewing key differs from the recommendation's author.", "method": "deterministic" }, { "id": "recomputed", "check": "Every saving was recomputed from its cited evidence.", "method": "deterministic" } ], "bounds": { "max_elapsed_seconds": 900 }, "review": "distinct_reviewer", "follows": [ "cost-optimization.recommend" ] } ] }