emergent-security/tools/build_adoption_draft.py
tegwick ee2e17a2d2 Reconcile published offline intake in knowledge 0.2.4
Informed Decision 15c330cc documents an offline intake service with empty
registries and no live listener. The decisions card carries those limits.
The unsigned draft binds the new digest and is not submitted.
EMERGENT-WP-0002 stays blocked.

Assistant: grok
Assistant-Session: 01a10286-9185-7bb2-b411-89cf6ab4c0c6
2026-10-03 20:14:41 +02:00

87 lines
5.1 KiB
Python

#!/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. Provider
routing renewal, continuity, and harness proof remain open. No full Grok
validation is claimed.
0.2.4 reviews Informed Decision at 15c330cc. An offline intake service, ledger,
and doctrine constraints are documented there. No listener, submitter grant,
custody, or live route is claimed. A creating approval without a retained
receipt is not retried.
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())