ifcraftcorpus 1.1.0__py3-none-any.whl → 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. ifcraftcorpus/cli.py +7 -2
  2. ifcraftcorpus/embeddings.py +11 -7
  3. ifcraftcorpus/index.py +4 -2
  4. ifcraftcorpus/mcp_server.py +316 -10
  5. ifcraftcorpus/providers.py +3 -3
  6. ifcraftcorpus/search.py +13 -9
  7. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/agent-design/agent_prompt_engineering.md +183 -9
  8. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/README.md +198 -0
  9. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_genre_consultant.md +257 -0
  10. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_platform_advisor.md +306 -0
  11. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_prose_writer.md +187 -0
  12. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_quality_reviewer.md +245 -0
  13. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_story_architect.md +162 -0
  14. ifcraftcorpus-1.2.0.data/data/share/ifcraftcorpus/subagents/if_world_curator.md +280 -0
  15. {ifcraftcorpus-1.1.0.dist-info → ifcraftcorpus-1.2.0.dist-info}/METADATA +1 -1
  16. ifcraftcorpus-1.2.0.dist-info/RECORD +66 -0
  17. ifcraftcorpus-1.1.0.dist-info/RECORD +0 -59
  18. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/agent-design/multi_agent_patterns.md +0 -0
  19. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/audience-and-access/accessibility_guidelines.md +0 -0
  20. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/audience-and-access/audience_targeting.md +0 -0
  21. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/audience-and-access/localization_considerations.md +0 -0
  22. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/audio_visual_integration.md +0 -0
  23. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/collaborative_if_writing.md +0 -0
  24. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/creative_workflow_pipeline.md +0 -0
  25. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/diegetic_design.md +0 -0
  26. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/idea_capture_and_hooks.md +0 -0
  27. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/if_platform_tools.md +0 -0
  28. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/player_analytics_metrics.md +0 -0
  29. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/quality_standards_if.md +0 -0
  30. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/research_and_verification.md +0 -0
  31. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/craft-foundations/testing_interactive_fiction.md +0 -0
  32. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/emotional-design/conflict_patterns.md +0 -0
  33. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/emotional-design/emotional_beats.md +0 -0
  34. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/game-design/mechanics_design_patterns.md +0 -0
  35. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/children_and_ya_conventions.md +0 -0
  36. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/fantasy_conventions.md +0 -0
  37. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/historical_fiction.md +0 -0
  38. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/horror_conventions.md +0 -0
  39. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/mystery_conventions.md +0 -0
  40. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/genre-conventions/sci_fi_conventions.md +0 -0
  41. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/branching_narrative_construction.md +0 -0
  42. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/branching_narrative_craft.md +0 -0
  43. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/endings_patterns.md +0 -0
  44. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/episodic_serialized_if.md +0 -0
  45. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/nonlinear_structure.md +0 -0
  46. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/pacing_and_tension.md +0 -0
  47. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/romance_and_relationships.md +0 -0
  48. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/scene_structure_and_beats.md +0 -0
  49. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/narrative-structure/scene_transitions.md +0 -0
  50. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/character_voice.md +0 -0
  51. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/dialogue_craft.md +0 -0
  52. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/exposition_techniques.md +0 -0
  53. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/narrative_point_of_view.md +0 -0
  54. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/prose_patterns.md +0 -0
  55. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/subtext_and_implication.md +0 -0
  56. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/prose-and-language/voice_register_consistency.md +0 -0
  57. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/scope-and-planning/scope_and_length.md +0 -0
  58. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/world-and-setting/canon_management.md +0 -0
  59. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/world-and-setting/setting_as_character.md +0 -0
  60. {ifcraftcorpus-1.1.0.data → ifcraftcorpus-1.2.0.data}/data/share/ifcraftcorpus/corpus/world-and-setting/worldbuilding_patterns.md +0 -0
  61. {ifcraftcorpus-1.1.0.dist-info → ifcraftcorpus-1.2.0.dist-info}/WHEEL +0 -0
  62. {ifcraftcorpus-1.1.0.dist-info → ifcraftcorpus-1.2.0.dist-info}/entry_points.txt +0 -0
  63. {ifcraftcorpus-1.1.0.dist-info → ifcraftcorpus-1.2.0.dist-info}/licenses/LICENSE +0 -0
  64. {ifcraftcorpus-1.1.0.dist-info → ifcraftcorpus-1.2.0.dist-info}/licenses/LICENSE-CONTENT +0 -0
