forgedock 1.0.5 → 1.0.6

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.
@@ -65,6 +65,134 @@ gh api repos/{GH_REPO}/issues/{NUMBER}/comments \
65
65
 
66
66
  ---
67
67
 
68
+ ## Phase A0: Read Custom Instructions and Project Conventions
69
+
70
+ Read project-resident authoritative docs **before** any code path tracing. `project/custom-instructions.md` has the highest precedence of all knowledge sources — its directives are BINDING and override agent defaults, training knowledge, and all other context. Other applicable `project/*.md` files provide authoritative project conventions the architect must enforce.
71
+
72
+ **Time budget**: 30 seconds. If exceeded, log a skip note and continue to Phase A1.
73
+
74
+ **Skip if**: `{REPO_PATH}` is not set, devdocs path does not exist, or path contains no markdown files.
75
+
76
+ ### Step 0: Resolve devdocs path
77
+
78
+ Read `forge.yaml → devdocs.path` from the project root. Default to `devdocs` if the key is absent or unreadable.
79
+
80
+ ```bash
81
+ DEVDOCS_PATH=""
82
+
83
+ FORGE_YAML_PATH="{REPO_PATH}/forge.yaml"
84
+
85
+ if [ -f "$FORGE_YAML_PATH" ]; then
86
+ DEVDOCS_REL=$(grep -A5 '^devdocs:' "$FORGE_YAML_PATH" \
87
+ | grep '^\s*path:' \
88
+ | head -1 \
89
+ | sed 's/.*path:\s*//' \
90
+ | tr -d '"'"'"' \
91
+ | tr -d '[:space:]')
92
+ fi
93
+
94
+ DEVDOCS_REL="${DEVDOCS_REL:-devdocs}"
95
+ DEVDOCS_PATH="{REPO_PATH}/${DEVDOCS_REL}"
96
+
97
+ if [ ! -d "$DEVDOCS_PATH" ]; then
98
+ echo "Devdocs path '${DEVDOCS_PATH}' does not exist — skipping Phase A0 (no blocking)"
99
+ DEVDOCS_PATH=""
100
+ fi
101
+ ```
102
+
103
+ > **Note**: `devdocs/` must be tracked in git for the worktree to contain it. If the project gitignores `devdocs/`, the path will not exist in the worktree and this phase silently skips — this is by design. Run `git check-ignore -v devdocs/` to confirm tracking status.
104
+
105
+ ### Step 1: Priority read — custom instructions (HIGHEST PRECEDENCE)
106
+
107
+ Always read `project/custom-instructions.md` first if it exists. Directives in this file are BINDING — they override everything else.
108
+
109
+ ```bash
110
+ CUSTOM_INSTRUCTIONS=""
111
+
112
+ if [ -n "$DEVDOCS_PATH" ]; then
113
+ CUSTOM_INSTRUCTIONS_FILE="${DEVDOCS_PATH}/project/custom-instructions.md"
114
+ if [ -f "$CUSTOM_INSTRUCTIONS_FILE" ]; then
115
+ TOTAL_LINES=$(wc -l < "$CUSTOM_INSTRUCTIONS_FILE" 2>/dev/null || echo 0)
116
+ if [ "$TOTAL_LINES" -gt 200 ]; then
117
+ CUSTOM_INSTRUCTIONS=$(head -200 "$CUSTOM_INSTRUCTIONS_FILE")
118
+ CUSTOM_INSTRUCTIONS="${CUSTOM_INSTRUCTIONS}
119
+
120
+ _[Truncated at 200 lines — ${TOTAL_LINES} total. Read full file for complete directives.]_"
121
+ else
122
+ CUSTOM_INSTRUCTIONS=$(cat "$CUSTOM_INSTRUCTIONS_FILE")
123
+ fi
124
+ fi
125
+ fi
126
+ ```
127
+
128
+ ### Step 2: Secondary reads — other applicable project files
129
+
130
+ Read all other `*.md` files under `DEVDOCS_PATH` where `applies_to` contains `work-on`. Skip `project/custom-instructions.md` (already read). Sort by authority (`required` first).
131
+
132
+ ```bash
133
+ PROJECT_CONVENTIONS=""
134
+
135
+ if [ -n "$DEVDOCS_PATH" ]; then
136
+ APPLICABLE_FILES=""
137
+
138
+ while IFS= read -r -d '' mdfile; do
139
+ # Skip custom-instructions — already read as priority
140
+ [ "$mdfile" = "${DEVDOCS_PATH}/project/custom-instructions.md" ] && continue
141
+
142
+ FRONTMATTER=$(awk '/^---/{c++; if(c==1){next} if(c==2){exit}} c==1{print}' "$mdfile" 2>/dev/null)
143
+
144
+ if echo "$FRONTMATTER" | grep -q 'applies_to:.*work-on'; then
145
+ AUTHORITY=$(echo "$FRONTMATTER" | grep 'authority:' | head -1 | sed 's/.*authority:\s*//' | tr -d ' ')
146
+ case "$AUTHORITY" in
147
+ required) SORT_KEY="1" ;;
148
+ recommended) SORT_KEY="2" ;;
149
+ *) SORT_KEY="3" ;;
150
+ esac
151
+ APPLICABLE_FILES="${APPLICABLE_FILES}${SORT_KEY}|${mdfile}\n"
152
+ fi
153
+ done < <(find "$DEVDOCS_PATH" -name "*.md" -print0 2>/dev/null)
154
+
155
+ APPLICABLE_FILES=$(printf "$APPLICABLE_FILES" | sort | cut -d'|' -f2-)
156
+
157
+ while IFS= read -r mdfile; do
158
+ [ -z "$mdfile" ] && continue
159
+ TOTAL_LINES=$(wc -l < "$mdfile" 2>/dev/null || echo 0)
160
+ if [ "$TOTAL_LINES" -gt 200 ]; then
161
+ FILE_CONTENT=$(head -200 "$mdfile")
162
+ TRUNCATION_NOTE="_[Truncated at 200 lines — ${TOTAL_LINES} total.]_"
163
+ else
164
+ FILE_CONTENT=$(cat "$mdfile")
165
+ TRUNCATION_NOTE=""
166
+ fi
167
+
168
+ REL_PATH="${mdfile#${DEVDOCS_PATH}/}"
169
+ PROJECT_CONVENTIONS="${PROJECT_CONVENTIONS}
170
+
171
+ #### \`${REL_PATH}\`
172
+ ${FILE_CONTENT}
173
+ ${TRUNCATION_NOTE}"
174
+ done <<< "$APPLICABLE_FILES"
175
+ fi
176
+ ```
177
+
178
+ ### Step 3: Precedence rules to enforce
179
+
180
+ When `CUSTOM_INSTRUCTIONS` or `PROJECT_CONVENTIONS` is non-empty, the architect MUST apply them throughout the plan. The precedence order is:
181
+
182
+ ```
183
+ project/custom-instructions.md ← HIGHEST PRIORITY (binding directives)
184
+ ↑
185
+ other project/*.md ← Authoritative project conventions
186
+ agent/*.md ← ForgeDock/GitHub usage instructions
187
+ agent memory ← Recalled knowledge
188
+ agent defaults ← Built-in behaviors
189
+ ↓ LOWEST PRIORITY
190
+ ```
191
+
192
+ `CUSTOM_INSTRUCTIONS` and `PROJECT_CONVENTIONS` are used in the `### Custom Instructions (HIGHEST PRECEDENCE)` and `### Project Conventions` sections of the FORGE:ARCHITECT output. If both are empty (devdocs path absent), these sections are replaced with skip notes.
193
+
194
+ ---
195
+
68
196
  ## Phase A1: Read Entry Points
