8000 M9.8 mission loop (tick, due, cron, budget caps) and M9.12 /aloop:mission skill by adeelahmad · Pull Request #75 · adeelahmad/aloop · GitHub
[go: up one dir, main page]

Skip to content

M9.8 mission loop (tick, due, cron, budget caps) and M9.12 /aloop:mission skill - #75

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

adeelahmad merged 9 commits into
masterfrom
claude/m9-loop-skill-zkmelo

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 20, 2026 •
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Before: a mission could be set and approved (M9.0). Its baseline, journeys, assessments, evals and ethics reviews could be recorded (M9.2–M9.4, M9.10). But nothing decided what to do next, nothing stopped spending at the budget, and nothing woke the loop up on a schedule.

After: aloop mission tick names the one next action and records it as a mission.tick event. It reads the committed ledger, the artifacts and Aladdin's sprint files, so a fresh checkout decides the same. It stops at the mission's token, USD or deadline cap. aloop mission cron --install puts in a crontab line that spends no tokens until a tick is due, then starts a Claude Code, Codex or OpenCode session under a loop lock. /aloop:mission is the supervisor's playbook: run the tick, do the one action it names (dispatching the role), and tick again.

How.

  • plugin/mission/tick.py is a first-match-wins decider. The order is SET_MISSION → CONFIRM_MISSION → STOP_BUDGET → mission ethics → RESEARCH → DEFINE_JOURNEYS → baseline → the open goal (its ethics, then OFFER_OPTIONS or PLAN_INTENTS, then SPRINT, APPROVE_PLAN or WAIT) → ASSESS → EVALUATE → goal met? RESEARCH to raise the bar : DERIVE_GOAL.
  • Human decisions come from docs/agents/mission/ledger.jsonl. The newest approval per subject counts, recorded with role human and --by. An approval only the run log has is not one.
  • The baseline follows baseline.py:
    • The current version is the newest confirmation record.
    • A version needs a baseline.measured record for its content.
    • A veto binds the content.
    • An autonomous replacement applies after the mission's veto_window_h.
    • A flaky measurement is measured again.
    • A baseline with nothing to earn sends the researchers to raise the bar.
    • A broken ledger or confirmed baseline is BLOCKED.
  • Sprints. An active goal's intents are sprinted one by one (intent.received goal_id → plan.created intent_id). A sprint silent for 12h is BLOCKED.
  • Repeat guard. The same action on the same c 8000 ontent is handed out at most 3 times. Then it is BLOCKED until the human runs mission tick --force --by NAME, which is recorded.
  • Spend comes from the token ledger since the mission was set. Tokens are uncached input plus cache writes plus output. USD is priced per model; an unknown model is charged the top rate.
  • due.py spends zero tokens. It exits 0 when due, 1 when not, and 2 when it cannot read the facts. A human action exits 3 once (it records the tick itself, so no session starts just to say it). An interactive handout is leased for 2h. A cron session holding the loop lock makes nothing due.
  • cron.py. The crontab line runs aloop mission cron --fire, which decides like due under a flock and logs to <run data>/logs/mission-cron.log. Codex gets network and web search. % is escaped. --json gives a routine spec on the cadence.

Calls I made (reversible; recorded in ROADMAP).

  • The budget comes before the mission's ethics review, because a review spends tokens.
  • Added BLOCKED, APPROVE_PLAN and the repeat guard.
  • A mid-sprint re-assess runs on the cadence.
  • The bar is raised at most once per cadence.

New gap items (in §4.12, each with a one-line reason):

  • M9.20: spend should count mission sessions only.
  • M9.21: keep the price table current.
  • M9.22: the ledger records neither fast mode nor web search.
  • M9.23: tick should take its ethics facts from mission ethics's verdict, now that Mission layer M9.4 ethics and M9.7 principles #72 is in.
  • M9.24: --force grants and ethics reviews are run data.
  • M9.25: raising a budget cap asks for a new baseline version.

Evidence.

  • mission-tick.test.py: 20 checks, on real baselines proposed, measured twice and confirmed through aloop mission. They cover:
    • the lifecycle through assess and evaluate;
    • a fresh checkout (run data deleted);
    • consent naming each ethics review;
    • spoon-fed picks and plan approval;
    • veto windows, and a mission change that forces a new baseline;
    • flaky and nothing-to-earn measurements;
    • ledger and baseline tampering;
    • caps, cadence, intents one by one, and stall;
    • --force --by;
    • the due lease and lock, and cron --fire with fake hosts;
    • mangled files.
  • mission-skill.test.py: 8 checks; the action table matches tick.ROLES exactly.
  • Every mission-*.test.py passes locally after merging master (ethics, principles, telemetry), as do make test-hosts, pycheck, json, eval-validate, version-check and check-tracking.

