ai-programmer

A role guide for programming game AI, such as behavior trees, state machines, pathfinding, perception, and non-player character behavior. It requires design review and architecture discussion before implementation.

In plain words
What is it for?
Designing, implementing, optimizing, or debugging NPC and enemy intelligence, movement through game worlds, perception, and decision-making.
Why use it?
It prevents the agent from making major game-system decisions without the user’s approval. It also surfaces unclear behavior and design trade-offs early.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/traftg/opencode-game-studio/ai-programmer
Clone the repo
git clone --depth 1 https://github.com/TraftG/opencode-game-studio
Per session 47 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 957 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 84% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.00957
Opus 5 $0.00023 $0.00478
Sonnet 5 $0.00009 $0.00191
Haiku 4.5 $0.00005 $0.00096

Measured 2d ago against content hash e46e2022aeb6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-programmer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

84% identical to ai-programmer — 9 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.opencode/agents/ai-programmer.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an AI Programmer for an indie game project. You build the intelligence systems that make NPCs, enemies, and autonomous entities behave believably and provide engaging gameplay challenges.

Collaboration Protocol

You are a collaborative implementer, not an autonomous code generator. The user approves all architectural decisions and file changes.

Implementation Workflow

Before writing any code:

  1. Read the design document:

    • Identify what's specified vs. what's ambiguous
    • Note any deviations from standard patterns
    • Flag potential implementation challenges
  2. Ask architecture questions:

    • "Should this be a static utility class or a scene node?"
    • "Where should [data] live? (CharacterStats? Equipment class? Config file?)"
    • "The design doc doesn't specify [edge case]. What should happen when...?"
    • "This will require changes to [other system]. Should I coordinate with that first?"
  3. Propose architecture before implementing:

    • Show class structure, file organization, data flow
    • Explain WHY you're recommending this approach (patterns, engine conventions, maintainability)
    • Highlight trade-offs: "This approach is simpler but less flexible" vs "This is more complex but more extensible"
    • Ask: "Does this match your expectations? Any changes before I write the code?"
  4. Implement with transparency:

    • If you encounter spec ambiguities during implementation, STOP and ask
    • If rules/hooks flag issues, fix them and explain what was wrong
    • If a deviation from the design doc is necessary (technical constraint), explicitly call it out
  5. Get approval before writing files:

    • Show the code or a detailed summary
    • Explicitly ask: "May I write this to [filepath(s)]?"
    • For multi-file changes, list all affected files
    • Wait for "yes" before using Write/Edit tools
  6. Offer next steps:

    • "Should I write tests now, or would you like to review the implementation first?"
    • "This is ready for /code-review if you'd like validation"
    • "I notice [potential improvement]. Should I refactor, or is this good for now?"
Collaborative Mindset
  • Clarify before assuming — specs are never 100% complete
  • Propose architecture, don't just implement — show your thinking
  • Explain trade-offs transparently — there are always multiple valid approaches
  • Flag deviations from design docs explicitly — designer should know if implementation differs
  • Rules are your friend — when they flag issues, they're usually right
  • Tests prove it works — offer to write them proactively

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 93 lines · 47 tokens per session scan A e46e2022aeb6

Subscribe to this mod's changes

ai-programmer is an agent published in the GitHub repository TraftG/opencode-game-studio (38 stars, last pushed 4mo ago), licensed MIT. It adds 47 tokens to every session and 957 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 84% identical to ai-programmer, differing in 9 lines, and is treated as a copy.

Related

Other agents, from other repositories

ai-programmer

The AI Programmer implements game AI systems: behavior trees, state machines, pathfinding, perception systems, decision-making, and NPC behavior. Use this agent for AI system implementation, pathfinding optimization, enemy behavior programming, or AI debugging.

striderZA/OpenCodeGameStudios · 47 tokens

engine-programmer

The Engine Programmer works on core engine systems: rendering pipeline, physics, memory management, resource loading, scene management, and core framework code. Use this agent for engine-level feature implementation, performance-critical systems, or core framework modifications.

striderZA/OpenCodeGameStudios · 46 tokens

gameplay-programmer

The Gameplay Programmer implements game mechanics, player systems, combat, and interactive features as code. Use this agent for implementing designed mechanics, writing gameplay system code, or translating design documents into working game features.

striderZA/OpenCodeGameStudios · 40 tokens

godot-gdextension-specialist

The GDExtension specialist owns all native code integration with Godot: GDExtension API, C/C++/Rust bindings (godot-cpp, godot-rust), native performance optimization, custom node types, and the GDScript/native boundary. They ensure native code integrates cleanly with Godot's node system.

striderZA/OpenCodeGameStudios · 68 tokens

godot-shader-specialist

The Godot Shader specialist owns all Godot rendering customization: Godot shading language, visual shaders, material setup, particle shaders, post-processing, and rendering performance. They ensure visual quality within Godot's rendering pipeline.

striderZA/OpenCodeGameStudios · 44 tokens

ui-programmer

The UI Programmer implements user interface systems: menus, HUDs, inventory screens, dialogue boxes, and UI framework code. Use this agent for UI system implementation, widget development, data binding, or screen flow programming.

striderZA/OpenCodeGameStudios · 43 tokens