polydeukes 0.6.1 → 0.8.0

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.
Files changed (108) hide show
  1. package/README.ko.md +16 -28
  2. package/README.md +16 -28
  3. package/dist/baseline.d.ts +37 -1
  4. package/dist/baseline.js +68 -1
  5. package/dist/bin.d.ts +3 -4
  6. package/dist/bin.js +73 -90
  7. package/dist/covenant/bash-line.d.ts +130 -0
  8. package/dist/covenant/bash-line.js +566 -0
  9. package/dist/covenant/declaration-engine.d.ts +108 -0
  10. package/dist/covenant/declaration-engine.js +415 -0
  11. package/dist/covenant/discipline.d.ts +109 -0
  12. package/dist/covenant/discipline.js +667 -0
  13. package/dist/covenant/dispatch.d.ts +156 -0
  14. package/dist/covenant/dispatch.js +250 -0
  15. package/dist/covenant/extract-steps.d.ts +122 -0
  16. package/dist/covenant/extract-steps.js +0 -0
  17. package/dist/covenant/mention.d.ts +117 -0
  18. package/dist/covenant/mention.js +209 -0
  19. package/dist/covenant/module.d.ts +25 -0
  20. package/dist/covenant/module.js +23 -0
  21. package/dist/covenant/mutation-rules.d.ts +40 -0
  22. package/dist/covenant/mutation-rules.js +146 -0
  23. package/dist/covenant/relations.d.ts +46 -0
  24. package/dist/covenant/relations.js +68 -0
  25. package/dist/covenant/run-covenant.d.ts +95 -0
  26. package/dist/covenant/run-covenant.js +164 -0
  27. package/dist/covenant/self-mod.d.ts +55 -0
  28. package/dist/covenant/self-mod.js +84 -0
  29. package/dist/covenant/shell-evidence.d.ts +38 -0
  30. package/dist/covenant/shell-evidence.js +247 -0
  31. package/dist/covenant/shell-mod.d.ts +84 -0
  32. package/dist/covenant/shell-mod.js +213 -0
  33. package/dist/covenant/supply.d.ts +54 -0
  34. package/dist/covenant/supply.js +50 -0
  35. package/dist/covenant/transcript-mod.d.ts +60 -0
  36. package/dist/covenant/transcript-mod.js +254 -0
  37. package/dist/covenant/ttl-witness.d.ts +47 -0
  38. package/dist/covenant/ttl-witness.js +80 -0
  39. package/dist/covenant-check.d.ts +74 -41
  40. package/dist/covenant-check.js +372 -129
  41. package/dist/diff-ir.d.ts +28 -0
  42. package/dist/diff-ir.js +310 -0
  43. package/dist/docs/README.ko.md +10 -9
  44. package/dist/docs/README.md +10 -9
  45. package/dist/docs/catalog.json +76 -28
  46. package/dist/docs/concepts/judgment.ko.md +2 -2
  47. package/dist/docs/concepts/judgment.md +2 -2
  48. package/dist/docs/how-to/configure-project.ko.md +16 -16
  49. package/dist/docs/how-to/configure-project.md +15 -12
  50. package/dist/docs/how-to/connect-surfaces.ko.md +67 -34
  51. package/dist/docs/how-to/connect-surfaces.md +67 -34
  52. package/dist/docs/how-to/write-disciplines.ko.md +64 -7
  53. package/dist/docs/how-to/write-disciplines.md +65 -7
  54. package/dist/docs/index.json +744 -362
  55. package/dist/docs/reference/cli/covenant-check.ko.md +112 -65
  56. package/dist/docs/reference/cli/covenant-check.md +114 -59
  57. package/dist/docs/reference/cli/docs.ko.md +2 -2
  58. package/dist/docs/reference/cli/docs.md +2 -2
  59. package/dist/docs/reference/cli/explain.ko.md +20 -15
  60. package/dist/docs/reference/cli/explain.md +22 -15
  61. package/dist/docs/reference/cli/init.ko.md +91 -52
  62. package/dist/docs/reference/cli/init.md +81 -55
  63. package/dist/docs/reference/configuration/index.ko.md +182 -71
  64. package/dist/docs/reference/configuration/index.md +188 -76
  65. package/dist/docs/reference/packages/adapter-claude-code.ko.md +39 -11
  66. package/dist/docs/reference/packages/adapter-claude-code.md +40 -14
  67. package/dist/docs/reference/packages/adapter-codex.ko.md +99 -0
  68. package/dist/docs/reference/packages/adapter-codex.md +100 -0
  69. package/dist/docs/reference/packages/adapter-grok.ko.md +81 -0
  70. package/dist/docs/reference/packages/adapter-grok.md +83 -0
  71. package/dist/docs/reference/packages/core.ko.md +50 -4
  72. package/dist/docs/reference/packages/core.md +55 -6
  73. package/dist/docs/reference/packages/polydeukes.ko.md +139 -77
  74. package/dist/docs/reference/packages/polydeukes.md +147 -81
  75. package/dist/docs/reference/packages/sdk-ts.ko.md +164 -0
  76. package/dist/docs/reference/packages/sdk-ts.md +167 -0
  77. package/dist/docs/troubleshooting.ko.md +51 -19
  78. package/dist/docs/troubleshooting.md +53 -17
  79. package/dist/docs/tutorials/first-judgment.ko.md +6 -4
  80. package/dist/docs/tutorials/first-judgment.md +6 -4
  81. package/dist/explain.d.ts +1 -1
  82. package/dist/explain.js +37 -22
  83. package/dist/load-config.d.ts +25 -1
  84. package/dist/load-config.js +21 -3
  85. package/dist/pre-state-reader.d.ts +1 -1
  86. package/dist/pre-state-reader.js +1 -1
  87. package/dist/scaffold-project.d.ts +2 -2
  88. package/dist/scaffold-project.js +12 -4
  89. package/dist/schema/polydeukes.schema.json +12 -0
  90. package/dist/worktree-reader.d.ts +19 -0
  91. package/dist/worktree-reader.js +30 -0
  92. package/package.json +5 -18
  93. package/dist/claude-code-hook.d.ts +0 -79
  94. package/dist/claude-code-hook.js +0 -372
  95. package/dist/claude-code.d.ts +0 -6
  96. package/dist/claude-code.js +0 -6
  97. package/dist/covenant-module.d.ts +0 -25
  98. package/dist/covenant-module.js +0 -42
  99. package/dist/docs/reference/packages/adapter-git.ko.md +0 -101
  100. package/dist/docs/reference/packages/adapter-git.md +0 -108
  101. package/dist/docs/reference/packages/covenant.ko.md +0 -115
  102. package/dist/docs/reference/packages/covenant.md +0 -123
  103. package/dist/index.d.ts +0 -22
  104. package/dist/index.js +0 -21
  105. package/dist/init-claude-code.d.ts +0 -52
  106. package/dist/init-claude-code.js +0 -586
  107. package/dist/init-grok.d.ts +0 -51
  108. package/dist/init-grok.js +0 -242
