feat(agent-reflection): durable kernel — reflection.v1 capture + risk-floor + Phase-0 #545
Reference in New Issue
Block a user
Delete Branch "feat/agent-reflection-loop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Bakes in the durable kernel of the agent reflection loop. Passive end-of-run capture of the doer's end-state as structured
reflection.v1data, plus a deterministic diff review risk-floor. The closed calibration / skill-synthesis loop (design §7–§8) stays gated behind Phase-0 experiments P1/P2/P3.Spec:
docs/plans/agent-reflection-loop-PRD.md· Tasks:docs/tasks/544-agent-reflection-loop.mdWhat's included
packages/macp—evaluateRiskFloor(pure, deterministic surface classifier; auth/data/infra → review) +reflection.v1.schema.json. 15 unit tests.packages/types—reflection.v1zod schemas +ReflectionSelfReportDto. 10 unit tests.packages/mosaic/framework— fail-closed Stop hook (reflect-stop-hook.sh) writing the sidecar, registered ashooks.Stopinruntime/claude/settings.json. Strict no-op unlessREFLECTION_MODE=solo|orchestrated; never blocks or fails a session, never emits adecision.scripts/analysis— P1/P2/P3 experiment harnesses with pre-registered kill conditions + structured output.Design notes
$REFLECTION_INPUT, else null +provenance.degraded=true.evaluateRiskFloor; the hook ports the same surface table inline to stay node/build-free, documented as kept in sync.settings.json(thesettings-overlays/dir has no merge mechanism — would be inert).Verification
pnpm typecheck/lint/format:check/build— all green..mosaicdiff no longer aborts the write;session_idsanitized before path use).Activation (post-merge, not a blocker)
Hook activates only when a launcher/profile sets
REFLECTION_MODE; unset/offis a strict no-op, so global registration is safe.framework/install.shrsyncs the hook; themosaiclauncher reflects the updatedsettings.jsoninto~/.claude/settings.json.Closes #544
Fixes #544