diff --git a/README.md b/README.md index 375a1f7..bb6b323 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,10 @@ Start with: - `docs/legacy-command-parity.md` - `docs/legacy-infospace-migration-guide.md` - `docs/replacement-readiness-decision.md` +- `docs/wealth-vsm-generation-pipeline.md` - `infospaces/bootstrap-pilot/` - `infospaces/wealth-vsm-legacy-slice/` +- `infospaces/wealth-vsm-generation-pilot/` - `workplans/` Current development command: diff --git a/docs/legacy-command-parity.md b/docs/legacy-command-parity.md index 4f92a5d..0770e4e 100644 --- a/docs/legacy-command-parity.md +++ b/docs/legacy-command-parity.md @@ -87,3 +87,12 @@ infospace-bench workflow plan infospaces/bootstrap-pilot bootstrap-readiness infospace-bench workflow run infospaces/bootstrap-pilot bootstrap-readiness ``` +Run the Wealth/VSM one-chapter generation pilot with deterministic assisted +fixtures: + +```bash +infospace-bench workflow run infospaces/wealth-vsm-generation-pilot wealth-vsm-extract-entities --fixture-responses infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml +infospace-bench workflow run infospaces/wealth-vsm-generation-pilot wealth-vsm-map-and-analyze --fixture-responses infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml +infospace-bench workflow run infospaces/wealth-vsm-generation-pilot wealth-vsm-evaluate-entities --fixture-responses infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml +infospace-bench check infospaces/wealth-vsm-generation-pilot +``` diff --git a/docs/replacement-acceptance-matrix.md b/docs/replacement-acceptance-matrix.md index 5a4cb46..f8ff0c8 100644 --- a/docs/replacement-acceptance-matrix.md +++ b/docs/replacement-acceptance-matrix.md @@ -30,6 +30,7 @@ considered a replacement for each in-scope legacy infospace behavior from | Persist durable assets | Optional engine-backed repository adapter | Dry-run sync tests and integration design | `IB-WP-0010` | boundary done | | Run a legacy-derived pilot | Pruned `infospace-with-history` migration | Pilot corpus, migration report, parity comparison | `IB-WP-0011` | done | | Provide command migration path | Legacy command parity guide | Command table, examples, migration guide, decision record, acceptance tests | `IB-WP-0012` | done | +| Regenerate Wealth/VSM pilot | Explicit assisted workflows and deterministic fixtures | One-chapter generation tests, bundle splitting, evaluation metrics, scale-up docs | `IB-WP-0013` | done | ## Replacement Gates diff --git a/docs/wealth-vsm-generation-pipeline.md b/docs/wealth-vsm-generation-pipeline.md new file mode 100644 index 0000000..7078639 --- /dev/null +++ b/docs/wealth-vsm-generation-pipeline.md @@ -0,0 +1,76 @@ +# Wealth VSM Generation Pipeline + +Date: 2026-05-14 + +## Purpose + +This document defines how `infospace-bench` regenerates the Adam Smith +`Wealth of Nations` / VSM infospace through explicit workflows. + +The successor path is workflow-first. It does not reuse the legacy +`process_chapters.py` entrypoint, hide provider calls in a broad command, or +write generated files outside the artifact manifest. + +## Legacy pipeline decomposition + +The old Wealth/VSM experiment in `markitect-main` processed source chapters +through these conceptual stages: + +| Legacy stage | Successor workflow shape | Notes | +| --- | --- | --- | +| `extract-entities` | `wealth-vsm-extract-entities` assisted stage plus `split_entities` stage | Assisted output is a chapter entity bundle; bench splits and registers stable entity artifacts. | +| `map-to-vsm` | `wealth-vsm-map-and-analyze` assisted relation stage | Relation artifacts use the successor relation parser and manifest IDs. | +| `synthesize-analysis` | `wealth-vsm-map-and-analyze` assisted analysis stage | Analysis remains a generated artifact with source provenance. | +| `evaluate-entity` | `wealth-vsm-evaluate-entities` assisted stage | Evaluation files use successor `artifact_id` frontmatter. | +| `assess-metrics` | `infospace-bench check` | Deterministic checks merge generated evaluations into metrics and history. | + +The first golden target is Book I Chapter III because it grounds the existing +`wealth-vsm-legacy-slice` pilot and exercises the market-extent relation. + +## One-chapter pilot + +`infospaces/wealth-vsm-generation-pilot/` contains: + +- one source excerpt: `book-1-chapter-03.md` +- explicit workflow declarations for extraction, VSM mapping/analysis, and + entity evaluation +- deterministic fixture responses for tests +- markdown contracts for generated entity and relation artifacts +- a pilot report comparing the successor workflow shape with the legacy + process script + +Default tests use fixture responses so they do not require network access, +provider credentials, or live model output. + +## Live provider-backed generation + +Any live provider-backed generation should use the same workflow declarations and +the same assisted request records. Provider adapters must be selected +explicitly by the caller and should record provider metadata in workflow run +records and artifact provenance. + +Live runs should document: + +- provider and model +- prompt/template version +- source corpus selection +- retry and rate-limit settings +- expected cost range +- resume strategy +- generated artifact review status + +## Full corpus scale-up + +Scale-up should proceed only after the one-chapter pilot is green. + +Recommended sequence: + +1. Run Book I Chapter III with fixture responses. +2. Run Book I Chapter III with a live provider in a disposable copy. +3. Review generated entities, relations, evaluations, and metrics. +4. Add a small Book I batch with explicit cost and resume notes. +5. Only then run the full corpus. + +The full corpus should not be committed wholesale until it has a current scoped +use, deterministic acceptance coverage, and a migration report explaining what +was generated, reviewed, deferred, or retired. diff --git a/infospaces/wealth-vsm-generation-pilot/artifacts/index.yaml b/infospaces/wealth-vsm-generation-pilot/artifacts/index.yaml new file mode 100644 index 0000000..3e11b3f --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/artifacts/index.yaml @@ -0,0 +1,10 @@ +artifacts: + - id: source/book-1-chapter-03.md + path: artifacts/sources/book-1-chapter-03.md + kind: source + title: Book I Chapter III + provenance: + legacy_path: markitect-main/examples/infospace-with-history/artifacts/sources/book-1-chapter-03.md + pilot_role: one-chapter generation target + relationships: [] + diff --git a/infospaces/wealth-vsm-generation-pilot/artifacts/sources/book-1-chapter-03.md b/infospaces/wealth-vsm-generation-pilot/artifacts/sources/book-1-chapter-03.md new file mode 100644 index 0000000..6a19951 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/artifacts/sources/book-1-chapter-03.md @@ -0,0 +1,23 @@ +--- +id: book-1-chapter-03 +title: THAT THE DIVISION OF LABOUR IS LIMITED BY THE EXTENT OF THE MARKET. +book: "1" +chapter: 3 +artifact_type: content +legacy_source: markitect-main/examples/infospace-with-history/artifacts/sources/book-1-chapter-03.md +--- + +# Book I Chapter III + +## Excerpt + +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. + +When the market is very small, no person can have any encouragement to dedicate +himself entirely to one employment, 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. + diff --git a/infospaces/wealth-vsm-generation-pilot/contracts/economic-entity.contract.md b/infospaces/wealth-vsm-generation-pilot/contracts/economic-entity.contract.md new file mode 100644 index 0000000..7c94dde --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/contracts/economic-entity.contract.md @@ -0,0 +1,25 @@ +# Economic Entity Contract + +```yaml contract +id: economic-entity-generation-pilot +document: + type: economic-entity +sections: + - id: definition + title: Definition + presence: required + level: 2 + - id: source-chapter + title: Source Chapter + presence: required + level: 2 + - id: context + title: Context + presence: required + level: 2 + - id: economic-domain + title: Economic Domain + presence: required + level: 2 +``` + diff --git a/infospaces/wealth-vsm-generation-pilot/contracts/relation.contract.md b/infospaces/wealth-vsm-generation-pilot/contracts/relation.contract.md new file mode 100644 index 0000000..cb7c98e --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/contracts/relation.contract.md @@ -0,0 +1,33 @@ +# Relation Triplet Contract + +```yaml contract +id: relation-triplet-generation-pilot +document: + type: relation-triplet +sections: + - id: subject + title: Subject + presence: required + level: 2 + - id: predicate + title: Predicate + presence: required + level: 2 + - id: object + title: Object + presence: required + level: 2 + - id: relation-type + title: Relation Type + presence: required + level: 2 + - id: vsm-channel + title: VSM Channel + presence: required + level: 2 + - id: evidence + title: Evidence + presence: required + level: 2 +``` + diff --git a/infospaces/wealth-vsm-generation-pilot/infospace.yaml b/infospaces/wealth-vsm-generation-pilot/infospace.yaml new file mode 100644 index 0000000..924e638 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/infospace.yaml @@ -0,0 +1,106 @@ +slug: wealth-vsm-generation-pilot +name: Wealth/VSM Generation Pilot +topic: + name: The Wealth of Nations / VSM Generation Pilot + domain: Classical Economics + sources: artifacts/sources +disciplines: + - name: Viable System Model + path: artifacts/vsm-reference +schemas: + entity: contracts/economic-entity.contract.md + relation: contracts/relation.contract.md +workflows: + - id: wealth-vsm-extract-entities + description: Extract economic entities from a source chapter and split the bundle into manifest artifacts. + inputs: + source: + kind: source + artifact_ids: + - source/book-1-chapter-03.md + static_macros: + discipline: Viable System Model + stages: + - id: extract-entities + kind: assisted + input: source + template: workflows/templates/extract-entities.md + provider_hint: explicit-adapter + output: + path: artifacts/generated/{{ input.slug }}-entities-bundle.md + artifact_id: generated/{{ input.slug }}-entities-bundle.md + kind: generated + title: "{{ input.title }} Entity Bundle" + - id: split-entity-bundle + kind: split_entities + input: source + static_macros: + bundle_stage: extract-entities + expected_evaluations: + - entity-contracts + - metrics + - id: wealth-vsm-map-and-analyze + description: Map generated entities to VSM relation artifacts and produce chapter analysis. + inputs: + source: + kind: source + artifact_ids: + - source/book-1-chapter-03.md + static_macros: + discipline: Viable System Model + stages: + - id: map-to-vsm + kind: assisted + input: source + template: workflows/templates/map-to-vsm.md + provider_hint: explicit-adapter + output: + path: artifacts/relations/division-of-labour-constrains-market-extent.md + artifact_id: relation/division-of-labour-constrains-market-extent.md + kind: relation + title: Division of Labour constrains Market Extent + - id: synthesize-analysis + kind: assisted + input: source + template: workflows/templates/synthesize-analysis.md + provider_hint: explicit-adapter + output: + path: artifacts/generated/{{ input.slug }}-analysis.md + artifact_id: generated/{{ input.slug }}-analysis.md + kind: generated + title: "{{ input.title }} VSM Analysis" + expected_evaluations: + - relation-contracts + - metrics + - id: wealth-vsm-evaluate-entities + description: Evaluate generated entity artifacts using successor artifact_id semantics. + inputs: + entity: + kind: entity + static_macros: + discipline: Viable System Model + stages: + - id: evaluate-entity + kind: assisted + input: entity + template: workflows/templates/evaluate-entity.md + provider_hint: explicit-adapter + output: + path: output/evaluations/{{ input.slug }}.md + artifact_id: evaluation/{{ input.slug }}.md + kind: evaluation + title: "{{ input.title }} Evaluation" + expected_evaluations: + - metrics +viability: + coverage_ratio: + min: 0.5 + redundancy_ratio: + max: 0.1 + coherence_components: + max: 3 + consistency_cycles: + max: 0 + per_artifact_mean: + min: 3.5 + diff --git a/infospaces/wealth-vsm-generation-pilot/reports/generation-pilot-report.md b/infospaces/wealth-vsm-generation-pilot/reports/generation-pilot-report.md new file mode 100644 index 0000000..9935727 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/reports/generation-pilot-report.md @@ -0,0 +1,39 @@ +# Wealth/VSM Generation Pilot Report + +## Summary + +This pilot proves one-chapter regeneration for the Adam Smith Wealth/VSM +infospace using explicit `infospace-bench` workflows, not the legacy process +script. + +This is not the legacy process script; it is the successor workflow shape. + +## One-Chapter Target + +- Source: Book I Chapter III +- Legacy alignment: `markitect-main/examples/infospace-with-history` +- Successor pilot: `infospaces/wealth-vsm-generation-pilot` + +## Workflow Shape + +- `wealth-vsm-extract-entities` produces a generated entity bundle and splits + it into stable entity artifacts. +- `wealth-vsm-map-and-analyze` produces a relation artifact and generated + chapter analysis. +- `wealth-vsm-evaluate-entities` produces evaluation Markdown files using + successor `artifact_id` semantics. +- `infospace-bench check` merges deterministic collection checks and generated + evaluations into metrics history. + +## Comparison To Legacy + +The legacy implementation centered on a large `process_chapters.py` script with +implicit provider execution and output conventions. This pilot keeps provider +work explicit through assisted requests and records generated outputs through +the manifest or evaluation history. + +## Scale-Up Notes + +Full-corpus generation should happen only after reviewing one live +provider-backed run. Cost, model, prompt version, retry settings, and resume +strategy should be recorded before processing more chapters. diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-analysis.md b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-analysis.md new file mode 100644 index 0000000..d11da93 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-analysis.md @@ -0,0 +1,19 @@ +# Book I Chapter III VSM Analysis + +## Summary + +The chapter describes a viability constraint: operational specialization can +increase productive power only when the exchange environment is large enough to +absorb specialized surplus. + +## VSM Interpretation + +Division of Labour behaves like a System 1 operational pattern. Market Extent +acts as an environmental and coordination constraint around those operations. +The generated relation records the structural dependency that makes +specialization viable only at sufficient market scale. + +## Provenance + +Generated by the fixture adapter for the one-chapter successor workflow pilot. + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-entities-bundle.md b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-entities-bundle.md new file mode 100644 index 0000000..4582b81 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-entities-bundle.md @@ -0,0 +1,52 @@ +# Division of Labour + +## Definition + +The separation of work into specialized tasks that increases productivity and depends on opportunities for exchange. + +## Source Chapter + +Book I, Chapter 3 + +## Context + +Smith explains that the power of exchanging gives occasion to the division of labour, but that this division is constrained by how much exchange the market can support. + +## Economic Domain + +Production + +## Original Wording + +Smith writes that the power of exchanging gives occasion to the division of labour. + +## Modern Interpretation + +Specialization works only when producers can exchange specialized output for the goods they need. + +# Market Extent + +## Definition + +The geographical and economic reach of exchange that determines whether specialized producers can find enough demand for their surplus output. + +## Source Chapter + +Book I, Chapter 3 + +## Context + +Smith states that the extent of the division of labour must always be limited by the extent of the market. + +## Economic Domain + +Exchange + +## Original Wording + +The extent of this division must always be limited by the extent of the market. + +## Modern Interpretation + +Market size sets the practical ceiling for specialization because small markets cannot absorb surplus production. + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-relation.md b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-relation.md new file mode 100644 index 0000000..92d90ef --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/book-1-chapter-03-relation.md @@ -0,0 +1,30 @@ +# Division of Labour constrains Market Extent + +## Subject + +Division of Labour + +## Predicate + +is limited by + +## Object + +Market Extent + +## Relation Type + +constrains + +## VSM Channel + +S2 <- S1 + +## Evidence + +Book I, Chapter 3: "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." + +## Feedback Role + +Market extent constrains specialization; successful specialization can increase surplus exchange and eventually expand the market. + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/division-of-labour-evaluation.md b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/division-of-labour-evaluation.md new file mode 100644 index 0000000..9cc411f --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/division-of-labour-evaluation.md @@ -0,0 +1,51 @@ +--- +artifact_id: entity/division-of-labour.md +evaluator: fixture +evaluated_at: "2026-05-14T12:00:00+00:00" +scores: + - name: definition_precision + value: 4.0 + max_value: 5.0 + rationale: The definition is concise and grounded in exchange-mediated specialization. + - name: source_grounding + value: 5.0 + max_value: 5.0 + rationale: The entity is directly supported by Book I Chapter III. + - name: domain_placement + value: 4.0 + max_value: 5.0 + rationale: Production is the correct primary domain. + - name: vsm_relevance + value: 4.0 + max_value: 5.0 + rationale: The entity maps clearly to System 1 operations and coordination needs. + - name: explanatory_value + value: 5.0 + max_value: 5.0 + rationale: It explains why productive organization depends on exchange scale. +notes: + - Fixture evaluation for the explicit Wealth/VSM workflow pilot. +--- + +# Evaluation: entity/division-of-labour.md + +## definition_precision - 4.0 / 5.0 + +The definition is concise and grounded in exchange-mediated specialization. + +## source_grounding - 5.0 / 5.0 + +The entity is directly supported by Book I Chapter III. + +## domain_placement - 4.0 / 5.0 + +Production is the correct primary domain. + +## vsm_relevance - 4.0 / 5.0 + +The entity maps clearly to System 1 operations and coordination needs. + +## explanatory_value - 5.0 / 5.0 + +It explains why productive organization depends on exchange scale. + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/market-extent-evaluation.md b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/market-extent-evaluation.md new file mode 100644 index 0000000..6ddbe65 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/responses/market-extent-evaluation.md @@ -0,0 +1,51 @@ +--- +artifact_id: entity/market-extent.md +evaluator: fixture +evaluated_at: "2026-05-14T12:00:00+00:00" +scores: + - name: definition_precision + value: 4.0 + max_value: 5.0 + rationale: The definition captures market reach and demand capacity. + - name: source_grounding + value: 5.0 + max_value: 5.0 + rationale: The chapter states the relation directly. + - name: domain_placement + value: 4.0 + max_value: 5.0 + rationale: Exchange is the correct economic domain. + - name: vsm_relevance + value: 4.0 + max_value: 5.0 + rationale: The entity captures the environment that constrains operations. + - name: explanatory_value + value: 4.0 + max_value: 5.0 + rationale: It explains the limit on specialization. +notes: + - Fixture evaluation for the explicit Wealth/VSM workflow pilot. +--- + +# Evaluation: entity/market-extent.md + +## definition_precision - 4.0 / 5.0 + +The definition captures market reach and demand capacity. + +## source_grounding - 5.0 / 5.0 + +The chapter states the relation directly. + +## domain_placement - 4.0 / 5.0 + +Exchange is the correct economic domain. + +## vsm_relevance - 4.0 / 5.0 + +The entity captures the environment that constrains operations. + +## explanatory_value - 4.0 / 5.0 + +It explains the limit on specialization. + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml new file mode 100644 index 0000000..b49846f --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/fixtures/wealth-vsm-fake-responses.yaml @@ -0,0 +1,22 @@ +responses: + - stage_id: extract-entities + input_artifact_id: source/book-1-chapter-03.md + provider: fixture + markdown_path: responses/book-1-chapter-03-entities-bundle.md + - stage_id: map-to-vsm + input_artifact_id: source/book-1-chapter-03.md + provider: fixture + markdown_path: responses/book-1-chapter-03-relation.md + - stage_id: synthesize-analysis + input_artifact_id: source/book-1-chapter-03.md + provider: fixture + markdown_path: responses/book-1-chapter-03-analysis.md + - stage_id: evaluate-entity + input_artifact_id: entity/division-of-labour.md + provider: fixture + markdown_path: responses/division-of-labour-evaluation.md + - stage_id: evaluate-entity + input_artifact_id: entity/market-extent.md + provider: fixture + markdown_path: responses/market-extent-evaluation.md + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/templates/evaluate-entity.md b/infospaces/wealth-vsm-generation-pilot/workflows/templates/evaluate-entity.md new file mode 100644 index 0000000..bf6621f --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/templates/evaluate-entity.md @@ -0,0 +1,12 @@ +# Evaluate Entity + +Discipline: {{ macros.discipline }} +Entity: {{ input.artifact_id }} + +Return a successor evaluation Markdown file with YAML frontmatter containing +artifact_id, evaluator, evaluated_at, and scores. + +## Entity Text + +{{ input.content }} + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/templates/extract-entities.md b/infospaces/wealth-vsm-generation-pilot/workflows/templates/extract-entities.md new file mode 100644 index 0000000..a02d678 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/templates/extract-entities.md @@ -0,0 +1,12 @@ +# Extract Economic Entities + +Discipline: {{ macros.discipline }} +Source: {{ input.artifact_id }} + +Return one Markdown entity document per top-level heading. Each entity must +include Definition, Source Chapter, Context, and Economic Domain sections. + +## Source Text + +{{ input.content }} + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/templates/map-to-vsm.md b/infospaces/wealth-vsm-generation-pilot/workflows/templates/map-to-vsm.md new file mode 100644 index 0000000..9da2d22 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/templates/map-to-vsm.md @@ -0,0 +1,13 @@ +# Map Source To VSM Relation + +Discipline: {{ macros.discipline }} +Source: {{ input.artifact_id }} + +Return one relation triplet that links the generated economic entities and +includes Subject, Predicate, Object, Relation Type, VSM Channel, Evidence, and +Feedback Role sections. + +## Source Text + +{{ input.content }} + diff --git a/infospaces/wealth-vsm-generation-pilot/workflows/templates/synthesize-analysis.md b/infospaces/wealth-vsm-generation-pilot/workflows/templates/synthesize-analysis.md new file mode 100644 index 0000000..1244991 --- /dev/null +++ b/infospaces/wealth-vsm-generation-pilot/workflows/templates/synthesize-analysis.md @@ -0,0 +1,12 @@ +# Synthesize Chapter Analysis + +Discipline: {{ macros.discipline }} +Source: {{ input.artifact_id }} + +Write a concise VSM analysis of the chapter using the generated entities and +relation as evidence. + +## Source Text + +{{ input.content }} + diff --git a/src/infospace_bench/cli.py b/src/infospace_bench/cli.py index 838efa5..b6ef5fe 100644 --- a/src/infospace_bench/cli.py +++ b/src/infospace_bench/cli.py @@ -9,6 +9,7 @@ from pathlib import Path from .checks import run_collection_checks from .engine import engine_capability_contract, plan_asset_sync, sync_assets from .errors import InfospaceError +from .evaluation_io import read_entity_evaluations from .history import ( build_viability_report, find_snapshot, @@ -21,7 +22,12 @@ from .inspection import export_mermaid, relationship_summary from .lifecycle import add_artifact, create_infospace, load_infospace from .markdown_adapter import validate_infospace_artifacts from .semantics import list_entities, list_relations -from .workflow import load_workflows, plan_workflow, run_workflow +from .workflow import ( + FixtureAssistedGenerationAdapter, + load_workflows, + plan_workflow, + run_workflow, +) def build_parser() -> argparse.ArgumentParser: @@ -111,6 +117,11 @@ def build_parser() -> argparse.ArgumentParser: ) workflow_run.add_argument("root") workflow_run.add_argument("workflow_id") + workflow_run.add_argument( + "--fixture-responses", + default="", + help="Run assisted stages with deterministic fixture responses", + ) engine = sub.add_parser("engine", help="Inspect and sync engine boundary state") engine_sub = engine.add_subparsers(dest="engine_command", required=True) @@ -222,7 +233,11 @@ def main(argv: list[str] | None = None) -> int: elif args.command == "check": infospace = load_infospace(Path(args.root)) report = run_collection_checks(infospace.artifacts) - result = record_check_results(infospace.root, report) + result = record_check_results( + infospace.root, + report, + artifact_evaluations=_read_output_evaluations(infospace.root), + ) _write_json( { **result.to_dict(), @@ -253,8 +268,19 @@ def main(argv: list[str] | None = None) -> int: plan_workflow(Path(args.root), args.workflow_id).to_dict() ) elif args.workflow_command == "run": + adapter = ( + FixtureAssistedGenerationAdapter.from_file( + Path(args.fixture_responses) + ) + if args.fixture_responses + else None + ) _write_json( - run_workflow(Path(args.root), args.workflow_id).to_dict() + run_workflow( + Path(args.root), + args.workflow_id, + assisted_adapter=adapter, + ).to_dict() ) else: parser.error(f"Unhandled workflow command: {args.workflow_command}") @@ -328,9 +354,14 @@ def _record_checks(root: Path): return record_check_results( infospace.root, run_collection_checks(infospace.artifacts), + artifact_evaluations=_read_output_evaluations(infospace.root), ) +def _read_output_evaluations(root: Path): + return read_entity_evaluations(root / "output" / "evaluations") + + def _relationship_summary_payload(summary) -> dict: return { "node_count": summary.node_count, diff --git a/src/infospace_bench/evaluation_io.py b/src/infospace_bench/evaluation_io.py index d6fc287..4cecf1d 100644 --- a/src/infospace_bench/evaluation_io.py +++ b/src/infospace_bench/evaluation_io.py @@ -75,6 +75,17 @@ def read_entity_evaluation(path: str | Path) -> EntityEvaluation: ) +def read_entity_evaluations(directory: str | Path) -> list[EntityEvaluation]: + source = Path(directory) + if not source.is_dir(): + return [] + return [ + read_entity_evaluation(path) + for path in sorted(source.glob("*.md")) + if path.is_file() + ] + + def write_snapshot(snapshot: EvaluationSnapshot, path: str | Path) -> None: target = Path(path) target.parent.mkdir(parents=True, exist_ok=True) diff --git a/src/infospace_bench/generation.py b/src/infospace_bench/generation.py new file mode 100644 index 0000000..4e94e23 --- /dev/null +++ b/src/infospace_bench/generation.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from dataclasses import asdict, dataclass +from pathlib import Path +from typing import Any + +from .errors import InfospaceError +from .lifecycle import register_artifact +from .semantics import slugify + + +ENTITY_HEADING_RE = re.compile(r"(?m)^# (?P