@@ -2,85 +2,118 @@
2
2
 
3
3
  [English](./init.md) · **한국어**
4
4
 
5
- 프로젝트를 세션 표면에 연결합니다. `claude-code`와 `grok` 두 형식 모두 대상 프로젝트에서
6
- 설치된 패키지를 찾을 수 있는지 먼저 검사합니다. 그 검사가 끝나기 전에는 파일을 쓰지 않습니다.
5
+ `pdks init`은 에이전트와 무관한 초기 파일을 만듭니다. 설정 파일과 텔레메트리 제외 항목
6
+ 둘입니다. 이 명령은 어느 에이전트도 알지 못합니다. 세션 표면 등록은 그 에이전트의 어댑터가
7
+ 맡는 별도 명령입니다. Claude Code는 `pdks-claude-code init`, Grok는 `pdks-grok init`,
8
+ Codex는 `pdks-codex init`입니다.
7
9
 
8
10
  <a id="init-syntax"></a>
9
11
  ## 구문
10
12
 
11
13
  ```sh
12
- pdks init claude-code
13
- pdks init grok
14
+ pdks init
14
15
  ```
15
16
 
16
- 두 형식 모두 다시 실행할 수 있습니다. 이미 있는 산출물은 보존하고 `skipped`로 보고합니다.
17
- 사전 검사에 실패하면 파일을 쓰지 않고 종료 코드 `2`를 반환합니다.
17
+ 다른 인자를 주면 사용법을 출력하고 종료 코드 `2`를 반환합니다. 이미 있는 산출물은 보존하고
18
+ `skipped`로 보고하며, 사전 검사에 실패하면 파일을 쓰지 않고 종료 코드 `2`를 반환합니다.
18
19
 
