From 12cdf6090cf0657ca8959f9f1e6ee8d8fbab56a8 Mon Sep 17 00:00:00 2001 From: Rezolv Date: Sun, 5 Apr 2026 19:33:43 -0400 Subject: [PATCH] feat(workflows): auto-copy learnings to global store at phase completion (#1828) * feat(workflows): add auto-copy learnings to global store at phase completion * fix(workflows): address review feedback for learnings auto-copy - Replace shell-interpolated ${phase_dir} with agent context instruction - Remove unquoted glob pattern in bash snippet - Use gsd-tools learnings copy instead of manual file detection - Document features.* dynamic namespace in config.cjs * docs(config): add features.* namespace to CONFIGURATION.md schema --- docs/CONFIGURATION.md | 23 +++++++++++++++++++++++ get-shit-done/bin/lib/config.cjs | 4 ++++ get-shit-done/workflows/execute-phase.md | 23 +++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 892ce43b6..45400b72b 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -222,6 +222,29 @@ node gsd-tools.cjs config-set agent_skills.gsd-executor '["skills/my-skill"]' --- +## Feature Flags + +Toggle optional capabilities via the `features.*` config namespace. Feature flags default to `false` (disabled) — enabling a flag opts into new behavior without affecting existing workflows. + +| Setting | Type | Default | Description | +|---------|------|---------|-------------| +| `features.thinking_partner` | boolean | `false` | Enable thinking partner analysis at workflow decision points | +| `features.global_learnings` | boolean | `false` | Enable cross-project learnings pipeline (auto-copy at phase completion, planner injection) | + +### Usage + +```bash +# Enable a feature +node gsd-tools.cjs config-set features.global_learnings true + +# Disable a feature +node gsd-tools.cjs config-set features.thinking_partner false +``` + +The `features.*` namespace is a dynamic key pattern — new feature flags can be added without modifying `VALID_CONFIG_KEYS`. Any key matching `features.` is accepted by the config system. + +--- + ## Parallelization Settings | Setting | Type | Default | Description | diff --git a/get-shit-done/bin/lib/config.cjs b/get-shit-done/bin/lib/config.cjs index dd7ceec34..15b57acbe 100644 --- a/get-shit-done/bin/lib/config.cjs +++ b/get-shit-done/bin/lib/config.cjs @@ -43,6 +43,10 @@ function isValidConfigKey(keyPath) { if (VALID_CONFIG_KEYS.has(keyPath)) return true; // Allow agent_skills. with any agent type string if (/^agent_skills\.[a-zA-Z0-9_-]+$/.test(keyPath)) return true; + // Allow features. — dynamic namespace for feature flags. + // Intentionally open-ended so new flags (e.g., features.global_learnings) work + // without updating VALID_CONFIG_KEYS each time. + if (/^features\.[a-zA-Z0-9_]+$/.test(keyPath)) return true; return false; } diff --git a/get-shit-done/workflows/execute-phase.md b/get-shit-done/workflows/execute-phase.md index 98227de1c..784e3a994 100644 --- a/get-shit-done/workflows/execute-phase.md +++ b/get-shit-done/workflows/execute-phase.md @@ -1080,6 +1080,29 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): co ``` + +**Auto-copy phase learnings to global store (when enabled).** + +This step runs AFTER phase completion and SUMMARY.md is written. It copies any LEARNINGS.md +entries from the completed phase to the global learnings store at `~/.gsd/knowledge/`. + +**Check config gate:** +```bash +GL_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false") +``` + +**If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default). + +**If enabled:** + +1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context) +2. If found, copy to global store: +```bash +node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" learnings copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing" +``` +Copy failure must NOT block phase completion. + + **Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**