本書は folio Layer 0 framework 自身の architecture spec である。 Layer 1 consumer 向け rules は rules.html、 不変原則は constitution.html を参照する。 spec 編集前に caller marker を set し (§7.3)、 cwd が Layer 0 編集か consumer (Layer 1) 編集かを §7.4 で確認する。
folio は物理 repo を 2 層に分離する: Layer 0 (本 repo) が rules (constitution + rules.html) と plugin harness を一体配布し (P-12)、 Layer 1 consumer は別 git repo で spec と実装の両方を持つ。 consumer は repo root の folio.config.yaml で明示的に folio を consume し、 folio constitution + rules を継承する (convention-based discovery は不採用、 P-3)。
folio は 2 layer の物理 repo 分離を採用する。 folio 自身は Layer 0 (META FRAMEWORK) を提供し、 Layer 1 (各 project の architecture spec + 実装) は別 git repo として展開する。 Layer 0 は rules (constitution + rules.html) と plugin harness (.claude-plugin/) を一体配布する (constitution P-12)。
| Layer | repo 位置 | 役割 | 変更頻度 | 例 |
|---|---|---|---|---|
| Layer 0 (META FRAMEWORK) | folio/ repo (本 repo) |
spec を書くための universal rules + constitution + plugin harness (skills + agents + hooks + scripts) の一体配布。 全 Layer 1 が consume する reference framework。 | 稀 (constitution 改訂時のみ、 MAJOR/MINOR bump) | constitution.html、 rules.html、 folio-self-spec.html (本書)、 .claude-plugin/plugin.json |
| Layer 1 (consumer project) | 各 consumer repo (別 git repo) | folio rules を適用した architecture/ spec と実装本体 (src/、 skills/ 等) を同 repo 内に持つ。 spec と実装の両方を含む。 |
project 開発中に随時 (Phase 7 G で commit) | scribe (special wrapper role)、 my-ts-webapp、 my-python-ml |
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
graph TB
accTitle: 2-Layer 詳細構造 + plugin harness
accDescr: Layer 0 folio は rules と plugin harness を一体提供する。 Layer 1 consumer projects は folio.config.yaml で folio を consume する
subgraph L0["Layer 0 — folio (本 repo)"]
direction TB
subgraph L0R["rules"]
C["constitution.html"]
R["rules.html"]
FSS["folio-self-spec.html (本書)"]
end
subgraph L0H[".claude-plugin/ — harness"]
PJ["plugin.json"]
SKAH["skills + agents + hooks"]
SCBN["scripts + bin"]
end
end
subgraph L1["Layer 1 — consumer project (例)"]
direction TB
L1CONF["folio.config.yaml"]
L1ARCH["architecture/spec/
(Layer 1 spec、 folio rules で書かれた)"]
L1IMPL["実装 dir
(src/、 skills/、 等)"]
end
L0 -->|"install + consume"| L1CONF
L1CONF -.->|"defines"| L1ARCH
L1ARCH -.->|"guides"| L1IMPL
style L0 fill:#2a4d6e,color:#ffffff
style L0R fill:#5ac8b8,color:#08131a
style L0H fill:#5ac8b8,color:#08131a
style L1 fill:#fefbea,color:#08131a
folio.config.yaml で consume する。 Layer 1 同 repo 内に Layer 1 spec (architecture/) と実装本体が共存。Resolution flow: Layer 1 consumer が folio.config.yaml で folio plugin (rules + harness) を consume する。 spec は project repo 内 architecture/spec/ に存在し、 folio constitution + rules を継承する。
Discovery mechanism: explicit (各 project repo root の folio.config.yaml で folio を consume する宣言)。 convention-based discovery は採用しない。 folio repo 自身は下流 consumer を識別しない (constitution P-3)。
folio repo の canonical layout: architecture/ (design-intent 空間 = spec / decisions / research / assets)、 tests/ (HOW-test sibling)、 hooks/ + .claude-plugin/ (plugin harness)、 root marker file。 folio は自身の rules を self-host し、 consumer と一意の構造を取る (X4-C 物理移植、 ADR-0022)。 下の tree と図がディレクトリ構成の SSoT。
folio/
├── FOLIO.md # root marker (Markdown 例外、 P-2)
├── README.md # GitHub 表示用 (Markdown 例外、 P-2)
├── CLAUDE.md # AI-agent instruction (Markdown 例外、 P-2、 P-11 root 例外)
├── common.css # design tokens
├── .gitignore
│
├── architecture/ # folio 自身の design-intent 空間 (self-host、 P-7 3-domain)
│ ├── index.html # landing + walkable nav (folio build が graph から生成、 hero は curated、 ADR-0035/0039)
│ ├── glossary.html # 用語集 (folio build が vocabulary.yaml から生成、 ADR-0036)
│ ├── spec/ # design intent (WHAT)。 全ページ chrome は build が marker 領域で維持 (ADR-0039 §2.3)
│ │ ├── README.html # spec entry point (P-6)
│ │ ├── constitution.html # 14 immutable principles (P-1〜P-14)
│ │ ├── rules.html # Layer 1 consumer 向け universal rules
│ │ ├── folio-self-spec.html # 本書 — folio 自身の self-spec
│ │ ├── relations.html # spec 間関係性 (JSON-LD + inventory)
│ │ └── verification.html # verification contract
│ ├── decisions/ # decision (WHY): ADR-NNNN-<slug>.html
│ ├── research/ # exploration (spec 反映前の探索)
│ └── assets/ # mermaid.min.js (support、 domain でない)
│
├── tests/ # HOW-test sibling (executable、 P-3/P-11、 ADR-0022)
│ ├── scenarios/ # use case 別 YAML
│ ├── fixtures/ baselines/ e2e/ # テストデータ / golden / 統合検証
│ └── runner.sh # 軽量 runner (bash + yq + jq)
│
├── hooks/ # Claude Code 公式仕様: plugin root 直下 MUST
│ └── hooks.json # hook 宣言 (PreToolUse / PostToolUse / SessionStart)
│
└── .claude-plugin/ # plugin harness (P-12 一体配布、 HOW)
├── plugin.json # manifest (name, version, userConfig)
├── skills/ # folio-architect 等 (完成形 §7.2)
├── agents/ # specialist agents (完成形 §7.2)
├── scripts/ # hook script 実装 (CI check)
├── bin/ # CLI: folio version / init / inventory / prime / validate / fix / build
├── refs/ # skill + agent 共有 reference
└── static/ # plugin-bundled static assets
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
graph TD
accTitle: folio Repository Layout (Layer 0, canonical self-host)
accDescr: folio repo は architecture/ (spec/decisions/research/assets の design-intent 空間) と tests/ (HOW-test sibling) と hooks/ + .claude-plugin/ (HOW harness) と root marker file が並ぶ
ROOT["folio/"]
ROOT --> ARCH["architecture/
(design-intent 空間)"]
ROOT --> VER["tests/
(HOW-test sibling)"]
ROOT --> HK["hooks/
(hooks.json)"]
ROOT --> PLUGIN[".claude-plugin/
(plugin harness, HOW)"]
ROOT --> MD["root marker
(FOLIO.md / README.md /
CLAUDE.md / common.css)"]
ARCH --> SPEC["spec/ (WHAT)
constitution / rules /
folio-self-spec /
relations / verification"]
ARCH --> DEC["decisions/ (WHY)
ADR-NNNN-*"]
ARCH --> RES["research/
(exploration)"]
ARCH --> AST["assets/
(mermaid, support)"]
PLUGIN --> BN["bin/
(validate / fix / build /
init / inventory / prime)"]
PLUGIN --> SCM["scripts/ skills/
agents/ refs/ static/"]
style ROOT fill:#2a4d6e,color:#ffffff
style ARCH fill:#5ac8b8,color:#08131a
style VER fill:#fefbea,color:#08131a
style PLUGIN fill:#5ac8b8,color:#08131a
folio 自身の spec は rules §7 の dual-audience pattern を self-apply し、 human↔AI hub として機能する: machine 精密 normative を canonical SSoT、 human essence + 視覚 view を派生 view として 1 DOM に co-author する。 規範の SSoT は rules.html §7 / §8 にあり (P-7 重複禁止)、 本 §3 は folio の self-application 設計を informative に解説する (ADR-0033)。
folio 自身の spec は rules.html §7 の dual-audience pattern を self-apply し、 human↔AI hub として機能する: machine 精密 normative = canonical SSoT を [data-audience="machine"] に、 human essence + graphical = 派生 view (非規範) を [data-audience="human"] に 1 DOM で co-author する。 human は cognition-friendly な要約を読み、 AI は machine normative だけを構造的に読む。 規範 (taxonomy / safety invariant / JS governance) の SSoT は rules.html §7・§8 にあり (P-7 重複禁止)、 本 §3 は folio 自身の self-application 設計を informative に解説する (ADR-0033)。
core 構成は data-audience taxonomy (machine|human) + <details> 視覚 fold + human essence。 machine 部は DOM 常在 (aria-hidden 不使用) で、 畳まれていても AI / accessibility-tree / find-in-page から可読。 folio prime の Tier 1 digest はこの machine SSoT を抽出源とする。
core 構成は data-audience taxonomy (2 値: machine|human) + <details> 視覚 fold + human essence (rules §7.1 / §7.2)。 machine 部は DOM 常在 (aria-hidden 不使用) で、 視覚的に畳まれていても AI / accessibility-tree / find-in-page から可読。 folio prime の Tier 1 digest (machine 向け要約注入) はこの machine SSoT を抽出源とする (§7.6 growth path、 ADR-0007)。 reference 実装 = verification.html §3 の dual-audience card (REQ-VER-001/002/003/007/009)。 全 living spec への core propagation は後続 wave で行う。
1-DOM co-author は機械的導出 (view を生成・維持しない) を持たない novelty ゆえ、 human↔machine の consistency を ADR-0028 二層 enforcement で担保する: deterministic な floor (folio validate の REQ-DA-STRUCT 構造検査) と LLM ceiling (Phase F spec-review-fidelity の意味検査)。 ceiling は装飾でなく構造の要 (load-bearing)。 下表が両層の機構・判定・捕捉・起動の対比。
1-DOM co-author は DITA / literate programming のような機械的導出 (view は生成・維持しない) を持たない novelty ゆえ、 human↔machine の consistency を構造でなく ADR-0028 二層 enforcement で担保する (ADR-0033 §2.4)。 LLM ceiling は装飾でなく構造の要 (load-bearing)。
| floor (deterministic) | ceiling (LLM) | |
|---|---|---|
| 機構 | folio validate dual-audience gate | Phase F spec-review-fidelity agent |
| 判定 | 構造的対応 + 機械可読 key 一致 (REQ-DA-STRUCT-1〜5) | 意味的 fidelity (essence が normative を忠実要約か + pattern semantic) |
| 捕捉 | 孤立 human / id 不一致 / 値域 / aria-hidden / EARS-pattern declared 不一致 | 要約の脱落・誇張・矛盾・pattern 取り違え |
| 起動 | folio validate (CI block)・普遍 | spec 編集時 (folio-architect Phase F) |
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TB
accTitle: dual-audience co-author の二層 enforcement
accDescr: 1 DOM に machine SSoT と human 派生 view を co-author し、 floor (folio validate の REQ-DA-STRUCT 構造検査) と ceiling (spec-review-fidelity agent の意味検査) の 2 層で consistency を担保する
SRC["dual-audience spec
(1 HTML artifact)"]
M["machine normative
(canonical SSoT)"]
H["human essence + graphical
(派生 view)"]
SRC --> M
SRC --> H
FL["floor: folio validate
REQ-DA-STRUCT-1..5
(構造・key 一致)"]
CE["ceiling: spec-review-fidelity
(意味的 fidelity)"]
M -. "検査" .-> FL
H -. "検査" .-> FL
M -. "検査" .-> CE
H -. "検査" .-> CE
FL --> OK["consistency 担保
(導出の代役)"]
CE --> OK
style SRC fill:#2a4d6e,color:#ffffff
style M fill:#5ac8b8,color:#08131a
style H fill:#fefbea,color:#08131a
style OK fill:#5ac8b8,color:#08131a
style FL fill:#e6f6f2,color:#08131a
style CE fill:#fdf3f3,color:#08131a
folio validate 構造検査) + ceiling (spec-review-fidelity 意味検査) が機械的導出の代役として consistency を担保する。folio spec の JS は read-only view enhancement のみ (content SSoT は static HTML) とする (rules.html §8)。 vendored mermaid render は ALLOW、 ES modules + fetch() は file:// 破綻ゆえ PROHIBIT。 現 wave の CSS-only 骨格は本規約と無矛盾。
folio spec の JS は read-only view enhancement のみ (content SSoT は static HTML) とする規約に従う (rules.html §8: ALLOW / PROHIBIT / REQUIRE)。 vendored mermaid render は ALLOW、 ES modules + fetch() は file:// 破綻ゆえ PROHIBIT。 現 wave の CSS-only 骨格は本規約と無矛盾。
folio 自身の architecture は rules.html §9 の object cross-reference system を self-apply する (ADR-0034): defined-object (P-N / REQ-* / ADR-NNNN / §) の canonical 定義は各 object の in-band 要素が SSoT で、 そこから完全性 lint + AI-graph を生成する。 human は xref を hover して定義 essence を即見、 AI は href と objectGraph projection を辿る。 維持は folio fix の auto-materialize、 完全性は folio validate の 4 gate が担う (completeness は opt-in で、 folio の全 living spec が dogfood 済 — 詳細は機械層)。
folio 自身の architecture は rules.html §9 の object cross-reference system を self-apply する (ADR-0034、 §3 dual-audience hub の object 参照網への拡張)。 defined-object (principle P-N / requirement REQ-* / decision ADR-NNNN / rule §) の canonical 定義は各 object の in-band 要素 (その id) が SSoT で、 そこから read-only な projection (完全性 lint + AI-graph) を生成する hybrid (DB-as-SSoT 却下)。 human↔AI hub: human は xref を hover して定義 essence を即見 (no-JS tooltip)、 AI は href と inventory.json の objectGraph projection を構造的に辿る。 維持は folio fix の auto-materialize (裸 token → xref wrap)、 完全性は folio validate の 4 gate (resolve / uniqueness / tooltip-consistency / completeness) が担う (REQ-VER-017/018)。
completeness は opt-in/conditional-normative (REQ-XREF-002) — folio-xref-completeness=enabled を宣言した doc のみ orphan-mention を block する。 folio 自身の全 living spec (verification / rules / relations / folio-self-spec / README) が completeness opt-in を宣言し、 prose 内の裸 canonical token は folio fix で xref へ materialize 済 — folio が xref system を self-host (dogfood) する。 real corpus の folio validate は completeness gate を含め clean。 opt-in 対象は body 改訂可能な living spec に限り、 constitution.html (P-10 不可触) と frozen ADR は定義 site として read-only に essence を供出するのみ (言及側 living spec の prose だけが wrap される)。 dual-audience の core propagation (§3.1) と同じく、 機構と規範を landable な土台として確立した上で living spec への適用を完了した。
本 §7 は folio Layer 0 の plugin harness を構成する 5 component を informative に解説する: 7-phase PR cycle (§7.1)・specialist agents (§7.2)・caller marker (§7.3)・5-Layer Defense (§7.4)・CI Gate (§7.5)。 各 component が連携して folio rules を enforce する。 規範 MUST 要件 (caller marker set/unset・CI gate enforcement) の SSoT は rules.html §10 Mandatory Actions にあり、 本 §7 は設計と enforcement flow を解説する。
本 §7 は folio Layer 0 の plugin harness を構成する 5 component を規定する。 7-phase PR cycle (§7.1) の各 phase で specialist agents (§7.2)、 caller marker (§7.3)、 5-Layer Defense (§7.4)、 CI Gate (§7.5) が連携し、 folio rules を enforce する。
規範要件と informative design の分離: §7 全体は informative design intent を記述する。 規範 MUST 要件 (caller marker set/unset MUST、 CI gate enforcement MUST) は rules.html §10 Mandatory Actions に集約する。 本 §7 では各 component の設計と enforcement flow を informative に解説する。
folio-architect は spec edit の唯一 author で、 7 phase (A Discovery → B Exploration → C Clarifying → D Design → E Implementation → F Quality Review → G Summary) を順次実行する。 Phase C (grilling) と F (review) は MUST NOT SKIP、 B/D は specialist 並列、 F は review agent 並列 (下表・図 4 の「F 7 並列固定」は完成形 vision で、 v1.0 実装は 5 agent — §7.2)。 v1.0 scope は ADR-0029 で確定し、 Phase A/B/C の adoption-aware 化は ADR-0031 による (下表・図・aside で詳説)。
folio-architect は spec edit の唯一 author。 7 phase (A〜G) を順次実行する。
| Phase | name | agent | 並列 | 必須 |
|---|---|---|---|---|
| A | Discovery | (なし、 folio-architect 直接) | — | MUST (todo list + folio.config.yaml load + adoption-state 検出 → greenfield onboarding / maintenance 分岐) |
| B | Spec Exploration | spec-explorer | 2-3 並列 | MUST |
| C | Clarifying / Grilling | (なし、 user dialog) | — | MUST NOT SKIP (gap-driven grilling) |
| D | Spec Design | spec-architect | 2-3 並列 | optional (structural change 時のみ) |
| E | Implementation | (folio-architect 直接) | — | MUST (caller marker + Edit + 機械検証 + unset) |
| F | Quality Review | spec-review-{vocabulary,structure,ssot,temporal,ears,stakeholder,fidelity} | 7 並列固定 | MUST NOT SKIP |
| G | Summary | (folio-architect 直接) | — | MUST (delta marker check + changelog 更新) |
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TB
accTitle: 7-Phase PR Cycle
accDescr: Discovery A から Summary G まで 7 phase を順次実行。 Phase B と D は 2-3 specialist 並列、 Phase F は 7 specialist 並列固定
A["A
Discovery"]
B["B
Exploration
(2-3 並列)"]
C["C
Clarifying
(MUST NOT SKIP)"]
D["D
Design
(2-3 並列、 optional)"]
E["E
Implementation
(caller marker)"]
F["F
Quality Review
(7 並列固定)"]
G["G
Summary
(delta marker)"]
A --> B --> C --> D --> E --> F --> G
style A fill:#2a4d6e,color:#ffffff
style C fill:#fefbea,color:#08131a
style F fill:#fdf3f3,color:#08131a
style G fill:#5ac8b8,color:#08131a
完成形 vision の 9 agent (= Phase B explorer 1 + Phase D architect 1 + Phase F review 7 軸) を下表に列挙する。 v1.0 で実装するのは Phase F の 5 review agent (ears / vocabulary / ssot / temporal / fidelity)。 spec-review-structure は folio validate 被覆ゆえ cut、 explorer / architect / stakeholder は post-1.0 defer (削除でなく将来 opt-in の anchor として table に残す、 ADR-0029)。
| agent | phase | focus |
|---|---|---|
spec-explorer | B (2-3 並列) | 関連 spec の cross-ref / ADR / EXP listing |
spec-architect | D (2-3 並列、 optional) | minimal / clean / pragmatic 3 案設計 (structural change 時) |
spec-review-vocabulary | F 軸 1 | P-5 canonical name 違反、 forbidden synonym detection |
spec-review-structure | F 軸 2 | directory structure、 file naming、 cross-ref、 heading hierarchy |
spec-review-ssot | F 軸 3 | P-7 content domain exclusivity、 ADR / changes / research 境界 |
spec-review-temporal | F 軸 4 | P-4 declarative form、 wave-specific narrative 検出 |
spec-review-ears | F 軸 5 | EARS 5 pattern 網羅、 REQ-ID uniqueness、 traceability |
spec-review-stakeholder | F 軸 6 | ISO 42010 Stakeholder Perspectives coverage、 AI Agent first-class |
spec-review-fidelity | F 軸 7 | dual-audience human essence ↔ machine normative 意味的 fidelity + EARS pattern semantic (ADR-0033 ceiling) |
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart LR
accTitle: Specialist Agents 並列 spawn (Phase B / D / F)
accDescr: Phase B では spec-explorer を 2-3 並列、 Phase D では spec-architect を 2-3 並列 (optional)、 Phase F では spec-review 7 個を並列固定で spawn する
subgraph PB["Phase B — 2-3 並列"]
SE1["spec-explorer #1"]
SE2["spec-explorer #2"]
SE3["spec-explorer #3"]
end
subgraph PD["Phase D — 2-3 並列 (optional)"]
SA1["spec-architect #1
(minimal)"]
SA2["spec-architect #2
(clean)"]
SA3["spec-architect #3
(pragmatic)"]
end
subgraph PF["Phase F — 7 並列固定"]
R1["review-vocabulary"]
R2["review-structure"]
R3["review-ssot"]
R4["review-temporal"]
R5["review-ears"]
R6["review-stakeholder"]
R7["review-fidelity"]
end
style PB fill:#e6f6f2,color:#08131a
style PD fill:#fefbea,color:#08131a
style PF fill:#fdf3f3,color:#08131a
caller marker は AI agent が現在 spec edit 中であることを宣言する env var で、 .claude-plugin/hooks/ の PreToolUse hook が値を check し、 未 set / 異値なら spec_path 配下 file の編集を block する。 set / unset の MUST 要件は rules.html §10.1 (REQ-CM-001〜003)、 本 §7.3 は enforcement flow (下図) を informative に解説する。
spec edit を行う AI agent が caller marker を set / unset すべき MUST 要件は rules.html §10.1 (REQ-CM-001〜003) に規定する。 本 §7.3 は PreToolUse hook による enforcement flow chart (下図) を informative に解説する。
caller marker は AI agent が現在 spec edit 中であることを宣言する。 .claude-plugin/hooks/ の PreToolUse hook が env var を check し、 未 set または異なる値の場合は spec 配下 file の編集を block する。
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TD
accTitle: PreToolUse Hook による caller marker enforcement flow
accDescr: Edit/Write ツール呼び出し時、 PreToolUse hook が caller marker env var 存在と spec_path 配下 file かを check し、 caller marker 未 set の場合 deny する
TE["ToolUse attempt
(Edit / Write / NotebookEdit)"]
TE --> HK["PreToolUse hook
(.claude-plugin/hooks/)"]
HK --> SP{"target file
spec_path 配下?"}
SP -- "No" --> AL["allow
(spec 外 edit OK)"]
SP -- "Yes" --> CC{"caller marker
env var set?"}
CC -- "No / 異値" --> DN["deny
(permissionDecision: deny)"]
CC -- "Yes" --> AL2["allow
(spec edit OK)"]
style DN fill:#fdf3f3,color:#08131a
style AL fill:#e6f6f2,color:#08131a
style AL2 fill:#e6f6f2,color:#08131a
AI agent が混同し得る 3 つの context boundary — (a) folio vs 旧 twill、 (b) folio (Layer 0) vs consumer (Layer 1)、 (c) Layer 1 の spec edit vs 実装 edit — を、 5 層の防御 (物理 git repo 分離 / root marker / HTML meta 宣言 / caller marker env var / directory naming) が pipeline で構造的に防ぐ。 5 層全てを通過した時のみ正しい layer の spec を編集できる (下表・図で詳説)。
AI agent は以下の 3 つの context boundary を混同し得る。 本 §7.4 はこれを構造的に防ぐ 5 層の boundary mechanism を informative に解説する:
architecture/spec/) vs Layer 1 実装 edit (src/、 skills/ 等)| 層 | 機構 | folio (Layer 0) | consumer (Layer 1) | 旧 twill (reference) |
|---|---|---|---|---|
| L1 物理分離 | 独立 git repo | folio repo (standard、 bare 不採用) | 各 consumer repo (standard) | twill repo (bare、 freeze) |
| L2 root marker | Markdown 例外 file | FOLIO.md "META FRAMEWORK" |
SCRIBE.md 等 "folio consumer" |
(なし、 CLAUDE.md のみ) |
| L3 meta 宣言 | HTML <meta> tag |
folio-layer="core" |
folio-layer="project" + folio-project |
(なし) |
| L4 caller marker | env var | folio caller marker (具体値は §9 + .claude-plugin/plugin.json userConfig) |
同 env var (Layer 1 spec 編集時、 folio.config.yaml で override 可能) |
異名 (twill 固有、 folio scope 外、 旧 twill repo を参照) |
| L5 directory naming | folio 固有 dir | .claude-plugin/ |
architecture/spec/、 howto/ 等 |
twill 固有命名 (混在) |
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TB
accTitle: 3 axis × 5 層防御 pipeline
accDescr: 3 軸の混同リスク (folio vs twill、 folio vs consumer、 spec edit vs impl edit) に対し 5 層の防御 (物理分離、 root marker、 meta 宣言、 caller marker、 directory naming) が pipeline で適用される
subgraph AX["3 axis 混同リスク"]
A1["(a) folio vs twill"]
A2["(b) folio vs consumer"]
A3["(c) spec edit vs impl edit"]
end
subgraph DEF["5 層防御 pipeline"]
direction TB
L1["L1
物理 git repo
分離"]
L2["L2
root marker
file"]
L3["L3
HTML meta
宣言"]
L4["L4
caller marker
env var"]
L5["L5
directory
naming"]
L1 --> L2 --> L3 --> L4 --> L5
end
AX --> DEF
style AX fill:#fefbea,color:#08131a
style DEF fill:#e6f6f2,color:#08131a
CI workflow が強制する 7 gate (link-integrity / declarative-form / what-only / vocabulary / EARS coverage / delta-marker / json-ld-validation) の MUST 要件は rules.html §10.2 にある。 ADR-0028 二層 enforcement で、 機械化可能部は deterministic floor (folio validate)、 意味的残余は LLM ceiling (Phase F agent) に分担する。 EARS coverage のみ warn 扱い (下図・aside で詳説)。
CI workflow が強制すべき 7 gate の MUST 要件は rules.html §10.2 (REQ-CI-001 + REQ-CI-010〜016) に規定する。 本 §7.5 は各 gate の script 実装参照 (.claude-plugin/scripts/) を informative に解説する。 具体的 script 実装は §9 Bindings に集約。
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TB
accTitle: CI Gate Pipeline
accDescr: PR / commit から merge までの 7 gate (link integrity、 declarative form、 what-only、 vocabulary、 EARS coverage、 delta marker consistency、 json-ld-validation) を順次通過した場合のみ merge 許可
PR["PR / push"]
PR --> G1["link-integrity
(P-6)"]
G1 --> G2["declarative-form
(P-4)"]
G2 --> G3["what-only
(P-3 / P-11)"]
G3 --> G4["vocabulary
(P-5)"]
G4 --> G5["EARS coverage
(§6)"]
G5 --> G6["delta marker
consistency
(§5)"]
G6 --> G7["json-ld-validation
(relations §3)"]
G7 --> OK["merge allowed"]
G1 -. "fail" .-> BL["merge blocked"]
G2 -. "fail" .-> BL
G3 -. "fail" .-> BL
G4 -. "fail" .-> BL
G5 -. "warn" .-> OK
G6 -. "fail" .-> BL
G7 -. "fail" .-> BL
style OK fill:#5ac8b8,color:#08131a
style BL fill:#fdf3f3,color:#08131a
試作段階 (Phase X3) の plugin minimal scope = 1 skill + 4 hook + 6 script + 1 CLI (WHAT enumeration の SSoT は ADR-0003 §2)。 段階的成長 path: 1 skill (X3) → 3 review agent (X4) → 5 review agent v1.0 (X5-γ + ADR-0033) → 9 agents 完成形 vision (post-1.0)。 §7.2 完成形は未来 anchor として保持し、 実機検証は verification.html sandbox で行う。
Phase X3 minimal viable plugin scope = 1 skill + 4 hook + 6 script + 1 CLI。 各 component の詳細 enumeration および役割 (WHAT) は ADR-0003 §2 Decision を SSoT として参照する MUST (本 §7.6 は ADR-0003 への entry point + 段階的成長 path 規定のみを担う、 detailed table の重複定義は禁止)。
段階的成長 path: 1 skill (Phase X3) → 7-Phase SKILL + 3 review agent (Phase X4) → 5 review agent v1.0 (Phase X5-γ + ADR-0033) → 9 agents 完成形 vision (post-1.0) (X4-D で 3 review agent ears/vocabulary/ssot、 ADR-0027; X5-γ で temporal 追加・spec-review-structure は folio validate 被覆ゆえ cut・spec-explorer/spec-architect/spec-review-stakeholder は post-1.0 defer、 ADR-0029; dual-audience spec-review-fidelity ceiling 追加、 ADR-0033)。 試作で発見した修正点 / 必要追加機能を spec に逐次反映する。 具体的 binding (script 内容 / CLI 構文) は §9 Bindings に隔離。
本 minimal plugin の実機検証は verification.html (sandbox verification framework) で実施する。 verification scope の段階的対比 (完成形 §7.2 vs 試作段階 §7.6) は verification.html §4.2 に集約 (SSoT)。
folio は Claude Code plugin として配布される (P-12)。 公式 plugin spec に準拠した manifest (plugin.json) + component layout を採用し、 consumer は folio.config.yaml で userConfig default (spec_path / caller_marker 等) を override できる。 配布は Git marketplace + semver pinning。 §8.1〜§8.3 で schema・override 機構・distribution を解説する。
folio は Claude Code plugin として配布される (constitution P-12)。 公式 plugin spec (docs.claude.com/en/plugins) に準拠した manifest + component layout を採用する。
下の plugin.json が manifest schema: name / version / description / homepage + userConfig (spec_path・caller_marker_env・caller_marker_value・review_model) を宣言する。 実 plugin.json は spec_path default を canonical architecture/spec/ とし、 各 userConfig に title field を持つ (claude plugin validate 要件)。
{
"name": "folio",
"version": "0.5.0-draft",
"description": "folio Layer 0 META FRAMEWORK — universal architecture spec-writing rules + Claude Code plugin harness.",
"homepage": "https://github.com/shuu5/folio",
"userConfig": {
"spec_path": {
"type": "string",
"default": "architecture/spec/",
"description": "Relative path (from consumer project root) where folio-managed spec HTML files live."
},
"caller_marker_env": {
"type": "string",
"default": "FOLIO_ARCHITECT_CONTEXT",
"description": "Environment variable name that AI agent must set before editing files under spec_path."
},
"caller_marker_value": {
"type": "string",
"default": "folio-architect",
"description": "Expected value of the caller marker env var."
},
"review_model": {
"type": "string",
"default": "opus",
"description": "LLM model for Phase F specialist review agents."
}
}
}
注: 実 plugin.json は spec_path default を canonical architecture/spec/ とする (folio 自身の self-host、 X4-C で scratch/specs/ 暫定 override から物理移植済、 ADR-0023)。 また実 plugin.json は各 userConfig に title field を持つ (claude plugin validate 要件)。
各 Layer 1 consumer project は folio.config.yaml で plugin.json userConfig の default を override できる (下の例: spec_path / caller_marker_env / caller_marker_value の上書き)。
各 Layer 1 consumer project は folio.config.yaml で plugin.json userConfig の default を override 可能。 例:
folio_version: "^0.4"
spec_path: ".folio/spec/" # default architecture/spec/ を上書き
caller_marker_env: "MY_PROJECT_CTX" # default FOLIO_ARCHITECT_CONTEXT を上書き
caller_marker_value: "spec-editor"
配布は Git marketplace + semver pinning (shuu5/folio#v0.5.0)。 1.0.0 未満は development phase として MAJOR/MINOR/PATCH boundary を緩和する (constitution §5)。 npm / pip 配布は scope 外 (Claude Code plugin protocol 中心)。
shuu5/folio#v0.5.0
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2a4d6e', 'primaryTextColor': '#ffffff'}}}%%
flowchart TB
accTitle: Plugin Integration Flow
accDescr: consumer project が folio.config.yaml で folio plugin を consume すると、 Claude Code が plugin.json から skills + agents + hooks を load し、 PreToolUse hook で caller marker enforce が起動する
CP["consumer project
folio.config.yaml
(folio_version: ^0.4)"]
CC["Claude Code"]
PJ["folio plugin
plugin.json"]
SK["skills/
load"]
AG["agents/
load"]
HK["hooks/
register"]
CP --> CC
CC --> PJ
PJ --> SK
PJ --> AG
PJ --> HK
HK -.-> PRE["PreToolUse hook
(caller marker enforce、 §7.3)"]
HK -.-> POST["PostToolUse hook
(spec validate、 §7.5)"]
style CP fill:#fefbea,color:#08131a
style PJ fill:#2a4d6e,color:#ffffff
style PRE fill:#5ac8b8,color:#08131a
style POST fill:#5ac8b8,color:#08131a
folio.config.yaml 宣言から Claude Code が plugin component を load、 hooks が PreToolUse / PostToolUse 時に caller marker enforce + spec validate を実行する。constitution P-3 / P-11 (WHAT-only + HOW 禁止) を守るため、 platform 固有の HOW (env var の具体値・hook script 名・binary path・OS-specific command) は本文でなく binding location (.claude-plugin/plugin.json userConfig / .claude-plugin/scripts/ / CLAUDE.md) に分離する (下表が SSoT)。 他 AI platform への移植時は本 §9 の table を拡張し、 §1〜§8 本文は platform 中立を保つ。
constitution P-3 / P-11 (WHAT-only + HOW 禁止) を遵守するため、 platform 固有の HOW (env var の具体値、 hook script 名、 specific binary path、 OS-specific command 等) は本書 §1〜§8 の本文ではなく、 以下の binding location に分離する:
| HOW 領域 | binding location | 備考 |
|---|---|---|
| Claude Code plugin manifest (env var default / spec_path default) | .claude-plugin/plugin.json userConfig |
plugin install 時に各 consumer の folio.config.yaml で override 可能 |
caller marker env var の具体値 (default は .claude-plugin/plugin.json userConfig.caller_marker_env + .caller_marker_value を参照) |
.claude-plugin/plugin.json userConfig + CLAUDE.md |
本書 §7.3 では WHAT のみ規定、 具体値は plugin.json default に隔離 (P-11) |
| hook script の実装 (例: caller marker enforcement、 spec validate 等) | .claude-plugin/scripts/ |
本書 §7.3 で flow chart は規定、 script content は .claude-plugin/scripts/ 配下 |
CI check script (link-integrity.py 等) |
.claude-plugin/scripts/ |
本書 §7.5 で gate WHAT のみ規定 |
| Claude Code 固有 primitives (Skill / Hook / Agent 命名規約) | CLAUDE.md (folio repo root) + 各 consumer project の CLAUDE.md |
P-2 の Markdown 例外として CLAUDE.md は HOW root 許容 (P-11 例外として明示) |
将来、 他 AI platform (Cursor / Continue / Aider 等) に folio framework を移植する場合、 本 §9 の table を拡張して platform-specific binding を追加する (例: core/bindings/cursor/)。 §1〜§8 の本文は platform 中立を維持する。