Repository navigation
Remove write-budget gate: apply is offered whenever a finding is apply_capable - #707
Merged
Merged
Conversation
…pply action Deletes core/optimize/write_budget.py and core/optimize/write_allocation.py entirely, along with their suppression-reason strings and constants (MIN_NET_WRITE_USD, MAX_OFFERED_WRITES, AGENT_FILE_STANDING_CEILING_TOKENS, AGENT_FILE_GROWTH_SHARE_PER_WINDOW, WRITE_BUDGET_TOKENS, the placeholder-fix quality floor, and the REASON_* strings). Apply is now offered whenever an analyzer marks a finding apply_capable, with no budget, payback-ratio, or instruction-file-size ceiling gating the offer. The model fields that existed only to carry that gate's verdict are removed from CostProposal and RelearnCluster (write_offered, write_blocked_reason, write_blocked_short, standing_cost_*, payback_ratio, net_negative, gross_recoverable_*, write_exposure_sessions), along with their UI and CLI rendering. The apply_blocked_reason field survives unchanged: it belongs to the unrelated model-swap / MCP-server-removal precheck plumbing, not the write budget. Delivery-mechanism cost pricing (standing_tokens_per_session, used to choose between a project-scoped and a user-global destination) moves from the deleted module into core/rulewrite/delivery.py, since rule placement still needs it to pick the cheaper destination -- it just no longer feeds an offer/suppress decision. Dry-run-by-default plus explicit --go / go:true remains the only guard on an actual write, and the owner/content-hash/symlink protections and relearn's undo/backup machinery are untouched. Accepted trade-off: tokenjam can now offer to write a permanent rule whose standing context cost may exceed its savings, into an already-large instruction file. This is a deliberate operator decision, not an oversight. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_019rAPK7A1ctiVJgxdP4VtXf
Contributor
|
| Filename | Overview |
|---|---|
| tokenjam/core/optimize/analyzers/relearn.py | Removes write-budget accounting and derives offerability directly from persona, workspace, and advisory-family state. |
| tokenjam/core/optimize/cost_proposals.py | Removes budget decisions and netting while retaining informational destination placement for write-bearing proposals. |
| tokenjam/core/rulewrite/delivery.py | Relocates artifact and standing-cost pricing helpers from the deleted budget module without using them to gate offers. |
| tokenjam/core/rulewrite/plan.py | Treats cost proposals with an artifact and delivery as offered and derives relearn offers from target and advisory state. |
| tokenjam/ui/index.html | Removes budget and payback disclosures and gates apply controls directly on apply-capable or non-advisory state. |
| tokenjam/core/optimize/write_budget.py | Deletes the write-budget, quality-floor, netting, family-allocation, and suppression-reason implementation. |
| tokenjam/core/optimize/write_allocation.py | Deletes the shared cross-lane write-allocation pass and its serialized report decisions. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Analyzer finding] --> B{Apply capable?}
B -->|No| C[Advisory-only presentation]
B -->|Yes| D[Resolve placement]
D --> E[Offer apply action]
E --> F{Explicit go?}
F -->|No| G[Dry-run only]
F -->|Yes| H[Safety checks]
H --> I[Write artifact]
Reviews (3): Last reviewed commit: "test: prune the fix-prose ratchet entrie..." | Re-trigger Greptile
# Conflicts: # tokenjam/core/optimize/write_allocation.py
Removing the write-budget netting pass from cost_proposals.py deleted the PAST_OVERSPEND_OBSERVED_NOTE tense-suffix composition and the _apply_write_decisions/_driver_role_proposals evidence assembly that used to concatenate standing-cost disclosure text into the advise/evidence slots. The ratchet's 16 corresponding entries are now stale — the underlying prose is gone, not moved, confirmed by diffing the offender scan against the branch's pre-purge parent commit, where all 16 still matched. Co-Authored-By: Claude <[email protected]>
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.
What changed
Removes the write-budget gate entirely.
core/optimize/write_budget.pyandcore/optimize/write_allocation.pyare deleted, along with:MIN_NET_WRITE_USD(the $5 floor),MAX_OFFERED_WRITES,AGENT_FILE_STANDING_CEILING_TOKENS,AGENT_FILE_GROWTH_SHARE_PER_WINDOW,WRITE_BUDGET_TOKENS,MIN_WRITE_BUDGET_TOKENS, the placeholder-fix quality floor (MIN_FIX_CHARS/_PLACEHOLDER_PATTERNS/is_placeholder_fix), and the sevenREASON_*sentences.write_offered,write_blocked_reason,write_blocked_short,standing_cost_tokens_per_session,standing_cost_tokens,standing_cost_usd,standing_cost_basis,payback_ratio,net_negative,gross_recoverable_usd,gross_recoverable_tokens,write_exposure_sessions— removed fromCostProposalandRelearnCluster, plus their UI and CLI rendering (the payback-arithmetic disclosure, the write-gate line, the short-label stamping).apply_blocked_reasonis untouched: it belongs to a separate, unrelated mechanism (why a model-swap or MCP-server-removal precheck failed — no registered source path, a dirty git tree, an already-removed config entry), not to the write budget.New behavior
Apply is now offered whenever an analyzer marks a finding
apply_capable. There is no budget, payback-ratio, or instruction-file-size ceiling gating that offer any more — the only reasons a rule is not offered are the ones that were always separate from the budget: the user already applied it, it's already present in their own files, they dismissed it, there's no resolved workspace/destination, or the family is advisory-only (the harness already self-corrects, so there's genuinely nothing to write).Delivery-mechanism cost pricing (how many tokens a rule/skill/hook adds to every future session) is not gone — it moved from the deleted module into
core/rulewrite/delivery.py, becauserule_placement.pystill uses it to choose between a project-scoped and a user-global destination (a rule confined to fewer sessions is cheaper to keep). That pricing is purely informational now: it changes which destination a rule lands in, never whether it's offered.Guards that are untouched
Dry-run-by-default plus an explicit
--go(CLI) /go: true(API) remains the only guard on an actual write. Owner checks, content-hash and symlink protections, and relearn's undo/backup machinery are all unchanged — this PR only removes the offer-side economics gate, not the write-safety machinery.Accepted trade-off
tokenjam can now offer to write a permanent rule whose standing context cost may exceed its savings, into an already-large instruction file. This is a deliberate, explicit operator decision, not an oversight — the product no longer second-guesses whether a permanent rule is "worth" its own keep before offering it.
Test changes
tests/unit/test_write_budget.py(tested the deleted module directly) is deleted, along with itstests/write_allocation_helpers.pysupport module. Across the other touched test files: assertions that pinned the old suppression/gating behavior were removed or inverted to assert the new always-offered behavior; assertions about other features that merely happened to size their fixtures past the old $5 floor or token ceiling were kept, with only the stale scaling comment cleaned up. New tests pin the contract directly: anapply_capablecost proposal and an apply-capable relearn cluster are both offered regardless of how large the recoverable figure or the implied rule size is, and a dry-run apply call still writes nothing withoutgo=True.