Problem
Source : surfaced during /idd-verify --pr 153 R3 cluster verify (per IC_R011 — proper-design follow-up after 3-iteration implementation failure).
/idd-edit 屬 bounded-section-replace (--replace mode) + audit-block-append (--append/--prepend-note) per #150 action-scoped modify discipline (rules/append-vs-modify.md)。 #150 v2.73.0 ship 時宣告 BREAKING runtime enforcement,但實際 bash 落地經過 3 iterations 都失敗:
R1 (commit d643fc6) — 加 Step 1/2/4 enforcement bash
R2 Codex independent revision 捕捉 (post-master):
B3-NEW-1 CRITICAL: --scope value (space form) parser sets SCOPE_FLAG="next" literal
B3-NEW-2 CATASTROPHIC: --body space form → BODY_INPUT="" → silent comment overwrite
B3-NEW-3 LOGIC: section replacement awk end_re ignores SECTION_LEVEL,orphans subsections
B3-NEW-4 DOC: old usage example without --scope
R3 (commit 5c62b38) — parser rewrite + section level + docs
R3 full 6-AI ensemble verify 捕捉 (Logic + DA + Codex triple-confirmed):
C1 CRITICAL INFINITE LOOP: trailing space-form flag → shift 2 silently fails on $#=1 → while [[ $# -gt 0 ]] spins forever
C2 CRITICAL flag-value-eat: --scope --body "x" → SCOPE_FLAG="--body" + BODY_INPUT="" (next-token capture without look-ahead)
C3 CRITICAL multi-line awk-v BREAK: BSD awk rejects newlines in -v value → awk: newline in string → section-replace DEAD-ON-ARRIVAL for realistic markdown content
H1 HIGH --body-file=/missing/path silently produces empty BODY_INPUT → silent comment overwrite
F4 MEDIUM (from R2,still standing) errata flow regression on user-authored comments — /idd-comment --type=errata auto-call /idd-edit --prepend-note triggers verbatim-preserve guard refuse if target非 OWNER
Type
feature — proper runtime enforcement implementation (3-iteration failure → needs standalone proposal)
Expected
/idd-edit runtime enforcement landed with:
Parser pattern :positional shift while [[ $# -gt 0 ]]; case "$1" in ... shift / shift 2 ;; esac with explicit missing-value guards :
--scope) [ -z " ${2:- } " ] && abort " --scope requires value"
[[ " $2 " == --* ]] && abort " --scope value cannot start with --"
SCOPE_FLAG=" $2 " ; shift 2 ;;
(same guards for all 7 space-form flags: --scope / --section / --reason / --body / --body-file / --repo / --cwd)
Multi-line body handling :write BODY_INPUT to temp file → awk reads via getline new_content < body_file per line(不要用 -v 傳多行)
--body-file readability pre-check :[ -r "${1#--body-file=}" ] || abort "body-file not readable: ..."
Errata flow integration :/idd-comment --type=errata auto-call /idd-edit --prepend-note 偵測 non-OWNER target → auto-pass --override-user-content --reason="errata clarification per IDD discipline"(or refuse with helpful "use --override-user-content" message)
Doc consistency :argument-hint / frontmatter / batch-mode / usage examples all show updated syntax
Test fixtures :cover all R1/R2/R3 edge cases(--scope=value / --scope value / --scope last arg / --scope --body next-flag / --body-file missing / multi-line body / single-line body / section with ### subs / section with no closing heading)
Actual
3 bash-incremental attempts(R1/R2/R3)each introduced new bugs。 Implementation needs proper standalone proposal,not incremental patches。
Why this is a follow-up not a R4 fix
R4 bash patch path likely introduces R4 bugs(R1/R2/R3 evidence pattern)
Multi-line awk handling needs rewrite (getline pattern),不是 patch
Errata flow integration touches /idd-comment SKILL.md not just /idd-edit — cross-skill coordination
Acceptance criteria need explicit test fixtures(R1/R2/R3 attempts all missed adversarial patterns via narrow happy-path smoke tests)
Splitting /idd-edit runtime enforcement as its own proposal lets it ship cleanly without blocking #137 + #150 substance(B1 awk fix + B2 BSD head fix + M5 wording + L3 retroactive labels — all solid)。 Spec discipline + AI/user invocation pattern guidance ship today;runtime gate ships post-design。
Sister Concerns
Open Questions
Bash 是否是正確 layer? 3 iterations 都失敗暗示 bash 不是 right tool。 alternative: Rust CLI plugin / Python helper / native flag parsing infrastructure shared across IDD skills
/idd-edit 用 case statement vs argparse-style helper? 7 個 SKILL.md 都需要 flag parsing(idd-comment / idd-issue / etc)— 抽 shared utility?
Multi-line body handling pattern for awk replace:temp-file getline 是 Codex 建議,但需 verify pattern works on macOS BSD awk + gawk + mawk + can handle binary content / unicode
Errata flow integration :/idd-comment 自動 pass --override-user-content 是否違反 IC_R007 spirit(user authored intent vs AI override)? Spec carve-out vs runtime auto-detect?
Routing
Complexity:Plan tier(2 SKILL.md changes + multi-line body design + test fixtures + cross-skill /idd-comment integration)— 不是 Spectra(no new published spec contract,extends existing [META] Codify append-vs-modify discipline as plugin-level principle #150 spec implementation)
Path:depends on user — direct /idd-implement after diagnose,或 /idd-plan 跑 EnterPlanMode design review first
Residue
本 issue 涵蓋「/idd-edit runtime enforcement bash impl」。 不涵蓋:
廣義 IDD skill flag parsing infrastructure 抽 shared helper(屬另一 follow-up,跨 7+ SKILL.md scope)
Rust / Python CLI plugin layer 替代 bash 評估(屬 long-term architecture decision)
/idd-comment errata flow 重設計(本 issue 只整合,不重設計)
Current Status
Phase : implemented
Last updated : 2026-05-25 by /idd-update (via /idd-implement — 14 tasks GREEN + PR #159 open)
Key Decisions
Scope Changes
(none — diagnosis matches issue body's self-suggested scope)
Blocking
(none — ready for /idd-plan EnterPlanMode)
Sister concerns filed
Commits
(none yet — diagnose phase)
Next
Problem
/idd-edit屬bounded-section-replace(--replacemode) +audit-block-append(--append/--prepend-note) per #150 action-scoped modify discipline (rules/append-vs-modify.md)。 #150 v2.73.0 ship 時宣告 BREAKING runtime enforcement,但實際 bash 落地經過 3 iterations 都失敗:R1 (commit
d643fc6) — 加 Step 1/2/4 enforcement bashR2 Codex independent revision 捕捉(post-master):
--scope value(space form) parser sets SCOPE_FLAG="next" literal--bodyspace form → BODY_INPUT="" → silent comment overwriteR3 (commit
5c62b38) — parser rewrite + section level + docsR3 full 6-AI ensemble verify 捕捉(Logic + DA + Codex triple-confirmed):
shift 2silently fails on$#=1→while [[ $# -gt 0 ]]spins forever--scope --body "x"→ SCOPE_FLAG="--body" + BODY_INPUT="" (next-token capture without look-ahead)-vvalue →awk: newline in string→ section-replace DEAD-ON-ARRIVAL for realistic markdown content--body-file=/missing/pathsilently produces empty BODY_INPUT → silent comment overwrite/idd-comment --type=errataauto-call/idd-edit --prepend-notetriggers verbatim-preserve guard refuse if target非 OWNERType
feature — proper runtime enforcement implementation (3-iteration failure → needs standalone proposal)
Expected
/idd-editruntime enforcement landed with:while [[ $# -gt 0 ]]; case "$1" in ... shift / shift 2 ;; esacwith explicit missing-value guards:BODY_INPUTto temp file → awk reads viagetline new_content < body_fileper line(不要用-v傳多行)--body-filereadability pre-check:[ -r "${1#--body-file=}" ] || abort "body-file not readable: ..."/idd-comment --type=errataauto-call/idd-edit --prepend-note偵測 non-OWNER target → auto-pass--override-user-content --reason="errata clarification per IDD discipline"(or refuse with helpful "use --override-user-content" message)--scope=value/--scope value/--scopelast arg /--scope --bodynext-flag /--body-filemissing / multi-line body / single-line body / section with###subs / section with no closing heading)Actual
3 bash-incremental attempts(R1/R2/R3)each introduced new bugs。 Implementation needs proper standalone proposal,not incremental patches。
Why this is a follow-up not a R4 fix
/idd-commentSKILL.md not just/idd-edit— cross-skill coordinationSplitting
/idd-editruntime enforcement as its own proposal lets it ship cleanly without blocking #137 + #150 substance(B1 awk fix + B2 BSD head fix + M5 wording + L3 retroactive labels — all solid)。 Spec discipline + AI/user invocation pattern guidance ship today;runtime gate ships post-design。Sister Concerns
Open Questions
/idd-edit用 case statement vs argparse-style helper? 7 個 SKILL.md 都需要 flag parsing(idd-comment / idd-issue / etc)— 抽 shared utility?/idd-comment自動 pass--override-user-content是否違反 IC_R007 spirit(user authored intent vs AI override)? Spec carve-out vs runtime auto-detect?Routing
/idd-implementafter diagnose,或/idd-plan跑 EnterPlanMode design review firstResidue
Current Status
Phase: implemented
Last updated: 2026-05-25 by /idd-update (via /idd-implement — 14 tasks GREEN + PR #159 open)
Key Decisions
<!-- @trace -->blocks lack auto-update mechanism (tangential from #154 plan) #157 trace blocks, [design] /idd-edit batch mode + R5 refuse interaction — semantic decision needed (tangential from #154 plan) #158 batch+R5). Plan: comment-4532483652--override-user-contentvs refuse-with-message) flagged as real open decision for Plan tier EnterPlanModeScope Changes
Blocking
Sister concerns filed
Commits
Next
/idd-verify --pr 159— 6-AI ensemble verify on PR feat: /idd-edit runtime enforcement (R4 + R5) via extracted helper script (#154) #159