In this section
- VEDIC Estate Domain Scan storage · vedic- / tools/estate_domain_scan.py lines 1–222
- VEDIC Family Pulse storage · vedic- / tools/family_pulse.py lines 1–214
VEDIC Estate Domain Scan
A Python command-line tool in the tools folder that reads spider references, domain lines and vogel shots, using SHA-256. It compiles library (`compile_library`) and scans estate (`scan_estate`).
storagevedic- / tools/estate_domain_scan.py · lines 1–222 of 222 · Entry point · pattern score (shared by 17 files)
- What it does
- It loads spider references, domain lines and vogel shots. Defines 10 functions or classes, including compile_library, source_contexts, gpu_scorer, score, scan. Uses libraries argparse, contextlib, collections, functools, hashlib. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'vedic'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: Parquet file domain-lines.parquet; SQLite database; command-line arguments. Out: JSON file spider-references.json; JSON file vogel-shots.json.
- Downstream impact
- Used directly by 2 files: VEDIC Daily Accelerator (vedic-); VEDIC Test Daily Accelerator (vedic-). Reached from 4 other entry points, including VEDIC Anatomy Workflow (vedic-); VEDIC Modular Consumer Workflow (vedic-); VEDIC Daily Operations (vedic-).
- What it achieves
- Compile the domain crib library and scan all unique indexed lines in ID order. It accepts `--seed`, `--spider` and `--backend`.
- Why it matters
- Imported by VEDIC Daily Accelerator. Checked by VEDIC Test Daily Accelerator.
- Application
- vedic- · tools · Python CLI
- Uses
- VEDIC Dictionary Shards (import), VEDIC Estate Crib Search (import), argparse, contextlib, collections, functools, hashlib, json, pathlib, random
- Used by
- imported by VEDIC Daily Accelerator (import), imported by VEDIC Test Daily Accelerator (import)
- Produces
- compile_library, source_contexts, gpu_scorer, scan, source_shots, sha256, spider_evidence, main, scan_estate
- Defines here
- compile_library, source_contexts, gpu_scorer, score, scan, source_shots, sha256, spider_evidence, main, scan_estate
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- vedic-@1c95ee78c2dd3f1f72c0fd5a5f6e247aaf1624e0 tools/estate_domain_scan.py:1-222 · blob 5446e10bd76fa344ff7335b793d6c4c9acb134b8 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
"""Compile the domain crib library and scan all unique indexed lines in ID order."""
import argparse
from contextlib import closing
from collections import Counter
from functools import lru_cache
import hashlib
import json
from pathlib import Path
import random
import re
import sqlite3
from time import perf_counter
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
from dictionary_shards import tokens
from estate_crib_search import DOT_CUDA
BATCH = 8192
MAX_LINE_BYTES = 4096
ROTATION_STEP = 0x9E3779B97F4A7C15
def compile_library(path):
document = json.loads(path.read_bytes())
groups = document["groups"]
if document["schema"] != "vedic.estate-crib-library.v1" or not 1 <= len(groups) <= 64:
raise ValueError("Unsupported domain library")
titles = [group["title"] for group in groups]
if len(set(titles)) != len(titles) or any(not re.fullmatch(r"[A-Z]+(?: [A-Z]+){0,4}", title) for title in titles):
raise ValueError("Expected distinct compact domain groups")
vocabulary = sorted({word for group in groups for role in ("actions", "objects") for word in group[role]})
columns = {word: index for index, word in enumerate(vocabulary)}
cues = np.zeros((len(vocabulary), 2 * len(groups)), dtype=np.float32)
for index, group in enumerate(groups):
for role_index, role in enumerate(("actions", "objects")):
if not group[role]:
raise ValueError(f"Group needs both action and object clues: {group['title']}")
for word in group[role]:
cues[columns[word], 2 * index + role_index] = 1
return groups, columns, cues
def source_contexts(database, groups, maximum_id):
by_tablet = Counter()
origins = database.execute("SELECT DISTINCT repo, path, tablet FROM occurrence")
for repo, path, tablet in origins:
repository = repo.rsplit("/", 1)[-1].casefold()
path = path.casefold()
for index, group in enumerate(groups):
if repository in group["repositories"] or any(hint in path for hint in group["path_contains"]):
by_tablet[tablet] |= 1 << index
masks = np.zeros(maximum_id + 1, dtype=np.uint64)
for tablet, raw in database.execute("SELECT n, lines FROM tablet"):
mask = by_tablet[tablet]
if mask:
masks[np.frombuffer(raw, dtype="<u4")] |= np.uint64(mask)
return masks
def gpu_scorer(cp, cues, powers):
kernel = cp.RawKernel(DOT_CUDA, "cross_dot")
weights = cp.asarray(cues)
device_powers = cp.asarray(powers)
def score(matrix):
device = cp.asarray(matrix)
n, width = matrix.shape
k = cues.shape[1]
scores = cp.empty((n, k), dtype=cp.float32)
kernel(((k + 15) // 16, (n + 15) // 16), (16, 16),
(device, weights, scores, np.int32(n), np.int32(width), np.int32(k)))
hits = (scores[:, 0::2] >= 1) & (scores[:, 1::2] >= 2)
return cp.sum(hits * device_powers, axis=1, dtype=cp.uint64).get()
score(np.zeros((1, cues.shape[0]), dtype=np.float32))
return score
def scan(database, columns, cues, backend="cupy"):
powers = 2 ** np.arange(cues.shape[1] // 2, dtype=np.uint64)
gpu_score = None
if backend == "cupy":
import cupy as cp
gpu_score = gpu_scorer(cp, cues, powers)
lookup = lru_cache(maxsize=16384)(tokens)
started = perf_counter()
elapsed = cpu_seconds = preparation = 0.0
line_ids, winners = [], []
truncated = 0
cursor = database.execute("SELECT n, text FROM line ORDER BY n")
while rows := cursor.fetchmany(BATCH):
initial = perf_counter()
matrix = np.zeros((len(rows), len(columns)), dtype=np.float32)
for row, (number, raw) in enumerate(rows):
truncated += len(raw) > MAX_LINE_BYTES
terms = lookup(raw[:MAX_LINE_BYTES].decode("utf-8", errors="replace")).split()
matrix[row, [columns[word] for word in terms if word in columns]] = 1
line_ids.append(number)
preparation += perf_counter() - initial
initial = perf_counter()
cpu = matrix @ cues
expected = np.sum(((cpu[:, 0::2] >= 1) & (cpu[:, 1::2] >= 2)) *
powers, axis=1, dtype=np.uint64)
cpu_seconds += perf_counter() - initial
if gpu_score is not None:
initial = perf_counter()
actual = gpu_score(matrix)
elapsed += perf_counter() - initial
if not np.array_equal(actual, expected):
raise ValueError("CPU and GPU disagree on line domain clues")
winners.append(expected)
benchmarks = {"cupy_seconds_including_transfers": elapsed if gpu_score is not None else None,
"numpy_seconds": cpu_seconds, "line_preparation_seconds": preparation,
"peak_cached_gpu_bytes": cp.get_default_memory_pool().total_bytes() if gpu_score is not None else None,
"seconds_including_database_iteration": perf_counter() - started}
return np.asarray(line_ids), np.concatenate(winners), truncated, benchmarks
def source_shots(line_ids, lexical, contexts, groups, seed):
rng = random.Random(seed)
result = {}
for index, group in enumerate(groups):
bit = 1 << index
eligible = np.flatnonzero((lexical & bit) != 0)
if not len(eligible):
continue
rotation = rng.getrandbits(64)
positions = {}
for shot in range(len(eligible) * 4):
if len(positions) == min(4, len(eligible)):
break
selected = ((rotation + shot * ROTATION_STEP) & ((1 << 64) - 1)) * len(eligible) >> 64
positions[selected] = None
result[group["title"]] = [
{"line_id": int(line_ids[eligible[position]]),
"same_group_in_source_context": bool(contexts[eligible[position]] & bit)}
for position in positions
]
return result
def sha256(path):
with path.open("rb") as data:
return hashlib.file_digest(data, "sha256").hexdigest()
def spider_evidence(path, groups):
genome = json.loads(path.read_bytes())
ids = {node["id"] for node in genome["nodes"]}
wanted = {"Ventusltd/" + repository for group in groups for repository in group["repositories"]}
edges = []
for edge in genome["edges"]:
start, target = edge["from"], edge["to"]
start_repo, target_repo = start.split("::", 1)[0], target.split("::", 1)[0]
if target_repo != start_repo and target_repo in wanted and start in ids and target in ids:
evidence = edge["evidence"]
edges.append({"from": start, "to": target, "type": edge["type"],
"file": evidence["file"], "line": evidence["line"], "pin": edge.get("pin")})
return {"sha256": sha256(path), "graph_nodes": len(ids), "graph_edges": len(genome["edges"]),
"named_group_repositories_present": sorted(ids & wanted), "matching_feed_edges": len(edges),
"source_references": edges}
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("database", type=Path)
parser.add_argument("library", type=Path)
parser.add_argument("output", type=Path)
parser.add_argument("--seed", type=int, default=20261126)
parser.add_argument("--spider", type=Path, help="existing Spiders genome.json for local provenance references")
parser.add_argument("--backend", choices=("numpy", "cupy"), default="cupy")
args = parser.parse_args()
scan_estate(args.database, args.library, args.output, args.seed, args.spider, args.backend)
def scan_estate(database_path, library, output, seed, spider_path=None, backend="cupy"):
groups, columns, cues = compile_library(library)
with closing(sqlite3.connect(database_path.resolve().as_uri() + "?mode=ro", uri=True)) as database:
maximum_id, = database.execute("SELECT max(n) FROM line").fetchone()
context_index = source_contexts(database, groups, maximum_id)
ids, lexical, truncated, benchmark = scan(database, columns, cues, backend)
contexts = context_index[ids]
shots = source_shots(ids, lexical, contexts, groups, seed)
output.mkdir(parents=True, exist_ok=False)
spider = spider_evidence(spider_path, groups) if spider_path else None
if spider:
(output / "spider-references.json").write_text(json.dumps(spider, indent=2) + "\n", encoding="utf-8")
parquet = output / "domain-lines.parquet"
pq.write_table(pa.table({"line_id": ids, "lexical_domain_mask": lexical,
"source_context_mask": contexts}), parquet, compression="zstd")
(output / "vogel-shots.json").write_text(json.dumps(shots, indent=2) + "\n", encoding="utf-8")
receipt = {"schema": "vedic.estate-domain-scan.v1", "seed": seed,
"library_sha256": sha256(library), "database_sha256": sha256(database_path),
"lines": len(ids), "line_group_pairs": len(ids) * len(groups),
"source_context_lines": int(np.count_nonzero(contexts)),
"lexical_group_lines": int(np.count_nonzero(lexical)),
"same_domain_agreement_lines": int(np.count_nonzero(contexts & lexical)),
"any_domain_lines": int(np.count_nonzero(contexts | lexical)),
"bounded_long_lines": truncated, "backend": backend,
"exact_cpu_gpu_mask_parity": True if backend == "cupy" else None,
"groups_in_bit_order": [group["title"] for group in groups],
"spider_evidence_sha256": spider["sha256"] if spider else None,
"spider_cross_repository_references": spider["matching_feed_edges"] if spider else None,
"counts": {group["title"]: {
"lexical": int(np.count_nonzero(lexical & (1 << index))),
"context": int(np.count_nonzero(contexts & (1 << index))),
} for index, group in enumerate(groups)},
"benchmark": benchmark, "parquet_sha256": sha256(parquet), "parquet_bytes": parquet.stat().st_size}
(output / "manifest.json").write_text(json.dumps(receipt, indent=2) + "\n", encoding="utf-8")
print(json.dumps({key: value for key, value in receipt.items() if key not in {"groups_in_bit_order", "counts"}}, indent=2))
return receipt
if __name__ == "__main__":
main()VEDIC Family Pulse
A Python command-line tool in the tools folder that reads daily command queue, dictionary, translation geodesy and family research, using SHA-256. It verifies extension (`verify_extension`) and exports pulse (`export_pulse`).
storagevedic- / tools/family_pulse.py · lines 1–214 of 214 · Entry point · pattern allocate (shared by 4 files)
- What it does
- It loads daily command queue, dictionary, translation geodesy and family research. Defines 14 functions or classes, including require, key, read, write, indexes. Uses libraries argparse, copy, gzip, hashlib, json. Side effects: reads or writes files; starts processes; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'vedic'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file daily-command-queue.json; JSON file dictionary.json; JSON file translation-geodesy.json; Parquet file family-pulse.parquet; JSON file family-research.json; DuckDB queries; command-line arguments. Out: Parquet file.
- Downstream impact
- Used directly by 5 files: VEDIC Allocate Commands (vedic-); VEDIC Daily Operations (vedic-); VEDIC Source Admissions (vedic-); VEDIC Test Family Pulse (vedic-); and 1 more. Reached from 5 other entry points, including VEDIC Anatomy Workflow (vedic-); VEDIC Modular Consumer Workflow (vedic-); VEDIC Daily Source Policy (vedic-).
- What it achieves
- Bounded daily family discovery and reviewed dictionary allocation. It reads `data/translation-geodesy.json` and writes `admission/dictionary.json`. It accepts `--checkpoint` and `--output`.
- Why it matters
- Imported by VEDIC Allocate Commands and VEDIC Source Admissions. Run by VEDIC Daily Operations. Checked by 2 tests, including VEDIC Test Family Pulse.
- Application
- vedic- · tools · Python CLI
- Uses
- VEDIC Dictionary Shards (import), VEDIC Validate Dictionary (import), argparse, copy, gzip, hashlib, json, re, subprocess, tempfile
- Used by
- imported by VEDIC Allocate Commands (import), run by VEDIC Daily Operations (script call), imported by VEDIC Source Admissions (import), imported by VEDIC Test Family Pulse (import), imported by VEDIC Test Source Admissions (import)
- Produces
- require, key, read, write, indexes, allocate, verify_extension, asset_metadata, acquire, family_identities, checkpoint_cursor, family_rows
- Defines here
- require, key, read, write, indexes, allocate, verify_extension, asset_metadata, acquire, family_identities, checkpoint_cursor, family_rows, export_pulse, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- vedic-@1c95ee78c2dd3f1f72c0fd5a5f6e247aaf1624e0 tools/family_pulse.py:1-214 · blob ff8282ffe872d862690756a39991efb634aff956 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, process, storage · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
"""Bounded daily family discovery and reviewed dictionary allocation. Never execute source."""
import argparse
import copy
from dictionary_shards import PATTERNS, tokens
import gzip
import hashlib
import json
import re
import subprocess
import tempfile
import unicodedata
from pathlib import Path
from validate_dictionary import validate, verify_source_entries
ROOT = Path(__file__).resolve().parents[1]
PRODUCER = "Ventusltd/stars"
TAG = "modular-star"
ASSET = "catalog.json.gz"
MAX_COMPRESSED = 16 * 1024**2
MAX_UNCOMPRESSED = 96 * 1024**2
BATCH = 100
MAX_ADDITIONS = 20
QUEUE = ROOT / "data/daily-command-queue.json"
DICT = ROOT / "data/dictionary.json"
def require(ok, message):
if not ok:
raise ValueError(message)
def key(text):
return "".join(c for c in unicodedata.normalize("NFKC", text).casefold() if c.isalnum())
def read(path):
return json.loads(path.read_text(encoding="utf-8"))
def write(path, value):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
def indexes(entries):
words, symbols, families, senses = set(), set(), set(), set()
for e in entries:
words.add(key(e["word"]))
words.update(key(a) for a in e.get("aliases", []))
if e.get("translation_ref"):
symbols.add(key(e["translation_ref"].rsplit(":", 1)[-1]))
families.update(e.get("modular_family_refs", []))
if type(e.get("family_id")) is int:
families.add(e["family_id"])
senses.add(e["sense_key"])
return words, symbols, families, senses
def allocate(dictionary, queue, limit=MAX_ADDITIONS):
"""Allocate only explicitly reviewed, pinned functions; no inferred semantics."""
require(queue["schema"] == "vedic.daily-command-queue.v1", "queue schema")
words, symbols, families, senses = indexes(dictionary["entries"])
added, held = [], []
for c in queue["records"]:
require(c["decision"] == "REVIEWED_FOR_ADMISSION", "unreviewed command")
require(isinstance(c["family_refs"], list) and c["family_refs"] and
all(type(f) is int and f > 0 for f in c["family_refs"]), "family refs")
e = c["entry"]
name = key(e["word"])
sym = key(e["translation_ref"].rsplit(":", 1)[-1])
if not name or name in words or name in symbols or sym in words or sym in symbols or e["sense_key"] in senses or families.intersection(c["family_refs"]):
held.append({"word": e["word"], "reason": "existing word, symbol, sense or family; reconcile, do not duplicate"})
continue
if limit is not None and len(added) >= limit:
break
require(e["word"] == e["word"].upper(), "canonical command must be uppercase")
aliases=e.get("aliases", [])
require(isinstance(aliases,list) and all(isinstance(a,str) and key(a) for a in aliases), "invalid aliases")
require(len({key(e["word"]), *map(key,aliases)}) == len(aliases)+1, "duplicate aliases")
require(e["kind"] == "FUNCTION" and e["state"] == "STATIC_SOURCE_REVIEW" and e["demo"] is None, "unsupported admission")
require(1 <= len(tokens(e["word"]).split()) <= 5 and
len(e["word"]) <= 64 and len(e["purpose"]) <= 240, "command not compact")
require(e.get("application") and e["application"]["url"].startswith("https://"), "application/source reference")
require(not any(key(a) in words or key(a) in symbols for a in e.get("aliases", [])), "alias collision")
n = dictionary["next_number"]
row = dict(e, number=n, gg_id=f"GG2050-VEDIC-{n:06d}", modular_family_refs=sorted(set(c["family_refs"])))
dictionary["entries"].append(row)
dictionary["next_number"] += 1
added.append(row["gg_id"])
words.add(name); words.update(key(a) for a in e.get("aliases", []))
symbols.add(sym); families.update(c["family_refs"]); senses.add(e["sense_key"])
return added, held
def verify_extension(historic, current, queue):
"""Replay reviewed appended rows without changing any historic allocation."""
expected=copy.deepcopy(historic)
allocate(expected,queue,limit=None)
n=len(current["entries"])
require(len(historic["entries"])<=n<=len(expected["entries"]),"unreviewed extension length")
expected["entries"]=expected["entries"][:n]
expected["next_number"]=historic["next_number"]+n-len(historic["entries"])
require(expected==current,"dictionary differs from reviewed daily replay")
def asset_metadata():
release = json.loads(subprocess.check_output(["gh","api",f"repos/{PRODUCER}/releases/tags/{TAG}"], timeout=30))
a = [a for a in release["assets"] if a["name"] == ASSET and a["state"] == "uploaded"]
require(len(a) == 1, "missing producer catalogue")
a = a[0]
require(0 < a["size"] <= MAX_COMPRESSED and str(a.get("digest","")).startswith("sha256:"), "producer size/digest")
return {k:a[k] for k in ("id","size","digest","updated_at")}
def acquire(directory):
before = asset_metadata()
asset_path = directory / ASSET
with asset_path.open("wb") as output:
subprocess.run(["gh", "api", f"repos/{PRODUCER}/releases/assets/{before['id']}",
"-H", "Accept: application/octet-stream"], stdout=output, check=True, timeout=90)
with asset_path.open("rb") as stream:
raw = stream.read(MAX_COMPRESSED + 1)
require(len(raw) == before["size"] and
"sha256:" + hashlib.sha256(raw).hexdigest() == before["digest"], "producer asset changed or corrupt")
with gzip.open(directory / ASSET,"rb") as stream:
payload = stream.read(MAX_UNCOMPRESSED + 1)
require(len(payload) <= MAX_UNCOMPRESSED, "uncompressed catalogue too large")
d = json.loads(payload)
require(isinstance(d["families"],dict) and isinstance(d["family_by_hash"],dict), "producer schema")
return d, before
def family_identities(catalogue):
identities = {}
for digest, number in catalogue["family_by_hash"].items():
require(isinstance(digest, str) and re.fullmatch(r"[0-9a-f]{40,64}", digest) and
type(number) is int and number > 0 and number not in identities,
"invalid or duplicate permanent family identity")
identities[number] = digest
require(identities and all(int(n) in identities for n in catalogue["families"]),
"invalid producer placement identities")
return identities
def checkpoint_cursor(checkpoint, identities):
if checkpoint is None:
return 0
require(checkpoint.get("schema") == "vedic.daily-family-pulse.v2", "unsupported checkpoint schema")
cursor = checkpoint.get("next_cursor")
require(type(cursor) is int and cursor >= 0, "invalid checkpoint cursor")
require((cursor == 0 or cursor in identities) and
identities.get(cursor) == checkpoint.get("cursor_family_hash"),
"checkpoint family identity changed")
return cursor
def family_rows(catalogue, identities, entries, cursor):
words, symbols, mapped, _ = indexes(entries)
selected = sorted(n for n in identities if n > cursor)[:BATCH]
rows = []
for n in selected:
placement = catalogue["families"].get(str(n))
v = placement or {}
names = [x for x in v.get("names",[]) if isinstance(x,str) and x != "(anonymous)"]
possible = sorted({x for x in names if key(x) in words or key(x) in symbols})
if n in mapped:
status = "MAPPED_FAMILY"
elif placement is None:
status = "NO_CURRENT_PLACEMENT"
elif possible:
status = "POSSIBLE_EXISTING_COMMAND"
else:
status = "REVIEW_REQUIRED"
terms=set(tokens(" ".join(names)).split())
groups=sorted(p for p,words in PATTERNS.items() if terms.intersection(words))
labels=sorted({tokens(name).upper() for name in names if tokens(name)})
rows.append((n,json.dumps(names),int(v.get("repos",0)),json.dumps(v.get("places",[])),status,json.dumps(possible),json.dumps(groups),json.dumps(labels)))
return rows, selected[-1] if selected else cursor
def export_pulse(rows, out):
import duckdb
db = duckdb.connect()
try:
db.execute("CREATE TABLE pulse(family_id BIGINT, names_json VARCHAR, repository_count INTEGER, occurrences_json VARCHAR, status VARCHAR, possible_matches_json VARCHAR, pattern_groups_json VARCHAR, candidate_labels_json VARCHAR)")
if rows:
db.executemany("INSERT INTO pulse VALUES (?, ?, ?, ?, ?, ?, ?, ?)", rows)
# Parameterised destination; never copy code or the whole producer database.
db.execute("COPY (SELECT * FROM pulse ORDER BY family_id) TO ? (FORMAT PARQUET, COMPRESSION ZSTD)", [str(out)])
require(db.execute("SELECT count(*) FROM read_parquet(?)",[str(out)]).fetchone()[0] == len(rows), "Parquet round trip")
finally:
db.close()
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--checkpoint", type=Path)
parser.add_argument("--output", type=Path, default=ROOT/"receipts")
args = parser.parse_args()
d, queue = read(DICT), read(QUEUE)
prior = json.loads(json.dumps(d))
with tempfile.TemporaryDirectory(prefix="vedic-family-") as temp:
catalogue, asset = acquire(Path(temp))
identities = family_identities(catalogue)
prior_checkpoint = read(args.checkpoint) if args.checkpoint else None
cursor = checkpoint_cursor(prior_checkpoint, identities)
for c in queue["records"]:
require(set(c["family_refs"]) <= identities.keys(),"unknown Modular Star family")
added, held = allocate(d,queue)
out = args.output
if added:
validate(d,read(ROOT/"data/translation-geodesy.json"),prior)
verify_source_entries({"entries":[e for e in d["entries"] if e["gg_id"] in added]})
write(out/"admission/dictionary.json",d)
rows, next_cursor = family_rows(catalogue,identities,d["entries"],cursor)
out.mkdir(parents=True,exist_ok=True)
export_pulse(rows,out/"family-pulse.parquet")
write(out/"family-research.json",{"schema":"vedic.daily-family-pulse.v2","producer_asset":asset,
"producer_family_count":len(identities),"current_placement_family_count":len(catalogue["families"]),
"scanned_families":len(rows),"previous_cursor":cursor,"next_cursor":next_cursor,
"cursor_family_hash":identities.get(next_cursor),"status":"research_candidates" if rows else "no_change",
"dictionary_count":len(prior["entries"]),"proposed_dictionary_count":len(d["entries"]),
"proposed_additions":added,"held":held,"execution_claim":False,
"coverage":"permanent family IDs; placement metadata where present"})
if __name__ == "__main__":
main()