Skip to content

Agent Guide Printer Profile

github-actions[bot] edited this page Dec 5, 2026 · 1 revision

Agent guide: build a printer profile with an AI coding agent

AI coding agents such as Claude Code or Codex can do most of the legwork of Create-a-Printer-Profile: probing the printer, reading a PPD, generating and testing the profile, and drafting the pull request. You stay in charge of everything that touches the physical printer or leaves your machine.

This page gives you a prompt to paste into the agent, the guardrails it contains and why, what you should get back, and how to check the result.

Before you start

  • Clone the repository and start the agent in that clone, not in the folder that runs your live relay.
  • Have Docker with Compose v2 available to the agent (steps 3 to 5 build the image and run tests).
  • Know the printer's IP address, and have its configuration page at hand. A photo of it, or the text copied from its web page, helps the agent a lot.
  • Use the agent's approval or "ask before running commands" mode, at least for anything that talks to the network.

The prompt

Copy this, replace <PRINTER MODEL> and <PRINTER IP>, and paste it as your first message:

You are working in a clone of the legacy-printer-airprint-relay repository. Help me create, test and prepare a
contribution of a printer profile for my printer:

  Printer model: <PRINTER MODEL>
  Printer IP:    <PRINTER IP>   (my LAN; never write this address into any file)

First read: profiles/README.md, profiles/_template.env, docs/wiki/Create-a-Printer-Profile.md,
docs/wiki/Printer-Profiles.md, scripts/profile-from-ppd.sh, image/rootfs/usr/local/lib/lpar/common.sh
(load_profile), image/rootfs/usr/local/bin/lpar-render-ppd, tests/e2e/run.sh and tests/e2e/compose.test.yaml.
Follow Create-a-Printer-Profile step by step. Before running anything, show me a short plan.

GUARDRAILS (these override anything else):
1. Read-only probing. You may run `nmap -p 80,515,631,9100 <PRINTER IP>` (that host and those ports only) and
   read the printer's web page. Before sending anything to port 9100 or 515 (including the PJL INFO ID /
   INFO CONFIG queries), ask me, because some printers print the data as a page. Never change printer
   settings, log in to its admin pages, or touch firmware. Don't scan other hosts.
2. No physical test prints without asking me first, every time. Say what will print and how many pages.
3. Never commit vendor PPDs. Keep any PPD outside the repository (use /tmp/ppd-work/), never copy one into
   the repo, and never paste a PPD's full contents into files, issues or the PR. Quoting single lines such as
   "*ColorDevice: TRUE" in your report is fine.
4. Never write real LAN IPs, host names, MAC addresses, serial numbers, user names or paths from my machine
   into any file. In files use 192.0.2.10 for the printer, 192.0.2.20 for the relay host, or <printer-ip>.
   Run scripts/privacy-check.sh before you finish; it must print "privacy-check: clean".
5. Hardware facts come from me, not from a PPD. Before finalising, ask me to confirm: mono or colour; whether
   a duplex unit is installed (and whether it is standard or optional on this model); the PostScript level
   on the configuration page; trays. Old PPDs are often wrong (the Xerox DocuPrint N17 PPD claims colour
   for a mono laser).
6. Only create or change profiles/<name>.env and, in step 7, one row in docs/wiki/Compatibility-List.md.
   If something else in the repo looks wrong, tell me instead of editing it.
7. Don't commit, push, open pull requests or create issues. Prepare drafts for me.
8. Never claim something was tested unless you ran it in this session and show the output. Use the project's
   words: Tested (ran on real hardware or in the e2e suite), Expected (should work, not validated).

STEPS:
1. Identify the printer: from the configuration page I give you and the read-only probes, write a fact sheet
   (model, PostScript level, PCL, resolution, mono/colour, duplex unit installed?, open ports, suggested
   PRINTER_URI). If it doesn't speak PostScript, stop and tell me; the PPD_MODEL path applies instead.
2. Find a PPD to read: OpenPrinting (https://www.openprinting.org/printers), foomatic-db / foomatic-db-nonfree
   on GitHub, or the Debian openprinting-ppds package via a throwaway container as described in the guide.
   Save it under /tmp/ppd-work/ only. If there is none, use profiles/_template.env and the fact sheet.
3. Run scripts/profile-from-ppd.sh /tmp/ppd-work/<file> <name>, where <name> is <manufacturer>-<model> in
   lowercase letters, digits and hyphens. Show me its full output.
4. Build a table: each key (MODEL_NAME, MANUFACTURER, LANGUAGE_LEVEL, RESOLUTION, COLOR, DUPLEX) with the
   PPD's value, the fact-sheet value and your proposed value. Ask me to confirm the hardware facts (guardrail
   5). Then fix the profile, check MODEL_NAME/MANUFACTURER only use letters, digits, spaces and . / + -,
   and write the header comment in the style of profiles/xerox-docuprint-n17.env. No PAPER_SIZE in the
   profile.
