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:
@@ -0,0 +1,75 @@
|
||||
---
|
||||
id: mapping-rules
|
||||
name: mapping_rules
|
||||
artifact_type: content
|
||||
description: Guidelines for mapping economic entities to VSM concepts
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
# VSM Mapping Rules
|
||||
|
||||
## Mapping Principles
|
||||
|
||||
1. **Ground in Beer's definitions.** Every mapping rationale must reference
|
||||
the specific VSM system function, not just a superficial resemblance.
|
||||
|
||||
2. **Prefer structural over metaphorical mappings.** A mapping is strong
|
||||
when the economic entity performs the same *functional role* in Smith's
|
||||
economic system as the VSM component performs in an organisation.
|
||||
|
||||
3. **Allow multiple mappings.** A single economic entity may map to
|
||||
multiple VSM systems. For example, "the sovereign" may map to both
|
||||
S3 (regulation) and S5 (policy). Create separate mapping documents
|
||||
for each relationship.
|
||||
|
||||
4. **Respect recursion.** Consider at which level of recursion the mapping
|
||||
applies. The division of labour within a single workshop (S1-level)
|
||||
differs from the division of labour across an entire national economy
|
||||
(higher recursion level).
|
||||
|
||||
## Mapping Strength Criteria
|
||||
|
||||
### Strong
|
||||
- The entity directly performs the function of the VSM system.
|
||||
- The mapping would be recognisable to a VSM practitioner without explanation.
|
||||
- Example: "market price mechanism" → S2 (Coordination) — prices coordinate
|
||||
supply and demand between producers.
|
||||
|
||||
### Moderate
|
||||
- The entity partially performs the function or performs it in a limited context.
|
||||
- The mapping requires some argument but is defensible.
|
||||
- Example: "merchant" → S4 (Intelligence) — merchants gather information
|
||||
about foreign markets, but this is not their primary function.
|
||||
|
||||
### Weak
|
||||
- The mapping is speculative or metaphorical rather than structural.
|
||||
- The connection exists but requires significant interpretive work.
|
||||
- Example: "moral sentiments" → S5 (Policy) — broad ethical framework
|
||||
shapes economic behaviour, but the connection is indirect.
|
||||
|
||||
## What NOT to Map
|
||||
|
||||
- Do not force mappings where none exist. It is valid for an entity to have
|
||||
no clear VSM mapping — flag it with "Mapping Strength: Weak" and explain
|
||||
the difficulty.
|
||||
- Do not map purely descriptive/historical content that lacks functional
|
||||
significance.
|
||||
|
||||
## VSM System Checklist
|
||||
|
||||
When mapping, consider each system:
|
||||
|
||||
| System | Question to Ask |
|
||||
|--------|----------------|
|
||||
| S1 | Does this entity directly produce value or output? |
|
||||
| S2 | Does this entity coordinate between operational units? |
|
||||
| S3 | Does this entity regulate internal operations? |
|
||||
| S3* | Does this entity provide audit or verification? |
|
||||
| S4 | Does this entity scan the environment or plan for the future? |
|
||||
| S5 | Does this entity define identity, policy, or purpose? |
|
||||
|
||||
Also consider the key concepts:
|
||||
- **Recursion**: At what level does this entity operate?
|
||||
- **Variety**: Does this entity manage variety (attenuate or amplify)?
|
||||
- **Algedonic signals**: Does this entity serve as an emergency signal?
|
||||
- **Autonomy**: Does this entity relate to operational autonomy?
|
||||
Reference in New Issue
Block a user