Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions core/dispatch_table.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ use "plugins/loop/plugin"
use "plugins/inbox/plugin"
use "plugins/todo/plugin"
use "plugins/go/plugin"
use "plugins/principle-verification-via-hexa-cli-only/plugin"
use "plugins/principle-atlas-knowledge/plugin"
use "plugins/principle-atlas-strict-lint/plugin"
use "plugins/principle-hexa-cli-surface/plugin"
use "plugins/principle-ai-native/plugin"
use "plugins/principle-pool-resource-routing/plugin"
use "plugins/principle-hexa-first/plugin"
use "plugins/principle-andrej-karpathy-skills/plugin"
use "plugins/principle-lattice-as-tool/plugin"
use "plugins/principle-step-by-step-decision-gate/plugin"
use "plugins/principle-closure-depth-accumulation/plugin"
// --with memory,compaction-local,compaction-llm would add:
// use "plugins/memory/plugin"
// use "plugins/compaction-local/plugin"
Expand Down Expand Up @@ -118,13 +129,24 @@ pub fn dispatch_static(target_id: string, op: string, payload: any) -> any {
// if target_id == "memory" { return _wrap(memory_dispatch(op, payload)) }
// if target_id == "compaction-local" { return _wrap(compaction_local_dispatch(op, payload)) }
// if target_id == "compaction-llm" { return _wrap(compaction_llm_dispatch(op, payload)) }
if target_id == "principle-verification-via-hexa-cli-only" { return _wrap(principle_verification_via_hexa_cli_only_dispatch(op, payload)) }
if target_id == "principle-atlas-knowledge" { return _wrap(principle_atlas_knowledge_dispatch(op, payload)) }
if target_id == "principle-atlas-strict-lint" { return _wrap(principle_atlas_strict_lint_dispatch(op, payload)) }
if target_id == "principle-hexa-cli-surface" { return _wrap(principle_hexa_cli_surface_dispatch(op, payload)) }
if target_id == "principle-ai-native" { return _wrap(principle_ai_native_dispatch(op, payload)) }
if target_id == "principle-pool-resource-routing" { return _wrap(principle_pool_resource_routing_dispatch(op, payload)) }
if target_id == "principle-hexa-first" { return _wrap(principle_hexa_first_dispatch(op, payload)) }
if target_id == "principle-andrej-karpathy-skills" { return _wrap(principle_andrej_karpathy_skills_dispatch(op, payload)) }
if target_id == "principle-lattice-as-tool" { return _wrap(principle_lattice_as_tool_dispatch(op, payload)) }
if target_id == "principle-step-by-step-decision-gate" { return _wrap(principle_step_by_step_decision_gate_dispatch(op, payload)) }
if target_id == "principle-closure-depth-accumulation" { return _wrap(principle_closure_depth_accumulation_dispatch(op, payload)) }
return #{ "ok": false, "error": "not statically linked: " + target_id }
}

// list of ids in this build's table — `wilson --version`, `wilson plugin list`,
// and loader's name-collision / "is X bundled?" checks use it. regenerated too.
pub fn dispatch_static_ids() -> [string] {
return ["hello", "harness-cli", "harness-print", "harness-rpc", "tool-core", "provider-claude-cli", "provider-anthropic", "provider-openai-compat", "endpoint-registry", "agents-md", "sysprompt", "prefs", "governance", "git-guard", "guard-domain-lint", "guard-dangerous-path", "guard-ssot", "project-rules", "user-rules", "guard-hexa-verify", "guard-readme-format", "guard-tape-append-only", "bridge-hexa", "bridge-git", "bridge-gh", "tool-web", "tool-task", "tool-image", "recap", "swarm", "pool", "cost", "permissions", "hooks", "notebook", "mcp", "slash-core", "loop", "inbox", "todo", "go"]
return ["hello", "harness-cli", "harness-print", "harness-rpc", "tool-core", "provider-claude-cli", "provider-anthropic", "provider-openai-compat", "endpoint-registry", "agents-md", "sysprompt", "prefs", "governance", "git-guard", "guard-domain-lint", "guard-dangerous-path", "guard-ssot", "project-rules", "user-rules", "guard-hexa-verify", "guard-readme-format", "guard-tape-append-only", "bridge-hexa", "bridge-git", "bridge-gh", "tool-web", "tool-task", "tool-image", "recap", "swarm", "pool", "cost", "permissions", "hooks", "notebook", "mcp", "slash-core", "loop", "inbox", "todo", "go", "principle-verification-via-hexa-cli-only", "principle-atlas-knowledge", "principle-atlas-strict-lint", "principle-hexa-cli-surface", "principle-ai-native", "principle-pool-resource-routing", "principle-hexa-first", "principle-andrej-karpathy-skills", "principle-lattice-as-tool", "principle-step-by-step-decision-gate", "principle-closure-depth-accumulation"]
}

