@dotdotgod/pi 0.1.21
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/LICENSE +94 -0
- package/README.md +120 -0
- package/extensions/context-metrics/utils.ts +66 -0
- package/extensions/load-project/README.md +44 -0
- package/extensions/load-project/index.ts +76 -0
- package/extensions/load-project/utils.ts +338 -0
- package/extensions/plan-mode/README.md +65 -0
- package/extensions/plan-mode/index.ts +830 -0
- package/extensions/plan-mode/utils.ts +747 -0
- package/package.json +65 -0
- package/skills/project-initializer/SKILL.md +66 -0
- package/skills/project-initializer/agents/openai.yaml +4 -0
- package/skills/project-initializer/references/agent-docs.md +25 -0
- package/skills/project-initializer/scripts/init_project.sh +344 -0
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dotdotgod/pi",
|
|
3
|
+
"version": "0.1.21",
|
|
4
|
+
"description": "Pi adapter for dotdotgod: project-initializer skill, shared docs scaffold, plan/archive workflow, and project loading extensions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Elastic-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"agent-memory",
|
|
12
|
+
"ai-agent",
|
|
13
|
+
"context-curation",
|
|
14
|
+
"context-loader",
|
|
15
|
+
"documentation",
|
|
16
|
+
"dotdotgod",
|
|
17
|
+
"extension",
|
|
18
|
+
"graph-impact",
|
|
19
|
+
"pi",
|
|
20
|
+
"pi-coding-agent",
|
|
21
|
+
"pi-package",
|
|
22
|
+
"plan-mode",
|
|
23
|
+
"project-initializer",
|
|
24
|
+
"project-loader",
|
|
25
|
+
"project-memory",
|
|
26
|
+
"skill",
|
|
27
|
+
"traceability"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"syntax": "node --check extensions/context-metrics/utils.ts && node --check extensions/load-project/index.ts && node --check extensions/load-project/utils.ts && node --check extensions/plan-mode/index.ts && node --check extensions/plan-mode/utils.ts",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"test": "node --test --experimental-strip-types test/*.test.ts",
|
|
33
|
+
"verify": "pnpm run syntax && pnpm run typecheck && pnpm run test",
|
|
34
|
+
"pack:dry-run": "pnpm pack --dry-run --json"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@earendil-works/pi-agent-core": "*",
|
|
38
|
+
"@earendil-works/pi-ai": "*",
|
|
39
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
40
|
+
"@earendil-works/pi-tui": "*"
|
|
41
|
+
},
|
|
42
|
+
"pi": {
|
|
43
|
+
"skills": [
|
|
44
|
+
"./skills"
|
|
45
|
+
],
|
|
46
|
+
"extensions": [
|
|
47
|
+
"./extensions"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"skills",
|
|
52
|
+
"extensions",
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://github.com/dotdotgod/dotdotgod-kit/tree/main/packages/pi#readme",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/dotdotgod/dotdotgod-kit.git",
|
|
60
|
+
"directory": "packages/pi"
|
|
61
|
+
},
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/dotdotgod/dotdotgod-kit/issues"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-initializer
|
|
3
|
+
description: Initialize a new software project with shared AI agent instructions and a documentation scaffold. Use when asked to set up a new project, create or normalize AGENTS.md/CLAUDE.md/CODEX.md, create docs/spec docs/test docs/arch docs/plan docs/archive, or establish a doc-first project baseline for multiple AI agents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Initializer
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Create a conservative dotdotgod project baseline that multiple AI coding agents can share:
|
|
11
|
+
|
|
12
|
+
- `AGENTS.md` is the canonical project instruction file.
|
|
13
|
+
- `CLAUDE.md` imports `AGENTS.md` for Claude Code.
|
|
14
|
+
- `CODEX.md` points Codex users to `AGENTS.md`.
|
|
15
|
+
- `docs/` contains `spec`, `test`, `arch`, `plan`, and `archive` areas with concise README files.
|
|
16
|
+
- `docs/arch/` covers architecture decisions, code conventions, module boundaries, data flow, infrastructure/runtime dependencies, integration boundaries, and migration design.
|
|
17
|
+
- Behavior specs can include fenced `json dotdotgod` traceability blocks as the final section; `dotdotgod validate` owns and enforces that machine-readable schema for CLI users.
|
|
18
|
+
- Code conventions can start as `docs/arch/CODE_CONVENTIONS.md`; when they grow across multiple topics, promote them to `docs/arch/conventions/README.md` plus supporting UPPER_SNAKE_CASE files.
|
|
19
|
+
- Under `docs/`, all directories use kebab-case and all markdown file names use UPPER_SNAKE_CASE, including `README.md`.
|
|
20
|
+
- `docs/plan/<task-slug>/README.md` is the default shape for active plan work.
|
|
21
|
+
- Completed plans move to `docs/archive/plan/<task-slug>/`.
|
|
22
|
+
- Temporary reports and investigations move to `docs/archive/report/<report-slug>/`.
|
|
23
|
+
- `.gitignore` includes `docs/plan`, `docs/archive`, and `.dotdotgod` so local memory and the graph cache stay local by default.
|
|
24
|
+
|
|
25
|
+
Use the dotdotgod CLI initializer when it is already available in the target environment:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dotdotgod init <project-root>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not require users to install the CLI just to initialize. If `dotdotgod` is unavailable or the command is not executable, use the bundled dependency-free shell fallback:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
sh scripts/init_project.sh <project-root>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The fallback still creates the baseline docs indexes and local-memory `.gitignore` entries, so project loading can work from README indexes until the CLI is added later.
|
|
38
|
+
|
|
39
|
+
Use `--dry-run` before touching an unfamiliar repository. Use `--dotdot-setting` when the user wants dotdot code conventions generated under `docs/arch/CODE_CONVENTIONS.md` and referenced from `AGENTS.md`. Use `--force` only when explicitly requested; it creates timestamped backups before replacing files.
|
|
40
|
+
|
|
41
|
+
## Workflow
|
|
42
|
+
|
|
43
|
+
1. Inspect the target project root.
|
|
44
|
+
- Check for existing `AGENTS.md`, `AGENT.md`, `CLAUDE.md`, `CODEX.md`, `README.md`, `.gitignore`, and `docs/`.
|
|
45
|
+
- Preserve project-specific instructions unless the user asks to replace them.
|
|
46
|
+
- If both `AGENT.md` and `AGENTS.md` exist, prefer `AGENTS.md` as canonical and leave `AGENT.md` untouched unless asked.
|
|
47
|
+
2. Run the initializer.
|
|
48
|
+
- Try `dotdotgod init` only when the CLI is available; otherwise run the bundled fallback script without blocking initialization.
|
|
49
|
+
- Default behavior creates missing files only.
|
|
50
|
+
- Existing files are skipped.
|
|
51
|
+
- `.gitignore` is created or appended with missing `docs/plan`, `docs/archive`, and `.dotdotgod` entries.
|
|
52
|
+
- `--dotdot-setting` additionally creates `docs/arch/CODE_CONVENTIONS.md`, adds it to the architecture README index, and adds an `AGENTS.md` reference.
|
|
53
|
+
- `--force` backs up replaced files as `<name>.bak.<timestamp>`.
|
|
54
|
+
3. Review generated files.
|
|
55
|
+
- Fill project-specific sections in `AGENTS.md` when context is available.
|
|
56
|
+
- Keep `CLAUDE.md` and `CODEX.md` thin so instructions do not drift.
|
|
57
|
+
- Treat `docs/plan` and `docs/archive` as local working memory unless the project deliberately changes that policy.
|
|
58
|
+
- When adding behavior specs, run `dotdotgod validate` when the CLI is available and follow any traceability schema/example shown in validation errors; if the CLI is unavailable, keep README indexes accurate and validate later.
|
|
59
|
+
4. Report the result.
|
|
60
|
+
- List created/skipped/backed-up files.
|
|
61
|
+
- Mention any existing instructions that still need manual consolidation.
|
|
62
|
+
|
|
63
|
+
## Bundled Resources
|
|
64
|
+
|
|
65
|
+
- `scripts/init_project.sh`: fallback scaffold generator that mirrors `dotdotgod init` with POSIX shell only.
|
|
66
|
+
- `references/agent-docs.md`: naming rationale and expected content model for shared agent docs.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Project Initializer"
|
|
3
|
+
short_description: "Initialize agent docs and local docs folders."
|
|
4
|
+
default_prompt: "Initialize this project with dotdotgod init when available, otherwise use the bundled fallback; include AGENTS.md, CLAUDE.md, CODEX.md, docs folders, and local memory gitignore entries."
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Shared Agent Docs
|
|
2
|
+
|
|
3
|
+
Use `AGENTS.md` as the canonical shared instruction file.
|
|
4
|
+
|
|
5
|
+
## Naming
|
|
6
|
+
|
|
7
|
+
- `AGENTS.md`: preferred shared file name. OpenAI Codex recognizes this convention, and the community `agents.md` convention uses the plural form.
|
|
8
|
+
- `CLAUDE.md`: Claude Code's project memory file. Keep it thin and import `AGENTS.md` with `@AGENTS.md`.
|
|
9
|
+
- `CODEX.md`: project-local Codex pointer. Keep it thin and link to `AGENTS.md`.
|
|
10
|
+
- `AGENT.md`: avoid for new projects unless an existing tool in the repo requires it.
|
|
11
|
+
|
|
12
|
+
## Content Model
|
|
13
|
+
|
|
14
|
+
Put durable, project-wide instructions in `AGENTS.md`:
|
|
15
|
+
|
|
16
|
+
- project purpose and stack
|
|
17
|
+
- install, test, run, and lint commands
|
|
18
|
+
- architecture and ownership notes
|
|
19
|
+
- documentation map
|
|
20
|
+
- coding and review expectations
|
|
21
|
+
- environment constraints
|
|
22
|
+
|
|
23
|
+
For projects using the dotdotgod CLI, `dotdotgod validate` is the enforcement point for machine-readable docs rules such as fenced `json dotdotgod` traceability blocks in behavior specs. Keep the detailed schema in the CLI and its validation errors.
|
|
24
|
+
|
|
25
|
+
Do not duplicate the same body in `CLAUDE.md` and `CODEX.md`; duplication causes drift.
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
usage() {
|
|
5
|
+
cat <<'EOF'
|
|
6
|
+
Usage: init_project.sh <project-root> [--project-name NAME] [--dotdot-setting] [--force] [--dry-run]
|
|
7
|
+
|
|
8
|
+
Initializes:
|
|
9
|
+
AGENTS.md, CLAUDE.md, CODEX.md
|
|
10
|
+
docs/README.md
|
|
11
|
+
docs/spec/README.md
|
|
12
|
+
docs/test/README.md
|
|
13
|
+
docs/arch/README.md
|
|
14
|
+
docs/plan/README.md
|
|
15
|
+
docs/archive/README.md
|
|
16
|
+
.gitignore entries for docs/plan, docs/archive, and .dotdotgod
|
|
17
|
+
EOF
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
PROJECT_ROOT=""
|
|
21
|
+
PROJECT_NAME=""
|
|
22
|
+
FORCE=0
|
|
23
|
+
DRY_RUN=0
|
|
24
|
+
DOTDOT_SETTING=0
|
|
25
|
+
|
|
26
|
+
while [ "$#" -gt 0 ]; do
|
|
27
|
+
case "$1" in
|
|
28
|
+
--project-name)
|
|
29
|
+
[ "$#" -ge 2 ] || {
|
|
30
|
+
echo "error: --project-name requires a value" >&2
|
|
31
|
+
exit 2
|
|
32
|
+
}
|
|
33
|
+
PROJECT_NAME=$2
|
|
34
|
+
shift 2
|
|
35
|
+
;;
|
|
36
|
+
--dotdot-setting)
|
|
37
|
+
DOTDOT_SETTING=1
|
|
38
|
+
shift
|
|
39
|
+
;;
|
|
40
|
+
--force)
|
|
41
|
+
FORCE=1
|
|
42
|
+
shift
|
|
43
|
+
;;
|
|
44
|
+
--dry-run)
|
|
45
|
+
DRY_RUN=1
|
|
46
|
+
shift
|
|
47
|
+
;;
|
|
48
|
+
-h|--help)
|
|
49
|
+
usage
|
|
50
|
+
exit 0
|
|
51
|
+
;;
|
|
52
|
+
-*)
|
|
53
|
+
echo "error: unknown option: $1" >&2
|
|
54
|
+
usage >&2
|
|
55
|
+
exit 2
|
|
56
|
+
;;
|
|
57
|
+
*)
|
|
58
|
+
if [ -n "$PROJECT_ROOT" ]; then
|
|
59
|
+
echo "error: unexpected argument: $1" >&2
|
|
60
|
+
usage >&2
|
|
61
|
+
exit 2
|
|
62
|
+
fi
|
|
63
|
+
PROJECT_ROOT=$1
|
|
64
|
+
shift
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
[ -n "$PROJECT_ROOT" ] || {
|
|
70
|
+
usage >&2
|
|
71
|
+
exit 2
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
case "$PROJECT_ROOT" in
|
|
75
|
+
/*) ;;
|
|
76
|
+
*) PROJECT_ROOT="$(pwd)/$PROJECT_ROOT" ;;
|
|
77
|
+
esac
|
|
78
|
+
|
|
79
|
+
if [ -z "$PROJECT_NAME" ]; then
|
|
80
|
+
PROJECT_NAME=$(basename "$PROJECT_ROOT")
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
timestamp() {
|
|
84
|
+
date -u "+%Y%m%d%H%M%S"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
print_result() {
|
|
88
|
+
status=$1
|
|
89
|
+
path=$2
|
|
90
|
+
extra=${3:-}
|
|
91
|
+
if [ -n "$extra" ]; then
|
|
92
|
+
printf '%-13s %s %s\n' "$status" "$path" "$extra"
|
|
93
|
+
else
|
|
94
|
+
printf '%-13s %s\n' "$status" "$path"
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
write_file() {
|
|
99
|
+
path=$1
|
|
100
|
+
content=$2
|
|
101
|
+
|
|
102
|
+
if [ -e "$path" ] && [ "$FORCE" -ne 1 ]; then
|
|
103
|
+
print_result "skipped" "$path"
|
|
104
|
+
return
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
backup=""
|
|
108
|
+
if [ -e "$path" ] && [ "$FORCE" -eq 1 ]; then
|
|
109
|
+
backup="$path.bak.$(timestamp)"
|
|
110
|
+
if [ "$DRY_RUN" -ne 1 ]; then
|
|
111
|
+
mv "$path" "$backup"
|
|
112
|
+
fi
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
116
|
+
if [ -n "$backup" ]; then
|
|
117
|
+
print_result "would_replace" "$path" "backup=$backup"
|
|
118
|
+
else
|
|
119
|
+
print_result "would_create" "$path"
|
|
120
|
+
fi
|
|
121
|
+
return
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
mkdir -p "$(dirname "$path")"
|
|
125
|
+
printf '%s\n' "$content" > "$path"
|
|
126
|
+
if [ -n "$backup" ]; then
|
|
127
|
+
print_result "replaced" "$path" "backup=$backup"
|
|
128
|
+
else
|
|
129
|
+
print_result "created" "$path"
|
|
130
|
+
fi
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
ensure_gitignore_entry() {
|
|
134
|
+
entry=$1
|
|
135
|
+
path="$PROJECT_ROOT/.gitignore"
|
|
136
|
+
existed=0
|
|
137
|
+
[ -f "$path" ] && existed=1
|
|
138
|
+
|
|
139
|
+
if [ -f "$path" ] && grep -Fxq "$entry" "$path"; then
|
|
140
|
+
return
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
144
|
+
if [ -f "$path" ]; then
|
|
145
|
+
print_result "would_update" "$path" "add=$entry"
|
|
146
|
+
else
|
|
147
|
+
print_result "would_create" "$path" "add=$entry"
|
|
148
|
+
fi
|
|
149
|
+
return
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
mkdir -p "$PROJECT_ROOT"
|
|
153
|
+
if [ -f "$path" ] && [ -s "$path" ]; then
|
|
154
|
+
last_char=$(tail -c 1 "$path" || true)
|
|
155
|
+
[ "$last_char" = "" ] || printf '\n' >> "$path"
|
|
156
|
+
fi
|
|
157
|
+
printf '%s\n' "$entry" >> "$path"
|
|
158
|
+
if [ "$existed" -eq 1 ]; then
|
|
159
|
+
print_result "updated" "$path" "add=$entry"
|
|
160
|
+
else
|
|
161
|
+
print_result "created" "$path" "add=$entry"
|
|
162
|
+
fi
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if [ "$DRY_RUN" -ne 1 ]; then
|
|
166
|
+
mkdir -p "$PROJECT_ROOT"
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
DOTDOT_AGENT_RULE=""
|
|
170
|
+
if [ "$DOTDOT_SETTING" -eq 1 ]; then
|
|
171
|
+
DOTDOT_AGENT_RULE='
|
|
172
|
+
- Follow the project code conventions in `docs/arch/CODE_CONVENTIONS.md`.'
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
ARCH_README_EXTRA=""
|
|
176
|
+
if [ "$DOTDOT_SETTING" -eq 1 ]; then
|
|
177
|
+
ARCH_README_EXTRA='
|
|
178
|
+
|
|
179
|
+
## Index
|
|
180
|
+
|
|
181
|
+
- `CODE_CONVENTIONS.md`: dotdot code conventions, including abstraction boundaries and when to split long code. If conventions grow across multiple topics, promote them to `conventions/README.md` with supporting UPPER_SNAKE_CASE files.'
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
write_file "$PROJECT_ROOT/AGENTS.md" "# AGENTS.md
|
|
185
|
+
|
|
186
|
+
Canonical instructions for AI coding agents working in this repository.
|
|
187
|
+
|
|
188
|
+
## Project
|
|
189
|
+
|
|
190
|
+
- Name: $PROJECT_NAME
|
|
191
|
+
- Purpose: TODO: describe the product, service, or library.
|
|
192
|
+
- Primary stack: TODO: list runtime, framework, database, and package manager.
|
|
193
|
+
|
|
194
|
+
## Working Rules
|
|
195
|
+
|
|
196
|
+
- Read existing code and docs before changing behavior.
|
|
197
|
+
- Keep changes scoped to the user's request.
|
|
198
|
+
- Preserve user edits and unrelated dirty worktree changes.
|
|
199
|
+
- Prefer existing local patterns over introducing new abstractions.
|
|
200
|
+
- Update docs when behavior, architecture, or test strategy changes.
|
|
201
|
+
- When using the dotdotgod CLI, run \`dotdotgod validate\` after docs changes and follow its traceability guidance for behavior specs.$DOTDOT_AGENT_RULE
|
|
202
|
+
|
|
203
|
+
## Commands
|
|
204
|
+
|
|
205
|
+
Document the project-specific commands here:
|
|
206
|
+
|
|
207
|
+
\`\`\`bash
|
|
208
|
+
# Install dependencies
|
|
209
|
+
TODO
|
|
210
|
+
|
|
211
|
+
# Run tests
|
|
212
|
+
TODO
|
|
213
|
+
|
|
214
|
+
# Run the app
|
|
215
|
+
TODO
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
## Documentation Map
|
|
219
|
+
|
|
220
|
+
- \`docs/spec/\`: product behavior, API contracts, user-facing requirements.
|
|
221
|
+
- \`docs/test/\`: test strategy, regression cases, manual verification notes.
|
|
222
|
+
- \`docs/arch/\`: architecture decisions, code conventions, module boundaries, data flow, infrastructure/runtime dependencies, integration boundaries, and migration design.
|
|
223
|
+
- \`docs/\`: all directories use kebab-case; all markdown file names use UPPER_SNAKE_CASE, including \`README.md\`.
|
|
224
|
+
- \`docs/\`: prefer keeping individual markdown files under 200 lines and under 10,000 characters; split larger docs into focused UPPER_SNAKE_CASE files and keep \`README.md\` as the index/overview.
|
|
225
|
+
- \`docs/\`: when adding, renaming, splitting, moving, or archiving docs, update the nearest relevant \`README.md\` index/table of contents in the same change.
|
|
226
|
+
- \`docs/\`: each docs subdirectory \`README.md\` acts as the local table of contents; list important files, task directories, status, and a one-line purpose for each entry.
|
|
227
|
+
- \`docs/\`: start small with a single focused markdown file; when one domain grows into multiple docs, promote it to \`docs/<area>/<domain>/README.md\` plus related UPPER_SNAKE_CASE files in that directory.
|
|
228
|
+
- \`docs/arch/\`: code conventions may start as \`CODE_CONVENTIONS.md\`; when they grow across multiple topics, use \`docs/arch/conventions/README.md\` as the index with supporting UPPER_SNAKE_CASE files.
|
|
229
|
+
- \`docs/plan/\`: local active implementation plans. Create one kebab-case directory per task (\`docs/plan/<task-slug>/\`), keep the task overview/index in that directory's \`README.md\`, and add supporting UPPER_SNAKE_CASE plan files alongside it. Ignored by git by default.
|
|
230
|
+
- \`docs/archive/\`: local completed plans, temporary reports, historical notes, payload captures. Move completed plan task directories to \`docs/archive/plan/<task-slug>/\`; put temporary reports and investigations under \`docs/archive/report/<report-slug>/\`. Ignored by git by default.
|
|
231
|
+
|
|
232
|
+
## Agent-Specific Entrypoints
|
|
233
|
+
|
|
234
|
+
- \`CLAUDE.md\` imports this file with \`@AGENTS.md\`.
|
|
235
|
+
- \`CODEX.md\` points users to this file.
|
|
236
|
+
|
|
237
|
+
Keep long-lived instructions here so agent-specific files do not drift."
|
|
238
|
+
|
|
239
|
+
write_file "$PROJECT_ROOT/CLAUDE.md" "# CLAUDE.md
|
|
240
|
+
|
|
241
|
+
@AGENTS.md"
|
|
242
|
+
|
|
243
|
+
write_file "$PROJECT_ROOT/CODEX.md" "# CODEX.md
|
|
244
|
+
|
|
245
|
+
See [AGENTS.md](./AGENTS.md)."
|
|
246
|
+
|
|
247
|
+
write_file "$PROJECT_ROOT/docs/README.md" "# Docs
|
|
248
|
+
|
|
249
|
+
This directory keeps project knowledge close to the code.
|
|
250
|
+
|
|
251
|
+
## Naming
|
|
252
|
+
|
|
253
|
+
- All directories under \`docs/\` use kebab-case.
|
|
254
|
+
- All markdown file names under \`docs/\` use UPPER_SNAKE_CASE, including \`README.md\`.
|
|
255
|
+
- Prefer keeping individual markdown files under 200 lines and under 10,000 characters; split larger docs into focused UPPER_SNAKE_CASE files and keep \`README.md\` as the index/overview.
|
|
256
|
+
|
|
257
|
+
## Indexing
|
|
258
|
+
|
|
259
|
+
- When adding, renaming, splitting, moving, or archiving docs, update the nearest relevant \`README.md\` index/table of contents in the same change.
|
|
260
|
+
- Each docs subdirectory \`README.md\` acts as the local table of contents; list important files, task directories, status, and a one-line purpose for each entry.
|
|
261
|
+
- Start small with a single focused markdown file; when one domain grows into multiple docs, promote it to \`docs/<area>/<domain>/README.md\` plus related UPPER_SNAKE_CASE files in that directory.
|
|
262
|
+
|
|
263
|
+
## Map
|
|
264
|
+
|
|
265
|
+
- \`spec/\`: product behavior, API contracts, user-facing requirements.
|
|
266
|
+
- \`test/\`: test strategy, regression cases, manual verification notes.
|
|
267
|
+
- \`arch/\`: architecture decisions, code conventions, module boundaries, data flow, infrastructure/runtime dependencies, integration boundaries, and migration design.
|
|
268
|
+
- \`plan/\`: local active implementation plans. Create one kebab-case directory per task (\`plan/<task-slug>/\`), keep the task overview/index in that directory's \`README.md\`, and add supporting UPPER_SNAKE_CASE plan files alongside it. Ignored by git by default.
|
|
269
|
+
- \`archive/\`: local completed plans, temporary reports, historical notes, payload captures. Move completed plan task directories to \`archive/plan/<task-slug>/\`; put temporary reports and investigations under \`archive/report/<report-slug>/\`. Ignored by git by default."
|
|
270
|
+
|
|
271
|
+
write_file "$PROJECT_ROOT/docs/spec/README.md" "# Specs
|
|
272
|
+
|
|
273
|
+
Use this area for behavior specs, API contracts, and product requirements.
|
|
274
|
+
|
|
275
|
+
For projects using the dotdotgod CLI, behavior specs may be required by \`dotdotgod validate\` to include fenced \`json dotdotgod\` traceability blocks as the final section. The CLI owns the schema and prints property-level repair guidance when validation fails."
|
|
276
|
+
|
|
277
|
+
write_file "$PROJECT_ROOT/docs/test/README.md" "# Tests
|
|
278
|
+
|
|
279
|
+
Use this area for test strategy, coverage notes, regression cases, and manual verification records."
|
|
280
|
+
|
|
281
|
+
write_file "$PROJECT_ROOT/docs/arch/README.md" "# Architecture
|
|
282
|
+
|
|
283
|
+
Use this area for architecture decisions, code conventions, module boundaries, data flow notes, infrastructure/runtime dependencies, integration boundaries, and migration design.$ARCH_README_EXTRA"
|
|
284
|
+
|
|
285
|
+
if [ "$DOTDOT_SETTING" -eq 1 ]; then
|
|
286
|
+
write_file "$PROJECT_ROOT/docs/arch/CODE_CONVENTIONS.md" "# Code Conventions
|
|
287
|
+
|
|
288
|
+
Dotdot code conventions for keeping implementation simple and maintainable.
|
|
289
|
+
|
|
290
|
+
## Abstraction Boundaries
|
|
291
|
+
|
|
292
|
+
- Do not introduce unnecessary abstractions.
|
|
293
|
+
- Do not abstract code that is not reused.
|
|
294
|
+
- If code grows beyond 150 lines, consider splitting or extracting focused units even when it is not reused.
|
|
295
|
+
- Review files approaching 250 lines for focused extraction by responsibility.
|
|
296
|
+
- Treat repeated \`dotdotgod graph impact\` results that collapse onto one large file as a design signal to split mixed responsibilities by behavior.
|
|
297
|
+
- Dotdotgod impact reveals hotspots but does not replace focused module boundaries.
|
|
298
|
+
- Prefer extracting pure helpers when behavior can be tested without runtime dependencies.
|
|
299
|
+
- Keep runtime integration explicit and local until a stable reuse pattern appears.
|
|
300
|
+
- Do not abstract reused code when the reused behavior is likely to split into separate features or flows later.
|
|
301
|
+
- Keep source files readable as plain text for humans and coding agents.
|
|
302
|
+
"
|
|
303
|
+
fi
|
|
304
|
+
|
|
305
|
+
write_file "$PROJECT_ROOT/docs/plan/README.md" "# Plans
|
|
306
|
+
|
|
307
|
+
Use this area for active implementation plans.
|
|
308
|
+
|
|
309
|
+
## Naming
|
|
310
|
+
|
|
311
|
+
- Task directories use kebab-case: \`docs/plan/<task-slug>/\`.
|
|
312
|
+
- Markdown file names use UPPER_SNAKE_CASE: \`README.md\`, \`RESEARCH_NOTES.md\`, \`VERIFICATION.md\`.
|
|
313
|
+
|
|
314
|
+
## Structure
|
|
315
|
+
|
|
316
|
+
- Create one directory per task: \`docs/plan/<task-slug>/\`.
|
|
317
|
+
- Put the task overview, index, scope, status, and main plan in \`docs/plan/<task-slug>/README.md\`.
|
|
318
|
+
- Add supporting research, checklists, payload captures, or verification notes as additional UPPER_SNAKE_CASE markdown files in the same task directory.
|
|
319
|
+
- Move completed or superseded task directories to \`docs/archive/plan/<task-slug>/\`.
|
|
320
|
+
|
|
321
|
+
This directory is local-only and ignored by git by default."
|
|
322
|
+
|
|
323
|
+
write_file "$PROJECT_ROOT/docs/archive/README.md" "# Archive
|
|
324
|
+
|
|
325
|
+
Use this area for local completed plans, temporary reports, historical notes, payload captures, and investigation notes.
|
|
326
|
+
|
|
327
|
+
## Naming
|
|
328
|
+
|
|
329
|
+
- Archived plan task directories preserve their kebab-case task slug.
|
|
330
|
+
- Archived report directories use a focused kebab-case report slug.
|
|
331
|
+
- Markdown file names use UPPER_SNAKE_CASE, including \`README.md\`.
|
|
332
|
+
|
|
333
|
+
## Structure
|
|
334
|
+
|
|
335
|
+
- Move completed plan task directories from \`docs/plan/<task-slug>/\` to \`docs/archive/plan/<task-slug>/\`.
|
|
336
|
+
- Put temporary investigations, reports, payload captures, and historical notes under \`docs/archive/report/<report-slug>/\`.
|
|
337
|
+
- Preserve each archive directory's \`README.md\` overview/index and supporting UPPER_SNAKE_CASE markdown files.
|
|
338
|
+
- Additional archive categories can be added later as focused kebab-case subdirectories when needed.
|
|
339
|
+
|
|
340
|
+
This directory is local-only and ignored by git by default."
|
|
341
|
+
|
|
342
|
+
ensure_gitignore_entry "docs/plan"
|
|
343
|
+
ensure_gitignore_entry "docs/archive"
|
|
344
|
+
ensure_gitignore_entry ".dotdotgod"
|