feat(infospace): add L2 entity classification with type × VSM matrix (S2.9)

Implements the L2 typed-entities layer — each entity is assigned an
Entity Type (Element, Process, Relation, Principle, Institution) and a
VSM System (S1–S5) by an LLM, with one-sentence rationales for each.

New modules:
- markitect/infospace/classification.py — EntityClassification dataclass
  + ENTITY_TYPES / VSM_SYSTEMS controlled vocabularies
- markitect/infospace/classification_io.py — write/read classification
  files (YAML frontmatter + markdown body, mirrors evaluation_io)
- markitect/infospace/classifier.py — build_classification_prompt(),
  parse_classification_response(), run_entity_classification(); batch
  runner writes files incrementally (same resumable pattern as evaluate)

CLI: markitect infospace classify [--entity SLUG] [--provider P] [--model M]
  - Incremental skip: checks output/classifications/ for existing files
  - Defaults to openrouter provider; 2000 max_tokens (Gemini 2.5 Flash
    uses ~787 thinking tokens, so 800 was too low)

CLI: markitect infospace classify-summary [--update-metrics]
  - Entity type counts + VSM system counts with percentages
  - 5 × 6 type × VSM matrix (spots structural blind spots at a glance)
  - --update-metrics writes type_distribution, type_entropy,
    vsm_type_matrix_cells to metrics.yaml

Config: InfospaceConfig gains classifications_dir (default output/classifications)
Schema: schemas/typed-entity-schema-v1.0.md — type/VSM vocabulary tables,
  rationale format rules, validation rules, metrics enabled at L2
infospace.yaml: schemas.typed_entity references typed-entity-schema-v1.0.md

Seed classifications (3): division_of_labour (Process/S1),
  natural_price_as_central_price (Principle/S2),
  invisible_hand_mechanism (Principle/S4)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 09:35:58 +01:00
parent 2d45425b25
commit 81a4c8796a
10 changed files with 789 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ schemas:
mapping: schemas/vsm-mapping-schema-v1.0.md
analysis: schemas/chapter-analysis-schema-v1.0.md
relation: schemas/relation-schema-v1.0.md
typed_entity: schemas/typed-entity-schema-v1.0.md
competency_questions: |
1. How does Smith's division of labour map to VSM System 1 operations?

View File

@@ -0,0 +1,30 @@
---
entity_slug: division_of_labour
entity_type: Process
vsm_system: S1
type_rationale: The definition describes "the separation of a work process into distinct
tasks performed by specialised workers," which is an activity or transformation
in how work is conducted.
vsm_rationale: Division of Labour directly concerns the organization and execution
of "productive activities" by specialized workers to increase output, which is the
core function of S1.
classified_at: '2026-02-23T05:14:54.928218'
---
# Classification: Division Of Labour
## Entity Type
Process
## VSM System
S1
## Type Rationale
The definition describes "the separation of a work process into distinct tasks performed by specialised workers," which is an activity or transformation in how work is conducted.
## VSM Rationale
Division of Labour directly concerns the organization and execution of "productive activities" by specialized workers to increase output, which is the core function of S1.

View File

@@ -0,0 +1,30 @@
---
entity_slug: invisible_hand_mechanism
entity_type: Principle
vsm_system: S4
type_rationale: The Invisible Hand Mechanism is an abstract theoretical claim about
how individual self-interest unintentionally leads to broader public welfare, functioning
as a fundamental rule of market operation.
vsm_rationale: The Invisible Hand Mechanism describes the system's inherent capacity
for adaptation and self-organization, producing beneficial outcomes from individual
actions without central direction, aligning with S4's function of intelligence.
classified_at: '2026-02-23T05:15:10.936874'
---
# Classification: Invisible Hand Mechanism
## Entity Type
Principle
## VSM System
S4
## Type Rationale
The Invisible Hand Mechanism is an abstract theoretical claim about how individual self-interest unintentionally leads to broader public welfare, functioning as a fundamental rule of market operation.
## VSM Rationale
The Invisible Hand Mechanism describes the system's inherent capacity for adaptation and self-organization, producing beneficial outcomes from individual actions without central direction, aligning with S4's function of intelligence.

View File

@@ -0,0 +1,30 @@
---
entity_slug: natural_price_as_central_price
entity_type: Principle
vsm_system: S2
type_rationale: The natural price is an abstract concept describing an equilibrium
point and a tendency for market prices to gravitate towards it, functioning as a
fundamental economic law.
vsm_rationale: The natural price acts as a central price signal that coordinates market
activity by drawing fluctuating market prices towards an equilibrium, thereby performing
an anti-oscillation function.
classified_at: '2026-02-23T05:15:04.916853'
---
# Classification: Natural Price As Central Price
## Entity Type
Principle
## VSM System
S2
## Type Rationale
The natural price is an abstract concept describing an equilibrium point and a tendency for market prices to gravitate towards it, functioning as a fundamental economic law.
## VSM Rationale
The natural price acts as a central price signal that coordinates market activity by drawing fluctuating market prices towards an equilibrium, thereby performing an anti-oscillation function.

