v0.4.1-draft 時点で architecture-rules.html は以下の 2 種類の異質な内容を 1 file に混在して保持している。
この混在は以下の問題を生じる。
constitution.html §3 (Layer Architecture) + §4 (Folio as a Plugin) が architecture-rules §1 + §8 と内容重複。architecture/spec/ 配下に self-application されるべき (dogfooding)。 v0.4.1 段階では未完成のため「仮組み」 として (A) と同居。ユーザーは v0.4.1-draft dig セッション (2026-05-22) で本問題を指摘:
architecture-rules の立ち位置がよくわからない。 folio の architecture spec 的な内容が書かれているが、 それこそ architecture-spec として定義したい構造をとっていない。 ……architecture-rules という名前が分かりづらい。 ようは仮組みの folio の未来 spec 的な性格なのだと思うのだ。
Phase 2 Codebase Exploration (3 並列 explorer agent、 2026-05-22 afternoon) で以下を発見:
.claude-plugin/ 配下 → folio-self-spec.html 一本化が SSoT 遵守。Phase 4 Architecture Design (2 並列 architect agent、 2026-05-22 evening) で以下を refine:
<table> 形式で reader experience 最大化。Phase X2 開始時に以下の作業を実施する MUST。
section 帰属 (v2 確定、 v3 で再掲):
| section / 要素 | 帰属 | 備考 |
|---|---|---|
| §0 Reader Guide (Developer persona) | rules.html §0 | Layer 1 consumer 開発者向けに書き直し |
| §0 Reader Guide (AI Agent persona) | folio-self-spec.html §0 | caller marker 操作手順 + folio plugin の読み方 |
| §1 2-Layer Architecture | folio-self-spec.html §1 | mermaid 図 1 + table 移植 |
| §2.1 folio repo layout | folio-self-spec.html §2 | mermaid 図 2 移植 |
| §2.2 Layer 1 consumer layout + folio.config.yaml | rules.html §2 | — |
| §3 File Naming | rules.html §3 | — |
| §4 HTML Format | rules.html §4 | — |
| §5 Delta Marker | rules.html §5 | — |
| §6 EARS Notation | rules.html §6 | — |
| §7.1〜§7.5 (informative design 部) | folio-self-spec.html §7 | MUST 文は rules §10 への cross-ref に置換 |
| §7.3 Caller Marker MUST | rules.html §10.1 | EARS REQ-CM-001〜003 |
| §7.5 CI Gate MUST (6 gate 定義) | rules.html §10.2 | EARS REQ-CI-001 + REQ-CI-010〜015 |
| §8 Plugin Integration | folio-self-spec.html §8 | — |
| §9 Bindings | folio-self-spec.html §9 | 一本化 (SSoT 遵守) |
rules.html applicability statement (§0 内に inline):
本 rules は Layer 1 consumer project (folio framework を consume する各 project repo) に適用する。 Layer 0 (folio framework 本体) の設計は
folio-self-spec.htmlを参照。
commit 2 の split 前段階として、 commit 1 で architecture-rules.html 冒頭 (<body> 直後、 既存 <aside class="informative"> の前) に provisional aside を追加する。 split 完了 (commit 2) と同時に本 aside は撤去。
constitution §3 縮小文 (実装と整合、 anchor は long-form):
folio は Layer 0 (本 repo) + Layer 1 (consumer projects) の 2 層を採用する (P-12)。 詳細 (2-Layer 体系図 + table + Resolution flow) は folio-self-spec.html §1、 consumer project の directory layout は rules.html §2 を参照。
constitution §4 縮小文 (実装と整合、 anchor は long-form、 MCP 不採用宣言を保持):
folio は Claude Code plugin として配布される (P-12)。 plugin 構造の詳細は folio-self-spec.html §7 + §8。 folio harness は skill + hook + CLI (local process) のみで構成し、 MCP (Model Context Protocol) は採用しない。
constitution §1 Purpose 補強 (冒頭 p の直後、 独立 p):
folio は Layer 0 META FRAMEWORK であり、 各 consumer project は Layer 1 として別 git repo に展開される (P-12)。 Layer 0 は rules (constitution + rules.html) と plugin harness (.claude-plugin/) を一体配布し、 Layer 1 は folio.config.yaml 1 file の宣言で全体を consume する。
constitution §5 / §6 / §7 の番号は維持する (renumber しない)。 mermaid 図 3 + 図 4 を constitution から削除、 folio-self-spec.html へ移植 (詳細は §2.8)。
本 ADR 適用は不変原則 (P-1〜P-12) の semantic を変更しない。 P-2/P-3/P-11/P-12 の plain text file 名列挙を以下に書き換える:
| 原則 | 現文 (抜粋) | 改訂案 |
|---|---|---|
| P-2 | "spec / ADR / constitution / architecture-rules / changes proposal を含む全文書" | "spec / ADR / spec writing documents (constitution / rules / folio-self-spec) / changes proposal を含む全文書" |
| P-3 | "spec / constitution / architecture-rules に platform 固有 HOW を記述しない" | "spec / constitution / rules / folio-self-spec に platform 固有 HOW を記述しない" |
| P-11 | "spec / constitution / architecture-rules に HOW を書かない" | "spec / constitution / rules / folio-self-spec に HOW を書かない" |
| P-12 (rules 言及部) | "rules (constitution + architecture-rules) と plugin harness を一体として配布" | "rules (constitution + rules + folio-self-spec) と plugin harness を一体として配布" |
SemVer 判定: PATCH bump (v0.4.1-draft → v0.4.2-draft、 constitution.html / rules.html / folio-self-spec.html / plugin.json すべて同 version)。 constitution §5 cross-ref 補正規定の延長として解釈。
P-10 (constitution 自身への変更前 user 確認): 本 dig session (2026-05-22) でユーザーが P-2/3/11/12 改訂を承認済。 commit 3 で改訂箇所に <aside class="ai-rationale" data-decision="2026-05-22" data-adr="ADR-0001-v3" hidden> を inline で添付し、 P-10 承認を文書化する。
4 commit に分割。 各 commit の precise file operations:
| file | 行 (approx) | 操作 |
|---|---|---|
| architecture-rules.html | L30 (<body> 直後) | provisional aside (約 14 行) を L37 既存 <aside class="informative"> 直前に挿入 |
| decisions/ADR-0001-architecture-rules-split.html | 新規 (本 file) | git add (decisions/ dir 新設) |
| file | 行 (approx) | 操作 |
|---|---|---|
| rules.html (新規) | 0 → 約 250 行 | §0 (Developer persona) + §2 + §3〜§6 + §10 Mandatory Actions 新設 |
| folio-self-spec.html (新規) | 0 → 約 500 行 | §0 (AI Agent persona) + §1 + §2 + §7 informative (MUST cross-ref 化) + §8 + §9 |
| architecture-rules.html | 全削除 | git rm |
| common.css | 末尾 | .normative-ref CSS class 追加 (font-weight: bold; color: var(--folio-danger)) |
新 file の <meta folio-version> は 0.4.2-draft で開始 (commit 3 で constitution と version 整合)。
| file | 行 (approx) | 操作 |
|---|---|---|
| constitution.html | L7 (meta) | folio-version を 0.4.1-draft → 0.4.2-draft |
| constitution.html | L52 (§0 AI Agent aside) | 2 href (architecture-rules.html / #s7-3-caller-marker) を rules.html + folio-self-spec.html 分割 (#s7-3-caller-marker は folio-self-spec.html へ) |
| constitution.html | L63 (§1 冒頭 p 直後) | Layer 概念 1 文 (独立 p、 §2.3 文面) を挿入 |
| constitution.html | L124 (P-2 dd) | plain text 修正 (§2.4 改訂案) + P-10 inline aside 添付 |
| constitution.html | L127 (P-3 dd) | plain text 修正 |
| constitution.html | L158-L159 (P-11 dt + dd) | plain text 修正 |
| constitution.html | L162 (P-12 dd) | plain text 修正 |
| constitution.html | L164 (P-12 ai-rationale aside) | "architecture-rules §7.4" → "folio-self-spec.html §7.4" |
| constitution.html | L170-L205 (§3 全体) | 本文 + mermaid 図 3 削除、 cross-ref スタブ (§2.3 文面、 href 付き) に縮小 |
| constitution.html | L208-L240 (§4 全体) | 本文 + mermaid 図 4 削除、 cross-ref スタブ (§2.3 文面、 href 付き) に縮小 |
| constitution.html | L259 (§5 内 link) | "architecture-rules.html#s5-delta" → "rules.html#s5" |
| constitution.html | L273 (§6 内 link) | "architecture-rules.html#s7-1-7phase" → "folio-self-spec.html#s7-1-7phase" |
| constitution.html | JSON-LD (L13-L21) | tiers metadata 維持 (P-1〜P-12 数 + tier 不変) |
| file | 行 (approx) | 操作 |
|---|---|---|
| FOLIO.md | L14 (ASCII 図) | "architecture-rules.html" を "rules.html / folio-self-spec.html" に 2 行分割 |
| FOLIO.md | L74 (Entry points) | 同上 |
| FOLIO.md | L83-L87 (AI Agent 手順) | read 順序更新 + §7.4 参照 → folio-self-spec.html §7.4 |
| README.md | L22 (table) | 2 行分割 |
| README.md | L43-L44 (tailnet URL) | 2 URL 分割 |
| README.md | L55 (§7.4 参照) | folio-self-spec.html §7.4 |
| CLAUDE.md | L3 (§9 Bindings 参照) | folio-self-spec.html §9 |
| CLAUDE.md | L18 (必読 list) | rules.html + folio-self-spec.html (2 file) |
| CLAUDE.md | L28 (caller marker) | "§7.3" → "rules.html §10.1 + folio-self-spec.html §7.3" |
| CLAUDE.md | L40 (§7.4 参照) | folio-self-spec.html §7.4 |
| CLAUDE.md | L55 (5 層防御 table) | folio-self-spec.html §7.4 |
| CLAUDE.md | L65 (format ルール) | "architecture-rules" → "rules + folio-self-spec" |
| CLAUDE.md | L70 (plugin 構造) | folio-self-spec.html §8 |
| CLAUDE.md | L99 (§9 Bindings) | folio-self-spec.html §9 |
| .claude-plugin/plugin.json | L3 (version) | "0.4.0-draft" → "0.4.2-draft" |
| .claude-plugin/skills/README.md | L20 | folio-self-spec.html §7 |
| .claude-plugin/agents/README.md | L20 | folio-self-spec.html §7.2 |
| .claude-plugin/scripts/README.md | L19 | "rules.html §10.2 + folio-self-spec.html §7.5" に分割 |
| .claude-plugin/static/README.md | L7 | "rules.html / folio-self-spec.html" |
| decisions/ADR-0001-architecture-rules-split.html | L8 (meta status) | "proposed" → "accepted" |
| decisions/ADR-0001-architecture-rules-split.html | §5 Trace | doobidoo conversation_id 記録 (commit 4 push 後に追記) |
§10 reader guide:
<section id="s10-mandatory" class="normative">
<h2>§10. Mandatory Actions for Layer 1 Consumer</h2>
<p>本 §10 は Layer 1 consumer project が folio rules を consume する際に
<strong>無条件に遵守すべき MUST 要件を一箇所に集約</strong>する。
§2〜§6 の markup / naming rules が「構造上の規則」であるのに対し、
§10 は「動的な操作上の義務」を規定する。
各 MUST の enforcement mechanism (hook flow / script 実装) は
<a href="folio-self-spec.html#s7">folio-self-spec.html §7</a> を参照。</p>
§10.1 Spec Edit Caller Marker:
<section id="s10-1" class="normative">
<h3>§10.1 Spec Edit Caller Marker</h3>
<aside class="informative">
<p>本 §10.1 は IETF RFC 2119 / RFC 8174 / BCP 14 に定義される MUST に従う規範要件。
enforcement の hook flow chart は
<a href="folio-self-spec.html#s7-3-caller-marker">folio-self-spec.html §7.3</a> 参照。</p>
</aside>
<p class="ears" data-ears-pattern="event-driven">
<span class="ears-id">REQ-CM-001</span>:
<span class="ears-when">WHEN AI agent attempts to write to any file under <code>spec_path</code></span>,
the system <span class="ears-shall">SHALL</span> verify that the caller marker
environment variable is set to the declared value.
</p>
<p class="ears" data-ears-pattern="ubiquitous">
<span class="ears-id">REQ-CM-002</span>:
The AI agent <span class="ears-shall">SHALL</span> set the caller marker env var
(declared in <code>folio.config.yaml</code>) before invoking any spec Edit/Write tool call,
and <span class="ears-shall">SHALL</span> unset it immediately upon completion.
</p>
<p class="ears" data-ears-pattern="unwanted">
<span class="ears-id">REQ-CM-003</span>:
IF the caller marker env var is absent or holds an unexpected value,
THEN the PreToolUse hook <span class="ears-shall">SHALL</span> return
<code>permissionDecision: deny</code>.
</p>
<p>env var の具体名・値は <code>folio.config.yaml</code> で declare し、
binding 詳細は <a href="folio-self-spec.html#s9-bindings">folio-self-spec.html §9</a> に集約。</p>
</section>
§10.2 CI Gate Compliance:
<section id="s10-2" class="normative">
<h3>§10.2 CI Gate Compliance</h3>
<aside class="informative">
<p>本 §10.2 は規範要件 (RFC 2119 MUST)。
各 gate の script 実装は
<a href="folio-self-spec.html#s7-5-ci-gate">folio-self-spec.html §7.5</a> 参照。</p>
</aside>
<p class="ears" data-ears-pattern="ubiquitous">
<span class="ears-id">REQ-CI-001</span>:
The Layer 1 consumer CI workflow <span class="ears-shall">SHALL</span>
enforce all six gates defined below before permitting merge.
</p>
<table>
<thead><tr><th>REQ-ID</th><th>gate</th><th>結果</th><th>根拠</th></tr></thead>
<tbody>
<tr><td>REQ-CI-010</td><td>link-integrity gate</td><td>fail = merge block</td><td>P-6</td></tr>
<tr><td>REQ-CI-011</td><td>declarative-form gate</td><td>fail = merge block</td><td>P-4</td></tr>
<tr><td>REQ-CI-012</td><td>what-only gate</td><td>fail = merge block</td><td>P-3 / P-11</td></tr>
<tr><td>REQ-CI-013</td><td>vocabulary gate</td><td>fail = merge block</td><td>P-5</td></tr>
<tr><td>REQ-CI-014</td><td>EARS coverage gate</td><td>warn (merge 許可)</td><td>§6</td></tr>
<tr><td>REQ-CI-015</td><td>delta marker consistency gate</td><td>fail = merge block</td><td>§5</td></tr>
</tbody>
</table>
</section>
main 直接 commit は broken link time window (commit 2 split → commit 4 cross-ref 修正 までの中間状態) が high severity risk のため、 feature branch 戦略を採用する MUST。
git checkout -b split/adr-0001-v3 で feature branch 作成。git push -u origin split/adr-0001-v3 で branch push。gh pr create --draft で draft PR 作成、 user が diff 全体を review。gh pr ready + gh pr merge --merge (normal merge、 4 commit history 保持) で main に取り込み。 squash merge は採用しない (4 commit の独立性を git history に残す)。architecture-rules.html の 8 mermaid 図の帰属:
| 元 図番号 | data-diagram-type | 帰属 | 修正 |
|---|---|---|---|
| 図 1 | layer-detail | folio-self-spec.html §1 | ノード AR["architecture-rules.html"] → R["rules.html"] + 別ノードで folio-self-spec.html 表現 |
| 図 2 | folio-layout | folio-self-spec.html §2 | ノード RULES 内 plain text "architecture-rules.html" → "rules.html + folio-self-spec.html" |
| 図 3 | phase-flow | folio-self-spec.html §7.1 | 変更なし |
| 図 4 | specialist-spawn | folio-self-spec.html §7.2 | 変更なし |
| 図 5 | caller-marker-flow | folio-self-spec.html §7.3 | 変更なし |
| 図 6 | defense-pipeline | folio-self-spec.html §7.4 | 変更なし |
| 図 7 | ci-gate-pipeline | folio-self-spec.html §7.5 | 変更なし |
| 図 8 | plugin-integration | folio-self-spec.html §8 | 変更なし |
constitution 内 mermaid 図の処理:
| constitution 元 図番号 | 処理 |
|---|---|
| 図 1 philosophy-divergence | constitution に保持 (constitution §1 残存) |
| 図 2 principles-tier | constitution に保持 (constitution §2 残存) |
| 図 3 layer-architecture | 削除 (architecture-rules.html 図 1 に統合済のため重複) |
| 図 4 plugin-structure | 削除 (architecture-rules.html 図 8 に統合済のため重複) |
figure caption 番号: folio-self-spec.html 内で図 1 から再採番。 constitution 図 3 + 図 4 は削除済のため移植は不要 (folio-self-spec.html 図 1 (元 architecture-rules 図 1) + 図 8 (元 architecture-rules 図 8) が機能を担う)。
| 案 | 採用しなかった理由 |
|---|---|
| A. self-application を Phase X2 で直接実施 | bootstrap paradox。 Phase X3 以降で再検討。 |
| B. keep + 内部境界明示のみ | 名前と内容の乖離未解消。 |
| C. Phase X2 完了直前に split | plugin 実装中の参照修正大規模化。 |
| D. Phase X1.5 として独立 phase 化 | 「0.5 等の小数点表記不採用」 と非整合。 |
| E. constitution §3 §4 完全削除 | 独立読可能性低下。 |
| F. constitution renumber | 外部 cross-ref 不変性優先。 |
| G. §9 Bindings を rules.html に配置 | SSoT 違反 (binding location が .claude-plugin/ 配下)。 |
| H. §7 全体を folio-self-spec へ (MUST cross-ref のみ) | reader experience 劣化。 |
| I. §7 全体を rules.html へ | folio-self-spec が欠陥、 純粋性違反。 |
| J. MUST を §10 ではなく §4-§6 に inline 分散 | discoverability 低。 |
| K. P-2/3/11/12 plain text 保留 (ADR-0002 で別途) | 一時的不整合発生。 |
| L. P-2/3/11/12 plain text 抽象化のみ | reader が具体 file 名判別不能。 |
| M. main 直接 commit (ADR v2 想定) | broken link time window high severity。 feature branch 採用。 |
| N. squash merge | 4 commit の独立性が git history から失われる。 normal merge 採用。 |
folio-adr-0001-split-v3-2026-05-22。<meta name="folio-version" content="0.4.1-draft"> は ADR が起票された時点 (v0.4.1-draft 段階) を記録する。 本 ADR 適用によって framework version は v0.4.2-draft に bump されたが、 ADR 自身の meta version は起票時 snapshot として 0.4.1-draft を保持する慣習。 framework の現行 version は本 ADR §2.4 SemVer bump section + commit 3/4 で 0.4.2-draft に反映済。