omniconductor 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ Format follows [Keep a Changelog](https://keepachangelog.com/); versioning is [S
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.5.0] — 2026-07-07
9
+
10
+ ### Added
11
+ - **`git-hygiene` recipe + `stop-git-hygiene-guard` Stop hook** — opt-in shared-repo discipline (G1–G7): no unrequested worktrees, push-don't-hoard, merge=delete-branch, backup≠applied (verify by real code), no reckless force/rebase on shared repos, bundle PRs for CI, session-end hygiene check. Prevents the failure where merged work *looks* lost (orphan worktrees / local-only commit hoarding / stale merged branches) and burns reconciliation time. Recipe body installs on all six tools; the Stop-hook reminder is Claude-only (ADR-034), non-blocking, self-gated on the recipe. Recipe count **11 → 12**, hook templates **7 → 9** (the 0.3.0 `stop-trajectory-log` count was also un-synced). — **ADR-037**.
12
+
8
13
  ## [0.4.1] — 2026-07-06
9
14
 
10
15
  ### Fixed (docs)
package/README.md CHANGED
@@ -6,11 +6,11 @@ Write your project's rules, workflow, and discipline ONCE. Install into any AI c
6
6
 
7
7
  > Born from one year of production iteration at LFamily Labs — the rules, agents, hooks, and memory patterns that survived real shipping pressure.
8
8
 
