Skip to content

Rescue conflicted autoloop PR work - #42

Merged
XelHaku merged 49 commits into
mainfrom
rescue/conflicted-prs
Apr 25, 2026
Merged

Rescue conflicted autoloop PR work#42
XelHaku merged 49 commits into
mainfrom
rescue/conflicted-prs

Conversation

@XelHaku

@XelHaku XelHaku commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

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

XelHaku and others added 30 commits April 24, 2026 23:55
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>
XelHaku and others added 11 commits April 25, 2026 01:40
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)
@XelHaku
XelHaku merged commit a679dd3 into main Apr 25, 2026
@XelHaku
XelHaku deleted the rescue/conflicted-prs branch April 25, 2026 08:13
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.

1 participant