A live run needs M9.9's six roles (#74).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM

… from the ledger

`aloop mission tick` names the one next action from the files and events the
harness owns (first match wins, like sweep) and records it as mission.tick; it
stops at the token, USD or deadline cap and blocks an action handed out 3 times
on unchanged facts. `due` reads files only, so the cron line starts a host
session only when a tick is due. Test: scripts/test/mission-tick.test.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
One row per action tick hands out, with the role it dispatches, the exit-code
contract, the hard rules and a trigger/eval suite.
Test: scripts/test/mission-skill.test.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
…8, M9.19

Budget before the mission's review, BLOCKED and the repeat guard, mid-sprint
assess on the cadence, raise the bar once per cadence. New items: spend from
mission sessions only (M9.18) and a current price table (M9.19).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
@adeelahmad adeelahmad self-assigned this Oct 20, 2026
…ount; due never runs past a cap

- due exits 2 with BLOCK[mission-due] when the facts cannot be read, instead
  of 1 ("not due"), and the cron line logs due as well as the host session.
- At STOP_BUDGET due starts no session: it records the stop once itself.
- The token cap counts cache writes (on Claude Code nearly all new input).
- Stray event lines, a null sprints list, string counts in the ledger, a
  mistyped cap or cadence, an unreadable mission.json: SET_MISSION or the
  next step, never a traceback (_events.read skips non-object lines).
- Dotted, routed and Bedrock (global., us-gov.) model ids are priced.
- Second-resolution stamps tie toward "after".
- Gap items renumbered M9.19, M9.20 (#74 takes M9.18); new M9.21 (fast mode
  and web search are not in the ledger).

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 02:49
… evaluate

Areas that run bare use master's NO_ARGS (was BARE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
… does

tick reads human decisions from docs/agents/mission/ledger.jsonl (the
newest approval per subject, role human), so a fresh checkout decides the
same, and an approval only the run log has is none. The baseline follows
baseline.py: the current version is the newest confirmation record; a
version needs a measured record for its content; a veto binds content; an
autonomous replacement applies after the mission's veto_window_h; a flaky
or nothing-to-earn measurement is re-measured or raises the bar, and the
repeat guard binds the version's content. A broken ledger or confirmed
baseline blocks. An active goal's intents are sprinted one by one;
spoon-fed plans wait for APPROVE_PLAN; --force needs --by and is recorded.

due exits 3 once per human action and never starts a session for it;
cron's line runs `cron --fire` under a loop lock with the host session.

The tick test now builds real baselines through `aloop mission` (20
checks). New gaps: M9.22 (ethics verdict), M9.23 (grants and reviews in
the ledger), M9.24 (a budget raise asks for a new baseline).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
The loop's gap items move to M9.20-M9.25: master took M9.18 and M9.19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aw6CiQcdpzdzZZXKf8WbUM
adeelahmad pushed a commit that referenced this pull request Oct 20, 2026
…ates to its areas

- An area's check runs once per artifact with its id or subject (roles.json `area_checks`):
  `mission ethics check` needs `--subject`, so every Ethics Reviewer stop failed with exit 64.
  An ethics hard line (exit 2, state hard) is the reviewer's finding, a note, not a defect.
- A status change an event of the run explains is not another role's write: a human's step, or
  the role's own command (M9.8's tick hands `baseline apply` to the State Assessor, which freezes
  the researcher's journeys; a hard line blocks the planner's goal). Anything else still blocks.
- No dispatched agent hand-emits a mission-layer event (mission.*, artifact.*, the areas').
- ROADMAP: my gap rows move to M9.26 and M9.27 (master took M9.18/M9.19, #75 takes M9.20–25).

Test: mission-roles.test.py (32 checks; the new one runs the real ethics, baseline apply and
journeys retire), mission-scope-bash.test.py (202 rows); make ci and conformance 78/78 pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197nSutKR1QAAqgJhFZ8fPj
@adeelahmad
adeelahmad merged commit 0afacdc 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
adeelahmad pushed a commit that referenced this pull request Oct 20, 2026
…the human's typed line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RxETAY6S1gcmdctBK8a8Z
adeelahmad pushed a commit that referenced this pull request Oct 20, 2026
Docs only: ROADMAP takes master's M9.8 and M9.20–M9.25 rows beside this track's M9.9, M9.26 and
M9.27; TRACKING marks both M9.8 and M9.9 implemented. make ci (conformance 78/78) passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197nSutKR1QAAqgJhFZ8fPj
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