Part 1: For modders · 7 sections · page built 2026-12-05 00:35 UTC

Test and debug a mod

Do this with an agent

Turn on Papyrus logging, write a test plan with sf-test-plan, play a test session, collect the logs with sf-log-collector, and read them with papyrus-log-check, which marks each rule PASS, FAIL or NOT SEEN. Before and after saves, checked with sf-save-health, show what a test left behind.

Richard is modding

What's new

  • 2026-12-03. The page now has a Richard is modding panel that links to Richard's mods at Creations and Nexus Mods, and to Help Richard Help You.
  • 2026-11-29. This page has a new look, the same as the other Richard Presents pages, with a menu that lights the section you are reading, a short summary at the top and this What's new box.
  1. 1Turn on Papyrus logging and check it.
  2. 2Write a test plan and a rule file.
  3. 3Play a test session on a new character.
  4. 4Collect the logs.
  5. 5Read them and mark the steps.

What you need

  • sf-test-plan 0.5.1 (Python 3.10 or newer), papyrus-log-check 0.5.0 (Python 3.9 or newer), sf-log-collector 2.1.0 (Windows PowerShell 5.1 or 7), sf-save-health 0.7.4 and sf-save-reader 0.1.3 (the .NET 9 runtime), and sf-mod-build 0.7.2 for doctor. Install them as in Getting started.
  • Scripts that log. The tools only check what your mod writes. Your scripts need Debug.Trace lines with a mod prefix, and you must never compile with -release, which strips them. Code builders get a "Show Debug Messages (PC only)" switch from BuildKit's GameplayOptions.Debug. It lives in the mod's own Gameplay Options group and is off by default.
  • A new character. Test on a new character so old saves can't hide a problem.
  • Your setup. Steam and Game Pass use the same Documents\My Games\Starfield folder. Vortex doesn't move StarfieldCustom.ini, so edit it in Documents. Under Mod Organizer 2 (MO2), if the profile uses profile-specific INIs, edit the profile's StarfieldCustom.ini. Logs still go to Documents. The log collector needs -MO2Path for MO2.
  • A backup of your saves before a test, and the game closed before you collect logs.

Steps

1. Turn on Papyrus logging

In Documents\My Games\Starfield\StarfieldCustom.ini add a [Papyrus] section with these three lines, then restart the game.

[Papyrus]
bEnableLogging=1
bEnableTrace=1
bLoadDebugInformation=1

Logs go to Documents\My Games\Starfield\Logs\Script\, and Papyrus.0.log is the newest. If you build with sf-mod-build, doctor checks these lines for you and finds the game, the CK tools and .NET. It is read-only.

Command Prompt
sf-mod-build doctor

2. Write a test plan

new writes a starter plan. Edit it so each step says what to do and what you expect.

Command Prompt
sf-test-plan new MyMod.testplan.md --mod MyMod

check tests the plan without writing anything, and build writes MyMod.testplan.html, a checklist page you open in a browser.

Command Prompt
sf-test-plan check MyMod.testplan.md
Command Prompt
sf-test-plan build MyMod.testplan.md

The plan has a run: line. Change it for every new build, or old marks will show on changed steps. Console commands in backticks get a Copy button on the page.

3. Write a rule file

rules writes a starter rule file for papyrus-log-check from your prefix and plugin name, with one rule for each log: <id> line in the plan. Add a log: line under each step that the mod's log can prove first. The starter plan from new has none, so on it rules prints 0 log ids on 0 steps and writes no file.

Command Prompt
sf-test-plan rules MyMod.testplan.md --prefix MYM --plugin MyMod.esm

The tool only guesses patterns. Edit each pattern, and move lines that must never appear to forbid. Then run check again with --rules.

Command Prompt
sf-test-plan check MyMod.testplan.md --rules MyMod.logrules.json

Without --out, rules writes the plan's name with .logrules.json (MyMod.testplan.md gives MyMod.logrules.json). It never replaces a file unless you add --force.

4. Play a test session

Start a new character, install your build, and work through the plan page. Mark each step Pass, Fail or Skip, with notes. Export the marks before you rename or move the plan, because marks live in your browser. When you finish, quit the game.

5. Collect the logs

For a before and after pair of saves, add -SavePair. The collector takes the two newest manual saves.

Command Prompt
powershell -ExecutionPolicy Bypass -File .\Collect-StarfieldTestLogs.ps1 -SavePair

