@dotdotgod/codex 0.1.12 → 0.1.14

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/README.md CHANGED
@@ -18,10 +18,16 @@ Codex adapter for dotdotgod's context curation workflow. It packages reusable sk
18
18
  - Skills:
19
19
  - `project-load`: load project memory read-only.
20
20
  - `doc-first-planning`: plan from docs before implementation.
21
- - `project-initializer`: initialize shared agent docs and docs folders.
21
+ - `project-initializer`: initialize shared agent docs and docs folders, using `dotdotgod init` when available and the bundled fallback when not.
22
22
 
23
23
  Codex may not expose the same slash-command model as Pi or Claude Code. Treat `dd:load`, `dd:plan`, and `dd:init` as command-like trigger phrases for these skills unless the active Codex plugin runtime provides direct command registration.
24
24
 
25
+ ## Optional Hooks
26
+
27
+ Codex can run lifecycle hooks from trusted Codex configuration layers. dotdotgod does not require hooks: the bundled skills and `dd:load`, `dd:plan`, and `dd:init` trigger phrases work without them.
28
+
29
+ Use hooks only when you want opt-in reminders or validation around the same workflow. See [`hooks/README.md`](hooks/README.md) for advisory examples and stricter plan-safety patterns.
30
+
25
31
  ## Local Development
26
32
 
27
33
  Run package checks:
@@ -0,0 +1,98 @@
1
+ # Optional Codex Hooks
2
+
3
+ Codex hooks can complement dotdotgod skills and `dd:*` trigger phrases, but they are not required. The `project-load`, `doc-first-planning`, and `project-initializer` 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. Project-local `.codex/` hooks should be reviewed and trusted before use.
6
+
7
+ ## When To Use Hooks
8
+
9
+ - Use `dd:load` or the `project-load` skill when you intentionally want a curated project-memory load.
10
+ - Use `dd:plan` or the `doc-first-planning` skill before implementation, refactors, migrations, or multi-step work.
11
+ - Use hooks for small reminders at session start, prompt submission, supported tool boundaries, or stop time.
12
+
13
+ ## Opt-In Levels
14
+
15
+ - `advisory`: print reminders or read-only status only.
16
+ - `validate`: run `dotdotgod validate` after docs work or at stop time.
17
+ - `strict-plan-safety`: add local blocking scripts only when a reliable plan-only state signal exists.
18
+
19
+ Start with advisory hooks. Do not enable blocking hooks until you have tested the hook payload, Codex trust state, and your local policy script.
20
+
21
+ ## Advisory `hooks.json` Example
22
+
23
+ This example reminds Codex to use dotdotgod intentionally at session start:
24
+
25
+ ```json
26
+ {
27
+ "hooks": {
28
+ "SessionStart": [
29
+ {
30
+ "matcher": "startup|resume",
31
+ "hooks": [
32
+ {
33
+ "type": "command",
34
+ "command": "printf '%s\\n' 'dotdotgod: use dd:load or dotdotgod load-snapshot when project memory is needed.'",
35
+ "timeout": 10
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Inline TOML Shape
45
+
46
+ Codex can also express hooks in `config.toml`:
47
+
48
+ ```toml
49
+ [[hooks.PostToolUse]]
50
+ matcher = "Edit|Write|apply_patch"
51
+
52
+ [[hooks.PostToolUse.hooks]]
53
+ type = "command"
54
+ command = "sh .codex/hooks/validate-docs-if-needed.sh"
55
+ timeout = 120
56
+ statusMessage = "Checking dotdotgod docs when relevant"
57
+ ```
58
+
59
+ Use validation hooks only by explicit opt-in. They are useful for docs-heavy sessions but can be noisy if they run after every supported edit. Prefer a local wrapper that filters to docs-related edits or writes validation logs without returning invalid hook output.
60
+
61
+ ## Prompt Reminder Pattern
62
+
63
+ 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.
64
+
65
+ ## Strict Plan Safety Pattern
66
+
67
+ Strict safety belongs in a local script, not a generic package default:
68
+
69
+ ```json
70
+ {
71
+ "hooks": {
72
+ "PreToolUse": [
73
+ {
74
+ "matcher": "Edit|Write|apply_patch",
75
+ "hooks": [
76
+ {
77
+ "type": "command",
78
+ "command": "python3 .codex/hooks/dotdotgod-plan-safety.py",
79
+ "timeout": 10
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ ```
87
+
88
+ 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. Codex tool interception may not cover every command path, so do not treat this as complete Plan Mode parity.
89
+
90
+ ## Avoid By Default
91
+
92
+ - Do not run `pnpm run verify` after every tool call.
93
+ - Do not run `dotdotgod index` as an automatic stop hook.
94
+ - Do not move active plans to `docs/archive/` automatically.
95
+ - Do not block all source writes without an explicit plan-only state signal.
96
+ - Do not imply Codex has Claude/Pi slash-command parity.
97
+ - Treat `dotdotgod load-snapshot` as a cache-aware opt-in, not as a side-effect-free strict hook; it may lazily refresh the ignored `.dotdotgod/` cache.
98
+ - Do not return raw `dotdotgod status` JSON from `Stop`; Codex stop hooks need Codex-compatible hook output. Use a tested wrapper if you want stop-time status reporting.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdotgod/codex",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Codex adapter for dotdotgod project memory workflows.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,11 +19,12 @@
19
19
  "files": [
20
20
  ".codex-plugin",
21
21
  "skills",
22
+ "hooks",
22
23
  "README.md",
23
24
  "LICENSE"
24
25
  ],
25
26
  "scripts": {
26
- "verify": "node -e \"const fs=require('fs'); const req=['.codex-plugin/plugin.json','skills/project-load/SKILL.md','skills/doc-first-planning/SKILL.md','skills/project-initializer/SKILL.md','skills/project-initializer/scripts/init_project.sh']; JSON.parse(fs.readFileSync('.codex-plugin/plugin.json','utf8')); for (const f of req) { if (!fs.existsSync(f)) throw new Error('missing '+f); } console.log('codex adapter ok')\"",
27
+ "verify": "node -e \"const fs=require('fs'); const req=['.codex-plugin/plugin.json','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('.codex-plugin/plugin.json','utf8')); for (const f of req) { if (!fs.existsSync(f)) throw new Error('missing '+f); } console.log('codex adapter ok')\"",
27
28
  "pack:dry-run": "pnpm pack --dry-run --json"
28
29
  }
29
30
  }
@@ -20,14 +20,22 @@ Create a conservative dotdotgod project baseline that multiple AI coding agents
20
20
  - `docs/plan/<task-slug>/README.md` is the default shape for active plan work.
21
21
  - Completed plans move to `docs/archive/plan/<task-slug>/`.
22
22
  - Temporary reports and investigations move to `docs/archive/report/<report-slug>/`.
23
- - `.gitignore` includes `docs/plan` and `docs/archive` so local memory stays local by default.
23
+ - `.gitignore` includes `docs/plan`, `docs/archive`, and `.dotdotgod` so local memory and the graph cache stay local by default.
24
24
 
25
- Prefer the bundled dependency-free shell script for deterministic setup:
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:
26
32
 
27
33
  ```bash
28
34
  sh scripts/init_project.sh <project-root>
29
35
  ```
30
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
+
31
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.
32
40
 
33
41
  ## Workflow
@@ -37,21 +45,22 @@ Use `--dry-run` before touching an unfamiliar repository. Use `--dotdot-setting`
37
45
  - Preserve project-specific instructions unless the user asks to replace them.
38
46
  - If both `AGENT.md` and `AGENTS.md` exist, prefer `AGENTS.md` as canonical and leave `AGENT.md` untouched unless asked.
39
47
  2. Run the initializer.
48
+ - Try `dotdotgod init` only when the CLI is available; otherwise run the bundled fallback script without blocking initialization.
40
49
  - Default behavior creates missing files only.
41
50
  - Existing files are skipped.
42
- - `.gitignore` is created or appended with missing `docs/plan` and `docs/archive` entries.
51
+ - `.gitignore` is created or appended with missing `docs/plan`, `docs/archive`, and `.dotdotgod` entries.
43
52
  - `--dotdot-setting` additionally creates `docs/arch/CODE_CONVENTIONS.md`, adds it to the architecture README index, and adds an `AGENTS.md` reference.
44
53
  - `--force` backs up replaced files as `<name>.bak.<timestamp>`.
45
54
  3. Review generated files.
46
55
  - Fill project-specific sections in `AGENTS.md` when context is available.
47
56
  - Keep `CLAUDE.md` and `CODEX.md` thin so instructions do not drift.
48
57
  - Treat `docs/plan` and `docs/archive` as local working memory unless the project deliberately changes that policy.
49
- - When adding behavior specs, run `dotdotgod validate` and follow any traceability schema/example shown in validation errors.
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.
50
59
  4. Report the result.
51
60
  - List created/skipped/backed-up files.
52
61
  - Mention any existing instructions that still need manual consolidation.
53
62
 
54
63
  ## Bundled Resources
55
64
 
56
- - `scripts/init_project.sh`: creates the scaffold and handles overwrite policy with POSIX shell only.
65
+ - `scripts/init_project.sh`: fallback scaffold generator that mirrors `dotdotgod init` with POSIX shell only.
57
66
  - `references/agent-docs.md`: naming rationale and expected content model for shared agent docs.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Project Initializer"
3
- short_description: "Initialize agent docs and local docs folders with shell."
4
- default_prompt: "Initialize this project with AGENTS.md, CLAUDE.md, CODEX.md, docs folders, and local plan/archive gitignore entries."
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."
@@ -13,7 +13,7 @@ Initializes:
13
13
  docs/arch/README.md
14
14
  docs/plan/README.md
15
15
  docs/archive/README.md
16
- .gitignore entries for docs/plan and docs/archive
16
+ .gitignore entries for docs/plan, docs/archive, and .dotdotgod
17
17
  EOF
18
18
  }
19
19
 
@@ -339,3 +339,4 @@ This directory is local-only and ignored by git by default."
339
339
 
340
340
  ensure_gitignore_entry "docs/plan"
341
341
  ensure_gitignore_entry "docs/archive"
342
+ ensure_gitignore_entry ".dotdotgod"