69
197
 
70
198
  Identify every entry point that initiates the affected logic. Start from the files named in the investigation report.
@@ -226,6 +354,20 @@ Post the following as a GitHub comment on `{NUMBER}`:
226
354
  gh issue comment {NUMBER} {GH_FLAG} --body "<!-- FORGE:ARCHITECT -->
227
355
  ## Implementation Plan for #{NUMBER}
228
356
 
357
+ ### Custom Instructions (HIGHEST PRECEDENCE)
358
+ <!-- Binding directives from project/custom-instructions.md (Phase A0).
359
+ These override agent defaults, training knowledge, and all other context.
360
+ Builder MUST follow these exactly — violations are elevated to HIGH severity in review.
361
+ If devdocs path was absent or file not found: 'No custom-instructions.md found at
362
+ {DEVDOCS_PATH}/project/custom-instructions.md — skipping. Run `npx forgedock docs init`.' -->
363
+ {CUSTOM_INSTRUCTIONS}
364
+
365
+ ### Project Conventions
366
+ <!-- Authoritative project knowledge from project/*.md and agent/*.md files
367
+ with applies_to: work-on (Phase A0). Read these before finalizing the plan.
368
+ If devdocs path was absent or no applicable files found: 'No applicable devdocs found.' -->
369
+ {PROJECT_CONVENTIONS}
370
+
229
371
  ### Affected Paths (ALL must be updated)
230
372
  | # | File | Function/Class | Change Required | Why |
231
373
  |---|------|----------------|-----------------|-----|
@@ -259,9 +401,10 @@ gh issue comment {NUMBER} {GH_FLAG} --body "<!-- FORGE:ARCHITECT -->
259
401
 
260
402
  ## Timing Rules
261
403
 
262
- - Each file read: skip if the file exceeds 500 lines and only the first 100 lines are needed for structure
404
+ - Phase A0 devdocs read: 30s total budget (path resolution + file enumeration + content reads); skip if exceeded
405
+ - Each file read (A1): skip if the file exceeds 500 lines and only the first 100 lines are needed for structure
263
406
  - Each `grep -r` call: timeout after 10s, skip if exceeded
264
- - Total wall time budget: **3 minutes**. If budget exceeded, post partial results with `<!-- FORGE:ARCHITECT:PARTIAL -->` marker instead of `COMPLETE`.
407
+ - Total wall time budget: **3 minutes** (A0 through A5 combined). If budget exceeded, post partial results with `<!-- FORGE:ARCHITECT:PARTIAL -->` marker instead of `COMPLETE`.
265
408
 
266
409
  ---
267
410
 
@@ -285,7 +428,16 @@ This module runs at **Step 3C.6** — after Context Gathering, before Implement:
285
428
  3C → Builder Contract posted
286
429
  3C.5 → Context Gathering (FORGE:CONTEXT comment)
287
430
  3C.6 → [THIS MODULE] Architecture Planning (FORGE:ARCHITECT comment)
431
+ Phase A0: Read Custom Instructions and Project Conventions (highest precedence)
432
+ Phase A1: Read Entry Points
433
+ Phase A2: Trace the Data Flow
434
+ Phase A2.5: Pipeline Phase-Dependency Check
435
+ Phase A3: Consistency Rules
436
+ Phase A4: Sequence the Implementation
437
+ Phase A5: Risk Assessment
288
438
  3F → Implement (builder reads plan, implements ALL affected paths)
289
439
  ```
290
440
 
291
441
  The builder agent reads the `<!-- FORGE:ARCHITECT -->` comment as its **primary input** before writing any code. The raw issue body is secondary context. If the architect step was skipped, the builder falls back to investigation report + contract.
442
+
443
+ **Devdocs precedence** (Phase A0): `project/custom-instructions.md` has ABSOLUTE priority over all other context. The architect's plan must reflect any directives in that file — if custom instructions mandate a specific pattern, the implementation order and approach MUST follow it, even if the architect's general reasoning suggests an alternative. <!-- Added: forge#259 -->
@@ -33,6 +33,117 @@ Parse from `$ARGUMENTS`:
33
33
 
34
34
  ---
35
35
 
36
+ ## Phase C-1: Authoritative Devdocs
37
+
38
+ Read project-resident authoritative docs **before** any institutional-memory queries. Devdocs contain binding project knowledge (conventions, architecture, custom instructions) that must inform the builder's mental model from the start.
39
+
40
+ **Time budget**: 30 seconds. If exceeded, log a skip note and continue to Phase C0.
41
+
42
+ **Skip if**: `{REPO_PATH}` is not set, devdocs path does not exist, or path contains no markdown files.
43
+
44
+ ### Step 0: Resolve devdocs path
45
+
46
+ Read `forge.yaml → devdocs.path` from the project root. Default to `devdocs` if the key is absent or unreadable.
47
+
48
+ ```bash
49
+ DEVDOCS_PATH=""
50
+
51
+ # Read forge.yaml directly from repo root (REPO_PATH points to the project root — no directory walk)
52
+ FORGE_YAML_PATH="{REPO_PATH}/forge.yaml"
53
+
54
+ if [ -f "$FORGE_YAML_PATH" ]; then
55
+ # Extract devdocs.path key (simple grep — value is on the same or next line under "devdocs:")
56
+ DEVDOCS_REL=$(grep -A5 '^devdocs:' "$FORGE_YAML_PATH" \
57
+ | grep '^\s*path:' \
58
+ | head -1 \
59
+ | sed 's/.*path:\s*//' \
60
+ | tr -d '"'"'"' \
61
+ | tr -d '[:space:]')
62
+ fi
63
+
64
+ # Default to "devdocs" if not found
65
+ DEVDOCS_REL="${DEVDOCS_REL:-devdocs}"
66
+ DEVDOCS_PATH="{REPO_PATH}/${DEVDOCS_REL}"
67
+
68
+ if [ ! -d "$DEVDOCS_PATH" ]; then
69
+ echo "Devdocs path '${DEVDOCS_PATH}' does not exist — skipping Phase C-1 (no blocking)"
70
+ DEVDOCS_PATH=""
71
+ fi
72
+ ```
73
+
74
+ > **Note**: `devdocs/` must be tracked in git for the worktree to contain it. If the project gitignores `devdocs/`, the path will not exist in the worktree and this phase silently skips — this is by design. Run `git check-ignore -v devdocs/` to confirm tracking status.
75
+
76
+ ### Step 1: Enumerate and filter applicable files
77
+
78
+ Find all `.md` files under `DEVDOCS_PATH`, parse YAML frontmatter, keep those with `work-on` in `applies_to`. Sort by authority (`required` first, then `recommended`, then `reference`).
79
+
80
+ ```bash
81
+ DEVDOCS_APPLICABLE="" # list of paths that apply
82
+
83
+ if [ -n "$DEVDOCS_PATH" ]; then
84
+ # Find all markdown files recursively
85
+ while IFS= read -r -d '' mdfile; do
86
+ # Extract frontmatter block (between first two --- markers)
87
+ FRONTMATTER=$(awk '/^---/{c++; if(c==1){next} if(c==2){exit}} c==1{print}' "$mdfile" 2>/dev/null)
88
+
89
+ # Check if applies_to contains work-on
90
+ if echo "$FRONTMATTER" | grep -q 'applies_to:.*work-on'; then
91
+ AUTHORITY=$(echo "$FRONTMATTER" | grep 'authority:' | head -1 | sed 's/.*authority:\s*//' | tr -d ' ')
92
+ # Prepend sort key: 1=required, 2=recommended, 3=reference, 4=other
93
+ case "$AUTHORITY" in
94
+ required) SORT_KEY="1" ;;
95
+ recommended) SORT_KEY="2" ;;
96
+ reference) SORT_KEY="3" ;;
97
+ *) SORT_KEY="4" ;;
98
+ esac
99
+ DEVDOCS_APPLICABLE="${DEVDOCS_APPLICABLE}${SORT_KEY}|${mdfile}\n"
100
+ fi
101
+ done < <(find "$DEVDOCS_PATH" -name "*.md" -print0 2>/dev/null)
102
+
103
+ # Sort by authority key and extract paths
104
+ DEVDOCS_APPLICABLE=$(printf "$DEVDOCS_APPLICABLE" | sort | cut -d'|' -f2-)
105
+ fi
106
+
107
+ if [ -z "$DEVDOCS_APPLICABLE" ]; then
108
+ echo "No devdocs files with 'applies_to: work-on' found — skipping Phase C-1 content read"
109
+ fi
110
+ ```
111
+
112
+ ### Step 2: Read content of applicable files
113
+
114
+ For each applicable file: read its content (max 200 lines; truncate with note if longer). Accumulate for output.
115
+
116
+ ```bash
117
+ DEVDOCS_CONTENT=""
118
+
119
+ while IFS= read -r mdfile; do
120
+ [ -z "$mdfile" ] && continue
121
+ TOTAL_LINES=$(wc -l < "$mdfile" 2>/dev/null || echo 0)
122
+ if [ "$TOTAL_LINES" -gt 200 ]; then
123
+ FILE_CONTENT=$(head -200 "$mdfile")
124
+ TRUNCATION_NOTE="_[Truncated at 200 lines — ${TOTAL_LINES} total. Read full file for complete context.]_"
125
+ else
126
+ FILE_CONTENT=$(cat "$mdfile")
127
+ TRUNCATION_NOTE=""
128
+ fi
129
+
130
+ # Relative path for display
131
+ REL_PATH="${mdfile#${DEVDOCS_PATH}/}"
132
+
133
+ DEVDOCS_CONTENT="${DEVDOCS_CONTENT}
134
+
135
+ #### \`${REL_PATH}\`
136
+ ${FILE_CONTENT}
137
+ ${TRUNCATION_NOTE}"
138
+ done <<< "$DEVDOCS_APPLICABLE"
139
+ ```
140
+
141
+ ### Step 3: Store for output
142
+
143
+ `DEVDOCS_CONTENT` is used in the `### Authoritative Devdocs` section of the FORGE:CONTEXT comment output. If empty (path absent or no applicable files), the section is replaced with a skip note.
144
+
145
+ ---
146
+
36
147
  ## Phase C0: Prior Investigation Findings (from Gists)
