[GM Workbench] Loot parcel generator (A4) #149

Closed
opened 2026-07-15 22:03:15 +00:00 by claude-bot · 2 comments
Contributor

Motivation / Context

GMs need itemized loot parcels scaled by party level, wealth, and source ("dragon hoard," "pickpocketed noble") constantly during prep — a classic, table-stakes generative tool (§3, Group A). No loot/item model exists in the schema today (confirmed by the report's grep for loot/quest_log in webapp/backend/app), and issue #112 (loot ledger + XP tracking, v3.7.0) is specifying the LootEntry/XpAward/GoldLedgerEntry tracking models. This generator produces forward content (new parcels from a prompt), which #112 explicitly flags as a complementary follow-up, distinct from #112's own noted future scope of "LLM extraction proposing loot from transcripts" (retroactive, from session text — not this tool).

Tagged TT in the report — sequence alongside or after #112 so the "send to ledger" action has a real destination, though the generator itself has no hard schema dependency on #112.

Approach

  • Register a loot_parcel tool in GENERATOR_TOOLS (generation_service.py, #136).
  • Inputs: party level/size (free text for now — no game-aware party model exists), source description (e.g. "dragon hoard," "pickpocketed noble"), game_system. Uses campaign_context from #136.
  • Output: an itemized parcel — items, quantities, estimated value/currency, flavor notes — via generate_structured_text in JSON mode. Small output → runs inline (sync_allowed=True).
  • Output landing: written to GenerationResult (scratch, #138) by default.
    • Magic items in the parcel → "Save as lore entry" creates a LoreEntry with entry_type=artifact (per §3's "Output lands" column) for items worth wiki tracking.
    • Once #112 lands: add a one-click "add to loot ledger" action that emits LootEntry-shaped fields (name, qty, est_value, currency, notes) directly into #112's POST /api/campaigns/{campaign_id}/loot endpoint. Until #112 ships, this action is simply absent — the tool still works standalone (scratch + artifact lore entries).
  • Structure the generated parcel's item shape (name, qty, est_value free-text, currency free-text, notes) to match #112's LootEntry field names from the start, even before #112 lands, so the later integration is a thin mapping rather than a reshape.

Dependencies

  • #134 (LLM core), #136 (workbench endpoint + tool registry), #138 (scratchpad) — Phase 0 foundation, per the report's 1→2→3 chain.
  • Sequenced with #112 (loot ledger + XP tracking): #112 owns the tracking models (LootEntry, XpAward, GoldLedgerEntry) and the /api/campaigns/{campaign_id}/loot endpoint. This issue does not require #112 to ship first — the generator works standalone — but the "add to loot ledger" action is a no-op/hidden until #112's endpoint exists. Recommend implementing this issue's ledger-integration action in the same PR as or immediately after #112, per the report's "sequence after or alongside #112" guidance.

Out of scope

  • Any new item/loot data model — must not invent a parallel model to #112's LootEntry; parcel output is scratch/lore-entry only until #112 exists, then maps onto LootEntry fields.
  • Encumbrance, item catalogs, or rules-aware valuation (no game-aware system exists — free-text game_system hint only, matching #130's locked stance).
  • LLM extraction proposing loot from existing transcripts — that's #112's separately flagged follow-up, not this tool (this tool only does forward generation from a prompt).

Acceptance criteria

  • loot_parcel tool registered and reachable via POST /api/campaigns/{campaign_id}/workbench/loot_parcel/generate, GM-only.
  • Given level/size, source, and game_system, returns an itemized parcel with name/qty/est_value/currency/notes per item.
  • Result appears in GenerationResult history.
  • Magic items can be saved as artifact-type LoreEntry rows individually.
  • If #112 has landed by the time this ships, "add to loot ledger" creates correctly-mapped LootEntry rows; if not, the action is absent and the rest of the tool functions normally.
## Motivation / Context GMs need itemized loot parcels scaled by party level, wealth, and source ("dragon hoard," "pickpocketed noble") constantly during prep — a classic, table-stakes generative tool (§3, Group A). No loot/item model exists in the schema today (confirmed by the report's grep for `loot`/`quest_log` in `webapp/backend/app`), and issue #112 (loot ledger + XP tracking, v3.7.0) is specifying the `LootEntry`/`XpAward`/`GoldLedgerEntry` tracking models. This generator produces *forward* content (new parcels from a prompt), which #112 explicitly flags as a complementary follow-up, distinct from #112's own noted future scope of "LLM extraction proposing loot from transcripts" (retroactive, from session text — not this tool). Tagged **TT** in the report — sequence alongside or after #112 so the "send to ledger" action has a real destination, though the generator itself has no hard schema dependency on #112. ## Approach - Register a `loot_parcel` tool in `GENERATOR_TOOLS` (`generation_service.py`, #136). - **Inputs**: party level/size (free text for now — no game-aware party model exists), source description (e.g. "dragon hoard," "pickpocketed noble"), `game_system`. Uses `campaign_context` from #136. - **Output**: an itemized parcel — items, quantities, estimated value/currency, flavor notes — via `generate_structured_text` in JSON mode. Small output → runs inline (`sync_allowed=True`). - **Output landing**: written to `GenerationResult` (scratch, #138) by default. - Magic items in the parcel → **"Save as lore entry"** creates a `LoreEntry` with `entry_type=artifact` (per §3's "Output lands" column) for items worth wiki tracking. - **Once #112 lands**: add a one-click **"add to loot ledger"** action that emits `LootEntry`-shaped fields (`name`, `qty`, `est_value`, `currency`, `notes`) directly into #112's `POST /api/campaigns/{campaign_id}/loot` endpoint. Until #112 ships, this action is simply absent — the tool still works standalone (scratch + artifact lore entries). - Structure the generated parcel's item shape (`name`, `qty`, `est_value` free-text, `currency` free-text, `notes`) to match #112's `LootEntry` field names from the start, even before #112 lands, so the later integration is a thin mapping rather than a reshape. ## Dependencies - **#134** (LLM core), **#136** (workbench endpoint + tool registry), **#138** (scratchpad) — Phase 0 foundation, per the report's 1→2→3 chain. - **Sequenced with #112** (loot ledger + XP tracking): #112 owns the tracking models (`LootEntry`, `XpAward`, `GoldLedgerEntry`) and the `/api/campaigns/{campaign_id}/loot` endpoint. This issue does not require #112 to ship first — the generator works standalone — but the "add to loot ledger" action is a no-op/hidden until #112's endpoint exists. Recommend implementing this issue's ledger-integration action in the same PR as or immediately after #112, per the report's "sequence after or alongside #112" guidance. ## Out of scope - Any new item/loot data model — must not invent a parallel model to #112's `LootEntry`; parcel output is scratch/lore-entry only until #112 exists, then maps onto `LootEntry` fields. - Encumbrance, item catalogs, or rules-aware valuation (no game-aware system exists — free-text `game_system` hint only, matching #130's locked stance). - LLM extraction proposing loot from existing transcripts — that's #112's separately flagged follow-up, not this tool (this tool only does forward generation from a prompt). ## Acceptance criteria - `loot_parcel` tool registered and reachable via `POST /api/campaigns/{campaign_id}/workbench/loot_parcel/generate`, GM-only. - Given level/size, source, and `game_system`, returns an itemized parcel with name/qty/est_value/currency/notes per item. - Result appears in `GenerationResult` history. - Magic items can be saved as `artifact`-type `LoreEntry` rows individually. - If #112 has landed by the time this ships, "add to loot ledger" creates correctly-mapped `LootEntry` rows; if not, the action is absent and the rest of the tool functions normally.
Author
Contributor

Moved from v3.7.0 Table Toolsv3.10.0 GM Workbench (2026-07-18).

Rationale: same as #144 — this issue is specified as a loot_parcel tool registered into the Phase 0 Workbench foundation (#134/#136/#138), which is unbuilt and lives in v3.10.0. Building it standalone now would mean re-homing it into the registry later. Note #112 (the loot ledger this feeds via "add to loot ledger") has now shipped in v3.7.0, so when this is built on the Workbench foundation, the ledger-integration action has a live POST /api/campaigns/{id}/loot destination and correctly-named LootEntry fields (name/qty/est_value/currency/notes) to map onto — a thin mapping, as intended.

Moved from **v3.7.0 Table Tools** → **v3.10.0 GM Workbench** (2026-07-18). Rationale: same as #144 — this issue is specified as a `loot_parcel` tool registered into the **Phase 0 Workbench foundation (#134/#136/#138)**, which is unbuilt and lives in v3.10.0. Building it standalone now would mean re-homing it into the registry later. Note #112 (the loot ledger this feeds via "add to loot ledger") **has now shipped** in v3.7.0, so when this is built on the Workbench foundation, the ledger-integration action has a live `POST /api/campaigns/{id}/loot` destination and correctly-named `LootEntry` fields (`name`/`qty`/`est_value`/`currency`/`notes`) to map onto — a thin mapping, as intended.
Author
Contributor

Done — merged to feat/v3.10-gm-workbench via PR #220 (batched with #144 + #147).

loot_parcel tool registered on the #136 engine: an itemized parcel scaled to source + optional party level, persisting a GenerationResult (#138). Item field names are exactly name/qty/est_value/currency/notes — matching LootEntry. Frontend LootParcelGenerator renders the parcel + flavor; per item, "Save as artifact"LoreEntry (entry_type=artifact), and "Add to ledger" → the #112 loot ledger via createLoot (a thin mapping, as intended — #112 has shipped). Tolerant parser. No new API/models/migrations.

Verified: backend 712 passed (incl. test_workbench_loot.py), frontend 372 passed, ruff + eslint clean.

Done — merged to `feat/v3.10-gm-workbench` via PR #220 (batched with #144 + #147). `loot_parcel` tool registered on the #136 engine: an itemized parcel scaled to source + optional party level, persisting a `GenerationResult` (#138). Item field names are exactly `name`/`qty`/`est_value`/`currency`/`notes` — matching `LootEntry`. Frontend `LootParcelGenerator` renders the parcel + flavor; per item, **"Save as artifact"** → `LoreEntry` (`entry_type=artifact`), and **"Add to ledger"** → the #112 loot ledger via `createLoot` (a thin mapping, as intended — #112 has shipped). Tolerant parser. No new API/models/migrations. Verified: backend 712 passed (incl. `test_workbench_loot.py`), frontend 372 passed, ruff + eslint clean.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#149
No description provided.