Skip to content

docs(phase3-step9): TDD implementation plan — Background Execution + Permission Gate#18

Merged
AVADSA25 merged 1 commit into
mainfrom
docs/phase3-step9-plan
May 3, 2026
Merged

docs(phase3-step9): TDD implementation plan — Background Execution + Permission Gate#18
AVADSA25 merged 1 commit into
mainfrom
docs/phase3-step9-plan

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

@AVADSA25 AVADSA25 commented May 3, 2026

Summary

TDD implementation plan for Phase 3 Step 9 — Background Execution + Permission Gate. Generated via superpowers:writing-plans from the approved blueprint (docs/PHASE3-BLUEPRINT.md §3). 11 tasks, 54 atomic TDD steps, 2113 lines.

What Step 9 builds

The runtime layer. Approved plans (Step 8) actually run autonomously:

  • New PM2 service codec-agent-runner (5s tick daemon)
  • Per-agent thread inside daemon
  • Per-checkpoint LLM↔skill loop with permission gate enforcement
  • Strict-consent (Step 3 §1.7 reuse) for destructive ops
  • Resume after PM2 restart (Q5 — from last atomic checkpoint)
  • Multi-agent concurrency cap = 3 (Q6, Q8 blocked occupies slot)
  • Plan-hash tamper detection at run start (Q13)

Still no UI — Step 10 picks that up.

Plan structure

Task Tests Purpose
1 1 Audit event constants (8 events)
2 1 Extend state machine for Step 9 statuses
3 4 PermissionViolation + permission_gate matrix
4 3 Qwen-3.6 next-action driver
5 2 Strict-consent gate integration (Q7)
6 4 _execute_checkpoint inner loop
7 5 _run_agent (happy/blocked/aborted/tampered/resume)
8 6 Daemon outer loop + concurrency (Q6/Q8/Q15)
9 4 PWA endpoints (abort/pause/resume/grant)
10 PM2 ecosystem + heartbeat monitor (Q15)
11 Final pytest + docs + push + PR
Total 30 (31 if you count audit-constants test as Task 1)

Estimated implementation outputs

  • 1 new module: codec_agent_runner.py (~700 LOC)
  • 1 new PM2 service: codec-agent-runner
  • 31 new passing tests
  • 8 new audit event constants
  • 4 new PWA endpoints
  • 5 file modifications (audit, agent_plan state machine, routes, ecosystem, heartbeat)
  • AGENTS.md §X.Y sub-section + §6 table + §10 don't-touch list

Quality discipline

  • Every step has exact file paths, exact code, exact pytest commands
  • Every test has a complete body (no "similar to Task N")
  • TDD pattern strictly followed
  • No placeholders / TBDs / TODOs
  • Type consistency verified: Action, PermissionViolation, _qwen_next_action, _execute_checkpoint, _run_agent, permission_gate all defined once, reused with consistent signatures

Test plan

  • No code changes — docs-only PR
  • User reviews plan structure + task decomposition
  • After approval: execute via superpowers:subagent-driven-development

Sequencing

This PR (Step 9 plan) → user merges → execution PR ships → Step 9 sign-off → Step 10 plan → Step 10 execution → Phase 3 closeout.

🤖 Generated with Claude Code

Implementation plan for Phase 3 Step 9 (Background Execution +
Permission Gate). Generated via superpowers:writing-plans skill.

11 tasks decomposing Step 9 into bite-sized TDD steps:

  1.  Audit event constants (8 events + PHASE3_STEP9_EVENTS frozenset)
  2.  Extend _VALID_TRANSITIONS with Step 9 runtime statuses
  3.  PermissionViolation + permission_gate (4-test matrix)
  4.  Qwen-3.6 next-action driver (3 tests)
  5.  Strict-consent gate integration for destructive ops (2 tests)
  6.  _execute_checkpoint inner loop (4 tests: happy/perm/destructive/budget)
  7.  _run_agent main thread function (5 tests: happy/blocked/aborted/tampered/resume)
  8.  Daemon outer loop + multi-agent concurrency (6 tests inc. Q6/Q8/Q15)
  9.  PWA endpoints — abort/pause/resume/grant (4 tests)
  10. PM2 ecosystem config + heartbeat monitoring
  11. Final pytest + AGENTS.md docs + push + PR

Estimated outputs:
- 1 new module (codec_agent_runner.py, ~700 LOC)
- 1 new PM2 service (codec-agent-runner)
- 31 new passing tests (tests/test_agent_runner.py)
- 8 new audit event constants in codec_audit.py
- 4 new PWA endpoints in routes/agents.py
- ecosystem.config.js + codec_heartbeat.py + AGENTS.md updates

Each task is self-contained with exact file paths, exact code,
exact pytest commands with expected outputs. No placeholders.

Reference: docs/PHASE3-BLUEPRINT.md §3 (approved 2026-05-03).

After Step 9 lands and signs off, Step 10 plan will follow the
same writing-plans cadence (UI + proactive messaging + auto-escalation).
@AVADSA25 AVADSA25 merged commit 59f7726 into main May 3, 2026
1 check passed
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