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,275 @@
|
||||
--- MAPPING: propensity-to-truck-barter-and-exchange-to-s5 ---
|
||||
|
||||
# Propensity to Truck, Barter, and Exchange -> System 5 (Policy/Identity)
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Propensity to Truck, Barter, and Exchange — an innate human disposition to
|
||||
negotiate and trade, identified as the ultimate cause of the division of labour.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
System 5 (Policy/Identity) — the policy-making body that defines the identity,
|
||||
values, and purpose of the organisation.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
The propensity to exchange functions as the foundational identity principle of
|
||||
the economic system. In Beer's VSM, System 5 defines what the system *is* — its
|
||||
essential nature and purpose. Smith's claim that this propensity is a fundamental
|
||||
feature of human nature (possibly arising from reason and speech) establishes
|
||||
exchange as the defining characteristic of human economic organisation. It is
|
||||
the principle from which all other economic structures emerge. Without it, Smith
|
||||
argues, there would be no division of labour, no specialisation, no difference
|
||||
of talents — the entire economic system would not exist. This is an identity-level
|
||||
property: it defines the system rather than operating within it.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Moderate
|
||||
|
||||
## Counter-arguments
|
||||
|
||||
This mapping is interpretive rather than structural. The propensity is not a
|
||||
governing body making policy decisions; it is a behavioural disposition. However,
|
||||
in Beer's framework, S5 can represent emergent identity rather than deliberate
|
||||
governance — the system's ethos rather than its explicit command structure.
|
||||
|
||||
--- MAPPING: propensity-to-truck-barter-and-exchange-to-s2 ---
|
||||
|
||||
# Propensity to Truck, Barter, and Exchange -> System 2 (Coordination)
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Propensity to Truck, Barter, and Exchange — an innate human disposition to
|
||||
negotiate and trade.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
System 2 (Coordination) — the information channels and bodies that allow
|
||||
System 1 units to communicate and coordinate.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
At the operational level, the propensity to exchange is the mechanism through
|
||||
which coordination between specialised producers actually occurs. It is what
|
||||
makes S2 possible in the economic system: without the disposition to trade,
|
||||
there would be no market interactions, no price signalling, no mutual
|
||||
adjustment of supply and demand. Smith's comparison with animals is telling —
|
||||
dogs have different talents but cannot coordinate them because they lack this
|
||||
propensity. The propensity is thus the prerequisite for all S2 coordination
|
||||
in the economic VSM.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Strong
|
||||
|
||||
--- MAPPING: self-interest-to-s1 ---
|
||||
|
||||
# Self-interest -> System 1 (Operations)
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Self-interest — the motivation of individuals to pursue their own advantage
|
||||
in economic transactions.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
System 1 (Operations) — the primary activities that produce the organisation's
|
||||
purpose, characterised by autonomy and self-organisation.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
Self-interest is the animating principle of System 1 operational units. In
|
||||
Beer's VSM, S1 elements are autonomous agents that self-organise within their
|
||||
operational domain. Smith's self-interest is precisely this autonomy principle:
|
||||
each economic actor (butcher, brewer, baker) pursues their own advantage, and
|
||||
it is this autonomous self-directed activity that produces the system's output.
|
||||
Self-interest ensures that S1 units are self-motivating and self-regulating
|
||||
at the local level — they do not require external commands to operate. This
|
||||
aligns with Beer's argument that S1 autonomy is essential for viability.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Strong
|
||||
|
||||
--- MAPPING: self-interest-to-autonomy ---
|
||||
|
||||
# Self-interest -> Autonomy
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Self-interest — the motivation of individuals to pursue their own advantage.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
Autonomy — the degree of freedom granted to operational units to self-organise
|
||||
within constraints set by System 3.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
Smith's self-interest maps directly to Beer's concept of operational autonomy.
|
||||
Beer argued that maximum autonomy consistent with systemic cohesion yields
|
||||
maximum viability. Smith makes essentially the same argument: individuals
|
||||
acting from self-interest, without central direction, produce better outcomes
|
||||
("universal opulence") than any deliberate plan could achieve. The butcher
|
||||
does not need to be told to provide meat — self-interest ensures it. This is
|
||||
autonomy as a systemic design principle: the system works *because* its
|
||||
operational units are self-directed, not *despite* it.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Strong
|
||||
|
||||
--- MAPPING: the-bargain-to-s2 ---
|
||||
|
||||
# The Bargain -> System 2 (Coordination)
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
The Bargain — a voluntary bilateral exchange in which each party offers
|
||||
something the other wants.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
System 2 (Coordination) — the information channels and bodies that allow
|
||||
System 1 units to communicate and coordinate.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
The bargain is the atomic unit of S2 coordination in the economic system.
|
||||
Each bargain is an information exchange (revealing preferences, willingness
|
||||
to pay, relative valuations) and a resource exchange simultaneously. Beer's
|
||||
S2 dampens oscillations and resolves conflicts between S1 units; the bargain
|
||||
does precisely this — two parties with conflicting interests (each wants the
|
||||
other's goods) reach an equilibrium through negotiation. The bargain is where
|
||||
coordination actually happens, one transaction at a time, aggregating into
|
||||
the market system's overall S2 function.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Strong
|
||||
|
||||
--- MAPPING: benevolence-to-s2 ---
|
||||
|
||||
# Benevolence -> System 2 (Coordination)
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Benevolence — the disposition to do good to others out of goodwill rather
|
||||
than self-interest.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
System 2 (Coordination) — the information channels and bodies that allow
|
||||
System 1 units to communicate and coordinate.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
Smith presents benevolence as an alternative but insufficient coordination
|
||||
mechanism. In a small group, benevolence can coordinate activity (one can
|
||||
secure "the friendship of a few persons"). But it cannot scale to coordinate
|
||||
the "great multitudes" required in civilised society. In VSM terms, benevolence
|
||||
is a low-variety S2 mechanism — it works for simple systems but lacks the
|
||||
requisite variety to coordinate a complex economy. Smith's argument is
|
||||
essentially that self-interested exchange is a higher-variety coordination
|
||||
mechanism than benevolence, and therefore the one that actually sustains the
|
||||
economic system at scale.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Weak
|
||||
|
||||
## Counter-arguments
|
||||
|
||||
Benevolence is more accurately described as a *failed* or *insufficient*
|
||||
coordination mechanism than an active one. Smith's point is precisely that
|
||||
it does not work at scale. The mapping is useful primarily for what it reveals
|
||||
about requisite variety in coordination.
|
||||
|
||||
--- MAPPING: surplus-produce-to-variety ---
|
||||
|
||||
# Surplus Produce -> Variety
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Surplus Produce — the portion of a worker's output exceeding their own
|
||||
consumption, available for exchange.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
Variety — the number of possible states of a system; the measure of
|
||||
complexity and differentiation.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
Surplus produce represents the variety that specialised S1 units inject into
|
||||
the economic system. Each specialised worker produces a large quantity of one
|
||||
type of good (high volume, low variety per worker) but the aggregate of all
|
||||
specialists' surpluses creates the system's total variety of available goods.
|
||||
The exchange of surpluses is how this variety is distributed across the system.
|
||||
Without surplus, there would be nothing to exchange, and without exchange,
|
||||
each person would be limited to the variety they could produce alone. Surplus
|
||||
is the material substrate of economic variety.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Moderate
|
||||
|
||||
--- MAPPING: difference-of-talents-to-variety ---
|
||||
|
||||
# Difference of Talents -> Variety
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Difference of Talents — the observable variation in skills and aptitudes among
|
||||
individuals, which Smith argues is largely the effect of the division of labour.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
Variety — the number of possible states of a system.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
The difference of talents is the human variety that the economic system creates
|
||||
and then exploits. Smith's argument that talents are effects rather than causes
|
||||
of specialisation is significant: the economic system generates its own variety
|
||||
through the division of labour, which then feeds back to enable further
|
||||
specialisation. In Beer's terms, this is a variety-amplification loop — the
|
||||
system's operational structure (division of labour) creates variety (diverse
|
||||
talents) that enhances the system's capacity for further differentiation.
|
||||
This is a self-reinforcing cybernetic process.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Moderate
|
||||
|
||||
--- MAPPING: common-stock-to-viability ---
|
||||
|
||||
# Common Stock -> Viability
|
||||
|
||||
## Economic Entity Reference
|
||||
|
||||
Common Stock — the aggregate pool of goods and services created when
|
||||
specialised producers bring their diverse products together through exchange.
|
||||
|
||||
## VSM Concept Reference
|
||||
|
||||
Viability — the capacity of a system to maintain a separate existence and
|
||||
survive in a changing environment.
|
||||
|
||||
## Mapping Rationale
|
||||
|
||||
The common stock represents the viable system's capacity to sustain all its
|
||||
members. Smith's argument that humans, unlike animals, can pool their different
|
||||
talents through exchange shows how viability emerges from coordination: no
|
||||
individual is self-sufficient, but the system as a whole is viable because
|
||||
exchange creates a shared pool of resources accessible to all. The mastiff
|
||||
cannot benefit from the greyhound's speed, but the philosopher can benefit
|
||||
from the porter's strength (and vice versa) through exchange. This pooling
|
||||
is what makes the human economic system viable while individual animals remain
|
||||
individually viable but collectively uncoordinated.
|
||||
|
||||
## Mapping Strength
|
||||
|
||||
Moderate
|
||||
Reference in New Issue
Block a user