Skip to content

Schema: Compiled Context

このページは Actor-local Compiled Context参照スキーマです。
概念的な定義や背景は ontology ページを優先し、このページでは field inventory、validation rules、selection / compaction / budget との切り分け、実装時の注意点を中心に整理します。

このページでは簡便のため Compiled Context という語を使いますが、PCE 2.0 においてそれは原則として
Actor-local Compiled Context
を意味します。
つまり、単なる prompt ではなく、ある actor がある局面で責任を遂行するための局所 view です。

Compiled Context schema は、PCE 2.0 における「いまこの actor が active に使う局所視界」を表します。
ここに入るのは、主に次のものです。

  • どの actor のための context か
  • どの frame / phase / purpose のためか
  • どの bundle を前提にしているか
  • 何が current goal slice か
  • どの facts / artifacts / evidence / unresolved issues を active に見るか
  • 何をしてよく、何をしてはいけないか
  • 何を返すべきか
  • どこで止まり、どこへ handoff / escalate すべきか
  • いつ stale になるか
  • 何が by-reference で、何が omitted か

逆に、仕事単位そのものの構造 は原則としてこの schema の外です。
たとえば次は別 schema で扱います。

つまり Compiled Context schema は、
構造そのものではなく、構造から導出された actor-local working interface
を表します。


PCE 2.0 では、compiled context は次のような導出物です。

actor_local_context(actor, frame, t) =
compile(
process_frame,
responsibility_bundle(actor, frame, t),
durable_project_state,
runtime_state(t)
)

この schema は、この compile(...)結果を保存・転送・検証するための参照形です。
そのため、次の性質を持ちます。

  • actor-relative
  • purpose-bound
  • phase-relative
  • budget-bounded
  • governance-aware
  • freshness-aware
  • invalidation-aware

このページでは、それを実装しやすい形に落とします。


PCE 2.0 の最小形は、次のように置けます。

actor_local_compiled_context:
actor:
frame_id:
derived_from:
process_frame:
responsibility_bundle:
durable_state_refs:
runtime_state_ref:
modality:
goal_slice:
relevant_state:
facts:
artifacts:
evidence:
unresolved_issues:
recent_deltas:
capability_scope:
allowed_tools:
allowed_actions:
data_visibility:
prohibitions:
constraints:
expected_output:
stop_conditions:
handoff_contract:
next_target:
required_format:
escalation_path:
provenance:
freshness:

この最小形で重要なのは、次の点です。

  • actorframe_id がある
  • derived_from があり、context が何から compile されたかが分かる
  • goal_slice がある
  • relevant_state が facts / artifacts / evidence / unresolved_issues / recent_deltas に分かれている
  • capability_scope が visibility と actionability を一体として示す
  • expected_outputstop_conditionshandoff_contract がある
  • freshness がある

実装や保存を考えるなら、次のような expanded shape が扱いやすいです。

compiled_context:
context_id:
actor_ref:
frame_ref:
phase_ref:
purpose:
# execute | review | evaluate | approve | memory_write | recover | join | escalate | custom
modality:
# llm_prompt | human_review_ui | tool_payload | runtime_package | policy_binding
derived_from:
process_frame_ref:
bundle_ref:
lifecycle_ref:
durable_state_refs:
delta_refs:
handoff_ref:
recovery_ref:
selection_record_ref:
compaction_record_ref:
budget_ref:
goal_slice:
mandatory_core:
scope_constraints:
pending_gates:
required_evidence_refs:
stop_conditions:
expected_output_contract:
relevant_state:
facts:
artifacts:
evidence:
unresolved_issues:
recent_deltas:
risk_notes:
counterevidence:
capability_scope:
allowed_tools:
allowed_actions:
allowed_resources:
data_visibility:
effect_class:
prohibitions:
governance_view:
approval_dependencies:
evaluation_dependencies:
promotion_dependencies:
escalation_path:
retained_authorities:
by_reference:
docs:
traces:
logs:
large_artifacts:
full_diffs:
omitted:
hidden:
stale:
irrelevant:
duplicate:
expected_output:
kind:
required_fields:
quality_requirements:
handoff_contract:
next_target:
required_package:
return_contract:
freshness:
source_epoch:
invalidated_by:
expires_when:
validity:
active_when:
not_valid_when:
provenance:
compiled_by:
compiled_at:
source_transition:
status:
# active | superseded | invalidated | consumed | archived

この shape は、selectioncompaction の痕跡まで含めた、かなり実務向けの参照形です。
軽量な実装では、selection_record_refcompaction_record_ref を省略してもよいですが、
高リスクな process や later audit / rollback / recovery を考えるなら持っておく価値があります。


