# Author prompts that agents can follow A codon runs without you. Once a hank starts, the agent receives your prompt, a workspace, and nothing else: no conversation, no clarification, no second chance to say what you actually meant. Everything the agent needs to do the task correctly has to be in the prompt text, and anything extra in that text costs tokens and attention without helping. This page is about writing prompts that survive that arrangement. It covers the structure a reliable prompt tends to have, the workspace facts the agent cannot guess on its own, how to anchor file paths so the agent does not go searching, how to keep maintainer notes out of the model's context, where standing rules belong, and how to validate the wiring before you spend a run on it. The examples come from shipped fixtures, so you can check each one against a real prompt. ## Give every prompt four parts A prompt gives a codon – one sealed agent task in the sequence – what it needs to work without us beside it. Four parts cover that need: * **Context** – what the task is. * **Process** – which steps to take. * **Constraints** – what not to do. * **Output** – what success looks like and which files to write. Not every prompt needs all four as labeled sections. For a simple task, **Process** and **Output** are enough, folded into plain prose. For a fuller task, rename the parts to headings that fit the domain. The skeleton below is an illustrative template, not a shipped prompt: ```text Context: Process: 1. 2. Constraints: Output: ``` The `minimal-single-provider` quickstart prompt shows the brief end of that range. It anchors the input and output, gives two requirements, preserves the source deadline, and sets a short line limit – all in a few sentences: ```markdown # Summarize the meeting notes Read the file `notes.txt` inside the `read_only_data_source` directory in your current working directory (use shell commands like `cat` — the directory may be a symlink). Write `summary.md` in the current working directory containing: 1. A one-sentence summary of what the meeting decided. 2. Exactly three bullet points: one decision, one owner, one deadline — taken from the notes. Keep the deadline's wording from the notes. Do not infer a month, year, calendar date, or other detail that the notes do not give. Nothing else. Keep it under 15 lines. ``` The `anchor-hank` fixture shows the fuller end. Its prompt opens with role and context, then uses `Read`, `Extract`, and `Write` sections. In the excerpt below, a line containing `…` marks omitted source lines; it is not literal prompt or output content: ```markdown # Normalize Aster (Datalab dialect) You are the mechanical extraction stage for supplier **Aster Metals (AST)**. Aster submitted **two** documents against RFQ NC-RFQ-0042 — extract both, faithfully, and do not decide between them. Which one wins is a judgment call for the `validate-and-repair` codon, not you. … Use shell commands (`cat`, `ls`) to read from `read_only_data_source/` — it may be a symlink, so avoid the native Read/LS tools on it. … Write a single JSON array of the two envelope objects — the original document first, then rev2 — to `./envelope-aster.json` relative to the working directory returned by `pwd`. The agent workspace is already the current directory. Do not add an execution-directory prefix or write under `read_only_data_source/`. Before finishing, run `test -s ./envelope-aster.json`. This file is the contract for `validate-and-repair`: it must be able to load `envelope-aster.json` and see both Aster submissions independently, with nothing pre-merged or pre-decided. ``` When precision matters, go further and prescribe the artifact itself. Require every field, copy source values verbatim, use `null` for a value the source lacks, and prohibit computing, converting, or inferring values. If an item does not resolve cleanly, route it to a named ledger – a file that records the item and its reason – rather than dropping it. Continuing should never mean silently omitting an item. We work through that rule in [validate and repair](/tutorial/3-validate-and-repair). The anchor's failure-routing line and output headings make that rule visible: ```markdown You check ALL normalized envelopes (eight suppliers: AST, BCN, CDR from the dialect codons; DVR, EMB, FJR, HBR, IRS from the extracts codon) plus the intake survey against the RFQ contract and the corpus lookups, repair what you can repair deterministically, and route everything else — including one deliberately unresolvable judgment call — to a typed exception ledger. **Continue must never mean silent omission**: if a line, a part, or a whole quote doesn't cleanly resolve, it must appear in `exception-ledger.json` with a reason. It may never simply vanish from your output. … **`validated-records.json`** — a JSON array, one object per line that survived Steps 1–3 (the losing Aster document's lines are dropped here, since Step 1 already logged that as a conflict), with exactly these fields: … **`exception-ledger.json`** — a JSON array, one object per exception you emitted above, with exactly these fields: ``` For a task that produces a file, make writing part of success: require the agent to write the artifact's skeleton first, extend it in at least four write steps, and self-verify with `wc -l` before finishing. For tight-versus-loose prompt strategy and how to account for context the agent lacks, see [designing codons and handoffs](/author/designing-codons-and-handoffs). ## Explain the workspace before assigning work The four parts tell the agent what to do; they do not tell it where it is. During a run, the agent's working directory is `agentRoot/`, a workspace inside the managed execution directory. Task inputs are exposed there as `read_only_data_source/`, and prompt-named outputs land in `agentRoot/`. The agent knows none of this unless the prompt says so. See [the runbook](/operate/runbook) for output management and [the execution directory](/reference/execution-directory) for link and store mechanics. The `init-fixture` shipped scaffold states the convention directly: ```markdown # Project Analysis (Haiku) Please analyze the files in the `read_only_data_source` directory located in the current working directory and create a comprehensive analysis report. Your analysis should include: 1. Very brief overview of the files in that directory Please create your analysis in a file called `analysis-haiku.md` in the execution directory. ``` Explain the read method too. The data directory is exposed through a symlink at `agentRoot/read_only_data_source/`; when symlinking fails, a copy is used. The captured text prompts above use `cat` and `ls` to avoid native-tool symlink problems. Use that guidance for text when the harness provides an authorized shell, not as a universal replacement for every file-reading tool. For an image, shell output from `cat image.png` is file bytes, not an image attachment the model can inspect. A native image read can expose visual content only when the selected model accepts images and the harness passes that format through as image content. Name the available image-reading tool in the prompt only after checking that route. If visual inspection is required but unavailable, the codon must report that limitation rather than claim it inspected the image. This is capability guidance, not a capture proving every image format or model route. Keep three layers separate when writing tool instructions: the **model** supplies reasoning and input modalities; the **harness** supplies the actual tools and session behavior; the **execution host** supplies installed programs, credentials, filesystem access, and network access. A model name does not guarantee a browser, image reader, shell executable, or the same tools as your authoring environment. See [models and harnesses](/reference/models-and-harnesses#two-harnesses-one-dispatch-rule). `agentRoot/` is a working directory, not a sandbox. Likewise, `read_only_data_source` is a convention: its symlink or copy does not enforce read-only filesystem permissions. The Claude Agent SDK route sets `permissionMode: "bypassPermissions"` for harness permission prompts; that does not grant operating-system privileges, change mount permissions, or override host/tool policy. Enforce isolation with the host's permissions and deployment controls, and keep prompt prohibitions as an additional instruction rather than a security boundary. Give the agent an inventory instead of asking it to explore: ```text - read_only_data_source/: read-only inputs - (the agent workspace)/: files to create - /: utility scripts -