# Plan: TAC RSI Loop Engineering with Plan F3

Metadata

created
  2026-06-28T00:00:00Z
modified
  2026-06-28T00:00:00Z
commits
  pending
agent name
  pi assistant
session id
  current TAC hardening session
back refs
  Plan F3 from disler/planf3; TAC Product Factory; RSI memory entries; signed deploy hardening
forward refs
  products/product_factory.py, pipeline/test_product_factory.py, products/DASHBOARD.md, products/receipts/rsi-proof-20260619T093724Z.md

## Process > Tools

Encode engineering taste into the plan fabric, then let the loops run under receipts and signed actions.

Nested loop engineering for TAC: agent, verification, event trigger, and guarded hill-climbing.

## Purpose

Create a Plan F3 implementation plan for turning the current TAC Product Factory into a truthful loop-engineering system: HTML-first plans, signed deploy boundaries, verification receipts, event-driven operation, and carefully scoped RSI claims.

## Problem

The repo already has pieces of RSI and Product Factory behavior, but the product narrative can drift into overclaiming. Factory-level deploy loops are operational, while broader agent-level auto-patch remains unproven except for tracked canary recovery evidence. The system needs a boring, machine-checkable plan that prevents future agents from confusing evidence, aspiration, and production truth.

Problem visual: claims become unsafe when they outrun receipts.

## Solution

Use Plan F3 as the canonical planning fabric. Encode the four loops directly in product metadata and receipts, validate plan/deploy/RSI truth in tests, and keep the deploy surface signed-action-only through `git-proxy:8099/deploy`. The lazy win: constants, receipts, and tests; no new framework.

Solution visual: loops are allowed to improve the system only through verifiable gates.

## Relevant Files

### Existing Files

- existing `products/product_factory.py` — central metadata, plan, receipt, dashboard generation.
- existing `pipeline/test_product_factory.py` — locks product factory claims and deploy route.
- existing `products/DASHBOARD.md` — published product truth surface.
- existing `products/AGENT_PRODUCTS.md` — product/control-plane documentation.
- existing `deploy_webhook.py` — signed action allowlist and deploy execution boundary.
- existing `skill_health.py` — RSI cron/self-diagnosis loop.
- existing `adw_modules/adw_pipeline.py` — ADW phase runner for agent loop.
- existing `skills/individual/planf3/` — vendored Plan F3 skill.

### New Files

- new `specs/tac-rsi-loop-engineering-planf3.html` — this implementation plan.
- new `plans/meta-prompts/loop_engineering.md` — optional follow-up: compact rules every future plan must include.

## Implementation Phases

IMPORTANT: Execute every phase and task step by step, in order, top to bottom.

Status markers: `[]` idle · `[wip]` in progress · `[x]` complete · `[f]` failed.

### `[x]` Phase 1: Lock Current Truth

Normalize Product Factory truth into constants and tests.

Phase 1 visual: evidence labels separated from claims.

#### 1.1 RSI claim constants

- `[x]` Keep `RSI_DECISION = healthy_but_autopatch_unproven`.
- `[x]` Keep `auto_patch_proven = false` until degraded-skill recovery receipt exists.
- `[x]` Track `rsi_canary_recovery_evidence = true` separately from broad autonomy.

#### 1.2 Testing Strategy

Use pytest to lock the claim model.

- `[x]` `uv run --with pytest pytest -q` — proves current factory tests pass.

🔁 Do not exit this phase until all product factory tests pass.

### `[x]` Phase 2: Encode Four Loops

Expose the loop-engineering model as metadata, not prose-only marketing.

Phase 2 visual: four loops as nested control system.

#### 2.1 Product metadata

- `[x]` Add `loop_engineering.agent_loop`: ADW phases run tools until completion.
- `[x]` Add `loop_engineering.verification_loop`: plan validation, pytest, verifier_result, receipts.
- `[x]` Add `loop_engineering.event_driven_loop`: webhooks, cron, JSONL events, dashboard refresh.
- `[x]` Add `loop_engineering.hill_climbing_loop`: signed patch requests, rollback, receipts.