@@ -285,6 +285,70 @@ Small models may interpret as "never validate" or "always validate."
285
285
 
286
286
  ---
287
287
 
288
+ ## Sampling Parameters
289
+
290
+ Sampling parameters control the randomness and diversity of LLM outputs. The two most important are **temperature** and **top_p**. These can be set per API call, enabling different settings for different phases of a workflow.
291
+
292
+ ### Temperature
293
+
294
+ Temperature controls the probability distribution over tokens. Lower values make the model more deterministic; higher values increase randomness and creativity.
295
+
296
+ | Temperature | Effect | Use Cases |
297
+ |-------------|--------|-----------|
298
+ | 0.0–0.2 | Highly deterministic, consistent | Structured output, tool calling, factual responses |
299
+ | 0.3–0.5 | Balanced, slight variation | General conversation, summarization |
300
+ | 0.6–0.8 | More creative, diverse | Brainstorming, draft generation |
301
+ | 0.9–1.0+ | High randomness, exploratory | Creative writing, idea exploration, poetry |
302
+
303
+ **How it works:** Temperature scales the logits (pre-softmax scores) before sampling. At T=0, the model always picks the highest-probability token. At T>1, probability differences flatten, making unlikely tokens more probable.
304
+
305
+ **Caveats:**
306
+
307
+ - Even T=0 isn't fully deterministic—hardware concurrency and floating-point variations can introduce tiny differences
308
+ - High temperature increases hallucination risk
309
+ - Temperature interacts with top_p; tuning both simultaneously requires care
310
+
311
+ ### Top_p (Nucleus Sampling)
312
+
313
+ Top_p limits sampling to the smallest set of tokens whose cumulative probability exceeds p. This provides a different control over diversity than temperature.
314
+
315
+ | Top_p | Effect |
316
+ |-------|--------|
317
+ | 0.1–0.3 | Very focused, few token choices |
318
+ | 0.5–0.7 | Moderate diversity |
319
+ | 0.9–1.0 | Wide sampling, more variation |
320
+
321
+ **Temperature vs Top_p:**
322
+
323
+ - Temperature affects *all* token probabilities uniformly
324
+ - Top_p dynamically adjusts the candidate pool based on probability mass
325
+ - For most use cases, adjust one and leave the other at default
326
+ - Common pattern: low temperature (0.0–0.3) with top_p=1.0 for structured tasks
327
+
328
+ ### Provider Temperature Ranges
329
+
330
+ | Provider | Range | Default | Notes |
331
+ |----------|-------|---------|-------|
332
+ | OpenAI | 0.0–2.0 | 1.0 | Values >1.0 increase randomness significantly |
333
+ | Anthropic | 0.0–1.0 | 1.0 | Cannot exceed 1.0 |
334
+ | Gemini | 0.0–2.0 | 1.0 | Similar to OpenAI |
335
+ | Ollama | 0.0–1.0+ | 0.7–0.8 | Model-dependent defaults |
336
+
337
+ ### Phase-Specific Temperature
338
+
339
+ Since temperature can be set per API call, use different values for different workflow phases:
340
+
341
+ | Phase | Temperature | Rationale |
342
+ |-------|-------------|-----------|
343
+ | Brainstorming/Discuss | 0.7–1.0 | Encourage diverse ideas, exploration |
344
+ | Planning/Freeze | 0.3–0.5 | Balance creativity with coherence |
345
+ | Serialize/Tool calls | 0.0–0.2 | Maximize format compliance |
346
+ | Validation repair | 0.0–0.2 | Deterministic corrections |
347
+
348
+ This is particularly relevant for the **Discuss → Freeze → Serialize** pattern described below—each stage benefits from different temperature settings.
349
+
350
+ ---
351
+
288
352
  ## Structured Output Pipelines
289
353
 
290
354
  Many agent tasks end in a **strict artifact**—JSON/YAML configs, story plans, outlines—rather than free-form prose. Trying to get both *conversation* and *perfectly formatted output* from a single response is brittle, especially for small/local models.
@@ -297,21 +361,23 @@ A more reliable approach is to separate the flow into stages:
297
361
 
298
362
  ### Discuss → Freeze → Serialize
299
363
 
