Repository navigation
RFC: Cross-Discipline Physical Boundary Routing & Detached Remote-L4 Sync (v3.0 Exploration) #9
endean-eng
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Target Specification:
TOKENMEv3.0 Exploration (Post-v2.1.1 Roadmap)Baseline Context:
ADR-001throughADR-017(tokenme-sync.pyv2.1.x)Status: Open RFC / Seeking Architectural Feedback
1. Context & Problem Statement
In single-discipline software repositories, deterministic AST extraction (
ADR-006), hierarchical directory sharding (ADR-009,ADR-012), and polymorphic# === [TOPOLOGY] ===edges (ADR-011,ADR-016) capture explicit module contracts withO(1)cold-start overhead. However, scalingTOKENME.txtinto multi-discipline hardware/software engineering organizations and split local/cloud storage environments exposes three structural blind spots:electronics/("400 Hz PWM switching losses require <= 45 degC ambient air") and a mechanical housing revision inenclosures/("remove side louvers and increase EPDM gasket compression for IP65 washdown sealing") sit far apart in dense embedding space and fail keyword/trigger matching (applies_when). Neither specification supersedes the other - both remain active and authoritative within their own discipline - yet modifying one silently violates the physical operating envelope of the other.304vs.316stainless steel,Grade 5vs.Grade 8fasteners, adjacent solenoid or relay part numbers) despite incompatible load, thermal, voltage, or corrosion limits.ADR-009, heavy assets breaching modality-weighted OR thresholds demote in place to L4 cold storage alongside a co-located<filename>.<ext>.l3.txtplain-text surrogate. In mixed 5-to-20+ person engineering and operations teams where multi-gigabyte CAD assemblies, inspection imagery, and scanned manuals live in Google Drive, SharePoint/OneDrive, S3, or Git LFS, requiring raw L4 binaries on every local disk either exhausts workstation storage or forces OS virtual-drive drivers to download gigabytes over the network duringsha256byte scans.2. Non-Negotiable Architectural Constraints
Any v3.0 extension to
TOKENME.txtandtokenme-sync.pymust satisfy five invariants:<= 150-line (<= 1,500-token /4,200 BperADR-012andADR-016) sharded L1 root router ceiling.ADR-006):tokenme-sync.pyMUST remain pure Python 3 standard library (ast,hashlib,json,os,pathlib,re,stat) with zero external OCR, PDF-parsing, vector-database, cloud-SDK, or LLM API dependencies. Semantic inference remains strictly delegated to active repository agents.ADR-008): Cross-discipline routing MUST preserve single-parent shard ownership (never a DAG with duplicate file rows) so bottom-upSTATE_ROOTverification executes in< 15 ms.ADR-009): Relative links in Markdown, CAD assemblies, and build scripts MUST NOT break when heavy binary assets demote to local or remote L4.3. Proposed Framework
Pillar A: Cross-Discipline Boundary Routing & Partial-Overlap Collision Triage
# === [TOPOLOGY] ===(ADR-011) already locks known cross-artifact contracts via<Artifact::Anchor> -> <Artifact::Anchor> [#sig:xxxxxx]. Pillar A solves the upstream discovery problem when two disciplines intersect without shared terminology or existing edges:<Primitive>:<Scope>):<Primitive>): Constrain primary tags to 8 conserved physical and system interface classes rather than org-chart department names:thermal,clearance,structural,electrical,fluid,timing,protocol, andcompliance.<Scope>): Pair the primitive with an optional assembly, zone, or bus slug (thermal:vfd_bay,clearance:service_door,electrical:bus_24v, or wildcardthermal:*)..l3.txtheaders (Boundaries: [thermal:vfd_bay, fluid:housing_seal]) or# === [FILES] ===metadata. During--sync,tokenme-sync.pydeterministically computes the deduplicated set union of child primitives into the parent# === [SHARDS] ===mount row (e.g.,interfaces=[thermal,fluid,clearance], adding~6 to 10 tokensper multi-discipline shard and0 tokensin pure software repos).tokenme-sync.pystdlib): Extracts explicit physical unit literals (VDC,VAC,mA,kW,degC,PSI,MPa,N*m,mm,IP65,Hz), BOM part prefixes, and schematic net designators into advisory[DETERMINISTIC_PRE_SCRAPE]hints inside.l3.txtstubs and--triagepayloads.<Primitive>:<Scope>tags during[NEEDS_HYDRATION]/--triagepasses and promotes verified cross-file dependencies into hash-locked# === [TOPOLOGY] ===edges.O(1)Cross-Shard Intersection in--triage(AvoidingO(N^2)Context Scans):--triage,tokenme-sync.pybuilds an in-memory inverted indexboundary_index[primitive][scope]across all shards in< 15 msat zero LLM token cost.struct_6hexchanged),--triageintersects its<Primitive>:<Scope>tags against unlinked artifacts in adjacent shards (K <= 5) matching 1-lineDeclarative Role & Invariantsblurbs (< 600 tokenstotal).Supersedes):[CONSTRAINS]): The agent promotes the intersection into# === [TOPOLOGY] ===with[#sig:xxxxxx]so future edits to either file trigger# [SIG_DRIFT].[BOUNDARY_CONFLICT]): When two active specs impose conflicting physical constraints on the same<Scope>without a clean 1-to-1supersedesrelationship, flagging[BOUNDARY_CONFLICT]blocks--check(Exit 2) until reconciled via spec revision or ADR waiver.Pillar B: Detached Remote-L4 & Local L1-L3 Mixed-Team Sync
Under$D_{\mathrm{flat}}$ , $D_{\mathrm{native}}$ , $D_{\mathrm{cad}}$ ) and projected directory line density ($L_{\mathrm{proj}}$ ):
ADR-009, heavy assets demote to L4 under modality-weighted inclusive OR ceilings (Flat_PDFNative_PDFRaster_CADTo cut local workstation sync overhead by
> 99.9%while keeping 100% of L1-L3 context (TOKENME.txt+<filename>.<ext>.l3.txt) in the local Git working tree:read_bytes()on any L4 path,tokenme-sync.pychecksos.stat()metadata (FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS0x00400000orFILE_ATTRIBUTE_OFFLINE0x00001000on Windows;st_blocks * 512 < st_sizeon POSIX), 130-byte Git LFS pointer headers (oid sha256:), or missing local binaries backed by a co-located.l3.txtdeclaring# L4_REMOTE_URI: <gdrive:// | s3:// | https://...>. Cloud-only placeholders are never opened for local byte streaming.<filename>.<ext>.l3.txtembeds# L4_SOURCE_HASH:(.l3.txtfile (tokenme-sync.pyVerification Behavior.l3.txt/ Triage Statesha256L4_SOURCE_HASH.LOCAL_VERIFIED(orSTALE_BINARY_CHANGEDif mutated)oidor.tokenme-remote-manifest.jsonremote_hashagainst Line 3L4_SOURCE_HASHwith zero network I/O.MANIFEST_VERIFIED(or[STALE_REMOTE_L4]on drift).l3.txtOnly (Offline / No Manifest)STATE_ROOTagainst pinned.l3.txtbytes without recomputing raw L4 hash.REMOTE_PINNED_OFFLINE(see Open Question 4)%%{init: {'theme': 'base', 'flowchart': {'wrappingWidth': 380, 'nodeSpacing': 35, 'rankSpacing': 40, 'curve': 'basis'}, 'themeVariables': { 'primaryColor': '#1e293b', 'primaryTextColor': '#f8fafc', 'primaryBorderColor': '#64748b', 'lineColor': '#94a3b8', 'edgeLabelBackground': '#1e293b', 'fontFamily': 'Consolas, monospace', 'fontSize': '15px'}}}%% flowchart TB Start(["Run tokenme-sync.py (--sync / --check / --triage)"]) ScanWorkspace["Scan Local Shards, AST Signatures & .l3.txt Sidecars"] DecL4Local{"Is L4 Binary Resident<br/>& Non-Recall on Disk?"} StreamHash["Compute Streaming 64 KB SHA-256<br/>Compare vs Line-3 L4_SOURCE_HASH"] DecManifest{"Git LFS Pointer or<br/>.tokenme-remote-manifest.json?"} CompareRemote["Compare remote_hash vs<br/>Line-3 L4_SOURCE_HASH"] PinOffline["Retain Pinned L4_SOURCE_HASH<br/>(REMOTE_PINNED_OFFLINE)"] DecHashMatch{"Does L4 Hash Match<br/>Recorded Surrogate?"} FlagRemoteStale["Emit [STALE_REMOTE_L4] in Triage /<br/>Flip STATUS: STALE_REMOTE_BINARY_CHANGED"] BuildBoundaryMap["Build In-Memory Inverted Map<br/>boundary_index[primitive][scope]"] DecStructEdit{"Did Modified File Cross<br/>Unlinked Cross-Shard Boundary?"} EmitBoundedCandidates["Emit Top-K (<= 5) Intersecting<br/>1-Line Shard Blurbs in --triage"] Done(["Recompute 1-to-1 Merkle STATE_ROOT (< 15 ms)"]) Start ==> ScanWorkspace ScanWorkspace --> DecL4Local DecL4Local -->|"YES (Local Resident)"| StreamHash DecL4Local -->|"NO (Cloud Stub / Detached)"| DecManifest DecManifest -->|"YES"| CompareRemote DecManifest -->|"NO (Offline)"| PinOffline StreamHash --> DecHashMatch CompareRemote --> DecHashMatch DecHashMatch -->|"NO (Drift)"| FlagRemoteStale DecHashMatch -->|"YES (Fresh)"| BuildBoundaryMap PinOffline --> BuildBoundaryMap FlagRemoteStale --> BuildBoundaryMap BuildBoundaryMap --> DecStructEdit DecStructEdit -->|"YES"| EmitBoundedCandidates DecStructEdit ==>|"NO"| Done EmitBoundedCandidates ==> Done style Start fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#f8fafc style Done fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#f8fafc style DecL4Local fill:#2e2310,stroke:#f59e0b,stroke-width:2px,color:#fde68a style DecManifest fill:#2e2310,stroke:#f59e0b,stroke-width:2px,color:#fde68a style DecHashMatch fill:#2e2310,stroke:#f59e0b,stroke-width:2px,color:#fde68a style DecStructEdit fill:#2e2310,stroke:#f59e0b,stroke-width:2px,color:#fde68a style FlagRemoteStale fill:#450a0a,stroke:#dc2626,stroke-width:2px,color:#fef2f2 style EmitBoundedCandidates fill:#1e293b,stroke:#38bdf8,stroke-width:2px,color:#e0f2feImportant
Zero-Dependency Polling Boundary (
ADR-006):tokenme-sync.pynever importsboto3,google-api-python-client, or network auth SDKs..tokenme-remote-manifest.jsonis an optional flat JSON ledger populated out-of-band by CI jobs (rclone lsjson --hash), lightweight cloud folder webhooks, or Git LFS pointer inspection.4. Open Architectural Questions for Discussion
Before locking any part of Pillar A or Pillar B into
ADR-018+, I am looking for feedback on four unresolved design seams:Pillar A): Does a closed 8-primitive set (thermal,clearance,structural,electrical,fluid,timing,protocol,compliance) paired with a repo-local<Scope>slug cover cross-discipline intersections cleanly, or should rootTOKENME.txtallow a bounded custom primitive declaration (# CUSTOM_BOUNDARIES: [optical, acoustic]) without re-opening synonym drift across teams?Pillar A): What is the cleanest stdlib regex boundary for Phase 1 unit and net pre-scraping so genuine engineering limits (24 VDC,85 degC,150 PSI,+/- 0.1 mm) surface as hydration hints without firing false positives on hex constants, UI pixel values (12px), or version strings?--triage(Pillar A): In a large repository where 30+ artifacts carry an unscoped tag likethermal:*orcompliance:*, emitting all matching rows defeats token bounding. Should--triagehard-cap cross-shard collision hints atK <= 5(ranked by exact<Scope>match first) and emit a[WARN: HIGH_FANOUT_BOUNDARY]advisory prompting the agent to sub-scope the locus (thermal:power_bay)?REMOTE_PINNED_OFFLINE(Pillar B): When raw L4 bytes are absent locally and no.tokenme-remote-manifest.jsonor Git LFS pointer is present, should standardtokenme-sync.py --checkexit0against the pinnedL4_SOURCE_HASHinside.l3.txt(emitting an out-of-bandstderradvisory perADR-017, while adding--require-remote-manifestfor strict CI gates), or fail closed whenever remote hash provenance cannot be cross-checked locally?All reactions