01 / THE APPROACHBACK TO INDEX
← BACK TO THE ZIPPER

04 / 06 — FROM CONTEXT TO A DRAFT

Connecting
the pieces.

Keep the orchestration explicit, and every attempt traceable.

The system architecture

An interactive component map of the current working implementation: the advisor interface, shared agent service, configured model, local guidance and persistent records.

Explore architecture

1. Understand the current request

The model classifies live advisor intent into one of six scenarios. Fixed-case evaluations specify the scenario separately. A new request must not be answered as an older birthday conversation merely because that text appears in history.

2. Assemble the right context

Business retrieval reads client and product data independently of test cases. Live requests do not implicitly load seeded messages, old summaries or database memories. Relevant history can be supplied explicitly. Persistent marketing opt-outs remain boundaries, even when other historical tasks are no longer current.

3. Load guidance and generate

The application loads the selected scenario skill and any configured modifier, then combines it with brand rules and structured facts. A real API adapter calls the configured model. There is no production template fallback, autonomous filesystem access or multi-agent tool loop.

4. Check, repair or stop

Deterministic rules check the three-candidate structure, Chinese text, price claims, stock language, marketing boundaries and care restrictions. A failed output can receive one repair call. A narrow off-task greeting check catches one known failure pattern; it is not a general semantic judge.

5. Store the actual attempt

Each request gets a run_id before model calls. Inputs, model metadata, versions, timing, attempt traces and final status are retained. Candidate and evaluation rows commit atomically. Draft candidates are not stored as messages already sent to the client.

6. Keep deployment simple

Docker Compose runs nginx in front of a Python backend, with a persistent SQLite volume. The database service initialises or migrates and exits. The current application is a single-instance demonstration; public model access still needs deployment controls and call limits.

The working pipeline

  1. CURRENT REQUEST → INTENT
  2. INTENT → SCENARIO SKILL
  3. FACTS + GUIDANCE → REAL MODEL
  4. THREE DRAFTS → CHECKS
  5. ONE REPAIR OR A CLEAR FAILURE
  6. RUN RECORD → ADVISOR CHOICE