37
148
 
38
149
  Scan the issue body for `<!-- FORGE:PRIOR_GIST: {url} -->` annotations embedded by the decompose or orchestrate phases (GIST-02). Also check for `<!-- FORGE:MILESTONE_INDEX: {url} -->` annotations — these reference a milestone-level index Gist (GIST-04) that aggregates all investigation Gist URLs for a milestone into a single reference. Both annotation types reference Knowledge Gists created during upstream investigation (GIST-01) and contain structured findings — verdict, root cause, recommendation, affected files — that the builder needs before writing code.
@@ -278,6 +389,14 @@ Post the following as a GitHub comment on `{NUMBER}`:
278
389
  gh issue comment {NUMBER} -R {GH_REPO} --body "<!-- FORGE:CONTEXT -->
279
390
  ## Implementation Context for #{NUMBER}
280
391
 
392
+ ### Authoritative Devdocs
393
+ <!-- Project-resident authoritative knowledge read from devdocs/ (Phase C-1).
394
+ These files have the highest precedence — they override agent defaults and memory.
395
+ custom-instructions.md directives are BINDING and MUST be followed exactly.
396
+ If devdocs path was absent or no files matched applies_to: work-on — write:
397
+ 'No devdocs found at {DEVDOCS_PATH} — skipping. Run `npx forgedock docs init` to scaffold.' -->
398
+ {DEVDOCS_CONTENT}
399
+
281
400
  ### Prior Investigation Findings