19
20
  <a id="init-common"></a>
20
- ## 공통 사전 검사와 초기 파일
21
+ ## `pdks init` — 초기 파일
21
22
 
22
- 설치 순서는 다음과 같습니다.
23
+ 이 명령의 순서는 다음과 같습니다.
23
24
 
24
25
  1. 대상 프로젝트에서 `polydeukes`를 찾을 수 있는지 확인합니다.
25
26
  2. 공통 설정과 텔레메트리 제외 항목을 만듭니다.
26
- 3. 표면별 등록 파일을 추가합니다.
27
27
 
28
- 두 설치기가 공통으로 만드는 것은 `polydeukes.config.yaml`과 `.gitignore`의 `.polydeukes/`
29
- 항목입니다. 설정 파일에는 언어 블록, 보호 목록, 증인 블록, 주석으로 된 규율 예제가 있습니다.
30
- 완성된 정책이 아니라 프로젝트에 맞춰 고칠 출발점입니다.
28
+ 어느 표면이든 여기서 출발합니다.
29
+
30
+ - `polydeukes.config.yaml`
31
+ - `.gitignore`의 `.polydeukes/` 항목
32
+
33
+ 설정 파일에는 언어 블록, 보호 목록, 증인(witness) 블록, 주석으로 된 규율(discipline) 예제가
34
+ 있습니다. 완성된 정책이 아니라 프로젝트에 맞춰 고칠 출발점입니다.
31
35
 
32
36
  <a id="init-claude-code"></a>
33
- ## `pdks init claude-code`
37
+ ## Claude Code — `pdks-claude-code init`
38
+
39
+ Claude Code 세션 표면은
40
+ [`@polydeukes/adapter-claude-code`](../packages/adapter-claude-code.ko.md)가 설치합니다. 이
41
+ 어댑터에는 자체 실행 파일이 있습니다.
42
+
43
+ ```sh
44
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-claude-code
45
+ npx pdks-claude-code init
46
+ ```
34
47
 
35
- Claude Code 세션 표면에 필요한 파일은 다음과 같습니다.
48
+ 이 명령은 먼저 `pdks init`으로 초기 파일을 만든 뒤 Claude Code 등록 산출물을 씁니다.
36
49
 
37
50
  - `.claude/hooks/covenant-pretooluse.mjs`
38
51
  - `.claude/settings.json`
39
52
  - `.claude/rules/polydeukes.md`
40
53
  - `.claude/skills/discipline-draft/SKILL.md`
41
- - `polydeukes.config.yaml`
42
- - `.gitignore`
43
54
 
