agentic-ai-engineering/specs/tac-rsi-loop-engineering-pl...

261 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plan: TAC RSI Loop Engineering with Plan F3</title>
<style>
:root {
--bg: #0d111b;
--panel: #121927;
--panel-2: #151f31;
--text: #e8edf7;
--muted: #8d99ae;
--accent: #88f7d0;
--blue: #7aa7ff;
--warn: #f6c177;
--bad: #f38ba8;
--border: #253044;
--code: #101624;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: radial-gradient(circle at top left, rgba(136,247,208,.08), transparent 34%), var(--bg);
color: var(--text);
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
line-height: 1.55;
}
main { max-width: 1120px; margin: 0 auto; padding: 42px 22px 80px; }
header, section, figure {
background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--panel);
border: 1px solid var(--border);
border-radius: 16px;
padding: 22px;
margin: 18px 0;
}
h1 { font-size: clamp(2rem, 5vw, 4.5rem); line-height: .95; margin: 0 0 16px; letter-spacing: -.05em; }
h2 { margin-top: 0; color: var(--accent); }
h3 { color: var(--blue); }
h4 { margin-bottom: 8px; }
a { color: var(--accent); }
code { background: var(--code); border: 1px solid var(--border); border-radius: 7px; padding: .12rem .35rem; }
pre { overflow: auto; background: var(--code); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.meta dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.meta dt { color: var(--muted); }
.hero { min-height: 220px; display: grid; place-items: center; text-align: center; background: linear-gradient(135deg, rgba(122,167,255,.14), rgba(136,247,208,.08)); }
.tag { border-radius: 999px; padding: 2px 8px; font-size: .78rem; border: 1px solid var(--border); }
.existing { color: var(--blue); }
.new { color: var(--accent); }
.phase { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin: 16px 0; }
.status { color: var(--warn); font-weight: 700; }
.checklist { list-style: none; padding-left: 0; }
.checklist li { padding: 7px 0; border-bottom: 1px dashed rgba(141,153,174,.25); }
.loop { border-left: 4px solid var(--accent); background: rgba(136,247,208,.07); padding: 12px 14px; border-radius: 10px; margin-top: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
figcaption { color: var(--muted); margin-top: 10px; }
</style>
</head>
<body>
<main>
<header>
<h1>Plan: TAC RSI Loop Engineering with Plan F3</h1>
<details class="meta" open>
<summary>Metadata</summary>
<dl>
<dt>created</dt><dd>2026-06-28T00:00:00Z</dd>
<dt>modified</dt><dd>2026-06-28T00:00:00Z</dd>
<dt>commits</dt><dd>pending</dd>
<dt>agent name</dt><dd>pi assistant</dd>
<dt>session id</dt><dd>current TAC hardening session</dd>
<dt>back refs</dt><dd>Plan F3 from disler/planf3; TAC Product Factory; RSI memory entries; signed deploy hardening</dd>
<dt>forward refs</dt><dd>products/product_factory.py, pipeline/test_product_factory.py, products/DASHBOARD.md, products/receipts/rsi-proof-20260619T093724Z.md</dd>
</dl>
</details>
</header>
<figure class="hero">
<img src="tac-rsi-loop-engineering-planf3/hero.svg" alt="nested four-loop factory, with signed deploy gate and receipt ledger">
<div>
<h2>Process > Tools</h2>
<p>Encode engineering taste into the plan fabric, then let the loops run under receipts and signed actions.</p>
</div>
<figcaption>Nested loop engineering for TAC: agent, verification, event trigger, and guarded hill-climbing.</figcaption>
</figure>
<section id="purpose">
<h2>Purpose</h2>
<p>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.</p>
</section>
<section id="problem">
<h2>Problem</h2>
<p>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.</p>
<figure>
<img src="tac-rsi-loop-engineering-planf3/problem.svg" alt="drifting claims crossing a red deploy boundary without receipts">
<figcaption>Problem visual: claims become unsafe when they outrun receipts.</figcaption>
</figure>
</section>
<section id="solution">
<h2>Solution</h2>
<p>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 <code>git-proxy:8099/deploy</code>. The lazy win: constants, receipts, and tests; no new framework.</p>
<figure>
<img src="tac-rsi-loop-engineering-planf3/solution.svg" alt="four nested loops feeding JSONL events and receipts into a signed deploy gate">
<figcaption>Solution visual: loops are allowed to improve the system only through verifiable gates.</figcaption>
</figure>
</section>
<section id="files" class="files">
<h2>Relevant Files</h2>
<h3>Existing Files</h3>
<ul>
<li><span class="tag existing">existing</span> <code>products/product_factory.py</code> — central metadata, plan, receipt, dashboard generation.</li>
<li><span class="tag existing">existing</span> <code>pipeline/test_product_factory.py</code> — locks product factory claims and deploy route.</li>
<li><span class="tag existing">existing</span> <code>products/DASHBOARD.md</code> — published product truth surface.</li>
<li><span class="tag existing">existing</span> <code>products/AGENT_PRODUCTS.md</code> — product/control-plane documentation.</li>
<li><span class="tag existing">existing</span> <code>deploy_webhook.py</code> — signed action allowlist and deploy execution boundary.</li>
<li><span class="tag existing">existing</span> <code>skill_health.py</code> — RSI cron/self-diagnosis loop.</li>
<li><span class="tag existing">existing</span> <code>adw_modules/adw_pipeline.py</code> — ADW phase runner for agent loop.</li>
<li><span class="tag existing">existing</span> <code>skills/individual/planf3/</code> — vendored Plan F3 skill.</li>
</ul>
<h3>New Files</h3>
<ul>
<li><span class="tag new">new</span> <code>specs/tac-rsi-loop-engineering-planf3.html</code> — this implementation plan.</li>
<li><span class="tag new">new</span> <code>plans/meta-prompts/loop_engineering.md</code> — optional follow-up: compact rules every future plan must include.</li>
</ul>
</section>
<section id="phases">
<h2>Implementation Phases</h2>
<p><strong>IMPORTANT:</strong> Execute every phase and task step by step, in order, top to bottom.</p>
<p>Status markers: <code>[]</code> idle · <code>[wip]</code> in progress · <code>[x]</code> complete · <code>[f]</code> failed.</p>
<div class="phase">
<h3><code class="status">[x]</code> Phase 1: Lock Current Truth</h3>
<p>Normalize Product Factory truth into constants and tests.</p>
<figure><img src="tac-rsi-loop-engineering-planf3/phase1.svg" alt="receipt ledger validating claim labels"><figcaption>Phase 1 visual: evidence labels separated from claims.</figcaption></figure>
<h4>1.1 RSI claim constants</h4>
<ul class="checklist">
<li><code class="status">[x]</code> Keep <code>RSI_DECISION = healthy_but_autopatch_unproven</code>.</li>
<li><code class="status">[x]</code> Keep <code>auto_patch_proven = false</code> until degraded-skill recovery receipt exists.</li>
<li><code class="status">[x]</code> Track <code>rsi_canary_recovery_evidence = true</code> separately from broad autonomy.</li>
</ul>
<h4>1.2 Testing Strategy</h4>
<p>Use pytest to lock the claim model.</p>
<ul class="checklist">
<li><code class="status">[x]</code> <code>uv run --with pytest pytest -q</code> — proves current factory tests pass.</li>
</ul>
<div class="loop">🔁 Do not exit this phase until all product factory tests pass.</div>
</div>
<div class="phase">
<h3><code class="status">[x]</code> Phase 2: Encode Four Loops</h3>
<p>Expose the loop-engineering model as metadata, not prose-only marketing.</p>
<figure><img src="tac-rsi-loop-engineering-planf3/phase2.svg" alt="four nested rings labeled Agent, Verification, Event, Hill-climb"><figcaption>Phase 2 visual: four loops as nested control system.</figcaption></figure>
<h4>2.1 Product metadata</h4>
<ul class="checklist">
<li><code class="status">[x]</code> Add <code>loop_engineering.agent_loop</code>: ADW phases run tools until completion.</li>
<li><code class="status">[x]</code> Add <code>loop_engineering.verification_loop</code>: plan validation, pytest, verifier_result, receipts.</li>
<li><code class="status">[x]</code> Add <code>loop_engineering.event_driven_loop</code>: webhooks, cron, JSONL events, dashboard refresh.</li>
<li><code class="status">[x]</code> Add <code>loop_engineering.hill_climbing_loop</code>: signed patch requests, rollback, receipts.</li>
</ul>
<h4>2.2 Testing Strategy</h4>
<p>Assert loop metadata exists in generated spec and receipt.</p>
<ul class="checklist">
<li><code class="status">[x]</code> <code>uv run --with pytest pytest pipeline/test_product_factory.py -q</code> — proves metadata is emitted.</li>
</ul>
<div class="loop">🔁 If metadata appears only in README/dashboard and not receipts, fail the phase.</div>
</div>
<div class="phase">
<h3><code class="status">[x]</code> Phase 3: Preserve Signed Deploy Boundary</h3>
<p>Prevent future agents from reintroducing raw shell deploy through product flows.</p>
<figure><img src="tac-rsi-loop-engineering-planf3/phase3.svg" alt="signed gate before deploy endpoint"><figcaption>Phase 3 visual: action allowlist before deploy.</figcaption></figure>
<h4>3.1 Deploy route assertions</h4>
<ul class="checklist">
<li><code class="status">[x]</code> Assert all product outputs use <code>git-proxy:8099/deploy</code>.</li>
<li><code class="status">[x]</code> Keep <code>deploy-webhook:8098</code> only as legacy/internal note.</li>
<li><code class="status">[x]</code> Confirm deploy payloads remain signed actions such as <code>patch_skill_from_pr</code>.</li>
</ul>
<h4>3.2 Testing Strategy</h4>
<p>Run product and deploy-webhook tests without live VPS calls.</p>
<ul class="checklist">
<li><code class="status">[x]</code> <code>uv run --with pytest pytest pipeline/test_product_factory.py pipeline/test_deploy_webhook.py -q</code> — proves local signed deploy contract.</li>
</ul>
<div class="loop">🔁 Do not run live deploy checks unless explicitly authorized.</div>
</div>
<div class="phase">
<h3><code class="status">[x]</code> Phase 4: Add Plan F3 Meta-Prompt</h3>
<p>Make future plans inherit the loop model automatically.</p>
<figure><img src="tac-rsi-loop-engineering-planf3/phase4.svg" alt="Plan F3 template injecting loop requirements into future plans"><figcaption>Phase 4 visual: planning fabric carries engineering taste forward.</figcaption></figure>
<h4>4.1 Meta-prompt file</h4>
<ul class="checklist">
<li><code class="status">[x]</code> Create <code>plans/meta-prompts/loop_engineering.md</code>.</li>
<li><code class="status">[x]</code> Require all Product Factory plans to include deploy route, receipts, RSI claim scope, and four-loop mapping.</li>
<li><code class="status">[x]</code> Reference this meta-prompt from generated plan templates or docs.</li>
</ul>
<h4>4.2 Testing Strategy</h4>
<p>Use existing plan validator checks; keep it file-based.</p>
<ul class="checklist">
<li><code class="status">[x]</code> <code>uv run --with pytest pytest pipeline/test_plan_validator.py -q</code> — proves strict plan validation still works.</li>
</ul>
<div class="loop">🔁 If this needs a new framework, stop. A markdown meta-prompt is enough.</div>
</div>
</section>
<section id="validation">
<h2>Validation Commands</h2>
<p>Execute these commands to validate the entire plan is complete:</p>
<ul class="checklist">
<li><code class="status">[x]</code> <code>uv run --with pytest pytest -q</code> — all repo-scoped tests pass.</li>
<li><code class="status">[x]</code> <code>rg -n "git-proxy:8099/deploy|auto_patch_proven|loop_engineering" products pipeline plans</code> — expected truth markers exist.</li>
<li><code class="status">[x]</code> <code>rg -n "command\"\s*:" deploy_webhook.py dark_factory.py trigger_webhook.py adw_modules products</code> — no raw command deploy payload in product path.</li>
</ul>
<div class="loop">🔁 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.</div>
</section>
<section id="notes">
<h2>Notes</h2>
<div class="grid">
<div class="card"><h3>Loop 1: Agent</h3><p>ADW planner/build/test/review/document/ship phases are the existing agent loop. Keep it boring.</p></div>
<div class="card"><h3>Loop 2: Verification</h3><p>Plan validation, pytest, verifier_result, and receipts prevent confident wrong output.</p></div>
<div class="card"><h3>Loop 3: Event-driven</h3><p>GitHub webhooks, cron, JSONL events, and dashboards move work out of manual invocation.</p></div>
<div class="card"><h3>Loop 4: Hill-climbing</h3><p>SkillOpt/skill_health can request signed patches, but receipts and rollback decide what is true.</p></div>
</div>
<h3>Tradeoffs</h3>
<ul>
<li>Skipped a new orchestration framework; constants and tests are enough.</li>
<li>Skipped live deploy probing; local contract tests are safer unless explicitly requested.</li>
<li>Separated canary evidence from broad auto-patch proof to avoid RSI overclaim.</li>
</ul>
<h3>References</h3>
<ul>
<li><a href="https://github.com/disler/planf3">disler/planf3</a></li>
<li><a href="https://www.anthropic.com/institute/recursive-self-improvement">Anthropic: When AI builds itself</a></li>
<li><code>products/receipts/rsi-proof-20260619T093724Z.md</code></li>
<li><code>products/AGENT_PRODUCTS.md</code></li>
</ul>
<figure><img src="tac-rsi-loop-engineering-planf3/notes.svg" alt="evidence ladder separating health, canary, broad autonomy"><figcaption>Notes visual: proof ladder from healthy system to canary evidence to broad autonomy.</figcaption></figure>
</section>
<section id="amendments">
<h2>Amendments</h2>
<details>
<summary>2026-06-28T00:00:00Z — Initial Plan F3 creation</summary>
<p>Created an HTML-first Plan F3 artifact for TAC RSI loop-engineering hardening.</p>
</details>
<details>
<summary>2026-06-28T00:00:00Z — Execution completed</summary>
<p>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.</p>
</details>
</section>
</main>
</body>
</html>