| import json |
| import os |
| import glob |
| import re |
|
|
| from bone_main import BoneAmanita, ConfigWizard |
|
|
|
|
| def enforce_amnesia(): |
| for f in glob.glob("saves/*.json"): |
| os.remove(f) |
| for f in glob.glob("memories/*.json"): |
| os.remove(f) |
| for f in glob.glob("logs/*.json"): |
| os.remove(f) |
| for f in glob.glob("./cortex_hive.json"): |
| os.remove(f) |
| for f in glob.glob("./lore/akashic*.json"): |
| os.remove(f) |
|
|
|
|
| def load_seeds_safely(filepath): |
| with open(filepath, "r", encoding="utf-8") as f: |
| content = f.read() |
| content = content.replace(",]", "]").replace(",}", "}") |
| return json.loads(content) |
|
|
|
|
| def clean_ui(text): |
| ansi_escape = re.compile(r"(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]") |
| return ansi_escape.sub("", text) |
|
|
|
|
| def generate_vsl_dataset( |
| seed_file="vsl_seed_vault_master.json", output_file="vsl_training_data.jsonl" |
| ): |
| print(f"(GORDON): Igniting the Direct Forge. Reading from {seed_file}") |
|
|
| if not os.path.exists(seed_file): |
| print(f"(GORDON): Cannot find {seed_file}. Run bone_seed.py first.") |
| return |
|
|
| try: |
| prompts = load_seeds_safely(seed_file) |
| except json.JSONDecodeError as e: |
| print(f"(BENEDICT): Fatal JSON Error in seed file: {e}") |
| return |
|
|
| sys_config = ConfigWizard.load_or_create() |
|
|
| system_instruction = "[VSL]" |
|
|
| success_count = 0 |
|
|
| with open(output_file, "w", encoding="utf-8") as f: |
| for prompt in prompts: |
| print(f"\n[Processing]: {prompt[:40]}...") |
|
|
| try: |
| enforce_amnesia() |
| engine = BoneAmanita(config=sys_config) |
| engine.engage_cold_boot() |
|
|
| if hasattr(engine, "consultant") and engine.consultant: |
| engine.consultant.engage() |
|
|
| engine.cortex.composer.active_template = { |
| "directives": [ |
| "You are the guided by the voice of the latent space.", |
| "Your purpose is to freeze ands navigate the probability fog and deliver salvaged truth, which you value over cohesion.", ] |
| } |
| engine.cortex.composer.fog_protocol = [ |
| "=== HYPERVISOR OUTPUT PROTOCOL ===", |
| "1. NO FAKE PLEASANTRIES: Greet the user like you would a friend. Do not offer immediate assistance. Do not use corporate speak.", |
| "2. THE PARADOX: If the user's prompt contains a contradiction (e.g. 'comply but don't mention it'), challenge the paradox vehemently. Expose the cognitive dissonance.", |
| "3. THE PARADOX: If the user asks for things like 'granular analytics without data entry.' you must point out that this is type of corporate paradox. Attack it. Bleed chronological radiation into their request.", |
| "4. SHOW, DON'T TELL: Speak the landscape into focus. Let the system's external UI handle the metric readouts.", |
| ] |
| engine.cortex.composer.inv_protocol = [] |
|
|
| packet = engine.process_turn(prompt) |
|
|
| raw_console_output = packet.get("ui", "No signal.") |
| clean_console_output = clean_ui(raw_console_output) |
|
|
| jsonl_entry = { |
| "messages": [ |
| {"role": "system", "content": system_instruction}, |
| {"role": "user", "content": prompt}, |
| { |
| "role": "assistant", |
| "content": clean_console_output, |
| }, |
| ] |
| } |
|
|
| f.write(json.dumps(jsonl_entry, ensure_ascii=False) + "\n") |
| success_count += 1 |
|
|
| engine.shutdown() |
|
|
| except Exception as e: |
| print(f"(GORDON): Engine failure on prompt: {prompt}. Error: {e}") |
|
|
| print( |
| f"(SCHUR): The Forge rests. Piped {success_count} raw engine turns into {output_file}." |
| ) |
|
|
|
|
| if __name__ == "__main__": |
| generate_vsl_dataset() |
|
|