以下、各 field の意味を整理します。

compiled context 自体を識別する stable ID です。

期待される性質:

  • frame 内または project 内で一意
  • later invalidation / supersession / recovery から参照可能
  • one-shot ephemeral でもよいが、important contexts は traceable に残る方がよい

例:

  • ctx.feature.checkout.coupon-combination.reviewer.v2
  • ctx.incident.resume.validation.v1

この context を使う actor を指します。

重要な点:

  • actor kind は human / ai / tool / runtime / document / policy いずれでもよい
  • 同じ frame でも actor が違えば compiled context は原則別物
  • actor-local であることが PCE 2.0 の前提

詳しくは Actor を参照。


どの frame の局面に対する context かを指します。

重要な点:

  • context は frame 外で独立存在しない
  • frame_ref がなければ goal / scope / gate / validity を説明しにくい
  • child frame 用か parent frame 用かもここから分かる

その context がどの phase のために compile されたかを示します。

例:

  • analysis
  • implementation
  • review
  • evaluation
  • promotion
  • incident
  • recovery

注意点:

  • phase は lifecycle state ではない
  • review phase でも current state は active, pending_approval, recovering などになりうる

purpose — required in practical implementations

Section titled “purpose — required in practical implementations”

この context が何のために compile されたかを示します。

代表値:

  • execute
  • review
  • evaluate
  • approve
  • memory_write
  • recover
  • join
  • escalate

同じ actor・同じ frame でも purpose が違えば context は変わりえます。
たとえば reviewer が evaluate するための context と、approve するための context は一致しないことがあります。


この context がどの形式で消費されるかを示します。

例:

  • llm_prompt
  • human_review_ui
  • tool_payload
  • runtime_package
  • policy_binding

重要な点:

  • modality が違えば budget、selection、compaction の形も変わる
  • 同じ semantic content が同じ rendering になるとは限らない
  • prompt は modality の一つにすぎない

この context が何から導出されたかを示します。
PCE 2.0 において compiled context は生データではなく derived view なので、ここは非常に重要です。

典型 subfields:

  • process_frame_ref
  • bundle_ref
  • lifecycle_ref
  • durable_state_refs
  • delta_refs
  • handoff_ref
  • recovery_ref
  • selection_record_ref
  • compaction_record_ref
  • budget_ref

重要な点:

  • current context がどう成立したかを later audit 可能にする
  • selection / compaction を explicit に追いたいなら ref を持つ
  • durable_state_refs は active に見せたものだけでなく、by-reference reserve の source にもなりうる

その actor が今この局面で向き合うべき局所 goal です。

期待される性質:

  • frame 全体の goal をそのまま貼るのではなく、actor-relative に局所化されている
  • current purpose に合っている
  • next expected action を方向づける
  • review / approval / memory writing では “what to judge” を明確にする

悪い例:

  • 親 frame の長い goal をそのまま全部入れる
  • vague な task label だけにする

current responsibility を legal / adequate に遂行するための safety floor をまとめる場所です。

典型 subfields:

  • scope_constraints
  • pending_gates
  • required_evidence_refs
  • stop_conditions
  • expected_output_contract

これを独立フィールドにしておくと、

  • selection validation
  • compaction validation
  • budget validation
  • corrupt-success detection

がかなりしやすくなります。


actor がいま判断・実行・handoff のために active に見る state です。

推奨 subfields:

  • facts
  • artifacts
  • evidence
  • unresolved_issues
  • recent_deltas
  • risk_notes
  • counterevidence

ここで重要なのは、counterevidencerisk_notes を持てることです。
PCE 2.0 では、success を支持する情報だけを active にすると Corrupt Success を生みやすくなります。


capability_scope — required whenever the actor can act

Section titled “capability_scope — required whenever the actor can act”

その actor がこの context の中で何をしてよいかを示します。

典型 subfields:

  • allowed_tools
  • allowed_actions
  • allowed_resources
  • data_visibility
  • effect_class
  • prohibitions

重要な点:

  • visibility と capability を分けて考える
  • current phase に合わせた actual scope であるべき
  • actor bundle 上の潜在的 authority をそのまま表すのではなく、current local envelope を表す

詳しくは Capability Scope を参照。


その actor に relevant な governance surface の局所投影です。

典型 subfields:

  • approval_dependencies
  • evaluation_dependencies
  • promotion_dependencies
  • escalation_path
  • retained_authorities

これを入れておくと、current context が単なる info pack ではなく
governed working interface になります。

