@dotdotgod/claude-code 0.2.20 → 0.2.22

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.
@@ -14,11 +14,27 @@ Arguments: `$ARGUMENTS`
14
14
 
15
15
  ## Goal
16
16
 
17
- Create a non-destructive dotdotgod baseline with canonical agent instructions, thin agent entrypoints, documentation indexes, project config, and local-memory ignore rules.
17
+ Create a non-destructive dotdotgod baseline with canonical agent instructions, thin agent entrypoints, documentation indexes, a project config selected from an appropriate initialization template, and local-memory ignore rules.
18
+
19
+ ## Template Selection
20
+
21
+ 1. Inspect existing agent instructions, the root README, docs indexes, major top-level directories, config, and ignore rules.
22
+ 2. Discover custom templates as individual JSON files under `~/.dotdotgod/templates/`. Built-in templates are `software`, `research`, `case-and-evidence`, `publication`, `portfolio`, and `policy`.
23
+ 3. Choose from project evidence:
24
+ - `software`: application, library, or infrastructure projects organized around specs, architecture, source, and tests.
25
+ - `research`: research diaries, dated records, reports, artifacts, and evaluation evidence.
26
+ - `case-and-evidence`: canonical case records, evidence or legal grounds, and case outputs.
27
+ - `publication`: briefs, outlines, chapters, claims, manuscripts, and research sources.
28
+ - `portfolio`: strategy, positions, ledgers, journals, and market research.
29
+ - `policy`: policy sections, integrated proposals, evidence, and submission outputs.
30
+ 4. Consider custom templates by filename and config contents. A same-name custom template replaces the built-in template completely.
31
+ 5. Ask the user when multiple choices are plausible and materially change memory areas or traceability. With insufficient evidence, use `~/.dotdotgod/config.json` `defaultTemplate`, then `software`.
32
+ 6. Report the selected template and a concise reason.
18
33
 
19
34
  ## Workflow
20
35
 
21
- 1. Inspect existing agent instructions, documentation, config, and ignore rules; preserve existing files and unrelated user work.
22
- 2. Run `dotdotgod init <project-root>` when available; otherwise run `sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root>`. Existing files must be skipped, not replaced.
23
- 3. Validate the initialized project with `dotdotgod validate <project-root>` when available.
24
- 4. Report created and skipped files, validation failures, and unresolved instruction conflicts.
36
+ 1. Preserve existing files and unrelated user work.
37
+ 2. Run `dotdotgod init <project-root> --template <name>` when available; otherwise run `sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root> --template <name>`. Existing files must be skipped, not replaced.
38
+ 3. The POSIX fallback supports bundled templates only. If a custom template was selected and the CLI is unavailable, stop and explain that custom templates require the CLI; do not silently substitute another template.
39
+ 4. Validate the initialized project with `dotdotgod validate <project-root>` when available.
40
+ 5. Report created and skipped files, the selected template, validation failures, and unresolved instruction conflicts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdotgod/claude-code",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Claude Code adapter for dotdotgod project memory workflows.",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",
@@ -10,11 +10,27 @@ version: 1.0.0
10
10
 
11
11
  ## Goal
12
12
 
13
- Create a non-destructive dotdotgod baseline with canonical agent instructions, thin agent entrypoints, documentation indexes, project config, and local-memory ignore rules.
13
+ Create a non-destructive dotdotgod baseline with canonical agent instructions, thin agent entrypoints, documentation indexes, a project config selected from an appropriate initialization template, and local-memory ignore rules.
14
+
15
+ ## Template Selection
16
+
17
+ 1. Inspect existing agent instructions, the root README, docs indexes, major top-level directories, config, and ignore rules.
18
+ 2. Discover custom templates as individual JSON files under `~/.dotdotgod/templates/`. Built-in templates are `software`, `research`, `case-and-evidence`, `publication`, `portfolio`, and `policy`.
19
+ 3. Choose from project evidence:
20
+ - `software`: application, library, or infrastructure projects organized around specs, architecture, source, and tests.
21
+ - `research`: research diaries, dated records, reports, artifacts, and evaluation evidence.
22
+ - `case-and-evidence`: canonical case records, evidence or legal grounds, and case outputs.
23
+ - `publication`: briefs, outlines, chapters, claims, manuscripts, and research sources.
24
+ - `portfolio`: strategy, positions, ledgers, journals, and market research.
25
+ - `policy`: policy sections, integrated proposals, evidence, and submission outputs.
26
+ 4. Consider custom templates by filename and config contents. A same-name custom template replaces the built-in template completely.
27
+ 5. Ask the user when multiple choices are plausible and materially change memory areas or traceability. With insufficient evidence, use `~/.dotdotgod/config.json` `defaultTemplate`, then `software`.
28
+ 6. Report the selected template and a concise reason.
14
29
 
