@dotdotgod/claude-code 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/.claude-plugin/plugin.json +7 -0
- package/LICENSE +94 -0
- package/README.md +97 -0
- package/commands/dd/init.md +71 -0
- package/commands/dd/load.md +61 -0
- package/commands/dd/plan.md +78 -0
- package/hooks/README.md +166 -0
- package/package.json +44 -0
- package/skills/doc-first-planning/SKILL.md +70 -0
- package/skills/doc-first-planning/agents/openai.yaml +4 -0
- package/skills/project-initializer/SKILL.md +67 -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/skills/project-load/SKILL.md +57 -0
- package/skills/project-load/agents/openai.yaml +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
Copyright 2026 JooYoung Kim
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set
|
|
20
|
+
of the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key
|
|
23
|
+
functionality in the software, and you may not remove or obscure any
|
|
24
|
+
functionality in the software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
27
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
28
|
+
is subject to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
39
|
+
for the software granted under these terms ends immediately. If your company
|
|
40
|
+
makes such a claim, your patent license ends immediately for work on behalf
|
|
41
|
+
of your company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
46
|
+
you also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not
|
|
59
|
+
licensed, and your licenses will automatically terminate. If the licensor
|
|
60
|
+
provides you with a notice of your violation, and you cease all violation of
|
|
61
|
+
this license no later than 30 days after you receive that notice, your
|
|
62
|
+
licenses will be reinstated retroactively. However, if you violate these
|
|
63
|
+
terms after such reinstatement, any additional violation of these terms will
|
|
64
|
+
cause your licenses to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
76
|
+
the software the licensor makes available under these terms, including any
|
|
77
|
+
portion of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
85
|
+
the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your
|
|
92
|
+
licenses.
|
|
93
|
+
|
|
94
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @dotdotgod/claude-code
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@dotdotgod/claude-code) [](https://github.com/dotdotgod/dotdotgod-kit/tree/main/packages/claude-code) [](../../LICENSE)
|
|
4
|
+
|
|
5
|
+
> **Change a file, know what else must be checked.**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ dotdotgod graph impact . --changed packages/cli/src/core.mjs --compact
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
docs:
|
|
13
|
+
- docs/spec/REFERENCE_EXPANSION.md (91; incoming:implemented_by, semantic_similarity)
|
|
14
|
+
- docs/test/REFERENCE_EXPANSION.md (65.3; verified_by, semantic_similarity)
|
|
15
|
+
- docs/spec/LOAD_PROJECT.md (35.8; related_doc, semantic_similarity)
|
|
16
|
+
|
|
17
|
+
tests:
|
|
18
|
+
- packages/cli/test/core.test.mjs (78.6; semantic_similarity, incoming:semantic_similarity, verified_by)
|
|
19
|
+
- packages/cli/test/e2e.test.mjs (51.4; verified_by)
|
|
20
|
+
|
|
21
|
+
files:
|
|
22
|
+
- packages/cli/src/core.mjs (100; changed-file)
|
|
23
|
+
- packages/pi/extensions/plan-mode/index.ts (45; implemented_by, semantic_similarity)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`graph impact` ranks the specs, tests, architecture notes, config docs, and source files most likely to matter for a change. `--compact` keeps the result agent-facing: grouped by docs/tests/files and annotated with the reasons each item is likely relevant. It uses the project-memory graph built from Markdown links, README routes, headings, traceability blocks, package metadata, memory areas, and deterministic routing hints.
|
|
27
|
+
|
|
28
|
+
Claude Code adapter for dotdotgod's context curation workflow. It packages `/dd:init`, `/dd:load`, `/dd:plan`, and matching skills so Claude Code can start from the fixed load-context surface and use explicit maintained graph links instead of rediscovering specs, tests, plans, and archives from scratch.
|
|
29
|
+
|
|
30
|
+
## What Gets Better?
|
|
31
|
+
|
|
32
|
+
- `/dd:init` bootstraps shared agent instructions and docs folders for future context curation.
|
|
33
|
+
- `/dd:load` prefers `dotdotgod load-snapshot <root> --json` when the CLI is available, then falls back to README-index reads.
|
|
34
|
+
- Claude Code can use docs structure as retrieval intent: specs for behavior, architecture for rationale, tests for verification, plans for current work, and archive indexes for past decisions.
|
|
35
|
+
- Planning guidance encourages agents to keep README routes, traceability blocks, plans, and archives current so `graph impact` remains useful.
|
|
36
|
+
- `/dd:plan` writes or updates durable task intent in `docs/plan/<task-slug>/README.md` before implementation.
|
|
37
|
+
- Product intent, design rationale, verification standards, and completed work stay in durable files rather than chat history.
|
|
38
|
+
- Skills mirror the commands so natural-language requests can use the same workflows.
|
|
39
|
+
|
|
40
|
+
## Shared Memory and Traceability Model
|
|
41
|
+
|
|
42
|
+
By default, `docs/spec/**` has two roles: it is stable shared/fresh project memory, and it is the traceability-enforced behavior-spec path. These concepts are independent:
|
|
43
|
+
|
|
44
|
+
- `memory.areas` customizes memory classification, freshness, local/shared scope, priorities, and archive-body inclusion.
|
|
45
|
+
- `traceability.required` / `traceability.exclude` customizes which markdown paths must end with `json dotdotgod` blocks.
|
|
46
|
+
|
|
47
|
+
`docs/archive/README.md` is the history map. Archive bodies remain targeted historical memory and should not be read broadly by default.
|
|
48
|
+
|
|
49
|
+
## Included
|
|
50
|
+
|
|
51
|
+
- Claude Code plugin manifest: `.claude-plugin/plugin.json`
|
|
52
|
+
- Slash commands:
|
|
53
|
+
- `/dd:init`: initialize shared agent docs and docs folders, using `dotdotgod init` when available and the bundled fallback when not.
|
|
54
|
+
- `/dd:load`: load project memory read-only.
|
|
55
|
+
- `/dd:plan`: plan from docs before implementation.
|
|
56
|
+
- Skills:
|
|
57
|
+
- `project-load`
|
|
58
|
+
- `doc-first-planning`
|
|
59
|
+
- `project-initializer`
|
|
60
|
+
|
|
61
|
+
## Optional Hooks
|
|
62
|
+
|
|
63
|
+
Claude Code can run local lifecycle hooks from Claude settings. dotdotgod does not require hooks: `/dd:init`, `/dd:load`, `/dd:plan`, and the bundled skills work without them.
|
|
64
|
+
|
|
65
|
+
Use hooks only when you want opt-in reminders, validation, or local safety rails around the same SDLC loop: plan, implement, verify, review, and archive. The hook surface changes over time, so examples stay advisory and avoid claiming unavailable plan-mode transition hooks. See [`hooks/README.md`](hooks/README.md) for current lifecycle notes, advisory examples, and stricter plan-safety patterns.
|
|
66
|
+
|
|
67
|
+
## Shared Contract
|
|
68
|
+
|
|
69
|
+
- `AGENTS.md` remains canonical.
|
|
70
|
+
- `CLAUDE.md` stays thin and imports or points to `AGENTS.md`.
|
|
71
|
+
- Active plans use `docs/plan/<task-slug>/README.md`.
|
|
72
|
+
- Completed plans move to `docs/archive/plan/<task-slug>/`.
|
|
73
|
+
- Temporary reports move to `docs/archive/report/<report-slug>/`.
|
|
74
|
+
- `docs/archive/README.md` is the archive map; archive bodies should be read only when targeted.
|
|
75
|
+
|
|
76
|
+
## Local Development
|
|
77
|
+
|
|
78
|
+
Use the package as a local Claude Code plugin directory while developing:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
claude --plugin-dir /Users/dotdot/Workspace/dotdotgod/packages/claude-code
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Run package checks:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm --filter @dotdotgod/claude-code run verify
|
|
88
|
+
pnpm --filter @dotdotgod/claude-code run pack:dry-run
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Learn More
|
|
92
|
+
|
|
93
|
+
See the [root README](../../README.md), [GitHub repository](https://github.com/dotdotgod/dotdotgod-kit), [`docs/concept/CONTEXT_CURATION.md`](../../docs/concept/CONTEXT_CURATION.md), [`docs/concept/CONTEXT_MECHANICS.md`](../../docs/concept/CONTEXT_MECHANICS.md), [`docs/spec/MEMORY_AREA_CONFIG.md`](../../docs/spec/MEMORY_AREA_CONFIG.md), and [`docs/spec/TRACEABILITY_CONFIG.md`](../../docs/spec/TRACEABILITY_CONFIG.md).
|
|
94
|
+
|
|
95
|
+
## Compared with Graphify-Style Memory
|
|
96
|
+
|
|
97
|
+
This adapter is guidance-oriented. It asks Claude Code to prefer a bounded dotdotgod load snapshot when available, avoid broad archive scans, and follow README indexes before reading raw files. The strength is structured retrieval from explicit project-maintained links and the fixed docs surface, not a giant graph report.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize dotdotgod shared agent docs and documentation scaffold
|
|
3
|
+
argument-hint: [project-root] [--project-name NAME] [--dotdot-setting] [--force] [--dry-run]
|
|
4
|
+
allowed-tools: [Read, Glob, Grep, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dd:init - Initialize Project Memory
|
|
8
|
+
|
|
9
|
+
Initialize or normalize a repository with dotdotgod shared agent docs and docs folders.
|
|
10
|
+
|
|
11
|
+
Arguments: `$ARGUMENTS`
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Create a conservative dotdotgod project baseline that multiple AI coding agents can share:
|
|
16
|
+
|
|
17
|
+
- `AGENTS.md` is the canonical project instruction file.
|
|
18
|
+
- `CLAUDE.md` imports `AGENTS.md` for Claude Code.
|
|
19
|
+
- `CODEX.md` points Codex users to `AGENTS.md`.
|
|
20
|
+
- `docs/` contains `spec`, `test`, `arch`, `plan`, and `archive` areas with concise README files.
|
|
21
|
+
- `docs/arch/` covers architecture decisions, code conventions, module boundaries, data flow, infrastructure/runtime dependencies, integration boundaries, and migration design.
|
|
22
|
+
- 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.
|
|
23
|
+
- 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.
|
|
24
|
+
- Under `docs/`, all directories use kebab-case and all markdown file names use UPPER_SNAKE_CASE, including `README.md`.
|
|
25
|
+
- `docs/plan/<task-slug>/README.md` is the default shape for active plan work.
|
|
26
|
+
- Completed plans move to `docs/archive/plan/<task-slug>/`.
|
|
27
|
+
- Temporary reports and investigations move to `docs/archive/report/<report-slug>/`.
|
|
28
|
+
- `.gitignore` includes `docs/plan`, `docs/archive`, and `.dotdotgod` so local memory and the graph cache stay local by default.
|
|
29
|
+
|
|
30
|
+
Use the dotdotgod CLI initializer when it is already available in the target environment:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
dotdotgod init <project-root>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
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:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
1. Inspect the target project root.
|
|
49
|
+
- Check for existing `AGENTS.md`, `AGENT.md`, `CLAUDE.md`, `CODEX.md`, `README.md`, `.gitignore`, and `docs/`.
|
|
50
|
+
- Preserve project-specific instructions unless the user asks to replace them.
|
|
51
|
+
- If both `AGENT.md` and `AGENTS.md` exist, prefer `AGENTS.md` as canonical and leave `AGENT.md` untouched unless asked.
|
|
52
|
+
2. Run the initializer.
|
|
53
|
+
- Try `dotdotgod init` only when the CLI is available; otherwise run the bundled fallback script without blocking initialization.
|
|
54
|
+
- Default behavior creates missing files only.
|
|
55
|
+
- Existing files are skipped.
|
|
56
|
+
- `.gitignore` is created or appended with missing `docs/plan`, `docs/archive`, and `.dotdotgod` entries.
|
|
57
|
+
- `--dotdot-setting` additionally creates `docs/arch/CODE_CONVENTIONS.md`, adds it to the architecture README index, and adds an `AGENTS.md` reference.
|
|
58
|
+
- `--force` backs up replaced files as `<name>.bak.<timestamp>`.
|
|
59
|
+
3. Review generated files.
|
|
60
|
+
- Fill project-specific sections in `AGENTS.md` when context is available.
|
|
61
|
+
- Keep `CLAUDE.md` and `CODEX.md` thin so instructions do not drift.
|
|
62
|
+
- Treat `docs/plan` and `docs/archive` as local working memory unless the project deliberately changes that policy.
|
|
63
|
+
- 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.
|
|
64
|
+
4. Report the result.
|
|
65
|
+
- List created/skipped/backed-up files.
|
|
66
|
+
- Mention any existing instructions that still need manual consolidation.
|
|
67
|
+
|
|
68
|
+
## Bundled Resources
|
|
69
|
+
|
|
70
|
+
- `scripts/init_project.sh`: fallback scaffold generator that mirrors `dotdotgod init` with POSIX shell only.
|
|
71
|
+
- `references/agent-docs.md`: naming rationale and expected content model for shared agent docs.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Load dotdotgod project memory for the current repository
|
|
3
|
+
argument-hint: [optional focus]
|
|
4
|
+
allowed-tools: [Read, Glob, Grep, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dd:load - Load Project Memory
|
|
8
|
+
|
|
9
|
+
Load the current repository's dotdotgod project memory in a read-only pass.
|
|
10
|
+
|
|
11
|
+
User focus, if provided: `$ARGUMENTS`
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
|
|
15
|
+
Load the current repository's dotdotgod project memory in a read-only pass. Build a compact context map from shared agent instructions, README indexes, specs, architecture notes, test docs, active plans, and relevant archive notes.
|
|
16
|
+
|
|
17
|
+
Do not modify files during the load pass unless the user explicitly asks for edits after the summary.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. Identify the repository root and current state.
|
|
22
|
+
- Check current directory, git root, branch, and dirty worktree status.
|
|
23
|
+
- Mention user changes and avoid reverting or cleaning them.
|
|
24
|
+
2. Prefer the bounded CLI snapshot when available.
|
|
25
|
+
- If the user prompt contains explicit project-memory refs such as `[[PLAN_MODE]]`, run `dotdotgod expand <root> "<prompt>" --json` before broad `grep` or `find` scans, then read the resolved candidates selectively.
|
|
26
|
+
- If the prompt has high-signal natural refs such as `PLAN_MODE`, `docs/spec/PLAN_MODE.md`, or quoted doc names, use `dotdotgod expand <root> "<prompt>" --fuzzy --json` before broad scans; avoid fuzzy expansion for low-signal generic words alone and respect configured fuzzy low-signal add/remove terms.
|
|
27
|
+
- If `dotdotgod` is installed or available in the repository, run `dotdotgod load-snapshot <root> --json`.
|
|
28
|
+
- If the local environment allows package execution but no `dotdotgod` binary is available, optionally run `npx @dotdotgod/cli load-snapshot <root> --json`.
|
|
29
|
+
- Treat the snapshot as the first-pass project-memory map for cache status, graph size, memory areas, related communities, and archive inclusion policy.
|
|
30
|
+
- During load/planning, treat `dotdotgod status`, `load-snapshot`, `resolve`, `expand`, `graph impact`, `graph communities`, read-only `config`, and `index` as bounded context/status helpers. Avoid mutating scaffold/config commands such as `init` or `config init` unless the user explicitly asks for initialization or config creation.
|
|
31
|
+
- Use `dotdotgod graph impact <root> --changed <path> --compact --json` as a task-focused impact map when the user identifies a likely source/config/doc file.
|
|
32
|
+
- Use `grep` or `find` after `expand`, impact, and targeted reads when the task needs fallback discovery or raw source text search.
|
|
33
|
+
- Fall back to raw `dotdotgod graph impact <root> --changed <path> --json` only when diagnostics need the full payload.
|
|
34
|
+
- When graph impact surfaces traceability relations, inspect the related specs, tests, and docs before editing source.
|
|
35
|
+
- Related behavior docs: [load project](../../../docs/spec/LOAD_PROJECT.md), [cross-agent support](../../../docs/spec/CROSS_AGENT_SUPPORT.md), and [cross-agent architecture](../../../docs/arch/CROSS_AGENT_ARCHITECTURE.md).
|
|
36
|
+
- If the CLI is unavailable, network/package execution is undesirable, or the command fails, continue with the manual README-index fallback below.
|
|
37
|
+
3. Inspect baseline memory files when present:
|
|
38
|
+
- `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, `README.md`
|
|
39
|
+
- `docs/README.md`
|
|
40
|
+
- `docs/spec/README.md`
|
|
41
|
+
- `docs/test/README.md`
|
|
42
|
+
- `docs/arch/README.md`
|
|
43
|
+
- `docs/plan/README.md`
|
|
44
|
+
- `docs/archive/README.md`
|
|
45
|
+
4. Start with `AGENTS.md`, `README.md`, and `docs/README.md` when they are not already clear from the CLI snapshot or loaded context.
|
|
46
|
+
5. Follow README indexes. Read relevant docs under `docs/spec`, `docs/test`, and `docs/arch` selectively unless the task needs a full refresh.
|
|
47
|
+
6. List `docs/plan` entries first, then selectively read only relevant active plans.
|
|
48
|
+
7. Use `docs/archive/README.md` as the archive history map. Do not scan archive bodies by default; read targeted completed plans under `docs/archive/plan/` or reports under `docs/archive/report/` only when directly relevant.
|
|
49
|
+
8. Avoid broad reads of generated outputs, dependencies, databases, caches, secrets, and `.env*` contents.
|
|
50
|
+
|
|
51
|
+
## Output Shape
|
|
52
|
+
|
|
53
|
+
Respond concisely with:
|
|
54
|
+
|
|
55
|
+
- Project summary
|
|
56
|
+
- Key working rules
|
|
57
|
+
- Available commands and verification methods
|
|
58
|
+
- Documentation map
|
|
59
|
+
- Active plans
|
|
60
|
+
- Relevant archive notes
|
|
61
|
+
- Open TODO/TBD items or questions to clarify
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Plan a change using dotdotgod doc-first planning conventions
|
|
3
|
+
argument-hint: <task or change request>
|
|
4
|
+
allowed-tools: [Read, Glob, Grep, Bash, Write, Edit]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /dd:plan - Doc-First Planning
|
|
8
|
+
|
|
9
|
+
Create or update a dotdotgod implementation plan before changing source/config files.
|
|
10
|
+
|
|
11
|
+
Task request: `$ARGUMENTS`
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
|
|
15
|
+
Create implementation plans from the repository's documented design sources before changing source/config files. Treat planning as a managed artifact under `docs/plan`.
|
|
16
|
+
|
|
17
|
+
Do not start implementation until the plan has a clear evidence trail and the user has asked to execute it. Treat the written plan file as the durable review artifact; do not rely on transient chat previews.
|
|
18
|
+
|
|
19
|
+
## Source Order
|
|
20
|
+
|
|
21
|
+
Prefer live repository docs in this order:
|
|
22
|
+
|
|
23
|
+
1. `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, `README.md`, and `docs/README.md` for working rules and project map.
|
|
24
|
+
2. `docs/spec/` for behavior, domain rules, API contracts, and acceptance criteria.
|
|
25
|
+
3. `docs/test/` for verification strategy, regression cases, fixtures, and manual checks.
|
|
26
|
+
4. `docs/arch/` for architecture decisions, module boundaries, integration constraints, and runtime assumptions.
|
|
27
|
+
5. `docs/plan/README.md` and matching active plans under `docs/plan/`.
|
|
28
|
+
6. Relevant completed plans under `docs/archive/plan/` or reports under `docs/archive/report/` only when directly useful.
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
1. Establish current state.
|
|
33
|
+
- Check git status.
|
|
34
|
+
- Locate relevant docs and active plans.
|
|
35
|
+
- Preserve user edits and unrelated dirty worktree changes.
|
|
36
|
+
- If the session is long or noisy, suggest a user-initiated planning-focused compaction before writing or revising the plan; do not compact automatically because compaction is lossy.
|
|
37
|
+
2. Gather evidence before planning.
|
|
38
|
+
- When the request contains explicit project-memory refs such as `[[PLAN_MODE]]`, run `dotdotgod expand <root> "<request>" --json` before broad `grep` or `find` scans, then read the resolved candidates selectively.
|
|
39
|
+
- When the request uses high-signal natural refs such as `PLAN_MODE`, `docs/spec/PLAN_MODE.md`, or quoted doc names, run `dotdotgod expand <root> "<request>" --fuzzy --json`; skip fuzzy expansion for generic low-signal words alone and respect configured fuzzy low-signal add/remove terms.
|
|
40
|
+
- Search docs by domain terms from the user request.
|
|
41
|
+
- Read nearest README indexes and relevant focused docs.
|
|
42
|
+
- For behavior changes, prefer specs with CLI-enforced fenced `json dotdotgod` traceability blocks in the final section; use their source, test, related-doc, and verification-command mappings before editing code.
|
|
43
|
+
- When the dotdotgod CLI is available and likely target files are known, run `dotdotgod graph impact <root> --changed <path> --compact --json` for a small bounded set of those files. Use the related specs, tests, docs, commands, scores, and reasons to strengthen target files, risks, and verification steps. If impact lookup fails or the CLI is unavailable, continue with README-index and traceability fallback evidence.
|
|
44
|
+
- During planning, treat these dotdotgod commands as bounded context/status helpers: `status`, `load-snapshot`, `resolve`, `expand`, `graph impact`, `graph communities`, read-only `config`, and `index`. Do not run mutating scaffold/config commands such as `init` or `config init` unless the user explicitly asks for initialization or config creation.
|
|
45
|
+
- Use `grep` or `find` after reference expansion, impact, and targeted reads when the task needs fallback discovery or raw source text search.
|
|
46
|
+
- Read code only after docs identify likely module boundaries, impact output points to relevant files, or docs are missing/stale.
|
|
47
|
+
3. Create or update the active plan at:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
docs/plan/<task-slug>/README.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. Use supporting files in the same task directory only when useful, with UPPER_SNAKE_CASE markdown names such as `RESEARCH_NOTES.md` or `VERIFICATION.md`.
|
|
54
|
+
5. Include:
|
|
55
|
+
- scope and current status
|
|
56
|
+
- target files and rationale
|
|
57
|
+
- impact-derived related files/checks when available
|
|
58
|
+
- implementation steps
|
|
59
|
+
- risks and edge cases when useful
|
|
60
|
+
- verification method
|
|
61
|
+
- final housekeeping step to move completed work to `docs/archive/plan/<task-slug>/`
|
|
62
|
+
6. Update `docs/plan/README.md` if the repository keeps active plan entries there.
|
|
63
|
+
7. Use repository-local package manager evidence for verification commands. In this repository, prefer `pnpm run verify`, `pnpm run pack:dry-run`, and `.husky/pre-push` when applicable.
|
|
64
|
+
8. After creating or updating behavior specs, run project validation when possible. For dotdotgod projects, `dotdotgod validate` enforces machine-readable `json dotdotgod` traceability blocks as the final section in specs. Use `dotdotgod validate --check-index` when you need to confirm markdown fingerprints match the graph index. If validation fails, use the schema, property guidance, and example shown in the validation error to repair the spec.
|
|
65
|
+
9. Stop after presenting the plan unless the user explicitly asks for execution.
|
|
66
|
+
10. After implementation and verification, archive completed or superseded plan directories under `docs/archive/plan/<task-slug>/`; remove stale local plan artifacts only when the project policy allows plan/archive housekeeping.
|
|
67
|
+
|
|
68
|
+
## Quality Rules
|
|
69
|
+
|
|
70
|
+
- Prefer documented facts over inference; label inference explicitly.
|
|
71
|
+
- Keep plans concise and maintainable.
|
|
72
|
+
- Use local repository terminology and existing module names.
|
|
73
|
+
- Validation steps must be executable commands or concrete review checks.
|
|
74
|
+
- Avoid turning explanatory numbered lists into executable implementation plans. Use concrete action-oriented `Plan:` steps only when a real active plan artifact is being created or updated.
|
|
75
|
+
|
|
76
|
+
## Execution Rule
|
|
77
|
+
|
|
78
|
+
Do not implement source/config changes until the plan is clear and the user asks to proceed.
|
package/hooks/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Optional Claude Code Hooks
|
|
2
|
+
|
|
3
|
+
Claude Code hooks can complement dotdotgod commands and skills, but they are not required. `/dd:load`, `/dd:plan`, `/dd:init`, and the bundled skills work without hook configuration.
|
|
4
|
+
|
|
5
|
+
Use hooks only when you want opt-in reminders, lightweight validation, or local safety rails around the same doc-first workflow. Hooks run local commands with your user permissions, so copy and adapt examples deliberately.
|
|
6
|
+
|
|
7
|
+
## Current Claude Code Lifecycle Notes
|
|
8
|
+
|
|
9
|
+
Claude Code exposes a broad hook lifecycle. In addition to session, prompt, tool, subagent, and stop events, current Claude Code docs include events such as `Setup`, `UserPromptExpansion`, `PermissionRequest`, `PermissionDenied`, `PostToolUseFailure`, `PostToolBatch`, `TaskCreated`, `TaskCompleted`, `StopFailure`, `InstructionsLoaded`, `ConfigChange`, `CwdChanged`, `FileChanged`, `WorktreeCreate`, `WorktreeRemove`, `PreCompact`, `PostCompact`, `Elicitation`, `ElicitationResult`, and `SessionEnd`.
|
|
10
|
+
|
|
11
|
+
Dotdotgod examples intentionally use only a small subset of that surface. Prefer current events this way:
|
|
12
|
+
|
|
13
|
+
- `SessionStart`: fast project-memory reminders or environment setup.
|
|
14
|
+
- `UserPromptSubmit`: advisory SDLC reminders before Claude plans or implements.
|
|
15
|
+
- `PreToolUse`: narrowly scoped local safety checks before writes or commands.
|
|
16
|
+
- `PostToolUse`: optional feedback after a single successful tool call.
|
|
17
|
+
- `PostToolBatch`: once-per-parallel-tool-batch checks or context injection when a check depends on the whole batch.
|
|
18
|
+
- `Stop`: successful turn completion reminders or opt-in validation.
|
|
19
|
+
- `StopFailure`: logging or notification when a turn ends due to an API error; do not use `Stop` as the only failure-path hook.
|
|
20
|
+
- `SessionEnd`: cleanup or local logging at session termination, not required validation.
|
|
21
|
+
|
|
22
|
+
Claude Code currently does not document dedicated plan-mode transition hooks such as `PrePlanMode`, `PostPlanMode`, plan-accept, or plan-reject events. Treat plan-mode-specific hook names found in issues or community posts as feature requests unless they appear in the official docs. Dotdotgod plan-safety examples should rely on explicit durable plans plus current hook events such as `UserPromptSubmit`, `PreToolUse`, `PostToolBatch`, and `Stop`.
|
|
23
|
+
|
|
24
|
+
Hook handlers may be `command`, `http`, `mcp_tool`, `prompt`, or `agent`, with event-specific support limits. `SessionStart` and `Setup` support only `command` and `mcp_tool`. For project or plugin scripts, prefer command exec form with `args` so `${CLAUDE_PROJECT_DIR}`, `${CLAUDE_PLUGIN_ROOT}`, and `${CLAUDE_PLUGIN_DATA}` paths are passed without shell quoting. Hooks should not write directly to `/dev/tty`; use JSON `systemMessage` for user-visible messages or Claude Code's `terminalSequence` field for terminal notifications.
|
|
25
|
+
|
|
26
|
+
## SDLC Guardrail Framing
|
|
27
|
+
|
|
28
|
+
Use hooks as optional guardrails around the software-development lifecycle, not as a replacement for human review or the durable plan file:
|
|
29
|
+
|
|
30
|
+
1. Plan: `/dd:plan` or the planning skill creates or updates `docs/plan/<task-slug>/README.md` from docs evidence.
|
|
31
|
+
2. Implement: Claude changes only the target files described by the accepted plan.
|
|
32
|
+
3. Verify: run focused checks and, for docs changes, `dotdotgod validate . --include-local-memory --check-index`.
|
|
33
|
+
4. Review: inspect changed files, risks, and impact-derived related checks.
|
|
34
|
+
5. Archive: move completed plan artifacts only as an explicit housekeeping step, never from a default hook.
|
|
35
|
+
|
|
36
|
+
This SDLC framing maps common Claude Code guidance about a project brain to dotdotgod's cross-agent contract: keep `AGENTS.md` canonical and keep `CLAUDE.md` thin rather than duplicating long-lived instructions.
|
|
37
|
+
|
|
38
|
+
## When To Use Hooks
|
|
39
|
+
|
|
40
|
+
- Use `/dd:load` or the `project-load` skill when you intentionally want a curated project-memory load.
|
|
41
|
+
- Use `/dd:plan` or the `doc-first-planning` skill before implementation, refactors, migrations, or multi-step work.
|
|
42
|
+
- During planning, prefer bounded dotdotgod context/status helpers: `status`, `load-snapshot`, `resolve`, `expand`, `graph impact`, `graph communities`, read-only `config`, and intentional `index` refreshes. Do not run mutating scaffold/config commands such as `init` or `config init` from hooks unless the user explicitly requested that setup.
|
|
43
|
+
- Use hooks for small reminders at session start, prompt submission, tool boundaries, or stop time.
|
|
44
|
+
|
|
45
|
+
## Opt-In Levels
|
|
46
|
+
|
|
47
|
+
- `advisory`: print reminders or read-only status only.
|
|
48
|
+
- `validate`: run `dotdotgod validate . --include-local-memory --check-index` after docs work or at stop time.
|
|
49
|
+
- `strict-plan-safety`: add local blocking scripts only when a reliable plan-only state signal exists.
|
|
50
|
+
|
|
51
|
+
Start with advisory hooks. Do not enable blocking hooks until you have tested the hook payload and your local policy script.
|
|
52
|
+
|
|
53
|
+
## Advisory Example
|
|
54
|
+
|
|
55
|
+
This example reminds Claude to use dotdotgod intentionally and checks cache status without rebuilding it:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"hooks": {
|
|
60
|
+
"SessionStart": [
|
|
61
|
+
{
|
|
62
|
+
"matcher": "startup|resume",
|
|
63
|
+
"hooks": [
|
|
64
|
+
{
|
|
65
|
+
"type": "command",
|
|
66
|
+
"command": "printf '%s\\n' 'dotdotgod: use /dd:load or dotdotgod load-snapshot when project memory is needed.'",
|
|
67
|
+
"timeout": 10
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"Stop": [
|
|
73
|
+
{
|
|
74
|
+
"hooks": [
|
|
75
|
+
{
|
|
76
|
+
"type": "command",
|
|
77
|
+
"command": "dotdotgod status . --json 2>/dev/null || true",
|
|
78
|
+
"timeout": 20
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Opt-In Validation Example
|
|
88
|
+
|
|
89
|
+
Use this only when you want stop-time docs validation. It may be noisier than advisory hooks, but it keeps dotdotgod docs contracts visible:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"hooks": {
|
|
94
|
+
"Stop": [
|
|
95
|
+
{
|
|
96
|
+
"hooks": [
|
|
97
|
+
{
|
|
98
|
+
"type": "command",
|
|
99
|
+
"command": "dotdotgod validate . --include-local-memory --check-index",
|
|
100
|
+
"timeout": 120
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Prompt Reminder Pattern
|
|
110
|
+
|
|
111
|
+
A `UserPromptSubmit` hook can add a reminder for implementation-like prompts. Keep the command fast and non-mutating. Prefer reminders over automatic planning because `/dd:plan` and the planning skill are the explicit durable workflow.
|
|
112
|
+
|
|
113
|
+
`UserPromptSubmit` does not support matchers in Claude Code settings, so filter on the submitted `prompt` field inside the hook command. For planning-like prompts, use an advisory reminder that asks Claude to resolve explicit `[[...]]` project-memory refs with `dotdotgod expand`, identify the complete target file list, and run graph impact checks for every target file before finalizing the plan:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"hooks": {
|
|
118
|
+
"UserPromptSubmit": [
|
|
119
|
+
{
|
|
120
|
+
"hooks": [
|
|
121
|
+
{
|
|
122
|
+
"type": "command",
|
|
123
|
+
"command": "python3 -c \"import json,re,sys; p=json.load(sys.stdin).get('prompt',''); msg='dotdotgod: advisory reminder only. If the prompt contains [[...]] refs, run dotdotgod expand . \\\"<prompt>\\\" --json before broad grep/find. For planning work, identify the complete target file list, run dotdotgod graph impact . --changed <path> --compact for every target file, and use impact output to strengthen related docs, risks, and verification steps. If docs change, run dotdotgod validate . --include-local-memory --check-index.'; print(msg) if re.search(r'plan|planning|플랜|계획|\\[\\[', p, re.I) else None\"",
|
|
124
|
+
"timeout": 10
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Strict Plan Safety Pattern
|
|
134
|
+
|
|
135
|
+
Strict safety belongs in a local script, not a generic package default. Use exec form when referencing project-local scripts so paths with spaces do not require shell quoting:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"hooks": {
|
|
140
|
+
"PreToolUse": [
|
|
141
|
+
{
|
|
142
|
+
"matcher": "Write|Edit",
|
|
143
|
+
"hooks": [
|
|
144
|
+
{
|
|
145
|
+
"type": "command",
|
|
146
|
+
"command": "python3",
|
|
147
|
+
"args": ["${CLAUDE_PROJECT_DIR}/.claude/hooks/dotdotgod-plan-safety.py"],
|
|
148
|
+
"timeout": 10
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
A strict script must read hook JSON from stdin, confirm the session is explicitly in plan-only mode, allow expected `docs/plan/**` and `docs/archive/**` plan/archive updates, and fail open or advisory unless the mode signal and path parsing are tested.
|
|
158
|
+
|
|
159
|
+
## Avoid By Default
|
|
160
|
+
|
|
161
|
+
- Do not run `pnpm run verify` after every tool call.
|
|
162
|
+
- Do not run `dotdotgod index` as an automatic stop hook.
|
|
163
|
+
- Do not run `dotdotgod init` or `dotdotgod config init` automatically.
|
|
164
|
+
- Do not move active plans to `docs/archive/` automatically.
|
|
165
|
+
- Do not block all source writes without an explicit plan-only state signal.
|
|
166
|
+
- Do not treat `dotdotgod load-snapshot` as side-effect-free in strict hooks; it may lazily refresh the ignored `.dotdotgod/` cache.
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dotdotgod/claude-code",
|
|
3
|
+
"version": "0.1.21",
|
|
4
|
+
"description": "Claude Code adapter for dotdotgod project memory workflows.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Elastic-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"agent-memory",
|
|
12
|
+
"ai-coding-agent",
|
|
13
|
+
"claude-code",
|
|
14
|
+
"context-curation",
|
|
15
|
+
"documentation",
|
|
16
|
+
"dotdotgod",
|
|
17
|
+
"graph-impact",
|
|
18
|
+
"planning",
|
|
19
|
+
"plugin",
|
|
20
|
+
"project-memory",
|
|
21
|
+
"traceability"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"verify": "node -e \"const fs=require('fs'); const req=['.claude-plugin/plugin.json','commands/dd/load.md','commands/dd/plan.md','commands/dd/init.md','skills/project-load/SKILL.md','skills/doc-first-planning/SKILL.md','skills/project-initializer/SKILL.md','skills/project-initializer/scripts/init_project.sh','hooks/README.md']; JSON.parse(fs.readFileSync('.claude-plugin/plugin.json','utf8')); for (const f of req) { if (!fs.existsSync(f)) throw new Error('missing '+f); } console.log('claude-code adapter ok')\"",
|
|
25
|
+
"pack:dry-run": "pnpm pack --dry-run --json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
".claude-plugin",
|
|
29
|
+
"commands",
|
|
30
|
+
"skills",
|
|
31
|
+
"hooks",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://github.com/dotdotgod/dotdotgod-kit/tree/main/packages/claude-code#readme",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/dotdotgod/dotdotgod-kit.git",
|
|
39
|
+
"directory": "packages/claude-code"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/dotdotgod/dotdotgod-kit/issues"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-first-planning
|
|
3
|
+
description: Use this skill when the user asks Claude Code to plan a feature, refactor, migration, architecture change, test strategy, or multi-step task using dotdotgod docs before implementation; when docs/spec, docs/test, docs/arch, docs/plan, or dd:plan are mentioned.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Doc-First Planning
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
|
|
11
|
+
Create implementation plans from the repository's documented design sources before changing source/config files. Treat planning as a managed artifact under `docs/plan`.
|
|
12
|
+
|
|
13
|
+
Do not start implementation until the plan has a clear evidence trail and the user has asked to execute it. Treat the written plan file as the durable review artifact; do not rely on transient chat previews.
|
|
14
|
+
|
|
15
|
+
## Source Order
|
|
16
|
+
|
|
17
|
+
Prefer live repository docs in this order:
|
|
18
|
+
|
|
19
|
+
1. `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, `README.md`, and `docs/README.md` for working rules and project map.
|
|
20
|
+
2. `docs/spec/` for behavior, domain rules, API contracts, and acceptance criteria.
|
|
21
|
+
3. `docs/test/` for verification strategy, regression cases, fixtures, and manual checks.
|
|
22
|
+
4. `docs/arch/` for architecture decisions, module boundaries, integration constraints, and runtime assumptions.
|
|
23
|
+
5. `docs/plan/README.md` and matching active plans under `docs/plan/`.
|
|
24
|
+
6. Relevant completed plans under `docs/archive/plan/` or reports under `docs/archive/report/` only when directly useful.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Establish current state.
|
|
29
|
+
- Check git status.
|
|
30
|
+
- Locate relevant docs and active plans.
|
|
31
|
+
- Preserve user edits and unrelated dirty worktree changes.
|
|
32
|
+
- If the session is long or noisy, suggest a user-initiated planning-focused compaction before writing or revising the plan; do not compact automatically because compaction is lossy.
|
|
33
|
+
2. Gather evidence before planning.
|
|
34
|
+
- When the request contains explicit project-memory refs such as `[[PLAN_MODE]]`, run `dotdotgod expand <root> "<request>" --json` before broad `grep` or `find` scans, then read the resolved candidates selectively.
|
|
35
|
+
- When the request uses high-signal natural refs such as `PLAN_MODE`, `docs/spec/PLAN_MODE.md`, or quoted doc names, run `dotdotgod expand <root> "<request>" --fuzzy --json`; skip fuzzy expansion for generic low-signal words alone and respect configured fuzzy low-signal add/remove terms.
|
|
36
|
+
- Search docs by domain terms from the user request.
|
|
37
|
+
- Read nearest README indexes and relevant focused docs.
|
|
38
|
+
- For behavior changes, prefer specs with CLI-enforced fenced `json dotdotgod` traceability blocks in the final section; use their source, test, related-doc, and verification-command mappings before editing code.
|
|
39
|
+
- When the dotdotgod CLI is available and likely target files are known, run `dotdotgod graph impact <root> --changed <path> --compact --json` for a small bounded set of those files. Use the related specs, tests, docs, commands, scores, and reasons to strengthen target files, risks, and verification steps. If impact lookup fails or the CLI is unavailable, continue with README-index and traceability fallback evidence.
|
|
40
|
+
- During planning, treat these dotdotgod commands as bounded context/status helpers: `status`, `load-snapshot`, `resolve`, `expand`, `graph impact`, `graph communities`, read-only `config`, and `index`. Do not run mutating scaffold/config commands such as `init` or `config init` unless the user explicitly asks for initialization or config creation.
|
|
41
|
+
- Use `grep` or `find` after reference expansion, impact, and targeted reads when the task needs fallback discovery or raw source text search.
|
|
42
|
+
- Read code only after docs identify likely module boundaries, impact output points to relevant files, or docs are missing/stale.
|
|
43
|
+
3. Create or update the active plan at:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
docs/plan/<task-slug>/README.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
4. Use supporting files in the same task directory only when useful, with UPPER_SNAKE_CASE markdown names such as `RESEARCH_NOTES.md` or `VERIFICATION.md`.
|
|
50
|
+
5. Include:
|
|
51
|
+
- scope and current status
|
|
52
|
+
- target files and rationale
|
|
53
|
+
- impact-derived related files/checks when available
|
|
54
|
+
- implementation steps
|
|
55
|
+
- risks and edge cases when useful
|
|
56
|
+
- verification method
|
|
57
|
+
- final housekeeping step to move completed work to `docs/archive/plan/<task-slug>/`
|
|
58
|
+
6. Update `docs/plan/README.md` if the repository keeps active plan entries there.
|
|
59
|
+
7. Use repository-local package manager evidence for verification commands. In this repository, prefer `pnpm run verify`, `pnpm run pack:dry-run`, and `.husky/pre-push` when applicable.
|
|
60
|
+
8. After creating or updating behavior specs, run project validation when possible. For dotdotgod projects, `dotdotgod validate` enforces machine-readable `json dotdotgod` traceability blocks as the final section in specs. Use `dotdotgod validate --check-index` when you need to confirm markdown fingerprints match the graph index. If validation fails, use the schema, property guidance, and example shown in the validation error to repair the spec.
|
|
61
|
+
9. Stop after presenting the plan unless the user explicitly asks for execution.
|
|
62
|
+
10. After implementation and verification, archive completed or superseded plan directories under `docs/archive/plan/<task-slug>/`; remove stale local plan artifacts only when the project policy allows plan/archive housekeeping.
|
|
63
|
+
|
|
64
|
+
## Quality Rules
|
|
65
|
+
|
|
66
|
+
- Prefer documented facts over inference; label inference explicitly.
|
|
67
|
+
- Keep plans concise and maintainable.
|
|
68
|
+
- Use local repository terminology and existing module names.
|
|
69
|
+
- Validation steps must be executable commands or concrete review checks.
|
|
70
|
+
- Avoid turning explanatory numbered lists into executable implementation plans. Use concrete action-oriented `Plan:` steps only when a real active plan artifact is being created or updated.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-initializer
|
|
3
|
+
description: Use this skill when Claude Code is asked to initialize or normalize a project with dotdotgod shared agent instructions, AGENTS.md/CLAUDE.md/CODEX.md, docs/spec docs/test docs/arch docs/plan docs/archive, or a doc-first project baseline.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Project Initializer
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Create a conservative dotdotgod project baseline that multiple AI coding agents can share:
|
|
12
|
+
|
|
13
|
+
- `AGENTS.md` is the canonical project instruction file.
|
|
14
|
+
- `CLAUDE.md` imports `AGENTS.md` for Claude Code.
|
|
15
|
+
- `CODEX.md` points Codex users to `AGENTS.md`.
|
|
16
|
+
- `docs/` contains `spec`, `test`, `arch`, `plan`, and `archive` areas with concise README files.
|
|
17
|
+
- `docs/arch/` covers architecture decisions, code conventions, module boundaries, data flow, infrastructure/runtime dependencies, integration boundaries, and migration design.
|
|
18
|
+
- 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.
|
|
19
|
+
- 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.
|
|
20
|
+
- Under `docs/`, all directories use kebab-case and all markdown file names use UPPER_SNAKE_CASE, including `README.md`.
|
|
21
|
+
- `docs/plan/<task-slug>/README.md` is the default shape for active plan work.
|
|
22
|
+
- Completed plans move to `docs/archive/plan/<task-slug>/`.
|
|
23
|
+
- Temporary reports and investigations move to `docs/archive/report/<report-slug>/`.
|
|
24
|
+
- `.gitignore` includes `docs/plan`, `docs/archive`, and `.dotdotgod` so local memory and the graph cache stay local by default.
|
|
25
|
+
|
|
26
|
+
Use the dotdotgod CLI initializer when it is already available in the target environment:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dotdotgod init <project-root>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
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:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
sh "${CLAUDE_PLUGIN_ROOT}/skills/project-initializer/scripts/init_project.sh" <project-root>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
## Workflow
|
|
43
|
+
|
|
44
|
+
1. Inspect the target project root.
|
|
45
|
+
- Check for existing `AGENTS.md`, `AGENT.md`, `CLAUDE.md`, `CODEX.md`, `README.md`, `.gitignore`, and `docs/`.
|
|
46
|
+
- Preserve project-specific instructions unless the user asks to replace them.
|
|
47
|
+
- If both `AGENT.md` and `AGENTS.md` exist, prefer `AGENTS.md` as canonical and leave `AGENT.md` untouched unless asked.
|
|
48
|
+
2. Run the initializer.
|
|
49
|
+
- Try `dotdotgod init` only when the CLI is available; otherwise run the bundled fallback script without blocking initialization.
|
|
50
|
+
- Default behavior creates missing files only.
|
|
51
|
+
- Existing files are skipped.
|
|
52
|
+
- `.gitignore` is created or appended with missing `docs/plan`, `docs/archive`, and `.dotdotgod` entries.
|
|
53
|
+
- `--dotdot-setting` additionally creates `docs/arch/CODE_CONVENTIONS.md`, adds it to the architecture README index, and adds an `AGENTS.md` reference.
|
|
54
|
+
- `--force` backs up replaced files as `<name>.bak.<timestamp>`.
|
|
55
|
+
3. Review generated files.
|
|
56
|
+
- Fill project-specific sections in `AGENTS.md` when context is available.
|
|
57
|
+
- Keep `CLAUDE.md` and `CODEX.md` thin so instructions do not drift.
|
|
58
|
+
- Treat `docs/plan` and `docs/archive` as local working memory unless the project deliberately changes that policy.
|
|
59
|
+
- 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.
|
|
60
|
+
4. Report the result.
|
|
61
|
+
- List created/skipped/backed-up files.
|
|
62
|
+
- Mention any existing instructions that still need manual consolidation.
|
|
63
|
+
|
|
64
|
+
## Bundled Resources
|
|
65
|
+
|
|
66
|
+
- `scripts/init_project.sh`: fallback scaffold generator that mirrors `dotdotgod init` with POSIX shell only.
|
|
67
|
+
- `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"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-load
|
|
3
|
+
description: Use this skill when the user asks Claude Code to load, refresh, inspect, summarize, or resume a repository's dotdotgod project memory; when starting unfamiliar work; or when a dd:load style project context pass is requested.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Project Load
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
|
|
11
|
+
Load the current repository's dotdotgod project memory in a read-only pass. Build a compact context map from shared agent instructions, README indexes, specs, architecture notes, test docs, active plans, and relevant archive notes.
|
|
12
|
+
|
|
13
|
+
Do not modify files during the load pass unless the user explicitly asks for edits after the summary.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. Identify the repository root and current state.
|
|
18
|
+
- Check current directory, git root, branch, and dirty worktree status.
|
|
19
|
+
- Mention user changes and avoid reverting or cleaning them.
|
|
20
|
+
2. Prefer the bounded CLI snapshot when available.
|
|
21
|
+
- If the user prompt contains explicit project-memory refs such as `[[PLAN_MODE]]`, run `dotdotgod expand <root> "<prompt>" --json` before broad `grep` or `find` scans, then read the resolved candidates selectively.
|
|
22
|
+
- If the prompt has high-signal natural refs such as `PLAN_MODE`, `docs/spec/PLAN_MODE.md`, or quoted doc names, use `dotdotgod expand <root> "<prompt>" --fuzzy --json` before broad scans; avoid fuzzy expansion for low-signal generic words alone and respect configured fuzzy low-signal add/remove terms.
|
|
23
|
+
- If `dotdotgod` is installed or available in the repository, run `dotdotgod load-snapshot <root> --json`.
|
|
24
|
+
- If the local environment allows package execution but no `dotdotgod` binary is available, optionally run `npx @dotdotgod/cli load-snapshot <root> --json`.
|
|
25
|
+
- Treat the snapshot as the first-pass project-memory map for cache status, graph size, memory areas, related communities, and archive inclusion policy.
|
|
26
|
+
- During load/planning, treat `dotdotgod status`, `load-snapshot`, `resolve`, `expand`, `graph impact`, `graph communities`, read-only `config`, and `index` as bounded context/status helpers. Avoid mutating scaffold/config commands such as `init` or `config init` unless the user explicitly asks for initialization or config creation.
|
|
27
|
+
- Use `dotdotgod graph impact <root> --changed <path> --compact --json` as a task-focused impact map when the user identifies a likely source/config/doc file.
|
|
28
|
+
- Use `grep` or `find` after `expand`, impact, and targeted reads when the task needs fallback discovery or raw source text search.
|
|
29
|
+
- Fall back to raw `dotdotgod graph impact <root> --changed <path> --json` only when diagnostics need the full payload.
|
|
30
|
+
- When graph impact surfaces traceability relations, inspect the related specs, tests, and docs before editing source.
|
|
31
|
+
- Related behavior docs: [load project](../../../docs/spec/LOAD_PROJECT.md), [cross-agent support](../../../docs/spec/CROSS_AGENT_SUPPORT.md), and [cross-agent architecture](../../../docs/arch/CROSS_AGENT_ARCHITECTURE.md).
|
|
32
|
+
- If the CLI is unavailable, network/package execution is undesirable, or the command fails, continue with the manual README-index fallback below.
|
|
33
|
+
3. Inspect baseline memory files when present:
|
|
34
|
+
- `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, `README.md`
|
|
35
|
+
- `docs/README.md`
|
|
36
|
+
- `docs/spec/README.md`
|
|
37
|
+
- `docs/test/README.md`
|
|
38
|
+
- `docs/arch/README.md`
|
|
39
|
+
- `docs/plan/README.md`
|
|
40
|
+
- `docs/archive/README.md`
|
|
41
|
+
4. Start with `AGENTS.md`, `README.md`, and `docs/README.md` when they are not already clear from the CLI snapshot or loaded context.
|
|
42
|
+
5. Follow README indexes. Read relevant docs under `docs/spec`, `docs/test`, and `docs/arch` selectively unless the task needs a full refresh.
|
|
43
|
+
6. List `docs/plan` entries first, then selectively read only relevant active plans.
|
|
44
|
+
7. Use `docs/archive/README.md` as the archive history map. Do not scan archive bodies by default; read targeted completed plans under `docs/archive/plan/` or reports under `docs/archive/report/` only when directly relevant.
|
|
45
|
+
8. Avoid broad reads of generated outputs, dependencies, databases, caches, secrets, and `.env*` contents.
|
|
46
|
+
|
|
47
|
+
## Output Shape
|
|
48
|
+
|
|
49
|
+
Respond concisely with:
|
|
50
|
+
|
|
51
|
+
- Project summary
|
|
52
|
+
- Key working rules
|
|
53
|
+
- Available commands and verification methods
|
|
54
|
+
- Documentation map
|
|
55
|
+
- Active plans
|
|
56
|
+
- Relevant archive notes
|
|
57
|
+
- Open TODO/TBD items or questions to clarify
|