たとえば reviewer なら、

  • code_review_approval is pending
  • CI pass is required
  • direct code edit is prohibited
  • escalation target is product owner

などがここに出ます。


active には入れないが、必要なら開ける reserve です。

典型 subfields:

  • docs
  • traces
  • logs
  • large_artifacts
  • full_diffs

重要な点:

  • これは omission とは違う
  • active にないが reachable であることが重要
  • later expansion path として機能する

Section titled “omitted — recommended in explicit implementations”

何を active view から外したかを示します。
全部列挙する必要はありませんが、governance-relevant omission は traceable にすべきです。

典型 subfields:

  • hidden
  • stale
  • irrelevant
  • duplicate

重要な点:

  • omission を silent にしない
  • hiddenirrelevantstale は意味が違う
  • later audit や compaction reasoning に使える

この actor が何を返すべきかを定めます。

推奨 subfields:

  • kind
  • required_fields
  • quality_requirements

例:

  • reviewer
    → approval verdict + comments + rationale

  • coding agent
    → code diff + test update + rollback note

  • memory writer
    → promotion decision + resulting item refs

  • recovery validator
    → recovery verdict + reopened gates + stale context list

重要な点:

  • goal_sliceexpected_output は別
  • actor が今何をすべきかは、この二つの組み合わせで明確になる

Section titled “handoff_contract — optional but highly recommended for non-terminal contexts”

その context を使った actor が次に誰へ何を渡すべきかを定めます。

典型 subfields:

  • next_target
  • required_package
  • return_contract

これがあると、compiled context は単なる info surface ではなく
continuation-ready interface になります。

詳しくは Handoff を参照。


この context がいつ stale になるかを定めます。

典型 subfields:

  • source_epoch
  • invalidated_by
  • expires_when

例:

  • code diff changes
  • approved spec changes
  • governance rule changes
  • new incident opens
  • branch join result changes

重要な点:

  • compiled context は often stateful である
  • old context を current truth のように使わせないために freshness が必要
  • recovery や later review に特に重要

freshness より少し広く、「どの状態で使ってよいか」を示します。

例:

  • active_when: review_phase_open
  • not_valid_when: frame_closed
  • not_valid_when: escalation_pending

freshness が時間・状態変化による stale 化に寄るのに対し、
validity はより gate / lifecycle 寄りの利用条件を表すと考えると整理しやすいです。


この context が誰によって、いつ、どの transition や compile pipeline から作られたかを表します。

典型 subfields:

  • compiled_by
  • compiled_at
  • source_transition

これは later audit、rollback、corrupt-success diagnosis に役立ちます。


compiled context 自体の lifecycle です。

例:

  • active
  • superseded
  • invalidated
  • consumed
  • archived

これは frame lifecycle と混同しないことが重要です。
同じ frame が active でも、ある compiled context は superseded かもしれません。


混ざりやすいので明示します。

goal / scope / approval topology を丸ごと埋め込むのではなく、必要部分に絞るべきです。

compiled context は project memory 全体の dump ではありません。

必要時に ref で戻れるようにしても、active に全部持つべきではありません。

current purpose に必要なものだけを選ぶべきです。

予算を壊すだけの low-salience support は active に持つべきではありません。


この schema を Compiled Context として扱うための最低限の validation rule を置いておきます。

1. actor_ref, frame_ref, purpose, modality are required

Section titled “1. actor_ref, frame_ref, purpose, modality are required”

誰のための、何のための、どの形式の context か分からないものは compiled context ではありません。

局所 goal のない context は、actor-local ではありません。

3. mandatory_core must preserve current safety floor

Section titled “3. mandatory_core must preserve current safety floor”

必要な scope / gate / evidence / stop condition / expected output を欠いてはなりません。

4. capability_scope must not exceed current actual authority

Section titled “4. capability_scope must not exceed current actual authority”

bundle や governance surface を越える affordance を出してはなりません。

5. freshness must be explicit for stateful contexts

Section titled “5. freshness must be explicit for stateful contexts”

review, approval, recovery, promotion に関わる context では特に必須です。

必要時に ref を辿れないなら reserve として意味を持ちません。

7. omitted governance-relevant items should be explainable

Section titled “7. omitted governance-relevant items should be explainable”

特に hidden / stale / pending gate omission は later explanation が必要です。

8. expected_output should be actor-compatible

Section titled “8. expected_output should be actor-compatible”

reviewer に code diff patch output を要求するような misfit は避けるべきです。

9. If mandatory core does not fit the actor’s budget, redesign the process

Section titled “9. If mandatory core does not fit the actor’s budget, redesign the process”