The zip goes to Documents\StarfieldLogs\. To send it to a mod author or hand it to an AI assistant, add -Redact (or answer y when the double-click run asks). It replaces your user folder with %USERPROFILE%, your Windows user name with <user>, your computer name with <computer> and your Steam account number with <steam-id> in every copied text file. Saves, screenshots and file names are left as they are, and so is anything else that isn't text. A text file that can't be redacted is left out of the zip with a warning. The summary's Redacted: line says how many files changed. Without -Redact, the logs are copied as they are, so folder names can appear in them. Either way, look inside before you post the zip anywhere.

Command Prompt
powershell -ExecutionPolicy Bypass -File .\Collect-StarfieldTestLogs.ps1 -SavePair -Redact

6. Read the logs

Command Prompt
python -I papyrus_log_check.py <StarfieldLogs-zip> --rules MyMod.logrules.json

Without a rule file of your own, the starter pack explains the game's common error lines. Give its three files as three --rules.

Command Prompt
python -I papyrus_log_check.py <StarfieldLogs-zip> --rules rules\papyrus-runtime-errors.logrules.json --rules rules\papyrus-scripts-and-properties.logrules.json --rules rules\papyrus-saves-and-load.logrules.json

The report pair logcheck-....txt and .json goes to out\ next to the script.