282
401
  <!-- Summarized Knowledge Gist content from upstream investigations (Phase C0).
283
402
  If no FORGE:PRIOR_GIST annotations were found in the issue body: omit this section entirely.
@@ -317,11 +436,12 @@ gh issue comment {NUMBER} -R {GH_REPO} --body "<!-- FORGE:CONTEXT -->
317
436
 
318
437
  ## Timing Rules
319
438
 
439
+ - Phase C-1 devdocs read: 30s total budget (file enumeration + content reads combined); skip if exceeded
320
440
  - Phase C0 `gh gist view` calls: timeout after 15s each, 30s total budget for all Gist fetches
321
441
  - Each `gh issue list` call: timeout after 20s, skip if exceeded
322
442
  - Each `gh pr list` call: timeout after 20s, skip if exceeded
323
443
  - Each `grep -r` call: timeout after 10s, skip if exceeded
324
- - Total wall time budget: **2 minutes** (C0 through C4 combined). If budget exceeded, post partial results with `<!-- FORGE:CONTEXT:PARTIAL -->` marker instead of `COMPLETE`.
444
+ - Total wall time budget: **2 minutes** (C-1 through C4 combined). If budget exceeded, post partial results with `<!-- FORGE:CONTEXT:PARTIAL -->` marker instead of `COMPLETE`.
325
445
 