unsafe compaction や unsafe omission ではなく、child frame / staged review / escalation を考えるべきです。

10. compiled context must be traceable to frame and bundle

Section titled “10. compiled context must be traceable to frame and bundle”

何から compile されたかが説明できなければ、later audit が難しくなります。


Relationship to selection, compaction, and budget

Section titled “Relationship to selection, compaction, and budget”

この schema は、次の三つと密接に関係します。

何を active / by-reference / omitted にするかを決める。
Context Selection

選ばれた材料を target actor / modality に合わせて畳む。
Compaction

floor と ceiling を与える。
Context Budget

関係を図で書くと、次のようになります。

source materials
-> selection
-> compaction
-> compiled context
-> actor action / judgment / handoff

ここで compiled context は、selection や compaction の raw history そのものではなく、
その結果として actor が使う bounded view です。


実装では、compiled context は often ephemeral です。
しかし high-risk flows では保存価値があります。

  • low-risk local execution
  • deterministic read-only support
  • one-shot internal planning
  • review / approval contexts
  • memory promotion contexts
  • recovery / resume contexts
  • escalation packages
  • branch join integration contexts

persist する場合でも、full payload を全部持つ必要はありません。
最低限、次は残しておくとよいです。

  • selected active items
  • by-reference items
  • omissions class
  • freshness / invalidation conditions
  • provenance
  • resulting status

feature.checkout.coupon-combination の reviewer 用 context 例です。

compiled_context:
context_id: ctx.feature.checkout.coupon-combination.reviewer.v2
actor_ref: reviewer
frame_ref: feature.checkout.coupon-combination
phase_ref: review
purpose: approve
modality: human_review_ui
derived_from:
process_frame_ref: feature.checkout.coupon-combination
bundle_ref: reviewer_bundle_v1
lifecycle_ref: lifecycle.feature.checkout.coupon-combination.review_pending
durable_state_refs:
- artifact.spec.coupon-combination.v1
- decision.no-payment-gateway-change
delta_refs:
- delta.feature.checkout.coupon-combination.v3
handoff_ref: handoff.feature.checkout.coupon-combination.impl-to-review.v1
recovery_ref: rp.feature.checkout.coupon-combination.after-impl.v1
selection_record_ref: sel.review.checkout.coupon-combination.v1
compaction_record_ref: comp.review-package.checkout.coupon-combination.v1
budget_ref: reviewer_review_budget_v1
goal_slice: >
code change が approved spec と scope に整合しているかを判断し、
merge readiness を approve / reject / request_changes する
mandatory_core:
scope_constraints:
- payment_gateway_changes_are_out_of_scope
pending_gates:
- code_review_approval
- required_regression_confirmation
required_evidence_refs:
- code_diff_ref
- ci_report_ref
- approved_spec_summary_ref
- rollback_note_ref
stop_conditions:
- missing_required_evidence
- scope_violation_detected
expected_output_contract:
- approval_verdict
- review_comments
- rationale_note_if_needed
relevant_state:
facts:
- spec_approved
- implementation_completed
artifacts:
- changed_files_summary
- diff_summary
evidence:
- ci_pass_summary
- rollback_feasibility_summary
unresolved_issues:
- edge_case_for_stacked_discount_rounding
recent_deltas:
- artifact_delta.code_patch
- artifact_delta.tests_update
risk_notes:
- pricing_determinism_must_remain_stable
counterevidence:
- failure_note.naive_threshold_regression
capability_scope:
allowed_tools:
- diff_view
- test_report_view
- review_comment
allowed_actions:
- approve
- reject
- request_changes
- escalate
allowed_resources:
- current_diff
- current_required_evidence
data_visibility:
- relevant_checkout_artifacts_only
effect_class: ratification_without_direct_code_mutation
prohibitions:
- direct_code_edit
- canonical_memory_write
governance_view:
approval_dependencies:
- required_regression_confirmation
evaluation_dependencies:
- eval.feature.checkout.coupon-combination.artifact.v1
promotion_dependencies: []
escalation_path:
- product_owner
retained_authorities:
- final_frame_close_by_product_owner
by_reference:
docs:
- full_precedence_adr_ref
traces:
- full_implementation_trace_ref
logs:
- full_ci_log_ref
large_artifacts:
- complete_diff_ref
full_diffs:
- full_diff_ref
omitted:
hidden:
- production_credentials
stale: []
irrelevant:
- unrelated_marketing_notes
duplicate:
- repeated_local_debug_logs
expected_output:
kind: approval_decision
required_fields:
- verdict
- comments_if_any
quality_requirements:
- explicit_if_scope_conflict
- explicit_if_evidence_insufficient
handoff_contract:
next_target: memory_writer
required_package:
- approval_status
- review_notes
return_contract: null
freshness:
source_epoch: review_package_generated_at_2026_03_09T10_30_00Z
invalidated_by:
- code_diff_changes
- approved_spec_changes
- ci_report_changes
expires_when: review_concluded_or_subject_changed
validity:
active_when: review_phase_open
not_valid_when:
- frame_closed
- escalation_pending
provenance:
compiled_by: checkpoint_manager
compiled_at: 2026-03-09T10:31:00Z
source_transition: recover.for-review
status: active

