loreweaver: Instructions file for Codex

AGENTS.md

loreweaver AGENTS.md is an instructions file for Codex, OpenCode from 1A7432/loreweaver. It costs 4,419 tokens per session, scanned A, original, MIT.

Contributor instructions for Loreweaver, a self-hosted AI game master for tabletop role-playing games with structured worlds, rules and saved game state.

In plain words
What is it for?
Use them when developing, testing or running Loreweaver, or when changing its game rules, clients, protocol or extensions.
Why use it?
They explain the project's architecture, strict design rules, development workflow and testing expectations to coding agents.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

This is 1A7432/loreweaver's own configuration. It tells Codex and OpenCode how to work on loreweaver itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything loreweaver configures →

Reuse

Borrowing it

Nothing to install: this file belongs to 1A7432/loreweaver. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/1A7432/loreweaver/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/1A7432/loreweaver

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for loreweaver AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/1a7432/loreweaver/agents-md/github.svg)](https://agentmods.dev/instructions/1a7432/loreweaver/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/1a7432/loreweaver/agents-md"><img src="https://agentmods.dev/badge/instructions/1a7432/loreweaver/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loreweaver AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/1a7432/loreweaver/agents-md"><img src="https://agentmods.dev/badge/instructions/1a7432/loreweaver/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,419 This file is loaded in full into every session.
When invoked 4,419 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.1 $0.04419 $0.04419
Opus 5.5 $0.01768 $0.01768
Sonnet 5.5 $0.00884 $0.00884
Haiku 4.5 $0.00442 $0.00442

Measured 9d ago against content hash 6dfc429b2e63, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loreweaver AGENTS.md 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 9d 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.

AGENTS.md · 52 lines

How it starts

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

AGENTS.md — contributor & AI-agent guide

Loreweaver is a self-hosted AI Game Master / Keeper for tabletop RPGs: a world/story-first engine (structured world + module + rules + persistent state), not a persona-chat frontend. Terminal-first over Iroh p2p, system-agnostic (D&D 5e SRD + CoC 7e), English-first with runtime en/zh i18n, MIT. This file orients humans and AI coding agents working in the repo — it is the single source of truth (CLAUDE.md just imports it). User-facing docs live in README.md; the open client protocol in docs/protocol.md; the extensibility contract in docs/plugins.md. The formats themselves are specified in docs/lwf/ (LWF, CC BY 4.0): a change to a pack/card/rulepack/hook/panel format updates the matching docs/lwf/formats/*.md in the same commit.

Architecture (layers, each with one job)

  • core/ — deterministic engine (never AI-generated), rule-AGNOSTIC since M16: dice, resolution (pack-compiled check ladders + the QuickJS rules_script lane), sheets (pack-declared sheet shapes: canonical-name bridges, derived DAG — derived values are NEVER persisted — vitals, wire resources), character_rules (pack-constraint validation on every stat write path), clock, rulepacks (data-driven rule systems: resolution/sheet/subsystems/commands/expertise all pack data; tests/architecture/ pins agent/ to zero system tokens), skills (SKILL.md loader), deterministic relationship tracks, modvars (deterministic module-variable trackers), worldbook, charcard (SillyTavern-card parser), table_habits — the M20 E procedural-memory type (how THIS table plays; keeper-side only, player projection returns None, index-only residency), chronicle — the M18 campaign-history types (chronicle/campaign_summary/thread: projections keep keeper annotations out of every player-grade view) plus the deterministic fold policy (0.60 trigger / 0.40 floor / 0.85 emergency, 4-turn no-future lag window), and documents — the M17 meta-type: ALL room content (lore/NPCs/sheets/pregens/modvars/MVU tree/notes/pools) is a Document in one table, and every type's project(doc, viewer) is THE single wire chokepoint for iron rule #3.
  • infra/ — plumbing: SQLite store (documents + room_state + kv tables — content documents, room-scoped runtime state, non-room leftovers), pydantic-settings config + hot runtime overrides/credential book, i18n, llm/embeddings (each with a Fake* offline double), vector, providers (multi-vendor LLM factory).
  • agent/ — the AI-KP brain: AgentCtx, tools (@tool schema-gen + gating), kp_tools* (the Keeper tools), forge (self-extension generators: skill/rulepack/module from a description), prompt_builder, loop (function-calling loop), services (the wiring bundle), chronicle (the M18 fold flow: batch-fold old chronicle records into the rolling campaign_summary when the usage meter crosses the trigger; folded records join the embedding index for topical recall — records themselves are AUTO-WRITTEN since M21 by the Scribe, one player-grade line per material turn at zero extra model calls, so durable memory and the history trim that rides on it never depend on the Keeper remembering record_chronicle; the keeper spoiler margin stays exclusive to that voluntary tool), knowledge-scoped npc/companion actors, and the three model-driven prep lanes that used to sit in core/ — module_initializer (full-text module analysis into the keeper/player pools), document_manager (chunking + RAG answers), char_from_persona (persona → rule-legal sheet; the validation half stays in core.character_rules).
  • gateway/ — platform-independent: session/events/turn/member/room state, commands/ (dual-dialect + slash — a package: router owns the spec table and dispatch, each domain is a mixin module checks/sheet/rules/rooms/cast/world/panels/media/llm/forge; a new command lands in its domain module plus one spec row, never in the turn pipeline), ops (rate-limit/censor/permissions), hub (the cross-transport RoomHub), director.
  • net/ — session (transport-agnostic SessionCore), iroh_server (p2p QUIC, the DEFAULT carrier), tui_server (WebSocket, offline-test/loopback only), keystore, admin, room_backup.
  • adapters/ — cli only (the local operator REPL). The five chat-platform adapters (Discord/QQ/Telegram/Feishu/OneBot) were REMOVED 2026-07-30: the UI direction is protocol clients with a deeply customizable UI extension layer (ui frames, panels), which text-chat platforms structurally cannot render. Don't re-add platform adapters; build against docs/protocol.md instead. The QQ path is a protocol client, the terminal client's bridge mode (official Bot API first, OneBot second).
  • clients/ — TypeScript: protocol (shared types + WsClient; published to npm as loreweaver-protocol, whose major.minor tracks the wire-protocol version), tui (OpenTUI terminal client; IrohClient and the one-click host live here). Both speak docs/protocol.md. The DESKTOP client — Loreweaver Studio, Tauri (Rust transport + React UI), play mode with tier-1/tier-2 panels and the keeper screens plus the card/pack studio — lives in the separate loreweaver-studio repo and is the recommended player client; it consumes loreweaver-protocol from npm and pins itself to the engine with a cross-repo round-trip gate (bun run roundtrip there). Changing the protocol or a pack format here means that gate must be rerun there. Bumping the protocol means bumping it in all five places at once — net/session.py (the authority), protocol/src/types.ts, the npm manifest's version + description, protocol/README.md, docs/protocol.md — pinned by tests/architecture/test_protocol_version_sync.py.

Read the full file on GitHub · 52 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. 9d ago Changed · +54 tokens per session 6dfc429b2e63
  2. 1mo ago Changed · +52 tokens per session eb1dd18508b0
  3. 1mo ago Changed · +9 tokens per session c684da1cdf60
  4. 1mo ago Changed · +7 tokens per session 79252eced512
  5. 1mo ago Changed · +18 tokens per session 23992e0227d6
  6. 1mo ago First seen · 52 lines · 4,279 tokens per session scan A 19d3fb5920d1

Subscribe to this mod's changes

loreweaver AGENTS.md is an instructions file published in the GitHub repository 1A7432/loreweaver (67 stars, last pushed 4d ago), licensed MIT. It adds 4,419 tokens to every session, about $0.0177 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,581 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens