Designing a Rigorous AI Consultation Flow with an All-Plugin Architecture

    This article explains how an "everything is a plugin" architecture supports a rigorous, auditable AI consultation workflow for high-constraint healthcare and traditional medicine learning scenarios. It breaks the process into four pluggable stages—information intake, symptom and sign collection, differential matching, and evidence verification—and shows how stage gating, option-based input, confidence thresholds, and mandatory evidence checks keep the flow controllable and traceable. Readers will find practical design notes, pseudocode, safety and compliance boundaries, and deployment recommendations.

    1. Background: Why an All-Plugin Architecture Fits Rigorous Consultation

    As intelligent coding tools and agent frameworks continue to evolve, the “everything is a plugin” architecture is being adopted more widely. In this model, the model itself only handles intent understanding and content generation, while business capabilities, data access, validation rules, and interaction patterns are all pushed down into replaceable plugins. For high-constraint scenarios such as healthcare and traditional medicine formula learning, this decoupling is especially valuable—because the core requirement is not “answer fast,” but “ask thoroughly, judge reliably, verify sources, and stay accountable.”

    The traditional approach stuffs all logic into one long prompt, which makes the flow uncontrollable, thresholds unverifiable, and outputs untraceable. A plugin-based architecture splits the flow into independent stages. Each stage does one thing and can be tested, replaced, and audited separately. The example below uses a “classical formula consultation assistant plugin” as a general illustration of how to design an executable, rigorous flow.

    2. Overall Design: Splitting Consultation into Four Pluggable Stages

    A reliable consultation flow plugin typically includes four types of capability plugins:

    • Information intake plugin: collects basic information and the chief complaint in a structured way;
    • Symptom and sign plugin: refines the chief complaint into enumerable options;
    • Differentiation and matching plugin: produces candidate options with confidence scores;
    • Evidence verification and output plugin: performs literature checks and final generation.

    The key constraint is that these four plugin types communicate through explicit stage parameters, and no stage is allowed to advance if it fails to meet its requirements. A schematic call sequence looks like this (structure only, not a specific product API):

    1. consult({stage: "intake"}) // basic information
    2. consult({stage: "symptoms"}) // symptom refinement
    3. consult({stage: "signs"}) // tongue / pulse / vital signs
    4. differentiate() // differentiation and candidates
    5. evidence({query}) // literature and clause verification
    6. prescribe() // output after review

    3. Interaction Design: Replace Long Questionnaires with Option Cards

    The first pain point of rigorous consultation is uncontrollable user input quality. The core practice of the plugin approach is “make every question option-based”:

    1. The basic information stage collects six items: name, age, gender, chief complaint, disease duration, and special conditions (such as pregnancy, postpartum, or breastfeeding), avoiding omission of key background.
    2. The chief complaint uses multiple choice plus free-form supplements, covering common categories of discomfort and reducing typing effort.
    3. The symptom stage breaks discomfort into multiple multiple-choice groups, commonly covering nearly a hundred symptom items, with tongue and pulse signs listed separately as traditional medicine features.
    4. The sign stage offers both range options and numeric entry for temperature, blood pressure, and pulse, balancing ease of use and precision.

    The benefit of option-based input is not only a smoother experience. More importantly, it ensures the downstream matching algorithm receives normalized data instead of natural-language noise.

    4. Confidence Gating: Better to Ask More Than to Conclude Early

    This is the dividing line for whether the whole flow can be “serious.” The differentiation plugin should build in confidence thresholds. Typical rules include:

    • Do not return candidates when main symptoms are insufficiently matched;
    • Do not return candidates when the highest match score is below a threshold (for example, 60%);
    • Do not return candidates when the gap between the top and second choice is too small (for example, below 8 percentage points, relaxed to 4 percentage points at high match levels);
    • Cap automatic follow-up rounds (for example, three rounds), after which the flow prompts the user to supply more information.

    Pseudocode:

    1. def differentiate(state):
    2. if state.main_symptoms_hit < MIN_HIT:
    3. return ask_more(state)
    4. ranked = rank_candidates(state)
    5. top, second = ranked[0], ranked[1]
    6. if top.score < 0.60:
    7. return ask_more(state)
    8. if top.score - second.score < (0.04 if top.score > 0.85 else 0.08):
    9. return ask_more(state)
    10. return show_candidates(ranked)

    This gating exposes uncertainty explicitly instead of masking it with vague wording.

    5. Evidence Verification: Output Only When Sources Can Be Found

    The output plugin must take on a review role: it combines a built-in classical clause knowledge base with real-time public medical literature retrieval to form dual evidence. The output plugin releases results only when verification concludes “supported by evidence.” Otherwise, it rejects directly and returns alternative directions, sending the flow back to the differentiation stage to reconverge.

    The engineering focus here is that the “rejection path” matters as much as the “release path.” On rejection, returning structured reasons (missing main symptoms, insufficient match, literature conflict) is what drives the flow to fall back automatically, rather than looping endlessly or forcing output.

    6. Structured Defense: Giving the Tool the Ability to Self-Correct Under Challenge

    A rigorous tool must handle challenges. You can design a defense plugin: when a user raises an objection, the tool either cites the original text and literature identifiers to stand by its conclusion, or acknowledges and corrects it on the spot. This relies on two things: evidence snippets must be citable and locatable, and the output structure must support “revision” rather than only “rewrite.”

    7. Safety and Compliance Boundaries

    Such plugins must state clearly that they are for learning and assistance only and cannot replace in-person diagnosis or prescriptions from licensed physicians. Dosage conversion should use a conservative clinical approach, and any plan involving toxic medicinal materials must be used under a physician’s guidance. From an engineering standpoint, disclaimers, risk warnings, and dosage conventions should be written into the plugin configuration rather than only into the prompt, ensuring every output carries them.

    8. Implementation Recommendations

    • Define the stage state machine first, then write plugins, to avoid flow drift;
    • Test each plugin independently, especially the rejection paths;
    • Make thresholds, round limits, and dosage conventions configuration items for easier auditing;
    • Have outputs consistently carry evidence citations and risk warnings;
    • Deploy plugins on general cloud capabilities such as container platforms or function computing, and use logging services plus monitoring and alerting to achieve full-chain traceability.

    The value of “everything is a plugin” is not in piling up plugins, but in breaking rigor into verifiable gates. Clear gates make the flow controllable; a controllable flow makes outputs trustworthy.