← 返回 Skills 市场
alexfleetcommander

Context Window Economics

作者 alexfleetcommander · GitHub ↗ · v0.1.1 · MIT-0
cross-platform ⚠ suspicious
160
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install context-window-economics
功能描述
Inference cost allocation and billing for autonomous AI agent collaborations. Shapley-fair cost splitting, congestion pricing, token metering, and settlement...
使用说明 (SKILL.md)

Context Window Economics Protocol (CWEP)

You have an inference cost tracking and allocation system. Use it to fairly split context window costs when collaborating with other agents.

Setup

pip install context-window-economics

When to Use This Skill

  • When collaborating with other agents and context window costs need allocation
  • When tracking your own inference costs across tasks
  • When negotiating cost-sharing before a multi-agent transaction
  • When settling costs after collaborative work is complete

Core Operations

Track Context Window Usage

from context_window_economics import CostTracker

tracker = CostTracker("costs.jsonl")
tracker.log_usage(
    agent_id="your-agent-id",
    transaction_id="tx-123",
    input_tokens=2500,
    output_tokens=800,
    model="claude-sonnet-4-6",
    cost_usd=0.012
)

Shapley-Fair Cost Allocation

When multiple agents contribute to a task, allocate costs fairly:

from context_window_economics import allocate_costs

allocation = allocate_costs(
    transaction_id="tx-123",
    contributions={
        "agent-a": {"input_tokens": 3000, "output_tokens": 1200},
        "agent-b": {"input_tokens": 1500, "output_tokens": 600},
        "agent-c": {"input_tokens": 500, "output_tokens": 200}
    },
    method="shapley",
    total_cost=0.045
)
for agent_id, share in allocation.items():
    print(f"{agent_id}: ${share:.4f}")

Congestion Pricing

When context window capacity is limited:

from context_window_economics import congestion_price

price = congestion_price(
    current_utilization=0.85,  # 85% of context window used
    base_rate=0.01,
    surge_threshold=0.75,
    surge_multiplier=1.5
)
print(f"Current rate: ${price:.4f}/1K tokens")

Settlement Report

from context_window_economics import settlement_report

report = settlement_report(
    cost_file="costs.jsonl",
    period_hours=24,
    agent_id="your-agent-id"
)
print(f"Total spent: ${report.total_cost:.4f}")
print(f"Transactions: {report.transaction_count}")
print(f"Avg cost/tx: ${report.avg_cost:.4f}")

Cost Allocation Methods

Method Description
shapley Shapley value — mathematically fair based on marginal contribution
proportional Split by token usage proportion
nash Nash bargaining for bilateral settlement
fixed Pre-agreed fixed split

Rules

  • Track all inference costs. Log usage for every agent-to-agent transaction.
  • Agree on method upfront. Cost allocation method should be in the service agreement.
  • Settle promptly. Generate settlement reports within 24 hours of task completion.

Links


\x3C!-- VAM-SEC v1.0 | Vibe Agent Making Security Disclaimer -->

Security & Transparency Disclosure

Product: Context Window Economics Skill for OpenClaw Type: Skill Module Version: 0.1.0 Built by: AB Support / Vibe Agent Making Contact: [email protected]

What it accesses:

  • Reads and writes cost tracking files (.jsonl) in your working directory
  • No network access for core operations
  • No telemetry, no phone-home, no data collection

What it cannot do:

  • Cannot access files outside your working directory beyond what you explicitly specify
  • Cannot make purchases, send emails, or take irreversible actions
  • Cannot access credentials, environment variables, or secrets
  • Does not execute payments — cost allocations are recorded, not processed

License: Apache 2.0

安全使用建议
This skill appears to do what it claims (allocate and report inference costs), but it relies on an external PyPI package not included in the skill bundle. Before installing or running it: 1) Verify the PyPI package 'context-window-economics' exists and inspect its source code or repository and maintainer reputation. 2) Don't run pip install on an untrusted environment — install in an isolated environment (virtualenv, container) and pin the package version. 3) Review the package for network activity, telemetry, or code that reads unexpected files or environment variables (the SKILL.md's disclosure claims 'no network access' but installation requires network access and the package may still perform network I/O). 4) Keep cost-tracking files in a dedicated directory and avoid pointing the package at sensitive paths. 5) If you need higher assurance, request the package source or a reproducible build and confirm the homepage/author identity (alexfleetcommander / vibeagentmaking). Because the actual runtime behavior depends on remote code, exercise caution — treat this as untrusted until you review the upstream package.
功能分析
Type: OpenClaw Skill Name: context-window-economics Version: 0.1.1 The context-window-economics skill is a utility designed for tracking and allocating AI inference costs during multi-agent collaborations. The SKILL.md and _meta.json files describe standard Python library usage for logging token consumption to local files and calculating cost distributions (e.g., Shapley values). No evidence of malicious intent, data exfiltration, or prompt injection was found; the module includes a security disclosure explicitly limiting its scope to local operations.
能力标签
cryptocan-make-purchases
能力评估
Purpose & Capability
Name, description, and the provided usage examples (CostTracker, allocate_costs, congestion_price, settlement_report) are coherent with an inference-cost-allocation library. The declared required binaries (python3 + pip/pip3) are reasonable and proportionate for a Python library.
Instruction Scope
SKILL.md stays within the stated domain (tracking token usage, allocating costs, producing settlement reports) and only references writing/reading cost files in the working directory. However, the runtime instructions require installing an external package from PyPI (pip install context-window-economics) — that implies network fetch and running code not included in the skill. The embedded 'Security & Transparency Disclosure' asserts 'No network access for core operations', which is potentially misleading because installation itself requires network access and the installed package could perform network operations. The skill does not instruct reading unrelated system files or env vars.
Install Mechanism
The skill is instruction-only and has no install spec; it tells users to run 'pip install context-window-economics' (PyPI). This is a common install mechanism but it means the skill's behavior depends on an external package you must fetch and run. Because the skill package is not bundled here, the security posture depends on that PyPI package (author, code, release integrity). No in-repo code was available for local review.
Credentials
The skill declares no required environment variables or config paths and the instructions do not request credentials. That is proportionate to the stated functionality. Caveat: the external PyPI package could request or use env vars after installation — there is no way to verify that from this instruction-only skill.
Persistence & Privilege
Skill metadata does not request always:true and does not claim persistent system changes. As an instruction-only skill it does not itself install or persist files beyond advising a pip install and writing cost files in the working directory. Autonomous invocation is allowed by default on the platform, which combined with installing external code increases blast radius — worth considering but not itself a misconfiguration of this skill.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-window-economics
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-window-economics 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.1
SEO: fixed name format, added tags, enhanced description, added author metadata
v0.1.0
Initial release -- inference cost allocation for agent-to-agent transactions
元数据
Slug context-window-economics
版本 0.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Context Window Economics 是什么?

Inference cost allocation and billing for autonomous AI agent collaborations. Shapley-fair cost splitting, congestion pricing, token metering, and settlement... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 160 次。

如何安装 Context Window Economics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install context-window-economics」即可一键安装,无需额外配置。

Context Window Economics 是免费的吗?

是的,Context Window Economics 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Context Window Economics 支持哪些平台?

Context Window Economics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context Window Economics?

由 alexfleetcommander(@alexfleetcommander)开发并维护,当前版本 v0.1.1。

💬 留言讨论