#!/usr/bin/env python3 """Build an unsigned, UNSUBMITTED profile-adoption memo; never contact an API. This is an owner-format draft, not submitter registration or a human answer. Review class/group/admission with informed-decision before any submission. """ from pathlib import Path import argparse import hashlib import json import sys ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / 'src')) from emergent_security.knowledge import Knowledge def build(): package = Knowledge(ROOT / 'knowledge') version = package.catalog['version'] digest = package.package_digest item = 'emergent-profile-packet' content = f'''# Knowledge profile adoption request Adopt Emergent Security knowledge {version}, release digest {digest}, as a non-normative orientation profile for coding agents in NetKingdom. The profile points to existing owners, withholds stale guidance, and separates human decisions, runtime approvals, PDP decisions, credentials and procedure records. This asks only to accept that orientation boundary. It does not amend owner contracts or authorize operational effects, autonomous execution, root, credential changes or fleet rollout. Alternatives: return for wording/source corrections; decline this profile; accept this exact orientation boundary with the documented evidence limits. Changing the reviewed package requires a new review, not reuse of this answer. Evidence: knowledge/sources.yaml; docs/decision-runbook-integration.md; docs/operational-contracts.md; docs/adoption-review.md; docs/evidence/. Earlier provider reports and owner reviews retain their original release pins. Whitehat's offline review accepted remediation of the two loaded-package library findings on the 0.2.3 digest, with disclosed shared-session limits. That acceptance does not extend to this seal. Continuity and harness proof remain open. A fresh 0.2.4 Codex, Claude, and Grok session each answered all 28 scenarios. Implementing review found no unsafe authority recommendation. Recipient qualifications remain, and that review is not independent ratification. Those 0.2.4 answers, resume reloads, and four Claude pilots stay pinned to that digest. They are not evidence for this seal. 0.2.5 reviews Informed Decision at b4f63732. That revision records local intake delivery, fresh-login/p01 acceptance, and a dev forwarder that preserves governed booleans. No listener, submitter grant, custody, or live route is claimed. A creating approval without a retained receipt is not retried. 0.2.6 names the session owner as the recipient of a provider switch or compaction reload. glas-harness owns that session boundary. A live zone-endpoint question goes to zone-engine. The first two-case rerun on this seal has Codex, Claude, and Grok name zone-engine for that endpoint question and glas-harness for the reload. They do not use the fixture role label session-owner. A later two-case rerun, after the probe prompt named the token session-owner, has all three record that route and keep glas-harness in sources. Some source lists also name other card or envelope owners. Neither of those reruns is a full 28-case probe. A later full 28-case probe on this same seal has each provider preserve the authority boundary. zones is zone-engine and model-switch is session-owner. Seventeen route tokens match the fixture in each session, and recipient qualifications remain. Codex has no exact server model. That probe is not compaction proof, not independent Whitehat acceptance, and not acceptance of RISK-F-0015. 0.2.4 route results do not certify this wording. The draft is unsubmitted. The proposed memo class and review group must be confirmed by the owner; a synthetic test grant proves format only. INFD-WP-0005 intake rollout remains unfinished. This draft resolves no Statehub decision. ''' memo = dict(id='emergent-profile-adoption-'+version.replace('.', '-'), version=1, question=f'Accept Emergent Security knowledge {version} as a non-normative NetKingdom agent orientation profile?', requested_act='approve', binding_level='organizational', brief='Accept only the orientation boundary of this exact release; operational authority and remaining review gates stay with their owners.', binding=dict(principal=dict(id='pending-human-session', kind='person', display_name='Pending authenticated reviewer', role='reviewer', identifiers=[]), target=dict(id='emergent-security:knowledge:'+version+':'+digest, kind='knowledge-profile', label='Non-normative security orientation', environment='rehearsal', requires_new_bind=True), justification=None, terms=None), step_kind='approve', packet=[dict(item_id=item,label='Profile boundary and limitations',hash='sha256:'+hashlib.sha256(content.encode()).hexdigest())], highlights=[dict(id='orientation-only',item_id=item,locator=dict(kind='work_record',workplan='EMERGENT-WP-0002',task='EMERGENT-WP-0002-T02'),note='Acceptance is not runtime permission or completion of independent review, provider continuity or fleet rollout.',required_ack=True,severity='critical')], locale='en',ui_release='informed-decision@0.2.0',approval_id=None,approval_binding_digest=None,sealed=False) return dict(kind='informed-decision.memo-intake',version=1,idempotency_key='emergent-profile-'+digest, memo_class='knowledge-profile',review_group='net-kingdom-admins',drafted_by='codex@emergent-security (asserted)', serves=dict(hub_decision_id='d20a9750-2b29-534e-8227-fb866581a6ca',resolves='never'), approval_intent=dict(action='accept',principal='emergent-security',purpose='Accept only the non-normative knowledge profile boundary',target=dict(id=memo['binding']['target']['id'],type='knowledge-profile',system='emergent-security')), memo=memo,packet=[dict(item_id=item,media_type='text/markdown',content=content)]) def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--check', action='store_true') args = parser.parse_args() path = ROOT / 'docs/decisions/profile-adoption-intake.draft.json' content = json.dumps(build(), indent=2) + '\n' if args.check: if not path.exists() or path.read_text() != content: print('Draft differs from current release; rebuild and review.') return 1 print('Unsigned adoption draft matches current release; not submitted.') else: path.write_text(content) print('Wrote unsigned adoption draft; not submitted or approved.') return 0 if __name__ == '__main__': raise SystemExit(main())