15
30
  ## Workflow
16
31
 
17
- 1. Inspect existing agent instructions, documentation, config, and ignore rules; preserve existing files and unrelated user work.
18
- 2. Run `dotdotgod init <project-root>` when available; otherwise run `sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root>`. Existing files must be skipped, not replaced.
19
- 3. Validate the initialized project with `dotdotgod validate <project-root>` when available.
20
- 4. Report created and skipped files, validation failures, and unresolved instruction conflicts.
32
+ 1. Preserve existing files and unrelated user work.
33
+ 2. Run `dotdotgod init <project-root> --template <name>` when available; otherwise run `sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root> --template <name>`. Existing files must be skipped, not replaced.
34
+ 3. The POSIX fallback supports bundled templates only. If a custom template was selected and the CLI is unavailable, stop and explain that custom templates require the CLI; do not silently substitute another template.
35
+ 4. Validate the initialized project with `dotdotgod validate <project-root>` when available.
36
+ 5. Report created and skipped files, the selected template, validation failures, and unresolved instruction conflicts.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Project Initializer"
3
3
  short_description: "Initialize project memory and config."
4
- default_prompt: "Initialize shared project memory and the complete default config with dotdotgod init or the bundled fallback while preserving existing files."
4
+ default_prompt: "Inspect the project, select the most appropriate available dotdotgod config template, and initialize shared project memory without replacing existing files."
@@ -2,11 +2,11 @@
2
2
  set -eu
3
3
 
4
4
  SCRIPT_DIR=$(CDPATH= cd -P "$(dirname "$0")" && pwd)
5
- CONFIG_TEMPLATE="$SCRIPT_DIR/../templates/dotdotgod.config.json"
5
+ TEMPLATES_DIR="$SCRIPT_DIR/../templates"
6
6
 
7
7
  usage() {
8
8
  cat <<'EOF'
9
- Usage: init_project.sh <project-root> [--project-name NAME] [--dotdot-setting] [--dry-run]
9
+ Usage: init_project.sh <project-root> [--project-name NAME] [--template NAME] [--dotdot-setting] [--dry-run]
10
10
 
11
11
  Initializes:
12
12
  AGENTS.md, CLAUDE.md, CODEX.md
@@ -25,6 +25,7 @@ PROJECT_ROOT=""
25
25
  PROJECT_NAME=""
26
26
  DRY_RUN=0
27
27
  DOTDOT_SETTING=0
28
+ TEMPLATE_NAME="software"
28
29
 
29
30
  while [ "$#" -gt 0 ]; do
30
31
  case "$1" in
@@ -36,6 +37,14 @@ while [ "$#" -gt 0 ]; do
36
37
  PROJECT_NAME=$2
37
38
  shift 2
38
39
  ;;
40
+ --template)
41
+ [ "$#" -ge 2 ] || {
42
+ echo "error: --template requires a value" >&2
43
+ exit 2
44
+ }
45
+ TEMPLATE_NAME=$2
46
+ shift 2
47
+ ;;
39
48
  --dotdot-setting)
40
49
  DOTDOT_SETTING=1
41
50
  shift
@@ -80,8 +89,15 @@ if [ -z "$PROJECT_NAME" ]; then
80
89
  fi
81
90
 
82
91
  CONFIG_PATH="$PROJECT_ROOT/dotdotgod.config.json"
