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.
- package/README.ko.md +16 -28
- package/README.md +16 -28
- package/dist/baseline.d.ts +37 -1
- package/dist/baseline.js +68 -1
- package/dist/bin.d.ts +3 -4
- package/dist/bin.js +73 -90
- package/dist/covenant/bash-line.d.ts +130 -0
- package/dist/covenant/bash-line.js +566 -0
- package/dist/covenant/declaration-engine.d.ts +108 -0
- package/dist/covenant/declaration-engine.js +415 -0
- package/dist/covenant/discipline.d.ts +109 -0
- package/dist/covenant/discipline.js +667 -0
- package/dist/covenant/dispatch.d.ts +156 -0
- package/dist/covenant/dispatch.js +250 -0
- package/dist/covenant/extract-steps.d.ts +122 -0
- package/dist/covenant/extract-steps.js +0 -0
- package/dist/covenant/mention.d.ts +117 -0
- package/dist/covenant/mention.js +209 -0
- package/dist/covenant/module.d.ts +25 -0
- package/dist/covenant/module.js +23 -0
- package/dist/covenant/mutation-rules.d.ts +40 -0
- package/dist/covenant/mutation-rules.js +146 -0
- package/dist/covenant/relations.d.ts +46 -0
- package/dist/covenant/relations.js +68 -0
- package/dist/covenant/run-covenant.d.ts +95 -0
- package/dist/covenant/run-covenant.js +164 -0
- package/dist/covenant/self-mod.d.ts +55 -0
- package/dist/covenant/self-mod.js +84 -0
- package/dist/covenant/shell-evidence.d.ts +38 -0
- package/dist/covenant/shell-evidence.js +247 -0
- package/dist/covenant/shell-mod.d.ts +84 -0
- package/dist/covenant/shell-mod.js +213 -0
- package/dist/covenant/supply.d.ts +54 -0
- package/dist/covenant/supply.js +50 -0
- package/dist/covenant/transcript-mod.d.ts +60 -0
- package/dist/covenant/transcript-mod.js +254 -0
- package/dist/covenant/ttl-witness.d.ts +47 -0
- package/dist/covenant/ttl-witness.js +80 -0
- package/dist/covenant-check.d.ts +74 -41
- package/dist/covenant-check.js +372 -129
- package/dist/diff-ir.d.ts +28 -0
- package/dist/diff-ir.js +310 -0
- package/dist/docs/README.ko.md +10 -9
- package/dist/docs/README.md +10 -9
- package/dist/docs/catalog.json +76 -28
- package/dist/docs/concepts/judgment.ko.md +2 -2
- package/dist/docs/concepts/judgment.md +2 -2
- package/dist/docs/how-to/configure-project.ko.md +16 -16
- package/dist/docs/how-to/configure-project.md +15 -12
- package/dist/docs/how-to/connect-surfaces.ko.md +67 -34
- package/dist/docs/how-to/connect-surfaces.md +67 -34
- package/dist/docs/how-to/write-disciplines.ko.md +64 -7
- package/dist/docs/how-to/write-disciplines.md +65 -7
- package/dist/docs/index.json +744 -362
- package/dist/docs/reference/cli/covenant-check.ko.md +112 -65
- package/dist/docs/reference/cli/covenant-check.md +114 -59
- package/dist/docs/reference/cli/docs.ko.md +2 -2
- package/dist/docs/reference/cli/docs.md +2 -2
- package/dist/docs/reference/cli/explain.ko.md +20 -15
- package/dist/docs/reference/cli/explain.md +22 -15
- package/dist/docs/reference/cli/init.ko.md +91 -52
- package/dist/docs/reference/cli/init.md +81 -55
- package/dist/docs/reference/configuration/index.ko.md +182 -71
- package/dist/docs/reference/configuration/index.md +188 -76
- package/dist/docs/reference/packages/adapter-claude-code.ko.md +39 -11
- package/dist/docs/reference/packages/adapter-claude-code.md +40 -14
- package/dist/docs/reference/packages/adapter-codex.ko.md +99 -0
- package/dist/docs/reference/packages/adapter-codex.md +100 -0
- package/dist/docs/reference/packages/adapter-grok.ko.md +81 -0
- package/dist/docs/reference/packages/adapter-grok.md +83 -0
- package/dist/docs/reference/packages/core.ko.md +50 -4
- package/dist/docs/reference/packages/core.md +55 -6
- package/dist/docs/reference/packages/polydeukes.ko.md +139 -77
- package/dist/docs/reference/packages/polydeukes.md +147 -81
- package/dist/docs/reference/packages/sdk-ts.ko.md +164 -0
- package/dist/docs/reference/packages/sdk-ts.md +167 -0
- package/dist/docs/troubleshooting.ko.md +51 -19
- package/dist/docs/troubleshooting.md +53 -17
- package/dist/docs/tutorials/first-judgment.ko.md +6 -4
- package/dist/docs/tutorials/first-judgment.md +6 -4
- package/dist/explain.d.ts +1 -1
- package/dist/explain.js +37 -22
- package/dist/load-config.d.ts +25 -1
- package/dist/load-config.js +21 -3
- package/dist/pre-state-reader.d.ts +1 -1
- package/dist/pre-state-reader.js +1 -1
- package/dist/scaffold-project.d.ts +2 -2
- package/dist/scaffold-project.js +12 -4
- package/dist/schema/polydeukes.schema.json +12 -0
- package/dist/worktree-reader.d.ts +19 -0
- package/dist/worktree-reader.js +30 -0
- package/package.json +5 -18
- package/dist/claude-code-hook.d.ts +0 -79
- package/dist/claude-code-hook.js +0 -372
- package/dist/claude-code.d.ts +0 -6
- package/dist/claude-code.js +0 -6
- package/dist/covenant-module.d.ts +0 -25
- package/dist/covenant-module.js +0 -42
- package/dist/docs/reference/packages/adapter-git.ko.md +0 -101
- package/dist/docs/reference/packages/adapter-git.md +0 -108
- package/dist/docs/reference/packages/covenant.ko.md +0 -115
- package/dist/docs/reference/packages/covenant.md +0 -123
- package/dist/index.d.ts +0 -22
- package/dist/index.js +0 -21
- package/dist/init-claude-code.d.ts +0 -52
- package/dist/init-claude-code.js +0 -586
- package/dist/init-grok.d.ts +0 -51
- package/dist/init-grok.js +0 -242
|
@@ -36,8 +36,9 @@ monorepo sub-package whose dependencies installed at the workspace root, count t
|
|
|
36
36
|
# yaml-language-server: $schema=../../node_modules/polydeukes/dist/schema/polydeukes.schema.json
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
`pdks init claude-code` adds the schema line only when the
|
|
40
|
-
generated config. If the line is absent, add a relative path
|
|
39
|
+
`pdks init` — which `pdks-claude-code init` runs for you — adds the schema line only when the
|
|
40
|
+
default path resolves relative to the generated config. If the line is absent, add a relative path
|
|
41
|
+
to the installed schema yourself.
|
|
41
42
|
An unresolvable `$schema` can disable editor validation without displaying an error.
|
|
42
43
|
|
|
43
44
|
If you installed `@polydeukes/core` directly rather than the umbrella, name its copy:
|
|
@@ -72,24 +73,26 @@ Loading this setting does not itself run the command.
|
|
|
72
73
|
|
|
73
74
|
| Setting | Effect on a violation |
|
|
74
75
|
|---|---|
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
76
|
+
| `enforce: advise` on an entry (or absent) | Record advice and let the call proceed, exit 0. |
|
|
77
|
+
| `enforce: block` on an entry | Refuse the judged call, exit 2. |
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
**Absent means `advise`.** There is no surface-level enforcement key in the config: each entry
|
|
80
|
+
carries its own level and nothing promotes an absent one. Protection of configured paths is
|
|
81
|
+
separate from that per-entry default — it blocks on the session surface, and on the change-set
|
|
82
|
+
surface it lands `advised` unless the command is run with `--enforce block`. Assembly errors
|
|
83
|
+
still exit 2.
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
`protectedPaths` is a single top-level list that applies to both surfaces. On the change-set
|
|
86
|
+
surface the judge only emits the exit code; whether the commit stops is your hook wiring.
|
|
84
87
|
See [surface connection and witnesses](./connect-surfaces.md#witness-and-recovery).
|
|
85
88
|
|
|
86
89
|
<a id="confirm-the-project"></a>
|
|
87
90
|
## Confirm the project
|
|
88
91
|
|
|
89
92
|
- `pdks explain` loads the configuration and shows registrations without judging a change.
|
|
90
|
-
- `pdks covenant check --
|
|
91
|
-
- `pdks covenant check` observes staged changes
|
|
92
|
-
|
|
93
|
+
- `git diff HEAD | pdks covenant check --diff` judges everything not yet committed.
|
|
94
|
+
- `git diff --cached | pdks covenant check --diff` observes staged changes — the pre-commit shape.
|
|
95
|
+
The command never prompts; it exits 0 or 2 and your hook wiring decides the commit's fate.
|
|
93
96
|
|
|
94
97
|
Check stderr and telemetry as well as the exit code. Advice and some skipped observations exit 0.
|
|
95
98
|
If assembly fails, diagnose the named configuration or missing package before testing a discipline.
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[English](../how-to/connect-surfaces.md) · **한국어**
|
|
4
4
|
|
|
5
|
-
> 작업에 맞는 표면을 고릅니다. Claude Code와 Grok는 세션 표면을 배선하고, git은
|
|
5
|
+
> 작업에 맞는 표면을 고릅니다. Claude Code와 Grok, Codex는 세션 표면을 배선하고, git은 변경 집합 표면을 배선합니다.
|
|
6
6
|
|
|
7
7
|
두 표면은 같은 설정 어휘를 쓰지만 판정 시점이 다릅니다. AI 파트너가 편집할 때는 세션 표면을,
|
|
8
|
-
변경을 이력으로 기록하기 전에는
|
|
8
|
+
변경을 이력으로 기록하기 전에는 변경 집합 표면을 사용합니다.
|
|
9
9
|
|
|
10
10
|
<a id="claude-code"></a>
|
|
11
11
|
## Claude Code 세션 표면
|
|
12
12
|
|
|
13
13
|
Claude Code에서 AI 파트너와 함께 개발할 때 씁니다.
|
|
14
14
|
|
|
15
|
-
1. 패키지를 프로젝트 의존성으로 설치합니다. `pnpm add -D polydeukes
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
1. 세 패키지를 프로젝트 의존성으로 설치합니다. `pnpm add -D polydeukes
|
|
16
|
+
@polydeukes/core @polydeukes/adapter-claude-code`. 일회성 `npx` 실행만으로는 부족합니다. 두 표면 모두
|
|
17
|
+
프로젝트에 설치된 패키지에서 판정기를 불러옵니다.
|
|
18
|
+
2. 프로젝트 루트에서 배선합니다. `pnpm exec pdks-claude-code init`. 이 실행 파일은 어댑터가
|
|
19
|
+
제공하며, 먼저 `pdks init`으로 초기 파일을 만든 뒤 Claude Code 등록 산출물을 씁니다.
|
|
18
20
|
3. 생성된 훅, 병합된 설정, 초기 설정 파일, 문서 안내와 `discipline-draft` 스킬을 확인합니다.
|
|
19
21
|
4. 훅이 바뀌면 프로젝트를 다시 엽니다. 생성된 훅은 패키지에 판정을 위임하므로 패키지를
|
|
20
22
|
갱신할 때 훅 파일까지 다시 쓸 필요는 없습니다.
|
|
@@ -29,54 +31,83 @@ Claude Code에서 AI 파트너와 함께 개발할 때 씁니다.
|
|
|
29
31
|
|
|
30
32
|
Grok에서 개발할 때 씁니다.
|
|
31
33
|
|
|
32
|
-
1. 패키지를 프로젝트 의존성으로 설치합니다. `pnpm add -D polydeukes`.
|
|
33
|
-
2.
|
|
34
|
+
1. 세 패키지를 프로젝트 의존성으로 설치합니다. `pnpm add -D polydeukes @polydeukes/core @polydeukes/adapter-grok`.
|
|
35
|
+
2. 프로젝트 루트에서 배선합니다. `pnpm exec pdks-grok init`. 어댑터가 이 실행 파일을
|
|
36
|
+
제공합니다. 먼저 `pdks init`으로 초기 파일을 만든 뒤 Grok 등록 산출물을 씁니다.
|
|
34
37
|
3. 설치가 끝나면 Hooks 탭을 다시 불러오거나 새 세션을 엽니다.
|
|
35
38
|
|
|
36
|
-
Grok 프로젝트에는 `.grok/hooks/` 아래에 훅 JSON
|
|
37
|
-
Grok
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
새 등록의 제한 시간은 60초입니다. Grok 호스트의 기본값은 5초이며, 훅 실행이 시간 초과로
|
|
41
|
-
끝나면 해당 호출을 차단하지 않습니다(fail-open).
|
|
39
|
+
Grok 프로젝트에는 `.grok/hooks/` 아래에 훅 JSON과 위임자가 생깁니다. 새 등록의 제한 시간은
|
|
40
|
+
60초입니다. Grok 호스트의 기본값은 5초이며, 훅 실행이 시간 초과로 끝나면 해당 호출을
|
|
41
|
+
차단하지 않습니다(fail-open). 세션 어댑터를 한 프로젝트에 둘 이상 설치하면 호출마다
|
|
42
|
+
판정기가 두 번 실행될 수 있습니다.
|
|
42
43
|
|
|
43
|
-
Grok는 세션 증인 밸브에 필요한 Claude 형식의 인간 메시지를 공급하지 않습니다. 대화
|
|
44
|
-
Claude JSONL이 아니라 ACP `updates.jsonl`입니다.
|
|
45
|
-
의도한 편집이 차단되면 자신의 터미널에서 수행하세요.
|
|
46
|
-
|
|
44
|
+
Grok는 세션 증인(witness) 밸브에 필요한 Claude 형식의 인간 메시지를 공급하지 않습니다. 대화
|
|
45
|
+
기록은 Claude JSONL이 아니라 ACP `updates.jsonl`입니다.
|
|
46
|
+
의도한 편집이 차단되면 자신의 터미널에서 수행하세요. 변경 집합 표면에는 증인 프롬프트가 없으므로
|
|
47
|
+
차단된 Grok 도구 호출을 커밋 쪽에서 허용할 방법도 없습니다.
|
|
47
48
|
|
|
48
|
-
<a id="
|
|
49
|
-
##
|
|
49
|
+
<a id="codex"></a>
|
|
50
|
+
## Codex 세션 표면
|
|
51
|
+
|
|
52
|
+
Codex에서 개발할 때 씁니다.
|
|
53
|
+
|
|
54
|
+
1. 세 패키지를 프로젝트 의존성으로 설치합니다. `pnpm add -D polydeukes @polydeukes/core @polydeukes/adapter-codex`.
|
|
55
|
+
2. 프로젝트 루트에서 배선합니다. `pnpm exec pdks-codex init`. 어댑터가 이 실행 파일을
|
|
56
|
+
제공합니다. 먼저 `pdks init`으로 초기 파일을 만든 뒤 Codex 등록 산출물을 씁니다.
|
|
57
|
+
3. Codex에서 `/hooks`로 생성된 훅을 승인합니다. 승인하기 전까지는 훅을 건너뜁니다.
|
|
58
|
+
|
|
59
|
+
Codex 프로젝트에는 `.codex/hooks/covenant-pretooluse.mjs` 위임자와 `.codex/hooks.json`의 항목이
|
|
60
|
+
생깁니다. 이 JSON은 덮어쓰지 않고 병합합니다. 다른 이벤트, 다른 matcher, 설치기가 모르는 키는
|
|
61
|
+
그대로 둡니다. 초기 설정은 기본적으로 `.codex/hooks`를 보호합니다.
|
|
62
|
+
|
|
63
|
+
**승인은 선택이 아닙니다.** Codex는 훅 정의의 해시로 신뢰를 기록하므로, 새로 쓴 훅은 검토
|
|
64
|
+
대상으로 표시되고 누군가 승인하기 전까지 건너뛰어집니다. 그때까지는 아무것도 판정되지
|
|
65
|
+
않습니다. `init`은 실행할 때마다 바이트가 같은 명령 문자열을 쓰므로, 다시 설치해도 이미 받은
|
|
66
|
+
승인이 무효가 되지 않습니다.
|
|
67
|
+
|
|
68
|
+
Codex는 모든 파일 편집을 `apply_patch` 하나로 정규화하고, 경로 인자가 아니라 패치 텍스트를
|
|
69
|
+
보냅니다. `Edit`과 `Write`는 훅 파일에 적을 수 있는 matcher 별칭이며 도구 이름으로 도착하지
|
|
70
|
+
않습니다. 패치 하나가 여러 파일을 건드리면 파일마다 IR 원소 하나가 실리고, 그중 하나라도
|
|
71
|
+
차단되면 호출 전체가 차단됩니다.
|
|
72
|
+
|
|
73
|
+
Codex에는 대화 기록 채널이 없어서 세션 증인(witness) 밸브가 읽을 사람 메시지가 없습니다.
|
|
74
|
+
의도한 편집이 차단되면 자신의 터미널에서 수행하세요. 세션 어댑터를 한 프로젝트에 둘 이상
|
|
75
|
+
설치하면 호출마다 판정기가 두 번 실행될 수 있습니다.
|
|
76
|
+
|
|
77
|
+
<a id="change-set-surface"></a>
|
|
78
|
+
## 변경 집합 표면
|
|
50
79
|
|
|
51
80
|
스테이징한 변경을 이력으로 기록하기 전에 Git에서 판정하려면 이 표면을 사용합니다.
|
|
52
81
|
|
|
53
82
|
1. 프로젝트 루트에 `polydeukes.config.yaml`을 만듭니다.
|
|
54
83
|
2. pre-commit 훅을 추가합니다.
|
|
55
|
-
3. 필요할 때는 `pnpm exec pdks covenant check`를 직접 돌려 같은
|
|
84
|
+
3. 필요할 때는 `git diff HEAD | pnpm exec pdks covenant check --diff`를 직접 돌려 같은
|
|
85
|
+
판정을 봅니다.
|
|
56
86
|
|
|
57
|
-
lefthook 예시는 다음과 같습니다.
|
|
87
|
+
lefthook 예시는 다음과 같습니다. `git diff`의 플래그는 판정기가 받는 것을 고정합니다. 색 코드
|
|
88
|
+
없음, 외부 diff 드라이버 없음, textconv 변환 없음, 번역기가 벗기는 `a/`·`b/` 접두입니다. 사용자의
|
|
89
|
+
git 설정이 관측을 바꾸지 못합니다(CLI 레퍼런스 참고).
|
|
58
90
|
|
|
59
91
|
```yaml
|
|
60
92
|
pre-commit:
|
|
61
93
|
commands:
|
|
62
94
|
covenant:
|
|
63
95
|
priority: 1
|
|
64
|
-
|
|
65
|
-
run: ./node_modules/.bin/pdks covenant check
|
|
96
|
+
run: git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
66
97
|
```
|
|
67
98
|
|
|
68
99
|
husky 예시는 다음과 같습니다.
|
|
69
100
|
|
|
70
101
|
```sh
|
|
71
102
|
# .husky/pre-commit
|
|
72
|
-
./node_modules/.bin/pdks covenant check
|
|
103
|
+
git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
73
104
|
```
|
|
74
105
|
|
|
75
106
|
일반 git 훅으로 연결해도 됩니다.
|
|
76
107
|
|
|
77
108
|
```sh
|
|
78
109
|
#!/bin/sh
|
|
79
|
-
./node_modules/.bin/pdks covenant check
|
|
110
|
+
git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
80
111
|
```
|
|
81
112
|
|
|
82
113
|
일반 훅은 `.git/hooks/pre-commit`으로 저장한 뒤 `chmod +x .git/hooks/pre-commit`으로
|
|
@@ -84,12 +115,13 @@ husky 예시는 다음과 같습니다.
|
|
|
84
115
|
관리자로 설치하고 YAML을 저장한 뒤 훅 설치 명령을 실행합니다. husky는 git이 찾을 수 있도록
|
|
85
116
|
husky 설치기로 `.husky/pre-commit`을 저장하세요.
|
|
86
117
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
118
|
+
판정기는 종료 코드 0 또는 2만 내고 사람에게 묻지 않습니다. 기본값에서는 `protectedPaths`
|
|
119
|
+
위반을 포함한 이 표면의 모든 위반이 stderr에 진단 한 줄을 남기고 행으로 기록되며 종료
|
|
120
|
+
코드 0입니다. 스테이징된 관문 파일 변경은 이미 세션 표면에서 판정을 받았거나 사람이 직접
|
|
121
|
+
한 것이고, 이 표면에는 사람이 답할 밸브가 없기 때문입니다. `protectedPaths` 위반이나
|
|
122
|
+
`enforce: block` 항목의 위반을 종료 코드 2로 받으려면 명령에 `--enforce block`을 붙입니다.
|
|
123
|
+
커밋을 멈출지는 훅 배선이 정합니다. 위 예시는 종료 코드를 그대로 따릅니다. 조립 실패는
|
|
124
|
+
언제나 종료 코드 2입니다.
|
|
93
125
|
|
|
94
126
|
<a id="witness-and-recovery"></a>
|
|
95
127
|
## 증인과 회복
|
|
@@ -97,7 +129,8 @@ husky 설치기로 `.husky/pre-commit`을 저장하세요.
|
|
|
97
129
|
증인 토큰은 두 표면에서 같은 뜻이지만 전달 방식은 다릅니다.
|
|
98
130
|
|
|
99
131
|
- 세션 표면에서는 대화 메시지 첫 줄에 토큰만 단독으로 넣습니다.
|
|
100
|
-
-
|
|
132
|
+
- 변경 집합 표면에는 프롬프트가 없습니다. 판정은 종료 코드로 전달되고, 그것으로 무엇을 할지는
|
|
133
|
+
훅 배선이 정합니다.
|
|
101
134
|
|
|
102
135
|
밸브는 판정 결과가 차단일 때 확인합니다. 의도한 편집 전에 토큰을 입력해도 되며, 먼저
|
|
103
136
|
실패하는 요청을 보낼 필요는 없습니다. 정상 판정은 바꾸지 않고, 현재 Grok 대화 기록
|
|
@@ -111,5 +144,5 @@ Grok가 훅을 아직 읽지 못했다면 Hooks 탭을 다시 불러오거나
|
|
|
111
144
|
|
|
112
145
|
- `pdks explain`은 각 표면이 어떤 등록을 조립했는지 보여 줍니다.
|
|
113
146
|
- `.polydeukes/roi.log`는 표면이 남긴 행을 기록합니다.
|
|
114
|
-
- `pdks covenant check --
|
|
115
|
-
- `pdks covenant check --
|
|
147
|
+
- `git diff HEAD | pdks covenant check --diff`는 작업 뒤에 쓰기 좋은 즉시 확인 명령입니다.
|
|
148
|
+
- `git diff <base>..<head> | pdks covenant check --diff`는 PR 전에 쓰기 좋은 형태입니다.
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
**English** · [한국어](../how-to/connect-surfaces.ko.md)
|
|
4
4
|
|
|
5
|
-
> Pick the surface that matches the job. Claude Code and
|
|
6
|
-
the
|
|
5
|
+
> Pick the surface that matches the job. Claude Code, Grok, and Codex wire the session surface;
|
|
6
|
+
git wires the change-set surface.
|
|
7
7
|
|
|
8
8
|
The two surfaces share the same config vocabulary, but they answer different moments. Use the
|
|
9
|
-
session surface when an AI partner is making edits, and use the
|
|
10
|
-
to be written.
|
|
9
|
+
session surface when an AI partner is making edits, and use the change-set surface when history
|
|
10
|
+
is about to be written.
|
|
11
11
|
|
|
12
12
|
<a id="claude-code"></a>
|
|
13
13
|
## Claude Code session surface
|
|
14
14
|
|
|
15
15
|
Use this when the project is developed alongside an AI partner in Claude Code.
|
|
16
16
|
|
|
17
|
-
1. Install the
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
1. Install the three packages as project dependencies: `pnpm add -D polydeukes
|
|
18
|
+
@polydeukes/core @polydeukes/adapter-claude-code`. A one-off `npx` run is not enough —
|
|
19
|
+
both surfaces load the judge from the project's own installed package.
|
|
20
|
+
2. Wire the project from its root: `pnpm exec pdks-claude-code init`. The adapter ships this bin;
|
|
21
|
+
it runs `pdks init` for the scaffold, then writes the Claude Code registration artifacts.
|
|
20
22
|
3. Keep the generated hook file, settings merge, starter config, discovery rule, and
|
|
21
23
|
discipline-draft skill.
|
|
22
24
|
4. Reopen the project when the hook changes. The generated hook is a delegator, so upgrading the
|
|
@@ -32,54 +34,84 @@ described problem into either a judged entry or a draft entry.
|
|
|
32
34
|
|
|
33
35
|
Use this when the project is developed in Grok.
|
|
34
36
|
|
|
35
|
-
1. Install the
|
|
36
|
-
2. Wire the project: `pnpm exec pdks init
|
|
37
|
+
1. Install the three packages as project dependencies: `pnpm add -D polydeukes @polydeukes/core @polydeukes/adapter-grok`.
|
|
38
|
+
2. Wire the project from its root: `pnpm exec pdks-grok init`. The adapter ships this bin; it
|
|
39
|
+
runs `pdks init` for the scaffold, then writes the Grok registration artifacts.
|
|
37
40
|
3. Reload the Hooks tab or open a new session after the installer finishes.
|
|
38
41
|
|
|
39
|
-
A Grok tree gets its own hook JSON under `.grok/hooks/`.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
command, because Grok collapses the two registrations only when command and matcher match.
|
|
43
|
-
Generated registrations use a timeout of 60 seconds. The Grok host default is 5 seconds, and a
|
|
44
|
-
timed-out hook fails open.
|
|
42
|
+
A Grok tree gets its own hook JSON and delegator under `.grok/hooks/`. Generated registrations
|
|
43
|
+
use a timeout of 60 seconds. The Grok host default is 5 seconds, and a timed-out hook fails
|
|
44
|
+
open. Installing more than one session adapter in one project can run the judge twice per call.
|
|
45
45
|
|
|
46
46
|
Grok does not supply the Claude-format human message needed by the session witness valve. The
|
|
47
47
|
session log is ACP `updates.jsonl`, not Claude's JSONL.
|
|
48
|
-
For an intentional blocked edit, use your own terminal.
|
|
49
|
-
|
|
48
|
+
For an intentional blocked edit, use your own terminal. The change-set surface has no prompt, so
|
|
49
|
+
there is no way to authorize a blocked Grok tool call from that side either.
|
|
50
50
|
|
|
51
|
-
<a id="
|
|
52
|
-
##
|
|
51
|
+
<a id="codex"></a>
|
|
52
|
+
## Codex session surface
|
|
53
|
+
|
|
54
|
+
Use this when the project is developed in Codex.
|
|
55
|
+
|
|
56
|
+
1. Install the three packages as project dependencies: `pnpm add -D polydeukes @polydeukes/core @polydeukes/adapter-codex`.
|
|
57
|
+
2. Wire the project from its root: `pnpm exec pdks-codex init`. The adapter ships this bin; it
|
|
58
|
+
runs `pdks init` for the scaffold, then writes the Codex registration artifacts.
|
|
59
|
+
3. Approve the generated hook with `/hooks` in Codex. Until you do, it is skipped.
|
|
60
|
+
|
|
61
|
+
A Codex tree gets a delegator at `.codex/hooks/covenant-pretooluse.mjs` and an entry in
|
|
62
|
+
`.codex/hooks.json`. That JSON is merged, not overwritten: other events, other matchers, and
|
|
63
|
+
keys the installer does not know stay where they are. The scaffold config protects
|
|
64
|
+
`.codex/hooks` by default.
|
|
65
|
+
|
|
66
|
+
**Approval is not optional.** Codex records trust against the hash of a hook's definition, so a
|
|
67
|
+
newly written hook is listed for review and skipped until someone approves it — until then
|
|
68
|
+
nothing is judged. `init` writes a byte-identical command string on every run, so a re-install
|
|
69
|
+
does not invalidate an approval you already gave.
|
|
70
|
+
|
|
71
|
+
Codex normalises every file edit into one tool, `apply_patch`, and sends the patch text rather
|
|
72
|
+
than a path argument. `Edit` and `Write` are matcher aliases you may write in the hooks file;
|
|
73
|
+
they never arrive as the tool name. One patch that touches several files carries one IR element
|
|
74
|
+
per file, and any one of them blocking blocks the whole call.
|
|
75
|
+
|
|
76
|
+
Codex supplies no transcript channel, so the session witness valve has no human message to read.
|
|
77
|
+
For an intentional blocked edit, use your own terminal. Installing more than one session adapter
|
|
78
|
+
in one project can run the judge twice per call.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<a id="change-set-surface"></a>
|
|
82
|
+
## Change-set surface
|
|
53
83
|
|
|
54
84
|
Use this when you want git to judge staged changes before they become history.
|
|
55
85
|
|
|
56
86
|
1. Create `polydeukes.config.yaml` at the project root.
|
|
57
87
|
2. Add the pre-commit hook.
|
|
58
|
-
3. Run `pnpm exec pdks covenant check` when you want the same judgment
|
|
88
|
+
3. Run `git diff HEAD | pnpm exec pdks covenant check --diff` when you want the same judgment
|
|
89
|
+
on demand.
|
|
59
90
|
|
|
60
|
-
A minimal lefthook entry looks like this:
|
|
91
|
+
A minimal lefthook entry looks like this. The `git diff` flags pin what the judge receives:
|
|
92
|
+
no color codes, no external diff driver, no textconv rewrite, and the `a/`/`b/` prefixes the
|
|
93
|
+
translator strips — a user's git config cannot change the observation (see the CLI reference).
|
|
61
94
|
|
|
62
95
|
```yaml
|
|
63
96
|
pre-commit:
|
|
64
97
|
commands:
|
|
65
98
|
covenant:
|
|
66
99
|
priority: 1
|
|
67
|
-
|
|
68
|
-
run: ./node_modules/.bin/pdks covenant check
|
|
100
|
+
run: git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
69
101
|
```
|
|
70
102
|
|
|
71
103
|
A husky hook looks like this:
|
|
72
104
|
|
|
73
105
|
```sh
|
|
74
106
|
# .husky/pre-commit
|
|
75
|
-
./node_modules/.bin/pdks covenant check
|
|
107
|
+
git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
76
108
|
```
|
|
77
109
|
|
|
78
110
|
A plain git hook works too:
|
|
79
111
|
|
|
80
112
|
```sh
|
|
81
113
|
#!/bin/sh
|
|
82
|
-
./node_modules/.bin/pdks covenant check
|
|
114
|
+
git diff --cached --no-color --no-ext-diff --no-textconv --src-prefix=a/ --dst-prefix=b/ | ./node_modules/.bin/pdks covenant check --diff
|
|
83
115
|
```
|
|
84
116
|
|
|
85
117
|
If you use the plain hook, save it as `.git/hooks/pre-commit` and make it executable with
|
|
@@ -87,12 +119,12 @@ If you use the plain hook, save it as `.git/hooks/pre-commit` and make it execut
|
|
|
87
119
|
For lefthook, install it with your package manager and run its hook installer after saving the YAML.
|
|
88
120
|
For husky, save `.husky/pre-commit` through husky's own installer so git can find it.
|
|
89
121
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
exit
|
|
122
|
+
The judge emits exit 0 or exit 2 and never prompts. By default every break on this surface — a
|
|
123
|
+
`protectedPaths` violation included — lands as a row with a diagnostic on stderr and exit 0: a
|
|
124
|
+
staged gate-file change has already passed the session surface or was made by a human, and
|
|
125
|
+
this surface has no valve a human could answer. Add `--enforce block` to the command when you
|
|
126
|
+
want a `protectedPaths` violation or an entry set to `enforce: block` to exit 2. Whether a commit
|
|
127
|
+
stops is your hook wiring: the entries above honour the exit code. Assembly errors always exit 2.
|
|
96
128
|
|
|
97
129
|
<a id="witness-and-recovery"></a>
|
|
98
130
|
## Witness and recovery
|
|
@@ -100,7 +132,8 @@ exit 2 at either level.
|
|
|
100
132
|
The witness token is the same idea on both surfaces, but the delivery is different.
|
|
101
133
|
|
|
102
134
|
- On the session surface, type the token on its own first line in a conversation message.
|
|
103
|
-
-
|
|
135
|
+
- The change-set surface has no prompt. Its judgment reaches you as an exit code, and your hook
|
|
136
|
+
wiring decides what to do with it.
|
|
104
137
|
|
|
105
138
|
The valve is consulted after the judgment returns a block. You can supply the token before an
|
|
106
139
|
intentional edit; a previous failed attempt is not required. It does not change a passing verdict
|
|
@@ -114,5 +147,5 @@ cannot be loaded, reinstall the package or rebuild the workspace and try again.
|
|
|
114
147
|
|
|
115
148
|
- `pdks explain` shows which registrations each surface assembled.
|
|
116
149
|
- `.polydeukes/roi.log` records the rows that the surfaces wrote.
|
|
117
|
-
- `pdks covenant check --
|
|
118
|
-
- `pdks covenant check --
|
|
150
|
+
- `git diff HEAD | pdks covenant check --diff` is a good on-demand check after a task.
|
|
151
|
+
- `git diff <base>..<head> | pdks covenant check --diff` is the shape to use before a PR.
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
두 JSON 번역 파일의 키 집합을 비교합니다. 중첩된 키도 비교 대상입니다.
|
|
13
13
|
아래 전체 YAML을 **예제 프로젝트**의 `polydeukes.config.yaml`로 저장합니다. 기존 프로젝트의
|
|
14
|
-
설정을 덮어쓰지 마세요. 기존 설정에 추가할 때는 규율 항목만 복사합니다.
|
|
14
|
+
설정을 덮어쓰지 마세요. 기존 설정에 추가할 때는 규율 항목만 복사합니다. 아래 YAML에는
|
|
15
|
+
`protectedPaths`와 `witness` 블록이 없으므로, 생성된 설정 위에 그대로 저장하면 증인 밸브가
|
|
16
|
+
사라집니다.
|
|
15
17
|
설치 절차는 [첫 판정 튜토리얼](../tutorials/first-judgment.ko.md)에 있습니다.
|
|
16
18
|
|
|
17
19
|
```yaml
|
|
@@ -50,7 +52,7 @@ disciplines:
|
|
|
50
52
|
|
|
51
53
|
`flattenKeys`는 번역 값이 아니라 키를 추출합니다. `equal`은 양방향으로 비교하고,
|
|
52
54
|
`messageBySide`는 어느 파일에 짝이 없는 키가 있는지 알려 줍니다. 기본 강제 수준은
|
|
53
|
-
`advise`입니다. 소스 파일 둘 다 존재하고 올바른 JSON이어야 합니다.
|
|
55
|
+
`advise`입니다. 소스 파일 둘 다 존재하고 올바른 JSON이어야 합니다. 변경 집합 표면은 선택한
|
|
54
56
|
관측 범위에서 파일을 읽고, 세션 편집에서는 바뀌는 파일의 편집 후 내용을 사용합니다.
|
|
55
57
|
|
|
56
58
|
예제 프로젝트 루트에서 키가 같은 파일을 만들고 git 추적 대상으로 등록합니다.
|
|
@@ -64,7 +66,7 @@ printf '{"home":"홈"}\n' > locales/ko.json
|
|
|
64
66
|
git add locales/en.json locales/ko.json
|
|
65
67
|
git commit -m 'docs: prepare locale example'
|
|
66
68
|
printf '{"home":"Home","settings":"Settings"}\n' > locales/en.json
|
|
67
|
-
pnpm exec pdks covenant check --
|
|
69
|
+
git diff HEAD | pnpm exec pdks covenant check --diff
|
|
68
70
|
```
|
|
69
71
|
|
|
70
72
|
`locale-key-parity`의 `advised` 진단에 영어에만 있는 `settings` 키가 나와야 합니다.
|
|
@@ -72,7 +74,7 @@ pnpm exec pdks covenant check --worktree
|
|
|
72
74
|
|
|
73
75
|
```sh
|
|
74
76
|
printf '{"home":"홈","settings":"설정"}\n' > locales/ko.json
|
|
75
|
-
pnpm exec pdks covenant check --
|
|
77
|
+
git diff HEAD | pnpm exec pdks covenant check --diff
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
이제 키 비교 진단이 없어야 합니다. 번역 값은 서로 다르지만 키는 같습니다.
|
|
@@ -82,11 +84,66 @@ pnpm exec pdks covenant check --worktree
|
|
|
82
84
|
git restore -- locales/en.json locales/ko.json
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
이 예제는 수정 사례를 검사하고 쉽게 원상 복구하기
|
|
87
|
+
`git diff HEAD`는 마지막 커밋과의 차이를 냅니다. 아직 git이 추적하지 않는 파일은
|
|
88
|
+
`git add -N`을 거쳐야 diff에 나타납니다. 이 예제는 수정 사례를 검사하고 쉽게 원상 복구하기
|
|
89
|
+
위해 기준 상태를 커밋합니다.
|
|
87
90
|
소스 파일이 존재한다는 이유만으로 선언이 실행되지는 않습니다. 관측된 변경 중 하나
|
|
88
91
|
이상이 해당 선언의 적용 범위와 일치해야 합니다.
|
|
89
92
|
|
|
93
|
+
<a id="which-list"></a>
|
|
94
|
+
## 어느 목록에 적는가
|
|
95
|
+
|
|
96
|
+
규율 목록은 셋이고, 항목이 어느 목록에 속하는지는 소스 축이 정합니다. 기전이 정하지도 않고
|
|
97
|
+
관계가 정하지도 않습니다. 같은 `companion` 기전이라도 `file` 소스 위에 서면 `disciplines`에
|
|
98
|
+
있고 `changes` 위에 서면 `changeSetDisciplines`에 있습니다. 선언의 소스를 읽으면 목록이
|
|
99
|
+
따라 나옵니다.
|
|
100
|
+
|
|
101
|
+
| 선언이 읽는 것 | 목록 | 예 |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| 변경된 파일과 `file` 소스만 | `disciplines` | 파일 형상 유형들. 신규분 한정, 비가역 표식, 자기사면 금지, 통제 어휘, 이름 규약, `file` 소스 위의 동반 의무, 지문 동기, 순서 불변 |
|
|
104
|
+
| 대화 기록(transcript) | `sessionDisciplines` | 이력 4종. 선행 요구, 단계 순서, 턴 근접, 사전 언명 |
|
|
105
|
+
| 주체(actor) | `sessionDisciplines` | 생산자 전속, 주체 한정 |
|
|
106
|
+
| 명령줄 | `sessionDisciplines` | 명령줄 금지 |
|
|
107
|
+
| 스폰 기록 통로(`sidecar`) | `sessionDisciplines` | `{ sidecar: true }`를 묶는 모든 선언 |
|
|
108
|
+
| `changes` | `changeSetDisciplines` | 변경 집합 위의 짝 맞춤. 함께 움직여야 하는 경로 둘 사이의 `implies` |
|
|
109
|
+
|
|
110
|
+
항목은 그 소스가 가리키는 목록에 적습니다. 자리를 잘못 잡은 항목은 로드 시점 오류이고,
|
|
111
|
+
메시지가 항목과 그 항목이 읽는 통로와 가야 할 목록을 함께 대므로, 본문을 그대로 옮기면
|
|
112
|
+
됩니다. 규칙 자체와 오류 모양은
|
|
113
|
+
[설정 참조](../reference/configuration/index.ko.md#placement-rule)에 있습니다.
|
|
114
|
+
|
|
115
|
+
표면이 공급해야 할 것을 본체가 읽지 않아도 실제로는 표면에 묶이는 항목이 있습니다. 대화
|
|
116
|
+
기록을 읽는 밸브(`witness`)가 달린 항목은 밸브 자신의 `extract`가 대화 기록을 묶으므로 세션
|
|
117
|
+
항목이 됩니다.
|
|
118
|
+
|
|
119
|
+
<a id="posture"></a>
|
|
120
|
+
## 무인 실시간 표면의 기본 자세
|
|
121
|
+
|
|
122
|
+
무인 실시간 표면은 터미널 앞에 사람이 없는 어댑터 훅이나 SDK 호출자입니다. 사람이 지켜보는
|
|
123
|
+
자리에는 적용되지 않는 규칙 둘이 이곳에 적용됩니다.
|
|
124
|
+
|
|
125
|
+
**루프가 회차 안에서 스스로 고치지 못하는 항목을 `enforce: block`으로 올립니다.** 기준은
|
|
126
|
+
"되돌릴 수 없는가"가 아닙니다. 실시간 차단의 비용은 초 단위입니다. 모델이 stderr의 사유를
|
|
127
|
+
읽고 다시 시도하므로 위반이 그 회차 안에서 고쳐집니다. `advise`로 두면 같은 위반이 뒤의
|
|
128
|
+
검사, 곧 테스트 실행이나 CI나 리뷰어에게까지 가서 회차 하나를 쓰며 최대 45분이 듭니다.
|
|
129
|
+
"무인이니 전부 차단"이라는 뜻은 아닙니다. 차단은 회피를 낳고 회피는 텔레메트리 행을 남기지
|
|
130
|
+
않으므로, 루프가 손댈 수 없는 항목은 위반이라도 기록되는 `advise`에 두는 편이 낫습니다. 이
|
|
131
|
+
기준은 설정 저자의 것입니다.
|
|
132
|
+
|
|
133
|
+
**밸브가 없으므로 사유가 값으로 돌아옵니다.** 실시간 무인 표면에는 증인 밸브가 없습니다.
|
|
134
|
+
TTY도 사람의 턴도 없고, SDK는 증인 인자를 받지 않으며 세션을 지어내지도 않습니다. 그 자리를
|
|
135
|
+
대신하는 것이 사유를 데이터로 돌려주는 일입니다. `checkCovenant`는
|
|
136
|
+
`{ verdict: 'blocked', reason }`을 돌려주며 `reason`은 판정기 자신의 stderr이고,
|
|
137
|
+
`{ verdict: 'upheld', advisories }`는 종료 코드 0인 실행의 권고 줄을 싣습니다. 소비자는 그
|
|
138
|
+
텍스트를 사람이 나중에 읽는 자리, 곧 이슈나 로그에 적고 멈춥니다. 권고 텍스트를 모델에게
|
|
139
|
+
보일지도 소비자가 정합니다. 무인 루프에는 stderr 한 줄을 읽을 사람이 없으므로, 호출자가
|
|
140
|
+
전달해야 권고가 소비됩니다. 판정 결과의 모양은
|
|
141
|
+
[`@polydeukes/sdk-ts` 참조](../reference/packages/sdk-ts.ko.md)에 있습니다.
|
|
142
|
+
|
|
143
|
+
SDK 자신의 기본값은 실행 전체에 대한 `enforce: 'block'`이며, 이것은 표면의 강제 수준이지
|
|
144
|
+
항목의 것이 아닙니다. 보호 경로와 `enforce: block` 항목이 호출을 멈추고, 나머지 위반은
|
|
145
|
+
`advised`로 기록됩니다. 두 어댑터도 같은 방식으로 판정기를 스폰합니다.
|
|
146
|
+
|
|
90
147
|
<a id="when-to-draft"></a>
|
|
91
148
|
## 선언 대신 초안으로 남길 때
|
|
92
149
|
|
|
@@ -110,7 +167,7 @@ disciplines:
|
|
|
110
167
|
## 한 번은 실제로 판정해 보기
|
|
111
168
|
|
|
112
169
|
설정을 저장한 뒤에는 필요한 증거를 공급할 수 있는 판정 경로로 위반과 정상 사례를 모두
|
|
113
|
-
검사합니다. `pdks covenant check --
|
|
170
|
+
검사합니다. `git diff HEAD | pdks covenant check --diff`는 현재 작업 트리의 변경을 판정하고,
|
|
114
171
|
`pdks explain`은 선언과 초안의 등록 상태를 보여 줍니다. 위 번역 예제처럼 한쪽 파일만
|
|
115
172
|
바꾼 경우와 양쪽 키를 맞춘 경우를 비교하세요.
|
|
116
173
|
|
|
@@ -11,7 +11,9 @@ at `advise` until you decide that the observed results justify blocking.
|
|
|
11
11
|
|
|
12
12
|
This declaration compares the key sets of two JSON translation files, including nested keys.
|
|
13
13
|
Save the complete YAML below as `polydeukes.config.yaml` in an **example project**, not over an
|
|
14
|
-
existing project's configuration. In an existing project, copy only the discipline entry
|
|
14
|
+
existing project's configuration. In an existing project, copy only the discipline entry — the
|
|
15
|
+
YAML below carries no `protectedPaths` and no `witness` block, so saving it over a generated
|
|
16
|
+
config removes the witness valve.
|
|
15
17
|
The [first-judgment tutorial](../tutorials/first-judgment.md) supplies installation steps.
|
|
16
18
|
|
|
17
19
|
```yaml
|
|
@@ -50,7 +52,7 @@ disciplines:
|
|
|
50
52
|
|
|
51
53
|
`flattenKeys` extracts keys, not translation values. `equal` compares both directions and
|
|
52
54
|
`messageBySide` reports which file has an unmatched key. The default enforcement is `advise`.
|
|
53
|
-
Both source files must exist and contain valid JSON. The
|
|
55
|
+
Both source files must exist and contain valid JSON. The change-set surface reads them from the
|
|
54
56
|
chosen observation; a session edit uses that edit's proposed new contents for the file it changes.
|
|
55
57
|
|
|
56
58
|
From the example project's root, prepare matching tracked files. The commit below requires your
|
|
@@ -63,7 +65,7 @@ printf '{"home":"홈"}\n' > locales/ko.json
|
|
|
63
65
|
git add locales/en.json locales/ko.json
|
|
64
66
|
git commit -m 'docs: prepare locale example'
|
|
65
67
|
printf '{"home":"Home","settings":"Settings"}\n' > locales/en.json
|
|
66
|
-
pnpm exec pdks covenant check --
|
|
68
|
+
git diff HEAD | pnpm exec pdks covenant check --diff
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
Expect an `advised` diagnostic for `locale-key-parity` naming `settings` as present only in English.
|
|
@@ -71,7 +73,7 @@ The command still exits 0. Fix the mismatch and run the same observation again:
|
|
|
71
73
|
|
|
72
74
|
```sh
|
|
73
75
|
printf '{"home":"홈","settings":"설정"}\n' > locales/ko.json
|
|
74
|
-
pnpm exec pdks covenant check --
|
|
76
|
+
git diff HEAD | pnpm exec pdks covenant check --diff
|
|
75
77
|
```
|
|
76
78
|
|
|
77
79
|
The parity diagnostic should disappear. The values differ intentionally; the keys now match.
|
|
@@ -81,10 +83,66 @@ Restore the two example files to their committed baseline when finished:
|
|
|
81
83
|
git restore -- locales/en.json locales/ko.json
|
|
82
84
|
```
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
`git diff HEAD` reports changes against the last commit, so an untracked file needs `git add -N`
|
|
87
|
+
before it appears in the diff. This example commits a baseline to exercise modifications and make
|
|
88
|
+
cleanup predictable. A declaration does not run
|
|
86
89
|
merely because its source exists: at least one observed change must match its scope.
|
|
87
90
|
|
|
91
|
+
<a id="which-list"></a>
|
|
92
|
+
## Which list does it go in
|
|
93
|
+
|
|
94
|
+
There are three discipline lists, and the source axis decides which one an entry belongs to.
|
|
95
|
+
The mechanism does not decide it and the relation does not decide it: the same `companion`
|
|
96
|
+
mechanism sits in `disciplines` when it stands over `file` sources, and in
|
|
97
|
+
`changeSetDisciplines` when it stands over `changes`. Read the declaration's sources and the
|
|
98
|
+
list follows.
|
|
99
|
+
|
|
100
|
+
| The declaration reads | List | Examples |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| the changed file and `file` sources only | `disciplines` | the file-shaped types — added-only, one-way markers, self-absolution bans, controlled vocabulary, naming, companion over a `file` source, fingerprint sync, monotonic order |
|
|
103
|
+
| the transcript | `sessionDisciplines` | the four history types — precedent, phase order, turn locality, stated ground |
|
|
104
|
+
| the actor | `sessionDisciplines` | producer-owned, actor scope |
|
|
105
|
+
| the command line | `sessionDisciplines` | forbidden command |
|
|
106
|
+
| the spawn-record channel (`sidecar`) | `sessionDisciplines` | any declaration binding `{ sidecar: true }` |
|
|
107
|
+
| `changes` | `changeSetDisciplines` | pairing over a change set — `implies` between two paths that must move together |
|
|
108
|
+
|
|
109
|
+
Write the entry in the list its sources point at. A misplaced entry is a load-time error that
|
|
110
|
+
names the entry, the channels it reads, and the list it belongs in, so the fix is to move the
|
|
111
|
+
body unchanged. The rule itself and the error shapes are in [the configuration
|
|
112
|
+
reference](../reference/configuration/index.md#placement-rule).
|
|
113
|
+
|
|
114
|
+
An entry can also read nothing a surface has to supply and still be surface-bound in practice:
|
|
115
|
+
a valve (`witness`) that reads the transcript makes its entry a session entry, because the
|
|
116
|
+
valve's own `extract` binds the transcript.
|
|
117
|
+
|
|
118
|
+
<a id="posture"></a>
|
|
119
|
+
## Posture on an unattended real-time surface
|
|
120
|
+
|
|
121
|
+
An unattended real-time surface is an adapter hook or an SDK caller with no human at the
|
|
122
|
+
terminal. Two rules apply there that do not apply where a person is watching.
|
|
123
|
+
|
|
124
|
+
**Promote an entry to `enforce: block` when the loop cannot fix it inside the turn.** The
|
|
125
|
+
criterion is not "is this irreversible". A real-time block costs seconds: the model reads the
|
|
126
|
+
reason on stderr and retries, so the violation is corrected within the turn. Left at `advise`,
|
|
127
|
+
the same violation travels to a later check — a test run, CI, a reviewer — and costs a whole
|
|
128
|
+
turn, up to 45 minutes. This is not "block everything because nobody is watching": blocking
|
|
129
|
+
produces avoidance, and avoidance leaves no telemetry row, so an entry the loop cannot act on
|
|
130
|
+
belongs at `advise` where its break is at least recorded. The criterion is the config author's.
|
|
131
|
+
|
|
132
|
+
**The reason comes back as a value, because there is no valve.** A real-time unattended
|
|
133
|
+
surface has no witness valve: there is no TTY and no human turn, and the SDK takes no witness
|
|
134
|
+
argument and invents no session. What stands in its place is the reason travelling as data.
|
|
135
|
+
`checkCovenant` returns `{ verdict: 'blocked', reason }` where `reason` is the judge's own
|
|
136
|
+
stderr, and `{ verdict: 'upheld', advisories }` carries the advisory lines of an exit-0 run.
|
|
137
|
+
The consumer writes that text where a person reads it later — an issue, a log — and stops.
|
|
138
|
+
Whether the model sees the advisory text is the consumer's decision too: an unattended loop has
|
|
139
|
+
no reader for a stderr line, so advise is only consumed if the caller passes it on. The
|
|
140
|
+
[`@polydeukes/sdk-ts` reference](../reference/packages/sdk-ts.md) has the verdict shapes.
|
|
141
|
+
|
|
142
|
+
The SDK's own default is `enforce: 'block'` for the run, which is the surface's level, not an
|
|
143
|
+
entry's: protected paths and `enforce: block` entries stop the call, and every other break is
|
|
144
|
+
recorded as `advised`. Both adapters spawn the judge the same way.
|
|
145
|
+
|
|
88
146
|
<a id="when-to-draft"></a>
|
|
89
147
|
## When to draft instead of declaring
|
|
90
148
|
|
|
@@ -109,7 +167,7 @@ verdict or telemetry. It is still part of the config, so the file remains loadab
|
|
|
109
167
|
|
|
110
168
|
After you save the config, run the judgment path that can actually see it.
|
|
111
169
|
|
|
112
|
-
- `pdks covenant check --
|
|
170
|
+
- `git diff HEAD | pdks covenant check --diff` shows the same entry against the current tree.
|
|
113
171
|
- `pdks explain` shows the registration and whether it is a declare or a draft.
|
|
114
172
|
- A one-sided edit to `locales/en.json` or `locales/ko.json` is a good smoke test for the pairing
|
|
115
173
|
example.
|