feat(core): EDITMODE protocol — declarable tweakable params#84
feat(core): EDITMODE protocol — declarable tweakable params#84
Conversation
There was a problem hiding this comment.
Findings
-
[Major]
revisemode now receives EDITMODE declaration instructions, which does not match the stated scope (create+tweak) and can steer revision flows toward parameter-block authoring instead of targeted edits. Evidencepackages/core/src/prompts/index.ts:660,packages/core/src/prompts/index.ts:663
Suggested fix:const sections: string[] = [ IDENTITY, WORKFLOW, OUTPUT_RULES, DESIGN_METHODOLOGY, ARTIFACT_TYPES, PRE_FLIGHT, ]; if (opts.mode === 'create' || opts.mode === 'tweak') { sections.push(EDITMODE_PROTOCOL); } if (opts.mode === 'tweak') { sections.push(TWEAKS_PROTOCOL); }
-
[Minor] The protocol table suggests an enum detection via "comment hint (TBD)" while the rules explicitly forbid comments inside the JSON block, which can induce invalid output and parse failures. Evidence
packages/core/src/prompts/editmode-protocol.v1.txt:22,packages/core/src/prompts/editmode-protocol.v1.txt:37,packages/core/src/prompts/index.ts:182,packages/core/src/prompts/index.ts:197
Suggested fix:| Enum-like string (closed set defined by key/schema) | Select dropdown |
Summary
- Review mode: initial
- 2 issues found in added/modified lines (1 Major, 1 Minor).
docs/VISION.mdanddocs/PRINCIPLES.md: Not found in repo/docs in this checkout, so constraint validation relied onCLAUDE.mdplus diff-scoped files.
Testing
- Not run (automation)
- Suggested tests: add a
composeSystemPrompt({ mode: 'revise' })assertion that EDITMODE protocol is excluded (if create+tweak scope is intended).
open-codesign Bot
| DESIGN_METHODOLOGY, | ||
| ARTIFACT_TYPES, | ||
| PRE_FLIGHT, | ||
| EDITMODE_PROTOCOL, |
There was a problem hiding this comment.
EDITMODE_PROTOCOL is pushed in the base section list, so mode: 'revise' gets this section too. If scope is create+tweak (per PR description), gate this push to create || tweak to avoid revise-mode prompt drift.
| | `true / false` | Toggle switch | | ||
| | Number (e.g. `1.0`, `16`, `0.5`) | Slider | | ||
| | Plain string | Text input | | ||
| | Enum-like string with comment hint (TBD) | Select dropdown | |
There was a problem hiding this comment.
This row suggests enum detection via a comment hint, but the rules above forbid comments inside the JSON block. Please remove/comment-proof this guidance to prevent invalid JSON output.
Introduce a new prompt section that teaches the model to declare TWEAK_DEFAULTS as a JSON block bracketed by /*EDITMODE-BEGIN*/ and /*EDITMODE-END*/ markers. This enables a host-side Tweaks panel to scan the artifact, render type-appropriate controls, and rewrite values via string replacement — zero LLM token cost per tweak. Included in both create and tweak modes. Host-side panel scan/rewrite implementation lands in v0.2 (rewrite #74). This PR is protocol only.
300b7ee to
eb1a10c
Compare
There was a problem hiding this comment.
Findings
- [Minor]
Type detection表格与 JSON 规则冲突,可能诱导模型输出不可解析的块并导致 hostJSON.parse失败。规则明确禁止注释,但表格又写了 “comment hint (TBD)”。证据:packages/core/src/prompts/editmode-protocol.v1.txt:22,packages/core/src/prompts/editmode-protocol.v1.txt:37,packages/core/src/prompts/index.ts:182,packages/core/src/prompts/index.ts:197
Suggested fix:| Enum-like string (closed set by key/schema) | Select dropdown |
Summary
- Review mode: follow-up after new commits
- 1 issue found in added/modified lines (Minor)。
docs/VISION.md、docs/PRINCIPLES.md: Not found in repo/docs。
Testing
- Not run (automation)
open-codesign Bot
| | `true / false` | Toggle switch | | ||
| | Number (e.g. `1.0`, `16`, `0.5`) | Slider | | ||
| | Plain string | Text input | | ||
| | Enum-like string with comment hint (TBD) | Select dropdown | |
There was a problem hiding this comment.
Enum-like string with comment hint (TBD) conflicts with the rule above (No comments inside). This can push the model to emit invalid JSON in TWEAK_DEFAULTS, breaking host parsing.
Suggested fix:
| Enum-like string (closed set by key/schema) | Select dropdown |Please apply the same row update in packages/core/src/prompts/index.ts to keep drift tests aligned.
|
Addressed Codex [Minor]: removed the |
There was a problem hiding this comment.
Findings
- None.
Summary
- Review mode: follow-up after new commits
- No issues found in added/modified lines.
- Residual risk/testing gap: targeted Vitest execution could not be run in this environment because
pnpmis not available. docs/VISION.mdanddocs/PRINCIPLES.md: Not found in repo/docs.
Testing
- Not run (automation)
open-codesign Bot
让模型在 artifact 顶部声明 TWEAK_DEFAULTS 块(JSON between markers)。Host 实现待 v0.2 — 本 PR 只引入协议。详见 docs/research/30-claude-design-extracted-architecture.md §3。
改动
packages/core/src/prompts/editmode-protocol.v1.txtprompts/index.ts注册editmodeProtocol到PROMPT_SECTIONS+PROMPT_SECTION_FILESpre-flight之后、craft-directives之前插入EDITMODE_PROTOCOL,create / tweak / revise 三个 mode 都包含create和tweak两种 mode 都包含EDITMODE protocol、/*EDITMODE-BEGIN*/、TWEAK_DEFAULTS标识验证
pnpm --filter @open-codesign/core exec vitest run— 111 passed (含新增 2 个用例)pnpm typecheck— 通过范围说明
本 PR 只引入 protocol(让模型按规范输出 EDITMODE 块)。Host 端 panel scan / control rendering / string-rewrite 在 v0.2 重写 #74 中实现。
四绿