92
+ case "$TEMPLATE_NAME" in
93
+ *[!a-z0-9-]*|'')
94
+ echo "error: template name must be kebab-case: $TEMPLATE_NAME" >&2
95
+ exit 2
96
+ ;;
97
+ esac
98
+ CONFIG_TEMPLATE="$TEMPLATES_DIR/$TEMPLATE_NAME.json"
83
99
  if [ ! -e "$CONFIG_PATH" ] && [ ! -f "$CONFIG_TEMPLATE" ]; then
84
- echo "error: missing initializer config template: $CONFIG_TEMPLATE" >&2
100
+ echo "error: bundled template not found: $TEMPLATE_NAME; custom templates require the dotdotgod CLI" >&2
85
101
  exit 2
86
102
  fi
87
103
 
@@ -115,6 +131,20 @@ write_file() {
115
131
  print_result "created" "$path"
116
132
  }
117
133
 
134
+ ensure_directory() {
135
+ path=$1
136
+ if [ -e "$path" ]; then
137
+ print_result "skipped" "$path"
138
+ return
139
+ fi
140
+ if [ "$DRY_RUN" -eq 1 ]; then
141
+ print_result "would_create" "$path"
142
+ return
143
+ fi
144
+ mkdir -p "$path"
145
+ print_result "created" "$path"
146
+ }
147
+
118
148
  ensure_gitignore_entry() {
119
149
  entry=$1
120
150
  path="$PROJECT_ROOT/.gitignore"
@@ -396,6 +426,80 @@ Use this area for local completed plans, temporary reports, historical notes, pa
396
426
 
397
427
  This directory is local-only and ignored by git by default."
398
428
 
429
+ if [ ! -e "$CONFIG_PATH" ]; then
430
+ case "$TEMPLATE_NAME" in
431
+ software)
432
+ ;;
433
+ research)
434
+ write_file "$PROJECT_ROOT/docs/research/README.md" "# Research
435
+
436
+ Use this area for research notes, sources, and findings."
437
+ write_file "$PROJECT_ROOT/docs/record/README.md" "# Research Records
438
+
439
+ Use this area for dated measurements, experiments, and execution records."
440
+ write_file "$PROJECT_ROOT/docs/report/README.md" "# Reports
441
+
442
+ Use this area for research diagnoses, analyses, results, and performance reports."
443
+ ensure_directory "$PROJECT_ROOT/outputs"
444
+ ;;
445
+ case-and-evidence)
446
+ write_file "$PROJECT_ROOT/docs/case/README.md" "# Case Records
447
+
448
+ Use this area for canonical case facts, questions, and decisions."
449
+ write_file "$PROJECT_ROOT/docs/evidence/README.md" "# Evidence
450
+
451
+ Use this area for factual, legal, and other supporting evidence."
452
+ write_file "$PROJECT_ROOT/docs/outputs/README.md" "# Case Outputs
453
+
454
+ Use this area for maintained case outputs."
455
+ ;;
456
+ publication)
457
+ write_file "$PROJECT_ROOT/docs/outline/README.md" "# Publication Outline
458
+
459
+ Use this area for publication structure and outlines."
460
+ write_file "$PROJECT_ROOT/docs/chapters/README.md" "# Chapter Plans
461
+
462
+ Use this area for chapter plans and direction."
463
+ write_file "$PROJECT_ROOT/docs/claims/README.md" "# Claims
464
+
465
+ Use this area for maintained claims and their support."
466
+ write_file "$PROJECT_ROOT/docs/research/README.md" "# Research Sources
467
+
468
+ Use this area for research sources and supporting notes."
469
+ ensure_directory "$PROJECT_ROOT/book"
470
+ ;;
471
+ portfolio)
472
+ write_file "$PROJECT_ROOT/docs/strategy/README.md" "# Portfolio Strategy
473
+
474
+ Use this area for portfolio strategy and risk rules."
475
+ write_file "$PROJECT_ROOT/docs/positions/README.md" "# Position Theses
476
+
477
+ Use this area for position theses and investment conclusions."
478
+ write_file "$PROJECT_ROOT/docs/journal/README.md" "# Decision Journal
479
+
480
+ Use this area for dated investment decisions and reviews."
481
+ write_file "$PROJECT_ROOT/docs/report/README.md" "# Market Research
482
+
483
+ Use this area for maintained market research and analysis."
484
+ ensure_directory "$PROJECT_ROOT/data"
485
+ ;;
486
+ policy)
487
+ write_file "$PROJECT_ROOT/docs/policy/README.md" "# Policy Documents
488
+
489
+ Use this area for integrated policy proposals and outputs."
490
+ write_file "$PROJECT_ROOT/docs/sections/README.md" "# Policy Sections
491
+
492
+ Use this area for source policy sections."
493
+ write_file "$PROJECT_ROOT/docs/evidence/README.md" "# Policy Evidence
494
+
495
+ Use this area for evidence supporting policy proposals."
496
+ write_file "$PROJECT_ROOT/docs/outputs/README.md" "# Submission Outputs
497
+
498
+ Use this area for maintained policy submission outputs."
499
+ ;;
500
+ esac
501
+ fi
502
+
399
503
  if [ -e "$CONFIG_PATH" ]; then
