Making Text-Only Models Work with Screenshots in Coding Workflows

    Coding assistants built on text-only models can write code, refactor, and fix defects from logs, but they may reject image inputs or silently replace them with meaningless placeholders. This article describes an auditable preprocessing layer added to the agent or proxy lifecycle: classify each attached image, transcribe it into constrained, structured text with explicit uncertainty, and inject that text before the main model receives the message. It covers scenario-specific prompts for debugging, UI restoration, document and table extraction, and automated checks; prompt patterns that keep conclusions traceable to evidence; and engineering boundaries for privacy, permissions, replayability, graceful degradation, caching, and cost. The goal is to keep one continuous conversation for debugging, UI reconstruction, and extraction while the main model remains text-only.

    In everyday coding, handing an assistant a screenshot of an error screen, a design mockup, or a scanned page is often faster than writing another paragraph of background. To control invocation costs, many teams connect the agent wrapper of an AI coding tool to a text-only model. Function writing, refactoring, and log-driven bug fixing work smoothly. Once an image appears in the input, however, the request is rejected on the model side or becomes a meaningless placeholder.

    The problem is not a lack of prompt-writing skill. The capability boundary has been placed in the wrong position: people are forced to adapt to the model instead of letting the pipeline adapt to the way people work.

    1. Why Image Interaction Is a High-Frequency Requirement

    During front-end troubleshooting, console text, the network panel, and page layout often appear in the same screenshot. Missing any one of them can lead to a wrong diagnosis. When reproducing an interface, spacing, hierarchy, and states such as disabled, loading, and empty data matter more than scattered copy. In automated checks, a screenshot is evidence of whether the current page has reached the expected state. On the business side, teams also submit contracts, court judgments, or scanned reports and expect parties, dates, amounts, and obligation clauses to be extracted.

    The common point is that the information exists as pixels, while a text-only model can consume only symbolic sequences. If the system silently discards images, users may assume the model has “seen” them and continue the conversation on a false premise. That is more dangerous than returning an explicit error.

    2. Two Common Workarounds and Their Costs

    The first workaround is to run optical character recognition (OCR) first and paste the resulting plain text back into the conversation. This can be sufficient for text-heavy error stacks and API responses, but chart coordinates, component nesting, whether a button is disabled, and stamp positions are lost. Recognition errors can also be treated as facts in later reasoning.

    The second workaround is to switch temporarily to a model with visual capability whenever an image appears. A single turn may work, but the session is split into two parts. The repository structure, attempted modifications, and constraints from earlier context must be explained again, and the answer style and tool-calling habits are no longer continuous.

    Both approaches leave the adaptation cost with the user. Neither provides an audit trail showing which description the model relied on when making a judgment.

    3. Moving Conversion into the Proxy Lifecycle

    A more robust abstraction is this: the value of an agent comes not only from the base model but also from lifecycle points where behavior can be inserted. Before a user message is actually sent to the text-only model, a hook checks the attachments. If there are no images, the message passes through unchanged. If images are present, the hook first calls a service with vision or document-understanding capability, obtains constrained text, and then replaces or appends that text to the same context.

    The text-only model therefore always sees text only. Multimodal capability is confined to a well-bounded preprocessing stage. The main conversation’s memory, tool permissions, and coding style do not need to switch.

    The hook should do four things.

    1. Route by type. UI screenshots, design mockups, table photos, and scanned legal documents should not all use the same instruction to “describe this image.”
    2. Require structured output. Enforce headings or fixed fields so that prose-style retelling does not become impossible to reference in later prompts.
    3. Make uncertainty explicit. Blurry areas, half-cut lines of text, and illegible numbers must be marked as “unconfirmed.” Fabrication must be prohibited.
    4. Control size. Long scanned documents should be summarized page by page with page numbers preserved, so the context window does not fill up and push out the actual code and requirements.

    The following pseudocode illustrates the flow without binding it to a specific runtime:

    1. on_before_model(message):
    2. images = extract_images(message)
    3. if not images:
    4. return message
    5. notes = []
    6. for img in images:
    7. kind = classify(img) # ui_bug | mock | table | scan
    8. notes.append(vision_to_text(img, schema_for(kind)))
    9. message.text = render_context(message.text, notes)
    10. message.attachments = [] # the text-only model no longer receives pixels
    11. return message

    4. Prompting from Different Scenarios

    Debugging

    Do not ask, “What is wrong with this image?” Require a transcription organized by region: the visible error text, request path and status code, highlighted component, and user operation sequence. Separately list information that is “not present in the image and must not be assumed.”

    Then combine that transcription with the local code and the most recent change in the same prompt: “Without adding new dependencies, propose the smallest modification consistent with the visible facts above, and state which fact supports each judgment.” The text-only model is now checking evidence rather than improvising about pixels.

    UI Restoration

    For design restoration, ask for the layout skeleton first and the visual parameters second. The skeleton includes region division, reading order, repeated lists, and conditional rendering. The parameters include alignment relationships, approximate type hierarchy, color roles such as primary, danger, and disabled, and interaction states.

    Only in the second question should implementation begin: “Map the above regions to equivalents in the existing component library, and mark spacing that cannot be determined from the mockup. Do not fill it in with guessed values.” If “inspect the image and write the complete page” is bundled into one request, the model is likely to cover differences in the mockup with a familiar template.

    Documents and Tables

    For documents and tables, separate extraction from judgment. First output fields such as parties, document number, date, amount, and whether the signature block is clear, with a short quotation from the original text as evidence. Amounts, ID numbers, and similar values should follow what is shown in the image exactly, with no unit conversion. After the fields are confirmed, ask about risks or next steps.

    Scanned documents often contain seam stamps, handwritten annotations, and cross-page tables. The prompt should require that “continued tables spanning pages must mark their continuation relationship; if unreadable, leave the field blank.”

    Automated Checks

    For automated checks, the visual step should answer only with booleans plus evidence: whether the target button is visible, whether it is clickable, and whether key copy matches. Evidence should use the approximate position of an element and visible text, not a lengthy description of the scene. The subsequent text model consumes only this state to decide whether to retry, roll back, or continue. Once the state protocol is stable, the prompt does not need to be rewritten every time.

    5. Prompts Must Support Reviewability

    Smooth operation does not come from more elaborate role instructions. It comes from constraining the model to use only the observations already injected. Useful formulations include:

    • Use only content marked “confirmed” in the transcription.
    • When information conflicts with the code, list the conflict instead of choosing a side.
    • When information is insufficient, specify which screenshot region must be added, such as the network response body rather than the entire screen.
    • Output the conclusion first, then numbered evidence, then the change scope.

    For UI tasks, require the answer to include files that will not be modified, reducing broad rewrites. For extraction tasks, require a machine-parsable field list so people can spot-check it, rather than a prose summary that cannot be compared.

    There are also trade-offs in temperature and format. The transcription stage should use low randomness and reject free-form adjectives. The coding stage can be somewhat more flexible, but it must refer back to transcription IDs. If two pieces of transcribed text contradict each other, such as a status code and a page message, the conflict should be sent to the user for confirmation rather than silently resolved in the hook.

    6. Engineering Boundaries That Must Hold

    Screenshots often contain tokens, internal domains, personal information, and unreleased interfaces. Provide masking or redaction before preprocessing. Logs should retain only image hashes and transcription summaries, not raw pixels.

    Keep permissions separate for the vision service and the coding model: the former reads only the current image, while the latter has access to the repository. Transcriptions should be replayable so that reviewers can check why the model changed a given line. Degrade explicitly on failure: if the vision service times out, ask the user to paste the key text instead of sending an empty description into the main model.

    Do not turn the hook into a hidden second set of business logic. Otherwise, when something goes wrong, it will be impossible to tell whether the failure was in reading the image or in changing the code.

    For cost, trigger vision calls on demand and cache transcriptions for the same image in the same session. Repeated follow-up questions should reuse the text. This is cheaper than always using a multimodal model and more continuous than manually switching models.

    If the enterprise already has object storage, asynchronous task processing, and monitoring or alerting, large file scans can be placed in a queue and processed page by page, while the main session receives only progress and final fields to avoid blocking interaction. Generic capabilities such as object storage, asynchronous task processing, and monitoring or alerting on cloud platforms such as Baidu AI Cloud are suitable for supporting an upload, queue, page-by-page understanding, and summary write-back pipeline. Specific quotas, interface forms, and billing should follow the official documentation at the time and should not be hard-coded into the design.

    7. Self-Check List Before Launch

    Before launch, run regression tests with four kinds of samples:

    • A screenshot containing only error text
    • A layout mockup with almost no text
    • A skewed or blurry table
    • A multi-page scan

    Check whether placeholders leak through, whether “unconfirmed” becomes an asserted fact, whether the context still preserves the user’s original question, and whether the text-only model can still invoke its existing editing tools. Then examine the number of human steps. The ideal path is to paste an image and state the goal, not to export, run OCR, and start a new conversation.

    8. Conclusion

    A text-only model cannot see pixels, but that does not mean a coding assistant cannot handle image-based tasks. The key is to confine “seeing” to a single auditable preprocessing step, use scenario-specific structured transcription to preserve layout, state, and uncertainty, and then drive subsequent modifications and extraction with questions tightly bound to evidence.

    Users can continue to complete troubleshooting, UI restoration, and extraction in one conversation, while the machine performs adaptation at the entry point. This is closer to sustainable engineering practice than temporarily switching models or manually moving text around. It also makes it easier to turn prompting practices into reusable field specifications for the team instead of relying on individual oral experience.