Skip to content

feat(autonomy): approval queue + weekly operator brief (#27)#29

Draft
cgallic wants to merge 1 commit into
mainfrom
claude/keen-lamport-ynom91
Draft

feat(autonomy): approval queue + weekly operator brief (#27)#29
cgallic wants to merge 1 commit into
mainfrom
claude/keen-lamport-ynom91

Conversation

@cgallic

@cgallic cgallic commented Jun 22, 2026

Copy link
Copy Markdown
Owner

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 4

The one canonical hold for risky actions: outbound email, client-facing claims, live publish, paid media, account/credential changes, deploys.

  • Append-only event log (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.
  • enqueue dedupes 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 via KAI_AUTONOMY_DIR).
  • stage_findings(...) is the bridge from route_decision output: it enqueues exactly the findings routed to action_class == stage_for_approval.
  • approve / reject / record_validation append resolution + validation events; re-resolving a resolved item raises.

2. Weekly operator brief (scripts/autonomy/operator_brief.py) — #27 item 8

A decision, not a dump. Reads the ledger + approval queue and renders a short markdown brief:

  • biggest risks (high/critical findings + escalate/block), approvals needed (pending queue items), failed automations (runs with blockers), stale docs / broken sources (unresolved sources), suggested upgrades (recurring lessons via mine_repeated_lessons), actions taken.
  • --since N time window, --out PATH to write. Restates ledger/queue facts only — invents no numbers (Kai Data Provenance Rule).

Wiring

scripts/social/platform_change_monitor.py now stages any stage_for_approval findings into the queue on a real run.

Tests & checks

  • 25 new unittest cases (tests/test_autonomy_approval_queue.py, tests/test_autonomy_operator_brief.py); existing test_autonomy_ledger.py still 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/*.jsonl stay 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

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
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app-meetkai Ready Ready Preview, Comment Jun 22, 2026 4:25pm

Request Review

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