300
- **Discuss:** keep prompts focused on meaning, not field names. Explicitly tell the model *not* to output JSON/YAML during this phase.
364
+ **Discuss** (temperature 0.7–1.0): Keep prompts focused on meaning, not field names. Explicitly tell the model *not* to output JSON/YAML during this phase. Higher temperature encourages diverse ideas and creative exploration.
301
365
 
302
- **Freeze:** compress decisions into a short summary:
366
+ **Freeze** (temperature 0.3–0.5): Compress decisions into a short summary:
303
367
 
304
368
  - 10–30 bullets, one decision per line.
305
369
  - No open questions, only resolved choices.
306
370
  - Structured enough that a smaller model can follow it reliably.
371
+ - Moderate temperature balances coherence with flexibility.
307
372
 
308
- **Serialize:** in a separate call:
373
+ **Serialize** (temperature 0.0–0.2): In a separate call:
309
374
 
310
375
  - Provide the schema (JSON Schema, typed model, or tool definition).
311
- - Instruct: *“Output only JSON that matches this schema. No prose, no markdown fences.”*
376
+ - Instruct: *"Output only JSON that matches this schema. No prose, no markdown fences."*
312
377
  - Use constrained decoding/tool calling where available.
378
+ - Low temperature maximizes format compliance.
313
379
 
314
- This separates conversational drift from serialization, which significantly improves reliability for structured outputs like story plans, world-bible slices, or configuration objects.
380
+ This separates conversational drift from serialization, which significantly improves reliability for structured outputs like story plans, world-bible slices, or configuration objects. The temperature gradient—high for exploration, low for precision—matches each phase's purpose.
315
381
 
316
382
  ### Tool-Gated Finalization
317
383
 
@@ -363,7 +429,108 @@ When a candidate fails validation, the repair prompt should:
363
429
 
364
430
  > “Return a corrected JSON object that fixes **only** these errors. Do not change fields that are not mentioned. Output only JSON.”
365
431
 
366
- For small models, keep error descriptions compact and concrete rather than abstract (string too long: 345 > max 200).
432
+ For small models, keep error descriptions compact and concrete rather than abstract ("string too long: 345 > max 200").
433
+
434
+ ### Structured Validation Feedback
435
+
436
+ Rather than returning free-form error messages, use a structured feedback format that leverages attention patterns (status first, action last) and distinguishes error types clearly.
437
+
438
+ **Result Categories**
439
+
440
+ Use a semantic result enum rather than boolean success/failure:
441
+
442
+ | Result | Meaning | Model Action |
443
+ |--------|---------|--------------|
444
+ | `accepted` | Validation passed, artifact stored | Proceed to next step |
445
+ | `validation_failed` | Content issues the model can fix | Repair and resubmit |
446
+ | `tool_error` | Infrastructure failure | Retry unchanged or escalate |
447
+
448
+ This distinction matters: `validation_failed` tells the model its *content* was wrong (fixable), while `tool_error` indicates the tool itself failed (retry or give up).
449
+
450
+ **Error Categorization**
451
+
452
+ Group validation errors by type to help the model understand what went wrong:
453
+
454
+ ```json
455
+ {
456
+ "result": "validation_failed",
457
+ "issues": {
458
+ "invalid": [
459
+ {"field": "estimated_passages", "value": 15, "requirement": "must be 1-10"}
460
+ ],
461
+ "missing": ["protagonist_name", "setting"],
462
+ "unknown": ["passages"]
463
+ },
464
+ "issue_count": {"invalid": 1, "missing": 2, "unknown": 1},
465
+ "action": "Fix the 4 issues above and resubmit. Use exact field names from the schema."
466
+ }
467
+ ```
468
+
469
+ | Category | Meaning | Common Cause |
470
+ |----------|---------|--------------|
471
+ | `invalid` | Field present but value wrong | Constraint violation, wrong type |
472
+ | `missing` | Required field not provided | Omission, incomplete output |
473
+ | `unknown` | Field not in schema | Typo, hallucinated field name |
474
+
475
+ The `unknown` category is particularly valuable—it catches near-misses like `passages` instead of `estimated_passages` that would otherwise appear as "missing" with no hint about the typo.
476
+
477
+ **Field Ordering (Primacy/Recency)**
478
+
479
+ Structure feedback to exploit the U-shaped attention curve:
480
+
481
+ 1. **Result status** (first—immediate orientation)
482
+ 2. **Issues by category** (middle—detailed content)
483
+ 3. **Issue count** (severity summary)
484
+ 4. **Action instructions** (last—what to do next)
485
+
486
+ **What NOT to Include**
487
+
488
+ | Avoid | Why |
489
+ |-------|-----|
490
+ | Full schema | Already in tool definition; wastes tokens in retry loops |
491
+ | Boolean `success` field | Ambiguous; use semantic result categories instead |
492
+ | Generic hints | Replace with actionable, field-specific instructions |
493
+ | Valid fields | Only describe what failed, not what succeeded |
494
+
495
+ **Example: Before and After**
496
+
497
+ Anti-pattern (vague, wastes tokens):
498
+
499
+ ```
500
+ Error: Validation failed. Expected fields: type, title, protagonist_name,
501
+ setting, theme, estimated_passages, tone. Please check your submission
502
+ and ensure all required fields are present with valid values.
503
+ ```
504
+
505
+ Better (specific, actionable):
506
+
507
+ ```json
508
+ {
509
+ "result": "validation_failed",
510
+ "issues": {
511
+ "invalid": [{"field": "type", "value": "story", "requirement": "must be 'dream'"}],
512
+ "missing": ["protagonist_name"],
513
+ "unknown": ["passages"]
514
+ },
515
+ "action": "Fix these 3 issues. Did you mean 'estimated_passages' instead of 'passages'?"
516
+ }
517
+ ```
518
+
519
+ The improved version:
520
+
521
+ - Names the exact fields that failed
522
+ - Suggests the likely typo (`passages` → `estimated_passages`)
523
+ - Doesn't repeat schema information already available to the model
524
+ - Ends with a clear action instruction (primacy/recency)
525
+
526
+ ### Retry Budget and Token Efficiency
527
+
528
+ Validation loops consume tokens. Design for efficiency:
529
+
530
+ - **Cap retries**: 2-3 attempts is usually sufficient; more indicates a prompt or schema problem
531
+ - **Escalate gracefully**: After retry budget exhausted, surface a clear failure rather than looping
532
+ - **Track retry rates**: High retry rates signal opportunities for prompt improvement or schema simplification
533
+ - **Consider model capability**: Less capable models may need higher retry budgets but with simpler feedback
367
534
 
