Canonicalize IF.* naming across dossier
This commit is contained in:
parent
88bda9a998
commit
6afd9dca6d
7 changed files with 1909 additions and 1565 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,47 +1,40 @@
|
|||
# IF.* / if.* monikers found in `DANNY_STOCKER_INFRAFABRIC_DOSSIER.md`
|
||||
|
||||
## IF.* (protocol/moniker tokens)
|
||||
|
||||
Unique: 195
|
||||
Unique: 183
|
||||
|
||||
| Token | Count |
|
||||
|---|---:|
|
||||
| `IF.TTT` | 418 |
|
||||
| `IF.emotion` | 264 |
|
||||
| `IF.GUARD` | 153 |
|
||||
| `IF.5W` | 105 |
|
||||
| `IF.bus` | 66 |
|
||||
| `IF.guard` | 62 |
|
||||
| `IF.PACKET` | 60 |
|
||||
| `IF.TTT` | 416 |
|
||||
| `IF.GOV.PANEL` | 271 |
|
||||
| `IF.emotion` | 265 |
|
||||
| `IF.GOV.QUESTIONS` | 111 |
|
||||
| `IF.SECURITY.DETECT` | 103 |
|
||||
| `IF.TRANSIT.HUB` | 92 |
|
||||
| `IF.SECURITY.CHECK` | 68 |
|
||||
| `IF.TRANSIT.MESSAGE` | 66 |
|
||||
| `IF.GOV.TRIAGE` | 64 |
|
||||
| `IF.ground` | 58 |
|
||||
| `IF.yologuard` | 58 |
|
||||
| `IF.BIAS` | 56 |
|
||||
| `IF.search` | 48 |
|
||||
| `IF.Guard` | 46 |
|
||||
| `IF.INTELLIGENCE` | 44 |
|
||||
| `IF.armour` | 41 |
|
||||
| `IF.persona` | 41 |
|
||||
| `IF.ARBITRATE` | 41 |
|
||||
| `IF.YOLOGUARD` | 38 |
|
||||
| `IF.STORY` | 29 |
|
||||
| `IF.witness` | 27 |
|
||||
| `IF.GOV.WITNESS` | 33 |
|
||||
| `IF.optimise` | 27 |
|
||||
| `IF.STORY` | 24 |
|
||||
| `IF.chase` | 24 |
|
||||
| `IF.foundations` | 23 |
|
||||
| `IF.arbitrate` | 22 |
|
||||
| `IF.BUS` | 21 |
|
||||
| `IF.CEO` | 21 |
|
||||
| `IF.simplify` | 21 |
|
||||
| `IF.garp` | 20 |
|
||||
| `IF.TRANSIT.SWARM` | 19 |
|
||||
| `IF.guardian` | 19 |
|
||||
| `IF.sam` | 19 |
|
||||
| `IF.EMOTION` | 18 |
|
||||
| `IF.vesicle` | 18 |
|
||||
| `IF.ceo` | 18 |
|
||||
| `IF.ARMOUR` | 17 |
|
||||
| `IF.resource` | 17 |
|
||||
| `IF.swarm` | 17 |
|
||||
| `IF.GOV.PANEL` | 16 |
|
||||
| `IF.federate` | 15 |
|
||||
| `IF.intelligence` | 15 |
|
||||
| `IF.emotion.typist` | 15 |
|
||||
|
|
@ -52,18 +45,15 @@ Unique: 195
|
|||
| `IF.philosophy` | 11 |
|
||||
| `IF.reflect` | 10 |
|
||||
| `IF.SEARCH` | 10 |
|
||||
| `IF.GOV.TRIAGE` | 9 |
|
||||
| `IF.SECURITY.CHECK` | 9 |
|
||||
| `IF.collapse` | 9 |
|
||||
| `IF.philosophy-database.yaml` | 9 |
|
||||
| `IF.TTT.ledgerflow.deltasync` | 8 |
|
||||
| `IF.SECURITY.DETECT` | 7 |
|
||||
| `IF.TRANSIT.MESSAGE` | 7 |
|
||||
| `IF.SECURITY.CHECK.secrets.detect` | 8 |
|
||||
| `IF.quiet` | 7 |
|
||||
| `IF.forge` | 7 |
|
||||
| `IF.story` | 7 |
|
||||
| `IF.citation` | 7 |
|
||||
| `IF.GOV.QUESTIONS` | 6 |
|
||||
| `IF.SECURITY.CHECK.secrets` | 7 |
|
||||
| `IF.TTT.ledgerflow.deltasync.REPO-RESTRUCTURE.WHITEPAPER.md` | 6 |
|
||||
| `IF.STORY_WHITE_PAPER_v7.02_FINAL.md` | 6 |
|
||||
| `IF.CRYPTOGRAPHY` | 6 |
|
||||
|
|
@ -71,9 +61,6 @@ Unique: 195
|
|||
| `IF.memory` | 6 |
|
||||
| `IF.guardian-core-01` | 6 |
|
||||
| `IF.guardian-core-06` | 6 |
|
||||
| `IF.TRANSIT.SWARM` | 5 |
|
||||
| `IF.TRANSIT.HUB` | 5 |
|
||||
| `IF.GOV.WITNESS` | 5 |
|
||||
| `IF.core` | 5 |
|
||||
| `IF.veil` | 4 |
|
||||
| `IF.talent` | 4 |
|
||||
|
|
@ -84,13 +71,12 @@ Unique: 195
|
|||
| `IF.URI` | 4 |
|
||||
| `IF.TTT.narrative.logging` | 4 |
|
||||
| `IF.Story` | 4 |
|
||||
| `IF.armour.yologuard-bridge` | 4 |
|
||||
| `IF.SECURITY.CHECK.yologuard-bridge` | 4 |
|
||||
| `IF.TTT-compliant` | 4 |
|
||||
| `IF.guard-POC` | 4 |
|
||||
| `IF.deliberate` | 4 |
|
||||
| `IF.AUDIT.TRAIL` | 3 |
|
||||
| `IF.marl` | 3 |
|
||||
| `IF.swarm.s2` | 3 |
|
||||
| `IF.proxy` | 3 |
|
||||
| `IF.geopolitical` | 3 |
|
||||
| `IF.CEO-idealistic-01` | 3 |
|
||||
|
|
@ -125,8 +111,6 @@ Unique: 195
|
|||
| `IF.SECURITY` | 1 |
|
||||
| `IF.TRANSIT` | 1 |
|
||||
| `IF.AUDIT` | 1 |
|
||||
| `IF.WITNESS` | 1 |
|
||||
| `IF.SWARM.s2` | 1 |
|
||||
| `IF.DAVE` | 1 |
|
||||
| `IF.DOSSIER.ifstory-origin-story-02-the-fuck-moment` | 1 |
|
||||
| `IF.STORY.origin.02.fuck-moment` | 1 |
|
||||
|
|
@ -157,6 +141,7 @@ Unique: 195
|
|||
| `IF.DOSSIER.infrafabric-github-api-integration-roadmap-check` | 1 |
|
||||
| `IF.chassis` | 1 |
|
||||
| `IF.persona-database.json` | 1 |
|
||||
| `IF.bus` | 1 |
|
||||
| `IF.DOSSIER.ifintelligence-real-time-research-framework-for-guardian-council-deliberations` | 1 |
|
||||
| `IF.RELATE` | 1 |
|
||||
| `IF.EMERGE` | 1 |
|
||||
|
|
@ -164,7 +149,7 @@ Unique: 195
|
|||
| `IF.TRACE` | 1 |
|
||||
| `IF.OPTIMISE` | 1 |
|
||||
| `IF.DOSSIER.ifbias-bias-risk-pre-council-decision-matrix` | 1 |
|
||||
| `IF.BIAS.precouncil.matrix` | 1 |
|
||||
| `IF.GOV.TRIAGE.precouncil.matrix` | 1 |
|
||||
| `IF.DOSSIER.ifguard-strategic-communications-council-for-ai-message-validation` | 1 |
|
||||
| `IF.DOSSIER.ifguard-research-summary-executive-overview` | 1 |
|
||||
| `IF.GUARD_COUNCIL_FRAMEWORK.md` | 1 |
|
||||
|
|
@ -195,27 +180,24 @@ Unique: 195
|
|||
| `IF.DOSSIER.history-file-error-handling-test-report` | 1 |
|
||||
| `IF.DOSSIER.cloud-session-legal-document-database-build` | 1 |
|
||||
| `IF.DOSSIER.ifbus-the-infrafabric-motherboard-architecture` | 1 |
|
||||
| `IF.BUS.v2.0.0` | 1 |
|
||||
| `IF.TRANSIT.HUB.v2.0.0` | 1 |
|
||||
| `IF.redis` | 1 |
|
||||
| `IF.dds` | 1 |
|
||||
| `IF.TTT.philanthropy.grant` | 1 |
|
||||
| `IF.philosophy-database-v1.1-joe-coulombe.yaml` | 1 |
|
||||
| `IF.GUARD.v1` | 1 |
|
||||
|
||||
| `IF.TRANSIT.SWARM.alpha` | 1 |
|
||||
| `IF.GOV.PANEL.v1` | 1 |
|
||||
|
||||
## if.* (lowercase tokens)
|
||||
|
||||
Unique: 10
|
||||
Unique: 8
|
||||
|
||||
| Token | Count |
|
||||
|---|---:|
|
||||
| `if.emotion` | 24 |
|
||||
| `if.api` | 16 |
|
||||
| `if.armour.secrets.detect` | 8 |
|
||||
| `if.bus` | 7 |
|
||||
| `if.armour.secrets` | 7 |
|
||||
| `if.bus` | 6 |
|
||||
| `if.legal` | 5 |
|
||||
| `if.armour` | 4 |
|
||||
| `if.armour` | 3 |
|
||||
| `if.ttt.ledgerflow.deltasync` | 3 |
|
||||
| `if.search` | 1 |
|
||||
| `if.infrafabric` | 1 |
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ forbidden:
|
|||
|
||||
names:
|
||||
IF.GOV.TRIAGE:
|
||||
legacy: ["IF.BIAS", "if.bias"]
|
||||
legacy: ["IF.BIAS", "IF.Bias", "IF.bias", "if.bias"]
|
||||
academic: "controversy-weighted risk stratification"
|
||||
description: "Preflight risk triage that sizes councils and decides escalation."
|
||||
|
||||
IF.GOV.PANEL:
|
||||
legacy: ["IF.GUARD", "if.guard"]
|
||||
legacy: ["IF.GUARD", "IF.Guard", "IF.guard", "if.guard"]
|
||||
academic: "multi-agent oversight with structural dissent requirements"
|
||||
description: "Council governance protocol (minimum 5 seats including a contrarian)."
|
||||
|
||||
|
|
@ -38,12 +38,12 @@ names:
|
|||
description: "Structured inquiry briefs (who/what/when/where/why/how)."
|
||||
|
||||
IF.GOV.WITNESS:
|
||||
legacy: ["IF.WITNESS", "if.witness"]
|
||||
legacy: ["IF.WITNESS", "IF.witness", "if.witness"]
|
||||
academic: "audit observation and compliance monitoring"
|
||||
description: "Independent witness that validates governance and trace discipline."
|
||||
|
||||
IF.SECURITY.DETECT:
|
||||
legacy: ["IF.YOLOGUARD", "if.yologuard"]
|
||||
legacy: ["IF.YOLOGUARD", "IF.Yologuard", "IF.yologuard", "if.yologuard"]
|
||||
academic: "context-aware secret detection"
|
||||
description: "Secret/relationship screening and credential hygiene primitives."
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ names:
|
|||
description: "Deterministic actuation + privilege enforcement substrate."
|
||||
|
||||
IF.TRANSIT.MESSAGE:
|
||||
legacy: ["IF.PACKET", "if.packet"]
|
||||
legacy: ["IF.PACKET", "IF.packet", "if.packet"]
|
||||
academic: "cryptographically signed message protocol"
|
||||
description: "Schema-first message envelope with trace IDs and audit metadata."
|
||||
|
||||
|
|
|
|||
113
tools/apply_naming_refactor.py
Normal file
113
tools/apply_naming_refactor.py
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import re
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
SCAFFOLD_HEADING_RE = re.compile(r"^(#{1,6})\s+(HOOK|FLAW|SETUP|TENSION|TWIST|PUNCH):\s+(.*)\s*$")
|
||||
|
||||
|
||||
def _build_legacy_map(registry: dict) -> dict[str, str]:
|
||||
names = registry.get("names", {}) or {}
|
||||
legacy_to_canonical: dict[str, str] = {}
|
||||
for canonical, meta in names.items():
|
||||
legacy = (meta or {}).get("legacy", []) or []
|
||||
for legacy_token in legacy:
|
||||
if legacy_token in legacy_to_canonical and legacy_to_canonical[legacy_token] != canonical:
|
||||
raise ValueError(
|
||||
f"legacy token {legacy_token!r} maps to multiple canonicals: "
|
||||
f"{legacy_to_canonical[legacy_token]!r} and {canonical!r}"
|
||||
)
|
||||
legacy_to_canonical[legacy_token] = canonical
|
||||
return legacy_to_canonical
|
||||
|
||||
|
||||
def _safe_token_regex(token: str) -> re.Pattern[str]:
|
||||
# Replace token only when it’s not inside a larger identifier/path.
|
||||
# - Disallow alnum/_ on the left (word char) to avoid mid-word matches.
|
||||
# - Disallow alnum/_ or '/' or '-' on the right to avoid touching URLs, paths, file names,
|
||||
# or hyphenated “subtokens” like IF.guard-POC.
|
||||
return re.compile(rf"(?<![A-Za-z0-9_]){re.escape(token)}(?![A-Za-z0-9_/-])")
|
||||
|
||||
|
||||
def refactor_text(text: str, *, legacy_map: dict[str, str], skip_canonicals: set[str]) -> tuple[str, Counter[str]]:
|
||||
stats: Counter[str] = Counter()
|
||||
|
||||
# 1) Remove visible scaffolding labels from headings.
|
||||
out_lines: list[str] = []
|
||||
for raw in text.splitlines(True):
|
||||
line = raw.rstrip("\n")
|
||||
match = SCAFFOLD_HEADING_RE.match(line)
|
||||
if match:
|
||||
hashes, _, title = match.groups()
|
||||
out_lines.append(f"{hashes} {title}\n")
|
||||
stats["__scaffold_heading_renames__"] += 1
|
||||
continue
|
||||
out_lines.append(raw)
|
||||
out = "".join(out_lines)
|
||||
|
||||
# 2) Apply legacy → canonical replacements.
|
||||
# Sort by length so longer tokens are replaced first (defensive; avoids any weird overlaps).
|
||||
legacy_items = sorted(legacy_map.items(), key=lambda kv: len(kv[0]), reverse=True)
|
||||
for legacy_token, canonical in legacy_items:
|
||||
if canonical in skip_canonicals:
|
||||
continue
|
||||
pattern = _safe_token_regex(legacy_token)
|
||||
out, n = pattern.subn(canonical, out)
|
||||
if n:
|
||||
stats[legacy_token] += n
|
||||
|
||||
return out, stats
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Apply IF naming refactor + remove scaffold headings.")
|
||||
parser.add_argument(
|
||||
"--registry",
|
||||
type=Path,
|
||||
default=Path(__file__).resolve().parents[1] / "IF_NAMING_REGISTRY.yaml",
|
||||
help="Path to IF_NAMING_REGISTRY.yaml",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--file",
|
||||
type=Path,
|
||||
default=Path(__file__).resolve().parents[1] / "DANNY_STOCKER_INFRAFABRIC_DOSSIER.md",
|
||||
help="Markdown file to refactor in-place",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--skip-canonical",
|
||||
action="append",
|
||||
default=["IF.AUDIT.TRAIL"],
|
||||
help="Canonical name(s) to skip when applying legacy replacements (repeatable).",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
registry = yaml.safe_load(args.registry.read_text(encoding="utf-8"))
|
||||
legacy_map = _build_legacy_map(registry)
|
||||
|
||||
content = args.file.read_text(encoding="utf-8")
|
||||
updated, stats = refactor_text(
|
||||
content, legacy_map=legacy_map, skip_canonicals=set(args.skip_canonical or [])
|
||||
)
|
||||
if updated == content:
|
||||
print("no changes")
|
||||
return 0
|
||||
|
||||
args.file.write_text(updated, encoding="utf-8")
|
||||
|
||||
print(f"updated: {args.file}")
|
||||
if stats:
|
||||
print("changes:")
|
||||
for key, value in stats.most_common():
|
||||
print(f" {key}: {value}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
65
tools/generate_monikers_used.py
Normal file
65
tools/generate_monikers_used.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
IF_TOKEN_RE = re.compile(r"\bIF\.[A-Za-z0-9][A-Za-z0-9_.-]*\b")
|
||||
IF_LOWER_TOKEN_RE = re.compile(r"\bif\.[A-Za-z0-9][A-Za-z0-9_.-]*\b")
|
||||
|
||||
|
||||
def _render_table(counter: Counter[str]) -> str:
|
||||
lines = ["| Token | Count |", "|---|---:|"]
|
||||
for token, count in counter.most_common():
|
||||
lines.append(f"| `{token}` | {count} |")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
repo_root = Path(__file__).resolve().parents[1]
|
||||
dossier = repo_root / "DANNY_STOCKER_INFRAFABRIC_DOSSIER.md"
|
||||
registry_path = repo_root / "IF_NAMING_REGISTRY.yaml"
|
||||
out_path = repo_root / "IF_MONIKERS_USED.md"
|
||||
|
||||
text = dossier.read_text(encoding="utf-8")
|
||||
|
||||
upper = Counter(IF_TOKEN_RE.findall(text))
|
||||
lower = Counter(IF_LOWER_TOKEN_RE.findall(text))
|
||||
|
||||
forbidden: list[str] = []
|
||||
if registry_path.exists():
|
||||
registry = yaml.safe_load(registry_path.read_text(encoding="utf-8")) or {}
|
||||
forbidden = list(registry.get("forbidden", []) or [])
|
||||
|
||||
forbidden_hits = [tok for tok in forbidden if tok and tok in text]
|
||||
|
||||
parts: list[str] = []
|
||||
parts.append(f"# IF.* / if.* monikers found in `{dossier.name}`\n")
|
||||
|
||||
if forbidden_hits:
|
||||
parts.append("## Forbidden tokens (should be zero)\n")
|
||||
for tok in forbidden_hits:
|
||||
parts.append(f"- `{tok}`\n")
|
||||
parts.append("\n")
|
||||
|
||||
parts.append("## IF.* (protocol/moniker tokens)\n")
|
||||
parts.append(f"Unique: {len(upper)}\n\n")
|
||||
parts.append(_render_table(upper))
|
||||
parts.append("\n")
|
||||
|
||||
parts.append("## if.* (lowercase tokens)\n")
|
||||
parts.append(f"Unique: {len(lower)}\n\n")
|
||||
parts.append(_render_table(lower))
|
||||
|
||||
out_path.write_text("".join(parts), encoding="utf-8")
|
||||
print(f"wrote: {out_path}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
Loading…
Add table
Reference in a new issue