#### 2.2 Testing Strategy

Assert loop metadata exists in generated spec and receipt.

- `[x]` `uv run --with pytest pytest pipeline/test_product_factory.py -q` — proves metadata is emitted.

🔁 If metadata appears only in README/dashboard and not receipts, fail the phase.

### `[x]` Phase 3: Preserve Signed Deploy Boundary

Prevent future agents from reintroducing raw shell deploy through product flows.

Phase 3 visual: action allowlist before deploy.

#### 3.1 Deploy route assertions

- `[x]` Assert all product outputs use `git-proxy:8099/deploy`.
- `[x]` Keep `deploy-webhook:8098` only as legacy/internal note.
- `[x]` Confirm deploy payloads remain signed actions such as `patch_skill_from_pr`.

#### 3.2 Testing Strategy

Run product and deploy-webhook tests without live VPS calls.

- `[x]` `uv run --with pytest pytest pipeline/test_product_factory.py pipeline/test_deploy_webhook.py -q` — proves local signed deploy contract.

🔁 Do not run live deploy checks unless explicitly authorized.

### `[x]` Phase 4: Add Plan F3 Meta-Prompt

Make future plans inherit the loop model automatically.

Phase 4 visual: planning fabric carries engineering taste forward.

#### 4.1 Meta-prompt file

- `[x]` Create `plans/meta-prompts/loop_engineering.md`.
- `[x]` Require all Product Factory plans to include deploy route, receipts, RSI claim scope, and four-loop mapping.
- `[x]` Reference this meta-prompt from generated plan templates or docs.

#### 4.2 Testing Strategy

Use existing plan validator checks; keep it file-based.

- `[x]` `uv run --with pytest pytest pipeline/test_plan_validator.py -q` — proves strict plan validation still works.

🔁 If this needs a new framework, stop. A markdown meta-prompt is enough.

## Validation Commands

Execute these commands to validate the entire plan is complete:

- `[x]` `uv run --with pytest pytest -q` — all repo-scoped tests pass.
- `[x]` `rg -n "git-proxy:8099/deploy|auto_patch_proven|loop_engineering" products pipeline plans` — expected truth markers exist.
- `[x]` `rg -n "command\"\s*:" deploy_webhook.py dark_factory.py trigger_webhook.py adw_modules products` — no raw command deploy payload in product path.

🔁 The plan is not complete until every box is checked and every command passes. If a live VPS check is needed, mark it blocked until explicitly authorized.

## Notes

### Loop 1: Agent

ADW planner/build/test/review/document/ship phases are the existing agent loop. Keep it boring.

### Loop 2: Verification

Plan validation, pytest, verifier_result, and receipts prevent confident wrong output.

### Loop 3: Event-driven

GitHub webhooks, cron, JSONL events, and dashboards move work out of manual invocation.

### Loop 4: Hill-climbing

SkillOpt/skill_health can request signed patches, but receipts and rollback decide what is true.

### Tradeoffs

- Skipped a new orchestration framework; constants and tests are enough.
- Skipped live deploy probing; local contract tests are safer unless explicitly requested.
- Separated canary evidence from broad auto-patch proof to avoid RSI overclaim.

### References

- disler/planf3
- Anthropic: When AI builds itself
- `products/receipts/rsi-proof-20260619T093724Z.md`
- `products/AGENT_PRODUCTS.md`

Notes visual: proof ladder from healthy system to canary evidence to broad autonomy.

## Amendments

2026-06-28T00:00:00Z — Initial Plan F3 creation

Created an HTML-first Plan F3 artifact for TAC RSI loop-engineering hardening.

2026-06-28T00:00:00Z — Execution completed

Filled local SVG image slots, opened the plan in browser, added loop_engineering metadata and meta-prompt, resolved the planf3 skill collision, and verified pytest passed.