n3Plugins AI Agent Handbook
This page documents the committed source. Treat revision-sensitive RuneLite UI, packet, or in-game outcomes as pending live-client verification unless the page records direct evidence.
Use this handbook for quick orientation, review protocol, and critical implementation patterns when building API, SDK, or plugin work.
Core References
Canonical guides own each stage of development:
| Topic | Canonical Document |
|---|---|
| Platform contract & lifecycle | docs/agent/RUNELITE_DEVELOPMENT.md |
| Authority order & behavioral rules | Repository-root AGENTS.md and N3PLUGINS_SOURCE_OF_TRUTH.md |
| Plugin creation workflow | agent-plugin-production-loop.md |
| Workflow driver selection | sdk-pipeline-guide.md |
| Testing & failure taxonomy | agent-testing-loop.md |
| Validation suites & manual checklist | validation.md |
| Fast-path onboarding | Repository file .agents/QUICK_START.md |
| Decision checklists & task patterns | docs/agent/DECISION_PLAYBOOK.md |
Review Flow
Review diffs in this order before finalizing:
- User request & plan: verify changes match the requested scope without hidden refactors.
- Source/SOT consistency: verify registered plugins, packages, and architecture match reality.
- API & SDK reuse: check
Api.actions.*andInteractionResultusage; ensure no duplicate helpers. - Shared ownership: verify
PacketUtilsPluginretains bootstrap, pacer, walker, and client-thread ownership. - Anti-detection & timing: check action pacing, non-deterministic humanized timing, and clean transient state reset on logout/hop.
- Tests, docs, and live notes: run focused tests, update docs, and report unverified client behavior as
Live client verification: pending.
Use stop-slop on docs. Cut filler, cite real files, and avoid claims lacking source or live client evidence support.
Docs and SOT Sync
Use Docusaurus-native admonitions for callouts in docs/: :::note, :::tip, :::info, :::warning[Caution], and :::danger. Avoid GitHub callout blockquotes (> [!WARNING]) in repo docs. See documentation-style-guide.md for authoring standards.
Keep the SOT short. Put detailed playbooks in docs and register them in docs-site/sidebars.js.
Key Implementation Patterns
1. Dialogue Mechanics
- OSRS Dialogue is Stateless: Dialogue interfaces lack persistent state. Interact immediately when a target dialogue widget appears on the current tick (once the shared
ActionPaceris ready). Avoid complex retry backoffs, lockout mechanisms, or signature tracking. - Deduplication: Implement local tick-guards (e.g.
lastFiredTick) to prevent duplicate submissions on the same tick, and invokeActionPacer.recordAction()immediately upon packet dispatch. - Widget Visibility:
Widgets.search().result()returns hidden widgets. The game destroys OSRS dialogue widgets rather than hiding them when closed.
2. Testing Constraints
- JUnit & Mockito: Never use
mockStatic,MockedStatic, ormockito-inline. Use dependency seams and injected collaborators. - Action Pacer: Always call
ActionPacer.reset()in your@Beforesetup when tests touch action pacing. - Widget API: Use
Widgets.setClientForTesting(client)in@Beforeand clean up viaresetClientForTesting()in@After. - Stubbing Order: Ensure mocks are completely defined before invoking Mockito's
when().
3. Task Pipelines: Prefer Event Yielding
- Do not poll for UI loads: When a
TaskPipelineclicks an object and expects an interface to open (e.g. Bank), avoid polling manually every tick or usingStepResult.waitTicks(). Yield the pipeline immediately usingStepResult.waitForEvent(WidgetLoaded.class, ...). This provides sub-tick precision and prevents tick spam.