@dotdotgod/codex 0.1.13 → 0.1.15

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
@@ -1,13 +1,15 @@
1
1
  # @dotdotgod/codex
2
2
 
3
- Codex adapter for dotdotgod's context curation workflow. It packages reusable skills that help Codex load curated project memory, plan from docs before implementation, and initialize the shared agent documentation scaffold.
3
+ > **Change a file, know what else must be checked.**
4
+
5
+ Codex adapter for dotdotgod's context curation workflow. It packages reusable skills that help Codex load curated project memory, plan from docs before implementation, and initialize the shared agent documentation scaffold so changes start with the right specs, tests, plans, and archive map.
4
6
 
5
7
  ## What Gets Better?
6
8
 
7
- - Codex can start from `AGENTS.md` and the dotdotgod docs map instead of rebuilding context manually.
9
+ - Codex can start from `AGENTS.md` and the dotdotgod docs map.
8
10
  - Load guidance prefers `dotdotgod load-snapshot <root> --json` when the CLI is available, then falls back to README-index reads.
9
11
  - Codex 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.
10
- - Product intent, design rationale, and verification standards stay in durable docs instead of transient chat.
12
+ - Product intent, design rationale, and verification standards stay in durable docs.
11
13
  - Planning work captures current intent in `docs/plan/<task-slug>/README.md` before implementation.
12
14
  - Completed plans and temporary reports use the same archive structure as Pi and Claude Code, turning outcomes into future context.
13
15
  - `dd:load`, `dd:plan`, and `dd:init` can be used as command-like trigger phrases where direct slash commands are unavailable.
@@ -22,6 +24,12 @@ Codex adapter for dotdotgod's context curation workflow. It packages reusable sk
22
24
 
23
25
  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
26
 
27
+ ## Optional Hooks
28
+
29
+ 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.
30
+
31
+ 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.
32
+
25
33
  ## Local Development
26
34
 
27
35
  Run package checks:
@@ -42,6 +50,6 @@ pnpm --filter @dotdotgod/codex run pack:dry-run
42
50
 
43
51
  ## Compared with Graphify-Style Memory
44
52
 
45
- This adapter packages reusable workflow skills rather than a repo-wide extraction engine. It guides Codex to prefer a bounded dotdotgod load snapshot when available, avoid broad archive scans, and follow README indexes before reading raw files.
53
+ This adapter packages reusable workflow skills. It guides Codex to prefer a bounded dotdotgod load snapshot when available, avoid broad archive scans, and follow README indexes before reading raw files.
46
54
 
47
55
  The strength is structured retrieval: project docs declare which files are rules, specs, architecture, verification, active intent, or historical memory. That keeps the memory layer portable across Codex runtimes and useful on small tasks where a large graph report would be overhead.
@@ -0,0 +1,104 @@
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 . --include-local-memory --check-index` 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
+ ## Review Before First Run
22
+
23
+ Codex may detect a configured hook but keep it disabled until you review it. If Codex shows `1 hook needs review before it can run. Open /hooks to review it.`, open `/hooks`, inspect the command, and approve only commands you trust.
24
+
25
+ After approval, trigger a small supported edit such as an `apply_patch` documentation comment change and confirm the hook status message or command output appears. If the hook was added while a Codex session was already running, restart Codex before the smoke test so the current configuration is loaded.
26
+
27
+ ## Advisory `hooks.json` Example
28
+
29
+ This example reminds Codex to use dotdotgod intentionally at session start:
30
+
31
+ ```json
32
+ {
33
+ "hooks": {
34
+ "SessionStart": [
35
+ {
36
+ "matcher": "startup|resume",
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "printf '%s\\n' 'dotdotgod: use dd:load or dotdotgod load-snapshot when project memory is needed.'",
41
+ "timeout": 10
42
+ }
43
+ ]
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Inline TOML Shape
51
+
52
+ Codex can also express hooks in `config.toml`:
53
+
54
+ ```toml
55
+ [[hooks.PostToolUse]]
56
+ matcher = "Edit|Write|apply_patch"
57
+
58
+ [[hooks.PostToolUse.hooks]]
59
+ type = "command"
60
+ command = "dotdotgod validate . --include-local-memory --check-index"
61
+ timeout = 120
62
+ statusMessage = "Checking dotdotgod docs and index freshness"
63
+ ```
64
+
65
+ 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. `--check-index` compares current markdown fingerprints with `.dotdotgod/manifest.json` without refreshing the cache; if the only failure is an index freshness error, run `dotdotgod index .` or `pnpm run verify:cache` intentionally.
66
+
67
+ ## Prompt Reminder Pattern
68
+
69
+ 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.
70
+
71
+ ## Strict Plan Safety Pattern
72
+
73
+ Strict safety belongs in a local script, not a generic package default:
74
+
75
+ ```json
76
+ {
77
+ "hooks": {
78
+ "PreToolUse": [
79
+ {
80
+ "matcher": "Edit|Write|apply_patch",
81
+ "hooks": [
82
+ {
83
+ "type": "command",
84
+ "command": "python3 .codex/hooks/dotdotgod-plan-safety.py",
85
+ "timeout": 10
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ }
91
+ }
92
+ ```
93
+
94
+ 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.
95
+
96
+ ## Avoid By Default
97
+
98
+ - Do not run `pnpm run verify` after every tool call.
99
+ - Do not run `dotdotgod index` as an automatic stop hook.
100
+ - Do not move active plans to `docs/archive/` automatically.
101
+ - Do not block all source writes without an explicit plan-only state signal.
102
+ - Do not imply Codex has Claude/Pi slash-command parity.
103
+ - 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.
104
+ - 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.13",
3
+ "version": "0.1.15",
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,6 +20,6 @@ Put durable, project-wide instructions in `AGENTS.md`:
20
20
  - coding and review expectations
21
21
  - environment constraints
22
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 rather than duplicating it across agent memory files.
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
24
 
25
25
  Do not duplicate the same body in `CLAUDE.md` and `CODEX.md`; duplication causes drift.
@@ -34,7 +34,7 @@ Do not modify files during the load pass unless the user explicitly asks for edi
34
34
  - `docs/plan/README.md`
35
35
  - `docs/archive/README.md`
36
36
  4. Start with `AGENTS.md`, `README.md`, and `docs/README.md` when they are not already clear from the CLI snapshot or loaded context.
37
- 5. Follow README indexes. Read relevant docs under `docs/spec`, `docs/test`, and `docs/arch` selectively instead of re-scanning every listed file unless the task needs a full refresh.
37
+ 5. Follow README indexes. Read relevant docs under `docs/spec`, `docs/test`, and `docs/arch` selectively unless the task needs a full refresh.
38
38
  6. List `docs/plan` entries first, then selectively read only relevant active plans.
39
39
  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.
40
40
  8. Avoid broad reads of generated outputs, dependencies, databases, caches, secrets, and `.env*` contents.