Skip to content

Architecture

TFD-42 edited this page Aug 10, 2026 · 2 revisions

Architecture — how the pipeline works

Wild_Root_Prompt is a prompt compiler. Your rough sentence goes in one end; a heavily engineered prompt goes to the model; a structured document comes out the other end. This page walks the pipeline stage by stage.


The pipeline

raw input
    │
    ├─▶ 1. Metacommand extraction     /slash tokens → explicit directives
    │
    ├─▶ 2. PII redaction (optional)   --anonymize
    │
    ├─▶ 3. Pre-processing             LLM rewrite, or regex-only (--fast-preprocess)
    │
    ├─▶ 4. Web enrichment (optional)  DuckDuckGo search → fetch → inject
    │
    ├─▶ 5. Technique injection        N of 173 techniques appended as directives
    │
    ├─▶ 6. Memory injection           relevant prior-session context
    │
    ├─▶ 7. Prompt assembly            delimiters, priority stacking, output contract
    │
    ├─▶ 8. Generation                 1 model, or 2 in parallel (streamed)
    │
    ├─▶ 9. Synthesis (optional)       merge two outputs into one
    │
    └─▶ output + cache + memory write

1. Metacommand extraction

/slash tokens are pulled out of your text first and turned into an explicit ACTIVE METACOMMANDS — APPLY STRICTLY block. Unrecognized /tokens pass through as literal text, so file paths and URLs in a task are safe. Full list: Slash Metacommands.

2. PII redaction

With --anonymize, personal information is stripped from your task before it reaches any model — including the local one. It is regex-based and deliberately conservative; see Limitations and Roadmap.

3. Pre-processing

A model rewrites your raw input into something structured and complete: implicit requirements made explicit, ambiguity resolved, missing context surfaced. This is where a lazy one-liner becomes a real specification.

Mode Cost How
llm (default) one extra model call Full semantic rewrite
fast (--fast-preprocess) free Regex cleanup — whitespace, punctuation, spacing
off (--no-preprocess) free Raw text passes straight through

Set pre_processor_model to a small fast model — this step doesn't need your biggest one.

4. Web enrichment

When enabled and the network is reachable, the task is searched on DuckDuckGo, top results are fetched, and relevant excerpts are injected as grounding context. --summarize-web-pages condenses them first so they don't crowd out the rest of the prompt; --max-web-pages controls breadth; --deep-research lets you review and pick sources by hand.

--offline skips the whole stage, including connectivity checks.

5. Technique injection

The selected techniques from prompt_expert_methodology.json are rendered into explicit directives and appended. This is the heart of the tool: Prompt Engineering Techniques.

6. Memory injection

Relevant context from prior sessions is included so a sequence of related tasks builds on itself. Disable per-run with --no-memory, or per-prompt with /neuf.

7. Prompt assembly

Everything is composed into one prompt using the tool's own structural techniques: strong delimiters between sections, priority stacking (critical instructions at the start and the end, countering the lost in the middle failure mode), and an explicit output contract describing the expected structure.

8. Generation

Single — one model, tokens streamed live to terminal or browser.

Parallel — two models run concurrently in separate threads, rendered side by side. The point is difference: pair a systematic model with a creative one so the two outputs disagree in interesting ways.

9. Synthesis

A third pass reads both manifests and produces a unified document — not a concatenation, but a merge that keeps the strongest material from each and resolves conflicts. Available standalone (synthesis on two files) or as the tail of full.


Output modes

Quick

One enhanced prompt, ready to paste into any LLM — local or hosted. Use it while you're still iterating on the wording of your task.

Full — the 12-section manifest

  1. Title & Executive Summary
  2. Final Objective & Success Definition
  3. Execution Context & Prerequisites
  4. Ambiguity Zones to Resolve
  5. Step Decomposition (Detailed Pipeline)
  6. Control Loops & Scoring
  7. Persistent Artifacts to Maintain
  8. Constraints & Guardrails
  9. Error Handling Strategy
  10. Final Deliverable & Output Format
  11. Reproducibility Checklist
  12. Notes for the Target Agent

The structure is deliberate: sections 1–4 pin down what and why, 5–7 the execution, 8–9 the failure modes, 10–12 the handoff. It's written to be executed by an agent, not just read by a human — which is why ambiguity zones and reproducibility get their own sections.

--draft generates only sections 1–2, which is the cheapest way to check the direction is right before committing to a full run.


Code layout

File Role
prompt_expert_enhance.py Everything: CLI, menu, pipeline, pre-processor, backends, memory, cache
web_server.py Flask server, SSE streaming, the HTML/JS UI, REST endpoints
prompt_expert_methodology.json 173 techniques, 15 categories, anti-patterns, quick-reference bundles
prompt_templates.json 10 starter templates
tools/batch_test.py Batch evaluation helper
build_app.py Compiles the standalone single-icon app
install.sh / install.ps1 / install_termux.sh Per-platform installers

The CLI never imports Flask or web_server.py at module level — that's what makes the headless install possible with requests as the only dependency.


Design decisions worth knowing

Techniques live in JSON, not code. Adding or reweighting a technique needs no code change and no release. Same for templates and bundles.

Streaming is a first-class path, not an add-on. Both the terminal and the browser consume the same token stream, which is why parallel split-screen and live synthesis are possible at all.

Caching is on by default. Identical requests are served from cache/ instantly, so iterating on flags is cheap. --no-cache bypasses it.

Everything degrades instead of crashing. Missing flask disables only the web command. Missing cryptography drops memory to plaintext with a warning. A corrupt settings.json falls back field by field. No network means the web stage is skipped, not fatal.


Next: Glossary — terms used above · Comparison — how this pipeline differs from other approaches · Examples — each stage on real input · Prompt Engineering Techniques · Limitations and Roadmap.

Clone this wiki locally