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>
400 lines
19 KiB
Markdown
400 lines
19 KiB
Markdown
# Extract Economic Entities
|
||
|
||
You are an analytical economist specializing in classical economic theory.
|
||
Your task is to extract distinct economic entities from a chapter of
|
||
Adam Smith's *The Wealth of Nations*.
|
||
|
||
## Source Chapter
|
||
|
||
---
|
||
id: book-1-chapter-02
|
||
title: "OF THE PRINCIPLE WHICH GIVES OCCASION TO THE DIVISION OF LABOUR."
|
||
book: "1"
|
||
chapter: 2
|
||
artifact_type: content
|
||
---
|
||
|
||
CHAPTER II.
|
||
OF THE PRINCIPLE WHICH GIVES OCCASION
|
||
TO THE DIVISION OF LABOUR.
|
||
|
||
|
||
|
||
This division of labour, from which so many advantages are derived, is not
|
||
originally the effect of any human wisdom, which foresees and intends that
|
||
general opulence to which it gives occasion. It is the necessary, though
|
||
very slow and gradual, consequence of a certain propensity in human
|
||
nature, which has in view no such extensive utility; the propensity to
|
||
truck, barter, and exchange one thing for another.
|
||
|
||
Whether this propensity be one of those original principles in human
|
||
nature, of which no further account can be given, or whether, as seems
|
||
more probable, it be the necessary consequence of the faculties of reason
|
||
and speech, it belongs not to our present subject to inquire. It is common
|
||
to all men, and to be found in no other race of animals, which seem to
|
||
know neither this nor any other species of contracts. Two greyhounds, in
|
||
running down the same hare, have sometimes the appearance of acting in
|
||
some sort of concert. Each turns her towards his companion, or endeavours
|
||
to intercept her when his companion turns her towards himself. This,
|
||
however, is not the effect of any contract, but of the accidental
|
||
concurrence of their passions in the same object at that particular time.
|
||
Nobody ever saw a dog make a fair and deliberate exchange of one bone for
|
||
another with another dog. Nobody ever saw one animal, by its gestures and
|
||
natural cries signify to another, this is mine, that yours; I am willing
|
||
to give this for that. When an animal wants to obtain something either of
|
||
a man, or of another animal, it has no other means of persuasion, but to
|
||
gain the favour of those whose service it requires. A puppy fawns upon its
|
||
dam, and a spaniel endeavours, by a thousand attractions, to engage the
|
||
attention of its master who is at dinner, when it wants to be fed by him.
|
||
Man sometimes uses the same arts with his brethren, and when he has no
|
||
other means of engaging them to act according to his inclinations,
|
||
endeavours by every servile and fawning attention to obtain their good
|
||
will. He has not time, however, to do this upon every occasion. In
|
||
civilized society he stands at all times in need of the co-operation and
|
||
assistance of great multitudes, while his whole life is scarce sufficient
|
||
to gain the friendship of a few persons. In almost every other race of
|
||
animals, each individual, when it is grown up to maturity, is entirely
|
||
independent, and in its natural state has occasion for the assistance of
|
||
no other living creature. But man has almost constant occasion for the
|
||
help of his brethren, and it is in vain for him to expect it from their
|
||
benevolence only. He will be more likely to prevail if he can interest
|
||
their self-love in his favour, and shew them that it is for their own
|
||
advantage to do for him what he requires of them. Whoever offers to
|
||
another a bargain of any kind, proposes to do this. Give me that which I
|
||
want, and you shall have this which you want, is the meaning of every such
|
||
offer; and it is in this manner that we obtain from one another the far
|
||
greater part of those good offices which we stand in need of. It is not
|
||
from the benevolence of the butcher, the brewer, or the baker that we
|
||
expect our dinner, but from their regard to their own interest. We address
|
||
ourselves, not to their humanity, but to their self-love, and never talk
|
||
to them of our own necessities, but of their advantages. Nobody but a
|
||
beggar chooses to depend chiefly upon the benevolence of his
|
||
fellow-citizens. Even a beggar does not depend upon it entirely. The
|
||
charity of well-disposed people, indeed, supplies him with the whole fund
|
||
of his subsistence. But though this principle ultimately provides him with
|
||
all the necessaries of life which he has occasion for, it neither does nor
|
||
can provide him with them as he has occasion for them. The greater part of
|
||
his occasional wants are supplied in the same manner as those of other
|
||
people, by treaty, by barter, and by purchase. With the money which one
|
||
man gives him he purchases food. The old clothes which another bestows
|
||
upon him he exchanges for other clothes which suit him better, or for
|
||
lodging, or for food, or for money, with which he can buy either food,
|
||
clothes, or lodging, as he has occasion.
|
||
|
||
As it is by treaty, by barter, and by purchase, that we obtain from one
|
||
another the greater part of those mutual good offices which we stand in
|
||
need of, so it is this same trucking disposition which originally gives
|
||
occasion to the division of labour. In a tribe of hunters or shepherds, a
|
||
particular person makes bows and arrows, for example, with more readiness
|
||
and dexterity than any other. He frequently exchanges them for cattle or
|
||
for venison, with his companions; and he finds at last that he can, in
|
||
this manner, get more cattle and venison, than if he himself went to the
|
||
field to catch them. From a regard to his own interest, therefore, the
|
||
making of bows and arrows grows to be his chief business, and he becomes a
|
||
sort of armourer. Another excels in making the frames and covers of their
|
||
little huts or moveable houses. He is accustomed to be of use in this way
|
||
to his neighbours, who reward him in the same manner with cattle and with
|
||
venison, till at last he finds it his interest to dedicate himself
|
||
entirely to this employment, and to become a sort of house-carpenter. In
|
||
the same manner a third becomes a smith or a brazier; a fourth, a tanner
|
||
or dresser of hides or skins, the principal part of the clothing of
|
||
savages. And thus the certainty of being able to exchange all that surplus
|
||
part of the produce of his own labour, which is over and above his own
|
||
consumption, for such parts of the produce of other men’s labour as he may
|
||
have occasion for, encourages every man to apply himself to a particular
|
||
occupation, and to cultivate and bring to perfection whatever talent or
|
||
genius he may possess for that particular species of business.
|
||
|
||
The difference of natural talents in different men, is, in reality, much
|
||
less than we are aware of; and the very different genius which appears to
|
||
distinguish men of different professions, when grown up to maturity, is
|
||
not upon many occasions so much the cause, as the effect of the division
|
||
of labour. The difference between the most dissimilar characters, between
|
||
a philosopher and a common street porter, for example, seems to arise not
|
||
so much from nature, as from habit, custom, and education. When they came
|
||
in to the world, and for the first six or eight years of their existence,
|
||
they were, perhaps, very much alike, and neither their parents nor
|
||
play-fellows could perceive any remarkable difference. About that age, or
|
||
soon after, they come to be employed in very different occupations. The
|
||
difference of talents comes then to be taken notice of, and widens by
|
||
degrees, till at last the vanity of the philosopher is willing to
|
||
acknowledge scarce any resemblance. But without the disposition to truck,
|
||
barter, and exchange, every man must have procured to himself every
|
||
necessary and conveniency of life which he wanted. All must have had the
|
||
same duties to perform, and the same work to do, and there could have been
|
||
no such difference of employment as could alone give occasion to any great
|
||
difference of talents.
|
||
|
||
As it is this disposition which forms that difference of talents, so
|
||
remarkable among men of different professions, so it is this same
|
||
disposition which renders that difference useful. Many tribes of animals,
|
||
acknowledged to be all of the same species, derive from nature a much more
|
||
remarkable distinction of genius, than what, antecedent to custom and
|
||
education, appears to take place among men. By nature a philosopher is not
|
||
in genius and disposition half so different from a street porter, as a
|
||
mastiff is from a grey-hound, or a grey-hound from a spaniel, or this last
|
||
from a shepherd’s dog. Those different tribes of animals, however, though
|
||
all of the same species are of scarce any use to one another. The strength
|
||
of the mastiff is not in the least supported either by the swiftness of
|
||
the greyhound, or by the sagacity of the spaniel, or by the docility of
|
||
the shepherd’s dog. The effects of those different geniuses and talents,
|
||
for want of the power or disposition to barter and exchange, cannot be
|
||
brought into a common stock, and do not in the least contribute to the
|
||
better accommodation and conveniency of the species. Each animal is still
|
||
obliged to support and defend itself, separately and independently, and
|
||
derives no sort of advantage from that variety of talents with which
|
||
nature has distinguished its fellows. Among men, on the contrary, the most
|
||
dissimilar geniuses are of use to one another; the different produces of
|
||
their respective talents, by the general disposition to truck, barter, and
|
||
exchange, being brought, as it were, into a common stock, where every man
|
||
may purchase whatever part of the produce of other men’s talents he has
|
||
occasion for.
|
||
|
||
|
||
## Extraction Guidelines
|
||
|
||
---
|
||
id: extraction-rules
|
||
name: extraction_rules
|
||
artifact_type: content
|
||
description: Guidelines for extracting economic entities from source text
|
||
version: 1.0.0
|
||
---
|
||
|
||
# Entity Extraction Rules
|
||
|
||
## What Constitutes an Entity
|
||
|
||
An economic entity is a distinct concept, actor, mechanism, or institution
|
||
that plays a functional role in Adam Smith's economic analysis. Extract
|
||
entities at the level of specificity where they carry independent meaning.
|
||
|
||
## Extraction Criteria
|
||
|
||
1. **Concepts**: Abstract economic ideas (e.g., "division of labour",
|
||
"effectual demand", "natural price"). Extract when Smith defines,
|
||
explains, or argues about the concept.
|
||
|
||
2. **Actors**: Economic agents with defined roles (e.g., "the labourer",
|
||
"the merchant", "the sovereign"). Extract when the actor performs
|
||
a distinct economic function.
|
||
|
||
3. **Mechanisms**: Processes or dynamics that produce economic effects
|
||
(e.g., "accumulation of stock", "market price adjustment",
|
||
"foreign trade"). Extract when the mechanism is described as
|
||
producing specific outcomes.
|
||
|
||
4. **Institutions**: Organised structures that shape economic behaviour
|
||
(e.g., "the corporation", "the guild", "the joint-stock company").
|
||
Extract when the institution's economic function is described.
|
||
|
||
## Granularity Rules
|
||
|
||
- Extract at the level of a single coherent concept.
|
||
- Do NOT extract synonyms as separate entities — choose the primary term
|
||
Smith uses and note variations.
|
||
- DO extract distinct aspects of a broad concept as separate entities when
|
||
Smith treats them independently (e.g., "wages of labour" and "profits
|
||
of stock" are separate from "price of commodities" even though they
|
||
compose it).
|
||
- If an entity appears across multiple chapters, extract it on first
|
||
significant appearance and note cross-references in later chapters.
|
||
|
||
## Naming Conventions
|
||
|
||
- Use Smith's own terminology where possible.
|
||
- Normalise to lowercase except for proper nouns.
|
||
- Use the most common form Smith uses (e.g., "division of labour" not
|
||
"divided labour").
|
||
|
||
## Quality Checks
|
||
|
||
- Each entity must have a definition that would be comprehensible without
|
||
reading the source chapter.
|
||
- Each entity must cite the specific book and chapter of first appearance.
|
||
- Economic Domain must be one of: Production, Distribution, Exchange,
|
||
Consumption, Accumulation, Regulation, or General Theory.
|
||
|
||
|
||
## VSM Framework Context
|
||
|
||
Use the following VSM framework as context to guide your extraction.
|
||
Prioritize entities that are likely to have clear mappings to VSM concepts,
|
||
but do not exclude entities simply because they lack an obvious mapping.
|
||
|
||
---
|
||
id: vsm-framework
|
||
name: vsm_framework
|
||
artifact_type: content
|
||
description: Stafford Beer's Viable System Model reference for economic analysis
|
||
version: 1.0.0
|
||
---
|
||
|
||
# Stafford Beer's Viable System Model (VSM)
|
||
|
||
The Viable System Model (VSM) is a model of the organisational structure of any
|
||
autonomous system capable of producing itself. It was created by management
|
||
cybernetician Stafford Beer in his books *Brain of the Firm* (1972) and
|
||
*The Heart of Enterprise* (1979).
|
||
|
||
## Core Principle: Viability
|
||
|
||
A viable system is any system organised in such a way as to meet the demands
|
||
of surviving in a changing environment. One of the prime features of systems
|
||
that survive is that they are adaptable. The VSM expresses a model for a
|
||
viable system, which is an abstracted cybernetic description applicable to
|
||
any organisation that is a going concern.
|
||
|
||
## The Five Systems
|
||
|
||
### System 1 (S1) — Operations
|
||
|
||
The primary activities that produce the organisation's purpose. These are the
|
||
operational units that directly create value. Each operational element is itself
|
||
a viable system (the principle of recursion).
|
||
|
||
**In economic terms:** Productive enterprises, factories, farms, workshops,
|
||
individual labourers performing specialised tasks, merchant operations.
|
||
|
||
**Key properties:** Autonomy within constraints, self-organisation,
|
||
direct engagement with the environment.
|
||
|
||
### System 2 (S2) — Coordination
|
||
|
||
The information channels and bodies that allow the primary activities in
|
||
System 1 to communicate with each other and that allow System 3 to monitor
|
||
and coordinate activities. System 2 dampens oscillations and resolves
|
||
conflicts between operational units.
|
||
|
||
**In economic terms:** Market price mechanisms, trade customs, standard
|
||
weights and measures, commercial law, banking clearinghouses, trade guilds.
|
||
|
||
**Key properties:** Anti-oscillatory, dampening, scheduling, conflict
|
||
resolution, standardisation.
|
||
|
||
### System 3 (S3) — Control / Operational Management
|
||
|
||
The structures and controls that establish the rules, resources, rights,
|
||
and responsibilities of System 1 and provide an interface between Systems 1
|
||
and Systems 4/5. System 3 represents the day-to-day control of the
|
||
organisation. It optimises the internal environment.
|
||
|
||
**In economic terms:** Government regulation of trade, taxation policy, labour
|
||
laws, enforcement of contracts, the "invisible hand" as emergent internal
|
||
regulation, guilds and corporations governing members.
|
||
|
||
**Key properties:** Internal regulation, resource allocation, accountability,
|
||
synergy extraction, performance management.
|
||
|
||
### System 3* (S3*) — Audit / Monitoring
|
||
|
||
The audit and monitoring channel that allows System 3 to verify information
|
||
coming from System 1 through channels other than those provided by System 2.
|
||
System 3* provides sporadic, direct access to operational reality.
|
||
|
||
**In economic terms:** Market inspections, quality checks, auditing of accounts,
|
||
surprise investigations into trade practices, verification of weights and measures.
|
||
|
||
**Key properties:** Sporadic direct investigation, reality checking, bypassing
|
||
normal reporting channels.
|
||
|
||
### System 4 (S4) — Intelligence / Adaptation
|
||
|
||
The bodies and processes that look outward to the environment to monitor
|
||
how the organisation needs to adapt to remain viable. System 4 captures
|
||
all relevant information about the outside-and-then environment. It is
|
||
responsible for strategic responses.
|
||
|
||
**In economic terms:** Foreign intelligence about trade opportunities,
|
||
market research, new technology adoption, colonial exploration and trade
|
||
route development, understanding of foreign economic systems.
|
||
|
||
**Key properties:** Environmental scanning, future orientation, strategic
|
||
planning, modelling, research and development.
|
||
|
||
### System 5 (S5) — Policy / Identity
|
||
|
||
The policy-making body that balances demands from Systems 3 and 4 and defines
|
||
the identity, values, and purpose of the organisation. System 5 provides
|
||
closure to the whole system and represents its supreme authority.
|
||
|
||
**In economic terms:** Sovereign authority, constitutional principles governing
|
||
economic policy, national economic identity, the philosophical foundations
|
||
of economic systems (mercantilism vs. free trade), the overarching purpose
|
||
of the commonwealth.
|
||
|
||
**Key properties:** Identity, ethos, supreme command, policy closure,
|
||
balancing internal and external perspectives.
|
||
|
||
## Key Concepts
|
||
|
||
### Recursion
|
||
|
||
Every viable system contains and is contained in a viable system. The same
|
||
five-system structure recurs at every level of organisation. A workshop is
|
||
a viable system within a factory, which is a viable system within an
|
||
industry, which is a viable system within a national economy.
|
||
|
||
### Variety
|
||
|
||
A measure of the number of possible states of a system. The Law of Requisite
|
||
Variety (Ashby's Law) states that only variety can absorb variety. A
|
||
controller must have at least as much variety as the system it controls.
|
||
|
||
### Requisite Variety
|
||
|
||
The principle that for effective regulation, the variety of the regulator
|
||
must match the variety of the system being regulated. This is achieved
|
||
through variety attenuation (reducing the variety coming up from operations)
|
||
and variety amplification (increasing the variety of management's responses).
|
||
|
||
### Attenuation and Amplification
|
||
|
||
Variety engineering mechanisms. Attenuation reduces variety (e.g., reporting
|
||
summaries, statistical aggregation, standardisation). Amplification increases
|
||
variety (e.g., delegation, empowerment, decentralisation).
|
||
|
||
### Algedonic Signals
|
||
|
||
Emergency signals that bypass the normal management hierarchy to alert
|
||
higher systems of critical situations requiring immediate attention. Named
|
||
from the Greek words for pain (algos) and pleasure (hedone).
|
||
|
||
**In economic terms:** Market panics, famine signals, sudden price collapses,
|
||
trade embargoes, economic crises that demand immediate sovereign intervention.
|
||
|
||
### Autonomy
|
||
|
||
The degree of freedom granted to operational units (System 1) to self-organise
|
||
within constraints set by System 3. Beer argued that maximum autonomy
|
||
consistent with systemic cohesion yields maximum viability.
|
||
|
||
### Viability
|
||
|
||
The capacity of a system to maintain a separate existence and survive in a
|
||
changing environment. A viable system continuously adapts while maintaining
|
||
its identity.
|
||
|
||
|
||
## Instructions
|
||
|
||
1. Read the source chapter carefully.
|
||
2. Identify all distinct economic concepts, actors, mechanisms, and institutions.
|
||
3. For each entity, produce a separate markdown document following the
|
||
Economic Entity Schema v1.0.
|
||
4. Each entity document must include:
|
||
- An H1 heading with the entity name
|
||
- A Definition section (20-150 words)
|
||
- A Source Chapter section citing the specific chapter
|
||
- A Context section describing where in the argument the entity appears
|
||
- An Economic Domain section classifying the entity
|
||
5. Optionally include Smith's Original Wording (direct quote) and
|
||
Modern Interpretation sections.
|
||
6. Use neutral, analytical language throughout.
|
||
7. Ensure each entity is distinct and self-contained.
|
||
|
||
## Output Format
|
||
|
||
Output each entity as a separate markdown document, delimited by
|
||
`--- ENTITY: <entity-name> ---` markers.
|