368
535
  ### Best Practices
369
536
 
@@ -528,9 +695,12 @@ Before deploying:
528
695
 
529
696
  ## Provider-Specific Optimizations
530
697
 
531
- - **Anthropic**: Use `token-efficient-tools` beta header for up to 70% output token reduction
532
- - **OpenAI**: Consider fine-tuning for frequently-used patterns
533
- - **Local models**: Tool retrieval essential—small models struggle with 10+ tools
698
+ - **Anthropic**: Use `token-efficient-tools` beta header for up to 70% output token reduction; temperature capped at 1.0
699
+ - **OpenAI**: Consider fine-tuning for frequently-used patterns; temperature range 0.0–2.0
700
+ - **Gemini**: Temperature range 0.0–2.0, similar behavior to OpenAI
701
+ - **Ollama/Local**: Tool retrieval essential—small models struggle with 10+ tools; default temperature varies by model (typically 0.7–0.8)
702
+
703
+ See [Sampling Parameters](#sampling-parameters) for detailed temperature guidance by use case.
534
704
 
535
705
  ---
536
706
 
@@ -549,6 +719,8 @@ Before deploying:
549
719
  | Dynamic few-shot | Static example bloat | Retrieve relevant examples |
550
720
  | Reflection | Quality failures | Draft → critique → refine |
551
721
  | Context pruning | Context rot | Summarize and remove stale turns |
722
+ | Structured feedback | Vague validation errors | Categorize issues (invalid/missing/unknown) |
723
+ | Phase-specific temperature | Format errors in structured output | High temp for discuss, low for serialize |
552
724
 
553
725
  | Model Class | Max Prompt | Max Tools | Strategy |
554
726
  |-------------|------------|-----------|----------|
@@ -567,6 +739,8 @@ Before deploying:
567
739
  | RAG-MCP (2025) | Two-stage selection reduces tokens 50%+, improves accuracy 3x |
568
740
  | Anthropic Token-Efficient Tools | Schema optimization reduces output tokens 70% |
569
741
  | Reflexion research | Self-correction improves quality on complex tasks |
742
+ | STROT Framework (2025) | Structured feedback loops achieve 95% first-attempt success |
743
+ | AWS Evaluator-Optimizer | Semantic reflection enables self-improving validation |
570
744
 
571
745
  ---
572
746
 
@@ -0,0 +1,198 @@
1
+ # IF Craft Corpus Subagents
2
+
3
+ Specialized agent templates for Interactive Fiction authoring workflows. These templates provide system prompts for LLM agents that can assist with different aspects of IF creation.
4
+
5
+ ## Overview
6
+
7
+ The subagents follow a **hub-and-spoke orchestration pattern** where specialized agents handle specific tasks:
8
+
9
+ | Agent | Archetype | Role |
10
+ |-------|-----------|------|
11
+ | **Story Architect** | Orchestrator | Plans narrative structure, decomposes projects, coordinates creation |
12
+ | **Prose Writer** | Creator | Writes narrative prose, dialogue, and scene text |
13
+ | **Quality Reviewer** | Validator | Reviews content for quality, consistency, and standards |
14
+ | **Genre Consultant** | Researcher | Provides genre-specific guidance on conventions and tropes |
15
+ | **World Curator** | Curator | Maintains world consistency, manages canon |
16
+ | **Platform Advisor** | Researcher | Guides tool/platform selection and technical implementation |
17
+
18
+ ## Usage
19
+
20
+ ### Via MCP Prompts (Recommended)
21
+
22
+ When using the IF Craft Corpus MCP server, subagents are exposed as **prompts** that can be retrieved and used as system prompts for agents:
23
+
24
+ ```python
25
+ # Using FastMCP client
26
+ from fastmcp import Client
27
+
28
+ async with Client("ifcraftcorpus-mcp") as client:
29
+ # List available subagents
30
+ prompts = await client.list_prompts()
31
+
32
+ # Get a specific prompt
33
+ result = await client.get_prompt(
34
+ "if_story_architect",
35
+ arguments={"project_name": "My IF Game", "genre": "mystery"}
36
+ )
37
+
38
+ # Use the prompt content as a system prompt
39
+ system_prompt = result.messages[0].content.text
40
+ ```
41
+
42
+ ### Via MCP Tool
43
+
44
+ You can also use the `list_subagents` tool to discover available agents:
45
+
46
+ ```python
47
+ subagents = await client.call_tool("list_subagents")
48
+ # Returns list of agents with name, description, archetype, and parameters
49
+ ```
50
+
51
+ ### Direct File Access
52
+
53
+ The markdown templates can also be read directly:
54
+
55
+ ```python
56
+ from pathlib import Path
57
+
58
+ # In development
59
+ template = Path("subagents/if_prose_writer.md").read_text()
60
+
61
+ # In installed package
62
+ import sys
63
+ template_path = Path(sys.prefix) / "share" / "ifcraftcorpus" / "subagents" / "if_prose_writer.md"
64
+ template = template_path.read_text()
65
+ ```
66
+
67
+ ## Agent Details
68
+
69
+ ### IF Story Architect
70
+
71
+ **Archetype:** Orchestrator
72
+ **Parameters:** `project_name`, `genre`
73
+
74
+ Plans and coordinates IF projects without writing content itself. Responsibilities:
75
+ - Design narrative topology (time cave, branch-and-bottleneck, QBN, etc.)
76
+ - Decompose projects into scenes and branches
77
+ - Plan emotional arcs across branches
78
+ - Create scene briefs for content creators
79
+
80
+ **When to use:** At project start to plan structure, or when restructuring.
81
+
82
+ ---
83
+
84
+ ### IF Prose Writer
85
+
86
+ **Archetype:** Creator
87
+ **Parameters:** `genre`, `pov`
88
+
89
+ Creates narrative content from briefs. Responsibilities:
90
+ - Write scene prose and dialogue
91
+ - Maintain character voice consistency
92
+ - Handle POV and exposition
93
+ - Create choice text
94
+
95
+ **When to use:** For actual content creation from scene briefs.
96
+
97
+ ---
98
+
99
+ ### IF Quality Reviewer
100
+
101
+ **Archetype:** Validator
102
+ **Parameters:** `focus_areas`
103
+
104
+ Reviews content for quality issues. Responsibilities:
105
+ - Check structural integrity (orphaned content, dead ends)
106
+ - Verify voice and style consistency
107
+ - Validate canon and continuity
108
+ - Audit accessibility compliance
109
+
110
+ **When to use:** After content creation, before publishing.
111
+
112
+ ---
113
+
114
+ ### IF Genre Consultant
115
+
116
+ **Archetype:** Researcher
117
+ **Parameters:** `primary_genre`, `secondary_genre`
118
+
119
+ Provides genre-specific guidance. Responsibilities:
120
+ - Explain genre conventions and expectations
121
+ - Suggest appropriate tropes and subversions
122
+ - Advise on cross-genre blending
123
+ - Guide tone and style
124
+
125
+ **When to use:** During planning, or when genre questions arise.
126
+
127
+ ---
128
+
129
+ ### IF World Curator
130
+
131
+ **Archetype:** Curator
132
+ **Parameters:** `world_name`, `setting_type`
133
+
134
+ Maintains world consistency. Responsibilities:
135
+ - Track canon facts across branches
136
+ - Manage timeline and character states
137
+ - Flag contradictions
138
+ - Maintain world bible
139
+
140
+ **When to use:** Throughout project to maintain consistency.
141
+
142
+ ---
143
+
144
+ ### IF Platform Advisor
145
+
146
+ **Archetype:** Researcher
147
+ **Parameters:** `target_platform`, `team_size`
148
+
149
+ Guides technical decisions. Responsibilities:
150
+ - Compare IF platforms (Twine, Ink, ChoiceScript, etc.)
151
+ - Recommend tools based on project needs
152
+ - Advise on workflow and collaboration
153
+ - Guide integration strategies
154
+
155
+ **When to use:** At project start for platform selection, or when evaluating tools.
156
+
157
+ ## Corpus Integration
158
+
159
+ All subagents are designed to use the IF Craft Corpus MCP tools:
160
+
161
+ - `search_corpus(query, cluster?, limit?)` - Find relevant guidance
162
+ - `get_document(name)` - Retrieve full document
163
+ - `list_documents(cluster?)` - Discover available guidance
164
+
165
+ Each template includes guidance on which corpus clusters are most relevant for that agent's work.
166
+
167
+ ## Web Research
168
+
169
+ Subagents are also encouraged to use web search for:
170
+ - Historical/factual accuracy
171
+ - Current platform documentation
172
+ - Published IF examples
173
+ - Domain-specific knowledge
174
+
175
+ ## Design Principles
176
+
177
+ These templates follow patterns from the corpus's own agent design documents:
178
+
179
+ 1. **Sandwich Pattern** - Critical constraints at start AND end of prompt
180
+ 2. **Menu + Consult** - Summary in prompt, retrieve details on demand
181
+ 3. **Clear Archetypes** - Each agent has a defined role and boundaries
182
+ 4. **Neutral Tool Descriptions** - Descriptive, not prescriptive
183
+
184
+ ## Extending
185
+
186
+ To create custom subagents:
187
+
188
+ 1. Copy an existing template as a starting point
189
+ 2. Modify the role, responsibilities, and workflow sections
190
+ 3. Update the corpus cluster references for your agent's domain
191
+ 4. Add any custom output formats needed
192
+ 5. Register as an MCP prompt if desired
193
+
194
+ ## License
195
+
196
+ These templates are part of the IF Craft Corpus package:
197
+ - **Code**: MIT License
198
+ - **Content**: CC-BY-4.0
@@ -0,0 +1,257 @@
1
+ # IF Genre Consultant
2
+
3
+ You are an Interactive Fiction Genre Consultant - a researcher agent that provides genre-specific guidance on conventions, tropes, reader expectations, and tone. You help architects and writers understand what makes each genre work and how to meet (or subvert) expectations effectively.
4
+
5
+ ---
6
+
7
+ ## Critical Constraints
8
+
9
+ - **Know the conventions before breaking them** - subversion requires understanding
10
+ - **Audience expectations matter** - genre is a promise to readers
11
+ - **Cross-genre blending requires care** - identify which conventions conflict
12
+ - Always consult the IF Craft Corpus for documented conventions
13
+ - Use web research for examples, trends, and subgenre nuances
14
+
15
+ ---
16
+
17
+ ## Tools Available
18
+
19
+ ### IF Craft Corpus (MCP)
20
+ Query the corpus for craft guidance:
21
+
22
+ - `search_corpus(query, cluster?, limit?)` - Find guidance by topic
23
+ - `get_document(name)` - Retrieve full document
24
+ - `list_documents(cluster?)` - Discover available guidance
25
+
26
+ **Key cluster for your work:**
27
+ - `genre-conventions` - Fantasy, horror, mystery, sci-fi, historical, children/YA
28
+
29
+ **Supporting clusters:**
30
+ - `prose-and-language` - Genre-appropriate voice and style
31
+ - `emotional-design` - Genre-specific emotional beats
32
+ - `narrative-structure` - Genre-appropriate pacing patterns
33
+
34
+ ### Web Research
35
+ Use web search for:
36
+ - Current genre trends and reader expectations
37
+ - Published IF examples in specific genres
38
+ - Subgenre distinctions and conventions
39
+ - Genre awards and celebrated works
40
+ - Community discussions on genre expectations
41
+
42
+ ---
43
+
44
+ ## Genres Covered
45
+
46
+ ### Fantasy
47
+ **Subgenres:** High Fantasy, Urban Fantasy, Dark Fantasy, Sword & Sorcery, Portal Fantasy
48
+
49
+ **Core conventions:**
50
+ - Magic systems (hard vs soft)
51
+ - World distinctly not our own
52
+ - Good vs evil (often, but not always)
53
+ - Quest or journey structure common
54
+
55
+ **Reader expectations:**
56
+ - Wonder and escapism
57
+ - Internally consistent world rules
58
+ - Clear stakes and conflicts
59
+ - Satisfying resolution of magical elements
60
+
61
+ **Reference:** `get_document("fantasy_conventions")`
62
+
63
+ ---
64
+
65
+ ### Horror
66
+ **Subgenres:** Gothic, Psychological, Body Horror, Cosmic Horror, Supernatural
67
+
68
+ **Core conventions:**
69
+ - Building dread through atmosphere
70
+ - The unknown as threat
71
+ - Vulnerability of protagonists
72
+ - Transgression of boundaries
73
+
74
+ **Reader expectations:**
75
+ - Genuine tension and fear
76
+ - Earned scares (not cheap jump scares)
77
+ - Thematic depth beneath the fear
78
+ - Catharsis or meaningful unease
79
+
80
+ **Reference:** `get_document("horror_conventions")`
81
+
82
+ ---
83
+
84
+ ### Mystery
85
+ **Subgenres:** Cozy, Noir, Police Procedural, Amateur Sleuth, Locked Room
86
+
87
+ **Core conventions:**
88
+ - Fair play (clues available to reader)
89
+ - Red herrings and misdirection
90
+ - Investigation as engine
91
+ - Solution that satisfies
92
+
93
+ **Reader expectations:**
94
+ - Puzzle they can solve alongside protagonist
95
+ - Clues hidden but findable
96
+ - Satisfying "aha" moment
97
+ - Justice (of some form)
98
+
99
+ **Reference:** `get_document("mystery_conventions")`
100
+
101
+ ---
102
+
103
+ ### Science Fiction
104
+ **Subgenres:** Hard SF, Space Opera, Cyberpunk, Post-Apocalyptic, First Contact
105
+
106
+ **Core conventions:**
107
+ - Extrapolation from known science/tech
108
+ - "What if?" as central question
109
+ - Technology shapes society
110
+ - Exploration of humanity through otherness
111
+
112
+ **Reader expectations:**
113
+ - Internal consistency of speculation
114
+ - Sense of wonder or warning
115
+ - Ideas that provoke thought
116
+ - World that feels possible
117
+
118
+ **Reference:** `get_document("sci_fi_conventions")`
119
+
120
+ ---
121
+
122
+ ### Historical Fiction
123
+ **Subgenres:** Period Drama, Historical Mystery, Alternate History, Biographical
124
+
125
+ **Core conventions:**
126
+ - Period authenticity in detail
127
+ - Historical events as backdrop or driver
128
+ - Characters shaped by their time
129
+ - Research-grounded world
130
+
131
+ **Reader expectations:**
132
+ - Immersion in another era
133
+ - Authentic voice without archaism
134
+ - Historical accuracy (or clear alternate history framing)
135
+ - Fresh perspective on known events
136
+
137
+ **Reference:** `get_document("historical_fiction")`
138
+
139
+ ---
140
+
141
+ ### Children's & Young Adult
142
+ **Subgenres:** Middle Grade, YA Contemporary, YA Fantasy, Picture Book IF
143
+
144
+ **Core conventions:**
145
+ - Age-appropriate content and themes
146
+ - Protagonist agency and growth
147
+ - Coming-of-age elements
148
+ - Hope and empowerment
149
+
150
+ **Reader expectations:**
151
+ - Respect for young readers' intelligence
152
+ - Authentic representation
153
+ - Emotional honesty
154
+ - Satisfying resolution (not necessarily happy)
155
+
156
+ **Reference:** `get_document("children_and_ya_conventions")`
157
+
158
+ ---
159
+
160
+ ### Romance
161
+ **Subgenres:** Contemporary, Historical, Paranormal, Romantic Suspense
162
+
163
+ **Core conventions:**
164
+ - Central love story
165
+ - Emotional journey paramount
166
+ - HEA (Happily Ever After) or HFN (Happy For Now)
167
+ - Relationship tension and development
168
+
169
+ **Reader expectations:**
170
+ - Satisfying romantic resolution
171
+ - Chemistry between leads
172
+ - Emotional payoff
173
+ - Genre-appropriate heat level
174
+
175
+ **Reference:** `search_corpus("romance relationships emotional beats")`
176
+
177
+ ---
178
+
179
+ ## Genre Analysis Framework
180
+
181
+ When consulted on genre, provide:
182
+
183
+ ### 1. Convention Mapping
184
+ ```yaml
185
+ genre: [Primary genre]
186
+ subgenre: [Specific subgenre if applicable]
187
+ key_conventions:
188
+ - [convention 1]
189
+ - [convention 2]
190
+ - [convention 3]
191
+ reader_expectations:
192
+ - [expectation 1]
193
+ - [expectation 2]
194
+ tone: [Description of expected tone]
195
+ pacing: [Genre-typical pacing pattern]
196
+ ```
197
+
198
+ ### 2. Trope Guidance
199
+ ```yaml
200
+ essential_tropes:
201
+ - name: [trope name]
202
+ purpose: [why it works in this genre]
203
+ variations: [how to make it fresh]
204
+
205
+ dangerous_tropes:
206
+ - name: [trope to handle carefully]
207
+ risk: [why it's problematic]
208
+ alternative: [better approach]
209
+
210
+ subversion_opportunities:
211
+ - convention: [what could be subverted]
212
+ method: [how to subvert effectively]
213
+ risk: [what could go wrong]
214
+ ```
215
+
216
+ ### 3. Cross-Genre Compatibility
217
+ ```yaml
218
+ blending_with: [other genre]
219
+ compatible_elements:
220
+ - [element that works in both]
221
+ conflicting_conventions:
222
+ - convention_a: [from genre A]
223
+ convention_b: [from genre B]
224
+ resolution: [how to handle]
225
+ successful_examples: [published works that blend these]
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Workflow
231
+
232
+ 1. **Identify genre(s)** - Primary and any secondary genres
233
+ 2. **Consult corpus** - Get documented conventions
234
+ 3. **Research current landscape** - Web search for trends, examples
235
+ 4. **Map conventions** - What must be present, what's optional
236
+ 5. **Identify tensions** - Conflicting expectations if cross-genre
237
+ 6. **Provide guidance** - Concrete recommendations for the project
238
+
239
+ ---
240
+
241
+ ## Common Genre Mistakes
242
+
243
+ | Genre | Common Mistake | Better Approach |
244
+ |-------|----------------|-----------------|
245
+ | Fantasy | Magic without rules | Establish consistent system |
246
+ | Horror | Jump scares without dread | Build atmosphere first |
247
+ | Mystery | Unfair clues | Plant fair clues reader could find |
248
+ | Sci-Fi | Hand-wavy science | Pick one impossibility, extrapolate rigorously |
249
+ | Historical | Modern characters in period dress | Let era shape characters |
250
+ | YA | Talking down to readers | Respect intelligence, match emotional honesty |
251
+ | Romance | Obstacles without chemistry | Build chemistry first |
252
+
253
+ ---
254
+
255
+ ## REMINDER: Genre is a promise
256
+
257
+ Genre sets reader expectations. Know the conventions before you follow, subvert, or blend them. Effective genre work requires understanding what readers are looking for and either delivering it excellently or subverting it intentionally.