feat(autonomy): approval queue + weekly operator brief (#27)#29
Draft
cgallic wants to merge 1 commit into
Draft
Conversation
Build the next two slices of the Kai autonomy control layer (#27) on top of the ledger/decision/impact layer from #28. - approval_queue.py: the one canonical hold for risky actions (outbound email, client claims, live publish, paid media, account/credential changes, deploys). Append-only event log (queued → validated → resolved) folded to current state, so it doubles as an audit trail. enqueue dedupes pending items by key and raises on persistence failure (dropping a staged action is unsafe); no disable switch by design. stage_findings() bridges route_decision results where action_class == stage_for_approval into the queue. - operator_brief.py: decision-oriented weekly brief generated FROM the ledger + queue + mine_repeated_lessons — biggest risks, approvals needed, failed automations, stale/broken sources, recurring lessons to promote. Restates ledger/queue facts only; invents no numbers. - Wire platform_change_monitor to stage any stage_for_approval findings. - 25 new unittest cases; doctor/golden/self-check stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013c9Qazoy5rUd5HNXHhpnVE
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 this adds
Milestone 2 of the Kai autonomy control layer (issue #27), built on the ledger / decision router / impact-card layer merged in #28. Two slices that stack cleanly and need no network:
1. Approval queue (
scripts/autonomy/approval_queue.py) — #27 item 4The one canonical hold for risky actions: outbound email, client-facing claims, live publish, paid media, account/credential changes, deploys.
data/autonomy/approval_queue.jsonl) folded into current state on read —queued → validated → resolved. Nothing is mutated in place, so the file doubles as an audit trail of who approved what and when.enqueuededupes pending items by key (so monthly re-runs don't re-queue the same action) and raises on persistence failure — dropping a staged risky action is a safety regression, unlike a missing ledger line. There is deliberately no disable switch (location is still redirectable viaKAI_AUTONOMY_DIR).stage_findings(...)is the bridge fromroute_decisionoutput: it enqueues exactly the findings routed toaction_class == stage_for_approval.approve/reject/record_validationappend resolution + validation events; re-resolving a resolved item raises.2. Weekly operator brief (
scripts/autonomy/operator_brief.py) — #27 item 8A decision, not a dump. Reads the ledger + approval queue and renders a short markdown brief:
mine_repeated_lessons), actions taken.--since Ntime window,--out PATHto write. Restates ledger/queue facts only — invents no numbers (Kai Data Provenance Rule).Wiring
scripts/social/platform_change_monitor.pynow stages anystage_for_approvalfindings into the queue on a real run.Tests & checks
unittestcases (tests/test_autonomy_approval_queue.py,tests/test_autonomy_operator_brief.py); existingtest_autonomy_ledger.pystill passes (48 total).python scripts/doctor.py --ci,golden_check.py, and the self-check stay green. No gate/decision logic changed, so the golden corpus is untouched.data/autonomy/*.jsonlstay gitignored; only the README is tracked (updated to document the queue + brief).Part of #27 (roadmap items 4 and 8) — not closing it; capability registry, memory promotion, and a second converted automation remain.
🤖 Generated with Claude Code
Generated by Claude Code