View File

@@ -0,0 +1,126 @@
# Typed Entity Schema v1.0
Extends the economic entity schema with two classification fields produced
by the L2 `classify-entities` pipeline stage. An entity that has passed
through L2 classification has been assigned an **Entity Type** and a
**VSM System** by an LLM, each with a one-sentence rationale.
---
## Additional Sections
The following sections are added to the base entity file (or stored as
separate classification files in `output/classifications/`):
### Entity Type
**Required.** One of the five controlled values below.
| Value | Definition |
|---|---|
| **Element** | A stock, agent, artifact, or institution that persists — a *noun*, something that exists independently (e.g. Capital Stock, Corn, Colony, Guild) |
| **Process** | A flow, activity, or transformation with duration — something that *happens* rather than *exists* (e.g. Division of Labour, Credit Extension, Trade Route) |
| **Relation** | A structural dependency or causal link between two elements — a *connector* or mechanism (e.g. Rent determined by Price; Wages bounded by Profit Margin) |
| **Principle** | An abstract law or invariant that holds across contexts — a rule or theoretical claim (e.g. Comparative Advantage, Diminishing Returns, Opportunity Cost) |
| **Institution** | A socially constructed rule system, norm, or governance structure (e.g. Banking System, Apprenticeship Law, Taille, Navigation Acts) |
**Note:** Types are not mutually exclusive at the margin — *Market Price*
is both a Relation (between cost components and clearing condition) and an
emergent property of an Element (the market). Assign the **primary** type:
the one that best explains the entity's role in Smith's argument.
### VSM System
**Required.** One of the six controlled values below.
| Value | Beer's definition | WoN examples |
|---|---|---|
| **S1** | Primary operations — the productive activities of the system | Agricultural labour, manufacturing, carrying trade |
| **S2** | Coordination — anti-oscillation, price signals between operations | Market Price, Natural Price, Wages of Labour |
| **S3** | Management — resource allocation and operational control | Capital Allocation, Banking, Taxation |
| **S3\*** | Audit — inspection, compliance, integrity checking | Customs Enforcement, Assay, Coinage |
| **S4** | Intelligence — adaptation, environmental scanning | Invisible Hand, Comparative Advantage, Foreign Trade Intelligence |
| **S5** | Policy — identity, ultimate authority, normative purpose | Mercantile System, System of Natural Liberty, Public Debt Policy |
### Type Rationale
**Required.** One sentence explaining why this Entity Type was assigned,
grounded in the entity definition.
> *Example:* "Capital Stock is a persistent stock of accumulated resources
> that enables productive operations, making it an Element rather than a
> Process."
### VSM Rationale
**Required.** One sentence grounding the VSM assignment in Beer's
definitions as applied to the WoN domain.
> *Example:* "Capital Stock is deployed at the operational level to
> produce goods and services, placing it squarely within S1 (primary
> operations)."
---
## Validation Rules
1. **Entity Type** MUST be one of: Element, Process, Relation, Principle,
Institution. Any other value is a validation error.
2. **VSM System** MUST be one of: S1, S2, S3, S3*, S4, S5.
3. **Type Rationale** and **VSM Rationale** MUST be non-empty strings.
4. A classification file for slug `X` MUST be stored at
`output/classifications/X.md`.
---
## Metrics Enabled by L2
Once all entities are classified, the following collection-level metrics
become available:
| Metric | Concern | Question |
|---|---|---|
| **type_distribution** | Granularity | Is the collection balanced? |
| **vsm_type_matrix_cells** | Coverage | How many (type, VSM) coordinate pairs are occupied? |
| **type_entropy** | Granularity | Is the type distribution diverse or dominated by one type? |
| **orphan_relations** | Coherence | Are Relation-typed entities that name no elements they connect? |
| **principle_grounding** | Consistency | Does each Principle have at least one Element or Process it constrains? |
---
## File Format
Classification files use YAML frontmatter + markdown body:
```markdown
---
entity_slug: capital_stock
entity_type: Element
vsm_system: S1
type_rationale: Capital Stock is a persistent stock of accumulated resources
that enables productive operations.
vsm_rationale: It is the primary productive resource deployed at the
operational level (S1).
classified_by: openrouter/claude-sonnet-4
classified_at: 2026-02-23T14:00:00Z
---
# Classification: Capital Stock
## Entity Type
Element
## VSM System
S1
## Type Rationale
Capital Stock is a persistent stock of accumulated resources that enables
productive operations.
## VSM Rationale
It is the primary productive resource deployed at the operational level (S1).
```