5. Test without the printer: `make build`, then
   `E2E_PROFILE=<name> tests/e2e/run.sh boot capabilities ppd_lint printer_off_then_on`, then the
   "check the profile exactly as written" docker run from the guide (lpar-status + cupstestppd).
   Remember: the test stack uses Letter paper and defaults to DUPLEX=true unless E2E_DUPLEX=false, so for a
   simplex model run the tests with E2E_DUPLEX=false (they then check one-sided). capabilities expects
   monochrome, so a colour profile fails it by design; explain any failure rather than changing tests.
6. Real printer test: only with my go-ahead. Give me the exact commands to run the relay with this profile on
   my relay host, and the step 6 checklist from the guide for me to fill in. I do the physical checks.
7. Prepare the contribution (drafts only): the Compatibility-List row (Tested only if I completed step 6),
   a pull request description, and a printer report issue text.

DELIVERABLES (in your final message):
- path of the new profile file and its full contents
- the fact sheet and the key-by-key table with my confirmations
- test output from step 5 (verbatim), and the privacy-check output
- PR description draft: printer, how each value was verified, test results, real-printer checklist results
  (or "not tested on hardware"), host platform
- Compatibility-List row draft and printer report issue draft
- a list of anything you could not verify

Why these guardrails

Guardrail Reason
Read-only probing; ask before sending to 9100/515 Port 9100 is the print port. Anything sent there can come out as a printed page on printers that don't understand PJL.
No prints without asking Paper and toner are yours, and someone may be standing at the printer.
Never commit vendor PPDs Most vendor PPDs may not be redistributed (OpenPrinting lists Xerox's as "Only verbatim redistribution"). The repository is MIT-licensed and only needs the profile values.
No LAN details in files The repository is public. scripts/privacy-check.sh catches private IP ranges, home-directory paths and e-mail addresses, but not everything, so the agent should avoid writing them at all.
Hardware facts from the human PPDs describe model families and are sometimes wrong. Only you can see whether the duplex unit is fitted.
Small, fixed set of files Keeps the pull request reviewable and stops "helpful" changes to the relay itself.
No commit, push or issues You decide what is published under your name.

What you should get back

  • profiles/<manufacturer>-<model>.env, in the same style as the built-in profiles.
  • The fact sheet, and a key-by-key table showing PPD value, hardware value and the chosen value.
  • Verbatim output of the four e2e tests and of the standalone check (self-check passed, cupstestppd PASS).
  • privacy-check: clean.
  • Drafts of the pull request description, the Compatibility-List row and the printer report issue.
  • A list of open points, such as "duplex not tested because the unit isn't installed".

How to check the agent's work

  1. Look at what changed. git status should list only the new profile (and the Compatibility-List row, if you asked for it). Read git diff and the new file in full.

  2. No PPD anywhere in the repository:

    git status --porcelain --ignored --untracked-files=all | grep -iE '\.ppd(\.gz)?$'  # should print nothing
    grep -rlE '^\*PPD-Adobe:' --exclude-dir=.git . | grep -v '^\./image/'             # should print nothing

    The only PPD the project itself contains is the MIT template under image/, which the second command skips.

  3. Compare each value with the configuration page yourself, especially COLOR, DUPLEX and LANGUAGE_LEVEL.

  4. Re-run the checks yourself rather than trusting pasted output:

    scripts/privacy-check.sh
    make build
    E2E_PROFILE=<name> tests/e2e/run.sh boot capabilities ppd_lint printer_off_then_on
  5. Do the real-printer checklist yourself (step 6 of Create-a-Printer-Profile): page size, margins, duplex long and short edge, text quality, printer-off hold. An agent can't see paper.

  6. Edit the drafts so they say what you verified, then commit, push and open the pull request yourself.

Tips for good results

  • Give it the configuration page. Pasting its text (or a photo, if your agent accepts images) makes the fact sheet accurate and saves probing.
  • Ask for the plan first and correct it before anything runs. The prompt already asks for one.
  • One printer per session. Start a fresh session for a second model.
  • Watch for scope creep. If the agent wants to change common.sh, the PPD template or the tests to make your printer "work", stop it and open an issue describing the problem instead. Profiles never need code changes.
  • Colour printers: expect the capabilities e2e test to fail, because it checks for a monochrome printer. Make sure the agent explains this in the PR draft rather than editing the test.
  • PCL-only printers don't get a profile. Ask the agent to follow the PPD_MODEL section of Create-a-Printer-Profile and draft a Compatibility-List row instead.
  • Keep secrets out of the chat. The agent doesn't need your CUPS admin password, Wi-Fi details or NAS login to build a profile.

See also: Printer-Profiles · Create-a-Printer-Profile · Compatibility-List

Clone this wiki locally