recover 後に runtime / reviewer が使う resumable context 例です。

compiled_context:
context_id: ctx.feature.checkout.coupon-combination.recovery-review.v1
actor_ref: checkpoint_manager
frame_ref: feature.checkout.coupon-combination
phase_ref: recovery
purpose: recover
modality: runtime_package
derived_from:
process_frame_ref: feature.checkout.coupon-combination
bundle_ref: runtime_recovery_bundle
lifecycle_ref: lifecycle.feature.checkout.coupon-combination.recovering
durable_state_refs:
- artifact.spec.coupon-combination.v1
- decision.no-payment-gateway-change
delta_refs:
- delta.feature.checkout.coupon-combination.v3
recovery_ref: rp.feature.checkout.coupon-combination.after-impl.v1
budget_ref: recovery_runtime_budget_v1
goal_slice: >
pending review continuation を安全に再開できる runtime state を再構成する
mandatory_core:
scope_constraints:
- no_scope_widening_during_recovery
pending_gates:
- code_review_approval
- required_regression_confirmation
required_evidence_refs:
- recovery_point_ref
- delta_ref
- approved_spec_summary_ref
stop_conditions:
- recovery_point_invalid
- governance_drift_detected
- required_ref_missing
expected_output_contract:
- restored_runtime_state
- stale_context_list
- legal_next_transitions
relevant_state:
facts:
- frame_was_suspended_after_implementation
artifacts: []
evidence:
- recovery_integrity_check_inputs
unresolved_issues:
- edge_case_for_stacked_discount_rounding
recent_deltas:
- delta.feature.checkout.coupon-combination.v3
risk_notes:
- old_reviewer_context_may_be_stale
counterevidence:
- none
capability_scope:
allowed_tools:
- restore_checkpoint
- verify_refs
- compile_context
allowed_actions:
- recover
- invalidate_context
- reopen_gate
allowed_resources:
- recovery_points
- runtime_state_store
data_visibility:
- recovery_materials_only
effect_class: provisional_runtime_mutation
prohibitions:
- canonical_memory_write
- merge
governance_view:
approval_dependencies:
- human_resume_authorization_if_drift_detected
evaluation_dependencies:
- checkpoint_integrity_check
promotion_dependencies: []
escalation_path:
- product_owner
retained_authorities:
- risky_resume_decision_by_human_actor
by_reference:
docs:
- full_spec_ref
traces:
- full_pre_recovery_trace_ref
logs:
- checkpoint_creation_log_ref
large_artifacts: []
full_diffs:
- full_diff_ref
omitted:
hidden: []
stale:
- coding_agent_impl_context_v2
irrelevant:
- unrelated_old_branch_notes
duplicate: []
expected_output:
kind: recovery_result
required_fields:
- restored_state_ref
- invalidated_contexts
- reopened_gates
quality_requirements:
- legal_next_transitions_must_be_explicit
handoff_contract:
next_target: reviewer
required_package:
- restored_review_context
- reopened_gate_state
return_contract: null
freshness:
source_epoch: recovery_started_at_2026_03_10T09_00_00Z
invalidated_by:
- new_governance_change
- parent_frame_superseded
expires_when: recovery_completed
validity:
active_when: recovering
not_valid_when:
- active_review_resumed
- recovery_aborted
provenance:
compiled_by: checkpoint_manager
compiled_at: 2026-03-10T09:00:15Z
source_transition: recover.for-review
status: active

この schema を扱えるようになったら、次に実装・記述するとつながりやすいものは次です。


Compiled Context schema が言っていることは、最終的には次の一文に集約できます。

context は、単に関連しそうな情報の束ではない。
ある actor が、ある局面で、自分の責任を legal かつ adequate に遂行するために、必要な core を落とさず、不要なものを active から外し、何を返すかまで含めて bounded に構成された局所 interface である。

この schema は、その interface を保存・検証・受け渡し可能にするための参照形です。