diff --git a/examples/infospace-with-history/TUTORIAL.md b/examples/infospace-with-history/TUTORIAL.md index ca57f077..de7ba1cc 100644 --- a/examples/infospace-with-history/TUTORIAL.md +++ b/examples/infospace-with-history/TUTORIAL.md @@ -62,12 +62,38 @@ examples/infospace-with-history/ │ └── vsm-reference/ # VSM framework definition │ └── output/ # Generated artifacts (LLM outputs) - ├── entities/ # Per-chapter entity extractions + ├── entities/ # Flat canonical entity set + chapter views + │ ├── division-of-labour.md # Canonical entity file (PRIMARY) + │ ├── exchange.md + │ ├── commercial-society.md + │ ├── ... + │ ├── book-1-chapter-01-entities.md # Chapter view (transclusion) + │ ├── book-1-chapter-01-prompt.md # Compiled prompt + │ ├── book-1-chapter-04-entities.md # Also references division-of-labour.md + │ └── ... ├── mappings/ # Per-chapter VSM mappings ├── analyses/ # Per-chapter synthesised analyses └── metrics/ # Cross-chapter metrics reports ``` +**Entity organisation**: The infospace maintains a **flat canonical set** +of entities — one markdown file per entity, stored directly in +`output/entities/`. When a chapter mentions an entity that already exists +(detected by slug collision), the duplicate is skipped and the original +definition is kept. This builds a **minimal necessary and sufficient set** +of entities across the entire book. + +Per-chapter `*-entities.md` files are **secondary views** that use +MarkiTect's transclusion engine (`{{ include "entity.md" }}`) to compose +entity content by reference. The same entity (e.g., `division-of-labour.md`) +can appear in multiple chapter views. Editing a canonical entity file +automatically updates every chapter view that references it. + +**Deduplication**: The pipeline tells the LLM which entities already exist +(via the `@{existing_entities}` macro in the extraction template) so it +focuses on genuinely new entities. At the file level, slug collisions +are detected and skipped as a safety net. + --- ## 3. Designing Schemas @@ -149,6 +175,10 @@ Adam Smith's *The Wealth of Nations*. @{vsm_framework} +## Existing Entities + +@{existing_entities} + ## Instructions [... detailed step-by-step instructions ...] @@ -158,8 +188,11 @@ Output each entity as a separate markdown document, delimited by `--- ENTITY: ---` markers. ``` -The three macros (`chapter_text`, `extraction_rules`, `vsm_framework`) are -resolved by looking up artifacts by name in the relevant information spaces. +The four macros (`chapter_text`, `extraction_rules`, `vsm_framework`, +`existing_entities`) are resolved by looking up artifacts by name in +the relevant information spaces. The `existing_entities` list is +dynamically generated at runtime from the canonical entity files +already on disk, enabling incremental extraction without duplication. ### Template 2: Map to VSM (`templates/map-to-vsm.md`) @@ -275,19 +308,23 @@ python process_chapters.py --all --provider openrouter --no-commit python process_chapters.py --list ``` -Prints a table showing which chapters have completed each stage: +Prints a table showing which chapters have completed each stage +(entity counts reflect the chapter view's transclusion references, +including shared entities from earlier chapters): ``` Available chapters (35): Chapter Entities Mappings Analysis ------------------------------ ------------ ------------ ------------ - book-1-chapter-01 done done done - book-1-chapter-02 done done done - book-1-chapter-03 done done done - book-1-chapter-04 done done done + book-1-chapter-01 done (13) done done + book-1-chapter-02 done (7) done done + book-1-chapter-03 done (18) done done + book-1-chapter-04 done (5) done done book-1-chapter-05 - - - ... + + Canonical entity set: 41 unique entities ``` ### Assessing metrics @@ -335,10 +372,20 @@ Place your key in one of these locations (checked in order): with real content) 3. It writes the compiled prompt to `output//-prompt.md` for inspection -4. If an LLM adapter is configured and no output file exists yet, it - **executes** the prompt and writes the result -5. The output is **stored** as a generated artifact in the repository -6. Dependency edges are **recorded** in the graph +4. If no output exists yet and an LLM adapter is configured, it + **executes** the prompt +5. **For entity extraction (stage 1):** the pipeline first binds the + list of already-existing entity slugs to `@{existing_entities}` so + the LLM knows what to skip. The LLM returns combined content with + `--- ENTITY: ---` delimiters. The pipeline splits this into + the **flat canonical directory** (`output/entities/.md`), + skipping any entity whose slug already exists. It then generates the + chapter view file with transclusion directives. The combined content + is never persisted as a single file — canonical entity files are the + source of truth. +6. **For other stages:** the result is written directly to its output file +7. The output is **stored** as a generated artifact in the repository +8. Dependency edges are **recorded** in the graph --- @@ -347,7 +394,11 @@ Place your key in one of these locations (checked in order): Every processed chapter produces a git commit containing: - Compiled prompts (`*-prompt.md`) — so you can audit exactly what was sent -- Generated outputs (`*-entities.md`, `*-mappings.md`, `*-analysis.md`) +- Canonical entity files (`output/entities/.md`) — one file per entity, + shared across chapters, first occurrence wins +- Chapter entity views (`-entities.md`) — transclusion into the + canonical entities relevant to each chapter +- Generated outputs (`*-mappings.md`, `*-analysis.md`) This means: @@ -366,7 +417,8 @@ To commit manually after reviewing: ```bash python process_chapters.py --chapter book-1-chapter-05 --provider openrouter --no-commit -# review output/entities/book-1-chapter-05-entities.md etc. +# review new entity files in output/entities/ (look for recently modified .md files) +# review chapter view in output/entities/book-1-chapter-05-entities.md git add examples/infospace-with-history/output/ git commit -m "infospace: process book-1-chapter-05" ``` @@ -407,7 +459,9 @@ how to complete the rest. python process_chapters.py --book 1 --provider openrouter --no-commit ``` -Already-processed chapters are skipped (their output files exist). +Already-processed chapters are skipped (their chapter view files exist). +Entities from earlier chapters are automatically shared — the LLM is +told which entities already exist and avoids re-extracting them. **2. Process Books II-V:** @@ -478,32 +532,44 @@ Example: if metrics show that S3* (Audit) is consistently missed, you could add a paragraph to `extraction-rules.md` explicitly asking the LLM to look for audit, inspection, and oversight mechanisms. -To re-process a specific chapter: +To re-process a specific chapter, remove its chapter view and downstream +outputs. Note: canonical entity files in `output/entities/` are shared +across chapters — only delete individual entity files if you want them +re-extracted from scratch. ```bash -rm examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md -rm examples/infospace-with-history/output/mappings/book-1-chapter-03-mappings.md -rm examples/infospace-with-history/output/analyses/book-1-chapter-03-analysis.md +rm -f examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md +rm -f examples/infospace-with-history/output/mappings/book-1-chapter-03-mappings.md +rm -f examples/infospace-with-history/output/analyses/book-1-chapter-03-analysis.md python process_chapters.py --chapter book-1-chapter-03 --provider openrouter --no-commit ``` +To also re-extract specific entities, delete their canonical files first: + +```bash +rm -f examples/infospace-with-history/output/entities/extent-of-the-market.md +# then re-process the chapter as above +``` + --- -## 12. Infrastructure Issues Found +## 12. Infrastructure Issues Found and Fixed During development we documented three issues with the MarkiTect infrastructure in `INFRA-TASKS.md`: -1. **Artifact repo doesn't store content** — the resolver returns - placeholder text; the pipeline works around this with a local cache. -2. **ContentMacro `raw_text` defaults to `""`** — causes silent data - corruption when macros are constructed programmatically. -3. **No `@{target}` syntax in TemplateAnalyzer** — macros must be +1. **Artifact repo doesn't store content** — the resolver returned + placeholder text instead of actual artifact content. +2. **ContentMacro `raw_text` defaults to `""`** — caused silent data + corruption when macros were constructed programmatically. +3. **No `@{target}` syntax in MacroParser** — macros had to be constructed manually rather than auto-detected from template text. -These are intentionally not fixed in this example (the constraint was -"no changes to markitect infrastructure"). They are tracked for future -improvement, after which the experiment can be re-run. +All three have been fixed in the markitect infrastructure. The pipeline +script (`process_chapters.py`) has been refactored to use the fixed +infrastructure directly — the local content cache, manual macro +construction, and manual substitution workarounds have been removed. +See `INFRA-TASKS.md` for details on each fix. --- diff --git a/examples/infospace-with-history/output/entities/agriculture.md b/examples/infospace-with-history/output/entities/agriculture.md new file mode 100644 index 00000000..4a52e9bb --- /dev/null +++ b/examples/infospace-with-history/output/entities/agriculture.md @@ -0,0 +1,31 @@ +# Agriculture + +## Definition + +The sector of production concerned with the cultivation of land and the raising +of crops and livestock. Smith argues that agriculture does not admit of as many +subdivisions of labour as manufactures, because seasonal rhythms prevent workers +from specialising year-round in a single task. As a result, agricultural +productivity improves less dramatically with the division of labour than +manufacturing productivity. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Agriculture is introduced as a counterpoint to manufactures. Smith notes that +the ploughman, harrower, sower, and reaper are often the same person, and that +this is why even rich countries do not surpass poor countries in agricultural +output as dramatically as in manufacturing output. + +## Economic Domain + +Production + +## Smith's Original Wording + +"The nature of agriculture, indeed, does not admit of so many subdivisions of +labour, nor of so complete a separation of one business from another, as +manufactures." diff --git a/examples/infospace-with-history/output/entities/barter.md b/examples/infospace-with-history/output/entities/barter.md new file mode 100644 index 00000000..dddfef1d --- /dev/null +++ b/examples/infospace-with-history/output/entities/barter.md @@ -0,0 +1,13 @@ +# Barter + +## Definition +Barter is a method of exchange by which goods or services are directly exchanged for other goods or services without using a medium of exchange, such as money. It is a form of trade that predates the use of money. + +## Source Chapter +Book 1, Chapter 4 + +## Context +Smith explains the limitations of the barter system, especially in a society where the division of labour is prominent. These limitations, according to Smith, led to the development and use of money as a common medium of exchange. + +## Economic Domain +Economic Anthropology, Economic History, Microeconomics diff --git a/examples/infospace-with-history/output/entities/benevolence.md b/examples/infospace-with-history/output/entities/benevolence.md new file mode 100644 index 00000000..d6f461c1 --- /dev/null +++ b/examples/infospace-with-history/output/entities/benevolence.md @@ -0,0 +1,27 @@ +# Benevolence + +## Definition + +The disposition to do good to others out of goodwill rather than self-interest. +Smith argues that benevolence is an insufficient basis for economic organisation +in a complex society. While a person may secure the friendship of a few through +appeals to benevolence, they cannot rely on it to obtain the co-operation of +the "great multitudes" they need in civilised life. Even beggars, who depend +chiefly on benevolence for their subsistence, conduct most of their actual +transactions through exchange. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +Benevolence serves as the foil to self-interest. Smith systematically argues +that while benevolence exists, it cannot scale to support the complex +interdependencies of a specialised economy, making self-interested exchange +the necessary coordinating mechanism. + +## Economic Domain + +General Theory diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-01-entities.md b/examples/infospace-with-history/output/entities/book-1-chapter-01-entities.md index 0f0592b0..507b04d9 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-01-entities.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-01-entities.md @@ -1,439 +1,52 @@ ---- ENTITY: division-of-labour --- - -# Division of Labour - -## Definition - -The separation of a work process into a number of distinct tasks, each performed -by a specialised worker, resulting in a significant increase in the productive -powers of labour. Smith identifies it as the principal cause of improvement in -the productive capacity of any trade, art, or manufacture. The effect arises -from three circumstances: increased dexterity, saved time in transition between -tasks, and the invention of labour-saving machinery. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -The division of labour is the central argument of the chapter. Smith opens by -asserting that it is the greatest source of improvement in productive powers, -then illustrates it through the pin-factory example, explains its three causal -mechanisms, and concludes by showing how it generates universal opulence through -exchange. - -## Economic Domain - -Production - -## Smith's Original Wording - -"The greatest improvements in the productive powers of labour, and the greater -part of the skill, dexterity, and judgment, with which it is anywhere directed, -or applied, seem to have been the effects of the division of labour." - -## Modern Interpretation - -The division of labour remains a foundational concept in economics and -organisational theory. Modern extensions include specialisation theory, -comparative advantage (Ricardo), and the study of transaction costs that -determine the boundaries between internal division and market exchange (Coase). - ---- ENTITY: productive-powers-of-labour --- - -# Productive Powers of Labour - -## Definition - -The capacity of human labour to produce output, measured in terms of the -quantity and quality of goods a given number of workers can produce within -a given time. Smith argues that the division of labour is the primary cause -of increases in productive power, and that differences in productive power -explain differences in national wealth. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Smith introduces productive powers as the dependent variable that the division -of labour improves. He contrasts the output of an unskilled individual worker -(one pin per day) with the output of a coordinated team under division of -labour (4,800 pins per person per day) to demonstrate the scale of improvement. - -## Economic Domain - -Production - -## Smith's Original Wording - -"This great increase in the quantity of work, which, in consequence of the -division of labour, the same number of people are capable of performing, is -owing to three different circumstances." - ---- ENTITY: dexterity-of-the-workman --- - -# Dexterity of the Workman - -## Definition - -The skill and speed a worker acquires through repeated performance of a single -specialised operation. Smith identifies the increase in dexterity as the first -of three causes by which the division of labour improves productive power. -Specialisation reduces each worker's task to one simple operation, making it -the sole employment of their life, and thereby dramatically increasing their -proficiency. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Presented as the first of three mechanisms explaining why the division of labour -increases output. Smith illustrates it with the example of nail-making: an -unskilled smith makes 200-300 nails per day, while a specialised nailer can -produce over 2,300. - -## Economic Domain - -Production - -## Smith's Original Wording - -"First, the improvement of the dexterity of the workmen, necessarily increases -the quantity of the work he can perform; and the division of labour, by reducing -every man's business to some one simple operation, and by making this operation -the sole employment of his life, necessarily increases very much the dexterity -of the workman." - ---- ENTITY: saving-of-time --- - -# Saving of Time - -## Definition - -The elimination of time lost when a worker passes from one kind of work to -another. Smith identifies this as the second mechanism by which the division of -labour increases productive power. Time is lost both in physical transition -(moving between locations and tools) and in mental transition (the sauntering -and inattention that follows switching tasks). - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Presented as the second of three mechanisms. Smith argues the loss is greater -than commonly supposed, encompassing not only travel time but a psychological -cost: workers who constantly switch tasks develop habits of "sauntering" and -"indolent careless application" that reduce their output even during active work. - -## Economic Domain - -Production - -## Smith's Original Wording - -"Secondly, the advantage which is gained by saving the time commonly lost in -passing from one sort of work to another, is much greater than we should at -first view be apt to imagine it." - ---- ENTITY: invention-of-machinery --- - -# Invention of Machinery - -## Definition - -The development of machines that facilitate and abridge labour, enabling one -person to do the work of many. Smith identifies this as the third mechanism -by which the division of labour increases productive power, and argues that -the division of labour itself stimulates invention, because workers focused -on a single operation naturally discover improvements to their specific task. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Presented as the third mechanism. Smith provides the anecdote of the boy who -automated the valve on a fire engine to free himself for play. He extends the -argument beyond workers to include machine-makers and philosophers (men of -speculation), whose own specialised observation enables them to combine -knowledge from distant fields. - -## Economic Domain - -Production - -## Smith's Original Wording - -"Thirdly, and lastly, everybody must be sensible how much labour is facilitated -and abridged by the application of proper machinery. It is unnecessary to give -any example." - ---- ENTITY: separation-of-trades --- - -# Separation of Trades - -## Definition - -The process by which distinct occupations emerge as separate specialisations, -each performed by dedicated practitioners rather than by a single person who -performs all tasks. Smith presents the separation of trades as both a -consequence and an indicator of the division of labour, noting that it -advances furthest in the most industrious and improved countries. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Smith transitions from the pin-factory example to the economy-wide observation -that in improved societies, "the farmer is generally nothing but a farmer; the -manufacturer, nothing but a manufacturer." He contrasts manufacturing, where -trades separate extensively, with agriculture, where seasonal demands prevent -full separation. - -## Economic Domain - -Production - -## Smith's Original Wording - -"The separation of different trades and employments from one another, seems to -have taken place in consequence of this advantage." - ---- ENTITY: the-workman --- - -# The Workman - -## Definition - -The individual labourer who performs productive work, whether in manufacturing -or agriculture. In the context of the division of labour, the workman is the -operative unit whose dexterity, time, and inventiveness are the channels through -which specialisation increases output. Smith portrays the workman both as a -beneficiary of the division of labour (higher output) and as its agent -(inventing machinery through focused attention). - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -The workman appears throughout the chapter as the primary actor: the pin-maker, -the nailer, the country weaver, the boy at the fire engine. Smith attributes -both the productive gains and many mechanical inventions to ordinary workmen. - -## Economic Domain - -Production - ---- ENTITY: the-philosopher --- - -# The Philosopher - -## Definition - -A person whose occupation is observation and speculation rather than direct -production — "men of speculation, whose trade it is not to do any thing, but -to observe every thing." Smith treats the philosopher as an economic actor -whose specialised function is combining knowledge from diverse fields to -produce innovations and improvements, analogous to how the workman improves -their own narrow task. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Introduced near the end of Smith's discussion of the third mechanism (invention -of machinery). Smith notes that as society progresses, philosophy itself becomes -a specialised trade, subdivided into branches, with each philosopher becoming -expert in their field — the division of labour applied to intellectual work. - -## Economic Domain - -General Theory - -## Smith's Original Wording - -"In the progress of society, philosophy or speculation becomes, like every other -employment, the principal or sole trade and occupation of a particular class of -citizens." - ---- ENTITY: universal-opulence --- - -# Universal Opulence - -## Definition - -The general material well-being that extends across all ranks of society, -including the lowest, as a consequence of the division of labour and the -resulting multiplication of production. Smith argues that through exchange, -every workman can supply others abundantly with their specialised product -and receive in return the products of others' specialisation, creating a -"general plenty" that benefits even the poorest members of a civilised society. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -The concluding argument of the chapter. Smith illustrates universal opulence -by examining the "accommodation of the most common artificer or daylabourer," -showing that even a coarse woollen coat requires the cooperation of shepherds, -wool-combers, dyers, weavers, merchants, sailors, and many others — a vast -chain of interdependent labour that would be impossible without specialisation -and exchange. - -## Economic Domain - -Distribution - -## Smith's Original Wording - -"It is the great multiplication of the productions of all the different arts, -in consequence of the division of labour, which occasions, in a well-governed -society, that universal opulence which extends itself to the lowest ranks of -the people." - ---- ENTITY: exchange --- - -# Exchange - -## Definition - -The act of trading one's surplus production for the goods produced by others. -Smith presents exchange as the mechanism by which the division of labour -translates into universal opulence: each workman disposes of their surplus -output and receives in return the surplus of others, so that all are -supplied beyond what any individual could produce alone. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Exchange appears in the chapter's conclusion as the connecting mechanism -between specialised production and general welfare. Smith implicitly treats -it as prerequisite to the division of labour (explored further in Chapter 2), -since specialisation only benefits workers if they can trade their surplus. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -"Every workman has a great quantity of his own work to dispose of beyond what -he himself has occasion for; and every other workman being exactly in the same -situation, he is enabled to exchange a great quantity of his own goods for a -great quantity or, what comes to the same thing, for the price of a great -quantity of theirs." - ---- ENTITY: co-operation-of-labour --- - -# Co-operation of Labour - -## Definition - -The interdependent collaboration of many workers across different trades and -locations to produce a single finished good. Smith demonstrates that even the -simplest consumer goods in a civilised society require the combined efforts of -thousands of workers — shepherds, miners, sailors, smiths, weavers — who -collectively make possible what no individual could achieve alone. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Smith's extended example of the day-labourer's woollen coat serves to illustrate -the vast scope of co-operation. He traces the supply chain from raw materials -through manufacture and transport to show that civilised consumption depends on -an immense network of specialised, interdependent labour. - -## Economic Domain - -Production - -## Smith's Original Wording - -"Without the assistance and co-operation of many thousands, the very meanest -person in a civilized country could not be provided, even according to, what we -very falsely imagine, the easy and simple manner in which he is commonly -accommodated." - ---- ENTITY: manufactures --- - -# Manufactures - -## Definition - -The sector of production in which raw materials are transformed into finished -goods through a series of distinct operations, each typically performed by -specialised workers. Smith contrasts manufactures with agriculture, noting that -the former admits of far greater subdivision of labour and separation of trades, -and therefore exhibits far greater improvements in productive power. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Manufactures serve as the primary setting for Smith's analysis of the division -of labour. The pin factory is a manufacture; so are the linen, woollen, and -hardware trades he references. Smith uses the greater divisibility of -manufacturing work to explain why rich countries excel more conspicuously over -poor countries in manufactures than in agriculture. - -## Economic Domain - -Production - ---- ENTITY: agriculture --- - -# Agriculture - -## Definition - -The sector of production concerned with the cultivation of land and the raising -of crops and livestock. Smith argues that agriculture does not admit of as many -subdivisions of labour as manufactures, because seasonal rhythms prevent workers -from specialising year-round in a single task. As a result, agricultural -productivity improves less dramatically with the division of labour than -manufacturing productivity. - -## Source Chapter - -Book I, Chapter 1: "Of the Division of Labour" - -## Context - -Agriculture is introduced as a counterpoint to manufactures. Smith notes that -the ploughman, harrower, sower, and reaper are often the same person, and that -this is why even rich countries do not surpass poor countries in agricultural -output as dramatically as in manufacturing output. - -## Economic Domain - -Production - -## Smith's Original Wording - -"The nature of agriculture, indeed, does not admit of so many subdivisions of -labour, nor of so complete a separation of one business from another, as -manufactures." +# Economic Entities — Book I, Chapter 1 + +{{ include "division-of-labour.md" }} + +--- + +{{ include "productive-powers-of-labour.md" }} + +--- + +{{ include "dexterity-of-the-workman.md" }} + +--- + +{{ include "saving-of-time.md" }} + +--- + +{{ include "invention-of-machinery.md" }} + +--- + +{{ include "separation-of-trades.md" }} + +--- + +{{ include "the-workman.md" }} + +--- + +{{ include "the-philosopher.md" }} + +--- + +{{ include "universal-opulence.md" }} + +--- + +{{ include "exchange.md" }} + +--- + +{{ include "co-operation-of-labour.md" }} + +--- + +{{ include "manufactures.md" }} + +--- + +{{ include "agriculture.md" }} + diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-01-prompt.md b/examples/infospace-with-history/output/entities/book-1-chapter-01-prompt.md index ac7ac98b..18bc3e7e 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-01-prompt.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-01-prompt.md @@ -541,22 +541,33 @@ changing environment. A viable system continuously adapts while maintaining its identity. +## Existing Entities + +The following entities have already been extracted from previous chapters +of this work. Do NOT re-extract any of these. If one of these entities +appears in the current chapter, you may omit it entirely — the infospace +already contains it. Only extract entities that are genuinely new. + +(none — this is the first chapter) + ## 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 +2. Review the list of existing entities above and do not duplicate them. +3. Identify all distinct economic concepts, actors, mechanisms, and institutions + that are NOT already in the existing entities list. +4. For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0. -4. Each entity document must include: +5. 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 +6. 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. +7. Use neutral, analytical language throughout. +8. Ensure each entity is distinct and self-contained. ## Output Format diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-02-entities.md b/examples/infospace-with-history/output/entities/book-1-chapter-02-entities.md index 0519243a..6104950f 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-02-entities.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-02-entities.md @@ -1,252 +1,28 @@ ---- ENTITY: propensity-to-truck-barter-and-exchange --- - -# Propensity to Truck, Barter, and Exchange - -## Definition - -An innate or fundamental disposition in human nature to negotiate, trade, and -exchange goods with others. Smith identifies this propensity as the ultimate -cause of the division of labour, arguing that it is unique to humans and -absent in all other animal species. He leaves open whether it is a primary -instinct or a consequence of the faculties of reason and speech, but treats -it as the foundational mechanism from which specialisation and economic -organisation emerge. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -This is the central thesis of the chapter. Smith argues that the division of -labour "is not originally the effect of any human wisdom" but rather the -"necessary, though very slow and gradual, consequence" of this propensity. -The entire chapter serves to establish exchange as the causal origin of -specialisation. - -## Economic Domain - -General Theory - -## Smith's Original Wording - -"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 [...] the -propensity to truck, barter, and exchange one thing for another." - -## Modern Interpretation - -This concept prefigures the modern economic assumption of rational self-interest -as the basis of market behaviour. It also anticipates evolutionary and -institutional economics debates about whether exchange is a natural disposition -or a culturally constructed institution. - ---- ENTITY: self-interest --- - -# Self-interest - -## Definition - -The motivation of individuals to pursue their own advantage in economic -transactions. Smith argues that in civilised society, individuals obtain the -co-operation of others not through appeals to benevolence but by engaging -their self-love — showing them that it is to their own advantage to provide -what is desired. Self-interest is the engine that makes exchange function: -each party to a bargain acts from regard to their own benefit. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -Smith introduces self-interest through the celebrated passage about the -butcher, brewer, and baker. He contrasts it with benevolence, arguing that -we cannot rely on the goodwill of others for our daily needs in a society -of many, and that self-interest provides a more reliable and universal basis -for economic co-operation. - -## Economic Domain - -General Theory - -## Smith's Original Wording - -"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." - ---- ENTITY: the-bargain --- - -# The Bargain - -## Definition - -A voluntary bilateral exchange in which each party offers something the other -wants. Smith defines the bargain as the fundamental unit of economic -interaction: "Give me that which I want, and you shall have this which you -want." It is through bargaining that individuals obtain "the far greater part -of those good offices which we stand in need of" in civilised society, as -opposed to relying on benevolence or coercion. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -The bargain is presented as the practical expression of the propensity to -exchange. Smith argues that it is the dominant mode of economic interaction, -used even by beggars who exchange charity-received goods for things they -actually need. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -"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." - ---- ENTITY: benevolence --- - -# Benevolence - -## Definition - -The disposition to do good to others out of goodwill rather than self-interest. -Smith argues that benevolence is an insufficient basis for economic organisation -in a complex society. While a person may secure the friendship of a few through -appeals to benevolence, they cannot rely on it to obtain the co-operation of -the "great multitudes" they need in civilised life. Even beggars, who depend -chiefly on benevolence for their subsistence, conduct most of their actual -transactions through exchange. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -Benevolence serves as the foil to self-interest. Smith systematically argues -that while benevolence exists, it cannot scale to support the complex -interdependencies of a specialised economy, making self-interested exchange -the necessary coordinating mechanism. - -## Economic Domain - -General Theory - ---- ENTITY: surplus-produce --- - -# Surplus Produce - -## Definition - -The portion of a worker's output that exceeds their own consumption needs and -is therefore available for exchange. Smith argues that the certainty of being -able to exchange surplus produce for the products of other workers' labour -is what encourages every person to dedicate themselves to a particular -occupation. Surplus is thus both the material prerequisite and the incentive -for specialisation. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -Introduced in the passage describing the emergence of specialised trades in -a tribal society. The armourer, carpenter, smith, and tanner each produce -more of their specialty than they can personally consume, and exchange the -surplus for other goods, reinforcing their commitment to specialisation. - -## Economic Domain - -Production - -## Smith's Original Wording - -"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." - ---- ENTITY: difference-of-talents --- - -# Difference of Talents - -## Definition - -The observable variation in skills, aptitudes, and abilities among individuals -in different occupations. Smith makes the striking argument that this -difference is largely the effect rather than the cause of the division of -labour: people are born with roughly equal abilities, and it is their -different occupations, shaped by habit, custom, and education, that create -the apparent differences. He contrasts humans with dogs, where natural breed -differences are far greater but cannot be made useful because animals lack -the capacity for exchange. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -This argument occupies the final portion of the chapter. Smith uses it to -reinforce his claim that exchange, not innate difference, is the driver of -specialisation. The philosopher and the street porter were "very much alike" -until different employments shaped them differently. - -## Economic Domain - -General Theory - -## Smith's Original Wording - -"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." - ---- ENTITY: common-stock --- - -# Common Stock - -## Definition - -The aggregate pool of goods and services created when individuals bring -their diverse specialised products together through exchange. Smith argues -that among humans, unlike animals, different talents are made useful to -one another because their products can be "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." This common stock is the -emergent result of widespread exchange among specialised producers. - -## Source Chapter - -Book I, Chapter 2: "Of the Principle which gives Occasion to the Division -of Labour" - -## Context - -Appears in the chapter's concluding argument comparing humans and animals. -While a mastiff cannot benefit from a greyhound's speed due to lack of -exchange, humans can pool their different abilities through trade, making -all talents contribute to the general welfare. - -## Economic Domain - -Exchange +# Economic Entities — Book I, Chapter 2 + +{{ include "propensity-to-truck-barter-and-exchange.md" }} + +--- + +{{ include "self-interest.md" }} + +--- + +{{ include "the-bargain.md" }} + +--- + +{{ include "benevolence.md" }} + +--- + +{{ include "surplus-produce.md" }} + +--- + +{{ include "difference-of-talents.md" }} + +--- + +{{ include "common-stock.md" }} + diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-02-prompt.md b/examples/infospace-with-history/output/entities/book-1-chapter-02-prompt.md index b4472f33..85786d88 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-02-prompt.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-02-prompt.md @@ -376,22 +376,45 @@ changing environment. A viable system continuously adapts while maintaining its identity. +## Existing Entities + +The following entities have already been extracted from previous chapters +of this work. Do NOT re-extract any of these. If one of these entities +appears in the current chapter, you may omit it entirely — the infospace +already contains it. Only extract entities that are genuinely new. + +- agriculture +- co-operation-of-labour +- dexterity-of-the-workman +- division-of-labour +- exchange +- invention-of-machinery +- manufactures +- productive-powers-of-labour +- saving-of-time +- separation-of-trades +- the-philosopher +- the-workman +- universal-opulence + ## 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 +2. Review the list of existing entities above and do not duplicate them. +3. Identify all distinct economic concepts, actors, mechanisms, and institutions + that are NOT already in the existing entities list. +4. For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0. -4. Each entity document must include: +5. 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 +6. 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. +7. Use neutral, analytical language throughout. +8. Ensure each entity is distinct and self-contained. ## Output Format diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md b/examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md index 684a4ed4..952d02ff 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-03-entities.md @@ -1,507 +1,72 @@ +# Economic Entities — Book I, Chapter 3 +{{ include "extent-of-the-market.md" }} -I'll analyze Chapter III of *The Wealth of Nations* and extract the distinct economic entities. Let me work through the chapter systematically. +--- ---- ENTITY: extent of the market --- +{{ include "power-of-exchanging.md" }} -# Extent of the Market +--- -## Definition +{{ include "surplus-produce.md" }} -The reach and size of the exchange network available to producers, which determines how far the division of labour can be carried. Smith argues that the degree of specialisation in any economy is fundamentally constrained by the number of potential buyers and the accessibility of those buyers. A small, isolated market forces individuals to remain generalists, while a large, well-connected market permits extreme specialisation. +--- -## Source Chapter +{{ include "water-carriage.md" }} -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" +--- -## Context +{{ include "land-carriage.md" }} -This is the central concept of the chapter and its titular argument. Smith opens by establishing that the power of exchanging gives occasion to the division of labour, and therefore the extent of that division "must always be limited by the extent of that power, or, in other words, by the extent of the market." The remainder of the chapter illustrates this principle through examples of isolated versus connected economies. +--- -## Economic Domain +{{ include "country-workman.md" }} -Exchange +--- -## Smith's Original Wording +{{ include "porter.md" }} -> "As it is the power of exchanging that gives occasion to the division of labour, so the extent of this division must always be limited by the extent of that power, or, in other words, by the extent of the market." +--- -## Modern Interpretation +{{ include "nailer.md" }} -This concept anticipates modern ideas about market size and economies of scale. A firm cannot profitably specialise in a niche product unless the addressable market is large enough to absorb its output. It also prefigures theories of economic geography and trade liberalisation, where expanding market access enables greater productivity through specialisation. +--- ---- ENTITY: power of exchanging --- +{{ include "inland-navigation.md" }} -# Power of Exchanging +--- -## Definition +{{ include "maritime-commerce.md" }} -The capacity of economic agents to trade the surplus produce of their own labour for the produce of others. This power is the precondition for the division of labour: without the ability to exchange, there is no incentive to specialise, since a worker cannot consume the entirety of a single specialised output. The power of exchanging is shaped by transportation infrastructure, population density, and the absence of political barriers to trade. +--- -## Source Chapter +{{ include "mediterranean-sea-as-economic-geography.md" }} -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" +--- -## Context +{{ include "self-sufficiency-of-the-farmer.md" }} -Smith introduces this concept in the chapter's opening sentence as the causal mechanism linking market size to specialisation. It serves as the bridge between the division of labour (Chapter 1-2) and the geographic and infrastructural arguments that follow. +--- -## Economic Domain +{{ include "encouragement-to-industry.md" }} -Exchange +--- -## Smith's Original Wording +{{ include "cost-of-transport-relative-to-value.md" }} -> "As it is the power of exchanging that gives occasion to the division of labour, so the extent of this division must always be limited by the extent of that power." +--- -## Modern Interpretation +{{ include "improvement-of-art-and-industry.md" }} -This corresponds to the modern concept of market access or trade connectivity — the practical ability of producers to reach buyers, encompassing transaction costs, transportation costs, and institutional barriers to exchange. +--- ---- ENTITY: surplus produce --- +{{ include "territorial-obstruction-of-trade.md" }} -# Surplus Produce +--- -## Definition +{{ include "insurance-differential-land-vs-water.md" }} -The portion of a worker's output that exceeds their own consumption needs. Surplus produce is the material basis of exchange: a specialised worker produces far more of a single good than they can personally use, and must trade the excess for other necessities. Without the ability to dispose of surplus, specialisation becomes economically irrational, and the division of labour cannot proceed. +--- -## Source Chapter +{{ include "north-american-colonial-settlement-pattern.md" }} -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith references surplus produce when explaining why small markets prevent specialisation. A person in a tiny market cannot "exchange all that surplus part of the produce of his own labour, which is over and above his own consumption," making full-time specialisation untenable. - -## Economic Domain - -Production - -## Smith's Original Wording - -> "...for want of the power 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 has occasion for." - -## Modern Interpretation - -This anticipates the concept of marketable surplus in development economics — the output beyond subsistence that enables participation in market exchange and is a prerequisite for commercialisation and economic growth. - ---- ENTITY: water-carriage --- - -# Water-Carriage - -## Definition - -The transportation of goods by navigable rivers, canals, and sea routes. Smith identifies water-carriage as vastly superior to land-carriage in cost-efficiency, demonstrating that a ship crewed by six to eight men can transport the same quantity of goods as fifty waggons requiring a hundred men and four hundred horses. This cost advantage means that water-carriage dramatically expands the effective market available to producers, enabling finer division of labour. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Water-carriage is the chapter's primary mechanism for explaining geographic variation in economic development. Smith argues that civilisation and industry naturally arise first on sea-coasts and navigable rivers because water transport opens "a more extensive market... to every sort of industry than what land-carriage alone can afford it." - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "As by means of water-carriage, a more extensive market is opened to every sort of industry than what land-carriage alone can afford it, so it is upon the sea-coast, and along the banks of navigable rivers, that industry of every kind naturally begins to subdivide and improve itself." - -## Modern Interpretation - -This is an early articulation of how transportation costs shape economic geography. Modern trade theory and economic geography (Krugman's New Economic Geography) formalise the same insight: reductions in transport costs expand effective market size, enabling agglomeration economies and deeper specialisation. - ---- ENTITY: land-carriage --- - -# Land-Carriage - -## Definition - -The transportation of goods overland by waggon, cart, or pack animal. Smith characterises land-carriage as comparatively expensive and limited in capacity, requiring large numbers of men and horses to move modest quantities of goods. The high cost of land-carriage restricts overland trade to goods of high value-to-weight ratio, thereby constraining the extent of the market for inland regions and limiting the division of labour there. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith uses the London-to-Edinburgh comparison to quantify the inefficiency of land-carriage: a broad-wheeled waggon attended by two men with eight horses carries only four tons in six weeks, while a ship with a similar crew carries two hundred tons in the same time. This stark contrast demonstrates why inland economies develop later. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "A broad-wheeled waggon, attended by two men, and drawn by eight horses, in about six weeks time, carries and brings back between London and Edinburgh near four ton weight of goods." - -## Modern Interpretation - -The concept maps directly to modern analysis of infrastructure costs and logistics efficiency. The principle that high transport costs segment markets and inhibit specialisation remains central to development economics and trade policy. - ---- ENTITY: country workman --- - -# Country Workman - -## Definition - -A rural artisan or tradesman who, due to the limited extent of the local market, must perform a wide variety of tasks rather than specialising in a single operation. The country workman is the antithesis of the specialised urban worker: a country carpenter must also serve as joiner, cabinet-maker, carver, wheel-wright, plough-wright, and waggon-maker, while a country smith handles every sort of work in iron. This multi-functional role is an economic consequence of insufficient market demand to support narrow specialisation. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith uses the country workman to illustrate how small markets force generalism. The contrast between the country carpenter (who does everything in wood) and the urban specialist (who does only one thing) is direct evidence for the chapter's thesis that the division of labour depends on market extent. - -## Economic Domain - -Production - -## Smith's Original Wording - -> "A country carpenter deals in every sort of work that is made of wood; a country smith in every sort of work that is made of iron. The former is not only a carpenter, but a joiner, a cabinet-maker, and even a carver in wood, as well as a wheel-wright, a plough-wright, a cart and waggon-maker." - -## Modern Interpretation - -This illustrates the modern concept of economies of specialisation versus generalisation. In development economics, the persistence of multi-occupation households in rural areas reflects the same constraint Smith identified: insufficient local demand to support full-time specialisation. - ---- ENTITY: porter --- - -# Porter - -## Definition - -An urban labourer whose occupation consists of carrying goods and burdens for hire. Smith uses the porter as the exemplary case of a trade so specialised and dependent on volume of demand that it can only exist in a great town. A village or even an ordinary market-town cannot generate enough demand for carrying services to provide a porter with constant employment, making this trade the paradigmatic illustration of market-size-dependent specialisation. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -The porter is introduced immediately after the chapter's thesis statement as the first concrete illustration. Smith notes that "a porter can find employment and subsistence in no other place" than a great town, establishing the principle that some trades require a minimum threshold of market activity to exist. - -## Economic Domain - -Production - -## Smith's Original Wording - -> "A porter, for example, can find employment and subsistence in no other place. A village is by much too narrow a sphere for him; even an ordinary market-town is scarce large enough to afford him constant occupation." - -## Modern Interpretation - -This anticipates the concept of minimum efficient scale and threshold effects in urban economics. Certain service occupations require minimum population densities to be viable — an insight formalised in central place theory (Christaller, 1933). - ---- ENTITY: nailer --- - -# Nailer - -## Definition - -A specialised metalworker whose sole occupation is the manufacture of nails. Smith uses the nailer as a quantitative illustration of the impossibility of extreme specialisation in a small market. A nailer producing a thousand nails per day (three hundred thousand per year) could not dispose of even a single day's output in the remote highlands of Scotland, making the trade unviable there despite the productivity gains of specialisation. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -The nailer example follows the discussion of the country smith who must do all types of ironwork. It provides Smith's most precise numerical illustration of the mismatch between specialised output volume and local demand in a thin market. - -## Economic Domain - -Production - -## Smith's Original Wording - -> "It is impossible there should be such a trade as even that of a nailer in the remote and inland parts of the highlands of Scotland. Such a workman at the rate of a thousand nails a-day, and three hundred working days in the year, will make three hundred thousand nails in the year. But in such a situation it would be impossible to dispose of one thousand, that is, of one day's work in the year." - -## Modern Interpretation - -This is a clear early articulation of the relationship between production scale and market absorption capacity. It illustrates why high-volume, low-margin manufacturing concentrates in areas with access to large markets — a principle underlying modern industrial location theory. - ---- ENTITY: inland navigation --- - -# Inland Navigation - -## Definition - -The system of navigable rivers, canals, and waterways that enables water-borne transport of goods within the interior of a country. Smith identifies inland navigation as a primary determinant of early economic development, arguing that civilisations with extensive river systems and canals (Egypt, Bengal, China) developed agriculture and manufactures earlier than those without. The key economic function is to extend the effective market to inland areas that would otherwise be limited to costly land-carriage. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith devotes the latter half of the chapter to demonstrating that historically early civilisations — Egypt along the Nile, Bengal along the Ganges, eastern China along its river systems — owed their early development to the advantages of inland navigation. He contrasts these with inland Africa and Tartary, where the absence of navigable waterways left populations in "the same barbarous and uncivilized state." - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "The extent and easiness of this inland navigation was probably one of the principal causes of the early improvement of Egypt." - -## Modern Interpretation - -This concept foreshadows modern analysis of how infrastructure endowments shape long-run economic development. The geographical determinism in Smith's argument has been formalised in work by scholars like Gallup, Sachs, and Mellinger on how access to navigable waterways correlates with economic outcomes. - ---- ENTITY: maritime commerce --- - -# Maritime Commerce - -## Definition - -Trade conducted by sea between ports and coastal regions, as distinct from inland river trade. Smith argues that maritime commerce is the most powerful mechanism for extending markets because it connects distant parts of the world that could never trade overland. The Mediterranean Sea, with its calm waters, numerous islands, and proximate shores, served as the cradle of maritime commerce in the ancient world, enabling the earliest civilisations to trade across vast distances. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith transitions from the London-Edinburgh transport comparison to a global historical argument. Maritime commerce explains why coastal nations civilised first, why the Mediterranean basin was the seat of early civilisation, and why interior continental regions like Africa and Tartary remained undeveloped. The absence of "great inlets" in Africa is contrasted with the Baltic, Adriatic, and Mediterranean in Europe. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "There could be little or no commerce of any kind between the distant parts of the world. What goods could bear the expense of land-carriage between London and Calcutta?" - -## Modern Interpretation - -Smith's emphasis on maritime trade as the engine of globalisation and development anticipates modern trade theory's focus on shipping costs and port access as determinants of trade volume and economic integration. - ---- ENTITY: Mediterranean Sea (as economic geography) --- - -# Mediterranean Sea (as Economic Geography) - -## Definition - -The enclosed body of water that Smith identifies as the geographical precondition for the earliest civilisations in the Western world. Its economic significance derives from its physical properties: the absence of tides, calm surface waters, numerous islands providing waypoints, and proximate opposing shores — all of which made it uniquely suited to early navigation when sailors feared to lose sight of land. The Mediterranean thus functioned as a natural market-expanding infrastructure, enabling coastal peoples to trade and specialise. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith presents the Mediterranean as the historical centrepiece of his argument that water-carriage drives civilisation. He argues that nations around this sea "appear to have been first civilized" precisely because its geography facilitated early maritime commerce. This sets up the specific examples of Egypt, Phoenicia, and Carthage. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "That sea, by far the greatest inlet that is known in the world, having no tides, nor consequently any waves, except such as are caused by the wind only, was, by the smoothness of its surface, as well as by the multitude of its islands, and the proximity of its neighbouring shores, extremely favourable to the infant navigation of the world." - -## Modern Interpretation - -This is an early example of geographic determinism in economic thought — the idea that natural geography shapes comparative advantage and development trajectories. Modern economic geography continues to study how natural harbours, waterways, and geographic features influence trade patterns and development. - ---- ENTITY: self-sufficiency of the farmer --- - -# Self-Sufficiency of the Farmer - -## Definition - -The condition in which a farmer in a remote or sparsely populated area must perform all essential trades for his own household — butcher, baker, and brewer — because the local market is too thin to support separate specialists in these trades. Self-sufficiency is presented not as an ideal but as an economic constraint imposed by market isolation. It represents the minimal degree of division of labour, where the household is the entire economic unit. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith introduces the self-sufficient highland farmer immediately after the porter example, as the polar opposite case. Where the porter requires a great town, the highland farmer exists in a market so small that no specialisation at all is possible. "Every farmer must be butcher, baker, and brewer, for his own family." - -## Economic Domain - -Production - -## Smith's Original Wording - -> "In the lone houses and very small villages which are scattered about in so desert a country as the highlands of Scotland, every farmer must be butcher, baker, and brewer, for his own family." - -## Modern Interpretation - -This maps to the concept of subsistence economy or autarky at the household level. Development economists recognise the transition from household self-sufficiency to market participation as a fundamental stage in economic development, driven by exactly the market-access factors Smith describes. - ---- ENTITY: encouragement to industry --- - -# Encouragement to Industry - -## Definition - -The incentive effect that market access and trade opportunities exert on productive activity. When two places can trade with each other, they "mutually afford" encouragement to each other's industry — meaning that the existence of buyers stimulates producers to increase output, improve methods, and specialise further. Conversely, when markets are isolated, the absence of demand discourages investment in productive improvements. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith uses this concept to explain the reciprocal benefits of trade between London and Edinburgh, and between London and Calcutta. The ability to trade does not merely transfer goods but actively stimulates production in both locations by expanding the effective demand each faces. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "Those two cities, however, at present carry on a very considerable commerce with each other, and by mutually affording a market, give a good deal of encouragement to each other's industry." - -## Modern Interpretation - -This anticipates the modern concept of trade as a growth engine — the idea that market integration creates positive-sum outcomes by expanding demand and stimulating productivity gains. It is closely related to the concept of gains from trade in international economics. - ---- ENTITY: cost of transport relative to value --- - -# Cost of Transport Relative to Value - -## Definition - -The principle that the economic viability of trading a good over distance depends on the ratio of its transport cost to its market value. Only goods whose price is "very considerable in proportion to their weight" can bear the expense of long-distance land-carriage. This ratio determines which goods enter long-distance trade and which remain locally consumed, thereby shaping the composition and volume of commerce between regions. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith introduces this principle in the London-Edinburgh comparison, noting that if only land-carriage existed, trade would be restricted to high-value-to-weight goods. He extends the argument to the hypothetical of land-carriage between London and Calcutta, where the expense would prohibit all but the most precious commodities — and even those could not be safely transported through "the territories of so many barbarous nations." - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "...as no goods could be transported from the one to the other, except such whose price was very considerable in proportion to their weight, they could carry on but a small part of that commerce which at present subsists between them." - -## Modern Interpretation - -This is a precursor to the modern concept of trade costs and the gravity model of trade, which predicts that trade volumes depend inversely on transport costs and directly on market size. The value-to-weight ratio remains a key determinant of which goods enter international trade. - ---- ENTITY: improvement of art and industry --- - -# Improvement of Art and Industry - -## Definition - -The progressive advancement of productive techniques, manufacturing methods, and economic organisation that accompanies the expansion of markets. Smith argues that such improvements naturally begin in areas with water-carriage access, where the whole world serves as a potential market, and only later extend to inland regions. The concept links market extent to technological and organisational progress: larger markets incentivise innovation by rewarding specialisation and creating demand for refined products. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -This concept appears in the transitional passage between Smith's transport-cost analysis and his historical survey of civilisations. It establishes the causal chain: water-carriage → expanded markets → division of labour → improvement of art and industry. The historical examples (Egypt, Bengal, China) then serve as evidence. - -## Economic Domain - -Production - -## Smith's Original Wording - -> "Since such, therefore, are the advantages of water-carriage, it is natural that the first improvements of art and industry should be made where this conveniency opens the whole world for a market to the produce of every sort of labour." - -## Modern Interpretation - -This concept anticipates endogenous growth theory, which holds that market size affects the rate of innovation. Larger markets increase the returns to developing new techniques, creating a positive feedback loop between market expansion and technological progress. - ---- ENTITY: territorial obstruction of trade --- - -# Territorial Obstruction of Trade - -## Definition - -The capacity of a nation controlling territory along a trade route to impede or block the commerce of upstream or inland nations. When a river passes through foreign territory before reaching the sea, the controlling nation can obstruct communication between the interior country and maritime markets. This political-geographic constraint limits the effective market available to inland producers regardless of the physical navigability of the waterway. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith introduces this concept when explaining why Africa and interior Asia remained undeveloped despite having some large rivers. He illustrates it specifically with the Danube: its navigation is "of very little use to the different states of Bavaria, Austria, and Hungary" because none of them controls the river's full course to the Black Sea. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "The commerce, besides, which any nation can carry on by means of a river which does not break itself into any great number of branches or canals, and which runs into another territory before it reaches the sea, can never be very considerable, because it is always in the power of the nations who possess that other territory to obstruct the communication between the upper country and the sea." - -## Modern Interpretation - -This identifies what modern economists and political scientists call transit risk or landlocked disadvantage. Landlocked countries today face systematically higher trade costs and dependence on neighbours' infrastructure and political goodwill — a constraint that continues to impede development, as documented in extensive World Bank research. - ---- ENTITY: insurance differential (land vs. water) --- - -# Insurance Differential (Land vs. Water) - -## Definition - -The difference in risk premiums charged for insuring goods transported by land versus by water. Smith includes this as a component of transport cost, noting that the cost of water-carriage must account for "the value of the superior risk, or the difference of the insurance between land and water-carriage." Despite this risk premium, water-carriage remains far cheaper overall due to its vastly greater efficiency in labour and capital. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -This appears within Smith's detailed cost comparison of moving two hundred tons of goods between London and Edinburgh by land versus by water. After cataloguing the costs of men, horses, and waggons for land transport, he notes that water transport costs include maintenance of a small crew, wear on the ship, and this insurance differential. - -## Economic Domain - -Exchange - -## Smith's Original Wording - -> "...together with the value of the superior risk, or the difference of the insurance between land and water-carriage." - -## Modern Interpretation - -This is an early recognition that transport costs include not just direct logistics expenses but also risk-adjusted costs — what modern logistics and finance would call the risk premium or cost of insurance in supply chain management. - ---- ENTITY: North American colonial settlement pattern --- - -# North American Colonial Settlement Pattern - -## Definition - -The observed geographic pattern in which European plantations and settlements in North America concentrated along the sea-coast and the banks of navigable rivers, rarely extending to any considerable inland distance. Smith presents this as contemporary empirical evidence for his thesis that market access via water-carriage drives economic development and settlement. - -## Source Chapter - -Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" - -## Context - -Smith cites the colonial settlement pattern immediately after arguing that inland areas develop later than coastal ones. It serves as a bridge between his theoretical argument about water-carriage and his historical survey of ancient civilisations, showing that the same principle operates in the contemporary New World. - -## Economic Domain - -General Theory - -## Smith's Original Wording - -> "In our North American colonies, the plantations have constantly followed either the sea-coast or the banks of the navigable rivers, and have scarce anywhere extended themselves to any considerable distance from both." - -## Modern Interpretation - -This observation aligns with modern economic geography's finding that population density and economic activity correlate strongly with proximity to coasts and navigable waterways. It also reflects the broader principle that infrastructure access is a primary determinant of settlement patterns. diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-03-prompt.md b/examples/infospace-with-history/output/entities/book-1-chapter-03-prompt.md index 1c1cd492..3cf90536 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-03-prompt.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-03-prompt.md @@ -402,22 +402,52 @@ changing environment. A viable system continuously adapts while maintaining its identity. +## Existing Entities + +The following entities have already been extracted from previous chapters +of this work. Do NOT re-extract any of these. If one of these entities +appears in the current chapter, you may omit it entirely — the infospace +already contains it. Only extract entities that are genuinely new. + +- agriculture +- benevolence +- co-operation-of-labour +- common-stock +- dexterity-of-the-workman +- difference-of-talents +- division-of-labour +- exchange +- invention-of-machinery +- manufactures +- productive-powers-of-labour +- propensity-to-truck-barter-and-exchange +- saving-of-time +- self-interest +- separation-of-trades +- surplus-produce +- the-bargain +- the-philosopher +- the-workman +- universal-opulence + ## 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 +2. Review the list of existing entities above and do not duplicate them. +3. Identify all distinct economic concepts, actors, mechanisms, and institutions + that are NOT already in the existing entities list. +4. For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0. -4. Each entity document must include: +5. 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 +6. 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. +7. Use neutral, analytical language throughout. +8. Ensure each entity is distinct and self-contained. ## Output Format diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-04-entities.md b/examples/infospace-with-history/output/entities/book-1-chapter-04-entities.md index ee42056b..7ddbcdea 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-04-entities.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-04-entities.md @@ -1,74 +1,20 @@ ---- ENTITY: Division of Labour --- -# Division of Labour +# Economic Entities — Book I, Chapter 4 -## Definition -Division of Labour refers to the process of splitting up a task into a series of smaller tasks, each of which is performed by a specialist worker. This allows for an increase in productivity and efficiency as workers can focus on one or a few tasks where they can apply their skills, rather than having to learn and perform all tasks required to produce a good or service. +{{ include "division-of-labour.md" }} -## Source Chapter -Book 1, Chapter 4 +--- -## Context -According to Adam Smith, the division of labour has been a fundamental aspect of economic progress. His discussion of the division of labour in this chapter is focused on the difficulties that arise when individuals specializing in different tasks need to exchange goods and services. +{{ include "commercial-society.md" }} -## Economic Domain -Labour Economics, Microeconomics +--- ---- ENTITY: Commercial Society --- -# Commercial Society +{{ include "money.md" }} -## Definition -Commercial Society refers to a society in which the majority of economic activity is based on the exchange of goods and services. In such a society, individuals rely on the production of others for the majority of their needs and wants, facilitated by the use of money as a medium of exchange. +--- -## Source Chapter -Book 1, Chapter 4 +{{ include "commodity.md" }} -## Context -Smith uses the concept of a commercial society to explain the development of complex economies where individuals become increasingly specialized in their work and depend on trade with others to meet their needs. +--- -## Economic Domain -Economic Sociology, Economic History, Microeconomics +{{ include "barter.md" }} ---- ENTITY: Money --- -# Money - -## Definition -Money is a medium of exchange that is widely accepted in transactions involving goods, services, and repayment of debts. It serves as a store of value and a standard of deferred payment. Money can take various forms, including coins, banknotes, and digital tokens. - -## Source Chapter -Book 1, Chapter 4 - -## Context -Smith discusses the origin and use of money. He argues that the emergence of money is a solution to the problems of barter, providing a universally acceptable medium of exchange that facilitates trade and the division of labour in a commercial society. - -## Economic Domain -Monetary Economics, Macroeconomics - ---- ENTITY: Commodity --- -# Commodity - -## Definition -A commodity is a basic good that is used in commerce and can be interchanged with other commodities of the same type. Commodities are most often used as inputs in the production of other goods or services. Their quality may differ slightly but is essentially uniform across producers. - -## Source Chapter -Book 1, Chapter 4 - -## Context -Smith discusses commodities in the context of exchange and barter, where one commodity is traded for another before the advent of money. He also makes reference to various commodities used as a medium of exchange in different societies. - -## Economic Domain -Microeconomics, Commodities Market - ---- ENTITY: Barter --- -# Barter - -## Definition -Barter is a method of exchange by which goods or services are directly exchanged for other goods or services without using a medium of exchange, such as money. It is a form of trade that predates the use of money. - -## Source Chapter -Book 1, Chapter 4 - -## Context -Smith explains the limitations of the barter system, especially in a society where the division of labour is prominent. These limitations, according to Smith, led to the development and use of money as a common medium of exchange. - -## Economic Domain -Economic Anthropology, Economic History, Microeconomics \ No newline at end of file diff --git a/examples/infospace-with-history/output/entities/book-1-chapter-04-prompt.md b/examples/infospace-with-history/output/entities/book-1-chapter-04-prompt.md index 944ad942..b738d078 100644 --- a/examples/infospace-with-history/output/entities/book-1-chapter-04-prompt.md +++ b/examples/infospace-with-history/output/entities/book-1-chapter-04-prompt.md @@ -481,22 +481,73 @@ changing environment. A viable system continuously adapts while maintaining its identity. +## Existing Entities + +The following entities have already been extracted from previous chapters +of this work. Do NOT re-extract any of these. If one of these entities +appears in the current chapter, you may omit it entirely — the infospace +already contains it. Only extract entities that are genuinely new. + +- agriculture +- barter +- benevolence +- co-operation-of-labour +- commercial-society +- commodity +- common-stock +- cost-of-transport-relative-to-value +- country-workman +- dexterity-of-the-workman +- difference-of-talents +- division-of-labour +- encouragement-to-industry +- exchange +- extent-of-the-market +- improvement-of-art-and-industry +- inland-navigation +- insurance-differential-land-vs-water +- invention-of-machinery +- land-carriage +- manufactures +- maritime-commerce +- mediterranean-sea-as-economic-geography +- money +- nailer +- north-american-colonial-settlement-pattern +- porter +- power-of-exchanging +- productive-powers-of-labour +- propensity-to-truck-barter-and-exchange +- saving-of-time +- self-interest +- self-sufficiency-of-the-farmer +- separation-of-trades +- surplus-produce +- territorial-obstruction-of-trade +- the-bargain +- the-philosopher +- the-workman +- universal-opulence +- water-carriage + ## 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 +2. Review the list of existing entities above and do not duplicate them. +3. Identify all distinct economic concepts, actors, mechanisms, and institutions + that are NOT already in the existing entities list. +4. For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0. -4. Each entity document must include: +5. 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 +6. 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. +7. Use neutral, analytical language throughout. +8. Ensure each entity is distinct and self-contained. ## Output Format diff --git a/examples/infospace-with-history/output/entities/co-operation-of-labour.md b/examples/infospace-with-history/output/entities/co-operation-of-labour.md new file mode 100644 index 00000000..070e8750 --- /dev/null +++ b/examples/infospace-with-history/output/entities/co-operation-of-labour.md @@ -0,0 +1,31 @@ +# Co-operation of Labour + +## Definition + +The interdependent collaboration of many workers across different trades and +locations to produce a single finished good. Smith demonstrates that even the +simplest consumer goods in a civilised society require the combined efforts of +thousands of workers — shepherds, miners, sailors, smiths, weavers — who +collectively make possible what no individual could achieve alone. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Smith's extended example of the day-labourer's woollen coat serves to illustrate +the vast scope of co-operation. He traces the supply chain from raw materials +through manufacture and transport to show that civilised consumption depends on +an immense network of specialised, interdependent labour. + +## Economic Domain + +Production + +## Smith's Original Wording + +"Without the assistance and co-operation of many thousands, the very meanest +person in a civilized country could not be provided, even according to, what we +very falsely imagine, the easy and simple manner in which he is commonly +accommodated." diff --git a/examples/infospace-with-history/output/entities/commercial-society.md b/examples/infospace-with-history/output/entities/commercial-society.md new file mode 100644 index 00000000..be8acd6c --- /dev/null +++ b/examples/infospace-with-history/output/entities/commercial-society.md @@ -0,0 +1,13 @@ +# Commercial Society + +## Definition +Commercial Society refers to a society in which the majority of economic activity is based on the exchange of goods and services. In such a society, individuals rely on the production of others for the majority of their needs and wants, facilitated by the use of money as a medium of exchange. + +## Source Chapter +Book 1, Chapter 4 + +## Context +Smith uses the concept of a commercial society to explain the development of complex economies where individuals become increasingly specialized in their work and depend on trade with others to meet their needs. + +## Economic Domain +Economic Sociology, Economic History, Microeconomics diff --git a/examples/infospace-with-history/output/entities/commodity.md b/examples/infospace-with-history/output/entities/commodity.md new file mode 100644 index 00000000..178adc26 --- /dev/null +++ b/examples/infospace-with-history/output/entities/commodity.md @@ -0,0 +1,13 @@ +# Commodity + +## Definition +A commodity is a basic good that is used in commerce and can be interchanged with other commodities of the same type. Commodities are most often used as inputs in the production of other goods or services. Their quality may differ slightly but is essentially uniform across producers. + +## Source Chapter +Book 1, Chapter 4 + +## Context +Smith discusses commodities in the context of exchange and barter, where one commodity is traded for another before the advent of money. He also makes reference to various commodities used as a medium of exchange in different societies. + +## Economic Domain +Microeconomics, Commodities Market diff --git a/examples/infospace-with-history/output/entities/common-stock.md b/examples/infospace-with-history/output/entities/common-stock.md new file mode 100644 index 00000000..66cd7920 --- /dev/null +++ b/examples/infospace-with-history/output/entities/common-stock.md @@ -0,0 +1,27 @@ +# Common Stock + +## Definition + +The aggregate pool of goods and services created when individuals bring +their diverse specialised products together through exchange. Smith argues +that among humans, unlike animals, different talents are made useful to +one another because their products can be "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." This common stock is the +emergent result of widespread exchange among specialised producers. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +Appears in the chapter's concluding argument comparing humans and animals. +While a mastiff cannot benefit from a greyhound's speed due to lack of +exchange, humans can pool their different abilities through trade, making +all talents contribute to the general welfare. + +## Economic Domain + +Exchange diff --git a/examples/infospace-with-history/output/entities/cost-of-transport-relative-to-value.md b/examples/infospace-with-history/output/entities/cost-of-transport-relative-to-value.md new file mode 100644 index 00000000..6ed03906 --- /dev/null +++ b/examples/infospace-with-history/output/entities/cost-of-transport-relative-to-value.md @@ -0,0 +1,25 @@ +# Cost of Transport Relative to Value + +## Definition + +The principle that the economic viability of trading a good over distance depends on the ratio of its transport cost to its market value. Only goods whose price is "very considerable in proportion to their weight" can bear the expense of long-distance land-carriage. This ratio determines which goods enter long-distance trade and which remain locally consumed, thereby shaping the composition and volume of commerce between regions. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith introduces this principle in the London-Edinburgh comparison, noting that if only land-carriage existed, trade would be restricted to high-value-to-weight goods. He extends the argument to the hypothetical of land-carriage between London and Calcutta, where the expense would prohibit all but the most precious commodities — and even those could not be safely transported through "the territories of so many barbarous nations." + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "...as no goods could be transported from the one to the other, except such whose price was very considerable in proportion to their weight, they could carry on but a small part of that commerce which at present subsists between them." + +## Modern Interpretation + +This is a precursor to the modern concept of trade costs and the gravity model of trade, which predicts that trade volumes depend inversely on transport costs and directly on market size. The value-to-weight ratio remains a key determinant of which goods enter international trade. diff --git a/examples/infospace-with-history/output/entities/country-workman.md b/examples/infospace-with-history/output/entities/country-workman.md new file mode 100644 index 00000000..62447f25 --- /dev/null +++ b/examples/infospace-with-history/output/entities/country-workman.md @@ -0,0 +1,25 @@ +# Country Workman + +## Definition + +A rural artisan or tradesman who, due to the limited extent of the local market, must perform a wide variety of tasks rather than specialising in a single operation. The country workman is the antithesis of the specialised urban worker: a country carpenter must also serve as joiner, cabinet-maker, carver, wheel-wright, plough-wright, and waggon-maker, while a country smith handles every sort of work in iron. This multi-functional role is an economic consequence of insufficient market demand to support narrow specialisation. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith uses the country workman to illustrate how small markets force generalism. The contrast between the country carpenter (who does everything in wood) and the urban specialist (who does only one thing) is direct evidence for the chapter's thesis that the division of labour depends on market extent. + +## Economic Domain + +Production + +## Smith's Original Wording + +> "A country carpenter deals in every sort of work that is made of wood; a country smith in every sort of work that is made of iron. The former is not only a carpenter, but a joiner, a cabinet-maker, and even a carver in wood, as well as a wheel-wright, a plough-wright, a cart and waggon-maker." + +## Modern Interpretation + +This illustrates the modern concept of economies of specialisation versus generalisation. In development economics, the persistence of multi-occupation households in rural areas reflects the same constraint Smith identified: insufficient local demand to support full-time specialisation. diff --git a/examples/infospace-with-history/output/entities/dexterity-of-the-workman.md b/examples/infospace-with-history/output/entities/dexterity-of-the-workman.md new file mode 100644 index 00000000..43d41332 --- /dev/null +++ b/examples/infospace-with-history/output/entities/dexterity-of-the-workman.md @@ -0,0 +1,33 @@ +# Dexterity of the Workman + +## Definition + +The skill and speed a worker acquires through repeated performance of a single +specialised operation. Smith identifies the increase in dexterity as the first +of three causes by which the division of labour improves productive power. +Specialisation reduces each worker's task to one simple operation, making it +the sole employment of their life, and thereby dramatically increasing their +proficiency. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Presented as the first of three mechanisms explaining why the division of labour +increases output. Smith illustrates it with the example of nail-making: an +unskilled smith makes 200-300 nails per day, while a specialised nailer can +produce over 2,300. + +## Economic Domain + +Production + +## Smith's Original Wording + +"First, the improvement of the dexterity of the workmen, necessarily increases +the quantity of the work he can perform; and the division of labour, by reducing +every man's business to some one simple operation, and by making this operation +the sole employment of his life, necessarily increases very much the dexterity +of the workman." diff --git a/examples/infospace-with-history/output/entities/difference-of-talents.md b/examples/infospace-with-history/output/entities/difference-of-talents.md new file mode 100644 index 00000000..38fe6cda --- /dev/null +++ b/examples/infospace-with-history/output/entities/difference-of-talents.md @@ -0,0 +1,36 @@ +# Difference of Talents + +## Definition + +The observable variation in skills, aptitudes, and abilities among individuals +in different occupations. Smith makes the striking argument that this +difference is largely the effect rather than the cause of the division of +labour: people are born with roughly equal abilities, and it is their +different occupations, shaped by habit, custom, and education, that create +the apparent differences. He contrasts humans with dogs, where natural breed +differences are far greater but cannot be made useful because animals lack +the capacity for exchange. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +This argument occupies the final portion of the chapter. Smith uses it to +reinforce his claim that exchange, not innate difference, is the driver of +specialisation. The philosopher and the street porter were "very much alike" +until different employments shaped them differently. + +## Economic Domain + +General Theory + +## Smith's Original Wording + +"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." diff --git a/examples/infospace-with-history/output/entities/division-of-labour.md b/examples/infospace-with-history/output/entities/division-of-labour.md new file mode 100644 index 00000000..be310c77 --- /dev/null +++ b/examples/infospace-with-history/output/entities/division-of-labour.md @@ -0,0 +1,39 @@ +# Division of Labour + +## Definition + +The separation of a work process into a number of distinct tasks, each performed +by a specialised worker, resulting in a significant increase in the productive +powers of labour. Smith identifies it as the principal cause of improvement in +the productive capacity of any trade, art, or manufacture. The effect arises +from three circumstances: increased dexterity, saved time in transition between +tasks, and the invention of labour-saving machinery. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +The division of labour is the central argument of the chapter. Smith opens by +asserting that it is the greatest source of improvement in productive powers, +then illustrates it through the pin-factory example, explains its three causal +mechanisms, and concludes by showing how it generates universal opulence through +exchange. + +## Economic Domain + +Production + +## Smith's Original Wording + +"The greatest improvements in the productive powers of labour, and the greater +part of the skill, dexterity, and judgment, with which it is anywhere directed, +or applied, seem to have been the effects of the division of labour." + +## Modern Interpretation + +The division of labour remains a foundational concept in economics and +organisational theory. Modern extensions include specialisation theory, +comparative advantage (Ricardo), and the study of transaction costs that +determine the boundaries between internal division and market exchange (Coase). diff --git a/examples/infospace-with-history/output/entities/encouragement-to-industry.md b/examples/infospace-with-history/output/entities/encouragement-to-industry.md new file mode 100644 index 00000000..a97e8b0e --- /dev/null +++ b/examples/infospace-with-history/output/entities/encouragement-to-industry.md @@ -0,0 +1,25 @@ +# Encouragement to Industry + +## Definition + +The incentive effect that market access and trade opportunities exert on productive activity. When two places can trade with each other, they "mutually afford" encouragement to each other's industry — meaning that the existence of buyers stimulates producers to increase output, improve methods, and specialise further. Conversely, when markets are isolated, the absence of demand discourages investment in productive improvements. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith uses this concept to explain the reciprocal benefits of trade between London and Edinburgh, and between London and Calcutta. The ability to trade does not merely transfer goods but actively stimulates production in both locations by expanding the effective demand each faces. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "Those two cities, however, at present carry on a very considerable commerce with each other, and by mutually affording a market, give a good deal of encouragement to each other's industry." + +## Modern Interpretation + +This anticipates the modern concept of trade as a growth engine — the idea that market integration creates positive-sum outcomes by expanding demand and stimulating productivity gains. It is closely related to the concept of gains from trade in international economics. diff --git a/examples/infospace-with-history/output/entities/exchange.md b/examples/infospace-with-history/output/entities/exchange.md new file mode 100644 index 00000000..529c79fa --- /dev/null +++ b/examples/infospace-with-history/output/entities/exchange.md @@ -0,0 +1,32 @@ +# Exchange + +## Definition + +The act of trading one's surplus production for the goods produced by others. +Smith presents exchange as the mechanism by which the division of labour +translates into universal opulence: each workman disposes of their surplus +output and receives in return the surplus of others, so that all are +supplied beyond what any individual could produce alone. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Exchange appears in the chapter's conclusion as the connecting mechanism +between specialised production and general welfare. Smith implicitly treats +it as prerequisite to the division of labour (explored further in Chapter 2), +since specialisation only benefits workers if they can trade their surplus. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +"Every workman has a great quantity of his own work to dispose of beyond what +he himself has occasion for; and every other workman being exactly in the same +situation, he is enabled to exchange a great quantity of his own goods for a +great quantity or, what comes to the same thing, for the price of a great +quantity of theirs." diff --git a/examples/infospace-with-history/output/entities/extent-of-the-market.md b/examples/infospace-with-history/output/entities/extent-of-the-market.md new file mode 100644 index 00000000..46021e49 --- /dev/null +++ b/examples/infospace-with-history/output/entities/extent-of-the-market.md @@ -0,0 +1,25 @@ +# Extent of the Market + +## Definition + +The reach and size of the exchange network available to producers, which determines how far the division of labour can be carried. Smith argues that the degree of specialisation in any economy is fundamentally constrained by the number of potential buyers and the accessibility of those buyers. A small, isolated market forces individuals to remain generalists, while a large, well-connected market permits extreme specialisation. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +This is the central concept of the chapter and its titular argument. Smith opens by establishing that the power of exchanging gives occasion to the division of labour, and therefore the extent of that division "must always be limited by the extent of that power, or, in other words, by the extent of the market." The remainder of the chapter illustrates this principle through examples of isolated versus connected economies. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "As it is the power of exchanging that gives occasion to the division of labour, so the extent of this division must always be limited by the extent of that power, or, in other words, by the extent of the market." + +## Modern Interpretation + +This concept anticipates modern ideas about market size and economies of scale. A firm cannot profitably specialise in a niche product unless the addressable market is large enough to absorb its output. It also prefigures theories of economic geography and trade liberalisation, where expanding market access enables greater productivity through specialisation. diff --git a/examples/infospace-with-history/output/entities/improvement-of-art-and-industry.md b/examples/infospace-with-history/output/entities/improvement-of-art-and-industry.md new file mode 100644 index 00000000..dcccbb67 --- /dev/null +++ b/examples/infospace-with-history/output/entities/improvement-of-art-and-industry.md @@ -0,0 +1,25 @@ +# Improvement of Art and Industry + +## Definition + +The progressive advancement of productive techniques, manufacturing methods, and economic organisation that accompanies the expansion of markets. Smith argues that such improvements naturally begin in areas with water-carriage access, where the whole world serves as a potential market, and only later extend to inland regions. The concept links market extent to technological and organisational progress: larger markets incentivise innovation by rewarding specialisation and creating demand for refined products. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +This concept appears in the transitional passage between Smith's transport-cost analysis and his historical survey of civilisations. It establishes the causal chain: water-carriage → expanded markets → division of labour → improvement of art and industry. The historical examples (Egypt, Bengal, China) then serve as evidence. + +## Economic Domain + +Production + +## Smith's Original Wording + +> "Since such, therefore, are the advantages of water-carriage, it is natural that the first improvements of art and industry should be made where this conveniency opens the whole world for a market to the produce of every sort of labour." + +## Modern Interpretation + +This concept anticipates endogenous growth theory, which holds that market size affects the rate of innovation. Larger markets increase the returns to developing new techniques, creating a positive feedback loop between market expansion and technological progress. diff --git a/examples/infospace-with-history/output/entities/inland-navigation.md b/examples/infospace-with-history/output/entities/inland-navigation.md new file mode 100644 index 00000000..8d86bf92 --- /dev/null +++ b/examples/infospace-with-history/output/entities/inland-navigation.md @@ -0,0 +1,25 @@ +# Inland Navigation + +## Definition + +The system of navigable rivers, canals, and waterways that enables water-borne transport of goods within the interior of a country. Smith identifies inland navigation as a primary determinant of early economic development, arguing that civilisations with extensive river systems and canals (Egypt, Bengal, China) developed agriculture and manufactures earlier than those without. The key economic function is to extend the effective market to inland areas that would otherwise be limited to costly land-carriage. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith devotes the latter half of the chapter to demonstrating that historically early civilisations — Egypt along the Nile, Bengal along the Ganges, eastern China along its river systems — owed their early development to the advantages of inland navigation. He contrasts these with inland Africa and Tartary, where the absence of navigable waterways left populations in "the same barbarous and uncivilized state." + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "The extent and easiness of this inland navigation was probably one of the principal causes of the early improvement of Egypt." + +## Modern Interpretation + +This concept foreshadows modern analysis of how infrastructure endowments shape long-run economic development. The geographical determinism in Smith's argument has been formalised in work by scholars like Gallup, Sachs, and Mellinger on how access to navigable waterways correlates with economic outcomes. diff --git a/examples/infospace-with-history/output/entities/insurance-differential-land-vs-water.md b/examples/infospace-with-history/output/entities/insurance-differential-land-vs-water.md new file mode 100644 index 00000000..88f28a42 --- /dev/null +++ b/examples/infospace-with-history/output/entities/insurance-differential-land-vs-water.md @@ -0,0 +1,25 @@ +# Insurance Differential (Land vs. Water) + +## Definition + +The difference in risk premiums charged for insuring goods transported by land versus by water. Smith includes this as a component of transport cost, noting that the cost of water-carriage must account for "the value of the superior risk, or the difference of the insurance between land and water-carriage." Despite this risk premium, water-carriage remains far cheaper overall due to its vastly greater efficiency in labour and capital. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +This appears within Smith's detailed cost comparison of moving two hundred tons of goods between London and Edinburgh by land versus by water. After cataloguing the costs of men, horses, and waggons for land transport, he notes that water transport costs include maintenance of a small crew, wear on the ship, and this insurance differential. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "...together with the value of the superior risk, or the difference of the insurance between land and water-carriage." + +## Modern Interpretation + +This is an early recognition that transport costs include not just direct logistics expenses but also risk-adjusted costs — what modern logistics and finance would call the risk premium or cost of insurance in supply chain management. diff --git a/examples/infospace-with-history/output/entities/invention-of-machinery.md b/examples/infospace-with-history/output/entities/invention-of-machinery.md new file mode 100644 index 00000000..caa4be26 --- /dev/null +++ b/examples/infospace-with-history/output/entities/invention-of-machinery.md @@ -0,0 +1,31 @@ +# Invention of Machinery + +## Definition + +The development of machines that facilitate and abridge labour, enabling one +person to do the work of many. Smith identifies this as the third mechanism +by which the division of labour increases productive power, and argues that +the division of labour itself stimulates invention, because workers focused +on a single operation naturally discover improvements to their specific task. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Presented as the third mechanism. Smith provides the anecdote of the boy who +automated the valve on a fire engine to free himself for play. He extends the +argument beyond workers to include machine-makers and philosophers (men of +speculation), whose own specialised observation enables them to combine +knowledge from distant fields. + +## Economic Domain + +Production + +## Smith's Original Wording + +"Thirdly, and lastly, everybody must be sensible how much labour is facilitated +and abridged by the application of proper machinery. It is unnecessary to give +any example." diff --git a/examples/infospace-with-history/output/entities/land-carriage.md b/examples/infospace-with-history/output/entities/land-carriage.md new file mode 100644 index 00000000..a889190a --- /dev/null +++ b/examples/infospace-with-history/output/entities/land-carriage.md @@ -0,0 +1,25 @@ +# Land-Carriage + +## Definition + +The transportation of goods overland by waggon, cart, or pack animal. Smith characterises land-carriage as comparatively expensive and limited in capacity, requiring large numbers of men and horses to move modest quantities of goods. The high cost of land-carriage restricts overland trade to goods of high value-to-weight ratio, thereby constraining the extent of the market for inland regions and limiting the division of labour there. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith uses the London-to-Edinburgh comparison to quantify the inefficiency of land-carriage: a broad-wheeled waggon attended by two men with eight horses carries only four tons in six weeks, while a ship with a similar crew carries two hundred tons in the same time. This stark contrast demonstrates why inland economies develop later. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "A broad-wheeled waggon, attended by two men, and drawn by eight horses, in about six weeks time, carries and brings back between London and Edinburgh near four ton weight of goods." + +## Modern Interpretation + +The concept maps directly to modern analysis of infrastructure costs and logistics efficiency. The principle that high transport costs segment markets and inhibit specialisation remains central to development economics and trade policy. diff --git a/examples/infospace-with-history/output/entities/manufactures.md b/examples/infospace-with-history/output/entities/manufactures.md new file mode 100644 index 00000000..d3b0556d --- /dev/null +++ b/examples/infospace-with-history/output/entities/manufactures.md @@ -0,0 +1,25 @@ +# Manufactures + +## Definition + +The sector of production in which raw materials are transformed into finished +goods through a series of distinct operations, each typically performed by +specialised workers. Smith contrasts manufactures with agriculture, noting that +the former admits of far greater subdivision of labour and separation of trades, +and therefore exhibits far greater improvements in productive power. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Manufactures serve as the primary setting for Smith's analysis of the division +of labour. The pin factory is a manufacture; so are the linen, woollen, and +hardware trades he references. Smith uses the greater divisibility of +manufacturing work to explain why rich countries excel more conspicuously over +poor countries in manufactures than in agriculture. + +## Economic Domain + +Production diff --git a/examples/infospace-with-history/output/entities/maritime-commerce.md b/examples/infospace-with-history/output/entities/maritime-commerce.md new file mode 100644 index 00000000..d894b747 --- /dev/null +++ b/examples/infospace-with-history/output/entities/maritime-commerce.md @@ -0,0 +1,25 @@ +# Maritime Commerce + +## Definition + +Trade conducted by sea between ports and coastal regions, as distinct from inland river trade. Smith argues that maritime commerce is the most powerful mechanism for extending markets because it connects distant parts of the world that could never trade overland. The Mediterranean Sea, with its calm waters, numerous islands, and proximate shores, served as the cradle of maritime commerce in the ancient world, enabling the earliest civilisations to trade across vast distances. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith transitions from the London-Edinburgh transport comparison to a global historical argument. Maritime commerce explains why coastal nations civilised first, why the Mediterranean basin was the seat of early civilisation, and why interior continental regions like Africa and Tartary remained undeveloped. The absence of "great inlets" in Africa is contrasted with the Baltic, Adriatic, and Mediterranean in Europe. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "There could be little or no commerce of any kind between the distant parts of the world. What goods could bear the expense of land-carriage between London and Calcutta?" + +## Modern Interpretation + +Smith's emphasis on maritime trade as the engine of globalisation and development anticipates modern trade theory's focus on shipping costs and port access as determinants of trade volume and economic integration. diff --git a/examples/infospace-with-history/output/entities/mediterranean-sea-as-economic-geography.md b/examples/infospace-with-history/output/entities/mediterranean-sea-as-economic-geography.md new file mode 100644 index 00000000..71c4f9b1 --- /dev/null +++ b/examples/infospace-with-history/output/entities/mediterranean-sea-as-economic-geography.md @@ -0,0 +1,25 @@ +# Mediterranean Sea (as Economic Geography) + +## Definition + +The enclosed body of water that Smith identifies as the geographical precondition for the earliest civilisations in the Western world. Its economic significance derives from its physical properties: the absence of tides, calm surface waters, numerous islands providing waypoints, and proximate opposing shores — all of which made it uniquely suited to early navigation when sailors feared to lose sight of land. The Mediterranean thus functioned as a natural market-expanding infrastructure, enabling coastal peoples to trade and specialise. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith presents the Mediterranean as the historical centrepiece of his argument that water-carriage drives civilisation. He argues that nations around this sea "appear to have been first civilized" precisely because its geography facilitated early maritime commerce. This sets up the specific examples of Egypt, Phoenicia, and Carthage. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "That sea, by far the greatest inlet that is known in the world, having no tides, nor consequently any waves, except such as are caused by the wind only, was, by the smoothness of its surface, as well as by the multitude of its islands, and the proximity of its neighbouring shores, extremely favourable to the infant navigation of the world." + +## Modern Interpretation + +This is an early example of geographic determinism in economic thought — the idea that natural geography shapes comparative advantage and development trajectories. Modern economic geography continues to study how natural harbours, waterways, and geographic features influence trade patterns and development. diff --git a/examples/infospace-with-history/output/entities/money.md b/examples/infospace-with-history/output/entities/money.md new file mode 100644 index 00000000..a6d88ab5 --- /dev/null +++ b/examples/infospace-with-history/output/entities/money.md @@ -0,0 +1,13 @@ +# Money + +## Definition +Money is a medium of exchange that is widely accepted in transactions involving goods, services, and repayment of debts. It serves as a store of value and a standard of deferred payment. Money can take various forms, including coins, banknotes, and digital tokens. + +## Source Chapter +Book 1, Chapter 4 + +## Context +Smith discusses the origin and use of money. He argues that the emergence of money is a solution to the problems of barter, providing a universally acceptable medium of exchange that facilitates trade and the division of labour in a commercial society. + +## Economic Domain +Monetary Economics, Macroeconomics diff --git a/examples/infospace-with-history/output/entities/nailer.md b/examples/infospace-with-history/output/entities/nailer.md new file mode 100644 index 00000000..0de7fdea --- /dev/null +++ b/examples/infospace-with-history/output/entities/nailer.md @@ -0,0 +1,25 @@ +# Nailer + +## Definition + +A specialised metalworker whose sole occupation is the manufacture of nails. Smith uses the nailer as a quantitative illustration of the impossibility of extreme specialisation in a small market. A nailer producing a thousand nails per day (three hundred thousand per year) could not dispose of even a single day's output in the remote highlands of Scotland, making the trade unviable there despite the productivity gains of specialisation. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +The nailer example follows the discussion of the country smith who must do all types of ironwork. It provides Smith's most precise numerical illustration of the mismatch between specialised output volume and local demand in a thin market. + +## Economic Domain + +Production + +## Smith's Original Wording + +> "It is impossible there should be such a trade as even that of a nailer in the remote and inland parts of the highlands of Scotland. Such a workman at the rate of a thousand nails a-day, and three hundred working days in the year, will make three hundred thousand nails in the year. But in such a situation it would be impossible to dispose of one thousand, that is, of one day's work in the year." + +## Modern Interpretation + +This is a clear early articulation of the relationship between production scale and market absorption capacity. It illustrates why high-volume, low-margin manufacturing concentrates in areas with access to large markets — a principle underlying modern industrial location theory. diff --git a/examples/infospace-with-history/output/entities/north-american-colonial-settlement-pattern.md b/examples/infospace-with-history/output/entities/north-american-colonial-settlement-pattern.md new file mode 100644 index 00000000..84258156 --- /dev/null +++ b/examples/infospace-with-history/output/entities/north-american-colonial-settlement-pattern.md @@ -0,0 +1,25 @@ +# North American Colonial Settlement Pattern + +## Definition + +The observed geographic pattern in which European plantations and settlements in North America concentrated along the sea-coast and the banks of navigable rivers, rarely extending to any considerable inland distance. Smith presents this as contemporary empirical evidence for his thesis that market access via water-carriage drives economic development and settlement. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith cites the colonial settlement pattern immediately after arguing that inland areas develop later than coastal ones. It serves as a bridge between his theoretical argument about water-carriage and his historical survey of ancient civilisations, showing that the same principle operates in the contemporary New World. + +## Economic Domain + +General Theory + +## Smith's Original Wording + +> "In our North American colonies, the plantations have constantly followed either the sea-coast or the banks of the navigable rivers, and have scarce anywhere extended themselves to any considerable distance from both." + +## Modern Interpretation + +This observation aligns with modern economic geography's finding that population density and economic activity correlate strongly with proximity to coasts and navigable waterways. It also reflects the broader principle that infrastructure access is a primary determinant of settlement patterns. diff --git a/examples/infospace-with-history/output/entities/porter.md b/examples/infospace-with-history/output/entities/porter.md new file mode 100644 index 00000000..8ba12a5f --- /dev/null +++ b/examples/infospace-with-history/output/entities/porter.md @@ -0,0 +1,25 @@ +# Porter + +## Definition + +An urban labourer whose occupation consists of carrying goods and burdens for hire. Smith uses the porter as the exemplary case of a trade so specialised and dependent on volume of demand that it can only exist in a great town. A village or even an ordinary market-town cannot generate enough demand for carrying services to provide a porter with constant employment, making this trade the paradigmatic illustration of market-size-dependent specialisation. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +The porter is introduced immediately after the chapter's thesis statement as the first concrete illustration. Smith notes that "a porter can find employment and subsistence in no other place" than a great town, establishing the principle that some trades require a minimum threshold of market activity to exist. + +## Economic Domain + +Production + +## Smith's Original Wording + +> "A porter, for example, can find employment and subsistence in no other place. A village is by much too narrow a sphere for him; even an ordinary market-town is scarce large enough to afford him constant occupation." + +## Modern Interpretation + +This anticipates the concept of minimum efficient scale and threshold effects in urban economics. Certain service occupations require minimum population densities to be viable — an insight formalised in central place theory (Christaller, 1933). diff --git a/examples/infospace-with-history/output/entities/power-of-exchanging.md b/examples/infospace-with-history/output/entities/power-of-exchanging.md new file mode 100644 index 00000000..c2ec5a6b --- /dev/null +++ b/examples/infospace-with-history/output/entities/power-of-exchanging.md @@ -0,0 +1,25 @@ +# Power of Exchanging + +## Definition + +The capacity of economic agents to trade the surplus produce of their own labour for the produce of others. This power is the precondition for the division of labour: without the ability to exchange, there is no incentive to specialise, since a worker cannot consume the entirety of a single specialised output. The power of exchanging is shaped by transportation infrastructure, population density, and the absence of political barriers to trade. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith introduces this concept in the chapter's opening sentence as the causal mechanism linking market size to specialisation. It serves as the bridge between the division of labour (Chapter 1-2) and the geographic and infrastructural arguments that follow. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "As it is the power of exchanging that gives occasion to the division of labour, so the extent of this division must always be limited by the extent of that power." + +## Modern Interpretation + +This corresponds to the modern concept of market access or trade connectivity — the practical ability of producers to reach buyers, encompassing transaction costs, transportation costs, and institutional barriers to exchange. diff --git a/examples/infospace-with-history/output/entities/productive-powers-of-labour.md b/examples/infospace-with-history/output/entities/productive-powers-of-labour.md new file mode 100644 index 00000000..51a29b7b --- /dev/null +++ b/examples/infospace-with-history/output/entities/productive-powers-of-labour.md @@ -0,0 +1,30 @@ +# Productive Powers of Labour + +## Definition + +The capacity of human labour to produce output, measured in terms of the +quantity and quality of goods a given number of workers can produce within +a given time. Smith argues that the division of labour is the primary cause +of increases in productive power, and that differences in productive power +explain differences in national wealth. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Smith introduces productive powers as the dependent variable that the division +of labour improves. He contrasts the output of an unskilled individual worker +(one pin per day) with the output of a coordinated team under division of +labour (4,800 pins per person per day) to demonstrate the scale of improvement. + +## Economic Domain + +Production + +## Smith's Original Wording + +"This great increase in the quantity of work, which, in consequence of the +division of labour, the same number of people are capable of performing, is +owing to three different circumstances." diff --git a/examples/infospace-with-history/output/entities/propensity-to-truck-barter-and-exchange.md b/examples/infospace-with-history/output/entities/propensity-to-truck-barter-and-exchange.md new file mode 100644 index 00000000..3d825d15 --- /dev/null +++ b/examples/infospace-with-history/output/entities/propensity-to-truck-barter-and-exchange.md @@ -0,0 +1,43 @@ +# Propensity to Truck, Barter, and Exchange + +## Definition + +An innate or fundamental disposition in human nature to negotiate, trade, and +exchange goods with others. Smith identifies this propensity as the ultimate +cause of the division of labour, arguing that it is unique to humans and +absent in all other animal species. He leaves open whether it is a primary +instinct or a consequence of the faculties of reason and speech, but treats +it as the foundational mechanism from which specialisation and economic +organisation emerge. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +This is the central thesis of the chapter. Smith argues that the division of +labour "is not originally the effect of any human wisdom" but rather the +"necessary, though very slow and gradual, consequence" of this propensity. +The entire chapter serves to establish exchange as the causal origin of +specialisation. + +## Economic Domain + +General Theory + +## Smith's Original Wording + +"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 [...] the +propensity to truck, barter, and exchange one thing for another." + +## Modern Interpretation + +This concept prefigures the modern economic assumption of rational self-interest +as the basis of market behaviour. It also anticipates evolutionary and +institutional economics debates about whether exchange is a natural disposition +or a culturally constructed institution. diff --git a/examples/infospace-with-history/output/entities/saving-of-time.md b/examples/infospace-with-history/output/entities/saving-of-time.md new file mode 100644 index 00000000..aae769c7 --- /dev/null +++ b/examples/infospace-with-history/output/entities/saving-of-time.md @@ -0,0 +1,30 @@ +# Saving of Time + +## Definition + +The elimination of time lost when a worker passes from one kind of work to +another. Smith identifies this as the second mechanism by which the division of +labour increases productive power. Time is lost both in physical transition +(moving between locations and tools) and in mental transition (the sauntering +and inattention that follows switching tasks). + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Presented as the second of three mechanisms. Smith argues the loss is greater +than commonly supposed, encompassing not only travel time but a psychological +cost: workers who constantly switch tasks develop habits of "sauntering" and +"indolent careless application" that reduce their output even during active work. + +## Economic Domain + +Production + +## Smith's Original Wording + +"Secondly, the advantage which is gained by saving the time commonly lost in +passing from one sort of work to another, is much greater than we should at +first view be apt to imagine it." diff --git a/examples/infospace-with-history/output/entities/self-interest.md b/examples/infospace-with-history/output/entities/self-interest.md new file mode 100644 index 00000000..87fe04d7 --- /dev/null +++ b/examples/infospace-with-history/output/entities/self-interest.md @@ -0,0 +1,34 @@ +# Self-interest + +## Definition + +The motivation of individuals to pursue their own advantage in economic +transactions. Smith argues that in civilised society, individuals obtain the +co-operation of others not through appeals to benevolence but by engaging +their self-love — showing them that it is to their own advantage to provide +what is desired. Self-interest is the engine that makes exchange function: +each party to a bargain acts from regard to their own benefit. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +Smith introduces self-interest through the celebrated passage about the +butcher, brewer, and baker. He contrasts it with benevolence, arguing that +we cannot rely on the goodwill of others for our daily needs in a society +of many, and that self-interest provides a more reliable and universal basis +for economic co-operation. + +## Economic Domain + +General Theory + +## Smith's Original Wording + +"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." diff --git a/examples/infospace-with-history/output/entities/self-sufficiency-of-the-farmer.md b/examples/infospace-with-history/output/entities/self-sufficiency-of-the-farmer.md new file mode 100644 index 00000000..4d3ef022 --- /dev/null +++ b/examples/infospace-with-history/output/entities/self-sufficiency-of-the-farmer.md @@ -0,0 +1,25 @@ +# Self-Sufficiency of the Farmer + +## Definition + +The condition in which a farmer in a remote or sparsely populated area must perform all essential trades for his own household — butcher, baker, and brewer — because the local market is too thin to support separate specialists in these trades. Self-sufficiency is presented not as an ideal but as an economic constraint imposed by market isolation. It represents the minimal degree of division of labour, where the household is the entire economic unit. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith introduces the self-sufficient highland farmer immediately after the porter example, as the polar opposite case. Where the porter requires a great town, the highland farmer exists in a market so small that no specialisation at all is possible. "Every farmer must be butcher, baker, and brewer, for his own family." + +## Economic Domain + +Production + +## Smith's Original Wording + +> "In the lone houses and very small villages which are scattered about in so desert a country as the highlands of Scotland, every farmer must be butcher, baker, and brewer, for his own family." + +## Modern Interpretation + +This maps to the concept of subsistence economy or autarky at the household level. Development economists recognise the transition from household self-sufficiency to market participation as a fundamental stage in economic development, driven by exactly the market-access factors Smith describes. diff --git a/examples/infospace-with-history/output/entities/separation-of-trades.md b/examples/infospace-with-history/output/entities/separation-of-trades.md new file mode 100644 index 00000000..1f9a85c3 --- /dev/null +++ b/examples/infospace-with-history/output/entities/separation-of-trades.md @@ -0,0 +1,30 @@ +# Separation of Trades + +## Definition + +The process by which distinct occupations emerge as separate specialisations, +each performed by dedicated practitioners rather than by a single person who +performs all tasks. Smith presents the separation of trades as both a +consequence and an indicator of the division of labour, noting that it +advances furthest in the most industrious and improved countries. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Smith transitions from the pin-factory example to the economy-wide observation +that in improved societies, "the farmer is generally nothing but a farmer; the +manufacturer, nothing but a manufacturer." He contrasts manufacturing, where +trades separate extensively, with agriculture, where seasonal demands prevent +full separation. + +## Economic Domain + +Production + +## Smith's Original Wording + +"The separation of different trades and employments from one another, seems to +have taken place in consequence of this advantage." diff --git a/examples/infospace-with-history/output/entities/surplus-produce.md b/examples/infospace-with-history/output/entities/surplus-produce.md new file mode 100644 index 00000000..9a4b57b7 --- /dev/null +++ b/examples/infospace-with-history/output/entities/surplus-produce.md @@ -0,0 +1,33 @@ +# Surplus Produce + +## Definition + +The portion of a worker's output that exceeds their own consumption needs and +is therefore available for exchange. Smith argues that the certainty of being +able to exchange surplus produce for the products of other workers' labour +is what encourages every person to dedicate themselves to a particular +occupation. Surplus is thus both the material prerequisite and the incentive +for specialisation. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +Introduced in the passage describing the emergence of specialised trades in +a tribal society. The armourer, carpenter, smith, and tanner each produce +more of their specialty than they can personally consume, and exchange the +surplus for other goods, reinforcing their commitment to specialisation. + +## Economic Domain + +Production + +## Smith's Original Wording + +"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." diff --git a/examples/infospace-with-history/output/entities/territorial-obstruction-of-trade.md b/examples/infospace-with-history/output/entities/territorial-obstruction-of-trade.md new file mode 100644 index 00000000..f8d018a9 --- /dev/null +++ b/examples/infospace-with-history/output/entities/territorial-obstruction-of-trade.md @@ -0,0 +1,25 @@ +# Territorial Obstruction of Trade + +## Definition + +The capacity of a nation controlling territory along a trade route to impede or block the commerce of upstream or inland nations. When a river passes through foreign territory before reaching the sea, the controlling nation can obstruct communication between the interior country and maritime markets. This political-geographic constraint limits the effective market available to inland producers regardless of the physical navigability of the waterway. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Smith introduces this concept when explaining why Africa and interior Asia remained undeveloped despite having some large rivers. He illustrates it specifically with the Danube: its navigation is "of very little use to the different states of Bavaria, Austria, and Hungary" because none of them controls the river's full course to the Black Sea. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "The commerce, besides, which any nation can carry on by means of a river which does not break itself into any great number of branches or canals, and which runs into another territory before it reaches the sea, can never be very considerable, because it is always in the power of the nations who possess that other territory to obstruct the communication between the upper country and the sea." + +## Modern Interpretation + +This identifies what modern economists and political scientists call transit risk or landlocked disadvantage. Landlocked countries today face systematically higher trade costs and dependence on neighbours' infrastructure and political goodwill — a constraint that continues to impede development, as documented in extensive World Bank research. diff --git a/examples/infospace-with-history/output/entities/the-bargain.md b/examples/infospace-with-history/output/entities/the-bargain.md new file mode 100644 index 00000000..ed56a25c --- /dev/null +++ b/examples/infospace-with-history/output/entities/the-bargain.md @@ -0,0 +1,32 @@ +# The Bargain + +## Definition + +A voluntary bilateral exchange in which each party offers something the other +wants. Smith defines the bargain as the fundamental unit of economic +interaction: "Give me that which I want, and you shall have this which you +want." It is through bargaining that individuals obtain "the far greater part +of those good offices which we stand in need of" in civilised society, as +opposed to relying on benevolence or coercion. + +## Source Chapter + +Book I, Chapter 2: "Of the Principle which gives Occasion to the Division +of Labour" + +## Context + +The bargain is presented as the practical expression of the propensity to +exchange. Smith argues that it is the dominant mode of economic interaction, +used even by beggars who exchange charity-received goods for things they +actually need. + +## Economic Domain + +Exchange + +## Smith's Original Wording + +"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." diff --git a/examples/infospace-with-history/output/entities/the-philosopher.md b/examples/infospace-with-history/output/entities/the-philosopher.md new file mode 100644 index 00000000..3146194e --- /dev/null +++ b/examples/infospace-with-history/output/entities/the-philosopher.md @@ -0,0 +1,31 @@ +# The Philosopher + +## Definition + +A person whose occupation is observation and speculation rather than direct +production — "men of speculation, whose trade it is not to do any thing, but +to observe every thing." Smith treats the philosopher as an economic actor +whose specialised function is combining knowledge from diverse fields to +produce innovations and improvements, analogous to how the workman improves +their own narrow task. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +Introduced near the end of Smith's discussion of the third mechanism (invention +of machinery). Smith notes that as society progresses, philosophy itself becomes +a specialised trade, subdivided into branches, with each philosopher becoming +expert in their field — the division of labour applied to intellectual work. + +## Economic Domain + +General Theory + +## Smith's Original Wording + +"In the progress of society, philosophy or speculation becomes, like every other +employment, the principal or sole trade and occupation of a particular class of +citizens." diff --git a/examples/infospace-with-history/output/entities/the-workman.md b/examples/infospace-with-history/output/entities/the-workman.md new file mode 100644 index 00000000..fcd38a13 --- /dev/null +++ b/examples/infospace-with-history/output/entities/the-workman.md @@ -0,0 +1,24 @@ +# The Workman + +## Definition + +The individual labourer who performs productive work, whether in manufacturing +or agriculture. In the context of the division of labour, the workman is the +operative unit whose dexterity, time, and inventiveness are the channels through +which specialisation increases output. Smith portrays the workman both as a +beneficiary of the division of labour (higher output) and as its agent +(inventing machinery through focused attention). + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +The workman appears throughout the chapter as the primary actor: the pin-maker, +the nailer, the country weaver, the boy at the fire engine. Smith attributes +both the productive gains and many mechanical inventions to ordinary workmen. + +## Economic Domain + +Production diff --git a/examples/infospace-with-history/output/entities/universal-opulence.md b/examples/infospace-with-history/output/entities/universal-opulence.md new file mode 100644 index 00000000..d5675717 --- /dev/null +++ b/examples/infospace-with-history/output/entities/universal-opulence.md @@ -0,0 +1,34 @@ +# Universal Opulence + +## Definition + +The general material well-being that extends across all ranks of society, +including the lowest, as a consequence of the division of labour and the +resulting multiplication of production. Smith argues that through exchange, +every workman can supply others abundantly with their specialised product +and receive in return the products of others' specialisation, creating a +"general plenty" that benefits even the poorest members of a civilised society. + +## Source Chapter + +Book I, Chapter 1: "Of the Division of Labour" + +## Context + +The concluding argument of the chapter. Smith illustrates universal opulence +by examining the "accommodation of the most common artificer or daylabourer," +showing that even a coarse woollen coat requires the cooperation of shepherds, +wool-combers, dyers, weavers, merchants, sailors, and many others — a vast +chain of interdependent labour that would be impossible without specialisation +and exchange. + +## Economic Domain + +Distribution + +## Smith's Original Wording + +"It is the great multiplication of the productions of all the different arts, +in consequence of the division of labour, which occasions, in a well-governed +society, that universal opulence which extends itself to the lowest ranks of +the people." diff --git a/examples/infospace-with-history/output/entities/water-carriage.md b/examples/infospace-with-history/output/entities/water-carriage.md new file mode 100644 index 00000000..17b60d1b --- /dev/null +++ b/examples/infospace-with-history/output/entities/water-carriage.md @@ -0,0 +1,25 @@ +# Water-Carriage + +## Definition + +The transportation of goods by navigable rivers, canals, and sea routes. Smith identifies water-carriage as vastly superior to land-carriage in cost-efficiency, demonstrating that a ship crewed by six to eight men can transport the same quantity of goods as fifty waggons requiring a hundred men and four hundred horses. This cost advantage means that water-carriage dramatically expands the effective market available to producers, enabling finer division of labour. + +## Source Chapter + +Book 1, Chapter 3: "That the Division of Labour is Limited by the Extent of the Market" + +## Context + +Water-carriage is the chapter's primary mechanism for explaining geographic variation in economic development. Smith argues that civilisation and industry naturally arise first on sea-coasts and navigable rivers because water transport opens "a more extensive market... to every sort of industry than what land-carriage alone can afford it." + +## Economic Domain + +Exchange + +## Smith's Original Wording + +> "As by means of water-carriage, a more extensive market is opened to every sort of industry than what land-carriage alone can afford it, so it is upon the sea-coast, and along the banks of navigable rivers, that industry of every kind naturally begins to subdivide and improve itself." + +## Modern Interpretation + +This is an early articulation of how transportation costs shape economic geography. Modern trade theory and economic geography (Krugman's New Economic Geography) formalise the same insight: reductions in transport costs expand effective market size, enabling agglomeration economies and deeper specialisation. diff --git a/examples/infospace-with-history/process_chapters.py b/examples/infospace-with-history/process_chapters.py index 76c83404..5a48d36e 100644 --- a/examples/infospace-with-history/process_chapters.py +++ b/examples/infospace-with-history/process_chapters.py @@ -32,6 +32,7 @@ Usage: """ import argparse +import re import subprocess import sys from pathlib import Path @@ -45,7 +46,8 @@ from markitect.prompts.models import Artifact, ArtifactType from markitect.prompts.repositories.sqlite import SQLiteArtifactRepository from markitect.prompts.dependencies.repository import SQLiteDependencyRepository from markitect.prompts.services.artifact_service import ArtifactService -from markitect.prompts.templates.models import PromptTemplate, ContentMacro, MacroKind +from markitect.prompts.templates.models import PromptTemplate +from markitect.prompts.templates.analyzer import TemplateAnalyzer from markitect.prompts.resolver.resolver import PromptResolver from markitect.prompts.resolver.compiler import ContextCompiler from markitect.prompts.resolver.strategy import ResolutionConfig, MultiSpaceResolutionStrategy @@ -80,6 +82,10 @@ class ChapterProcessor: self.artifact_repo, self.dep_repo, db_path=self.db_path ) + # Template analysis and compilation + self.analyzer = TemplateAnalyzer() + self.compiler = ContextCompiler() + # Information spaces self.spaces = { "templates": "infospace-templates", @@ -92,9 +98,6 @@ class ChapterProcessor: "metrics": "infospace-metrics", } - # Content cache (repository stores metadata, we cache content) - self.artifact_content: dict[str, str] = {} - # ── Artifact Management ────────────────────────────────────────── def load_or_create_artifact( @@ -103,7 +106,7 @@ class ChapterProcessor: filepath: Path, artifact_type: ArtifactType, name: Optional[str] = None, - ) -> tuple[Artifact, str]: + ) -> Artifact: """Load artifact from file, create in repo if needed.""" if name is None: name = filepath.stem @@ -112,16 +115,14 @@ class ChapterProcessor: existing = self.artifact_repo.get_by_name(space, name) if existing: - self.artifact_content[existing.id] = content - return existing, content + return existing artifact = Artifact.create( space_id=space, name=name, content=content, artifact_type=artifact_type ) artifact = self.artifact_repo.create(artifact) - self.artifact_content[artifact.id] = content print(f" + {name} ({artifact.content_digest[:8]})") - return artifact, content + return artifact def store_output_artifact( self, space: str, name: str, content: str, artifact_type: ArtifactType @@ -135,7 +136,6 @@ class ChapterProcessor: space_id=space, name=name, content=content, artifact_type=artifact_type ) artifact = self.artifact_repo.create(artifact) - self.artifact_content[artifact.id] = content return artifact def bind_macro_artifact(self, space: str, macro_name: str, content: str) -> Artifact: @@ -151,7 +151,6 @@ class ChapterProcessor: artifact_type=ArtifactType.CONTENT, ) artifact = self.artifact_repo.create(artifact) - self.artifact_content[artifact.id] = content return artifact # ── Setup ──────────────────────────────────────────────────────── @@ -186,23 +185,16 @@ class ChapterProcessor: print(" Done.\n") - # ── Helpers ─────────────────────────────────────────────────────── - - @staticmethod - def _macro(target: str, kind: MacroKind = MacroKind.REQUIRED) -> ContentMacro: - """Create a ContentMacro with correct raw_text for @{target} syntax.""" - return ContentMacro(kind=kind, target=target, raw_text=f"@{{{target}}}") - # ── Template Resolution ────────────────────────────────────────── def resolve_and_compile( - self, template_name: str, macros: list[ContentMacro], extra_spaces: list[str] + self, template_name: str, extra_spaces: list[str] ) -> Optional[str]: """Resolve macros and compile a template into a final prompt string. - Uses the resolver for dependency validation, then performs content - substitution from our local cache (since the artifact repository - doesn't persist content — see resolver.py line 147). + Uses TemplateAnalyzer to parse @{target} macros from the template, + the resolver to look up artifact content, and ContextCompiler to + assemble the final prompt. """ template_artifact = self.artifact_repo.get_by_name( self.spaces["templates"], template_name @@ -212,8 +204,10 @@ class ChapterProcessor: return None template = PromptTemplate.from_artifact(template_artifact) - template.macros = macros - template.analyzed = True + template_content = template_artifact.content + + # Analyze template to extract @{target} macros + self.analyzer.analyze(template, template_content) config = ResolutionConfig( space_id=self.spaces["templates"], @@ -228,31 +222,16 @@ class ChapterProcessor: print(f" ERROR: Resolution failed: {result.context.errors}") return None - # Load template content - template_content = self.artifact_content.get(template_artifact.id) - if not template_content: - template_content = ( - self.example_dir / "templates" / f"{template_name}.md" - ).read_text() + # Compile template with resolved content + compiled = self.compiler.compile(template, template_content, result) + return compiled.content - # Substitute macros with actual content from cache - # (The resolver returns placeholders because the repo doesn't store content) - compiled_content = template_content - for resolved in result.context.resolved_macros: - if resolved.resolved and resolved.artifact: - actual_content = self.artifact_content.get(resolved.artifact.id, "") - compiled_content = compiled_content.replace( - f"@{{{resolved.macro.target}}}", actual_content - ) + # ── LLM Execution Helpers ───────────────────────────────────────── - return compiled_content + def _call_llm(self, prompt: str, stage_label: str) -> Optional[str]: + """Call the LLM and return the content string, or ``None`` on failure. - # ── LLM Execution Helper ──────────────────────────────────────── - - def _execute_llm(self, prompt: str, output_file: Path, stage_label: str) -> Optional[str]: - """Execute *prompt* via the configured LLM adapter and write the result. - - Returns the generated content, or ``None`` on failure. + Does **not** write any files — callers decide where to persist. """ import time as _time from markitect.prompts.execution.models import RunConfig @@ -279,63 +258,254 @@ class ChapterProcessor: print(f" LLM returned empty content") return None - output_file.parent.mkdir(parents=True, exist_ok=True) - output_file.write_text(content) - print(f" LLM output written to {output_file.name}") return content + def _execute_llm(self, prompt: str, output_file: Path, stage_label: str) -> Optional[str]: + """Call the LLM, write the result to *output_file*, and return it.""" + content = self._call_llm(prompt, stage_label) + if content: + output_file.parent.mkdir(parents=True, exist_ok=True) + output_file.write_text(content) + print(f" LLM output written to {output_file.name}") + return content + + # ── Entity Management (flat canonical set) ───────────────────── + + @staticmethod + def _normalize_entity_name(name: str) -> str: + """Normalize an entity name to a kebab-case filename stem.""" + slug = name.lower().strip() + slug = slug.replace("_", "-").replace(" ", "-") + slug = re.sub(r"[^a-z0-9-]", "", slug) + slug = re.sub(r"-{2,}", "-", slug) + return slug.strip("-") + + def _entities_dir(self) -> Path: + return self.example_dir / "output" / "entities" + + def _list_existing_entity_names(self) -> list[str]: + """Return sorted slugs of all canonical entity files already on disk.""" + return sorted( + f.stem + for f in self._entities_dir().glob("*.md") + if not f.name.endswith("-entities.md") + and not f.name.endswith("-prompt.md") + ) + + def _split_entities( + self, combined_content: str + ) -> list[tuple[str, Path]]: + """Split combined LLM output into the flat canonical entity directory. + + Writes each entity to ``output/entities/.md``. If a file + with that slug already exists it is **skipped** (first-occurrence + wins), but the entity is still included in the returned list so + the chapter view can reference it. + + Returns list of (entity_name, file_path) for every entity in + *combined_content* (new and pre-existing alike). + """ + entities_dir = self._entities_dir() + entities_dir.mkdir(parents=True, exist_ok=True) + + parts = re.split( + r"^---\s*ENTITY:\s*(.+?)\s*---\s*$", + combined_content, + flags=re.MULTILINE, + ) + + entity_files: list[tuple[str, Path]] = [] + new_count = 0 + skipped_count = 0 + + for i in range(1, len(parts), 2): + entity_name = parts[i] + entity_content = parts[i + 1].strip() if i + 1 < len(parts) else "" + + slug = self._normalize_entity_name(entity_name) + if not slug: + continue + + file_path = entities_dir / f"{slug}.md" + if file_path.exists(): + skipped_count += 1 + else: + file_path.write_text(entity_content + "\n") + new_count += 1 + + entity_files.append((entity_name, file_path)) + + msg = f" {new_count} new entities written" + if skipped_count: + msg += f", {skipped_count} pre-existing (skipped)" + print(msg) + return entity_files + + def _write_chapter_entity_view( + self, chapter_id: str, entity_files: list[tuple[str, Path]] + ) -> Path: + """Write a per-chapter view file that transcludes individual entities.""" + parts = chapter_id.split("-") + book_num = int(parts[1]) if len(parts) >= 2 else 1 + ch_num = int(parts[3]) if len(parts) >= 4 else 0 + roman = {1: "I", 2: "II", 3: "III", 4: "IV", 5: "V"}.get(book_num, str(book_num)) + title = f"# Economic Entities — Book {roman}, Chapter {ch_num}\n" + + lines = [title] + for _name, file_path in entity_files: + lines.append(f'{{{{ include "{file_path.name}" }}}}') + lines.append("") + lines.append("---") + lines.append("") + + # Remove trailing separator after last entity + if lines and lines[-1] == "" and len(lines) >= 3 and lines[-2] == "---": + lines = lines[:-2] + + view_path = self._entities_dir() / f"{chapter_id}-entities.md" + view_path.write_text("\n".join(lines) + "\n") + print(f" Chapter view written to {view_path.name}") + return view_path + + def _read_entities_from_view( + self, chapter_id: str + ) -> tuple[str, list[tuple[str, Path]]]: + """Reconstruct combined entity content from a chapter view file. + + Parses ``{{ include "..." }}`` directives in the view to discover + which canonical entity files belong to this chapter, reads them, + and rebuilds the delimited combined content needed by downstream + stages. + """ + from markitect.packaging.transclusion.directives import DirectiveParser + + view_path = self._entities_dir() / f"{chapter_id}-entities.md" + view_content = view_path.read_text() + includes = DirectiveParser.extract_file_includes(view_content) + + entities_dir = self._entities_dir() + entity_files: list[tuple[str, Path]] = [] + parts: list[str] = [] + + for rel_path in includes: + file_path = entities_dir / rel_path + if not file_path.exists(): + continue + slug = file_path.stem + body = file_path.read_text().strip() + parts.append(f"--- ENTITY: {slug} ---\n\n{body}") + entity_files.append((slug, file_path)) + + combined = "\n\n".join(parts) + "\n" if parts else "" + return combined, entity_files + # ── Pipeline Stages ────────────────────────────────────────────── def stage_extract_entities(self, chapter_id: str, chapter_content: str) -> Optional[str]: - """Stage 1: Extract economic entities from a chapter.""" + """Stage 1: Extract economic entities from a chapter. + + Canonical entity files live in a **flat** directory + (``output/entities/.md``). Duplicates across chapters are + skipped — first occurrence wins. The per-chapter view file + (``-entities.md``) is a **secondary** transclusion view + that ``{{ include }}``s each entity relevant to the chapter. + """ print(f" [1/3] Extracting entities...") # Bind the chapter content to the macro name self.bind_macro_artifact(self.spaces["sources"], "chapter_text", chapter_content) - macros = [ - self._macro("chapter_text"), - self._macro("extraction_rules"), - self._macro("vsm_framework"), - ] + # Bind existing entity list so the LLM knows what already exists + existing = self._list_existing_entity_names() + if existing: + entity_list = "\n".join(f"- {name}" for name in existing) + else: + entity_list = "(none — this is the first chapter)" + self.bind_macro_artifact( + self.spaces["entities"], "existing_entities", entity_list + ) prompt = self.resolve_and_compile( - "extract-entities", macros, ["sources", "guidelines", "vsm-reference"] + "extract-entities", + ["sources", "guidelines", "vsm-reference", "entities"], ) if not prompt: return None - # Write compiled prompt for inspection / LLM execution - prompt_file = self.example_dir / "output" / "entities" / f"{chapter_id}-prompt.md" + # Write compiled prompt for inspection + prompt_file = self._entities_dir() / f"{chapter_id}-prompt.md" + prompt_file.parent.mkdir(parents=True, exist_ok=True) prompt_file.write_text(prompt) print(f" Prompt written to {prompt_file.relative_to(self.example_dir)}") - # Check for existing output (manual or LLM-generated) - output_file = self.example_dir / "output" / "entities" / f"{chapter_id}-entities.md" - if output_file.exists(): - content = output_file.read_text() + view_file = self._entities_dir() / f"{chapter_id}-entities.md" + + # ── PRIMARY: chapter view with transclusion already on disk ── + if view_file.exists() and "{{ include" in view_file.read_text(): + content, entity_files = self._read_entities_from_view(chapter_id) self.store_output_artifact( self.spaces["entities"], f"{chapter_id}-entities", content, ArtifactType.GENERATED, ) - print(f" Found existing output: {output_file.name}") + print(f" Found chapter view referencing {len(entity_files)} entities") return content - # Auto-generate via LLM if adapter is available - if self.llm_adapter and prompt: - content = self._execute_llm(prompt, output_file, "entities") - if content: + # ── MIGRATION: per-chapter subdirectory (previous format) ── + subdir = self._entities_dir() / chapter_id + if subdir.is_dir() and list(subdir.glob("*.md")): + print(f" Migrating per-chapter subdir: {chapter_id}/") + entity_files: list[tuple[str, Path]] = [] + entities_dir = self._entities_dir() + for src in sorted(subdir.glob("*.md")): + dest = entities_dir / src.name + if not dest.exists(): + src.rename(dest) + entity_files.append((src.stem, dest)) + # Clean up empty subdir + if not list(subdir.glob("*")): + subdir.rmdir() + self._write_chapter_entity_view(chapter_id, entity_files) + content = self._read_entities_from_view(chapter_id)[0] + self.store_output_artifact( + self.spaces["entities"], + f"{chapter_id}-entities", + content, + ArtifactType.GENERATED, + ) + return content + + # ── MIGRATION: legacy combined file (pre-split format) ── + if view_file.exists(): + raw = view_file.read_text() + if "--- ENTITY:" in raw: + print(f" Migrating legacy combined file: {view_file.name}") + entity_files = self._split_entities(raw) + self._write_chapter_entity_view(chapter_id, entity_files) self.store_output_artifact( self.spaces["entities"], f"{chapter_id}-entities", - content, + raw, ArtifactType.GENERATED, ) - return content + return raw - print(f" Awaiting output at: {output_file.relative_to(self.example_dir)}") + # ── GENERATE: call LLM, persist individual files first ── + if self.llm_adapter and prompt: + combined = self._call_llm(prompt, "entities") + if combined: + entity_files = self._split_entities(combined) + self._write_chapter_entity_view(chapter_id, entity_files) + self.store_output_artifact( + self.spaces["entities"], + f"{chapter_id}-entities", + combined, + ArtifactType.GENERATED, + ) + return combined + + print(f" Awaiting entity files in: output/entities/") return None def stage_map_to_vsm(self, chapter_id: str, entities_content: str) -> Optional[str]: @@ -344,14 +514,8 @@ class ChapterProcessor: self.bind_macro_artifact(self.spaces["entities"], "entities", entities_content) - macros = [ - self._macro("entities"), - self._macro("vsm_framework"), - self._macro("mapping_rules"), - ] - prompt = self.resolve_and_compile( - "map-to-vsm", macros, ["entities", "vsm-reference", "guidelines"] + "map-to-vsm", ["entities", "vsm-reference", "guidelines"] ) if not prompt: return None @@ -396,16 +560,8 @@ class ChapterProcessor: self.bind_macro_artifact(self.spaces["entities"], "entities", entities_content) self.bind_macro_artifact(self.spaces["mappings"], "mappings", mappings_content) - macros = [ - self._macro("chapter_text"), - self._macro("entities"), - self._macro("mappings"), - self._macro("vsm_framework"), - ] - prompt = self.resolve_and_compile( "synthesize-analysis", - macros, ["sources", "entities", "mappings", "vsm-reference"], ) if not prompt: @@ -462,13 +618,8 @@ class ChapterProcessor: self.bind_macro_artifact(self.spaces["analyses"], "all_analyses", combined) - macros = [ - self._macro("all_analyses"), - self._macro("vsm_framework"), - ] - prompt = self.resolve_and_compile( - "assess-metrics", macros, ["analyses", "vsm-reference"] + "assess-metrics", ["analyses", "vsm-reference"] ) if not prompt: return None @@ -615,11 +766,20 @@ class ChapterProcessor: print(f" {'-'*30} {'-'*12} {'-'*12} {'-'*12}") for ch in chapters: - entities = "done" if (self.example_dir / "output" / "entities" / f"{ch}-entities.md").exists() else "-" + view_file = self._entities_dir() / f"{ch}-entities.md" + entity_count = 0 + if view_file.exists() and "{{ include" in view_file.read_text(): + from markitect.packaging.transclusion.directives import DirectiveParser + entity_count = len(DirectiveParser.extract_file_includes(view_file.read_text())) + entities = f"done ({entity_count})" if entity_count else "-" mappings = "done" if (self.example_dir / "output" / "mappings" / f"{ch}-mappings.md").exists() else "-" analysis = "done" if (self.example_dir / "output" / "analyses" / f"{ch}-analysis.md").exists() else "-" print(f" {ch:<30} {entities:<12} {mappings:<12} {analysis:<12}") + total_entities = len(self._list_existing_entity_names()) + if total_entities: + print(f"\n Canonical entity set: {total_entities} unique entities") + # ── Statistics ─────────────────────────────────────────────────── def show_stats(self): diff --git a/examples/infospace-with-history/templates/extract-entities.md b/examples/infospace-with-history/templates/extract-entities.md index eb2e6d16..871349fa 100644 --- a/examples/infospace-with-history/templates/extract-entities.md +++ b/examples/infospace-with-history/templates/extract-entities.md @@ -20,22 +20,33 @@ but do not exclude entities simply because they lack an obvious mapping. @{vsm_framework} +## Existing Entities + +The following entities have already been extracted from previous chapters +of this work. Do NOT re-extract any of these. If one of these entities +appears in the current chapter, you may omit it entirely — the infospace +already contains it. Only extract entities that are genuinely new. + +@{existing_entities} + ## 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 +2. Review the list of existing entities above and do not duplicate them. +3. Identify all distinct economic concepts, actors, mechanisms, and institutions + that are NOT already in the existing entities list. +4. For each new entity, produce a separate markdown document following the Economic Entity Schema v1.0. -4. Each entity document must include: +5. 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 +6. 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. +7. Use neutral, analytical language throughout. +8. Ensure each entity is distinct and self-contained. ## Output Format