Conversation
Rewrites the integration doc to reflect all 18 feature gaps implemented in cycles-openclaw-budget-guard v0.2.0, including: LLM call reservations, chained model fallbacks, cost estimator callbacks, per-user/session scoping, tool allowlist/blocklist, graceful degradation strategies, dry-run mode, budget transition alerts, session analytics, multi-currency support, budget pools, retry on deny, and configurable reservation TTL and overage policies. Removes outdated "phase 1 limitations" section. https://claude.ai/code/session_01B9dEkb617462NNiRpgA96g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR significantly expands the documentation for the
cycles-openclaw-budget-guardplugin with comprehensive coverage of advanced features, configuration options, and operational patterns. The updates reflect the full capabilities of the plugin beyond basic budget enforcement.Key Changes
Enhanced lifecycle hook descriptions: Updated the five OpenClaw lifecycle hooks table to clarify that both model and tool calls follow the reserve → commit → release protocol, with details on immediate model commitment and actual cost tracking via
costEstimatorcallbacks.Chained model fallbacks: Documented support for ordered fallback chains (arrays) in
modelFallbacks, allowing the plugin to select the cheapest affordable model when budget is low. AddedmodelBaseCostsconfiguration example.Tool access control: New section covering
toolAllowlistandtoolBlocklistwith glob-style pattern matching (*wildcards) for fine-grained tool permission management.Graceful degradation strategies: Introduced composable low-budget strategies beyond model downgrading:
downgrade_model— use cheaper fallback modelsreduce_max_tokens— append token limit guidancedisable_expensive_tools— block high-cost toolslimit_remaining_calls— cap remaining callsDynamic cost estimation: Documented
costEstimatorcallback for per-tool actual cost calculation based on execution duration and results, with fallback to estimates.Per-user and per-session scoping: Added section on
userIdandsessionIdconfiguration for budget isolation, with runtime override viactx.metadata.Reservation settings: Documented per-tool TTL and overage policy overrides (
REJECT,ALLOW_IF_AVAILABLE,ALLOW_WITH_OVERDRAFT).Retry on denied reservations: Added configuration for automatic retry of denied tool reservations with configurable delay and max attempts.
Budget transition alerts: Documented webhook and callback support for budget level changes (healthy → low → exhausted).
Session analytics and cost breakdown: New section covering per-tool/model cost tracking, session summaries with timing and forecasts, and export via callback or webhook.
End-user budget visibility: Documented automatic attachment of budget status to
ctx.metadata["cycles-budget-guard-status"]for frontend UI display.Multi-currency support: Added configuration for per-tool and per-model currency overrides.
Budget pools: Documented hierarchical budget scoping via
parentBudgetIdwith pool balance visibility in hints and snapshots.Dry-run mode: New section on testing without a live Cycles server using in-memory simulation.
Error handling: Documented structured error types (
BudgetExhaustedError,ToolBudgetDeniedError) for programmatic error handling.Comprehensive configuration reference: Reorganized and expanded the configuration table into logical sections (core, thresholds, model, tool, prompts, reservations, strategies, retry, dry-run, scoping, transitions, analytics, pools) with 50+ documented fields.
Updated verification section: Improved log output examples to match actual plugin output format.
Removed phase 1 limitations: Removed outdated limitations section as the documentation now covers the full feature set.
Notable Implementation Details
agent_end.https://claude.ai/code/session_01B9dEkb617462NNiRpgA96g