Rescue conflicted autoloop PR work - #42
Merged
Merged
Conversation
Brainstormed design for Phase C autoloop-planner feedback loop. Five-commit layered design that closes the loop in the autoloop→planner direction (Phase B closed it the other way). Six layers total (L6 folds into L1's commit): - L1: planner ledger (.codex/architecture-planner/state/runs.jsonl) with per-run records: trigger, before/after stats, rows changed, retry attempts - L2: event-driven trigger via .codex/architecture-planner/triggers.jsonl; autoloop emits on quarantine_added / quarantine_stale_cleared; systemd path unit fires planner within seconds (rate-limited to 1/60s); cursor tracks consumption - L3: retry-with-feedback when validateHealthPreservation rejects a regen; re-prompt LLM with "you dropped row X" up to N times in same run - L4: self-evaluation correlates planner ledger with autoloop ledger; per- row outcomes (unstuck / still_failing / no_attempts_yet) feed next prompt - L5: PlannerVerdict typed field on Item (planner owns; autoloop preserves structurally via Phase B round-trip); sticky NeedsHuman after N reshapes; autoloop selection skips NeedsHuman rows; status surface lists them with suggested actions - L6: keyword arguments for topical focus runs (`go run ./cmd/architecture- planner-loop run honcho memory`); mechanical context narrowing + LLM topical clause Symmetric ownership rule: autoloop owns Health (Phase B); planner owns PlannerVerdict (Phase C). Both blocks structurally preserved via Phase B's typed-struct round-trip. Out of Phase C scope (deferred): external notifications, adaptive cadence, preview-via-dry-run, auto-unset of NeedsHuman. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
13-task TDD plan for the spec at
docs/superpowers/specs/2026-04-24-planner-self-healing-design.md.
Tasks (each ends in one commit):
1. Add PlannerVerdict schema in internal/progress (typed field on Item)
2. Symmetric preservation regression test (both blocks survive both writers)
3. Planner ledger types + AppendLedgerEvent / LoadLedger / LoadLedgerWindow
4. Wire planner ledger into RunOnce (computeStats, diffRows, status)
5. Topical focus mode: matchKeywords + FilterContextByKeywords +
cmd positional args + topical prompt clause
6. Autoloop side: classifyForTrigger + FlushWithTriggers + emit to
triggers.jsonl from run loop
7. Planner side: AppendTriggerEvent + cursor + RunOnce wires reads +
trigger context section in prompt
8. systemd path unit alongside timer for event-driven cadence
9. Retry-with-feedback on validation rejection (RetryFeedback +
extractDroppedRows + RunOnce loop)
10. Self-evaluation: Evaluate correlates planner ledger ↔ autoloop ledger;
PreviousReshapes section + SELF-EVALUATION SOFT clause
11. StampVerdicts post-processing pass (deterministic; ReshapeCount
monotonic; sticky NeedsHuman after threshold)
12. Autoloop selection skips NeedsHuman; status surface lists rows with
suggested actions per failure category
13. End-to-end lifecycle test (7 simulated runs across all 6 layers)
Self-review notes:
- Tasks 4, 9, 12, 13 have deliberate t.Skip stubs because the existing
planner test fixtures use a fixture style the implementer must follow.
Required test names and scenarios are pinned; only the wiring is
implementer discretion.
- Cross-package import cycle risk flagged in Task 6: autoloop importing
architectureplanner.TriggerEvent. If circular, plan calls for a new
shared internal/plannertriggers package.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts: # internal/apiserver/chat_completions_test.go # internal/apiserver/kernel_loop.go # internal/apiserver/server.go # internal/cli/pty_bridge_linux.go # internal/hermes/bedrock_converse.go # internal/hermes/client.go # internal/hermes/http_client.go # internal/hermes/mock.go # internal/hermes/provider_status_test.go # internal/hermes/status.go # internal/kernel/frame.go # internal/kernel/kernel.go
(cherry picked from commit 00f69dd)
(cherry picked from commit 4c3bdb5)
This was referenced Apr 25, 2026
Closed
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.
Rescues the useful work from the conflicted autoloop PR backlog, integrates local main fixes after PR intake, and repairs the merged main baseline.\n\nVerification:\n- go test ./... -count=1