Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tag in lockstep. Tag releases as `vMAJOR.MINOR.PATCH`.
## [Unreleased]

### Added
- Mission goals and the Aladdin handoff (ROADMAP §4.12, M9.11): `aloop mission goal derive` turns the Evaluator's gaps (in its own priority order) into a goal (autonomous: the top N; spoon-fed: the gaps the human picks with `--pick … --by`, which is the goal's approval) that names its targets and is bound to the mission's content, the eval, the principles block for the mission's mode and the Aladdin autonomy it maps to; `goal check` holds every intent until the goal is the content `derive` recorded, the mission is unchanged and approved and the mission's and the goal's ethics pass; `goal intents` writes one Intent Contract per gap (`intent new --source mission --goal --gap`, filled without a model, and refused for a goal that fails its check); `goal next` normalizes them one sprint at a time; `goal close` marks an active goal met once an evaluation of it says so; goals come only from the latest recorded evaluation, whose state `mission assess` measured, and `events emit` can no longer forge the state, eval or intent records; a gap a hard line fixed is held out of every later goal; `events trace` walks a commit back through intent → goal → eval → ethics → mission → its approver. Test: `mission-goal.test.py`.
- Mission layer hardening (ROADMAP §4.12, a second adversarial review of M9.0/M9.2/M9.3/M9.10, 31 unique findings, each now a test): gates decide from ledger records, not files. Frozen journeys, replacements and retirements, states (`state.assessed`) and the active goal (`goal.derived`) are read from the ledger, so a hidden or edited file changes nothing. Nothing decides from a broken ledger or an edited current baseline, and a restore cannot be undone by a re-apply. The runner pins every project file it runs and refuses links, inline code and scripts outside the project. A judged metric pins its rubric by sha256. A veto binds the content in any order. An unknown flag exits 64. Text is UTF-8 in any locale. GA4's reserved names are one list, and `ethics.*` and `goal.*` decisions are ledger rows. Tests: `mission-{core,journeys,baseline,evaluate}.test.py`.
- Mission ethics (ROADMAP §4.12, M9.4): `aloop mission ethics new --subject mission|<goal_id>` writes a review bound to the subject's sha256 with the topics a fixed screen matched; `record` checks and seals it; `check` passes a clear review, asks (exit 3) on a gray one until `mission ethics consent --by NAME --reason TEXT` is recorded for exactly that content and review (stored inside the goal, never carried over), and blocks a hard line (illegal, deceptive, harmful) for good: no consent, later or edited review, deleted file, edited goal, the same words under a new goal id or a goal derived again from the same gap unlocks it, and the goal is retired (`blocked`). The screen reads normalized text and the mechanics a planner would write ("hide the unsubscribe link", "hack into"), and `check --json` names the state the loop acts on. `events emit` refuses human approvals and ethics verdicts, so only their own commands write them. Reason: the spec's three ethics tiers. Test: `mission-ethics.test.py`.
- Mission principles (ROADMAP §4.12, M9.7): `plugin/mission/principles.md` holds the standing principles in two variants, autonomous and spoon-fed, with the IBM autonomic loop as the engine and four Amazon-style tension pairs; `aloop mission principles show --mode M` renders the block a goal carries, `hash` its sha256, and `check` refuses an edit that drops a principle, a variant or a pair. Reason: the spec's principles in both modes. Test: `mission-principles.test.py`.
Expand Down
2 changes: 1 addition & 1 deletion docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Each task flips only its own row here and in TRACKING.md.
| M9.8 | Loop: `tick` (the state machine above), `due` (zero-token cadence check), `cron` (host routine or crontab line), budget caps from the token ledger | M9.0 | `plugin/mission/{tick,due,cron}.py`, `scripts/test/mission-tick.test.py` | yes | done: `mission-tick.test.py` (20 checks, on baselines proposed, measured and confirmed through `aloop mission`; a fresh checkout decides the same) |
| M9.9 | Roles and wiring: the six personas, hook matchers, model routes, host install, eval suites, role counts in docs; `gate-mission-scope` (role path guards) and `gate-mission-artifact` (a role's artifact passes its check at stop) | M9.0 | `plugin/agents/` (6 new files), `plugin/hooks/hooks.json`, `plugin/hosts/`, `plugin/evals/`, `plugin/bin/gate-mission-*`, role counts in README / OVERVIEW / plugin docs | yes (the only track touching shared lists) | open |
| M9.10 | Assess and evaluate: the State Assessor's report (numbers only, from pinned scripts) and the Evaluator's gap list against the baseline and rivals, with `goal_met` | M9.2, M9.3, M9.5 | `plugin/mission/{assess,evaluate}.py`, `schemas/{state,eval}.json`, `scripts/test/mission-evaluate.test.py` | after its needs | done: `mission-evaluate.test.py` (8 checks); judged metrics come from `judge.verdict(cwd, rubric, journey_id, rubric_sha256=…)` (M9.5) for the rubric content the journey pinned and stay pending until a pass or fail verdict; every input is the content its record covers (state `state.assessed`, baseline confirmation, frozen journeys, goal `goal.derived`/`goal.approved`). Open: rival values keyed per benchmark in the baseline, so the gap list compares against rivals (review finding) |
| M9.11 | Goals and the Aladdin handoff: top gaps → a goal → intents (`intent` source `mission`), ethics and principles applied, mode → autonomy; `events trace` reaches goal → mission | M9.4, M9.7, M9.10 | `plugin/mission/goal.py`, `schemas/goal.json`, `plugin/bin/intent` (source list), `plugin/bin/events` (trace) | after its needs | blocked |
| M9.11 | Goals and the Aladdin handoff: top gaps → a goal → intents (`intent` source `mission`), ethics and principles applied, mode → autonomy; `events trace` reaches goal → mission | M9.4, M9.7, M9.10 | `plugin/mission/goal.py`, `schemas/goal.json`, `plugin/bin/intent` (source list), `plugin/bin/events` (trace) | after its needs | done: `mission goal options / derive / check / approve / intents / next / close / show`, `intent new --source mission --goal --gap`, `events trace` adds goal → eval → ethics → mission; `mission-goal.test.py` (13 checks, on the real journeys → baseline → assess → evaluate pipeline; every new gate mutation-tested: deleting it fails a check). Calls: a goal takes M9.10's gaps in its own order (regressions, then closest to target) and names them as `targets` [{journey_id, criterion_id}], which `mission evaluate` narrows to while the goal is active; autonomous takes the top 3 by default, spoon-fed the human's `--pick` (the pick is `goal.approved`); a goal comes only from the latest eval of the whole mission (not an older one, whose gaps may be closed, nor one narrowed to an active goal) whose gap list `evaluate check` confirms, whose content its `eval.completed` recorded, and whose state a `state.assessed` recorded (a hand-written state that `mission evaluate` accepted is still refused); `goal check`, `intents`, `next` and `close` hold a goal to the content its `goal.derived` recorded, so a crafted or edited-and-resealed goal file is never handed off or closed; a goal is stale once the mission's content changes; intents are filled from the gap and the journey without a model (zero tokens), one per gap, normalized one at a time by `next`, which first makes that intent the newest file (gate-intake re-checks the newest, so the sprint's plan links the right gap); `intent new --source mission` needs `--gap` and a goal that passes `goal check` and lists that gap, and `intent check` holds a mission intent to its own `intent.received` record (goal and gap) and to the goal's autonomy (a reviewed goal's intent is not checked as autonomous); the handoff counts only intents whose first `intent.received` names the goal; `intents` and `close` change only the status, never the goal's hashed content (its ethics review, consent and approval stay valid); a goal is met by a newer evaluation of that goal that says `goal_met`, only while it is active (a derived, blocked or retired goal never closes; closing a met goal again is a no-op); `events emit` refuses `goal.derived`, `goal.met`, `state.assessed`, `eval.completed` and `intent.received`, so the lineage `trace` reads and the records a goal is derived and closed from are written only by their commands (edits outside its files: `assess` and `evaluate` add the content's `sha256` to their events, one field each). A gap a hard line fixed is held, by its id and by its summary: listed apart by `options`, never taken by `derive`, so the autonomous loop moves on instead of re-deriving it (`ethics.blocked` names the gaps); a gap's summary is the journey's title, criterion and target (stable across evals); a goal keeps the principles stamp it was derived under (stale after an upgrade, not invalid, since re-stamping would void its ethics review and approval) |
| M9.12 | The `/aloop:mission` skill: the supervisor's playbook for the tick loop | M9.8, M9.9 | `plugin/skills/mission/` | after its needs | done: `mission-skill.test.py` (8 checks); a live run needs M9.9's roles |
| M9.13 | End to end: an offline scripted to-do-app mission (mission → baseline → eval → goal → intent, zero tokens), then a live `make e2e-mission YES=1` | M9.10–M9.12 | `scripts/test/mission-e2e.test.py`, `scripts/smoke/e2e-mission.sh` | after its needs | blocked |
| M9.14 | GA4 live on the owner's account (one Google sign-in) | M9.6 | — | — | needs the owner: `aloop mission telemetry auth` prints the steps, then `init`, `consent`, `setup`, `debug-hit` |
Expand Down
2 changes: 1 addition & 1 deletion docs/TRACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Status of every requirement in [ROADMAP.md](ROADMAP.md), in the four states §8
| M9.8 | Mission loop: `tick` from facts, zero-token `due`, cron, budget caps | IMPLEMENTED_TESTED | `scripts/test/mission-tick.test.py` |
| M9.9 | Six fixed mission roles, wired; role path guards; artifact check at stop | NOT_IMPLEMENTED | §4.12 |
| M9.10 | State Assessor report and Evaluator gap list | IMPLEMENTED_TESTED | `scripts/test/mission-evaluate.test.py` |
| M9.11 | Goals become Aladdin intents; lineage reaches the mission | NOT_IMPLEMENTED | §4.12 |
| M9.11 | Goals become Aladdin intents; lineage reaches the mission | IMPLEMENTED_TESTED | `scripts/test/mission-goal.test.py` |
| M9.12 | `/aloop:mission` skill | IMPLEMENTED_TESTED | `scripts/test/mission-skill.test.py` |
| M9.13 | Mission end to end (offline in CI, one live cycle measured) | NOT_IMPLEMENTED | §4.12 |
| M9.17 | Approvals name the captured human prompt | NOT_IMPLEMENTED | §4.12 |
Expand Down
48 changes: 42 additions & 6 deletions plugin/bin/events
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Usage:
events lineage TASK_ID the task's chain: dispatch → attempts → gates →
limits/decisions → worktree outcome (no transcripts)
events trace SHA commit → task → gates/decisions → plan → intent →
approver, from the stream alone (exit 1: unknown commit)
approver, from the stream alone (exit 1: unknown commit);
a mission intent adds goal → eval → ethics → mission
events commit-msg TASK_ID a commit message built from the task's title (tasks.md),
its recorded decisions and the intent, never model prose
events graph [--format json|dot] the stream as a graph (events, tasks, commits, intents;
Expand All @@ -23,7 +24,7 @@ Usage:
structured rationale (plan|split|target|
implementation|replan|acceptance)
Emitting never fails a hook: an unknown event type is the only error (exit 64), besides the
human approvals and ethics verdicts of the mission layer, which only their own commands write.
human approvals, ethics verdicts and goal lineage of the mission layer, which only their own commands write.
"""
import glob
import json
Expand All @@ -36,8 +37,11 @@ import _events # noqa: E402
import _mission # noqa: E402
import _paths # noqa: E402

# events only their own command may write (ROADMAP §4.12): human approvals and the ethics gate's verdicts
GATE_OWNED = set(_mission.APPROVAL_EVENTS) | {"ethics.reviewed", "ethics.blocked"}
# events only their own command may write (ROADMAP §4.12): human approvals, the ethics gate's verdicts
# and the goal lineage (`events trace` and `mission goal close` read them)
GATE_OWNED = set(_mission.APPROVAL_EVENTS) | {"ethics.reviewed", "ethics.blocked", "goal.derived", "goal.met",
"state.assessed", "eval.completed", # what goals are derived and closed from
"intent.received"} # an intent's lineage (`intent new`)


def parse(argv):
Expand Down Expand Up @@ -97,6 +101,7 @@ def trace(cwd, sha):
iid = (intent.get("data") or {}).get("intent_id", "")
recv = next((e for e in evs if e.get("event") == "intent.received" and (e.get("data") or {}).get("intent_id") == iid), {})
print("intent %s %s raw=%s" % (iid, (intent.get("refs") or {}).get("intent", ""), (recv.get("refs") or {}).get("raw", "-")))
mission_trace(evs, recv)
else:
print("intent (missing: the plan names no intent.normalized)")
appr = [e for e in evs if e.get("event") == "plan.approved" and e.get("caused_by") == plan.get("event_id")]
Expand All @@ -108,6 +113,37 @@ def trace(cwd, sha):
return 0


def mission_trace(evs, recv):
"""intent → goal → eval → ethics → mission → its approver (ROADMAP §4.12), for an intent a
mission goal handed off (`intent new --source mission --goal`)."""
gid = (recv.get("data") or {}).get("goal_id")
if not gid:
return
gd = None
for e in evs:
if e.get("event") == "goal.derived" and (e.get("data") or {}).get("goal_id") == gid:
gd = e
if not gd:
print("goal %s (missing: no goal.derived)" % gid)
return
d = gd.get("data") or {}
ref = d.get("subject") # the goal file the ledger row covers
print("goal %s from eval %s gaps=%s (%s)" % (gid, d.get("eval_id"), ",".join(d.get("gaps") or []), d.get("autonomy")))
about = [e for e in evs if (e.get("data") or {}).get("subject") == ref and (e.get("data") or {}).get("sha256") == d.get("sha256")]
tiers = [e["data"].get("tier") for e in about if e.get("event") == "ethics.reviewed"]
consent = [e for e in about if e.get("event") == "ethics.consent"]
if not tiers:
print("ethics (missing: no review of this goal's content)")
else:
tier = "hard" if "hard" in tiers else "gray" if "gray" in tiers else "clear"
print("ethics %s%s" % (tier, " (consent by %s)" % consent[-1]["data"].get("by") if tier == "gray" and consent else ""))
ok = [e for e in evs if e.get("event") == "mission.approved" and (e.get("data") or {}).get("sha256") == d.get("mission_sha256")]
if ok:
print("mission %s approved by %s" % (d.get("mission_id"), ok[-1]["data"].get("by")))
else:
print("mission %s (missing: no mission.approved for the content the goal served)" % d.get("mission_id"))


def task_title(cwd, task):
m = re.match(r"^S(\d+)-(\d+)-T(\d+)$", task or "")
if not m:
Expand Down Expand Up @@ -187,8 +223,8 @@ def main(argv):
print("events emit: need an EVENT", file=sys.stderr)
return 64
if pos[0] in GATE_OWNED:
print("events emit: %s is a human approval or a gate's verdict; only its own command writes it "
"(aloop mission … approve / consent / record)" % pos[0], file=sys.stderr)
print("events emit: %s is a human approval or a gate's record; only its own command writes it "
"(aloop mission … approve / consent / record / goal / assess / evaluate; intent new)" % pos[0], file=sys.stderr)
return 64
try:
eid = _events.emit(cwd, pos[0], task=opts.get("task", ""), attempt=opts.get("attempt", ""),
Expand Down
Loading
Loading