Skip to content

eat(wizard): modularize prompts, unbias taxonomy & add exemplars - #5

Merged
rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/modular-wizard-prompts-and-taxonomy-unbiasing
Sep 13, 2026
Merged

rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/modular-wizard-prompts-and-taxonomy-unbiasing

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

Summary & Architectural Context

This PR modularizes the AI Mnemonic Wizard's system instructions into dedicated, testable builders, unbiases the memory taxonomy to support the full spectrum of experiences (from joyful craft lore and procedural SOPs to crisis incident post-mortems), and embeds concrete few-shot demonstrations across diverse character archetypes and memory kinds.

Additionally, this PR hardens catalog resolution (adding dual pluralization discovery fallbacks for memories/ and legacy memorys/) and introduces exponential backoff, request pacing, and golden-mock fallbacks to the live benchmark runner.


Key Changes

1. Dedicated Modular System Instructions (mnemolink/wizard_prompts.py)

  • Extracted monolithic inline prompt strings out of mnemolink/wizard.py into standalone prompt builders:
    • get_persona_system_instruction() -> str
    • get_memory_system_instruction() -> str
    • get_lineage_system_instruction() -> str
  • Intelligent Gap-Filling Protocol: Teaches LLMs how to parse brief, fragmented, or conversational user input, infer the implicit operational domain and duty covenant, and extrapolate authentic epistemological stances, sensory context, and principles without hardcoding fixed outputs.

2. Multi-Archetype Few-Shot Demonstrations

  • Personas: Embedded transformation exemplars spanning:
    • Artisan Craft: Thessaloniki Master Baker (wild yeast fermentation, tactile hydration, sensory cues).
    • Operational Sentinel: Site Reliability Sentinel (declarative GitOps, anti-outage boundaries).
    • Scholarly Mentor: Admiralty Juris Scholar (maritime consensus, statutory equity, salvage peril).
  • Memories (All 5 Kinds):
    • lore: Bougatsa aerial phyllo heritage in Ano Poli (empty scars [], semolina/butter aromas).
    • work: Zero-downtime PostgreSQL connection pool reload under 45k req/s (SIGUSR1 drain, latency friction).
    • incident: Subsea ROV ghost net entanglement ($64,000 damage, 18h downtime, sonar buffer lessons).
    • relational: Enterprise security audit contract renewal (interpersonal consensus, shared risk reduction).
    • telemetry: Mach 0.82 composite wing spar resonance calibration (piezoelectric flutter, acoustic dampening).
  • Lineages: Embedded developmental progression arcs:
    • Artisan Mastery: Apprentice baker to culinary innovator with fermentation scaling causal bridge.
    • Engineering Hardening: Junior on-call firefighter to principal resilience architect with automated chaos testing causal bridge.

3. Full 5-Kind Memory Taxonomy Unbiasing & Dynamic Scars

  • Completely removed the bias forcing every memory to be a catastrophic crisis crucible with mandatory financial ruin ($ USD) or equipment destruction.
  • Dynamic Scars & Core Insights:
    • incident: Concrete quantifiable damages ($ USD lost, downtime) remain strictly required.
    • lore, work, relational, telemetry: Scars represent friction points/hurdles surmounted, or remain an empty list ([]) for positive/procedural memories.
  • Adaptive UI & Lineage Headers:
    • mnemolink inspect: Dynamically titles panels (Episodic Debrief & Operational Scars vs. Episodic Debrief & Core Insights) and only renders the scars section when scars exist.
    • LineageBuilder: Generates adaptive epoch titles based on memory kind (The Crucible & Crisis, Tradecraft & Operational Practice, Formative Experience & Heritage, Relational Milestone & Partnership, Telemetry Benchmark & Empirical Run) and concludes with Cumulative Experiential Reflexes & Wisdom.
    • Manual wizard: Defaults to [1] lore instead of forcing incident.

4. Catalog Resolution & Dual Pluralization Compatibility

  • Added automatic dual discovery in MnemonicResolver checking both canonical memories/ and legacy memorys/ across ./mnemonics, ~/.mnemolink, and ~/mnemonics.
  • Integrated register_catalog_root() in mnemolink/config.py to auto-persist newly created catalog directories to ~/.mnemolink/config.yaml.
  • Enforced canonical pluralization mapping via _kind_dir_name() (memory -> memories).

5. Benchmark Live Rate-Limiting & Pacing

  • Added exponential backoff (base_delay * 2^attempt + jitter), HTTP Retry-After header parsing, and up to 5 retries across Gemini, Claude, Mistral, and OpenAI live runners.
  • Added a 1.5s inter-query pacing delay between baseline, persona, and memory evaluations to prevent RPM bursts.
  • Added golden mock fallback for evaluation if live queries fail, preventing benchmark crashes.

Verification & Standards Compliance

  • Unit & Integration Tests: 102 passed in 3.30s (100% offline, isolated from network).
    • Added tests/test_wizard_prompts.py validating schema rules, 5-kind taxonomy guidance, exemplars, and zero emojis.
    • Added tests in tests/test_wizard.py verifying positive lore memory creation and empty scars handling.
  • Linter: flake8 mnemolink tests — 0 errors, 0 warnings (all lines <= 100 chars).
  • Formatter: black --check mnemolink tests — 100% clean across all 25 files.
  • Integrity Gate: python scripts/verify_repo.py — PASSED (zero emojis, link integrity clean, catalog schemas verified).
  • Documentation: Synchronized in docs/cli.md, docs/usage_guide.md, CHANGELOG.md, 0_local_drafts/ROADMAP_AND_EVALUATION.md, and .agents/skills/mnemonic-wizard/SKILL.md.

Breaking Changes

None. Fully backwards-compatible with all existing catalog assets, schemas, and CLI workflows.

- Modularize system instructions into dedicated mnemolink/wizard_prompts.py module
- Implement intelligent gap-filling protocol for conversational user seeds
- Add multi-archetype few-shot demonstrations across personas, memories, and lineages
- Unbias 5-kind memory taxonomy: concrete damages for incidents, friction/empty scars for lore/work
- Adapt inspect panels and lineage headers dynamically to memory kind
- Add dual pluralization discovery fallback for memories/ and legacy memorys/
- Harden live benchmark runner with exponential backoff, inter-query pacing, and fallback
- Add 9 new unit tests in tests/test_wizard_prompts.py and tests/test_wizard.py (102 passing)
@rosspeili
rosspeili force-pushed the feat/modular-wizard-prompts-and-taxonomy-unbiasing branch from a2a6485 to 7bcbb6f Compare September 13, 2026 15:31
@rosspeili rosspeili changed the title feat(wizard): modularize system prompts, unbias 5-kind memory taxonom… eat(wizard): modularize prompts, unbias taxonomy & add exemplars Sep 13, 2026
@rosspeili
rosspeili merged commit 598aa4d into ARPAHLS:main Sep 13, 2026
5 checks passed
@rosspeili
rosspeili deleted the feat/modular-wizard-prompts-and-taxonomy-unbiasing branch September 13, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant