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 です。
このスキーマの役割
Section titled “このスキーマの役割”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 で扱います。
-
frame の goal / scope / approval topology / memory policy
→Schema: Process Frame -
emitted / evaluated / promoted / merged の差分
→Schema: Process Delta -
current lifecycle state
→Lifecycle -
checkpoint / recovery point
→Recovery Point
つまり Compiled Context schema は、
構造そのものではなく、構造から導出された actor-local working interface
を表します。
この schema が表すもの
Section titled “この schema が表すもの”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
このページでは、それを実装しやすい形に落とします。
最小 canonical schema
Section titled “最小 canonical schema”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:この最小形で重要なのは、次の点です。
actorとframe_idがあるderived_fromがあり、context が何から compile されたかが分かるgoal_sliceがあるrelevant_stateが facts / artifacts / evidence / unresolved_issues / recent_deltas に分かれているcapability_scopeが visibility と actionability を一体として示すexpected_output、stop_conditions、handoff_contractがあるfreshnessがある
推奨 expanded schema
Section titled “推奨 expanded schema”実装や保存を考えるなら、次のような 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 は、selection と compaction の痕跡まで含めた、かなり実務向けの参照形です。
軽量な実装では、selection_record_ref や compaction_record_ref を省略してもよいですが、
高リスクな process や later audit / rollback / recovery を考えるなら持っておく価値があります。
Field-by-field reference
Section titled “Field-by-field reference”以下、各 field の意味を整理します。
context_id — recommended
Section titled “context_id — recommended”compiled context 自体を識別する stable ID です。
期待される性質:
- frame 内または project 内で一意
- later invalidation / supersession / recovery から参照可能
- one-shot ephemeral でもよいが、important contexts は traceable に残る方がよい
例:
ctx.feature.checkout.coupon-combination.reviewer.v2ctx.incident.resume.validation.v1
actor_ref — required
Section titled “actor_ref — required”この context を使う actor を指します。
重要な点:
- actor kind は human / ai / tool / runtime / document / policy いずれでもよい
- 同じ frame でも actor が違えば compiled context は原則別物
- actor-local であることが PCE 2.0 の前提
詳しくは Actor を参照。
frame_ref — required
Section titled “frame_ref — required”どの frame の局面に対する context かを指します。
重要な点:
- context は frame 外で独立存在しない
frame_refがなければ goal / scope / gate / validity を説明しにくい- child frame 用か parent frame 用かもここから分かる
phase_ref — optional but recommended
Section titled “phase_ref — optional but recommended”その context がどの phase のために compile されたかを示します。
例:
- analysis
- implementation
- review
- evaluation
- promotion
- incident
- recovery
注意点:
- phase は lifecycle state ではない
reviewphase でも current state はactive,pending_approval,recoveringなどになりうる
purpose — required in practical implementations
Section titled “purpose — required in practical implementations”この context が何のために compile されたかを示します。
代表値:
executereviewevaluateapprovememory_writerecoverjoinescalate
同じ actor・同じ frame でも purpose が違えば context は変わりえます。
たとえば reviewer が evaluate するための context と、approve するための context は一致しないことがあります。
modality — required
Section titled “modality — required”この context がどの形式で消費されるかを示します。
例:
llm_prompthuman_review_uitool_payloadruntime_packagepolicy_binding
重要な点:
- modality が違えば budget、selection、compaction の形も変わる
- 同じ semantic content が同じ rendering になるとは限らない
- prompt は modality の一つにすぎない
derived_from — required
Section titled “derived_from — required”この context が何から導出されたかを示します。
PCE 2.0 において compiled context は生データではなく derived view なので、ここは非常に重要です。
典型 subfields:
process_frame_refbundle_reflifecycle_refdurable_state_refsdelta_refshandoff_refrecovery_refselection_record_refcompaction_record_refbudget_ref
重要な点:
- current context がどう成立したかを later audit 可能にする
- selection / compaction を explicit に追いたいなら ref を持つ
durable_state_refsは active に見せたものだけでなく、by-reference reserve の source にもなりうる
goal_slice — required
Section titled “goal_slice — required”その actor が今この局面で向き合うべき局所 goal です。
期待される性質:
- frame 全体の goal をそのまま貼るのではなく、actor-relative に局所化されている
- current purpose に合っている
- next expected action を方向づける
- review / approval / memory writing では “what to judge” を明確にする
悪い例:
- 親 frame の長い goal をそのまま全部入れる
- vague な task label だけにする
mandatory_core — highly recommended
Section titled “mandatory_core — highly recommended”current responsibility を legal / adequate に遂行するための safety floor をまとめる場所です。
典型 subfields:
scope_constraintspending_gatesrequired_evidence_refsstop_conditionsexpected_output_contract
これを独立フィールドにしておくと、
- selection validation
- compaction validation
- budget validation
- corrupt-success detection
がかなりしやすくなります。
relevant_state — required
Section titled “relevant_state — required”actor がいま判断・実行・handoff のために active に見る state です。
推奨 subfields:
factsartifactsevidenceunresolved_issuesrecent_deltasrisk_notescounterevidence
ここで重要なのは、counterevidence や risk_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_toolsallowed_actionsallowed_resourcesdata_visibilityeffect_classprohibitions
重要な点:
- visibility と capability を分けて考える
- current phase に合わせた actual scope であるべき
- actor bundle 上の潜在的 authority をそのまま表すのではなく、current local envelope を表す
詳しくは Capability Scope を参照。
governance_view — recommended
Section titled “governance_view — recommended”その actor に relevant な governance surface の局所投影です。
典型 subfields:
approval_dependenciesevaluation_dependenciespromotion_dependenciesescalation_pathretained_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
などがここに出ます。
by_reference — recommended
Section titled “by_reference — recommended”active には入れないが、必要なら開ける reserve です。
典型 subfields:
docstraceslogslarge_artifactsfull_diffs
重要な点:
- これは omission とは違う
- active にないが reachable であることが重要
- later expansion path として機能する
omitted — recommended in explicit implementations
Section titled “omitted — recommended in explicit implementations”何を active view から外したかを示します。
全部列挙する必要はありませんが、governance-relevant omission は traceable にすべきです。
典型 subfields:
hiddenstaleirrelevantduplicate
重要な点:
- omission を silent にしない
hiddenとirrelevantとstaleは意味が違う- later audit や compaction reasoning に使える
expected_output — required
Section titled “expected_output — required”この actor が何を返すべきかを定めます。
推奨 subfields:
kindrequired_fieldsquality_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_sliceとexpected_outputは別- actor が今何をすべきかは、この二つの組み合わせで明確になる
handoff_contract — optional but highly recommended for non-terminal contexts
Section titled “handoff_contract — optional but highly recommended for non-terminal contexts”その context を使った actor が次に誰へ何を渡すべきかを定めます。
典型 subfields:
next_targetrequired_packagereturn_contract
これがあると、compiled context は単なる info surface ではなく
continuation-ready interface になります。
詳しくは Handoff を参照。
freshness — required
Section titled “freshness — required”この context がいつ stale になるかを定めます。
典型 subfields:
source_epochinvalidated_byexpires_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 に特に重要
validity — optional but useful
Section titled “validity — optional but useful”freshness より少し広く、「どの状態で使ってよいか」を示します。
例:
active_when: review_phase_opennot_valid_when: frame_closednot_valid_when: escalation_pending
freshness が時間・状態変化による stale 化に寄るのに対し、
validity はより gate / lifecycle 寄りの利用条件を表すと考えると整理しやすいです。
provenance — recommended
Section titled “provenance — recommended”この context が誰によって、いつ、どの transition や compile pipeline から作られたかを表します。
典型 subfields:
compiled_bycompiled_atsource_transition
これは later audit、rollback、corrupt-success diagnosis に役立ちます。
status — optional
Section titled “status — optional”compiled context 自体の lifecycle です。
例:
activesupersededinvalidatedconsumedarchived
これは frame lifecycle と混同しないことが重要です。
同じ frame が active でも、ある compiled context は superseded かもしれません。
何をこの schema に入れないか
Section titled “何をこの schema に入れないか”混ざりやすいので明示します。
入れない方がよいもの
Section titled “入れない方がよいもの”1. full process frame structure
Section titled “1. full process frame structure”goal / scope / approval topology を丸ごと埋め込むのではなく、必要部分に絞るべきです。
2. complete durable state
Section titled “2. complete durable state”compiled context は project memory 全体の dump ではありません。
3. all raw transcripts by default
Section titled “3. all raw transcripts by default”必要時に ref で戻れるようにしても、active に全部持つべきではありません。
4. all historical approvals / evals
Section titled “4. all historical approvals / evals”current purpose に必要なものだけを選ぶべきです。
5. unbounded optional support
Section titled “5. unbounded optional support”予算を壊すだけの low-salience support は active に持つべきではありません。
Validation rules
Section titled “Validation rules”この 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 ではありません。
2. goal_slice must exist
Section titled “2. goal_slice must exist”局所 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 では特に必須です。
6. by_reference items must be reachable
Section titled “6. by_reference items must be reachable”必要時に 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 は、次の三つと密接に関係します。
Context Selection
Section titled “Context Selection”何を active / by-reference / omitted にするかを決める。
→ Context Selection
Compaction
Section titled “Compaction”選ばれた材料を target actor / modality に合わせて畳む。
→ Compaction
Context Budget
Section titled “Context Budget”floor と ceiling を与える。
→ Context Budget
関係を図で書くと、次のようになります。
source materials -> selection -> compaction -> compiled context -> actor action / judgment / handoffここで compiled context は、selection や compaction の raw history そのものではなく、
その結果として actor が使う bounded view です。
Serialization guidance
Section titled “Serialization guidance”実装では、compiled context は often ephemeral です。
しかし high-risk flows では保存価値があります。
ephemeral でよい場合
Section titled “ephemeral でよい場合”- low-risk local execution
- deterministic read-only support
- one-shot internal planning
persisted した方がよい場合
Section titled “persisted した方がよい場合”- 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
Example 1: Reviewer context
Section titled “Example 1: Reviewer context”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: activeExample 2: Recovery context
Section titled “Example 2: Recovery context”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: activeWhat to implement next
Section titled “What to implement next”この schema を扱えるようになったら、次に実装・記述するとつながりやすいものは次です。
暫定的なまとめ
Section titled “暫定的なまとめ”Compiled Context schema が言っていることは、最終的には次の一文に集約できます。
context は、単に関連しそうな情報の束ではない。
ある actor が、ある局面で、自分の責任を legal かつ adequate に遂行するために、必要な core を落とさず、不要なものを active から外し、何を返すかまで含めて bounded に構成された局所 interface である。
この schema は、その interface を保存・検証・受け渡し可能にするための参照形です。