// manifests of the statically-linked plugins, in dispatch_static_ids() order.
Expand Down Expand Up @@ -174,7 +196,18 @@ pub fn bundled_manifests() -> [PluginManifest] {
loop_manifest(),
inbox_manifest(),
todo_manifest(),
go_manifest() ]
go_manifest(),
principle_verification_via_hexa_cli_only_manifest(),
principle_atlas_knowledge_manifest(),
principle_atlas_strict_lint_manifest(),
principle_hexa_cli_surface_manifest(),
principle_ai_native_manifest(),
principle_pool_resource_routing_manifest(),
principle_hexa_first_manifest(),
principle_andrej_karpathy_skills_manifest(),
principle_lattice_as_tool_manifest(),
principle_step_by_step_decision_gate_manifest(),
principle_closure_depth_accumulation_manifest() ]
// --with arms emitted here by `wilson build`:
// memory_manifest(),
// compaction_local_manifest(), compaction_llm_manifest(), ...
Expand Down
22 changes: 22 additions & 0 deletions core/loader.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ pub fn plugin_family(id: string) -> string {
if id == "compaction-llm" { return "policy" }
if id == "compaction-trigger" { return "policy" }
if id == "compaction-prefilter" { return "policy" }
if id == "principle-verification-via-hexa-cli-only" { return "policy" }
if id == "principle-atlas-knowledge" { return "policy" }
if id == "principle-atlas-strict-lint" { return "policy" }
if id == "principle-hexa-cli-surface" { return "policy" }
if id == "principle-ai-native" { return "policy" }
if id == "principle-pool-resource-routing" { return "policy" }
if id == "principle-hexa-first" { return "policy" }
if id == "principle-andrej-karpathy-skills" { return "policy" }
if id == "principle-lattice-as-tool" { return "policy" }
if id == "principle-step-by-step-decision-gate" { return "policy" }
if id == "principle-closure-depth-accumulation" { return "policy" }
if id == "governance" { return "policy" }
if id == "resource-management" { return "policy" }
if id == "statusline" { return "policy" }
Expand Down Expand Up @@ -295,6 +306,17 @@ pub fn plugin_category(id: string) -> string {
if id == "compaction-llm" { return "state" }
if id == "compaction-trigger" { return "state" }
if id == "compaction-prefilter" { return "state" }
if id == "principle-verification-via-hexa-cli-only" { return "directive" }
if id == "principle-atlas-knowledge" { return "directive" }
if id == "principle-atlas-strict-lint" { return "directive" }
if id == "principle-hexa-cli-surface" { return "directive" }
if id == "principle-ai-native" { return "directive" }
if id == "principle-pool-resource-routing" { return "directive" }
if id == "principle-hexa-first" { return "directive" }
if id == "principle-andrej-karpathy-skills" { return "directive" }
if id == "principle-lattice-as-tool" { return "directive" }
if id == "principle-step-by-step-decision-gate" { return "directive" }
if id == "principle-closure-depth-accumulation" { return "directive" }
if id == "governance" { return "guardrail" }
if id == "resource-management" { return "guardrail" }
if id == "statusline" { return "telemetry" }
Expand Down
49 changes: 49 additions & 0 deletions docs/sessions/2026-05-17-governance-principle-as-plugin-fanout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 2026-05-17 — governance principle-as-plugin: full fan-out (완전한 분리)

## 목표
`GOVERNANCE_PRINCIPLES` 16-entry 하드코딩 배열을 **전부** 플러그인으로.
governance = 순수 aggregator + profile resolver. (goal: 완전한 분리까지)

## 결과 — 배열 0, 16개 전부 plugin-owned
- **guard-merge (5)**: 그 원칙을 enforce하는 guard가 문구도 제공(단일 SSOT) —
`readme-format`→guard-readme-format(슬라이스) · `hexa-verifier-cli`→guard-hexa-verify ·
`domain-meta-domain`→guard-domain-lint · `tape-runtime-trace`→guard-tape-append-only ·
`project-governance`→project-rules. 각 guard: `governance_principles@transform`
구독 + fold 분기 + `<sym>_principle_text()` (텍스트 verbatim 이전).
- **신규 `principle-<id>` 플러그인 (11)**: 무집행 텍스트 원칙 —
verification-via-hexa-cli-only · atlas-knowledge · atlas-strict-lint ·
hexa-cli-surface · ai-native · pool-resource-routing · hexa-first ·
andrej-karpathy-skills · lattice-as-tool · step-by-step-decision-gate(off) ·
closure-depth-accumulation(off). 생성기로 일괄(verbatim 텍스트 전사오류 0).
- `GOVERNANCE_PRINCIPLES = []`. governance_collect_principles 가
`host_fire_hook("governance_principles")` fold로 16개 수집 → order 정렬 →
프로파일 필터. 프로파일/`WILSON_GOVERNANCE_OFF`/default_on 해석은 governance 유지.

## 등록 (default-bundle, 코어 수동)
- `core/dispatch_table.hexa`: 11 `use` + 11 dispatch arm + `dispatch_static_ids()`
11 ids + `bundled_manifests()` 11 `_manifest()` (생성기 1차 누락분 — arm이
헤더 주석에 잘못 삽입돼 revert 후 정확 anchor로 재패치; ids/manifests도 추가)
- `plugins/_bundle/plugin.hexa`: 11 members
- `core/loader.hexa`: 11 family("policy") + 11 category("directive")

## 문서 일관성 (완전 분리 = stale 주장 제거)
- governance/main.hexa 헤더 + AGENTS.tape g1(`deny:write` enforcement 룰 —
사라진 배열을 SSOT라 강제, 미래 편집 오도) · ssot · l1 · x_principle_plugins ·
id001 정정 · SPEC.md 상단 노트 → "principle = 각 plugin SSOT, governance =
aggregator". SPEC.md §Principles 16섹션 per-plugin 재작성은 doc-debt로 flag
(배너 명시), 전면재작성은 별도.

## 검증
- `wilson build` (default) OK · `wilson test` 23/23
- `plugin info principle-ai-native` 등록 확인 (manifest enrollment 후)
- 기여 단위검증: guard-merge 4(가변 구조, 실위험) + 생성물 3 → `<sym>_on(
governance_principles/transform)` 전부 정확한 `#{id,order,default_on,text}` 반환
- governance 셀프테스트 정직 재작성(아키텍처 반영: fake-host=void bus→fold 불가
→collect 빈 set이 설계대로; profile resolution step 1-5 = fold-독립, 검증;
default_on/active-subset/block은 real-bus 필요 → wilson test+기여체크 커버) → ok
- 정합성 by construction: agent_loop과 동일 fire_hook · event_bus `_is_replace`
계약 · readme-format 슬라이스에서 end-to-end fold 입증.

## 남은 doc-debt (flag, 비차단)
SPEC.md §Principles 16개 per-entry 산문을 각 plugin 가리키게 재작성;
AGENTS.tape id002 "13 entries" descriptive(비-enforcement) stale.
46 changes: 46 additions & 0 deletions docs/sessions/2026-05-17-governance-principle-as-plugin-slice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 2026-05-17 — governance principle-as-plugin: vertical slice

## 목표
`GOVERNANCE_PRINCIPLES` 하드코딩 배열(16) 항목을 각각 플러그인으로.
granularity = **option 2**: 이미 그 원칙을 enforce하는 guard-* 플러그인이
원칙 **문구도 제공**(단일 SSOT, 플러그인 자체 g1 one-ssot-per-fact 정합);
무집행 원칙만 신규 `principle-<id>`. governance = aggregator + profile resolver.

## 메커니즘
- governance `session_start@transform` → `governance_collect_principles()`:
`host_fire_hook(host,"governance_principles",#{list:[]})` (phase 1.5에서 추가한
generic 래퍼) 발사 → 기여 플러그인들이 `#{id,order,default_on,text}` append
(event_bus transform fold) → governance가 배열 잔여분과 id-dedup 머지 →
order 정렬(레거시 배열 항목은 1-based index가 implicit order) → 프로파일 필터.
- 프로파일/`WILSON_GOVERNANCE_OFF`/default_on resolution은 governance가 계속 소유.
- fake-host(void bus) 가드: bus void면 hook 생략 → 배열만(셀프테스트 안전).

## 이번 슬라이스 (수직, 1개 마이그레이션)
- `plugins/governance/main.hexa`: collect/order_sort/has_id/is_on_rec 추가,
active_principles·active_principle_ids·principles()·default_on을 collect 기반
으로 재작성, 배열에서 `readme-format` 제거.
- `plugins/guard-readme-format/main.hexa`: `governance_principles@transform`
구독(activate) + `grf_on`에 fold 분기 + `grf_principle_text()` (배열에서
verbatim 이전). 이 guard가 readme-format의 enforce+문구 단일 SSOT.

## 검증
- `wilson build` (default) OK
- `wilson test` 23/23 · governance 셀프테스트 ok (배열 경로·프로파일 해석 불변;
셀프테스트는 readme-format is_on 미검사 → fake-host bus-void 경로 안전)
- 신규 기여 경로 단위검증: `grf_on(governance_principles/transform)` →
`{action:replace,value:{list:[readme-format rec]}}`, id/order=16/default_on/
text 정확; 비대상 이벤트는 미기여
- 정합성 by construction: agent_loop과 동일 fire_hook · event_bus `_is_replace`
(`action=="replace"`) 계약 · compaction-prefilter에서 입증된 transform 패턴.
세션 렌더 end-to-end는 interactive+LLM 필요 → `wilson test` 범위 밖(기존 한계).

## 남은 팬아웃 (15개)
guard 보유 → 그 guard가 문구 제공 (4): `domain-meta-domain`→guard-domain-lint ·
`tape-runtime-trace`→guard-tape-append-only · `hexa-verifier-cli`(또는
verification-via-hexa-cli-only)→guard-hexa-verify · (project-governance→
project-rules 검토). 무집행 → 신규 `principle-<id>` (~11): verification-via-
hexa-cli-only · atlas-knowledge · atlas-strict-lint · hexa-cli-surface ·
ai-native · pool-resource-routing · hexa-first · andrej-karpathy-skills ·
lattice-as-tool · step-by-step-decision-gate(off) · closure-depth-accumulation(off).
패턴 동일(이번 슬라이스 = 레퍼런스). 배열 비면 GOVERNANCE_PRINCIPLES 삭제 +
SPEC.md/AGENTS.tape g1 갱신.
11 changes: 11 additions & 0 deletions plugins/_bundle/plugin.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,16 @@ let _bundle = #{
"opt_in_examples": [
"memory", "compaction-local", "compaction-llm",
"resource-management", "statusline", "swarm", "telegram"
"principle-verification-via-hexa-cli-only",
"principle-atlas-knowledge",
"principle-atlas-strict-lint",
"principle-hexa-cli-surface",
"principle-ai-native",
"principle-pool-resource-routing",
"principle-hexa-first",
"principle-andrej-karpathy-skills",
"principle-lattice-as-tool",
"principle-step-by-step-decision-gate",
"principle-closure-depth-accumulation",
]
}
14 changes: 7 additions & 7 deletions plugins/governance/AGENTS.tape
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
# ─── §1 Identity ─────────────────────────────────────────────────────

@I id001 := "wilson.governance-plugin" :: identity-claim [d=2026-05-14 active]
kind = "wilson plugin (plugins/governance/) — principle array + validate pipeline + per-project AGENTS.md ## Governance enforcement"
kind = "wilson plugin (plugins/governance/) — principle AGGREGATOR + profile resolver. Principles are plugin-owned (2026-05-17): a guard that enforces one ALSO contributes its text; pure-text ones are plugins/principle-<id>/. governance holds NO principle data."
parent-repo = "dancinlab/wilson"
read-first = "SPEC.md (canonical written spec)"
ssot-array = "main.hexa::GOVERNANCE_PRINCIPLES (runtime) ↔ SPEC.md §Principles (written)"
ssot = "per-principle: its owning plugin (guard-<x>::<sym>_principle_text() OR plugins/principle-<id>/main.hexa::<sym>_text(), order+default_on in the same fold record). GOVERNANCE_PRINCIPLES = [] (emptied 2026-05-17). SPEC.md §Principles = written mirror."

@I id002 := "principle-array-state" :: identity-claim [d=2026-05-14 active]
<: id001
Expand All @@ -70,7 +70,7 @@
AGENTS.tape -> "this file · structured supplement (identity · pointers · summary)"
CLAUDE.md -> "symlink → AGENTS.tape (Claude Code auto-discovery)"
plugin.hexa -> "@plugin(...) manifest + governance_dispatch + governance_manifest"
main.hexa -> "implementation · GOVERNANCE_PRINCIPLES array (runtime SSOT) · validate pipeline · session_start inject"
main.hexa -> "aggregator + profile resolver · governance_collect_principles fires the `governance_principles` transform fold · GOVERNANCE_PRINCIPLES = [] · session_start inject of the rendered block"
test_governance.hexa -> "selftests (fake_host — see core/test_fixture.hexa)"

# ─── §3 Governance (plugin-local + inherited from wilson root) ───────
Expand All @@ -81,8 +81,8 @@
@> AGENTS.md

@D g1 := "one-ssot-per-fact" :: governance [required deny:write]
rule = "The principle array's text + position is `main.hexa::GOVERNANCE_PRINCIPLES`. `SPEC.md` mirrors current state under §Principles. When you reshuffle or add, update BOTH."
why = "runtime SSOT ↔ written SSOT must agree; drift breaks invariant"
rule = "Each principle's text + order + default_on is owned by ITS plugin — the enforcing guard's `<sym>_principle_text()` (+ host_on order) OR `plugins/principle-<id>/main.hexa::<sym>_text()`. governance holds NONE (GOVERNANCE_PRINCIPLES = []). To add / reshuffle / retext a principle, edit ITS plugin (and SPEC.md §Principles, the written mirror). Order = the host_on/record `order` int (stable kebab id across renumber)."
why = "single SSOT per principle = its plugin; governance is purely aggregator + profile resolver — there is no array to drift against"
@> AGENTS.md

@D g2 := "no-per-principle-individual-docs" :: governance [required deny:write]
Expand Down Expand Up @@ -139,8 +139,8 @@
scope = "127-line prose SSOT · function tables · when-you-change-X procedures · session_start inject surface · quick-verify shell snippets"
why-preserved = "rich procedural content + shell snippets that compress poorly to tape entries"

@X x_principles_array := "main.hexa::GOVERNANCE_PRINCIPLES" :: code-ssot [active]
scope = "runtime principle arraykebab-id + default_on + one-liner text"
@X x_principle_plugins := "plugins/principle-<id>/ + guard-<x> contributors" :: code-ssot [active]
scope = "per-principle SSOTeach owning plugin contributes #{id,order,default_on,text} to the governance_principles fold; governance aggregates"
mirror = "SPEC.md §Principles section"

@X x_tape_spec := "tape v1.2 spec" :: spec [d=2026-05-14 active]
Expand Down
Loading
Loading