8000 A mission's stop at a spend cap is a ledger row, so a clone stays stopped (M9.24) by adeelahmad · Pull Request #98 · adeelahmad/aloop · GitHub
[go: up one dir, main page]

Skip to content

A mission's stop at a spend cap is a ledger row, so a clone stays stopped (M9.24) - #98

Merged
adeelahmad merged 1 commit into
masterfrom
claude/m9-loop-skill-zkmelo
Oct 20, 2026
Merged

adeelahmad merged 1 commit into
masterfrom
claude/m9-loop-skill-zkmelo

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Before: when a mission hit its token or USD cap, aloop mission tick returned STOP_BUDGET, but that stop lived only in the checkout's token ledger and run log. On a fresh clone (or after .aladdin was deleted), the spend read 0, and the loop started handing out work again under the same approved mission.

After: the first STOP_BUDGET tick writes a mission.budget_exhausted row to the hash-chained mission ledger, once per mission content (keyed by the mission doc's sha256). Tick stops on that row whatever the local spend says. The stop is lifted only when the human approves a changed mission, such as a raised cap, because that changes the content hash.

How: mission.budget_exhausted joins LEDGER_EVENTS in plugin/bin/_mission.py. tick.facts() collects the rows into f["stops"] by sha. rules() stops when either the live budget is exhausted or a stop row exists for the current mission sha. record() writes the row only when there is none yet for that sha. ROADMAP marks M9.24 done, TRACKING shows it as IMPLEMENTED_TESTED, and CHANGELOG and the mission README are updated.

Evidence

  • New scripts/test/mission-tick.test.py section 30 (check 31):
    • A token cap of 1000 with 1100 spent gives STOP_BUDGET and exactly one ledger row (role mission-loop, sha = the mission digest, tokens 1100).
    • After rm -rf .aladdin the tick is still STOP_BUDGET with 0 local tokens.
    • Raising the cap to 5000 and approving it with a human-typed line lifts the stop.
  • I ran the new section against the prior code: it failed (RED), because no ledger row was written and the clone resumed handing out work.
  • Locally, all 15 mission suites pass (tick 31, core 13, e2e 8, skill 9, ethics 13, …), and so do make pycheck and scripts/check-tracking.py (84 requirements).

Generated by Claude Code

…pped (M9.24)

The first STOP_BUDGET tick now records mission.budget_exhausted in the
ledger (once per mission content) instead of the run log, and tick stops
on that row whatever the checkout's token ledger says, until a raised
cap changes the content. This closes M9.24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
@adeelahmad
adeelahmad marked this pull request as ready for review October 20, 2026 09:39
@adeelahmad
adeelahmad merged commit c796b75 into master Oct 20, 2026
5 checks passed
adeelahmad pushed a commit that referenced this pull request Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012rsDo9GYzNx8tXucywZHnA

# Conflicts:
#	CHANGELOG.md
#	docs/ROADMAP.md
#	plugin/bin/_mission.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0