9
- > **Status (v0.4.0 — 2026-07-05)**: All 6 adapters ship a working `transform.sh` — **Claude Code** (full: rules + hooks + sub-agents + per-call model routing), **Cursor**, **GitHub Copilot** (one install covers 5 IDEs), **Gemini CLI** (`GEMINI.md` + `.gemini/styleguide.md`), **Codex** (`AGENTS.md`), **Windsurf / Devin Desktop** (`.windsurfrules` + `.devin/rules/*.md`). Published to npm as [`omniconductor`](https://www.npmjs.com/package/omniconductor) (v0.4.0). Output is emit-verified (format-validator + CI on all 6); live runtime consumption by Gemini / Codex / Windsurf is adopter-pending — see [`docs/ADAPTER-LIVE-VERIFICATION.md`](./docs/ADAPTER-LIVE-VERIFICATION.md). Manual install ([`docs/MANUAL-INSTALL.md`](./docs/MANUAL-INSTALL.md)) remains a fallback.
9
+ > **Status (v0.5.0 — 2026-07-07)**: All 6 adapters ship a working `transform.sh` — **Claude Code** (full: rules + hooks + sub-agents + per-call model routing), **Cursor**, **GitHub Copilot** (one install covers 5 IDEs), **Gemini CLI** (`GEMINI.md` + `.gemini/styleguide.md`), **Codex** (`AGENTS.md`), **Windsurf / Devin Desktop** (`.windsurfrules` + `.devin/rules/*.md`). Published to npm as [`omniconductor`](https://www.npmjs.com/package/omniconductor) (v0.5.0). Output is emit-verified (format-validator + CI on all 6); live runtime consumption by Gemini / Codex / Windsurf is adopter-pending — see [`docs/ADAPTER-LIVE-VERIFICATION.md`](./docs/ADAPTER-LIVE-VERIFICATION.md). Manual install ([`docs/MANUAL-INSTALL.md`](./docs/MANUAL-INSTALL.md)) remains a fallback.
10
10
  >
11
- > **New in 0.4.0**: instruction-fidelity-first **token economy** — reduce tokens without distorting your instructions: lossless context editing before lossy compaction, an output-brevity discipline, and a new "verbose output" anti-pattern (ADR-035/036; [`docs/CONTEXT-EDITING-GUIDE.md`](./docs/CONTEXT-EDITING-GUIDE.md)). **In 0.3.0**: an opt-in **self-improvement / Reflector loop** (reads session trajectories + git and *proposes* lessons — propose-only — on all six tools; `--recipes=self-improvement`, ADR-030/032/033) + a first-party-verified **compatibility-matrix correction** (all six tools ship hooks / sub-agents / per-task model routing, retiring the old "Claude-only" view; ADR-031). Full history: [`CHANGELOG.md`](./CHANGELOG.md).
11
+ > **New in 0.5.0**: an opt-in **`git-hygiene` recipe** — shared-repo discipline (no orphan worktrees, push-don't-hoard, merge=delete-branch, backup≠applied) that stops merged work from *looking* lost; Claude adds a non-blocking Stop-hook reminder, other tools use the rule text (ADR-037). **In 0.4.0**: instruction-fidelity-first **token economy** (lossless context editing before lossy compaction + output-brevity discipline; ADR-035/036, [`docs/CONTEXT-EDITING-GUIDE.md`](./docs/CONTEXT-EDITING-GUIDE.md)). **In 0.3.0**: opt-in **self-improvement / Reflector loop** (propose-only; ADR-030/032/033) + a first-party-verified **compatibility-matrix correction** (all six tools ship hooks / sub-agents / model routing; ADR-031). Full history: [`CHANGELOG.md`](./CHANGELOG.md).
12
12
  >
13
- > Marketplace listing (VSCode Marketplace + Open VSX) remains **Phase 2** (post-0.4) — see ADR-023.
13
+ > Marketplace listing (VSCode Marketplace + Open VSX) remains **Phase 2** (post-0.5) — see ADR-023.
14
14
 
15
15
  ---
16
16
 
@@ -21,7 +21,7 @@ Write your project's rules, workflow, and discipline ONCE. Install into any AI c
21
21
  - [Tool coverage matrix](#tool-coverage-matrix)
22
22
  - [Install paths (3 options)](#install-paths)
23
23
  - [Cross-platform: Mac and Windows](#cross-platform-mac-and-windows)
24
- - [Recipes catalog (11)](#recipes-catalog)
24
+ - [Recipes catalog (12)](#recipes-catalog)
25
25
  - [`transform.sh` options reference](#transformsh-options-reference)
26
26
  - [Update / Maintenance / Uninstall](#update--maintenance--uninstall)
27
27
  - [Token measurement & KPI baseline](#token-measurement--kpi-baseline)
@@ -248,7 +248,7 @@ For tools without an adapter (Gemini / Codex / Windsurf), or for adopters in con
248
248
 
249
249
  ## Recipes catalog
250
250
 
251
- 11 opt-in recipes layer project-specific discipline on top of the 5 universal rule bundles. Universal rules always install; recipes are pick-and-mix.
251
+ 12 opt-in recipes layer project-specific discipline on top of the 5 universal rule bundles. Universal rules always install; recipes are pick-and-mix.
252
252
 
253
253
  | Recipe | Install when | Adds |
254
254
  |---|---|---|
@@ -263,6 +263,7 @@ For tools without an adapter (Gemini / Codex / Windsurf), or for adopters in con
263
263
  | `database-discipline` | Relational store + migrations + dev/prod split | Migration-first schema changes, access-control on new tables, dev/prod parity |
264
264
  | `design-system` | Design-token system in use | Tokens over raw hex, component reuse, accessibility + spacing scale adherence |
265
265
  | `self-improvement` | Want periodic, human-approved review of your sessions | A **Reflector** reads recent session trajectories + git and **proposes** lessons-learned to `docs/REFLECTION-PROPOSALS.md` (propose-only; you apply). Emits a session-end trajectory hook, a `/reflect` command, a reflector agent, a deterministic prune, and a weekly runner + scheduling guide — on all six tools. See ADR-030/032/033. |
266
+ | `git-hygiene` | Any git project — esp. multi-session/agent repos or protected branches | Shared-repo discipline (G1–G7): no unrequested worktrees, push-don't-hoard, merge=delete-branch, backup≠applied (verify by real code), no reckless force/rebase on shared repos, bundle PRs for CI, session-end hygiene check. Claude adds a non-blocking Stop-hook reminder; other tools use the rule text. See ADR-037. |
266
267
 
267
268
  #### Decision tree
268
269
 
@@ -278,6 +279,7 @@ Want root-cause debugging? YES → debugging
278
279
  Relational DB + migrations? YES → database-discipline
279
280
  Design-token system? YES → design-system
280
281
  Want weekly session self-review? YES → self-improvement
282
+ Use git (esp. shared/multi-session)? YES → git-hygiene
281
283
  ```
282
284
 
283
285
  #### Recommended combos
@@ -302,7 +304,7 @@ Usage: bash adapters/<tool>/transform.sh <target-project> [options]
302
304
  | Option | Description |
303
305
  |---|---|
304
306
  | `<target-project>` | Project directory to install into (required). `.` for current dir. |
305
- | `--recipes=A,B,C` | Comma-separated recipes from the 11 in `core/recipes/`. |
307
+ | `--recipes=A,B,C` | Comma-separated recipes from the 12 in `core/recipes/`. |
306
308
  | `--dry-run` | Preview only — no files written. |
307
309
  | `--measure-baseline` | Run `tools/measure-tokens.sh --latest` after install; save CSV; auto-show anti-patterns if cache hit < 95%. |
308
310
  | `--no-prompt` | Skip wizard, apply defaults (CI-safe). Combine with `--recipes` and `--measure-baseline` as needed. |
@@ -311,7 +313,7 @@ Usage: bash adapters/<tool>/transform.sh <target-project> [options]
311
313
  | `--force` | Bypass uninstall safety gates (active rebase/merge, missing manifest). |
312
314
  | `-h` `--help` | Print usage. |
313
315
 
314
- **Recipe names** (11): `web-mobile-parity`, `i18n`, `monorepo`, `branch-strategy`, `auto-mock-data`, `coding-conventions`, `tdd`, `debugging`, `database-discipline`, `design-system`, `self-improvement`.
316
+ **Recipe names** (12): `web-mobile-parity`, `i18n`, `monorepo`, `branch-strategy`, `auto-mock-data`, `coding-conventions`, `tdd`, `debugging`, `database-discipline`, `design-system`, `self-improvement`, `git-hygiene`.
315
317
 
316
318
  #### File overwrite behavior
317
319
 
@@ -410,7 +412,7 @@ diff CLAUDE.md.conductor-backup-* CLAUDE.md
410
412
 
411
413
  #### "recipe not found" warning
412
414
 
413
- Check recipe name spelling. Available: `web-mobile-parity`, `i18n`, `monorepo`, `branch-strategy`, `auto-mock-data`, `coding-conventions`, `tdd`, `debugging`, `database-discipline`, `design-system`, `self-improvement`.
415
+ Check recipe name spelling. Available: `web-mobile-parity`, `i18n`, `monorepo`, `branch-strategy`, `auto-mock-data`, `coding-conventions`, `tdd`, `debugging`, `database-discipline`, `design-system`, `self-improvement`, `git-hygiene`.
414
416
 
415
417
  #### "Tool doesn't recognize the new rules"
416
418
 
@@ -493,7 +495,7 @@ A: Open VSX. Cursor is a VSCode fork but cannot pull from Microsoft's marketplac
493
495
 
494
496
  **Q: My project uses Go / Python / Rust, not TypeScript.**
495
497
 
496
- A: Skip `coding-conventions` (TypeScript-specific). The 5 universal rule bundles and the other 10 recipes are stack-agnostic.
498
+ A: Skip `coding-conventions` (TypeScript-specific). The 5 universal rule bundles and the other 11 recipes are stack-agnostic.
497
499
 
498
500
  **Q: Windows native PowerShell?**
499
501
 
@@ -45,7 +45,7 @@ bash adapters/claude/transform.sh <target> [--dry-run]
45
45
  │ │ ├── quality-gates.md
46
46
  │ │ ├── operations.md
47
47
  │ │ └── meta-discipline.md
48
- │ ├── hooks/ # 7 hook scripts
48
+ │ ├── hooks/ # 9 hook scripts
49
49
  │ │ ├── pretool-agent-routing.sh
50
50
  │ │ ├── pretool-commit-current-work-check.sh
51
51
  │ │ ├── pretool-commit-test-coverage-check.sh
@@ -32,7 +32,7 @@ CONDUCTOR's universal `meta-discipline.md` rubric (token economy + model routing
32
32
 
33
33
  ## Hook execution model
34
34
 
35
- CONDUCTOR ships 7 hooks, all registered in the generated `.claude/settings.json` (written directly by `transform.sh` — there is no `settings.template.json`):
35
+ CONDUCTOR ships 9 hooks, all registered in the generated `.claude/settings.json` (written directly by `transform.sh` — there is no `settings.template.json`):
36
36
 
37
37
  | Hook | Event | Purpose |
38
38
  |---|---|---|
@@ -58,9 +58,9 @@ The Claude adapter ships a working `transform.sh`. Verified by fresh-target inst
58
58
 
59
59
  | Feature claim | Verified-by-real-install | Verification command / observation |
60
60
  |---|---|---|
61
- | `transform.sh` emits 6 roles, 5 rules, 7 hooks, settings.json, docs | ✅ | `bash adapters/claude/transform.sh <tmp>` then inspect `<tmp>/.claude/` |
61
+ | `transform.sh` emits 6 roles, 5 rules, 9 hooks, settings.json, docs | ✅ | `bash adapters/claude/transform.sh <tmp>` then inspect `<tmp>/.claude/` |
62
62
  | Sub-agent dispatch works | ✅ | `.claude/agents/{planner,builder,reviewer,helper,designer,scribe}.md` recognized by `/help` |
63
63
  | Lazy / always-loaded rules present | ✅ | `.claude/rules/{workflow,spec-as-you-go,quality-gates,operations,meta-discipline}.md` |
64
- | Hooks registered in settings.json | ✅ | `.claude/settings.json` `hooks:` block lists 4 PreToolUse + 3 Stop |
64
+ | Hooks registered in settings.json | ✅ | `.claude/settings.json` `hooks:` block lists 4 PreToolUse + 5 Stop |
65
65
  | Stop hook blocks on missing spec update | ✅ | commit code without spec → `stop-session-log-check.sh` fires |
66
66
  | Idempotent re-run | ✅ | second run reports "SKIP (exists)" for every emitted file |
@@ -31,7 +31,7 @@ core/docs-templates/specs/_example.md
31
31
  core/memory-pattern/README.md
32
32
  core/memory-pattern/EXAMPLES.md
33
33
  core/roles/*.md # 6 role personas → .claude/agents/ (planner/builder/reviewer/helper/designer/scribe)
34
- core/hooks/*.sh.template # 7 hook templates
34
+ core/hooks/*.sh.template # 9 hook templates
35
35
  adapters/claude/_native/CLAUDE.md.tpl # Claude-specific orchestrator manual template
36
36
  ```
37
37
 
@@ -70,7 +70,7 @@ Options:
70
70
  manifest are preserved.
71
71
  --force Bypass uninstall safety checks (active worktrees, missing manifest)
72
72
 
73
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
73
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
74
74
  EOF
75
75
  exit 0
76
76
  ;;
@@ -593,7 +593,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
593
593
  # 3. Select recipes
594
594
  echo ""
595
595
  echo "Available recipes:"
596
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
596
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
597
597
  printf "Select recipes (comma-separated, or leave blank for none): "
598
598
  read -r _recipe_answer
599
599
  if [ -n "$_recipe_answer" ]; then
@@ -725,7 +725,7 @@ mkdir_if_real "$TARGET_ABS/.claude/hooks"
725
725
  # read guard) emit only if their templates are present in the CONDUCTOR core/ tree, allowing the
726
726
  # adapter to remain forward-compatible with P1.7 work in progress.
727
727
  INSTALLED_HOOKS=()
728
- for hook in pretool-agent-routing stop-session-log-check stop-r6-review-check stop-cache-hit-baseline-check pretool-large-file-read-guard pretool-commit-current-work-check pretool-commit-test-coverage-check stop-trajectory-log; do
728
+ for hook in pretool-agent-routing stop-session-log-check stop-r6-review-check stop-cache-hit-baseline-check pretool-large-file-read-guard pretool-commit-current-work-check pretool-commit-test-coverage-check stop-trajectory-log stop-git-hygiene-guard; do
729
729
  src="$CORE_ROOT/hooks/$hook.sh.template"
730
730
  dest="$TARGET_ABS/.claude/hooks/$hook.sh"
731
731
  if [ ! -f "$src" ]; then
@@ -804,14 +804,15 @@ else
804
804
  { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-session-log-check.sh" },
805
805
  { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-r6-review-check.sh" },
806
806
  { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-cache-hit-baseline-check.sh" },
807
- { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-trajectory-log.sh" }
807
+ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-trajectory-log.sh" },
808
+ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-git-hygiene-guard.sh" }
808
809
  ]
809
810
  }
810
811
  ]
811
812
  }
812
813
  }
813
814
  SETTINGS_EOF
814
- log " wrote $SETTINGS_PATH ($(printf '%s' "${INSTALLED_HOOKS[*]}" | /usr/bin/wc -w | /usr/bin/tr -d ' ') hook(s) installed in .claude/hooks; settings.json registers 8 core hooks: 4 PreToolUse + 4 Stop)"
815
+ log " wrote $SETTINGS_PATH ($(printf '%s' "${INSTALLED_HOOKS[*]}" | /usr/bin/wc -w | /usr/bin/tr -d ' ') hook(s) installed in .claude/hooks; settings.json registers 9 core hooks: 4 PreToolUse + 5 Stop)"
815
816
  record_emit ".claude/settings.json" "<synthesized>" ""
816
817
  fi
817
818
 
@@ -75,7 +75,7 @@ Output (single-file Codex model):
75
75
  <target>/AGENTS.md Bundled intro + 5 universal rules + compressed workflow + recipes
76
76
  <target>/docs/*.md Universal doc templates (CURRENT_WORK, REMAINING_TASKS, ...)
77
77
 
78
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
78
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
79
79
 
80
80
  What this adapter does NOT install (per ADR-004 honesty):
81
81
  - Hook guards (CONDUCTOR emits the Reflector hook when --recipes=self-improvement, ADR-032; other guards remain Claude-only, ADR-034)
@@ -448,7 +448,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
448
448
 
449
449
  echo ""
450
450
  echo "Available recipes:"
451
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
451
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
452
452
  printf "Select recipes (comma-separated, or leave blank for none): "
453
453
  read -r _recipe_answer
454
454
  if [ -n "$_recipe_answer" ]; then
@@ -87,7 +87,7 @@ Options:
87
87
  Conductor-emitted files when none.
88
88
  --force Bypass uninstall safety checks (active worktrees, missing manifest)
89
89
 
90
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
90
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
91
91
 
92
92
  Output (default):
93
93
  <target>/.github/copilot-instructions.md (5 universal rules merged)
@@ -523,7 +523,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
523
523
 
524
524
  echo ""
525
525
  echo "Available recipes:"
526
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
526
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
527
527
  printf "Select recipes (comma-separated, blank for none): "
528
528
  read -r _recipe_answer
529
529
  if [ -n "$_recipe_answer" ]; then
@@ -67,7 +67,7 @@ Options:
67
67
  manifest are preserved.
68
68
  --force Bypass uninstall safety checks (active worktrees, missing manifest)
69
69
 
70
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
70
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
71
71
 
72
72
  What this adapter does NOT install (per ADR-004 honesty + ADR-021):
73
73
  - Hook guards (CONDUCTOR emits the Reflector hook when --recipes=self-improvement, ADR-032; other guards remain Claude-only, ADR-034)
@@ -490,7 +490,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
490
490
 
491
491
  echo ""
492
492
  echo "Available recipes:"
493
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
493
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
494
494
  printf "Select recipes (comma-separated, or leave blank for none): "
495
495
  read -r _recipe_answer
496
496
  if [ -n "$_recipe_answer" ]; then
@@ -71,7 +71,7 @@ Options:
71
71
  manifest are preserved.
72
72
  --force Bypass uninstall safety checks (active worktrees, missing manifest)
73
73
 
74
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
74
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
75
75
 
76
76
  Gemini single-file model:
77
77
  - All 5 universal rules + selected recipes are bundled into one always-loaded GEMINI.md.
@@ -486,7 +486,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
486
486
 
487
487
  echo ""
488
488
  echo "Available recipes:"
489
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
489
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
490
490
  printf "Select recipes (comma-separated, or leave blank for none): "
491
491
  read -r _recipe_answer
492
492
  if [ -n "$_recipe_answer" ]; then
@@ -67,7 +67,7 @@ Options:
67
67
  manifest are preserved.
68
68
  --force Bypass uninstall safety checks (active worktrees, missing manifest)
69
69
 
70
- Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement
70
+ Recipes available: web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene
71
71
 
72
72
  What this adapter does NOT install (per ADR-004 honesty + ADR-021):
73
73
  - Hook guards (CONDUCTOR emits the Reflector hook when --recipes=self-improvement, ADR-032; other guards remain Claude-only, ADR-034)
@@ -453,7 +453,7 @@ if [ "$IS_ADOPTER_CASE" = "true" ] && [ "$NO_PROMPT" = "false" ] && [ "$DRY_RUN"
453
453
 
454
454
  echo ""
455
455
  echo "Available recipes:"
456
- echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement"
456
+ echo " web-mobile-parity, i18n, monorepo, branch-strategy, auto-mock-data, coding-conventions, tdd, debugging, database-discipline, design-system, self-improvement, git-hygiene"
457
457
  printf "Select recipes (comma-separated, or leave blank for none): "
458
458
  read -r _recipe_answer
459
459
  if [ -n "$_recipe_answer" ]; then
@@ -14,6 +14,7 @@ CONDUCTOR's universal hook spec. Templates here are compiled into native shell s
14
14
  | `stop-r6-review-check.sh.template` | Session stop event | Remind to run pre-merge review on open PR | Claude `.claude/hooks/stop-r6-review-check.sh` |
15
15
  | `stop-cache-hit-baseline-check.sh.template` | Session stop event | Non-blocking diagnostic — reads the latest session JSONL, computes cache hit rate, reminds when below baseline (token-economy). Fail-open. Override env disables: `CONDUCTOR_SKIP_CACHE_CHECK=1`. | Claude `.claude/hooks/stop-cache-hit-baseline-check.sh` |
16
16
  | `stop-trajectory-log.sh.template` | Session stop event | Non-blocking — reads `transcript_path` + `session_id` from the Stop hook's **stdin** (exact provenance; no `~/.claude/projects` dir-scan) and **upserts** one pointer record per session (session id, transcript path, git HEAD, cwd) into `.conductor/trajectories/index.jsonl` for the Reflector (recipes/self-improvement.md). Same stdin approach as the non-Claude portable logger `core/reflector/trajectory-log.sh`. **Opt-in gated: no-ops unless `.conductor/reflect/` exists** (created only by the self-improvement recipe). Anchors to the project root; fail-open. Override: `CONDUCTOR_SKIP_TRAJLOG=1`. | Claude `.claude/hooks/stop-trajectory-log.sh` |
17
+ | `stop-git-hygiene-guard.sh.template` | Session stop event | Non-blocking — detects git-hygiene collapse (extra worktrees, local-only commits not on any remote, abnormally many local branches) and injects a cleanup reminder per `recipes/git-hygiene.md` (G1/G2/G3/G7). **Opt-in gated: no-ops unless `.claude/rules/git-hygiene.md` exists** (created only by the git-hygiene recipe). Anchors to the project root; 15-min cool-down; fail-open, always exits 0. Overrides: `CONDUCTOR_SKIP_GIT_HYGIENE=1`, `CONDUCTOR_GIT_HYGIENE_BRANCH_MAX` (default 20). | Claude `.claude/hooks/stop-git-hygiene-guard.sh` |
17
18
 
18
19
  The two `pretool-commit-*` templates are **soft `ask` warns**: they emit
19
20
  `{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask","permissionDecisionReason":...}}`,
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # CONDUCTOR universal hook template
4
+ # hook_id: stop-git-hygiene-guard
5
+ # trigger: stop
6
+ # action: On session stop, detect git-hygiene-collapse states (orphan worktrees,
7
+ # local-only commits, abnormally many local branches) and inject a
8
+ # non-blocking cleanup reminder per the git-hygiene recipe (G1/G2/G3/G7).
9
+ # compile_targets: claude
10
+ # fallback: rule-text-reminder
11
+ #
12
+ # Generated by adapters/<tool>/transform.sh.
13
+ #
14
+ # Enforces:
15
+ # - recipes/git-hygiene.md (session-end hygiene: G1 worktrees, G2 push, G3 delete)
16
+ #
17
+ # Behavior (fail-open, non-blocking):
18
+ # 1. No-op unless the git-hygiene recipe is installed (self-gate on
19
+ # .claude/rules/git-hygiene.md) — the guard ships with every Claude install
20
+ # but only acts for adopters who opted into the recipe.
21
+ # 2. Reminder only. Emits {"decision":"block","reason":...} to surface the state
22
+ # to Claude; ALWAYS exits 0. Never hard-fails, never blocks session stop.
23
+ # 3. Cools down (one reminder / 15 min) so it does not nag.
24
+ #
25
+ # Detects the states that make merged work look lost and burn reconciliation time:
26
+ # - worktrees beyond the main tree (G1),
27
+ # - local commits not on any remote (`git log --branches --not --remotes`) (G2),
28
+ # - abnormally high local branch count = merged branches never deleted (G3).
29
+ #
30
+ # Overrides (read at runtime, not compile-time placeholders):
31
+ # CONDUCTOR_SKIP_GIT_HYGIENE=1 silence for a deliberate transient state
32
+ # CONDUCTOR_GIT_HYGIENE_BRANCH_MAX local-branch threshold (default 20)
33
+
34
+ set -u
35
+
36
+ [ "${CONDUCTOR_SKIP_GIT_HYGIENE:-}" = "1" ] && exit 0
37
+
38
+ # Anchor to the project root. The emitted hook lives at <project>/.claude/hooks/,
39
+ # so ../.. is the root — resolves the recipe gate + git checks regardless of cwd.
40
+ _self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)" || exit 0
41
+ _proj_root="$(cd "$_self_dir/../.." 2>/dev/null && pwd)" || exit 0
42
+ cd "$_proj_root" || exit 0
43
+
44
+ # Self-gate: only act when the git-hygiene recipe is installed.
45
+ [ -f ".claude/rules/git-hygiene.md" ] || exit 0
46
+
47
+ # Not a git repo → nothing to check.
48
+ git rev-parse --git-dir >/dev/null 2>&1 || exit 0
49
+
50
+ BRANCH_MAX="${CONDUCTOR_GIT_HYGIENE_BRANCH_MAX:-20}"
51
+
52
+ # (1) Worktrees beyond the main tree.
53
+ WT_COUNT="$(git worktree list 2>/dev/null | /usr/bin/grep -c . )"
54
+ [ -n "$WT_COUNT" ] || WT_COUNT=1
55
+ WT_EXTRA=$((WT_COUNT - 1))
56
+
57
+ # (2) Local commits not on any remote (unpushed = at-risk / phantom-lost).
58
+ LOCAL_ONLY="$(git log --branches --not --remotes --oneline 2>/dev/null | /usr/bin/grep -c . )"
59
+ [ -n "$LOCAL_ONLY" ] || LOCAL_ONLY=0
60
+
61
+ # (3) Local branch count (merged branches never deleted accumulate here).
62
+ BRANCHES="$(git for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null | /usr/bin/grep -c . )"
63
+ [ -n "$BRANCHES" ] || BRANCHES=0
64
+
65
+ # Nothing wrong → allow stop silently.
66
+ if [ "$WT_EXTRA" -le 0 ] && [ "$LOCAL_ONLY" -le 0 ] && [ "$BRANCHES" -le "$BRANCH_MAX" ]; then
67
+ exit 0
68
+ fi
69
+
70
+ # Cool-down: at most one reminder per 15 min.
71
+ FLAG="/tmp/conductor-git-hygiene-flag-${USER:-unknown}"
72
+ if [ -f "$FLAG" ]; then
73
+ LAST="$(/bin/cat "$FLAG" 2>/dev/null || echo 0)"
74
+ NOW="$(/bin/date +%s 2>/dev/null || echo 0)"
75
+ if [ "$((NOW - LAST))" -lt 900 ]; then
76
+ exit 0
77
+ fi
78
+ fi
79
+ /bin/date +%s > "$FLAG" 2>/dev/null || true
80
+
81
+ MSGS=""
82
+ [ "$WT_EXTRA" -gt 0 ] && MSGS="${MSGS}${WT_EXTRA} extra git worktree(s) present (G1: remove unless a requested worktree is mid-use). "
83
+ [ "$LOCAL_ONLY" -gt 0 ] && MSGS="${MSGS}${LOCAL_ONLY} local-only commit(s) not on any remote (G2: push them — this is exactly the 'phantom lost/unmerged feature' state). "
84
+ [ "$BRANCHES" -gt "$BRANCH_MAX" ] && MSGS="${MSGS}${BRANCHES} local branches (G3: delete branches whose PRs merged, local+remote). "
85
+
86
+ /bin/cat <<JSON
87
+ {"decision":"block","reason":"[git-hygiene] ${MSGS}Before ending: run 'git worktree list' + 'git log --branches --not --remotes --oneline' and clean up per the git-hygiene recipe (push local-only work, remove orphan worktrees, delete merged branches). Backup != applied: verify features are on the target branch by real code, not by a backup branch. (Set CONDUCTOR_SKIP_GIT_HYGIENE=1 to silence a deliberate transient state.)"}
88
+ JSON
89
+ exit 0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Per ADR-013, CONDUCTOR ships project-specific recipes as OPT-IN. They are not loaded by default. Adopters select the recipes that match their project and the adapter wires them into the appropriate native location.
4
4
 
5
- ## The 11 recipes
5
+ ## The 12 recipes
6
6
 
7
7
  | File | When to install |
8
8
  |---|---|
@@ -17,6 +17,7 @@ Per ADR-013, CONDUCTOR ships project-specific recipes as OPT-IN. They are not lo
17
17
  | `database-discipline.md` | Project has a relational store with migrations + dev/prod split. Ships 2 recipe-scoped hookify rules (SQL access-control + SECURITY DEFINER search_path) — see ADR-028 |
18
18
  | `design-system.md` | Project maintains a design-token system (color/spacing/typography tokens). Ships 1 recipe-scoped hookify rule (raw-hex-instead-of-token) — see ADR-028 |
19
19
  | `self-improvement.md` | Project wants a periodic, human-approved Reflector that distils session lessons into memory/rules. Propose-only; nothing auto-applies. Drives the `reflector` role — see ADR-030 |
20
+ | `git-hygiene.md` | Any git project — esp. repos worked by multiple sessions/agents or with protected branches. Shared-repo discipline (no orphan worktrees, push-don't-hoard, merge=delete-branch, backup≠applied). Ships a Claude-only Stop-hook reminder (`stop-git-hygiene-guard`); other tools use the rule text — see ADR-037 |
20
21
 
21
22
  ## Selection patterns
22
23
 
@@ -27,7 +28,8 @@ Per ADR-013, CONDUCTOR ships project-specific recipes as OPT-IN. They are not lo
27
28
  | Multi-locale SaaS | `i18n` + `coding-conventions` + `tdd` + `debugging` |
28
29
  | Relational-DB-backed SaaS (migrations + dev/prod) | `database-discipline` + `coding-conventions` + `tdd` + `debugging` |
29
30
  | Token-driven design system (theming / dark-mode) | `design-system` + `coding-conventions` + `tdd` + `debugging` |
30
- | Full-stack SaaS with web + mobile + i18n | All 11 |
31
+ | Full-stack SaaS with web + mobile + i18n | All 12 |
32
+ | Any git repo, esp. shared / multi-session | add `git-hygiene` to any of the above |
31
33
  | Greenfield experiment | None — universal-rules + roles only is enough |
32
34
 
33
35
  ## How adapters consume these files
@@ -0,0 +1,60 @@
1
+ ---
2
+ recipe_id: git-hygiene
3
+ recipe_name: "Git Hygiene / Shared-Repo Discipline"
4
+ applies_when: "any git project — especially repos worked by multiple sessions/agents or with protected branches"
5
+ severity: STRONG (when installed)
6
+ linked_rules:
7
+ - operations
8
+ - quality-gates
9
+ - meta-discipline
10
+ ---
11
+
12
+ # Recipe — Git Hygiene / Shared-Repo Discipline
13
+
14
+ > Opt-in recipe. Install for any project under git — strongly recommended when more than one session/agent may touch the repo, or when it has protected branches. It codifies the workflow-hygiene habits that stop *completed* work from *looking* lost. Install if you have ever spent time reconciling "where did my feature go" — you likely will again without it.
15
+
16
+ ## Why this exists
17
+
18
+ Left undisciplined, an agent can turn a healthy repo into one where merged work looks stranded: it spins up `git worktree`s nobody asked for and never cleans them up, hoards commits locally instead of pushing, and never deletes branches after their PRs merge. The classic collapse — dozens of stale local branches, a pile of local-only commits, orphan worktrees — loses *nothing* (it's all merged), but it makes finished work read as **unmerged / lost**, triggers a false "it's only backed up, not applied" scramble, and burns large reconciliation time and trust. Prose alone gets forgotten, so this recipe is backed by a Claude Stop hook (below).
19
+
20
+ ## The 7 obligations
21
+
22
+ ### G1 — No worktrees unless explicitly requested
23
+ The default work model is **normal branches in the single working tree**. Reach for `git worktree` only when the user explicitly asks, or a documented isolation need exists. If you create one, **remove it in the same session** (`git worktree remove`) and delete its branch. An orphan worktree's uncommitted/unpushed work reads as a phantom "lost / unmerged feature" to the next actor.
24
+
25
+ ### G2 — Push, never hoard
26
+ The moment a commit is worth keeping, push it to a **named branch on origin**. Do not accumulate local-only commits. Invariant: at session end `git log --branches --not --remotes` is **empty**. Local-only piles are the direct cause of "unpushed/lost feature" panics and the cost of later diffing what is *actually* missing.
27
+
28
+ ### G3 — Merge means delete
29
+ When a PR merges, immediately delete that branch **both local and remote** (`git branch -d/-D` + `git push origin --delete`). Stale pointers — especially a pre-squash local pointer left after a squash-merge — masquerade as an "unmerged feature" and are the #1 source of the illusion.
30
+
31
+ ### G4 — Backup ≠ applied
32
+ Pushing to an isolated/backup branch is **not** integration. "It's backed up" and "the feature is on the target branch / live" are separate claims. Verify a feature is on your integration/target branch by reading the **actual code** there (file / symbol / value grep), never by the existence of a backup branch. This is `quality-gates.md` Q4 (verify-after-changes) applied to git: a backup is a safety net, never a completion verdict.
33
+
34
+ ### G5 — No reckless branch ops on a shared repo
35
+ No force-push / rebase / reset / branch-move / protected-branch rewrite that a concurrent session or another actor might be building on. Minimize branch churn; when a branch operation's scope or reversibility is unclear, ASK (`meta-discipline.md` AMB-3/AMB-4 — non-trivially-reversible ops and protected-branch writes force ASK). **Another session's uncommitted/unpushed work is inviolable** — back it up and surface it, but never merge/delete/rewrite it on your own judgment.
36
+
37
+ ### G6 — Bundle PRs (CI economy)
38
+ Bundle related work into as few PRs as reasonable — CI runs per PR and free-tier minutes are finite. Do not fragment one change into many PRs that each re-consume CI, and do not push docs-only commits mid-review that re-trigger the whole pipeline. Verify locally before the single push so the one CI run passes first try.
39
+
40
+ ### G7 — Session-end hygiene check
41
+ Before finishing a session: **0 orphan worktrees · 0 local-only commits (all on origin) · merged branches deleted · current branch + working-tree state clear.**
42
+
43
+ - [ ] `git worktree list` → only the main tree (unless a requested worktree is still mid-use)?
44
+ - [ ] `git log --branches --not --remotes --oneline` → empty?
45
+ - [ ] Merged PR branches deleted (local + remote)?
46
+ - [ ] Not sitting on a stale/behind branch that hides completed work?
47
+
48
+ ## Conductor Integration
49
+
50
+ - **Claude** — a Stop hook `stop-git-hygiene-guard` (from `core/hooks/`) fires a **non-blocking reminder** when it detects the collapse states: extra worktrees, local-only commits, or an abnormally high local-branch count. It always exits 0 (observation only, never blocks a session), self-gates on this recipe being installed, cools down between reminders, and honors `CONDUCTOR_SKIP_GIT_HYGIENE=1` (silence) and `CONDUCTOR_GIT_HYGIENE_BRANCH_MAX` (branch-count threshold, default 20).
51
+ - **Cursor / Copilot / Gemini / Codex / Windsurf** — the hook is Claude-only (per `docs/DESIGN-DECISIONS.md` ADR-034; Windsurf also lacks Stop-style events). On these tools this recipe's rule text is the enforcement: run the G7 checklist manually at session end.
52
+ - **Target branch** — G2/G3/G4 reference your *integration/target branch* (commonly `main`, or `develop` if you also install the `branch-strategy` recipe). Substitute your project's value.
53
+
54
+ ## Cross-References
55
+
56
+ - `quality-gates.md` §4 (verify-after-changes) — G4's "verify by real code, not by a backup branch."
57
+ - `meta-discipline.md` §3 (AMB-3/AMB-4) — G5's ASK-before-reckless-branch-op gate.
58
+ - `meta-discipline.md` §5.7 (lossless-before-lossy compaction) — the *uncommitted-durability* layer beneath G2's *unpushed-hygiene* layer; complementary.
59
+ - `branch-strategy.md` recipe — defines the target/integration branch model G2–G4 build on.
60
+ - `core/anti-patterns/frequent-rule-file-edit.md` — G6's "don't re-trigger CI with churn" echoes the cost-of-churn principle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omniconductor",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Multi-coding-agent workflow framework. Write your project's rules, workflow, and discipline ONCE — install into Claude Code, Cursor, GitHub Copilot, Gemini CLI, Codex, or Windsurf. Encodes the discipline developers most often skip — spec-before-code, review gates, session continuity — so your AI agents catch what's easy to miss.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "LFamily Labs LLC",