Skip to content

HTDAG loop discipline: persistent plan/DAG, re-plan as a pre-dispatch step, no action without a node - #13

Merged
dominno merged 2 commits into
mainfrom
claude/htdag-loop-discipline
Jul 27, 2026
Merged

dominno merged 2 commits into
mainfrom
claude/htdag-loop-discipline

Conversation

@dominno

@dominno dominno commented Jul 27, 2026

Copy link
Copy Markdown
Owner

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

  1. Persistent plan/DAG — new .claude/memory/loop-plan.md: typed nodes with id / description / after: edges / status / origin, a ready-node rule (deps done), 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 to loop-run-log.md), not a knowledge topic.
  2. Re-plan as a first-class step — loop.md step 9, positioned before dispatch so the loop always consults the fresh DAG (HTDAG's "consult the DAG before every dispatch"). Records a re-plan: delta in the run-log.
  3. No action without a node — every L2/L3 dispatch (loop-iteration.js args.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

  • No .js engine touched. The discipline is prose + a lightweight plan schema.
  • Readiness never bypasses the denylist (incl. .claude//CLAUDE.md) or trust levels — those gates still apply on top at dispatch.
  • Trust-level defaults (L1 when unstated), maker/checker split, and confirmation gates are unchanged.

Consistency

loop-checklist.md §5, topics/workflow.md, the memory index.md, skills-index.md, CLAUDE.md, and the loop-iteration diagram 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).
  • 14 important, all real+safe — genuine DAG-contract completeness gaps the checker found in the first draft, all applied:
    • in-progress was 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-progress recovery.
    • No cascade when an after: dependency became dropped/escalated → dependents stranded blocked forever. Fixed (drop/re-point for dropped; escalate-with-note for escalated).
    • node/step terminology collision, an append-only-vs-prune ambiguity in the checklist, and stale CLAUDE.md/skills-index.md pointers — all corrected.

Verification

  • /improve-skills gate: 0 blockers, 14 important (applied), 6 nice-to-have, 4 refuted.
  • No .js changed; denylist + trust defaults + maker/checker confirmed intact by grep and by the gate.
  • Ready-formula and terminology confirmed consistent across all seven surfaces.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 27, 2026 20:58
…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
@dominno
dominno merged commit 24b9126 into main Jul 27, 2026
5 checks passed
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.

2 participants