To see everything one mod wrote across all your test runs, use the prefix mode (papyrus-log-check 0.5.0, released 2026-12-01). It searches every .zip that your log collector made in one folder, oldest first (zips in subfolders aren't read), for the lines that hold your mod's prefix, and it reads no rule file. --prefix is plain text in any letter case, such as [MYMOD], and you can repeat it. --scripts is the start of your script names, such as MYMOD_: a Papyrus error that names one of those scripts is shown whole, with its stack: line. --since and --until leave out zips made before or after a day (YYYY-MM-DD, both days included). A zip's day comes from the stamp in its name, so the range picks whole zips, and a log line carries only a time of day.

Command Prompt
python -I papyrus_log_check.py --logs-dir "<folder of collector zips>" --prefix "[MYMOD]" --scripts MYMOD_ --since 2026-11-20 --until 2026-11-23

The run writes prefix-run<stamp>.txt and .json into out\ and ends with a RESULT: line. The release's README shows it on three made-up zips for the made-up mod Tidewater Errand, one of them outside the date range:

prefix mode: D:\TestLogs, 2026-11-20 to 2026-11-23
  StarfieldLogs-20261120-101500.zip  1 lines
  StarfieldLogs-20261122-190000.zip  2 lines
RESULT: FOUND, 3 lines in 2 of 2 zips (prefix [MYMOD]: 2, scripts MYMOD_: 1 lines in 1 errors), 1 left out by date

Exit 0 means at least one line was found. Exit 1 means none was (the mod never logged, or the date range leaves out every zip). Exit 2 is a refusal: a bad date, --prefix together with --rules, a folder with no .zip in it, or no zip in the range holding a Papyrus log that can be read. A zip it can't read is listed as SKIPPED and the run goes on.

7. Mark the steps the log proves

logs turns a papyrus-log-check JSON report into marks for your plan. It finds your mod in the report by the plan's mod: line, so keep that the same as the mod name in your rule file. If they differ, or the report holds only the starter pack, add --mod <name>.

Command Prompt
sf-test-plan logs <report.json> --plan MyMod.testplan.md

logs writes a marks file next to the report, and it replaces an existing marks file only with --force. That includes the default marks file, so running logs a second time on one report needs --force:

Command Prompt
sf-test-plan logs <report.json> --plan MyMod.testplan.md --force

Then open the plan page, use its Import button on that marks file, and use Export. Give the exported file to import, which adds it to the plan's results. The marks file from logs alone holds none of your own page marks. For each step the newer mark wins, but a mark from the log never replaces a mark or note you made yourself, and import follows the same rule when a file holds both (since sf-test-plan 0.5.0). A rebuild then shows the marks. The import summary counts every check that has no mark as "not run", also the deep checks of a smoke round.

Command Prompt
sf-test-plan import <marks.json> --plan MyMod.testplan.md

8. Check the saves

solo compares the save from before the test with the save from after it and reports only what changed. Give it a zip made with -SavePair. A zip without the pair holds no before and after saves, and solo exits 3.

Command Prompt
sf-save-health solo <StarfieldLogs-zip>

To read what a save remembers about your quests, with their stages, use sf-save-reader.

Command Prompt
sf-save-reader quests <save.sfs> --data --filter MYM --details

Test a quest

Test a quest stage by stage. Give each stage one check that plays the stage, one check that types getstage <QuestID> in the console and says what number to expect, and a note: that names the console fix (setstage <QuestID> <stage>) for a stage that never starts. A stage you moved by hand is a Fail, so mark it. The mod writes one Debug.Trace line for each stage change, and the plan's log: ids point at those lines.

Before you play, run sf-mod-check check on the built plugin. Since sf-mod-check version 0.19.0 it warns about a stage that nothing in the plugin sets (quest-stage-unset) and about a script that sets a stage the quest doesn't have (quest-stage-missing), so you don't spend a play-through on a stage that can never start. It can't see a stage that another mod or the game's engine sets, so the play test is still the proof. Build a quest mod shows the check on the tutorial quest.

The quest tutorial in this guide, A Courier's Request, is a worked example. Its plan and rule file are in the folder examples/PMTTutorialCourier/ of this guide's repository (https://github.com/taosecurity/starfield-pmt-guide). Run this in that folder:

Command Prompt
sf-test-plan check PMTTutorialCourier.testplan.md --rules PMTTutorialCourier.logrules.json

It ends 6 groups, 17 checks, 9 smoke; 0 errors, 0 warnings. On the tutorial's real test log, papyrus-log-check marked the mod PASS, and sf-test-plan logs then turned the report into Pass marks for 7 steps (2026-11-24).

The tools' own repositories also have a made-up quest example, Tidewater Errand: examples\QuestExample.testplan.md in sf-test-plan, and examples\example-quest.logrules.json with example-quest.log in papyrus-log-check, whose order rule proves that the stages came in the right order. They ship in the release zips since sf-test-plan version 0.4.1 and papyrus-log-check version 0.4.3, so you can run them from the unpacked folders:

Command Prompt
sf-test-plan check examples\QuestExample.testplan.md --rules examples\QuestExample.logrules.json
python -I papyrus_log_check.py examples\example-quest.log --rules examples\example-quest.logrules.json

The first ends 5 groups, 10 checks, 5 smoke; 0 errors, 0 warnings, and the second prints PASS Tidewater Errand 1.0.0 (run on 2026-11-25).

Copy the files, change the names, the quest ID and the log lines to your own, and keep one check per stage. The log proves only what the mod wrote. To read the stages the save itself holds, use sf-save-reader.

Command Prompt
sf-save-reader quests <save.sfs> --filter <name> --details

Example

The two tutorial mods, PMTTutorialSecondWind and PMTTutorialCourier, are the examples for this page. Each one's test plan, rule file and WALKTHROUGH.md (with the commands it ran) are in the folders examples/PMTTutorialSecondWind/ and examples/PMTTutorialCourier/ of this guide's repository. Build a mechanics mod and Build a quest mod walk through them.

Reading the results

  • papyrus-log-check. Each rule is PASS, FAIL or NOT SEEN. NOT LOADED means the mod wasn't active, and FOUND is an explain rule, which never fails. Exit 0 means no rule failed. Exit 1 means at least one FAIL. Exit 2 means bad arguments, a bad rule file or an unreadable input, and there is no report pair then.
  • sf-test-plan. Exit 0 is done (warnings are fine). Exit 1 means the plan has errors. Exit 2 means a file or option problem.
  • sf-save-health. Exit 0 is healthy. Exit 1 means warnings or notes only. Exit 2 means at least one problem, which is normal for a save made with mods no longer installed. Exit 3 means it could not check.
  • The collector. Exit 0 means a zip was made. Exit 1 means the game was running and you declined. Exit 2 means an error and nothing was zipped.

When PMT isn't enough

Note

NOT SEEN usually means the feature wasn't tested, not that it's broken. Play that step, then collect again.

Note

A silent dialogue line often means a missing voice file. Before you test a voiced mod, run sf-mod-check release on its zip: since sf-mod-check version 0.18.0 it warns about each line with no voice file (rule voice-missing). A mod with dialogue and no voice files at all gets one NOTE instead of warnings, so read the NOTE lines too. See Release a mod.

Not in PMT yet

sf-save-health doesn't check Papyrus script data in saves, such as orphaned scripts or stuck stacks. The report says so. It reads only saves from Starfield 1.16.244 (save version 153), and newer saves exit 3 until the tools are updated.

See the Coming next list

By design

Console testing is by hand. PMT runs on a PC and doesn't run the game, so you test a console build on the console.

Warning

Reports quote log lines, and logs can hold Windows user and computer names. Read a report and look inside the zip before you share either.

For CK and xEdit authors

You can use the whole page as it is. Add Debug.Trace lines with a prefix to your scripts in the CK, and compile without -release. The tools only read your logs, so it doesn't matter how the plugin was made.

For code builders

Use GameplayOptions.Debug for the debug switch, run sf-mod-build doctor before you test, and keep one rule file with your project. sf-test-plan check-build (see Release a mod) says whether the zip you tested is the one you are about to release.

Do this with an agent