devflow-kit 2.5.0 → 3.0.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +44 -19
  3. package/dist/agents/git.md +13 -15
  4. package/dist/cli/commands/ambient.js +160 -145
  5. package/dist/cli/commands/capture.js +29 -55
  6. package/dist/cli/commands/compliance.js +32 -61
  7. package/dist/cli/commands/context.js +17 -32
  8. package/dist/cli/commands/debug.js +65 -26
  9. package/dist/cli/commands/flags.js +3 -3
  10. package/dist/cli/commands/hud.js +34 -10
  11. package/dist/cli/commands/init-seed.js +40 -4
  12. package/dist/cli/commands/init.js +249 -271
  13. package/dist/cli/commands/install-report.js +10 -15
  14. package/dist/cli/commands/knowledge/index.js +1 -1
  15. package/dist/cli/commands/knowledge/toggle.js +11 -3
  16. package/dist/cli/commands/learning.js +52 -37
  17. package/dist/cli/commands/legacy-hooks.js +11 -14
  18. package/dist/cli/commands/memory.js +67 -78
  19. package/dist/cli/commands/proxy.js +23 -41
  20. package/dist/cli/commands/security.js +5 -13
  21. package/dist/cli/commands/skills.js +21 -3
  22. package/dist/cli/commands/tracker.js +100 -228
  23. package/dist/cli/commands/uninstall.js +343 -138
  24. package/dist/commands/bug-analysis.md +38 -12
  25. package/dist/commands/code-review.md +70 -21
  26. package/dist/commands/debug.md +37 -7
  27. package/dist/commands/dynamic-build.md +66 -17
  28. package/dist/commands/dynamic-plan.md +19 -8
  29. package/dist/commands/dynamic-profile.md +24 -10
  30. package/dist/commands/dynamic-tickets.md +22 -11
  31. package/dist/commands/explore.md +37 -7
  32. package/dist/commands/implement.md +96 -32
  33. package/dist/commands/plan.md +62 -19
  34. package/dist/commands/release.md +2 -2
  35. package/dist/commands/research.md +34 -8
  36. package/dist/commands/resolve.md +65 -17
  37. package/dist/commands/self-review.md +45 -9
  38. package/dist/core/compliance-compose.js +27 -27
  39. package/dist/core/evidence-policy.js +240 -24
  40. package/dist/core/feature-config.js +94 -25
  41. package/dist/core/feature-switch.js +1 -1
  42. package/dist/core/flags.js +30 -2
  43. package/dist/core/fs-atomic.js +27 -0
  44. package/dist/core/hook-log-dirs.js +104 -0
  45. package/dist/core/learning-tuning-config.js +5 -3
  46. package/dist/core/ledger-root.js +102 -0
  47. package/dist/core/manifest.js +6 -4
  48. package/dist/core/mds-variants.js +34 -97
  49. package/dist/core/migrations.js +49 -23
  50. package/dist/core/plugins.js +5 -4
  51. package/dist/core/project-paths.js +0 -17
  52. package/dist/core/same-location.js +25 -0
  53. package/dist/core/tracker.js +226 -139
  54. package/dist/hud/components/config-counts.js +15 -4
  55. package/dist/hud/components/learning-counts.js +14 -0
  56. package/dist/hud/config.js +2 -1
  57. package/dist/hud/cost-history.js +2 -4
  58. package/dist/hud/git.js +52 -7
  59. package/dist/hud/index.js +7 -9
  60. package/dist/skills/git/references/pr/check-merge-readiness.md +1 -1
  61. package/dist/skills/git/references/pr/ensure-pr-ready.md +1 -1
  62. package/dist/skills/git/references/pr/update-pr-evidence.md +1 -1
  63. package/dist/skills/git/references/tracker/_mcp.md +1 -1
  64. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +1 -1
  65. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +1 -1
  66. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +2 -2
  67. package/dist/skills/git/references/tracker/github/manage-debt.md +3 -3
  68. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +1 -1
  69. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +1 -1
  70. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +2 -2
  71. package/dist/skills/git/references/tracker/jira/manage-debt.md +1 -1
  72. package/dist/skills/git/references/tracker/jira/post-wave-report.md +1 -1
  73. package/dist/skills/git/references/tracker/jira/setup-task.md +1 -1
  74. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +1 -1
  75. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +1 -1
  76. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +2 -2
  77. package/dist/skills/git/references/tracker/linear/manage-debt.md +1 -1
  78. package/dist/skills/git/references/tracker/linear/post-wave-report.md +1 -1
  79. package/dist/skills/git/references/tracker/linear/setup-task.md +1 -1
  80. package/dist/targets/claude-code/claude-paths.js +59 -57
  81. package/dist/targets/claude-code/compliance-install.js +49 -65
  82. package/dist/targets/claude-code/hooks.js +108 -3
  83. package/dist/targets/claude-code/installer.js +30 -57
  84. package/dist/targets/claude-code/post-install.js +232 -139
  85. package/dist/targets/claude-code/tracker-install.js +38 -65
  86. package/package.json +5 -4
  87. package/src/assets/agents/code.md +4 -3
  88. package/src/assets/agents/design.md +1 -0
  89. package/src/assets/agents/git.mds +55 -57
  90. package/src/assets/agents/knowledge.md +2 -2
  91. package/src/assets/agents/review.md +3 -1
  92. package/src/assets/agents/tracker.md +37 -30
  93. package/src/assets/commands/_partials/_compliance.mds +19 -1
  94. package/src/assets/commands/_partials/_decisions.mds +15 -3
  95. package/src/assets/commands/_partials/_docs_root.mds +35 -0
  96. package/src/assets/commands/_partials/_engine.mds +2 -2
  97. package/src/assets/commands/_partials/_evidence_policy.mds +3 -3
  98. package/src/assets/commands/_partials/_factory.mds +1 -1
  99. package/src/assets/commands/_partials/_knowledge.mds +27 -9
  100. package/src/assets/commands/_partials/_plan_contract.mds +2 -2
  101. package/src/assets/commands/_partials/_preamble.mds +1 -1
  102. package/src/assets/commands/_partials/_publication.mds +6 -2
  103. package/src/assets/commands/_partials/_settings.mds +28 -0
  104. package/src/assets/commands/_partials/_ticket_template.mds +3 -3
  105. package/src/assets/commands/_partials/_tracker.mds +4 -4
  106. package/src/assets/commands/_partials/_wave.mds +4 -4
  107. package/src/assets/commands/bug-analysis.mds +19 -17
  108. package/src/assets/commands/code-review.mds +39 -33
  109. package/src/assets/commands/debug.mds +4 -5
  110. package/src/assets/commands/dynamic-build.mds +75 -53
  111. package/src/assets/commands/dynamic-plan.mds +20 -15
  112. package/src/assets/commands/dynamic-profile.mds +24 -11
  113. package/src/assets/commands/dynamic-tickets.mds +25 -20
  114. package/src/assets/commands/explore.mds +4 -5
  115. package/src/assets/commands/implement.mds +58 -45
  116. package/src/assets/commands/plan.mds +34 -29
  117. package/src/assets/commands/release.md +2 -2
  118. package/src/assets/commands/research.mds +11 -9
  119. package/src/assets/commands/resolve.mds +41 -39
  120. package/src/assets/commands/self-review.mds +24 -25
  121. package/src/assets/mds/git/_pr.mds +61 -61
  122. package/src/assets/mds/git/_references.mds +19 -19
  123. package/src/assets/mds/tracker/_common.mds +8 -8
  124. package/src/assets/mds/tracker/_github.mds +71 -71
  125. package/src/assets/mds/tracker/_jira.mds +74 -74
  126. package/src/assets/mds/tracker/_linear.mds +75 -75
  127. package/src/assets/mds/tracker/_mcp.mds +23 -17
  128. package/src/assets/scripts/hooks/background-memory-update +35 -19
  129. package/src/assets/scripts/hooks/capture-prompt +18 -12
  130. package/src/assets/scripts/hooks/capture-question +18 -12
  131. package/src/assets/scripts/hooks/capture-turn +27 -17
  132. package/src/assets/scripts/hooks/debug-trace +11 -6
  133. package/src/assets/scripts/hooks/ensure-devflow-init +33 -6
  134. package/src/assets/scripts/hooks/ensure-proxy +9 -8
  135. package/src/assets/scripts/hooks/ensure-root-gitignore +111 -36
  136. package/src/assets/scripts/hooks/git-marker +48 -0
  137. package/src/assets/scripts/hooks/json-helper.cjs +6 -1
  138. package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -19
  139. package/src/assets/scripts/hooks/log-paths +80 -0
  140. package/src/assets/scripts/hooks/memory-worker +17 -15
  141. package/src/assets/scripts/hooks/pre-compact-memory +41 -16
  142. package/src/assets/scripts/hooks/queue-append +104 -30
  143. package/src/assets/scripts/hooks/resolve-project-root +101 -7
  144. package/src/assets/scripts/hooks/session-start-context +289 -122
  145. package/src/assets/scripts/hooks/session-start-memory +35 -16
  146. package/src/assets/scripts/lib/project-config.cjs +633 -0
  147. package/src/assets/scripts/resolve-evidence-policy.cjs +300 -220
  148. package/src/assets/scripts/resolve-settings.cjs +1054 -0
  149. package/src/assets/scripts/verify-evidence.cjs +1 -1
  150. package/src/assets/skills/compliance/SKILL.md +2 -2
  151. package/src/assets/skills/docs-framework/SKILL.md +6 -7
  152. package/src/assets/skills/docs-framework/references/patterns.md +10 -17
  153. package/src/assets/skills/gap-analysis/SKILL.md +2 -2
  154. package/src/assets/skills/git/references/github-api.md +9 -9
  155. package/src/assets/skills/git/references/patterns.md +1 -1
  156. package/src/assets/skills/worktree-support/SKILL.md +1 -1
  157. package/src/assets/skills/worktree-support/references/roots.md +29 -0
  158. package/src/targets/claude-code/templates/managed-settings.json +25 -9