326
446
  ---
327
447
 
@@ -339,11 +459,19 @@ Skip this entire step (post nothing, return empty briefing) if:
339
459
  This module runs at **Step 3C.5** — after Builder Contract is posted, before Implement:
340
460
 
341
461
  ```
342
- 3C → Builder Contract posted
462
+ 3C → Builder Contract posted
343
463
  3C.5 → [THIS MODULE] Context gathering (max 2 min)
344
- 3F → Implement (builder now has context briefing)
464
+ Phase C-1: Authoritative Devdocs (project-resident knowledge — highest precedence)
465
+ Phase C0: Prior Investigation Findings (from Gists)
466
+ Phase C1: Past Review Findings on These Files
467
+ Phase C2: Past Bugs in the Same Module
468
+ Phase C3: Related Code Paths
469
+ Phase C4: Successful Similar Implementations
470
+ 3F → Implement (builder now has context briefing)
345
471
  ```
346
472
 
347
473
  The builder agent reads the `<!-- FORGE:CONTEXT -->` comment before writing any code. If the context step was skipped, the builder proceeds with investigation report + contract only.
348
474
 
475
+ **Devdocs precedence** (Phase C-1): Content from `project/custom-instructions.md` has the HIGHEST precedence of all context sources. Directives there override agent defaults, training knowledge, and all other devdocs. Other `project/*.md` and `agent/*.md` files with `applies_to: work-on` provide authoritative project conventions and ForgeDock usage guidance. <!-- Added: forge#259 -->
476
+
349
477
  When prior investigation Gists are available (Phase C0), the `### Prior Investigation Findings` section gives the builder cross-issue context — root causes, recommendations, and affected files from upstream investigations — without requiring manual Gist lookups. When a milestone-level index Gist exists (GIST-04), Phase C0 can resolve the index to discover all investigation Gists for the milestone from a single URL — providing full milestone-wide context automatically. <!-- Updated: forge#341 -->
