Repository navigation
HTDAG loop discipline: persistent plan/DAG, re-plan as a pre-dispatch step, no action without a node - #13
Merged
Conversation
…e, no-action-without-node) Adds the three HTDAG disciplines to the autonomous loop, built on the existing loop + run-log + memory wiki (no new runtime). Additive only — no existing gate is weakened; no workflow .js engine touched. - Persistent plan: new .claude/memory/loop-plan.md — a durable, mutable DAG of typed nodes (id, description, after: deps, status, origin, notes) with a documented ready-node rule. Pointer added to the memory index. Distinct from the append-only loop-run-log.md history. - Re-plan as a first-class node: loop.md step 9 "Re-evaluate & re-plan" runs BEFORE dispatch so the loop consults the fresh DAG every iteration — marks nodes done, adds nodes from confirmed findings, drops obsolete, recomputes ready. Run-log format gains node: and re-plan: lines. - No action without a node: L2/L3 dispatch (loop-iteration args.items) must be ready plan nodes; node creation is the only exempt action (the sanctioned bootstrap), so an empty/first-iteration plan populates rather than deadlocks. Readiness never bypasses the denylist or trust level. - Consistency: loop-checklist.md §5, topics/workflow.md, and the loop-iteration diagram label updated to match. Verification in progress: /improve-skills gate running over the changed files as the independent checker (maker/checker split). Follow-up commits will apply any confirmed real-and-safe findings. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G
The independent checker (24 agents) confirmed 0 blockers — no safety gate was weakened (criterion 4 holds) — and 14 important real+safe findings, all additive DAG-contract tightenings. Deduped to six fixes + two consistency touches: - Ready formula now excludes `in-progress` too, so a node orphaned by a crash/ timeout mid-dispatch isn't re-read as freshly ready (duplicate-dispatch risk); added a stale-in-progress recovery rule to the re-plan step. - Cascade rule: a node whose `after:` dep becomes `dropped`/`escalated` (never `done`) is resolved in re-plan (drop/re-point for dropped; escalate-with-note for escalated) instead of sitting silently `blocked` forever. - Terminology: re-plan is a "step", not a "node" (node is reserved for LP-NNN plan rows) — fixed in topics/workflow.md. - loop-checklist.md §5: disambiguated "resolved items pruned" — the run-log is append-only; prune resolved nodes only in loop-plan.md. - Stale pointers updated: CLAUDE.md and skills-index.md now name loop-plan.md as loop state alongside the run-log. - Consistency: step-2 ready shorthand marked illustrative + defers to the plan; empty-watchlist self-stop hardened "should"->"MUST". No .js engine touched; safety gates (denylist, L1/L2/L3 defaults, maker/checker) verified intact. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G
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.
Summary
Applies the three HTDAG planning disciplines to this repo's meta-layer (the autonomous
/loop) — building on the existing loop + run-log + memory wiki, without any new runtime (no pueue/hud/opencode analog). This is an additive discipline: it only ADDS constraints on top of the existing safety gates, never weakens one.Scoping note: the product backlog (2 PRD stories, both done — deliberately a workflow test-stub) is the wrong place for a dependency DAG; the loop machinery is the layer with real typed activities, dependencies, and re-planning. So the DAG lives over the loop, not the stories.
What changed
The three disciplines
.claude/memory/loop-plan.md: typed nodes withid/description/after:edges /status/origin, aready-node rule (depsdone), and cascade + stale-recovery rules. The loop reads it at iteration start and rewrites it in the re-plan step. It is loop state (sibling toloop-run-log.md), not a knowledge topic.loop.mdstep 9, positioned before dispatch so the loop always consults the fresh DAG (HTDAG's "consult the DAG before every dispatch"). Records are-plan:delta in the run-log.loop-iteration.jsargs.items) must be a ready plan node; node creation is the only exempt action (the sanctioned bootstrap), so an empty/first-iteration plan populates and dispatches in the same iteration rather than deadlocking.Safety posture
.jsengine touched. The discipline is prose + a lightweight plan schema..claude//CLAUDE.md) or trust levels — those gates still apply on top at dispatch.Consistency
loop-checklist.md§5,topics/workflow.md, the memoryindex.md,skills-index.md,CLAUDE.md, and theloop-iterationdiagram label all updated to reference the plan/DAG and stay in sync.Maker/checker — verified by our own gate
Ran
/improve-skills(24 agents) as the independent checker, explicitly told to flag any weakened safety gate as a blocker:confirmedBlockers: 0— no gate weakened (the core acceptance criterion).in-progresswas not excluded from the ready formula → a node orphaned by a crash/timeout could be re-read as ready and double-dispatched. Fixed + added stale-in-progressrecovery.after:dependency becamedropped/escalated→ dependents strandedblockedforever. Fixed (drop/re-point for dropped; escalate-with-note for escalated).node/stepterminology collision, an append-only-vs-prune ambiguity in the checklist, and staleCLAUDE.md/skills-index.mdpointers — all corrected.Verification
/improve-skillsgate: 0 blockers, 14 important (applied), 6 nice-to-have, 4 refuted..jschanged; denylist + trust defaults + maker/checker confirmed intact by grep and by the gate.🤖 Generated with Claude Code
Generated by Claude Code