@@ -517,7 +517,7 @@ function gh(io, args, maxBuffer) {
517
517
 
518
518
  /**
519
519
  * Every git call: `-c core.fsmonitor=false` first, so no repository-configured
520
- * hook runs, and bounded by the deadline.
520
+ * hook runs (D-NO-FSMONITOR), and bounded by the deadline.
521
521
  *
522
522
  * @param {Io} io
523
523
  * @param {readonly string[]} args
@@ -99,13 +99,13 @@ resource "aws_s3_bucket_logging" "data" { target_bucket = var.audit_bucket_id }
99
99
  | **CRITICAL** | Plaintext regulated data exposed; public IaC exposure of regulated stores |
100
100
  | **HIGH** | Missing audit trail on regulated mutations; PII in logs or errors |
101
101
  | **MEDIUM** | Missing retention/erasure paths; weak traceability (no actor/purpose) |
102
- | **LOW** | No active framework reference files installed; documentation/annotation gaps |
102
+ | **LOW** | Documentation/annotation gaps |
103
103
 
104
104
  ${DEVFLOW_COMPLIANCE_MAPPING}
105
105
 
106
106
  ## Checklist
107
107
 
108
- - [ ] Active frameworks identified from installed `references/{id}.md` files; controls applied
108
+ - [ ] Frameworks in force are the ids given (`COMPLIANCE_FRAMEWORKS`); their controls applied
109
109
  - [ ] No PII/PHI/payment data in logs, errors, or analytics events
110
110
  - [ ] Regulated data encrypted in transit (TLS 1.2+) and at rest
111
111
  - [ ] Every regulated mutation has an append-only audit entry (actor, purpose, timestamp)
@@ -117,15 +117,14 @@ TOPIC_SLUG=$(echo "$TOPIC" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed 's/[^
117
117
 
118
118
  ## Helper Functions
119
119
 
120
- Source helpers for consistent naming:
120
+ Define these inline, in the Bash call that needs them, for consistent naming. `.devflow/docs/` lives at the checkout's toplevel, never under a subdirectory the session started in:
121
121
 
122
122
  ```bash
123
- source .devflow/scripts/docs-helpers.sh 2>/dev/null || {
124
- get_timestamp() { date +%Y-%m-%d_%H%M; }
125
- get_branch_slug() { git branch --show-current 2>/dev/null | sed 's/\//-/g' || echo "standalone"; }
126
- get_topic_slug() { echo "$1" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed 's/[^a-z0-9-]//g' | cut -c1-50; }
127
- ensure_docs_dir() { mkdir -p ".devflow/docs/$1"; }
128
- }
123
+ get_timestamp() { date +%Y-%m-%d_%H%M; }
124
+ get_branch_slug() { git branch --show-current 2>/dev/null | sed 's/\//-/g' || echo "standalone"; }
125
+ get_topic_slug() { echo "$1" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed 's/[^a-z0-9-]//g' | cut -c1-50; }
126
+ get_docs_root() { git rev-parse --show-toplevel 2>/dev/null || pwd; }
127
+ ensure_docs_dir() { mkdir -p "$(get_docs_root)/.devflow/docs/$1"; }
129
128
  ```
130
129
 
131
130
  ---
@@ -150,12 +150,9 @@ Always lowercase:
150
150
 
151
151
  ## Helper Functions
152
152
 
153
- Full implementation for `.devflow/scripts/docs-helpers.sh`:
153
+ Full implementations, defined inline in the Bash call that needs them. `.devflow/docs/` lives at the checkout's toplevel, never under a subdirectory the session started in:
154
154
 
155
155
  ```bash
156
- #!/bin/bash
157
- # .devflow/scripts/docs-helpers.sh
158
-
159
156
  # Get current timestamp in standard format
160
157
  get_timestamp() {
161
158
  date +%Y-%m-%d_%H%M
@@ -182,10 +179,15 @@ get_topic_slug() {
182
179
  cut -c1-50
183
180
  }
184
181
 
182
+ # The checkout's toplevel, else the working directory outside git
183
+ get_docs_root() {
184
+ git rev-parse --show-toplevel 2>/dev/null || pwd
185
+ }
186
+
185
187
  # Ensure docs directory exists
186
188
  ensure_docs_dir() {
187
189
  local subdir="$1"
188
- mkdir -p ".devflow/docs/$subdir"
190
+ mkdir -p "$(get_docs_root)/.devflow/docs/$subdir"
189
191
  }
190
192
 
191
193
  # Get full output path for a document
@@ -193,7 +195,7 @@ get_doc_path() {
193
195
  local subdir="$1"
194
196
  local filename="$2"
195
197
  ensure_docs_dir "$subdir"
196
- echo ".devflow/docs/$subdir/$filename"
198
+ echo "$(get_docs_root)/.devflow/docs/$subdir/$filename"
197
199
  }
198
200
 
199
201
  # Create timestamped status log path
@@ -211,23 +213,14 @@ get_review_path() {
211
213
  branch_slug=$(get_branch_slug)
212
214
  timestamp=$(get_timestamp)
213
215
  ensure_docs_dir "reviews/$branch_slug/$timestamp"
214
- echo ".devflow/docs/reviews/$branch_slug/$timestamp/${focus}.md"
216
+ echo "$(get_docs_root)/.devflow/docs/reviews/$branch_slug/$timestamp/${focus}.md"
215
217
  }
216
218
  ```
217
219
 
218
220
  ### Usage Example
219
221
 
220
222
  ```bash
221
- # Source helpers
222
- source .devflow/scripts/docs-helpers.sh 2>/dev/null || {
223
- # Inline fallback if script not found
224
- get_timestamp() { date +%Y-%m-%d_%H%M; }
225
- get_branch_slug() { git branch --show-current 2>/dev/null | sed 's/\//-/g' || echo "standalone"; }
226
- get_topic_slug() { echo "$1" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed 's/[^a-z0-9-]//g' | cut -c1-50; }
227
- ensure_docs_dir() { mkdir -p ".devflow/docs/$1"; }
228
- }
229
-
230
- # Use helpers
223
+ # Define the helpers above in the same Bash call, then use them
231
224
  TIMESTAMP=$(get_timestamp)
232
225
  BRANCH_SLUG=$(get_branch_slug)
233
226
  ensure_docs_dir "reviews/$BRANCH_SLUG"
@@ -103,9 +103,9 @@ Detect ordering constraints and shared resource conflicts across issues.
103
103
 
104
104
  **Evidence trigger:** Any issue that references state, contracts, or resources that may be in flux due to another issue in the batch.
105
105
 
106
- ### 7. Compliance (when compliance skill installed)
106
+ ### 7. Compliance (when the compliance lens is on)
107
107
 
108
- Detect regulatory gaps that security doesn't cover. Active frameworks = the `references/{id}.md` files present in the installed skill. Load `devflow:compliance` before analyzing.
108
+ Detect regulatory gaps that security doesn't cover. Load `devflow:compliance` before analyzing, then `references/{id}.md` only for the ids in `COMPLIANCE_FRAMEWORKS` (`none`: generic controls only).
109
109
 
110
110
  **Detection patterns:**
111
111
  - Missing audit trails on regulated mutations — writes to financial records, PHI, PCI-scoped data without durable logging
@@ -164,7 +164,7 @@ REPO=$(echo "$REPO_INFO" | cut -d'/' -f2)
164
164
  HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid -q '.headRefOid')
165
165
 
166
166
  printf '%s\n' "$COMMENT_BODY" > "$DEVFLOW_BODY_RAW" \
167
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
167
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
168
168
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
169
169
  && gh api \
170
170
  -X POST \
@@ -224,7 +224,7 @@ fi
224
224
  git tag -a "v${VERSION}" -m "Version ${VERSION}" && git push origin "v${VERSION}"
225
225
 
226
226
  printf '%s\n' "$NOTES" > "$DEVFLOW_NOTES_RAW" \
227
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
227
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
228
228
  "$DEVFLOW_NOTES_RAW" "$DEVFLOW_NOTES" \
229
229
  && gh release create "v${VERSION}" --title "v${VERSION}" --notes-file "$DEVFLOW_NOTES"
230
230
  ```
@@ -265,7 +265,7 @@ ${changelog}"
265
265
  # The composed notes are written to the RAW file here — the scrub is what produces
266
266
  # "$DEVFLOW_NOTES", so chaining with && is what stops a scrubber failure publishing.
267
267
  printf '%s\n' "$changelog" > "$DEVFLOW_NOTES_RAW" \
268
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
268
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
269
269
  "$DEVFLOW_NOTES_RAW" "$DEVFLOW_NOTES" \
270
270
  && gh release create "v${version}" \
271
271
  --title "v${version}" \
@@ -278,7 +278,7 @@ ${changelog}"
278
278
  ```bash
279
279
  # CHANGELOG.md is the RAW input here: redact-secrets.cjs takes any input path, and
280
280
  # release notes publish like any other body, so the file that ships is the scrubbed one.
281
- node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
281
+ node "$HOME/.devflow/scripts/redact-secrets.cjs" \
282
282
  CHANGELOG.md "$DEVFLOW_NOTES" \
283
283
  && gh release create "v${VERSION}" \
284
284
  --title "v${VERSION} - ${RELEASE_TITLE}" \
@@ -320,7 +320,7 @@ generate_release_notes() {
320
320
  - [ ] Test login with valid credentials
321
321
  - [ ] Test token expiration
322
322
  EOF
323
- } && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
323
+ } && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
324
324
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
325
325
  && gh pr create --title "Add user authentication" --body-file "$DEVFLOW_BODY"
326
326
  ```
@@ -332,7 +332,7 @@ write must stop the post, not hand the scrubber whatever the RAW file last held.
332
332
 
333
333
  ```bash
334
334
  printf '%s\n' "Work in progress, not ready for review" > "$DEVFLOW_BODY_RAW" \
335
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
335
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
336
336
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
337
337
  && gh pr create --draft --title "WIP: Feature X" --body-file "$DEVFLOW_BODY"
338
338
  ```
@@ -344,7 +344,7 @@ link of its own chain — `$DEVFLOW_BODY` is the scrubber's output, not a shared
344
344
 
345
345
  ```bash
346
346
  printf '%s\n' "LGTM! Tested locally and all checks pass." > "$DEVFLOW_BODY_RAW" \
347
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
347
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
348
348
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
349
349
  && gh pr review "$PR_NUMBER" --approve --body-file "$DEVFLOW_BODY"
350
350
 
@@ -353,7 +353,7 @@ printf '%s\n' "LGTM! Tested locally and all checks pass." > "$DEVFLOW_BODY_RAW"
353
353
  1. **Security**: Input validation missing in `handleLogin`
354
354
  2. **Performance**: N+1 query in user list endpoint
355
355
  EOF
356
- } && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
356
+ } && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
357
357
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
358
358
  && gh pr review "$PR_NUMBER" --request-changes --body-file "$DEVFLOW_BODY"
359
359
  ```
@@ -659,7 +659,7 @@ fetch_review_threads() {
659
659
 
660
660
  ```bash
661
661
  printf '%s\n' "$REPLY_BODY" > "$DEVFLOW_BODY_RAW" \
662
- && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
662
+ && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
663
663
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
664
664
  && gh api graphql -f query='
665
665
  mutation($threadId: ID!, $body: String!) {
@@ -252,7 +252,7 @@ Implements JWT-based authentication...
252
252
 
253
253
  [Full description content]
254
254
  EOF
255
- } && node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/redact-secrets.cjs" \
255
+ } && node "$HOME/.devflow/scripts/redact-secrets.cjs" \
256
256
  "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" \
257
257
  && gh pr create \
258
258
  --base main \
@@ -49,7 +49,7 @@ Extract: `worktree {path}`, `HEAD {sha}`, `branch refs/heads/{name}`
49
49
 
50
50
  Exclude:
51
51
  - **Bare worktrees** (no branch)
52
- - **Detached HEAD** (no named branch)
52
+ - **Detached HEAD** (no named branch; roots and detached HEAD: `references/roots.md`)
53
53
  - **Protected branches**: `main`, `master`, `develop`, `integration`, `trunk`, `release/*`, `staging`, `production`
54
54
  - **Mid-rebase or mid-merge**: check `git -C {path} status` for "rebase in progress" or "merging"
55
55
 
@@ -0,0 +1,29 @@
1
+ # Project Roots and Detached HEAD
2
+
3
+ Where devflow keeps per-project data across checkouts, and what it does on a detached HEAD. Companion to the worktree discovery algorithm in `SKILL.md`.
4
+
5
+ ## Which Root Holds What
6
+
7
+ Devflow's per-project data does not all live in the same checkout.
8
+
9
+ | Data | Root | Why |
10
+ |------|------|-----|
11
+ | Learning ledger and queue (`.devflow/learning/`) | The main worktree, when its `.devflow/` exists and the main worktree is not HOME; else this checkout's toplevel | One ledger per repository, so ADR/PF numbers never restart or collide in a linked worktree (D-LEDGER-MAIN-WORKTREE) |
12
+ | Working memory (`.devflow/memory/`) | This checkout's toplevel | Memory describes the branch in front of you |
13
+ | Feature knowledge bases (`.devflow/features/`) | This checkout's toplevel | They are committed per branch (D-PROMPT-ROOT) |
14
+ | Personal `.devflow/config.json` | This checkout's toplevel | Per-worktree by decision: a new worktree does not inherit the source checkout's personal settings |
15
+
16
+ Hooks, loaders, the `devflow learning` CLI and the HUD resolve the root from git, never from cwd, so a session started in a subdirectory uses the repository root. Outside a git repository, and in a repository rooted at HOME, no hook creates `.devflow/` or a `.gitignore` (D-HOOKS-GIT-ONLY). A worktree that grew its own ledger before the main-worktree rule keeps it on disk; sessions there stop appending to it.
17
+
18
+ ---
19
+
20
+ ## Detached HEAD
21
+
22
+ A detached HEAD is a commit checked out without a branch (`git checkout <sha>`, `git bisect`, a rebase stop, `git worktree add --detach`, a CI checkout). Devflow treats it as follows (D-DETACHED-HEAD):
23
+
24
+ | Surface | Behaviour |
25
+ |---------|-----------|
26
+ | Knowledge commit | Skipped: a commit there becomes unreachable once HEAD moves. The Knowledge agent reports `KB_COMMIT: skipped (detached HEAD) — uncommitted: <paths>`, and the calling workflow names those paths to the user |
27
+ | Worktree discovery | Excluded from auto-review (discovery Step 3 in `SKILL.md`): there is no branch to review, compare or push |
28
+ | Memory bootstrap | The first compaction bootstraps `WORKING-MEMORY.md` stamped `branch: (detached)`, keyed on the HEAD commit; an unborn branch has no commit and still skips |
29
+ | Memory header | Renders `detached @ <short-sha>` instead of `on unknown` |
@@ -24,15 +24,16 @@
24
24
  "Bash(> /dev/nvme*)",
25
25
  "Bash(sh -c *)",
26
26
  "Bash(bash -c *)",
27
- "Bash(curl * | bash*)",
28
- "Bash(curl * | sh*)",
29
- "Bash(wget * | bash*)",
30
- "Bash(wget * | sh*)",
31
- "Bash(fetch | sh*)",
32
- "Bash(lynx -source | bash*)",
33
- "Bash(base64 -d | bash*)",
34
- "Bash(base64 -d | sh*)",
35
- "Bash(base64 --decode | bash*)",
27
+ "Bash(zsh -c *)",
28
+ "Bash(bash)",
29
+ "Bash(sh)",
30
+ "Bash(zsh)",
31
+ "Bash(bash - *)",
32
+ "Bash(sh - *)",
33
+ "Bash(zsh - *)",
34
+ "Bash(bash -s *)",
35
+ "Bash(sh -s *)",
36
+ "Bash(zsh -s *)",
36
37
  "Bash(eval *)",
37
38
  "Bash(exec *)",
38
39
  "Bash(sudo *)",
@@ -90,6 +91,21 @@
90
91
  "Bash(docker run -v /:/host*)",
91
92
  "Bash(docker run --pid=host*)",
92
93
  "Bash(docker run --net=host*)",
94
+ "Bash(docker run*--privileged*)",
95
+ "Bash(docker run*-v /:*)",
96
+ "Bash(docker run*--volume /:*)",
97
+ "Bash(docker run*--volume=/:*)",
98
+ "Bash(docker pull *)",
99
+ "Bash(docker image pull *)",
100
+ "Bash(docker rm *)",
101
+ "Bash(docker container rm *)",
102
+ "Bash(docker rmi *)",
103
+ "Bash(docker image rm *)",
104
+ "Bash(docker volume rm *)",
105
+ "Bash(docker*prune*)",
106
+ "Bash(orb *)",
107
+ "Bash(orbctl *)",
108
+ "Bash(open *OrbStack*)",
93
109
  "Bash(nsenter*)",
94
110
  "Bash(crontab*)",
95
111
  "Bash(rm /var/log*)",