Skip to content

feat: implement ADR-159 Dream Graduation#248

Merged
notque merged 4 commits intomainfrom
feat/adr-159-dream-graduation
Apr 1, 2026
Merged

feat: implement ADR-159 Dream Graduation#248
notque merged 4 commits intomainfrom
feat/adr-159-dream-graduation

Conversation

@notque
Copy link
Copy Markdown
Owner

@notque notque commented Apr 1, 2026

Summary

  • Add GRADUATE phase to the nightly dream cycle (ADR-159)
  • Dream now queries learning DB for mature entries (confidence >= 0.9, 3+ observations, scoped to agent/skill) and embeds them as permanent anti-patterns in target files
  • Commits graduation edits on dream/graduate-YYYY-MM-DD branch for human review — never directly to main
  • New graduate-candidates CLI command for inspecting what dream would graduate
  • Max 3 graduations per cycle, dry-run aware, full audit trail in dream report

Files changed

File Change
hooks/lib/learning_db_v2.py New query_graduation_candidates() function
scripts/auto-dream-cron.sh DREAM_DATE export, git branch safety cleanup
skills/auto-dream/dream-prompt.md New Phase 5: GRADUATE (between SYNTHESIZE and SELECT)
skills/auto-dream/SKILL.md Updated phases, triggers, safety constraints
skills/INDEX.json Added graduation triggers
skills/do/references/routing-tables.md Updated auto-dream routing entry

Design (from ADR-159)

The learning lifecycle is now fully automated:

  1. Capture — hooks record learnings at PostToolUse, session-end, manual learn
  2. Injection — dream builds payload, session-start hook injects it
  3. Graduation — dream evaluates mature entries overnight, embeds in agent/skill files on a branch
  4. Review — user merges graduation branch next session

Test plan

  • 1341 tests pass (1 pre-existing failure in governance report test)
  • ruff check + ruff format clean
  • graduate-candidates CLI works: returns candidates with inferred target paths
  • Dry-run dream cycle includes graduation phase output
  • Live dream cycle creates dream/graduate-* branch with edits

notque added 4 commits March 31, 2026 23:04
…t knowledge transfer

Add GRADUATE phase to the nightly dream cycle that promotes mature learning DB
entries (confidence >= 0.9, 3+ observations) into agent/skill files as permanent
anti-patterns. Commits on dream/graduate-YYYY-MM-DD branch for human review.

Changes:
- hooks/lib/learning_db_v2.py: add query_graduation_candidates() function
- scripts/auto-dream-cron.sh: add DREAM_DATE export, git branch safety cleanup
- skills/auto-dream/dream-prompt.md: add Phase 5 GRADUATE with full workflow
- skills/auto-dream/SKILL.md: update phases, triggers, safety constraints
- skills/INDEX.json: add graduation triggers to auto-dream skill
- skills/do/references/routing-tables.md: update auto-dream routing entry
Keep PR #248's GRADUATE phase additions (Phase 7 numbering) while
incorporating PR #250's dry-run fixes (DREAM_DRY_RUN_MODE substitution
instead of CLAUDE_DREAM_DRY_RUN env var check).
dream-prompt.md:
- Fix stale execution order in READ THIS FIRST block (was missing GRADUATE)
- Fix Phase 3 safety gate referencing Phase 6 instead of Phase 7
- Remove phantom CLAUDE_DREAM_DRY_RUN env var, use only ${DREAM_DRY_RUN_MODE}
- Add push-failure guard: skip mark_graduated if git push fails
- Use ${DREAM_DATE} for consistent branch naming across midnight
- Add dirty-tree guard (git stash) before branch checkout

learning_db_v2.py:
- Add rowcount check to mark_graduated, return bool, warn on 0 matches
- Simplify query_graduation_candidates params (direct tuple, no list)

auto-dream-cron.sh:
- Update dry-run echo to include GRADUATE

SKILL.md:
- Replace broken graduate-candidates CLI with working inline Python

tests:
- Add 8 unit tests for query_graduation_candidates covering all filters
@notque notque merged commit 5de12ae into main Apr 1, 2026
4 checks passed
@notque notque deleted the feat/adr-159-dream-graduation branch April 1, 2026 16:54
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