400
504
  print_result "skipped" "$CONFIG_PATH"
401
505
  else
@@ -0,0 +1,221 @@
1
+ {
2
+ "memory": {
3
+ "areas": [
4
+ {
5
+ "id": "rules",
6
+ "label": "Agent Rules",
7
+ "paths": [
8
+ "AGENTS.md"
9
+ ],
10
+ "excludePaths": [],
11
+ "scope": "shared",
12
+ "freshness": "fresh",
13
+ "role": "agent-working-rules",
14
+ "priority": 100,
15
+ "includeBodiesByDefault": true
16
+ },
17
+ {
18
+ "id": "agent-entrypoint",
19
+ "label": "Agent Entrypoints",
20
+ "paths": [
21
+ "CLAUDE.md",
22
+ "CODEX.md"
23
+ ],
24
+ "excludePaths": [],
25
+ "scope": "shared",
26
+ "freshness": "fresh",
27
+ "role": "agent-specific-entrypoint",
28
+ "priority": 85,
29
+ "includeBodiesByDefault": true
30
+ },
31
+ {
32
+ "id": "project-overview",
33
+ "label": "Project Overview",
34
+ "paths": [
35
+ "README.md"
36
+ ],
37
+ "excludePaths": [],
38
+ "scope": "shared",
39
+ "freshness": "fresh",
40
+ "role": "project-map",
41
+ "priority": 85,
42
+ "includeBodiesByDefault": true
43
+ },
44
+ {
45
+ "id": "docs-index",
46
+ "label": "Docs Index",
47
+ "paths": [
48
+ "docs/README.md"
49
+ ],
50
+ "excludePaths": [],
51
+ "scope": "shared",
52
+ "freshness": "fresh",
53
+ "role": "documentation-routing-map",
54
+ "priority": 90,
55
+ "includeBodiesByDefault": true
56
+ },
57
+ {
58
+ "id": "case",
59
+ "label": "Case Record",
60
+ "paths": [
61
+ "docs/case/**"
62
+ ],
63
+ "excludePaths": [],
64
+ "scope": "shared",
65
+ "freshness": "fresh",
66
+ "role": "case-truth-and-open-questions",
67
+ "priority": 85,
68
+ "includeBodiesByDefault": true
69
+ },
70
+ {
71
+ "id": "evidence",
72
+ "label": "Evidence and Grounds",
73
+ "paths": [
74
+ "docs/evidence/**"
75
+ ],
76
+ "excludePaths": [],
77
+ "scope": "shared",
78
+ "freshness": "fresh",
79
+ "role": "factual-and-legal-support",
80
+ "priority": 80,
81
+ "includeBodiesByDefault": true
82
+ },
83
+ {
84
+ "id": "outputs",
85
+ "label": "Case Outputs",
86
+ "paths": [
87
+ "docs/outputs/**"
88
+ ],
89
+ "excludePaths": [],
90
+ "scope": "shared",
91
+ "freshness": "fresh",
92
+ "role": "case-outputs",
93
+ "priority": 75,
94
+ "includeBodiesByDefault": true
95
+ },
96
+ {
97
+ "id": "active-plan",
98
+ "label": "Active Plans",
99
+ "paths": [
100
+ "docs/plan/**"
101
+ ],
102
+ "excludePaths": [],
103
+ "scope": "local",
104
+ "freshness": "fresh",
105
+ "role": "active-task-intent",
106
+ "priority": 95,
107
+ "includeBodiesByDefault": true
108
+ },
109
+ {
110
+ "id": "archive-map",
111
+ "label": "Archive Map",
112
+ "paths": [
113
+ "docs/archive/README.md"
114
+ ],
115
+ "excludePaths": [],
116
+ "scope": "local",
117
+ "freshness": "stale",
118
+ "role": "historical-memory-map",
119
+ "priority": 65,
120
+ "includeBodiesByDefault": true
121
+ },
122
+ {
123
+ "id": "archive-body",
124
+ "label": "Archive Body",
125
+ "paths": [
126
+ "docs/archive/**"
127
+ ],
128
+ "excludePaths": [
129
+ "docs/archive/README.md"
130
+ ],
131
+ "scope": "local",
132
+ "freshness": "stale",
133
+ "role": "historical-memory-body",
134
+ "priority": 20,
135
+ "includeBodiesByDefault": false
136
+ },
137
+ {
138
+ "id": "docs",
139
+ "label": "Project Documentation",
140
+ "paths": [
141
+ "docs/**"
142
+ ],
143
+ "excludePaths": [],
144
+ "scope": "shared",
145
+ "freshness": "fresh",
146
+ "role": "project-documentation",
147
+ "priority": 60,
148
+ "includeBodiesByDefault": true
149
+ }
150
+ ]
151
+ },
152
+ "traceability": {
153
+ "required": [
154
+ "docs/case/**",
155
+ "docs/outputs/**"
156
+ ],
157
+ "exclude": [
158
+ "**/README.md"
159
+ ],
160
+ "keys": [
161
+ {
162
+ "key": "basedOn",
163
+ "label": "Based on",
164
+ "description": "Canonical case records, evidence, or grounds supporting the document.",
165
+ "target": "path",
166
+ "relation": "based_on",
167
+ "weight": 4
168
+ },
169
+ {
170
+ "key": "relatedDocs",
171
+ "label": "Related docs",
172
+ "description": "Documents needed to interpret the record.",
173
+ "target": "path",
174
+ "relation": "related_doc",
175
+ "weight": 2
176
+ }
177
+ ]
178
+ },
179
+ "validation": {
180
+ "markdown": {
181
+ "maxLines": 200,
182
+ "maxChars": 10000,
183
+ "exclude": [],
184
+ "filename": {
185
+ "warnNumberedSeries": true,
186
+ "allow": []
187
+ }
188
+ }
189
+ },
190
+ "impactRanking": {
191
+ "semantic": {
192
+ "enabled": true,
193
+ "threshold": 0.5,
194
+ "topKPerFile": 5
195
+ }
196
+ },
197
+ "referenceExpansion": {
198
+ "fuzzy": {
199
+ "lowSignal": {
200
+ "add": [],
201
+ "remove": []
202
+ }
203
+ }
204
+ },
205
+ "load": {
206
+ "pinnedPaths": [],
207
+ "pinnedBodies": [],
208
+ "documentationSummary": {
209
+ "exclude": [
210
+ "docs/plan",
211
+ "docs/archive"
212
+ ]
213
+ }
214
+ },
215
+ "planMode": {
216
+ "writablePaths": [
217
+ "docs/plan/**",
218
+ "docs/archive/**"
219
+ ]
220
+ }
221
+ }
@@ -182,11 +182,11 @@
182
182
  "weight": 3
183
183
  },
184
184
  {
185
- "key": "verificationCommands",
186
- "label": "Verification commands",
187
- "description": "Project-local verification commands.",
188
- "target": "command",
189
- "relation": "verification_command",
185
+ "key": "designDecisions",
186
+ "label": "Design decisions",
187
+ "description": "Maintained architecture or design decision documents that constrain the behavior.",
188
+ "target": "path",
189
+ "relation": "design_decision",
190
190
  "weight": 3
191
191
  }
192
192
  ]