modkh 0.1.0 → 0.2.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.md +42 -0
- package/dist/agent/bundled-skills.d.ts +1 -1
- package/dist/agent/bundled-skills.js +1 -1
- package/dist/agent/compaction.d.ts +53 -0
- package/dist/agent/compaction.js +191 -0
- package/dist/agent/loop.d.ts +55 -8
- package/dist/agent/loop.js +119 -7
- package/dist/agent/skills.d.ts +7 -1
- package/dist/agent/skills.js +26 -5
- package/dist/agent/types.d.ts +14 -9
- package/dist/cli/agenticreplay.d.ts +1 -0
- package/dist/cli/agenticreplay.js +66 -0
- package/dist/cli/answer-markdown.d.ts +3 -0
- package/dist/cli/answer-markdown.js +29 -0
- package/dist/cli/approval.d.ts +2 -0
- package/dist/cli/approval.js +35 -5
- package/dist/cli/catalog.d.ts +30 -32
- package/dist/cli/catalog.js +37 -67
- package/dist/cli/chat.js +406 -78
- package/dist/cli/clipboard.d.ts +2 -0
- package/dist/cli/clipboard.js +28 -0
- package/dist/cli/color.d.ts +20 -3
- package/dist/cli/color.js +87 -19
- package/dist/cli/compaction-settings.d.ts +21 -0
- package/dist/cli/compaction-settings.js +54 -0
- package/dist/cli/completion-art.d.ts +2 -0
- package/dist/cli/completion-art.js +62 -0
- package/dist/cli/config.d.ts +9 -0
- package/dist/cli/config.js +5 -1
- package/dist/cli/editor.d.ts +7 -0
- package/dist/cli/editor.js +43 -5
- package/dist/cli/file-mentions.d.ts +14 -0
- package/dist/cli/file-mentions.js +141 -0
- package/dist/cli/head-checks.d.ts +41 -0
- package/dist/cli/head-checks.js +146 -0
- package/dist/cli/initial-connection.d.ts +7 -0
- package/dist/cli/initial-connection.js +20 -0
- package/dist/cli/keys.d.ts +12 -1
- package/dist/cli/keys.js +29 -4
- package/dist/cli/model-catalog.d.ts +16 -0
- package/dist/cli/model-catalog.js +130 -0
- package/dist/cli/models.d.ts +2 -2
- package/dist/cli/models.js +51 -19
- package/dist/cli/official-models.d.ts +6 -0
- package/dist/cli/official-models.js +77 -0
- package/dist/cli/pdf.d.ts +8 -0
- package/dist/cli/pdf.js +71 -0
- package/dist/cli/providers.d.ts +6 -42
- package/dist/cli/providers.js +44 -38
- package/dist/cli/shell-display.d.ts +6 -0
- package/dist/cli/shell-display.js +35 -0
- package/dist/cli/stateright.d.ts +1 -0
- package/dist/cli/stateright.js +37 -0
- package/dist/cli/terminal-mouse.d.ts +21 -0
- package/dist/cli/terminal-mouse.js +51 -0
- package/dist/cli/terminal.d.ts +95 -7
- package/dist/cli/terminal.js +783 -108
- package/dist/cli/tool-display.d.ts +9 -0
- package/dist/cli/tool-display.js +87 -0
- package/dist/cli/transcript-selection.d.ts +22 -0
- package/dist/cli/transcript-selection.js +75 -0
- package/dist/cli/usage.d.ts +9 -16
- package/dist/cli/usage.js +60 -18
- package/dist/cli/waiting-nyan.d.ts +3 -0
- package/dist/cli/waiting-nyan.js +17 -0
- package/dist/cli/waiting-whales.d.ts +3 -0
- package/dist/cli/waiting-whales.js +24 -0
- package/dist/index.js +30 -8
- package/dist/language/commonlisp-install.d.ts +1 -0
- package/dist/language/commonlisp-install.js +3 -2
- package/dist/language/lsp/client.js +4 -1
- package/dist/language/lsp/pool.d.ts +8 -0
- package/dist/language/lsp/pool.js +21 -3
- package/dist/language/lsp/service.d.ts +8 -4
- package/dist/language/lsp/service.js +51 -15
- package/dist/language/syntax/parser.d.ts +10 -1
- package/dist/language/syntax/parser.js +34 -16
- package/dist/lisp/builtin-agents.d.ts +5 -0
- package/dist/lisp/builtin-agents.js +52 -0
- package/dist/lisp/config.d.ts +9 -0
- package/dist/lisp/config.js +50 -7
- package/dist/lisp/routing.js +2 -2
- package/dist/lisp/runtime.d.ts +5 -0
- package/dist/lisp/runtime.js +26 -2
- package/dist/model/ai-sdk.js +13 -8
- package/dist/model/chatgpt/login.js +1 -1
- package/dist/model/chatgpt/responses.js +56 -4
- package/dist/model/connection.js +2 -0
- package/dist/model/context-window.d.ts +3 -0
- package/dist/model/context-window.js +64 -0
- package/dist/model/context.d.ts +3 -1
- package/dist/model/context.js +24 -24
- package/dist/model/factory.d.ts +3 -1
- package/dist/model/factory.js +28 -27
- package/dist/model/harness-profile.d.ts +6 -0
- package/dist/model/harness-profile.js +23 -0
- package/dist/model/providers.d.ts +32 -0
- package/dist/model/providers.js +72 -0
- package/dist/model/reasoning.d.ts +3 -3
- package/dist/model/reasoning.js +30 -8
- package/dist/model/record-fetch.d.ts +2 -0
- package/dist/model/record-fetch.js +19 -0
- package/dist/plugins/manager.d.ts +2 -1
- package/dist/plugins/manager.js +21 -2
- package/dist/session/store.d.ts +11 -0
- package/dist/session/store.js +27 -1
- package/dist/subagents/head-assignment.d.ts +11 -0
- package/dist/subagents/head-assignment.js +47 -0
- package/dist/subagents/limits.d.ts +4 -0
- package/dist/subagents/limits.js +6 -0
- package/dist/subagents/request.js +18 -1
- package/dist/subagents/service.d.ts +36 -2
- package/dist/subagents/service.js +331 -38
- package/dist/subagents/types.d.ts +20 -0
- package/dist/subagents/verification.d.ts +5 -2
- package/dist/subagents/verification.js +59 -22
- package/dist/tools/browse.d.ts +13 -0
- package/dist/tools/browse.js +117 -0
- package/dist/tools/browser-capability.d.ts +3 -0
- package/dist/tools/browser-capability.js +29 -0
- package/dist/tools/formal-input.d.ts +6 -0
- package/dist/tools/formal-input.js +29 -0
- package/dist/tools/formal.d.ts +3 -2
- package/dist/tools/formal.js +54 -52
- package/dist/tools/jobs.d.ts +2 -0
- package/dist/tools/jobs.js +5 -0
- package/dist/tools/language.js +25 -27
- package/dist/tools/lean-proof.d.ts +38 -0
- package/dist/tools/lean-proof.js +83 -0
- package/dist/tools/registry.d.ts +5 -3
- package/dist/tools/registry.js +13 -5
- package/dist/tools/run.js +13 -9
- package/dist/tools/shell-process.js +17 -6
- package/dist/tools/stateright-runtime.d.ts +3 -0
- package/dist/tools/stateright-runtime.js +16 -0
- package/dist/tools/stateright.d.ts +3 -0
- package/dist/tools/stateright.js +78 -0
- package/dist/tools/web.js +7 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/docs/commonlisp-build-output.md +14 -0
- package/docs/context-efficiency.md +25 -3
- package/docs/input.md +63 -3
- package/docs/languages.md +3 -3
- package/docs/models.md +30 -6
- package/docs/modkh.md +11 -7
- package/docs/presets.md +45 -0
- package/docs/setup.md +3 -16
- package/docs/stateright.md +45 -0
- package/docs/subagents.md +21 -3
- package/docs/web.md +1 -1
- package/experiments/presets/formal.lisp +15 -4
- package/experiments/presets/language-microagents.lisp +29 -0
- package/native/stateright/Cargo.lock +478 -0
- package/native/stateright/Cargo.toml +11 -0
- package/native/stateright/src/lib.rs +163 -0
- package/native/stateright/src/main.rs +38 -0
- package/package.json +10 -2
package/docs/models.md
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## モデル参照と選択画面
|
|
4
4
|
|
|
5
|
-
`modkh` を起動し、`/connect` で OpenAI / OpenCode / Ollama Local / Ollama Cloud / OpenRouter / Infron / Hermes Agent を選ぶ。
|
|
5
|
+
`modkh` を起動し、`/connect` で OpenAI / OpenCode Zen / OpenCode Go / Ollama Local / Ollama Cloud / OpenRouter / Infron / Hermes Agent を選ぶ。
|
|
6
6
|
TTYでは入力で検索、↑↓で選択、Enterで決定、Escで戻る。OpenAIではChatGPT OAuthとAPIキーを選べる。
|
|
7
7
|
APIキーは環境変数を優先し、未設定ならTTYで伏せ字入力できる。入力したキーは `keys.json`(0600)に保存し、次回起動時に再利用する。
|
|
8
|
-
|
|
8
|
+
OpenAIのモデル一覧は選択画面を開くたびに公式から取得する。APIキーでは `https://api.openai.com/v1/models`、
|
|
9
|
+
ChatGPT OAuthでは公式Codexと同じ `https://chatgpt.com/backend-api/codex/models` を使い、アカウントに返されたモデルIDを表示する。
|
|
10
|
+
`/models openai`、`/models chatgpt` でも再取得できる。取得中はCtrl+Cで中止でき、失敗時は理由を表示する。
|
|
11
|
+
古い固定リストや保存済み一覧へのフォールバックは行わない。再度開いて取得し直すか、モデルIDを直接指定できる。
|
|
12
|
+
`/models` では、保存済みのAPIキー・環境変数のAPIキー・ChatGPTのOAuth認証で使える接続先のモデルをまとめて選べる。
|
|
13
|
+
`/models <検索語>` で接続先をまたいで絞り込める。接続先の名前を指定すると、その一覧だけを取得する。
|
|
14
|
+
他のプロバイダーも同じ方針で、`/connect` と `/models` を開くたびに各プロバイダーの一覧APIから取得する。
|
|
15
|
+
AIプロバイダーはモデルの追加・廃止が多いため、組み込みの固定モデル一覧は持たない。
|
|
16
|
+
`fixed/scripted`(オフライン検証用)だけは取得元が無いため常に候補に出す。
|
|
9
17
|
|
|
10
18
|
`chat --model <provider>/<model>`、または `/connect <provider>/<model> [--base-url <url>]` で直接指定もできる。
|
|
11
19
|
接続に失敗しても別の接続先へ自動で切り替えない。モデルの選択だけではAPI到達や利用権限は検証されない。
|
|
@@ -26,7 +34,8 @@ APIキーは環境変数を優先し、未設定ならTTYで伏せ字入力で
|
|
|
26
34
|
| Provider | 認証 | 既定URL・設定 |
|
|
27
35
|
| --- | --- | --- |
|
|
28
36
|
| `openai` | `OPENAI_API_KEY` | OpenAI API |
|
|
29
|
-
| `opencode` | `OPENCODE_API_KEY` | `https://opencode.ai/
|
|
37
|
+
| `opencode` | `OPENCODE_API_KEY` | `https://opencode.ai/zen/v1` / `OPENCODE_BASE_URL` |
|
|
38
|
+
| `opencode-go` | `OPENCODE_API_KEY`(Zenと共通) | `https://opencode.ai/zen/go/v1` / `OPENCODE_GO_BASE_URL` |
|
|
30
39
|
| `ollama`(Local) | 不要 | `http://127.0.0.1:11434/v1` / `OLLAMA_BASE_URL` |
|
|
31
40
|
| `ollama-cloud` | `OLLAMA_API_KEY` | `https://ollama.com/v1` / `OLLAMA_CLOUD_BASE_URL` |
|
|
32
41
|
| `openrouter` | `OPENROUTER_API_KEY` | `https://openrouter.ai/api/v1` |
|
|
@@ -45,16 +54,31 @@ MODKHの個別承認やStopでリモートの副作用を制御・停止でき
|
|
|
45
54
|
|
|
46
55
|
`/connect` には **Ollama Local** と **Ollama Cloud** を別々に表示する。
|
|
47
56
|
ローカルは従来どおり `/connect ollama`。クラウドは `/connect ollama-cloud` でキーとモデルを選ぶ。
|
|
48
|
-
`/models ollama-cloud
|
|
57
|
+
`/models ollama-cloud` でもクラウド候補に絞り込める。
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
どちらの候補も固定値ではなく、`/v1/models` から取得した最新の一覧をそのまま並べる。
|
|
60
|
+
取得できなければ理由を表示し、モデルIDの直接入力を案内する。モデルの利用可否は送信時に確認する。
|
|
52
61
|
[公式の直接接続手順](https://docs.ollama.com/api/openai-compatibility)に従い、
|
|
53
62
|
`https://ollama.com/v1` と `OLLAMA_API_KEY` を使う。ローカルOllamaのインストール・サインインは不要。
|
|
54
63
|
直接APIでは `:cloud` 接尾辞を付けず、[API一覧のモデル名](https://ollama.com/api/tags)をそのまま使う。
|
|
55
64
|
`OLLAMA_BASE_URL` はLocalだけ、`OLLAMA_CLOUD_BASE_URL` はCloudだけに適用する。
|
|
56
65
|
Cloudのキー未設定・通信失敗時にLocalへ自動で切り替えない。
|
|
57
66
|
|
|
67
|
+
## OpenCode Zen / Go
|
|
68
|
+
|
|
69
|
+
`/connect` には **OpenCode Zen** と **OpenCode Go** を別々に表示する。
|
|
70
|
+
どちらも同じ `OPENCODE_API_KEY` を使うため、片方で入力したキーがもう片方にも適用される
|
|
71
|
+
(保存名は `opencode` に寄せ、旧版が `opencode-go` で保存したキーも読み替える)。
|
|
72
|
+
|
|
73
|
+
| 接続先 | ベースURL | 差し替え用の環境変数 |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| Zen | `https://opencode.ai/zen/v1` | `OPENCODE_BASE_URL` |
|
|
76
|
+
| Go | `https://opencode.ai/zen/go/v1` | `OPENCODE_GO_BASE_URL` |
|
|
77
|
+
|
|
78
|
+
Go は会話ごとの安定したセッションIDを要求し、無い場合は `400 MissingSessionID` を返す。
|
|
79
|
+
MODKHは `x-opencode-session` にプロセス単位のIDを、`user-agent` に `modkh/<version>` を付けて送る。
|
|
80
|
+
モデル一覧は両方とも `GET /models` から取得する(ZenとGoで内容は異なる)。
|
|
81
|
+
|
|
58
82
|
## Sign in with ChatGPT
|
|
59
83
|
|
|
60
84
|
```sh
|
package/docs/modkh.md
CHANGED
|
@@ -6,7 +6,7 @@ MoDKH (Mixture of DKH) is distributed as `modkh`, exposing only the `modkh` comm
|
|
|
6
6
|
|
|
7
7
|
See [Lisp presets](presets.md) for a single-preset example.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Ordinary `modkh` includes language-specific observation roles alongside the generic agents and installed plugins. The head can delegate to these roles and retains its ordinary editing tools. Loading a custom `--lisp-config` requires SBCL. In that session the supplied roles replace the default catalog, the head has read/language/delegation tools only, and editing/formal checking is delegated. Hermes cannot be used as the custom Lisp head because its remote tools bypass this boundary. Normal input goes through the head model unless `--routing auto` is explicitly supplied.
|
|
10
10
|
|
|
11
11
|
The trusted Lisp file is **arbitrary OS code**, not sandboxed configuration. Its input bytes are snapshotted, hash checked, and evaluated with startup files disabled in a private temporary HOME/TMPDIR and a minimal environment. Additional files loaded by that trusted code are not recursively covered by the hash. Relative loads resolve in the snapshot directory. Review any absolute dependencies separately. There is no implicit reload or workspace discovery.
|
|
12
12
|
|
|
@@ -53,7 +53,7 @@ Every role receives the full manifest-verified `kiokuko-single-purpose-functions
|
|
|
53
53
|
|
|
54
54
|
The manifest must explicitly include the trusted check's project inputs/dependencies. The model cannot supply the manifest or command. `targetPaths` must be an exact subset of owner-approved sources and cannot include protected files. Paths must be relative; existing single-link regular files only; symlinks, creation, rename, deletion and multi-file edits are refused. The request format allows up to eight paths for future workflows, but this workflow currently accepts exactly one.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
During editing, the child gets a private snapshot containing only the approved target and tools that list the exact permitted path. Give the child behavioral acceptance criteria in the assignment. In a configured head workflow, the host also supplies the current user request and preloads the approved source. When the child stages a change, the host pauses editing and runs the fixed command against the candidate and pinned verifier inputs in a separate workspace, through the existing approval path, with a 30-second limit and no job promotion. After a settled test failure, the same child can revise its candidate within its remaining turns. The child receives the verdict without protected file contents or test output. Exit state/code come from the host process handle; stdout cannot fabricate them. On success, current source/verifier hashes and source inode identity are checked before applying the single-file change through a no-follow file descriptor. Concurrent changes produce stale/unknown instead of a pass for another revision. Checks that fail leave the original source unchanged. Successful no-ops are `no-change/verified`; failed or unexecuted checks cannot verify a no-op.
|
|
57
57
|
|
|
58
58
|
**Security limitation:** the private snapshot is not an OS sandbox. Arbitrary checker or tested source code may execute OS operations, and pre/post hashes do not prove the verifier stayed unchanged throughout execution. External executable/dependency closures and hostile filesystem races are not fully protected. A process can interfere with its own test execution. `passed` means this fixed command exited zero for the recorded unchanged snapshots, not a proof against adversarial code or proof of the task's semantics. Use reviewed trusted execution inputs. Strong hostile-input isolation remains unfinished; see `modkh-verification.md`.
|
|
59
59
|
|
|
@@ -66,7 +66,7 @@ Examples inside the chat:
|
|
|
66
66
|
/agents route ts outline Inspect src/example.ts.
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
`--routing auto` is an optional conservative deterministic router, not LLM judgment. Unsupported/ambiguous requests go back to the head. Mixed intents, negation, conditionals, multiple files, URLs and outside paths do not directly dispatch a role.
|
|
69
|
+
`--routing auto` is an optional conservative deterministic router, not LLM judgment. Unsupported/ambiguous requests go back to the head. Mixed intents, negation, conditionals, multiple files, URLs and outside paths do not directly dispatch a role. If the trusted configuration uses `set-head-instruction`, normal chat input always goes to the head so its workflow can coordinate multiple roles. Explicit `/agents` commands still dispatch directly.
|
|
70
70
|
|
|
71
71
|
## Formal tools
|
|
72
72
|
|
|
@@ -74,12 +74,16 @@ Host flags select executables; the model never selects binaries or arbitrary ver
|
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
76
|
modkh chat --lisp-config experiments/presets/formal.lisp --trust-lisp-sha256 REVIEWED_SHA256 \
|
|
77
|
-
--
|
|
77
|
+
--lean /path/to/lean
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Both tools require command approval, snapshot bounded inputs, omit API credentials from the environment, and bound time/output.
|
|
80
|
+
Install the front verifier with `modkh stateright install` (Rust/Cargo required at installation). Normal chat automatically registers `modkh-micro-zenki` when installed. The Lisp preset uses `micro-zenki`. Both tools require command approval, snapshot bounded inputs, omit API credentials from the environment, and bound time/output. Stateright checks explicit finite-state JSON models; a complete exploration and matching input digest are required for success. Counterexamples are replayed by the host. See [installation, schema and migration](stateright.md). Model checking does not establish equivalence to application code.
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
To check a proof, create a separate workspace file such as `Expected.lean` with an owner-reviewed proposition, for example `def modkhExpected : Prop := ∀ n : Nat, n + 0 = n`. Add `--lean-contract Expected.lean --lean-theorem Examples.addZero` to the command. Delegate the proof source to 後鬼 and let the host load the expected proposition. The theorem name must be declared in the proof source. In the parent receipt, `proofPath` identifies the proof source and `target.expectedPropositionPath` identifies the expectation.
|
|
83
|
+
|
|
84
|
+
Compiler exit zero records `status: accepted`. With a configured target, a separate Lean process loads the compiled declarations, replays the candidate additions through the kernel, and checks the named theorem against the expected proposition using kernel definitional equality. It also checks transitive axioms, allowing Lean's standard `propext`, `Classical.choice` and `Quot.sound`. The receipt distinguishes `proofStatus: proved`, `rejected` (including missing declarations, different statements and disallowed axioms), and `unverified`. Without a configured target, even a successful compile remains `PROOF_UNVERIFIED`. The parent receives the proof verdict, target, input hashes and execution receipts in `formalEvidence`.
|
|
85
|
+
|
|
86
|
+
The contract and proof must be standalone Lean files. Project imports and universe-polymorphic target declarations are unsupported. Keep both inputs reviewed because Lean metaprograms can execute OS code during compilation. The verdict covers the configured proposition. The parent still checks whether that proposition addresses the user request and how it relates to any implementation.
|
|
83
87
|
|
|
84
88
|
## Language tooling and verification
|
|
85
89
|
|
|
@@ -121,4 +125,4 @@ node scripts/modkh-language-probe.mjs commonlisp /absolute/path/to/cl-lsp /absol
|
|
|
121
125
|
|
|
122
126
|
It checks lexical definition coordinates and a separate malformed document, records push notifications and supported pull requests, and returns nonzero unless both checks succeed. It never loads/evaluates the project to manufacture a global definition result. CL-LSP private cold installation remains unimplemented.
|
|
123
127
|
|
|
124
|
-
|
|
128
|
+
Each edit verification receipt applies to its tested candidate. Acceptance pauses the edit tools and only a settled test failure reopens them for revision in the same child. Changed or restored original files and changed snapshot dependencies invalidate acceptance. These checks do not establish OS isolation: arbitrary executed source can still access resources outside the snapshot, and complete verifier dependency isolation is not implemented. See `modkh-verification.md` for remaining acceptance failures.
|
package/docs/presets.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Lispプリセット
|
|
2
2
|
|
|
3
|
+
引数なしの `modkh` には、PHP・Common Lisp・JavaScript・TypeScript・Svelte・HTML・CSS・Tailwind CSS の調査担当が組み込まれています。親モデルが依頼を分割して順に委譲し、結果をまとめます。たとえば、対応するモデルに接続して「`src/client.ts` と `src/server.js` の構造を調べ、共通点をまとめて」と依頼できます。担当は `/agents` に `modkh-micro-` で始まる名前で表示されます。
|
|
4
|
+
|
|
5
|
+
組み込み担当を登録するために SBCL は不要です。診断や参照検索などには言語別の機能が必要です。以下の Lisp プリセットは、担当を独自に編成したり、検証付き編集を設定したりする場合に使います。
|
|
6
|
+
|
|
3
7
|
[プリセット一覧](../experiments/presets/)から使う言語のファイルを選びます。SBCLを用意し、ファイルを置いたプロジェクトで実行します。以下はリポジトリのルートでTypeScript用を使う例です。
|
|
4
8
|
|
|
5
9
|
```sh
|
|
@@ -12,6 +16,47 @@ Lispファイルはコードとして実行されます。内容を確認し、
|
|
|
12
16
|
|
|
13
17
|
チャットで `/agents` を開くと担当を確認できます。たとえば `/agents route ts outline Inspect src/index.ts` で構造調査を委譲できます。
|
|
14
18
|
|
|
19
|
+
## 役小角・前鬼・後鬼と作業を始める
|
|
20
|
+
|
|
21
|
+
前鬼はStaterightを使います。`modkh stateright install` で導入すると通常起動で利用できます(SBCL不要)。以下は前鬼と後鬼を必須の検証担当にするLispプリセットの設定です。[モデル形式](stateright.md)も参照してください。
|
|
22
|
+
|
|
23
|
+
複数言語の調査も役小角に委譲させる場合は、[言語別の担当一覧](../experiments/presets/language-microagents.lisp)を `formal.lisp` と同じ設定にまとめます。次の例はリポジトリのルートで実行します。
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
cat experiments/presets/formal.lisp experiments/presets/language-microagents.lisp > agents-with-languages.lisp
|
|
27
|
+
shasum -a 256 agents-with-languages.lisp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
内容を確認し、起動例の `--lisp-config` に `agents-with-languages.lisp`、`--trust-lisp-sha256` にその SHA-256 を指定します。役小角は言語、作業種別、ツールの一覧から `micro-ts-outline` などを直接選べます。子には対象ファイルを一つ渡し、定義・参照・ホバーには対象位置も添えます。各調査担当は専用ツール一つで、結果と位置を返します。言語別に編集を委譲する場合は、対象と保護テストを設定した編集担当を追加してください。
|
|
31
|
+
|
|
32
|
+
TypeScript・JavaScript・PHP・HTML・CSSの構文検索には、`micro-ts-syntax-search` などの担当を使えます。ファイルと宣言名を渡すと、Tree-sitterが候補の宣言全体の範囲を返します。役小角はこの範囲を編集担当に引き継げます。編集担当は現行ソースを読み取ってから変更を適用します。
|
|
33
|
+
|
|
34
|
+
`formal.lisp` を同じ手順で確認し、そのファイルの SHA-256 を指定して起動します。
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
modkh chat --lisp-config experiments/presets/formal.lisp --trust-lisp-sha256 REVIEWED_SHA256 \
|
|
38
|
+
--lean /path/to/lean \
|
|
39
|
+
--lean-contract Expected.lean --lean-theorem orders_cancel
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
通常チャットでは、MoA の親エージェントが **役小角(`enno-oduno`)** を担います。役小角は依頼を検証できる単位に分け、担当ごとの作業と確認条件を `start_subagent` の `task` に、全体の目的と関係する依存関係を `context` に渡します。担当を起動した後も親は独立した調査や確認を進め、子の結果が必要になった時点で待ちます。前鬼(`micro-zenki`)には `formalInput.path` で Stateright のモデルJSONを、後鬼(`micro-goki`)には `formalInput.path` で証明元の Lean ファイルを指定します。ホストは指定されたパスで各担当の検証ツールを一度実行します。起動時の `--lean-contract` と `--lean-theorem` は対象定理の照合に使います。後鬼から命題不一致が返れば、その条件は不合格として記録します。役小角は両者のツール結果と実装の受け入れ結果を元の依頼に照らして確認します。
|
|
43
|
+
|
|
44
|
+
`formal.lisp` に登録されているのは検証担当です。実装の編集も委譲する場合は、確認済みの同じ Lisp ファイルに編集担当と [検証コマンド・対象ファイルの設定](modkh.md#one-file-edit-and-independent-acceptance)を加え、SHA-256 を取り直してください。
|
|
45
|
+
|
|
46
|
+
`(require-head-checks)` を含む正式プリセットでは、修正や実装を依頼したターンを終える前に、ホストがそのターンの検証記録を確認します。結果が不足していれば、同じターンで役小角に確認を続けさせます。Lean の命題不一致は形式検証の不合格です。不合格が確定すると、ホストはそのターンの追加のツール呼び出しを止めます。同じセッションの次の依頼は、次のターンで得た検証記録で判定します。
|
|
47
|
+
|
|
48
|
+
プロジェクト固有の入力が決まっている場合は、信頼する Lisp 設定に次のように書くと、役小角が応答を終えようとした時点でホストが不足している検証を補えます。
|
|
49
|
+
|
|
50
|
+
```lisp
|
|
51
|
+
(set-head-check-inputs "Orders.json" "Orders.lean")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
第3引数に編集担当の ID を指定すると、その担当に登録された1つのソースの編集・反映も完了条件に加わります。ホストが補う処理にも通常の委譲、承認、受け入れチェックが適用されます。設定を変更したら SHA-256 を取り直してください。
|
|
55
|
+
|
|
56
|
+
編集担当を設定した実装依頼で、役小角の応答が委譲前に出力上限 `length` に達した場合、ホストは設定済みソースの先頭60行を読み、同じチャットターンを一度続けます。復帰直後の応答では、指定編集担当への `run_subagent` 一件だけを受け付けます。途中で切れた応答は実行記録に残します。その応答にツール要求が含まれていた場合は、実行せずにターンをエラーで終えます。編集担当から `EDIT_TURN_LIMIT` が届いた場合は編集不合格が確定します。
|
|
57
|
+
|
|
58
|
+
`(set-head-instruction "...")` は、信頼済みの Lisp 設定から親エージェントの進め方を指定します。指定した進め方が、標準の委譲手順とターンごとの汎用スキル指示に代わります。この設定があるセッションでは、`--routing auto` を指定していても通常のチャット入力は親を通ります。`/agents run` などで担当を明示した場合は、その担当を直接呼び出します。
|
|
59
|
+
|
|
15
60
|
## どんなときに役立つか
|
|
16
61
|
|
|
17
62
|
定義や参照の検索、診断などを専用ツール付きの担当に切り出せます。対応する言語サーバーが必要な操作もあります。編集は対象ファイルと固定の検証コマンドを設定したときだけ有効になります。通常のチャットと比べた速度やトークン消費の改善幅は未計測です。
|
package/docs/setup.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| Lisp担当設定・補助構文診断 | SBCL。ASDF/QuicklispやLSPは設定評価には不要 |
|
|
10
10
|
| CL-LSPの構築 | Cコンパイラ、make、tar/bzip2、Git、HTTPS接続。専用領域へRoswell、SBCL、ASDFとaskdkc/cl-lspを導入。Lisp依存はCL-LSPに同梱 |
|
|
11
11
|
| 導入時のHTTPS通信 | curl、CA証明書。CL-LSP用のOpenSSL設定やQlotは不要 |
|
|
12
|
-
| 前鬼(
|
|
12
|
+
| 前鬼(Stateright) | 導入時にRust/Cargo。`modkh stateright install`。通常のMoDKH起動には不要 |
|
|
13
13
|
| 後鬼(Lean) | Lean。elanでtoolchainを管理可能 |
|
|
14
14
|
| 文法WASMの再構築 | Tree-sitter CLIとEmscripten。通常buildは同梱用の既存WASMをコピーするため不要 |
|
|
15
15
|
|
|
@@ -25,10 +25,6 @@ brew install node git sbcl curl ca-certificates
|
|
|
25
25
|
# Roswellを手動で使う場合のみ
|
|
26
26
|
brew install roswell
|
|
27
27
|
|
|
28
|
-
# 前鬼を使う場合のみ。システムJavaの置換は不要
|
|
29
|
-
brew install openjdk
|
|
30
|
-
export PATH="$(brew --prefix openjdk)/bin:$PATH"
|
|
31
|
-
|
|
32
28
|
# 文法をソースから再構築する開発者のみ
|
|
33
29
|
brew install emscripten tree-sitter-cli
|
|
34
30
|
```
|
|
@@ -43,9 +39,6 @@ sudo pacman -Syu --needed base-devel nodejs npm git sbcl curl ca-certificates ta
|
|
|
43
39
|
# Roswellを手動で使う場合のみ
|
|
44
40
|
sudo pacman -S --needed roswell
|
|
45
41
|
|
|
46
|
-
# 前鬼を使う場合のみ
|
|
47
|
-
sudo pacman -S --needed jre-openjdk
|
|
48
|
-
|
|
49
42
|
# 文法をソースから再構築する開発者のみ
|
|
50
43
|
sudo pacman -S --needed emscripten tree-sitter-cli
|
|
51
44
|
```
|
|
@@ -97,15 +90,9 @@ Roswellが既存checkoutを再利用して古いコードを読む場合は、
|
|
|
97
90
|
| Ruby | Rubyと `ruby-lsp` gem(ホスト側で準備) |
|
|
98
91
|
| Swift | Swift toolchainの `sourcekit-lsp`。macOSではXcodeのtoolchainも利用可能 |
|
|
99
92
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```sh
|
|
103
|
-
modkh chat --lisp-config experiments/presets/formal.lisp --trust-lisp-sha256 REVIEWED_SHA256 \
|
|
104
|
-
--lean /absolute/path/to/lean \
|
|
105
|
-
--java /absolute/path/to/java --tla-jar /absolute/path/to/tla2tools.jar
|
|
106
|
-
```
|
|
93
|
+
前鬼は `modkh stateright install` で導入します。導入済みなら通常起動で自動登録されます。Java/TLCは不要です。[導入・モデル形式](stateright.md)を参照してください。ソースからテストする開発者もRust/Cargoが必要です(`npm test` が検証器をビルドします)。
|
|
107
94
|
|
|
108
|
-
[
|
|
95
|
+
後鬼に使うLeanは[公式インストール手順](https://lean-lang.org/install/)を参照してください。
|
|
109
96
|
|
|
110
97
|
CL/Svelteの実WASMは未同梱であり、Emscriptenを入れるだけでは有効になりません。強いOS検証隔離も未提供です。[機能ごとの検証状況](modkh-verification.md)
|
|
111
98
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 前鬼とStateright
|
|
2
|
+
|
|
3
|
+
前鬼は[Stateright](https://github.com/stateright/stateright) 0.31.0による有限状態探索を使います。MoDKH同梱のRustソースから専用コマンド `modkh-stateright` を構築します。
|
|
4
|
+
|
|
5
|
+
## 導入・更新
|
|
6
|
+
|
|
7
|
+
[Rust公式手順](https://rust-lang.org/tools/install/)でRust/Cargoを用意し、`cargo --version` を確認します。macOSではビルド用のCommand Line Toolsも必要です。
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
modkh stateright install
|
|
11
|
+
modkh stateright status
|
|
12
|
+
modkh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
初回ビルドには依存取得のネット接続が必要です。導入先は `~/.config/modkh/stateright/bin/modkh-stateright`(`MODKH_HOME` 指定時はその配下)です。次の起動で前鬼が自動登録されます。通常チャットでは親モデルに状態遷移や不変条件の検証を依頼してください。`/agents` に `modkh-micro-zenki` が表示されます。明示的に無効化した担当は自動で有効に戻しません。
|
|
16
|
+
|
|
17
|
+
更新時も同じinstallコマンドを使います。管理領域の検証器を優先し、なければPATH上の `modkh-stateright` を探します。独自の配置には `modkh --stateright /absolute/path/to/modkh-stateright` を使えます。RustライブラリがCargoのキャッシュにあるだけでは導入済みとは扱いません。
|
|
18
|
+
|
|
19
|
+
## モデルJSON
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"schemaVersion": 1,
|
|
24
|
+
"states": ["idle", "running", "done"],
|
|
25
|
+
"initial": ["idle"],
|
|
26
|
+
"transitions": [
|
|
27
|
+
{"from": "idle", "to": "running", "action": "Start"},
|
|
28
|
+
{"from": "running", "to": "done", "action": "Finish"}
|
|
29
|
+
],
|
|
30
|
+
"invariants": [{"name": "ValidState", "allowedStates": ["idle", "running", "done"]}],
|
|
31
|
+
"checkDeadlocks": false
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
全フィールド必須です。状態と遷移を明示し、各不変条件の許容状態を列挙します。到達可能な状態を幅優先探索し、許容状態から外れたら反例の状態列と操作列を返します。上記で `done` を許容状態から除けば反例になります。`checkDeadlocks: true` では、出る遷移がない到達状態も不合格です(正常な終端を含むため、モデルの意図に応じて指定してください)。
|
|
36
|
+
|
|
37
|
+
入力上限256KiB、状態1〜10,000件、不変条件1〜64件、遷移50,000件以下。検証時間は最大30秒です。未知のフィールド、重複名、存在しない状態への参照は拒否します。探索完了時のみpassedとし、反例はfailed、中断・時間切れ・不正な出力はunverifiedです。入力SHA-256を実行記録に結び付け、反例の遷移と違反をホストでも照合します。
|
|
38
|
+
|
|
39
|
+
親からは `run_subagent` に `pluginId: "modkh-micro-zenki"` と `formalInput: {"path": "Model.json"}` を渡します。Lisp正式プリセットでは担当IDは `micro-zenki` です。
|
|
40
|
+
|
|
41
|
+
## 旧TLC設定からの移行と範囲
|
|
42
|
+
|
|
43
|
+
`verify_tla`、`--java`、`--tla-jar` は廃止しました。TLA+/cfgの自動変換はありません。対象の状態・遷移・不変条件をJSONに書き直し、`verify_stateright` を使います。Lispは `(set-head-check-inputs "Model.json" "Proof.lean")` に変更し、設定のSHA-256を取り直してください。
|
|
44
|
+
|
|
45
|
+
検証するのはこの有限モデルだけです。公平性・時相論理・無限状態の証明、実装との等価性は扱いません。モデルの仮定と実装への対応をレビューし、実装の通常テストも併用してください。後鬼のLean検証は独立して利用できます。
|
package/docs/subagents.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
```text
|
|
6
6
|
/connect fixed/scripted
|
|
7
7
|
/agents
|
|
8
|
+
/agents limit 2
|
|
8
9
|
/agents run modkh-explorer 調査する内容
|
|
9
10
|
/agents run modkh-worker 実装する内容
|
|
10
11
|
```
|
|
@@ -14,11 +15,25 @@
|
|
|
14
15
|
- **modkh-explorer**: 列挙・検索・読み取りのみ。編集、シェル、再委譲は実行できません。
|
|
15
16
|
- **modkh-worker**: 親が持つファイル・コマンドツールを利用します。編集・コマンドごとの承認は省略しません。
|
|
16
17
|
- 承認にはプラグインIDと子IDが表示されます。拒否やCtrl+Cで中断でき、終了後は入力に戻ります。
|
|
17
|
-
-
|
|
18
|
+
- 同時実行は既定で **親1+子2(最大3)**、深さは1段です。`/agents` に現在値を表示し、`/agents limit <1〜16>` で子の上限を変更・保存します。親の1枠は別です。設定は次回起動でも復元します。上限を下げても実行中の子は停止しません。
|
|
19
|
+
- 子の起動は直ちに実行IDを返します。親は独立した調査や統合を進め、複数の子を統括できます。独立して分担できない作業は原則として親が行います。Lisp構成など専門担当の権限が必要な場合は委譲します。
|
|
20
|
+
- 親は子の結果保存・後片付け・通知回収が済むまで完了しません。親の中断・エラー・ターン上限・終了時は残った子を停止し、後片付けを待ちます。
|
|
21
|
+
- 編集権限のある汎用worker・externalは作業ルートを専有し、同時に別のwriterを動かしません。edit-verifyは異なる対象ファイルを並行処理できますが、検証入力の変更は既存のstale判定で適用を拒否します。子が編集中も親の読み取りは可能です。親の編集・コマンドは子の編集完了後に行います。親のバックグラウンドコマンドが実行中ならwriterの起動を拒否します。別MODKHプロセスとの編集排他は保証しません。
|
|
22
|
+
- 並行する承認要求は一件ずつ表示します。ある子の承認待ちを取り消しても、他の子の承認や親の入力を取り消しません。
|
|
18
23
|
- 子は独立したモデルと履歴を持ちます。親の全履歴、記憶、認証キーをプロンプトへ自動コピーしません。
|
|
19
24
|
- `completed` / `ok` は実行終了であり、依頼達成やテスト合格の証明ではありません。
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
モデルは次の入口を使います。子にはこれらの管理ツールを渡しません。モデルからの上限変更・インストール・有効化も許可しません。
|
|
27
|
+
|
|
28
|
+
- `list_subagents()`:利用できる担当を確認。
|
|
29
|
+
- `start_subagent({ pluginId, task, context?, targetPaths? })`:起動して`runId`を受け取る。返却は依頼達成を意味しません。
|
|
30
|
+
- `list_subagent_runs()`:親に属する実行の状態と上限を確認。
|
|
31
|
+
- `subagent_output({ runId, waitMs? })`:保存結果を取得。既定は待たずに`running`を返します。独立した仕事がない場合だけ`waitMs`(最大60,000)を指定します。
|
|
32
|
+
- `cancel_subagent({ runId })`:指定した子を停止し、後片付け結果を取得。
|
|
33
|
+
|
|
34
|
+
完了通知は親の次のモデル要求に入り、親が結果と実際のツール証拠を突き合わせます。`run_subagent`は同期実行の互換入口として残し、手動の`/agents run`でも使います。
|
|
35
|
+
|
|
36
|
+
上限はこの親セッションが起動する子に適用します。別プロセスや別アプリのAPI使用数は含みません。
|
|
22
37
|
|
|
23
38
|
## ローカルパッケージを登録する
|
|
24
39
|
|
|
@@ -69,7 +84,7 @@ export function define() {
|
|
|
69
84
|
|
|
70
85
|
IDは英小文字始まりの小文字英数字・ハイフンで64文字まで。`modkh-` は予約済み。API版は整数 `1` のみ。未知フィールド、範囲外entry、シンボリックリンクは拒否します。entryはパッケージ内の `.js` または `.mjs` です。
|
|
71
86
|
|
|
72
|
-
上限はmanifest 64 KiB、パッケージ10 MiB・1,000エントリ(ディレクトリを含む)、深さ32。依頼32 KiB、補足128 KiB、結果テキスト64 KiB
|
|
87
|
+
上限はmanifest 64 KiB、パッケージ10 MiB・1,000エントリ(ディレクトリを含む)、深さ32。依頼32 KiB、補足128 KiB、結果テキスト64 KiB。切り捨てずエラーにします。子の起動・モデル実行には120秒で停止を要求します(後片付け時間は別)。編集担当は設定されたターン数を上限に、各モデル・ツール往復に120秒を割り当てます。変更候補ができた時点で、ホストの受け入れ工程に別途60秒(コマンド実行は最大30秒)を割り当てます。入力指定付きのホストLean検証には別途150秒を割り当て、証明元と期待命題のコンパイルは各30秒、命題照合は60秒が上限です。どの工程も親から中止できます。ローカルモデルは既存ループの最大25ターンです。
|
|
73
88
|
|
|
74
89
|
## 子モデルとツール制限
|
|
75
90
|
|
|
@@ -77,6 +92,7 @@ IDは英小文字始まりの小文字英数字・ハイフンで64文字まで
|
|
|
77
92
|
|
|
78
93
|
```json
|
|
79
94
|
{
|
|
95
|
+
"subagentLimit": 2,
|
|
80
96
|
"subagents": {
|
|
81
97
|
"modkh-explorer": { "tools": ["read_file", "search_files"] },
|
|
82
98
|
"my-reviewer": { "model": "fixed/scripted", "tools": ["read_file"] }
|
|
@@ -132,3 +148,5 @@ sh scripts/acceptance.sh
|
|
|
132
148
|
```
|
|
133
149
|
|
|
134
150
|
受け入れ検証はtarballを隔離インストールし、インストールしたCLIから組み込み・追加local・external fixture、選択、個別承認、拒否、Ctrl+C後の入力復帰、無効化・登録解除、公開型の消費を確認します。実サービスの認証、Codex/Claude Code/ACP等の実製品アダプター、実PTY・スクリーンリーダーはこの検証に含みません。
|
|
151
|
+
|
|
152
|
+
入力を固定した役小角のワークフローでは、編集委譲に `task`、Lisp 指定の対象一件を含む `targetPaths`、同じ操作の現状と期待結果を記した `behaviorChange.before` / `behaviorChange.after` が必要です。ホストは欠落、定型的な曖昧値、同一の前後条件、対象の不一致を子の起動前に拒否します。前鬼・後鬼には固定した検証入力を要求し、ホストが作業・対象・判定基準を子セッションと委譲記録に保存します。編集担当には依頼原文と許可されたソースを渡します。差分がない場合や保護テストが異常終了せず不合格だった場合は、残りのターン数の範囲で同じ子が編集を続けます。テストはホストが別の作業領域で実行し、編集担当には合否だけを返します。差分がないままターン上限に達すると `EDIT_TURN_LIMIT` が役小角に届き、そのチャットターンは不合格で終了します。再委譲・保護テスト・反映は行いません。編集の完了は保護テストの合格と反映記録で判定します。
|
package/docs/web.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
| `none` | 通信のたびに確認する |
|
|
12
12
|
|
|
13
13
|
- 承認の表示には、送信先ホスト・URL・検索語・上限が入ります。**何が外部へ送られるかを見てから**決めてください。
|
|
14
|
-
- `fetch_url` は**転送(リダイレクト)のたびに**承認を求めます。転送先は、人間が承認したURL
|
|
14
|
+
- `fetch_url` は**転送(リダイレクト)のたびに**承認を求めます。転送先は、人間が承認したURLとは別の場所になり得るためです。拒否すれば、その先へは進みません。各承認の回答期限は表示から3分です。通信の制限時間には、承認待ちの時間を含めません。
|
|
15
15
|
- 承認と通信の間に Stop や中断が入った場合は、結果不明として返します。再送するかどうかは呼び出し側が判断してください。
|
|
16
16
|
|
|
17
17
|
## キー
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
(in-package :modkh)
|
|
2
|
-
(
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
(require-head-checks)
|
|
3
|
+
(set-head-instruction
|
|
4
|
+
"あなたは役小角 (enno-oduno)。MoA の親エージェントとして、通常チャットで受けたコーディング依頼の計画、委譲、最終確認を統括する。実装を依頼されたら、計画を返すだけで終えず、その応答中に委譲ツールを呼んで結果を回収する。質問や説明だけの依頼は通常どおり扱う。
|
|
5
|
+
依頼を Single Purpose Functions に沿って一責務ずつに分解する。各担当に一つの作業、正確な対象、観測できる完了条件を渡す。Lisp で編集対象が指定されていれば、必要に応じて先にそのソース一件を読み、編集担当へ委譲する。設定済みの形式検証ファイルの内容調査は前鬼・後鬼に任せる。start_subagent で担当を起動し、親は別の調査や受け入れ条件の確認を進める。編集結果に依存する検証は反映後に始める。依存のない担当は空き枠に応じて並行して起動する。子の結果が必要で、ほかに進められる作業がないときだけ待つ。
|
|
6
|
+
1. 実装は taskKind が edit の担当に依頼する。pluginId に編集担当の ID、task に実装する変更一件、targetPaths にソース一件を入れる。Lisp で編集担当が指定されている場合は behaviorChange の before と after に同じ操作の具体的な現状と期待結果を入れる。前鬼や後鬼には編集を依頼しない。
|
|
7
|
+
2. 前鬼は Stateright 専用。pluginId に micro-zenki、formalInput にモデルJSONの path を入れる。例: formalInput = {:path Model.json}。実在する .json に置き換える。
|
|
8
|
+
3. 後鬼は Lean 専用。pluginId に micro-goki、formalInput に path だけを入れる。例: formalInput = {:path Proof.lean}。実在する証明元に置き換える。定理名はファイル名に使わない。期待命題と対象定理の照合はホストが行う。
|
|
9
|
+
task には担当の作業条件を、context には全体の目的と依存関係を書く。それぞれの実行記録が揃うまで全体結果を報告しない。
|
|
10
|
+
各検証は同じ入力で一度だけ行う。ツール結果 formalEvidence を読み、proved、rejected、Stateright の passed、反例は確定として記録する。rejected は該当条件の不合格として記録し、他の担当に同じ確認を回さない。一度失敗した実行は、入力や原因を具体的に修正できた場合だけ再試行する。原因を解消できなければ未確認として次の担当に進む。
|
|
11
|
+
ホストの verification.application が applied のとき反映済みとする。EDIT_TURN_LIMIT が返ったら編集不合格で終了する。
|
|
12
|
+
最終確認では、依頼の各受け入れ条件を、反映された実装と各担当のツール記録に照らす。Stateright の結論は探索したモデルの範囲で扱う。Lean はコンパイル状態と proofStatus を別々に確認し、対象の期待命題が依頼の条件に対応し、proofStatus が proved の場合にその条件を証明済みとする。命題不一致が残る場合は、実装の受け入れチェックの結果とは別に、形式検証が不合格であると報告する。完了した作業、確認できた条件、未解決の条件を報告する。")
|
|
13
|
+
(defmicroagent micro-zenki :title "前鬼" :tool "verify_stateright"
|
|
14
|
+
:language "stateright" :task-kind "verify" :max-turns 4
|
|
15
|
+
:instruction "指定JSONモデルをStaterightで検査し、有限探索範囲・不変条件・反例・制約を返す。実装との等価性は別問題。")
|
|
5
16
|
(defmicroagent micro-goki :title "後鬼" :tool "verify_lean"
|
|
6
17
|
:language "lean" :task-kind "verify" :max-turns 4
|
|
7
|
-
:instruction "
|
|
18
|
+
:instruction "verify_lean の path に渡すのは、親が指定した証明元ファイルだけ。期待命題ファイルはホストが照合に使うため、確認目的でも verify_lean に渡さない。proved または rejected が返ったら、その判定を報告して終了する。報告では proofPath(証明元)、target.expectedPropositionPath(期待命題)、target.theorem(対象定理)と、コンパイル状態・proofStatus・判定理由を区別する。")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
(in-package :modkh)
|
|
2
|
+
|
|
3
|
+
; Add this roster to a reviewed head configuration, or use it on its own.
|
|
4
|
+
; IDs are formed as micro-<language>-<task-kind>.
|
|
5
|
+
(flet ((register-language-role (language label kind role-name tool instruction turns)
|
|
6
|
+
(register-agent (format nil "micro-~a-~a" language kind)
|
|
7
|
+
:title (format nil "~a~a担当" label role-name)
|
|
8
|
+
:tool tool :language language :task-kind kind
|
|
9
|
+
:instruction instruction :max-turns turns)))
|
|
10
|
+
(dolist (language '(("ts" "TypeScript")
|
|
11
|
+
("js" "JavaScript")
|
|
12
|
+
("php" "PHP")
|
|
13
|
+
("common-lisp" "Common Lisp")
|
|
14
|
+
("svelte" "Svelte")
|
|
15
|
+
("html" "HTML")
|
|
16
|
+
("css" "CSS")))
|
|
17
|
+
(destructuring-bind (code label) language
|
|
18
|
+
(dolist (role '(("outline" "構造" "code_outline" "指定ファイルの構造を取得し、主要な宣言と位置を返す。" 30)
|
|
19
|
+
("definition" "定義" "code_definition" "指定位置の定義を探し、定義元と位置を返す。" 4)
|
|
20
|
+
("references" "参照" "code_references" "指定位置のシンボルを参照している箇所を列挙し、位置と検索範囲を返す。" 4)
|
|
21
|
+
("diagnostics" "診断" "code_diagnostics" "指定ファイルの診断を取得し、位置と重大度を返す。" 4)))
|
|
22
|
+
(apply #'register-language-role code label role))
|
|
23
|
+
(when (member code '("ts" "js" "php" "html" "css") :test #'string=)
|
|
24
|
+
(register-language-role code label "syntax-search" "宣言検索" "code_syntax_search"
|
|
25
|
+
"指定ファイル一件で指定名をTree-sitterで検索し、各候補の宣言全体の範囲を返す。" 4))))
|
|
26
|
+
(register-language-role "tailwindcss" "Tailwind CSS" "hover" "クラス情報" "code_hover"
|
|
27
|
+
"指定位置のクラス情報を取得し、根拠を返す。" 4)
|
|
28
|
+
(register-language-role "tailwindcss" "Tailwind CSS" "diagnostics" "診断" "code_diagnostics"
|
|
29
|
+
"指定ファイルのTailwind CSS診断を取得し、位置と重大度を返す。" 4))
|