44
- 훅은 `polydeukes/claude-code`에 판정을 맡깁니다. 설정에는 PreToolUse 등록을 병합하고,
45
- 문서 안내 파일은 AI 파트너가 웹 검색 대신 `pdks docs`를 쓰도록 알려 줍니다.
46
- 스킬은 설명된 규율 문제를 설정 항목으로 바꾸는 절차를 제공합니다.
55
+ 산출물별 동작은 [표면 연결하기](../../how-to/connect-surfaces.ko.md#claude-code)에 있습니다.
47
56
 
48
- 기존 훅, 설정 데이터, 문서 안내, 스킬 파일은 보존합니다. 호스트 설정에는 필요한 등록을
49
- 병합하고 `.gitignore`에는 빠진 항목만 추가합니다. 아래 설명처럼 기존 Grok 등록을 조정할
50
- 수도 있으므로 재실행이 언제나 아무것도 바꾸지 않는 것은 아닙니다.
57
+ <a id="init-grok"></a>
58
+ ## Grok — `pdks-grok init`
51
59
 
52
- 패키지 버전을 올려도 사용자가 수정한 스킬은 덮어쓰지 않습니다. 임시 프로젝트에서 새 사본을
53
- 만들어 기존 파일과 비교한 뒤, 백업하고 필요한 부분만 반영하세요. 강제로 다시 만들려고
54
- 작업 중인 프로젝트의 스킬을 지우지는 마세요.
60
+ Grok 세션 표면은
61
+ [`@polydeukes/adapter-grok`](../packages/adapter-grok.ko.md)가 설치합니다. 이
62
+ 어댑터에는 자체 실행 파일이 있습니다.
55
63
 
56
- <a id="init-grok"></a>
57
- ## `pdks init grok`
64
+ ```sh
65
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-grok
66
+ npx pdks-grok init
67
+ ```
58
68
 
59
- Grok 전용 프로젝트에는 다음 파일을 만듭니다.
69
+ 이 명령은 먼저 `pdks init`으로 초기 파일을 만든 뒤 Grok 등록 산출물을 씁니다.
60
70
 
61
71
  - `.grok/hooks/covenant-pretooluse.mjs`
62
72
  - `.grok/hooks/covenant-pretooluse.json`
63
- - `polydeukes.config.yaml`
64
- - `.gitignore`
65
-
66
- Claude Code 형식과의 차이는 다음과 같습니다.
67
-
68
- - `.claude/` 파일을 만들지 않고 Grok 훅 JSON에 등록합니다.
69
- - Claude 위임 훅이 이미 있으면 새 훅을 만들지 않고 Grok JSON에서 기존 파일을 지정합니다.
70
- - 새 등록의 제한 시간은 60초입니다. Grok 호스트 기본값은 5초이며, 훅 실행이 시간 초과로
71
- 끝나면 해당 호출을 차단하지 않습니다(fail-open). Claude 설정에 같은 명령이 등록돼 있으면
72
- Grok의 매칭 조건도 맞춰
73
- 명령과 조건이 모두 같게 만듭니다.
74
- - 어느 설치기를 다시 실행하든, 설치기가 만든 Grok 훅 명령을 기존 Claude 파일로 바꾸고
75
- 매칭 조건을 맞출 수 있습니다. 사용자가 다른 곳을 지정한 명령은 그대로 두며 기존 제한
76
- 시간도 유지합니다.
77
- - 나중에 Claude 설정을 제거했다면 Grok JSON을 다시 만들어 Grok 기본 매칭 조건을 복원하세요.
78
- 사용자 설정부터 백업해야 합니다. 변경 뒤에는 Grok의 Hooks 탭을 다시 불러오거나 새 세션을
79
- 시작합니다.
80
-
81
- Grok는 Claude 세션 증인 밸브가 요구하는 인간 메시지 증거를 제공하지 않습니다.
73
+
74
+ `.claude/` 파일을 만들거나 고치지 않습니다. 새 등록의 제한 시간은 60초입니다. Grok 호스트
75
+ 기본값은 5초이며, 훅 실행이 시간 초과로 끝나면 해당 호출을 차단하지 않습니다(fail-open).
76
+ 세션 어댑터를 한 프로젝트에 둘 이상 설치하면 호출마다 판정기가 두 번 실행될 수 있습니다.
77
+
78
+ Grok는 Claude 세션 증인(witness) 밸브가 요구하는 인간 메시지 증거를 제공하지 않습니다.
82
79
  대화 기록은 Claude JSONL이 아니라 ACP `updates.jsonl`입니다.
83
- [Grok 복구 안내](../../troubleshooting.ko.md#grok-witness)를 참고하세요.
80
+ [Grok 복구 안내](../../troubleshooting.ko.md#grok-witness)를 참고하세요. 산출물별 동작은
81
+ [표면 연결하기](../../how-to/connect-surfaces.ko.md#grok)에 있습니다.
82
+
83
+ <a id="init-codex"></a>
84
+ ## Codex — `pdks-codex init`
85
+
86
+ Codex 세션 표면은
87
+ [`@polydeukes/adapter-codex`](../packages/adapter-codex.ko.md)가 설치합니다. 이
88
+ 어댑터에는 자체 실행 파일이 있습니다.
89
+
90
+ ```sh
91
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-codex
92
+ npx pdks-codex init
93
+ ```
94
+
95
+ 이 명령은 먼저 `pdks init`으로 초기 파일을 만든 뒤 Codex 등록 산출물을 씁니다.
96
+
97
+ - `.codex/hooks/covenant-pretooluse.mjs`
98
+ - `.codex/hooks.json`
99
+
100
+ `hooks.json`은 덮어쓰지 않고 병합합니다. 다른 이벤트, 다른 matcher, 설치기가 모르는 키는
101
+ 그대로 둡니다. 초기 설정은 기본적으로 `.codex/hooks`를 보호하므로, 이 설치기가 만드는 등록
102
+ 파일은 같은 설치가 만든 설정이 지킵니다.
103
+
104
+ **훅 승인까지가 설치입니다.** Codex는 훅 정의의 해시로 신뢰를 기록하므로, 생성된 훅은 검토
105
+ 대상으로 표시되고 `/hooks`에서 승인하기 전까지 건너뛰어집니다. 누군가 승인하기 전까지는
106
+ 아무것도 판정되지 않습니다. `init`이 실행할 때마다 바이트가 같은 명령 문자열을 쓰는 이유가
107
+ 이것입니다. 문자열이 바뀌면 다시 승인해야 합니다.
108
+
109
+ Codex는 모든 파일 편집을 `apply_patch` 하나로 정규화하고, 경로 인자가 아니라 패치 텍스트를
110
+ 보냅니다. `Edit`과 `Write`는 `.codex/hooks.json`에 적을 수 있는 matcher 별칭이며 도구 이름으로
111
+ 도착하지 않습니다. 패치 하나가 여러 파일을 건드리면 파일마다 IR 원소 하나가 실리고, 그중
112
+ 하나라도 차단되면 호출 전체가 차단됩니다.
113
+
114
+ Codex에는 대화 기록 채널이 없어서 세션 증인(witness) 밸브가 읽을 사람 메시지 증거가
115
+ 없습니다. 의도한 편집이 차단되면 자신의 터미널에서 수행하세요. 산출물별 동작은
116
+ [표면 연결하기](../../how-to/connect-surfaces.ko.md#codex)에 있습니다.
84
117
 
85
118
  <a id="init-results"></a>
86
119
  ## 결과와 실패 조건
@@ -103,16 +136,22 @@ Grok는 Claude 세션 증인 밸브가 요구하는 인간 메시지 증거를
103
136
  ## 예제
104
137
 
105
138
  ```sh
106
- pdks init claude-code
107
- pdks init grok
139
+ pdks init
140
+ npx pdks-claude-code init
141
+ npx pdks-grok init
142
+ npx pdks-codex init
108
143
  ```
109
144
 
110
- 설치기는 CLI 명령입니다. `polydeukes`나 `polydeukes/claude-code` 계약의 공개 심볼이
111
- 아닙니다.
145
+ 설치기는 CLI 명령입니다. `polydeukes` 계약의 공개 심볼이 아닙니다.
112
146
 
113
147
  <a id="init-see-also"></a>
114
148
  ## 함께 보기
115
149
 
150
+ - [`@polydeukes/adapter-claude-code`](../packages/adapter-claude-code.ko.md) — Claude Code 설치
151
+ 단위와 그 실행 파일
152
+ - [`@polydeukes/adapter-grok`](../packages/adapter-grok.ko.md) — Grok 설치 단위와 그 실행 파일
153
+ - [`@polydeukes/adapter-codex`](../packages/adapter-codex.ko.md) — Codex 설치 단위와 그 실행
154
+ 파일
116
155
  - [`pdks docs`](./docs.ko.md)
117
156
  - [`pdks explain`](./explain.ko.md)
118
157
  - [설정 참조](../configuration/index.ko.md)
@@ -2,31 +2,30 @@
2
2
 
3
3
  **English** · [한국어](./init.ko.md)
4
4
 
5
- `pdks init` wires a project into the session surface. The command has two forms: `claude-code` and
6
- `grok`. Both start with the same preflight: the package must resolve from the target project before
7
- anything is written.
5
+ `pdks init` creates the agent-neutral project scaffold: the config file and the telemetry ignore
6
+ line. It knows no agent. Registering a session surface is a separate command owned by that
7
+ agent's adapter — `pdks-claude-code init` for Claude Code, `pdks-grok init` for Grok, and
8
+ `pdks-codex init` for Codex.
8
9
 
9
10
  <a id="init-syntax"></a>
10
11
  ## Syntax
11
12
 
12
13
  ```sh
13
- pdks init claude-code
14
- pdks init grok
14
+ pdks init
15
15
  ```
16
16
 
17
- Both forms are idempotent. Existing artifacts are left in place and reported as skipped. A preflight
18
- failure writes nothing and exits `2`.
17
+ Any other argument prints usage and exits `2`. The command is idempotent: existing artifacts are
18
+ left in place and reported as skipped, and a preflight failure writes nothing and exits `2`.
19
19
 
20
20
  <a id="init-common"></a>
21
- ## Shared preflight and scaffold
21
+ ## `pdks init` — the scaffold
22
22
 
23
- The installer does three things in order:
23
+ The command does two things in order:
24
24
 
25
25
  1. Resolve `polydeukes` from the target project.
26
26
  2. Create the shared project-side scaffold: config and telemetry ignore line.
27
- 3. Add the surface-specific registration artifacts.
28
27
 
29
- The shared scaffold is the same for both installers:
28
+ The scaffold is the same one every surface starts from:
30
29
 
31
30
  - `polydeukes.config.yaml`
32
31
  - `.gitignore` with `.polydeukes/`
@@ -35,64 +34,85 @@ The config file starts with the language block, a protection list, a witness blo
35
34
  discipline examples. It is a starter policy, not a complete project policy.
36
35
 
37
36
  <a id="init-claude-code"></a>
38
- ## `pdks init claude-code`
37
+ ## Claude Code — `pdks-claude-code init`
39
38
 
40
- This form installs the Claude Code session surface.
39
+ The Claude Code session surface is installed by
40
+ [`@polydeukes/adapter-claude-code`](../packages/adapter-claude-code.md), which ships its own bin:
41
41
 
42
- Created artifacts:
42
+ ```sh
43
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-claude-code
44
+ npx pdks-claude-code init
45
+ ```
46
+
47
+ That command runs `pdks init` for the scaffold, then writes the Claude Code registration
48
+ artifacts:
43
49
 
44
50
  - `.claude/hooks/covenant-pretooluse.mjs`
45
51
  - `.claude/settings.json`
46
52
  - `.claude/rules/polydeukes.md`
47
53
  - `.claude/skills/discipline-draft/SKILL.md`
48
- - `polydeukes.config.yaml`
49
- - `.gitignore`
50
-
51
- What each artifact does:
52
-
53
- - The hook file is a delegator that imports `polydeukes/claude-code`.
54
- - The settings file merges a PreToolUse registration instead of replacing the whole file.
55
- - The discovery file tells the AI partner to use `pdks docs` instead of web search.
56
- - The skill file turns a described discipline problem into a config entry.
57
- - The config and ignore line come from the shared scaffold.
58
54
 
59
- Existing hook, config, discovery, and skill files are preserved. Settings registrations are
60
- merged and the ignore entry is appended if absent. Re-running can also reconcile a generated
61
- Grok registration as described below; it is not an unconditional no-op.
62
-
63
- Package upgrades do not overwrite a customized skill. Generate a fresh copy in a disposable
64
- project, compare it with the existing file, and merge the selected changes after taking a backup.
65
- Do not delete the working project's skill merely to force regeneration.
55
+ Details and the per-artifact behaviour are in
56
+ [Connect the surfaces](../../how-to/connect-surfaces.md#claude-code).
66
57
 
67
58
  <a id="init-grok"></a>
68
- ## `pdks init grok`
59
+ ## Grok — `pdks-grok init`
60
+
61
+ The Grok session surface is installed by
62
+ [`@polydeukes/adapter-grok`](../packages/adapter-grok.md), which ships its own bin:
69
63
 
70
- This form installs the Grok session surface.
64
+ ```sh
65
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-grok
66
+ npx pdks-grok init
67
+ ```
71
68
 
72
- Created artifacts:
69
+ That command runs `pdks init` for the scaffold, then writes the Grok registration artifacts:
73
70
 
74
71
  - `.grok/hooks/covenant-pretooluse.mjs`
75
72
  - `.grok/hooks/covenant-pretooluse.json`
76
- - `polydeukes.config.yaml`
77
- - `.gitignore`
78
-
79
- What differs from the Claude Code form:
80
-
81
- - It does not create `.claude/` files.
82
- - It writes a Grok hook JSON registration instead of `.claude/settings.json`.
83
- - If a Claude delegator already exists, the Grok JSON names it instead of creating another
84
- delegator.
85
- - Generated registrations use a timeout of 60 seconds. The Grok host default is 5 seconds, and a
86
- timed-out hook fails open. When Claude settings register the same command, the Grok matcher
87
- follows that registration so command and matcher agree.
88
- - Re-running either installer can retarget a generated Grok-delegator command to the existing
89
- Claude file and reconcile its matcher. A custom command is left alone; an existing timeout stays.
90
- - If you later remove Claude settings, regenerate the Grok JSON to restore the Grok-native matcher.
91
- Back up custom settings first. Reload Grok's Hooks tab or start a new session after changes.
73
+
74
+ It does not create or rewrite `.claude/` files. Generated registrations use a timeout of 60
75
+ seconds. The Grok host default is 5 seconds, and a timed-out hook fails open. Installing more
76
+ than one session adapter in one project can run the judge twice per call.
92
77
 
93
78
  Grok does not supply the human-message evidence required by the Claude session witness valve.
94
79
  The session log is ACP `updates.jsonl`, not Claude's JSONL.
95
- See [Grok recovery](../../troubleshooting.md#grok-witness).
80
+ See [Grok recovery](../../troubleshooting.md#grok-witness). Details are in
81
+ [Connect the surfaces](../../how-to/connect-surfaces.md#grok).
82
+
83
+ <a id="init-codex"></a>
84
+ ## Codex — `pdks-codex init`
85
+
86
+ The Codex session surface is installed by
87
+ [`@polydeukes/adapter-codex`](../packages/adapter-codex.md), which ships its own bin:
88
+
89
+ ```sh
90
+ npm install --save-dev polydeukes @polydeukes/core @polydeukes/adapter-codex
91
+ npx pdks-codex init
92
+ ```
93
+
94
+ That command runs `pdks init` for the scaffold, then writes the Codex registration artifacts:
95
+
96
+ - `.codex/hooks/covenant-pretooluse.mjs`
97
+ - `.codex/hooks.json`
98
+
99
+ `hooks.json` is merged rather than overwritten: other events, other matchers, and keys the
100
+ installer does not know are left in place. The scaffold config protects `.codex/hooks` by
101
+ default, so the registration this installer writes is covered by the config it writes.
102
+
103
+ **Approving the hook is part of the install.** Codex records trust against the hash of a hook's
104
+ definition, so the generated hook is listed for review and skipped until you approve it with
105
+ `/hooks`. Until someone does, nothing is judged. This is why `init` writes a byte-identical
106
+ command string on every run — a changed string needs approving again.
107
+
108
+ Codex normalises every file edit into one tool, `apply_patch`, and delivers the patch text
109
+ rather than a path argument. `Edit` and `Write` are matcher aliases you may write in
110
+ `.codex/hooks.json`; they never arrive as the tool name. One patch that touches several files
111
+ carries one IR element per file, and any one of them blocking blocks the whole call.
112
+
113
+ Codex supplies no transcript channel, so the session witness valve has no human-message
114
+ evidence to read. For an intentional blocked edit, use your own terminal. Details are in
115
+ [Connect the surfaces](../../how-to/connect-surfaces.md#codex).
96
116
 
97
117
  <a id="init-results"></a>
98
118
  ## Results and failure conditions
@@ -114,16 +134,22 @@ filesystem problem, and rerun rather than assuming every failed installation lef
114
134
  ## Examples
115
135
 
116
136
  ```sh
117
- pdks init claude-code
118
- pdks init grok
137
+ pdks init
138
+ npx pdks-claude-code init
139
+ npx pdks-grok init
140
+ npx pdks-codex init
119
141
  ```
120
142
 
121
- The installer is a CLI command. It is not a symbol on the `polydeukes` or
122
- `polydeukes/claude-code` contract.
143
+ The installers are CLI commands. They are not symbols on the `polydeukes` contract.
123
144
 
124
145
  <a id="init-see-also"></a>
125
146
  ## See also
126
147
 
148
+ - [`@polydeukes/adapter-claude-code`](../packages/adapter-claude-code.md) — the Claude Code
149
+ install unit and its bin.
150
+ - [`@polydeukes/adapter-grok`](../packages/adapter-grok.md) — the Grok install unit and its bin.
151
+ - [`@polydeukes/adapter-codex`](../packages/adapter-codex.md) — the Codex install unit and its
152
+ bin.
127
153
  - [`pdks docs`](../packages/polydeukes.md#polydeukes-bin) — the installed documentation reader lives
128
154
  in the same package.
129
155
  - [`pdks explain`](./explain.md)