feat(llm): add LLM integration module with OpenRouter and Claude Code adapters
Implements markitect/llm/ package with concrete LLMAdapter implementations:
- OpenRouterAdapter: HTTP via urllib with retry/backoff on 429/5xx
- ClaudeCodeAdapter: subprocess-based Claude CLI with stdin piping
- Factory pattern: create_adapter("openrouter") or create_adapter("claude-code")
- API key resolution chain: constructor > env var > project-root key file
- 42 unit tests, 2 integration tests (gated on API key / CLI availability)
Also adds the infospace-with-history example with Wealth of Nations VSM
analysis pipeline, templates, schemas, source chapters, and processed
output for chapters 1-2. process_chapters.py now supports --provider
and --model flags for automatic LLM-driven processing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
38
examples/infospace-with-history/templates/map-to-vsm.md
Normal file
38
examples/infospace-with-history/templates/map-to-vsm.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Map Economic Entities to VSM Concepts
|
||||
|
||||
You are a systems theorist specializing in Stafford Beer's Viable System Model.
|
||||
Your task is to map extracted economic entities to VSM concepts.
|
||||
|
||||
## Extracted Entities
|
||||
|
||||
@{entities}
|
||||
|
||||
## VSM Framework Reference
|
||||
|
||||
@{vsm_framework}
|
||||
|
||||
## Mapping Guidelines
|
||||
|
||||
@{mapping_rules}
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Review each extracted economic entity carefully.
|
||||
2. For each entity, determine which VSM system(s) it most closely relates to.
|
||||
3. Produce a mapping document for each entity-VSM relationship following
|
||||
the VSM Mapping Schema v1.0.
|
||||
4. Each mapping document must include:
|
||||
- An H1 heading in the format "Entity Name -> VSM Concept Name"
|
||||
- An Economic Entity Reference section
|
||||
- A VSM Concept Reference section
|
||||
- A Mapping Rationale section (minimum 30 words) grounded in Beer's definitions
|
||||
- A Mapping Strength section rated as Strong, Moderate, or Weak
|
||||
5. Where an entity maps to multiple VSM systems (recursion), create
|
||||
separate mapping documents for each relationship.
|
||||
6. Flag entities that don't clearly map to any VSM concept with a
|
||||
"Mapping Strength: Weak" and note the difficulty in the rationale.
|
||||
|
||||
## Output Format
|
||||
|
||||
Output each mapping as a separate markdown document, delimited by
|
||||
`--- MAPPING: <entity-name>-to-<vsm-concept> ---` markers.
|
||||
Reference in New Issue
Block a user