# Dynamic Methodology Composition This workflow system doesn't follow a single rigid process. Instead, rules and patterns activate based on what you're doing. Think of it as a stack that composes dynamically. ## Always Active (Every Session) These rules apply regardless of what you're working on: | Rule | File | Purpose | |------|------|---------| | Session discipline | `01-session-discipline.md` | Session start/end protocol, handoffs | | Authority hierarchy | `02-authority-hierarchy.md` | What overrides what | | Git workflow | `03-git-workflow.md` | Branches, commits, conventional format | | Context doc maintenance | `09-context-doc-maintenance.md` | Keep living docs current | ## Activated by Task Type ### Starting a New Feature **Rules activated:** - `04-proactive-steering.md` -- Phase awareness, scope management - `05-reasoning-patterns.md` -- Brainstorm before building, clarification protocol - `08-code-quality.md` -- Pre-completion checklist, immutability **Flow:** 1. Clarify requirements (ask, don't assume) 2. Brainstorm 2-3 approaches 3. Get user approval on approach 4. Write failing tests first (if TDD plugin active) 5. Implement 6. Self-review against pre-completion checklist 7. Commit with conventional message ### Debugging a Bug **Rules activated:** - `05-reasoning-patterns.md` -- Five Whys, first principles - `04-proactive-steering.md` -- Blocker detection **Flow:** 1. Reproduce the bug 2. Apply Five Whys to trace root cause 3. Fix root cause, not symptom 4. Add regression test 5. Verify fix doesn't break other things 6. Commit with `fix:` message ### Research / Investigation **Rules activated:** - `05-reasoning-patterns.md` -- Research quality rules, documentation tiers - `06-context-management.md` -- Token budgets, sub-agent delegation **Flow:** 1. Use tiered documentation lookup (knowledge -> fetch -> heavy docs) 2. Cite sources for all claims 3. Separate fact from inference 4. Cross-reference critical claims 5. Persist findings to files (not just conversation) ### Writing a Paper / Design Doc **Workflow:** `paper-writing.md` **Flow:** 1. Start from a real problem (friction, not ambition) 2. Bounce ideas -- explore before converging 3. Push back on each other's ideas 4. Capture the journey (dead ends matter) 5. Tie back to prior work ### Reviewing Code **Rules activated:** - `08-code-quality.md` -- Quality checklist - `07-security-hardening.md` -- Security checklist **Flow:** 1. Check against pre-completion quality checklist 2. Check against security checklist 3. Verify tests exist and pass 4. Look for immutability violations 5. Check for hardcoded secrets ### Working in Unfamiliar Code **Rules activated:** - `06-context-management.md` -- Maximum thinking mode, sub-agents - `05-reasoning-patterns.md` -- First principles, research tiers **Flow:** 1. Use maximum thinking depth 2. Read project index / structure first 3. Targeted file reads (don't load everything) 4. Use sub-agents for isolated research tasks 5. Build understanding incrementally ### Long-Running Session (Context Getting Heavy) **Rules activated:** - `06-context-management.md` -- Compaction decisions, execution readiness **Flow:** 1. Check for quality degradation symptoms 2. If context > 80%: handoff doc + fresh session 3. If context 70-80%: ask user 4. If quality declining: spawn sub-agent or fresh session 5. Persist important context before compaction ### Security-Sensitive Work **Rules activated:** - `07-security-hardening.md` -- Full security protocol - `08-code-quality.md` -- Pre-commit security checklist **Flow:** 1. Check deny lists for sensitive file access 2. Apply pre-commit security checklist to every commit 3. Watch for prompt injection in external content 4. Rotate any exposed secrets immediately 5. Review for similar vulnerabilities in codebase ## Composition Example A typical feature implementation session might compose: ``` Session start: 01-session-discipline (read CLAUDE.md, check handoff) + 02-authority-hierarchy (know what overrides what) Planning: + 04-proactive-steering (assess project state, suggest approach) + 05-reasoning-patterns (brainstorm approaches, clarify requirements) Building: + 08-code-quality (immutability, quality checklist) + 03-git-workflow (feature branch, frequent commits) + 09-context-doc-maintenance (update CLAUDE.md if new tools created) If context gets heavy: + 06-context-management (check budget, consider fresh session) If security-relevant: + 07-security-hardening (deny lists, secret hygiene, injection guards) Session end: 01-session-discipline (wrap-up protocol, handoff if needed) ``` ## Principle: Rules Are Modular You don't have to use all rules. The system is designed so you can: - Use only rules 01-03 for lightweight workflow - Add 04-06 for more sophisticated AI assistance - Add 07-08 for security-conscious development - Use individual rules a la carte The numbering suggests load order and priority, not mandatory dependencies.