@@ -1100,4 +1100,4 @@ gh issue comment {NUMBER} {GH_FLAG} --body "<!-- FORGE:TRAJECTORY -->
1100
1100
  - PR creation fails: check if branch pushed, if PR already exists
1101
1101
  - Merge conflicts: report to user, do NOT auto-resolve
1102
1102
  - gh CLI fails: check `gh auth status`
1103
- - Label missing: `gh label create "{name}" --color {hex} -R {GH_REPO}`
1103
+ - Label missing: run `npx forgedock labels setup` (from the project directory, or pass `--repo owner/repo`) to idempotently bootstrap all ForgeDock-managed labels with canonical colors and descriptions. Alternatively: `gh label create "{name}" --color {hex} --description "Managed by ForgeDock." --force -R {GH_REPO}`
package/docs/CONFIG.md CHANGED
@@ -23,6 +23,7 @@ echo "forge.yaml" >> .gitignore # if your credentials path is sensitive
23
23
  | [`project_board`](#project_board-optional) | No | GitHub Projects v2 integration |
24
24
  | [`services`](#services-optional) | No | External service URLs and IDs |
25
25
  | [`review`](#review-optional) | No | Context injected into review agents |
26
+ | [`devdocs`](#devdocs-optional) | No | Devdocs knowledge tree path |
26
27
  | [`verification`](#verification-optional) | No | Health-check patterns |
27
28
  | [`billing`](#billing-optional) | No | Enable financial integrity audit phase |
28
29
 
@@ -305,6 +306,39 @@ review:
305
306
 
306
307
  ---
307
308
 
309
+ ## `devdocs` (OPTIONAL)
310
+
311
+ Path configuration for the devdocs knowledge tree. Pipeline agents (work-on, review-pr, etc.) read these files as **authoritative project knowledge** before acting.
312
+
313
+ Run `npx forgedock docs init` to scaffold the tree from ForgeDock's seed templates into the configured path.
314
+
315
+ ```yaml
316
+ devdocs:
317
+ path: "devdocs"
318
+ ```
319
+
320
+ | Field | Type | Required | Description |
321
+ |-------|------|----------|-------------|
322
+ | `path` | string (relative path) | No | Path to the devdocs tree, relative to project root. Default: `devdocs`. |
323
+
324
+ **Commands that use this section**: `docs init`, `work-on/build/context` (Phase C-1), `work-on/build/architect` (Phase A0)
325
+
326
+ ### Migration from `review.context`
327
+
328
+ If you previously stored project context in `forge.yaml → review.context`, move that content into the appropriate devdocs file after running `npx forgedock docs init`:
329
+
330
+ | `review.context` content | Target devdocs file |
331
+ |--------------------------|---------------------|
332
+ | Architecture decisions | `devdocs/project/architecture.md` |
333
+ | Tech stack details | `devdocs/project/stack.md` |
334
+ | Coding conventions | `devdocs/project/conventions.md` |
335
+ | Project terminology | `devdocs/project/glossary.md` |
336
+ | ForgeDock usage notes | `devdocs/agent/using-forgedock.md` |
337
+
338
+ Agents read devdocs files as binding source-of-truth, so they receive richer context than the single `review.context` string.
339
+
340
+ ---
341
+
308
342
  ## `verification` (OPTIONAL)
309
343
 
310
344
  Service health-check patterns for the quality gate and validate commands.
@@ -382,6 +416,47 @@ billing:
382
416
 
383
417
  ---
384
418
 
419
+ ## Label Bootstrap
420
+
421
+ ForgeDock manages a canonical set of GitHub labels for use across all pipeline commands. Labels cover workflow state, priority, review findings, audit findings, and category classification.
422
+
423
+ ### Bootstrap command
424
+
425
+ ```bash
426
+ # Create/update all ForgeDock-managed labels on the repo defined in forge.yaml:
427
+ npx forgedock labels setup
428
+
429
+ # Or target a specific repo explicitly:
430
+ npx forgedock labels setup --repo owner/repo
431
+ ```
432
+
433
+ Running this command is idempotent — it creates labels that don't exist and updates the color/description of labels that do. Safe to re-run at any time.
434
+
435
+ **When to run it**: Once after `npx forgedock install`, or whenever a pipeline command fails with "label not found". The command bootstraps every label the pipeline relies on.
436
+
437
+ ### Canonical label set
438
+
439
+ The full manifest lives in [`bin/labels.json`](../bin/labels.json) in the ForgeDock package. Each label has a fixed hex color and a description attributing it to ForgeDock.
440
+
441
+ | Family | Labels |
442
+ |--------|--------|
443
+ | Priority | `priority:P0` `priority:P1` `priority:P2` `priority:P3` |
444
+ | Workflow | `workflow:investigating` `workflow:ready-to-build` `workflow:building` `workflow:in-review` `workflow:merged` `workflow:decomposed` `workflow:invalid` |
445
+ | Pipeline | `needs-human` `review-finding` `needs-validation` `validated` `false-positive` `staging-review` `audit-finding` `orchestration-metrics` `health-report` |
446
+ | Category | `bug` `enhancement` `feature` `refactor` `dead-code` `improvement` `documentation` `qa` `security` `performance` |
447
+
448
+ ### Colors
449
+
450
+ Colors are grouped by semantic meaning:
451
+ - **Critical/error** (`#B60205`): `priority:P0`, `security`
452
+ - **High/warning-red** (`#D93F0B`): `priority:P1`, `review-finding`, `audit-finding`
453
+ - **Medium/yellow** (`#FBCA04`): `priority:P2`, `needs-validation`
454
+ - **Low/green** (`#C2E0C6`, `#0E8A16`): `priority:P3`, `workflow:merged`, `validated`
455
+ - **Blue pipeline** (`#1D76DB`, `#0075CA`, `#0052CC`): active workflow states
456
+ - **Neutral** (`#CCCCCC`, `#E4E669`): terminal/dismissal states
457
+
458
+ ---
459
+
385
460
  ## Config Reading Conventions
386
461
 
387
462
  ForgeDock commands use two accepted patterns for reading `forge.yaml`:
@@ -393,6 +468,48 @@ Do **not** mix the two patterns for the same block of variables (e.g., `yq` with
393
468
 
394
469
  ---
395
470
 
471
+ ## CLAUDE.md Integration
472
+
473
+ ForgeDock can inject a managed usage block into your project's `CLAUDE.md` so every Claude Code session opened in the repo automatically knows that ForgeDock drives development here and which commands to use.
474
+
475
+ ### How It Works
476
+
477
+ Running `npx forgedock init` or `npx forgedock integrate` writes a marker-bounded block into `CLAUDE.md`:
478
+
479
+ ```
480
+ <!-- BEGIN FORGEDOCK -->
481
+ ## ForgeDock — Autonomous Development Pipeline
482
+ ...command index and conventions...
483
+ <!-- END FORGEDOCK -->
484
+ ```
485
+
486
+ The block is **idempotent** — re-running replaces only the managed section and leaves all other `CLAUDE.md` content untouched. If `CLAUDE.md` does not exist, it is created.
487
+
488
+ If `AGENTS.md` already exists in the project root, the same block is mirrored into it.
489
+
490
+ ### Commands
491
+
492
+ | Command | Action |
493
+ |---------|--------|
494
+ | `npx forgedock init` | Generates `forge.yaml` **and** injects the CLAUDE.md block |
495
+ | `npx forgedock integrate` | Injects/refreshes the block without modifying `forge.yaml` |
496
+
497
+ ### Opting Out
498
+
499
+ To prevent ForgeDock from managing the block, remove the `<!-- BEGIN FORGEDOCK -->` / `<!-- END FORGEDOCK -->` markers from `CLAUDE.md`. Without the markers, subsequent runs will append a new block rather than replacing one — so if you want to opt out permanently, delete or omit the markers **and** do not run `integrate` again.
500
+
501
+ Alternatively, keep the markers but edit the content between them freely — ForgeDock will replace that section on the next run, so any manual edits inside the markers will be overwritten.
502
+
503
+ ### Re-generating
504
+
505
+ The command index inside the block is auto-generated from the `description:` frontmatter in each `commands/*.md` file. To refresh it after a ForgeDock update:
506
+
507
+ ```bash
508
+ npx forgedock integrate
509
+ ```
510
+
511
+ ---
512
+
396
513
  ## Complete Example
397
514
 
398
515
  See [`forge.yaml.example`](../forge.yaml.example) at the repository root for a fully annotated example covering all sections.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "GitHub as a knowledge graph for AI agents. Autonomous dev pipeline for Claude Code.",
5
5
  "bin": {
6
6
  "forgedock": "bin/forgedock.mjs"
@@ -36,6 +36,7 @@
36
36
  "commands/",
37
37
  "docs/",
38
38
  "scripts/",
39
+ "templates/",
39
40
  "LICENSE",
40
41
  "README.md"
41
42
  ],
@@ -0,0 +1,96 @@
1
+ ---
2
+ authority: required
3
+ scope: project
4
+ applies_to: [work-on, review-pr, issue, orchestrate, quality-gate]
5
+ ---
6
+
7
+ # DevDocs — Authoritative Knowledge Base
8
+
9
+ This directory contains the authoritative knowledge base for your project. Pipeline agents (ForgeDock commands) read these files as **binding source-of-truth** before acting — not as suggestions.
10
+
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ DevDocs bridge the gap between what agents know by default and what your project requires. They answer:
16
+
17
+ - How do we use ForgeDock in this project? (`agent/using-forgedock.md`)
18
+ - How do we use GitHub in this project? (`agent/using-github.md`)
19
+ - What templates do we use? (`templates/`)
20
+ - What is this project's tech stack, architecture, and conventions? (`project/`)
21
+
22
+ ---
23
+
24
+ ## Directory Structure
25
+
26
+ ```
27
+ devdocs/
28
+ README.md ← you are here
29
+ agent/
30
+ using-forgedock.md ← ForgeDock pipeline how-to (all phases, lanes, commands)
31
+ using-github.md ← GitHub CLI, branch naming, labels, commit discipline
32
+ templates/
33
+ issue.md ← reusable issue body template
34
+ pull-request.md ← reusable PR body template
35
+ commit-convention.md ← conventional commit reference
36
+ review-finding.md ← review-finding issue template
37
+ project/
38
+ custom-instructions.md ← user binding directives (HIGHEST precedence)
39
+ stack.md ← tech stack description
40
+ architecture.md ← system and domain overview
41
+ conventions.md ← coding standards and patterns
42
+ glossary.md ← domain terms and definitions
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Precedence Rules
48
+
49
+ When a conflict arises between different knowledge sources, agents follow this priority order:
50
+
51
+ | Priority | Source | Description |
52
+ |----------|--------|-------------|
53
+ | 1 (highest) | `project/custom-instructions.md` | Explicit user-authored directives. Always wins. |
54
+ | 2 | Other `project/*.md` files | Authoritative project context (stack, architecture, conventions) |
55
+ | 3 | `agent/*.md` files | Authoritative ForgeDock/GitHub usage instructions |
56
+ | 4 | `templates/*.md` files | Standard templates (lower authority than instructions) |
57
+ | 5 | Agent memory | Recalled knowledge from past sessions |
58
+ | 6 (lowest) | Agent defaults | Built-in behaviors when no other source applies |
59
+
60
+ **Rule**: When `custom-instructions.md` says X, agents do X — even if their training or memory says otherwise.
61
+
62
+ ---
63
+
64
+ ## Authority Levels
65
+
66
+ Each file declares an `authority` field in its frontmatter:
67
+
68
+ | Authority | Meaning |
69
+ |-----------|---------|
70
+ | `required` | Agent MUST read this file before acting in its domain |
71
+ | `recommended` | Agent SHOULD read this file; improves output quality |
72
+ | `reference` | Agent MAY consult this file; informational only |
73
+
74
+ ---
75
+
76
+ ## How Agents Use DevDocs
77
+
78
+ 1. **Before investigating**: Read `agent/using-forgedock.md` and `project/custom-instructions.md`
79
+ 2. **Before building**: Read `agent/using-github.md`, relevant `project/*.md`, applicable `templates/*.md`
80
+ 3. **Before reviewing**: Read `project/conventions.md`, `project/stack.md`
81
+ 4. **Always**: Treat `project/custom-instructions.md` as the final authority
82
+
83
+ ---
84
+
85
+ ## Regeneration
86
+
87
+ If this directory was scaffolded by `npx forgedock docs init`, re-running that command will add any new template files introduced in newer ForgeDock versions. It will **not** overwrite files you have edited (idempotent).
88
+
89
+ ---
90
+
91
+ ## Maintenance Notes
92
+
93
+ - Edit `project/*.md` files to reflect your project's actual stack, architecture, and conventions
94
+ - Edit `project/custom-instructions.md` to add binding directives for your project
95
+ - Do NOT edit `agent/*.md` unless you want to override ForgeDock's default behavior for this project
96
+ - `templates/*.md` files can be customized; changes affect what pipeline agents use as templates